1/* 2 * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ArkUI 19 */ 20 21import { TextModifier } from './@ohos.arkui.modifier'; 22 23 24/** 25 * Control style of operation element 26 * @enum { OperationStyle } 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @since 10 29 */ 30/** 31 * Control style of operation element 32 * @enum { OperationStyle } 33 * @syscap SystemCapability.ArkUI.ArkUI.Full 34 * @atomicservice 35 * @since 11 36 */ 37export declare enum OperationType { 38 /** 39 * The TextArrow style. 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @since 10 42 */ 43 /** 44 * The TextArrow style. 45 * @syscap SystemCapability.ArkUI.ArkUI.Full 46 * @atomicservice 47 * @since 11 48 */ 49 TEXT_ARROW = 0, 50 51 /** 52 * The Button style. 53 * @syscap SystemCapability.ArkUI.ArkUI.Full 54 * @since 10 55 */ 56 /** 57 * The Button style. 58 * @syscap SystemCapability.ArkUI.ArkUI.Full 59 * @atomicservice 60 * @since 11 61 */ 62 BUTTON = 1, 63 64 /** 65 * The IconGroup style. 66 * @syscap SystemCapability.ArkUI.ArkUI.Full 67 * @since 10 68 */ 69 /** 70 * The IconGroup style. 71 * @syscap SystemCapability.ArkUI.ArkUI.Full 72 * @atomicservice 73 * @since 11 74 */ 75 ICON_GROUP = 2, 76 77 /** 78 * The LoadingProgress style. 79 * @syscap SystemCapability.ArkUI.ArkUI.Full 80 * @since 10 81 */ 82 /** 83 * The LoadingProgress style. 84 * @syscap SystemCapability.ArkUI.ArkUI.Full 85 * @atomicservice 86 * @since 11 87 */ 88 LOADING = 3 89} 90 91/** 92 * Declare type OperationOption 93 * @syscap SystemCapability.ArkUI.ArkUI.Full 94 * @since 10 95 */ 96/** 97 * Declare type OperationOption 98 * @syscap SystemCapability.ArkUI.ArkUI.Full 99 * @atomicservice 100 * @since 11 101 */ 102export declare class OperationOption { 103 /** 104 * The content of text or the address of icon. 105 * @type { ResourceStr }. 106 * @syscap SystemCapability.ArkUI.ArkUI.Full 107 * @since 10 108 */ 109 /** 110 * The content of text or the address of icon. 111 * @type { ResourceStr }. 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @atomicservice 114 * @since 11 115 */ 116 value: ResourceStr; 117 118 /** 119 * callback function when operate the text or icon. 120 * @type { () => void }. 121 * @syscap SystemCapability.ArkUI.ArkUI.Full 122 * @since 10 123 */ 124 /** 125 * callback function when operate the text or icon. 126 * @type { () => void }. 127 * @syscap SystemCapability.ArkUI.ArkUI.Full 128 * @atomicservice 129 * @since 11 130 */ 131 action?: () => void; 132} 133 134/** 135 * Declare type SelectOption 136 * @syscap SystemCapability.ArkUI.ArkUI.Full 137 * @since 10 138 */ 139/** 140 * Declare type SelectOption 141 * @syscap SystemCapability.ArkUI.ArkUI.Full 142 * @atomicservice 143 * @since 11 144 */ 145export declare class SelectOptions { 146 /** 147 * SubOption array of the select. 148 * @type { Array<SelectSubOption> }. 149 * @syscap SystemCapability.ArkUI.ArkUI.Full 150 * @since 10 151 */ 152 /** 153 * SubOption array of the select. 154 * @type { Array<SelectSubOption> }. 155 * @syscap SystemCapability.ArkUI.ArkUI.Full 156 * @atomicservice 157 * @since 11 158 */ 159 options: Array<SelectOption>; 160 161 /** 162 * The default selected index. 163 * @type { number }. 164 * @syscap SystemCapability.ArkUI.ArkUI.Full 165 * @since 10 166 */ 167 /** 168 * The default selected index. 169 * @type { number }. 170 * @syscap SystemCapability.ArkUI.ArkUI.Full 171 * @atomicservice 172 * @since 11 173 */ 174 selected?: number; 175 176 /** 177 * The default text value. 178 * @type { string }. 179 * @syscap SystemCapability.ArkUI.ArkUI.Full 180 * @since 10 181 */ 182 /** 183 * The default text value. 184 * @type { string }. 185 * @syscap SystemCapability.ArkUI.ArkUI.Full 186 * @atomicservice 187 * @since 11 188 */ 189 value?: string; 190 191 /** 192 * Callback when the select is selected. 193 * @type { (index: number, value?: string) => void }. 194 * @syscap SystemCapability.ArkUI.ArkUI.Full 195 * @since 10 196 */ 197 /** 198 * Callback when the select is selected. 199 * @type { (index: number, value?: string) => void }. 200 * @syscap SystemCapability.ArkUI.ArkUI.Full 201 * @atomicservice 202 * @since 11 203 */ 204 onSelect?: (index: number, value?: string) => void; 205} 206 207/** 208 * Declare type SymbolOptions 209 * @syscap SystemCapability.ArkUI.ArkUI.Full 210 * @atomicservice 211 * @since 12 212 */ 213export declare class SymbolOptions { 214 /** 215 * The size of symbol icon. 216 * @type { ?(number | string | Resource) }. 217 * @syscap SystemCapability.ArkUI.ArkUI.Full 218 * @atomicservice 219 * @since 12 220 */ 221 fontSize?: number | string | Resource; 222 223 /** 224 * The color of symbol icon. 225 * @type { ?(Array<ResourceColor>) }. 226 * @syscap SystemCapability.ArkUI.ArkUI.Full 227 * @atomicservice 228 * @since 12 229 */ 230 fontColor?: Array<ResourceColor>; 231 232 /** 233 * The fontWeight of symbol icon. 234 * @type { ?(number | FontWeight | string) }. 235 * @syscap SystemCapability.ArkUI.ArkUI.Full 236 * @atomicservice 237 * @since 12 238 */ 239 fontWeight?: number | FontWeight | string; 240 241 /** 242 * The effect strategy of symbol icon. 243 * @type { ?(SymbolEffectStrategy) }. 244 * @syscap SystemCapability.ArkUI.ArkUI.Full 245 * @atomicservice 246 * @since 12 247 */ 248 effectStrategy?: SymbolEffectStrategy; 249 250 /** 251 * The rendering strategy of symbol icon. 252 * @type { ?(SymbolRenderingStrategy) }. 253 * @syscap SystemCapability.ArkUI.ArkUI.Full 254 * @atomicservice 255 * @since 12 256 */ 257 renderingStrategy?: SymbolRenderingStrategy; 258} 259 260/** 261 * Declare struct SubHeader 262 * @syscap SystemCapability.ArkUI.ArkUI.Full 263 * @since 10 264 */ 265/** 266 * Declare struct SubHeader 267 * @syscap SystemCapability.ArkUI.ArkUI.Full 268 * @atomicservice 269 * @since 11 270 */ 271@Component 272export declare struct SubHeader { 273 274 /** 275 * Icon resource of content area. 276 * @type { ResourceStr }. 277 * @syscap SystemCapability.ArkUI.ArkUI.Full 278 * @since 10 279 */ 280 /** 281 * Icon resource of content area. 282 * @type { ResourceStr }. 283 * @syscap SystemCapability.ArkUI.ArkUI.Full 284 * @atomicservice 285 * @since 11 286 */ 287 @Prop icon?: ResourceStr; 288 289 /** 290 * Attributes of Symbol icon. 291 * @type { SymbolOptions}. 292 * @syscap SystemCapability.ArkUI.ArkUI.Full 293 * @atomicservice 294 * @since 12 295 */ 296 iconSymbolOptions?: SymbolOptions; 297 298 /** 299 * The first line text of content area. 300 * @type { ResourceStr }. 301 * @syscap SystemCapability.ArkUI.ArkUI.Full 302 * @since 10 303 */ 304 /** 305 * The first line text of content area. 306 * @type { ResourceStr }. 307 * @syscap SystemCapability.ArkUI.ArkUI.Full 308 * @atomicservice 309 * @since 11 310 */ 311 @Prop primaryTitle?: ResourceStr; 312 313 /** 314 * The secondary line text of content area. 315 * @type { ResourceStr }. 316 * @syscap SystemCapability.ArkUI.ArkUI.Full 317 * @since 10 318 */ 319 /** 320 * The secondary line text of content area. 321 * @type { ResourceStr }. 322 * @syscap SystemCapability.ArkUI.ArkUI.Full 323 * @atomicservice 324 * @since 11 325 */ 326 @Prop secondaryTitle?: ResourceStr; 327 328 /** 329 * Select option of content area. 330 * @type { SelectOptions }. 331 * @syscap SystemCapability.ArkUI.ArkUI.Full 332 * @since 10 333 */ 334 /** 335 * Select option of content area. 336 * @type { SelectOptions }. 337 * @syscap SystemCapability.ArkUI.ArkUI.Full 338 * @atomicservice 339 * @since 11 340 */ 341 select?: SelectOptions; 342 343 /** 344 * Operation style of SubHeader. 345 * @type { OperationStyle }. 346 * @syscap SystemCapability.ArkUI.ArkUI.Full 347 * @since 10 348 */ 349 /** 350 * Operation style of SubHeader. 351 * @type { OperationStyle }. 352 * @syscap SystemCapability.ArkUI.ArkUI.Full 353 * @atomicservice 354 * @since 11 355 */ 356 @Prop operationType?: OperationType; 357 358 /** 359 * operation item. 360 * @type { Array<OperationOption> }. 361 * @syscap SystemCapability.ArkUI.ArkUI.Full 362 * @since 10 363 */ 364 /** 365 * operation item. 366 * @type { Array<OperationOption> }. 367 * @syscap SystemCapability.ArkUI.ArkUI.Full 368 * @atomicservice 369 * @since 11 370 */ 371 operationItem?: Array<OperationOption>; 372 373 /** 374 * Attributes of Symbol icons in operation area. 375 * @type { Array<SymbolOptions> }. 376 * @syscap SystemCapability.ArkUI.ArkUI.Full 377 * @atomicservice 378 * @since 12 379 */ 380 operationSymbolOptions?: Array<SymbolOptions>; 381 382 /** 383 * Text modifier for primary title. 384 * @type { TextModifier }. 385 * @syscap SystemCapability.ArkUI.ArkUI.Full 386 * @atomicservice 387 * @since 12 388 */ 389 primaryTitleModifier?: TextModifier; 390 391 /** 392 * Text modifier for secondary title. 393 * @type { TextModifier }. 394 * @syscap SystemCapability.ArkUI.ArkUI.Full 395 * @atomicservice 396 * @since 12 397 */ 398 secondaryTitleModifier?: TextModifier; 399 400 /** 401 * Set the title content. 402 * @type { () => void } 403 * @syscap SystemCapability.ArkUI.ArkUI.Full 404 * @atomicservice 405 * @since 12 406 */ 407 @BuilderParam titleBuilder?: () => void; 408 409 /** 410 * Set the content margin. 411 * @type { ?LocalizedMargin } 412 * @default {start: LengthMetrics.resource($r('sys.float.margin_left')), 413 * <br> end: LengthMetrics.resource($r('sys.float.margin_right'))} 414 * @syscap SystemCapability.ArkUI.ArkUI.Full 415 * @atomicservice 416 * @since 12 417 */ 418 @Prop contentMargin?: LocalizedMargin; 419 420 /** 421 * Set the content padding. 422 * @type { ?LocalizedPadding } 423 * @default set different default values according to the width of the subHeader: 424 * <br> When the left area is secondaryTitle or the group of secondaryTitle and icon, 425 * <br> the default value is {start: LengthMetrics.vp(12), end: LengthMetrics.vp(12)}; 426 * @syscap SystemCapability.ArkUI.ArkUI.Full 427 * @atomicservice 428 * @since 12 429 */ 430 @Prop contentPadding?: LocalizedPadding; 431}