• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2  * Copyright (c) 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 api/@ohos.arkui.advanced.SubHeaderV2.d.ts
18 * @kit ArkUI
19 */
20import { TextModifier as TextModifier } from '@ohos.arkui.modifier';
21
22/**
23 * SubHeaderV2IconType
24 *
25 * @typedef { ResourceStr | SymbolGlyphModifier } SubHeaderV2IconType
26 * @syscap SystemCapability.ArkUI.ArkUI.Full
27 * @crossplatform
28 * @atomicservice
29 * @since 18
30 */
31declare type SubHeaderV2IconType = ResourceStr | SymbolGlyphModifier;
32
33/**
34 * Defines the SubHeaderV2TitleOptions.
35 *
36 * @interface SubHeaderV2TitleOptions
37 * @syscap SystemCapability.ArkUI.ArkUI.Full
38 * @crossplatform
39 * @atomicservice
40 * @since 18
41 */
42export interface SubHeaderV2TitleOptions {
43  /**
44   * The first line text of content area.
45   * @type { ?ResourceStr }.
46   * @syscap SystemCapability.ArkUI.ArkUI.Full
47   * @crossplatform
48   * @atomicservice
49   * @since 18
50   */
51  primaryTitle?: ResourceStr;
52  /**
53   * Text modifier for primary title.
54   * @type { ?TextModifier }.
55   * @syscap SystemCapability.ArkUI.ArkUI.Full
56   * @crossplatform
57   * @atomicservice
58   * @since 18
59   */
60  primaryTitleModifier?: TextModifier;
61  /**
62   * The secondary line text of content area.
63   * @type { ?ResourceStr }.
64   * @syscap SystemCapability.ArkUI.ArkUI.Full
65   * @crossplatform
66   * @atomicservice
67   * @since 18
68   */
69  secondaryTitle?: ResourceStr;
70  /**
71   * Text modifier for secondary title.
72   * @type { ?TextModifier }.
73   * @syscap SystemCapability.ArkUI.ArkUI.Full
74   * @crossplatform
75   * @atomicservice
76   * @since 18
77   */
78  secondaryTitleModifier?: TextModifier;
79}
80
81/**
82 * Declare the SubHeaderV2Title
83 * @syscap SystemCapability.ArkUI.ArkUI.Full
84 * @crossplatform
85 * @atomicservice
86 * @since 18
87 */
88@ObservedV2
89export declare class SubHeaderV2Title {
90  /**
91   * The first line text of content area.
92   * @type { ?ResourceStr }.
93   * @syscap SystemCapability.ArkUI.ArkUI.Full
94   * @crossplatform
95   * @atomicservice
96   * @since 18
97   */
98  @Trace primaryTitle?: ResourceStr;
99  /**
100   * Text modifier for primary title.
101   * @type { ?TextModifier }.
102   * @syscap SystemCapability.ArkUI.ArkUI.Full
103   * @crossplatform
104   * @atomicservice
105   * @since 18
106   */
107  @Trace primaryTitleModifier?: TextModifier;
108  /**
109   * The secondary line text of content area.
110   * @type { ?ResourceStr }.
111   * @syscap SystemCapability.ArkUI.ArkUI.Full
112   * @crossplatform
113   * @atomicservice
114   * @since 18
115   */
116  @Trace secondaryTitle?: ResourceStr;
117  /**
118   * Text modifier for secondary title.
119   * @type { ?TextModifier }.
120   * @syscap SystemCapability.ArkUI.ArkUI.Full
121   * @crossplatform
122   * @atomicservice
123   * @since 18
124   */
125  @Trace secondaryTitleModifier?: TextModifier;
126  /**
127   * The constructor of SubHeaderV2Title
128   *
129   * @param options { SubHeaderV2TitleOptions } the options of the SubHeaderV2Title
130   * @syscap SystemCapability.ArkUI.ArkUI.Full
131   * @crossplatform
132   * @atomicservice
133   * @since 18
134   */
135  constructor(options: SubHeaderV2TitleOptions);
136}
137
138/**
139 * The callback function that will be invoked when the selectedIndex of the SubHeaderV2Select is selected.
140 *
141 * @typedef { function } SubHeaderV2SelectOnSelect
142 * @param { number } selectedIndex - the index of selected item
143 * @param { ?string } selectedContent - the content of selected item
144 * @syscap SystemCapability.ArkUI.ArkUI.Full
145 * @crossplatform
146 * @atomicservice
147 * @since 18
148 */
149export type SubHeaderV2SelectOnSelect = (selectedIndex: number, selectedContent?: string) => void;
150
151/**
152 * Defines the SubHeaderV2SelectOptions.
153 *
154 * @interface SubHeaderV2SelectOptions
155 * @syscap SystemCapability.ArkUI.ArkUI.Full
156 * @crossplatform
157 * @atomicservice
158 * @since 18
159 */
160export interface SubHeaderV2SelectOptions {
161  /**
162   * Sets the options of the SubHeaderV2SelectOptions.
163   *
164   * @type { SelectOption[] }
165   * @syscap SystemCapability.ArkUI.ArkUI.Full
166   * @crossplatform
167   * @atomicservice
168   * @since 18
169   */
170  options: SelectOption[];
171  /**
172   * Sets the selected index of the SubHeaderV2SelectOptions.
173   *
174   * @type { ?number }
175   * @syscap SystemCapability.ArkUI.ArkUI.Full
176   * @crossplatform
177   * @atomicservice
178   * @since 18
179   */
180  selectedIndex?: number;
181  /**
182   * Sets the selected content of the SubHeaderV2SelectOptions.
183   *
184   * @type { ?string }
185   * @syscap SystemCapability.ArkUI.ArkUI.Full
186   * @crossplatform
187   * @atomicservice
188   * @since 18
189   */
190  selectedContent?: string;
191  /**
192   * Sets the onSelect of the SubHeaderV2SelectOptions.
193   *
194   * @type { ?SubHeaderV2SelectOnSelect }
195   * @syscap SystemCapability.ArkUI.ArkUI.Full
196   * @crossplatform
197   * @atomicservice
198   * @since 18
199   */
200  onSelect?: SubHeaderV2SelectOnSelect;
201  /**
202   * Sets the default focus state of SubHeaderV2SelectOptions.
203   * @type { ?boolean }
204   * @default false
205   * @syscap SystemCapability.ArkUI.ArkUI.Full
206   * @crossplatform
207   * @atomicservice
208   * @since 18
209   */
210  defaultFocus?: boolean;
211}
212
213/**
214 * Declare the SubHeaderV2Select
215 * @syscap SystemCapability.ArkUI.ArkUI.Full
216 * @crossplatform
217 * @atomicservice
218 * @since 18
219 */
220@ObservedV2
221export declare class SubHeaderV2Select {
222  /**
223   * Sets the options of the SubHeaderV2SelectOptions.
224   *
225   * @type { SelectOption[] }
226   * @syscap SystemCapability.ArkUI.ArkUI.Full
227   * @crossplatform
228   * @atomicservice
229   * @since 18
230   */
231  @Trace options: SelectOption[];
232  /**
233   * Sets the selected index of the SubHeaderV2SelectOptions.
234   *
235   * @type { ?number }
236   * @syscap SystemCapability.ArkUI.ArkUI.Full
237   * @crossplatform
238   * @atomicservice
239   * @since 18
240   */
241  @Trace selectedIndex?: number;
242  /**
243   * Sets the selected content of the SubHeaderV2SelectOptions.
244   *
245   * @type { ?string }
246   * @syscap SystemCapability.ArkUI.ArkUI.Full
247   * @crossplatform
248   * @atomicservice
249   * @since 18
250   */
251  @Trace selectedContent?: string;
252  /**
253   * Sets the onSelect of the SubHeaderV2SelectOptions.
254   *
255   * @type { ?SubHeaderV2SelectOnSelect }
256   * @syscap SystemCapability.ArkUI.ArkUI.Full
257   * @crossplatform
258   * @atomicservice
259   * @since 18
260   */
261  @Trace onSelect?: SubHeaderV2SelectOnSelect;
262  /**
263   * Sets the default focus state of SubHeaderV2SelectOptions.
264   * @type { ?boolean }
265   * @default false
266   * @syscap SystemCapability.ArkUI.ArkUI.Full
267   * @crossplatform
268   * @atomicservice
269   * @since 18
270   */
271  @Trace defaultFocus?: boolean;
272  /**
273   * The constructor of SubHeaderV2Select
274   *
275   * @param options { SubHeaderV2SelectOptions } the options of the SubHeaderV2Select
276   * @syscap SystemCapability.ArkUI.ArkUI.Full
277   * @crossplatform
278   * @atomicservice
279   * @since 18
280   */
281  constructor(options: SubHeaderV2SelectOptions);
282}
283
284/**
285 * Control style of operation element
286 * @enum { number }
287 * @syscap SystemCapability.ArkUI.ArkUI.Full
288 * @crossplatform
289 * @atomicservice
290 * @since 18
291 */
292export declare enum SubHeaderV2OperationType {
293  /**
294   * The TextArrow style.
295   * @syscap SystemCapability.ArkUI.ArkUI.Full
296   * @crossplatform
297   * @atomicservice
298   * @since 18
299   */
300  TEXT_ARROW = 0,
301  /**
302   * The Button style.
303   * @syscap SystemCapability.ArkUI.ArkUI.Full
304   * @crossplatform
305   * @atomicservice
306   * @since 18
307   */
308  BUTTON = 1,
309  /**
310   * The IconGroup style.
311   * @syscap SystemCapability.ArkUI.ArkUI.Full
312   * @crossplatform
313   * @atomicservice
314   * @since 18
315   */
316  ICON_GROUP = 2,
317  /**
318   * The LoadingProgress style.
319   * @syscap SystemCapability.ArkUI.ArkUI.Full
320   * @crossplatform
321   * @atomicservice
322   * @since 18
323   */
324  LOADING = 3
325}
326
327/**
328 * Defines the action callback of the SubHeaderV2OperationItem.
329 *
330 * @typedef { function } OnClicked
331 * @syscap SystemCapability.ArkUI.ArkUI.Full
332 * @crossplatform
333 * @atomicservice
334 * @since 18
335 */
336export type SubHeaderV2OperationItemAction = () => void;
337
338/**
339 * SubHeaderV2OperationItemType
340 *
341 * @typedef { ResourceStr | SymbolGlyphModifier } SubHeaderV2OperationItemType
342 * @syscap SystemCapability.ArkUI.ArkUI.Full
343 * @crossplatform
344 * @atomicservice
345 * @since 18
346 */
347declare type SubHeaderV2OperationItemType = ResourceStr | SymbolGlyphModifier;
348
349/**
350 * Defines the SubHeaderV2OperationItemOptions.
351 *
352 * @interface SubHeaderV2OperationItemOptions
353 * @syscap SystemCapability.ArkUI.ArkUI.Full
354 * @crossplatform
355 * @atomicservice
356 * @since 18
357 */
358export interface SubHeaderV2OperationItemOptions {
359  /**
360   * The content of text or the address of icon.
361   * @type { SubHeaderV2OperationItemType }.
362   * @syscap SystemCapability.ArkUI.ArkUI.Full
363   * @crossplatform
364   * @atomicservice
365   * @since 18
366   */
367  content: SubHeaderV2OperationItemType;
368  /**
369   * callback function when operate the text or icon.
370   * @type { ?SubHeaderV2OperationItemAction }.
371   * @syscap SystemCapability.ArkUI.ArkUI.Full
372   * @crossplatform
373   * @atomicservice
374   * @since 18
375   */
376  action?: SubHeaderV2OperationItemAction;
377  /**
378   * The accessibilityText of this text or icon.
379   * @type { ?ResourceStr }.
380   * @syscap SystemCapability.ArkUI.ArkUI.Full
381   * @crossplatform
382   * @atomicservice
383   * @since 18
384   */
385  accessibilityText?: ResourceStr;
386  /**
387   * The accessibilityDescription of this text or icon.
388   * @type { ?ResourceStr }
389   * @syscap SystemCapability.ArkUI.ArkUI.Full
390   * @crossplatform
391   * @atomicservice
392   * @since 18
393   */
394  accessibilityDescription?: ResourceStr;
395  /**
396   * The accessibilityLevel of this text or icon.
397   * @type { ?string }
398   * @default "auto".The options are as follows:<br/>
399   *     "auto":The value is converted to "yes" or "no" based on the component.
400   *     "yes": the current component is selectable for the accessibility service.
401   *     "no": The current component is not selectable for the accessibility service.
402   *     "no-hide-descendants":The current component and all its child components are not selectable<br/>
403   *     for the accessibility service.
404   * @syscap SystemCapability.ArkUI.ArkUI.Full
405   * @crossplatform
406   * @atomicservice
407   * @since 18
408   */
409  accessibilityLevel?: string;
410  /**
411   * Sets the default focus state of the text or icon.
412   * @type { ?boolean }
413   * @default false
414   * @syscap SystemCapability.ArkUI.ArkUI.Full
415   * @crossplatform
416   * @atomicservice
417   * @since 18
418   */
419  defaultFocus?: boolean;
420}
421
422/**
423 * Declare the SubHeaderV2OperationItem
424 * @syscap SystemCapability.ArkUI.ArkUI.Full
425 * @crossplatform
426 * @atomicservice
427 * @since 18
428 */
429@ObservedV2
430export declare class SubHeaderV2OperationItem {
431  /**
432   * The content of text or the address of icon.
433   * @type { SubHeaderV2OperationItemType }.
434   * @syscap SystemCapability.ArkUI.ArkUI.Full
435   * @crossplatform
436   * @atomicservice
437   * @since 18
438   */
439  @Trace content: SubHeaderV2OperationItemType;
440  /**
441   * callback function when operate the text or icon.
442   * @type { ?SubHeaderV2OperationItemAction }.
443   * @syscap SystemCapability.ArkUI.ArkUI.Full
444   * @crossplatform
445   * @atomicservice
446   * @since 18
447   */
448  @Trace action?: SubHeaderV2OperationItemAction;
449  /**
450   * The constructor of SubHeaderV2OperationItem
451   *
452   * @param options { SubHeaderV2OperationItemOptions } the options of the SubHeaderV2OperationItem
453   * @syscap SystemCapability.ArkUI.ArkUI.Full
454   * @crossplatform
455   * @atomicservice
456   * @since 18
457   */
458  constructor(options: SubHeaderV2OperationItemOptions);
459  /**
460   * The accessibilityText of this text or icon.
461   * @type { ?ResourceStr }.
462   * @syscap SystemCapability.ArkUI.ArkUI.Full
463   * @crossplatform
464   * @atomicservice
465   * @since 18
466   */
467  @Trace accessibilityText?: ResourceStr;
468  /**
469   * The accessibilityDescription of this text or icon.
470   * @type { ?ResourceStr }
471   * @syscap SystemCapability.ArkUI.ArkUI.Full
472   * @crossplatform
473   * @atomicservice
474   * @since 18
475   */
476  @Trace accessibilityDescription?: ResourceStr;
477  /**
478   * The accessibilityLevel of this text or icon.
479   * @type { ?string }
480   * @default "auto".The options are as follows:<br/>
481   *     "auto":The value is converted to "yes" or "no" based on the component.
482   *     "yes": the current component is selectable for the accessibility service.
483   *     "no": The current component is not selectable for the accessibility service.
484   *     "no-hide-descendants":The current component and all its child components are not selectable<br/>
485   *     for the accessibility service.
486   * @syscap SystemCapability.ArkUI.ArkUI.Full
487   * @crossplatform
488   * @atomicservice
489   * @since 18
490   */
491  @Trace accessibilityLevel?: string;
492  /**
493   * Sets the default focus state of the text or icon.
494   * @type { ?boolean }
495   * @default false
496   * @syscap SystemCapability.ArkUI.ArkUI.Full
497   * @crossplatform
498   * @atomicservice
499   * @since 18
500   */
501  @Trace defaultFocus?: boolean;
502}
503
504/**
505 * The callback function that will be invoked when the title build.
506 *
507 * @typedef { function } SubHeaderV2TitleBuilder
508 * @syscap SystemCapability.ArkUI.ArkUI.Full
509 * @crossplatform
510 * @atomicservice
511 * @since 18
512 */
513export type SubHeaderV2TitleBuilder = () => void;
514
515/**
516 * Defines struct SubHeaderV2.
517 *
518 * @struct SubHeaderV2
519 * @syscap SystemCapability.ArkUI.ArkUI.Full
520 * @crossplatform
521 * @atomicservice
522 * @since 18
523 */
524@ComponentV2
525export declare struct SubHeaderV2 {
526  /**
527   * Sets the icon of the SubHeaderV2.
528   *
529   * @type { ?SubHeaderV2IconType }
530   * @readonly
531   * @syscap SystemCapability.ArkUI.ArkUI.Full
532   * @crossplatform
533   * @atomicservice
534   * @since 18
535   */
536  @Param
537  readonly icon?: SubHeaderV2IconType;
538  /**
539   * Sets the title of the SubHeaderV2.
540   *
541   * @type { ?SubHeaderV2Title }
542   * @readonly
543   * @syscap SystemCapability.ArkUI.ArkUI.Full
544   * @crossplatform
545   * @atomicservice
546   * @since 18
547   */
548  @Param
549  readonly title?: SubHeaderV2Title;
550  /**
551   * Sets the select of the SubHeaderV2.
552   *
553   * @type { ?SubHeaderV2Select }
554   * @readonly
555   * @syscap SystemCapability.ArkUI.ArkUI.Full
556   * @crossplatform
557   * @atomicservice
558   * @since 18
559   */
560  @Param
561  readonly select?: SubHeaderV2Select;
562  /**
563   * Sets the operationType of the SubHeaderV2.
564   *
565   * @type { ?SubHeaderV2OperationType }
566   * @readonly
567   * @syscap SystemCapability.ArkUI.ArkUI.Full
568   * @crossplatform
569   * @atomicservice
570   * @since 18
571   */
572  @Param
573  readonly operationType?: SubHeaderV2OperationType;
574  /**
575   * Sets the operationItems of the SubHeaderV2.
576   *
577   * @type { ?SubHeaderV2OperationItem[] }
578   * @readonly
579   * @syscap SystemCapability.ArkUI.ArkUI.Full
580   * @crossplatform
581   * @atomicservice
582   * @since 18
583   */
584  @Param
585  readonly operationItems?: SubHeaderV2OperationItem[];
586  /**
587   * Set the title content.
588   * @type { ?SubHeaderV2TitleBuilder }
589   * @syscap SystemCapability.ArkUI.ArkUI.Full
590   * @crossplatform
591   * @atomicservice
592   * @since 18
593   */
594  @BuilderParam
595  titleBuilder?: SubHeaderV2TitleBuilder;
596}