• 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  /**
191   * Sets the selected content of the SubHeaderV2SelectOptions.
192   *
193   * @type { ?ResourceStr }
194   * @syscap SystemCapability.ArkUI.ArkUI.Full
195   * @crossplatform
196   * @atomicservice
197   * @since 20
198   */
199  selectedContent?: ResourceStr;
200  /**
201   * Sets the onSelect of the SubHeaderV2SelectOptions.
202   *
203   * @type { ?SubHeaderV2SelectOnSelect }
204   * @syscap SystemCapability.ArkUI.ArkUI.Full
205   * @crossplatform
206   * @atomicservice
207   * @since 18
208   */
209  onSelect?: SubHeaderV2SelectOnSelect;
210  /**
211   * Sets the default focus state of SubHeaderV2SelectOptions.
212   * @type { ?boolean }
213   * @default false
214   * @syscap SystemCapability.ArkUI.ArkUI.Full
215   * @crossplatform
216   * @atomicservice
217   * @since 18
218   */
219  defaultFocus?: boolean;
220}
221
222/**
223 * Declare the SubHeaderV2Select
224 * @syscap SystemCapability.ArkUI.ArkUI.Full
225 * @crossplatform
226 * @atomicservice
227 * @since 18
228 */
229@ObservedV2
230export declare class SubHeaderV2Select {
231  /**
232   * Sets the options of the SubHeaderV2SelectOptions.
233   *
234   * @type { SelectOption[] }
235   * @syscap SystemCapability.ArkUI.ArkUI.Full
236   * @crossplatform
237   * @atomicservice
238   * @since 18
239   */
240  @Trace options: SelectOption[];
241  /**
242   * Sets the selected index of the SubHeaderV2SelectOptions.
243   *
244   * @type { ?number }
245   * @syscap SystemCapability.ArkUI.ArkUI.Full
246   * @crossplatform
247   * @atomicservice
248   * @since 18
249   */
250  @Trace selectedIndex?: number;
251  /**
252   * Sets the selected content of the SubHeaderV2SelectOptions.
253   *
254   * @type { ?string }
255   * @syscap SystemCapability.ArkUI.ArkUI.Full
256   * @crossplatform
257   * @atomicservice
258   * @since 18
259   */
260  /**
261   * Sets the selected content of the SubHeaderV2SelectOptions.
262   *
263   * @type { ?ResourceStr }
264   * @syscap SystemCapability.ArkUI.ArkUI.Full
265   * @crossplatform
266   * @atomicservice
267   * @since 20
268   */
269  @Trace selectedContent?: ResourceStr;
270  /**
271   * Sets the onSelect of the SubHeaderV2SelectOptions.
272   *
273   * @type { ?SubHeaderV2SelectOnSelect }
274   * @syscap SystemCapability.ArkUI.ArkUI.Full
275   * @crossplatform
276   * @atomicservice
277   * @since 18
278   */
279  @Trace onSelect?: SubHeaderV2SelectOnSelect;
280  /**
281   * Sets the default focus state of SubHeaderV2SelectOptions.
282   * @type { ?boolean }
283   * @default false
284   * @syscap SystemCapability.ArkUI.ArkUI.Full
285   * @crossplatform
286   * @atomicservice
287   * @since 18
288   */
289  @Trace defaultFocus?: boolean;
290  /**
291   * The constructor of SubHeaderV2Select
292   *
293   * @param options { SubHeaderV2SelectOptions } the options of the SubHeaderV2Select
294   * @syscap SystemCapability.ArkUI.ArkUI.Full
295   * @crossplatform
296   * @atomicservice
297   * @since 18
298   */
299  constructor(options: SubHeaderV2SelectOptions);
300}
301
302/**
303 * Control style of operation element
304 * @enum { number }
305 * @syscap SystemCapability.ArkUI.ArkUI.Full
306 * @crossplatform
307 * @atomicservice
308 * @since 18
309 */
310export declare enum SubHeaderV2OperationType {
311  /**
312   * The TextArrow style.
313   * @syscap SystemCapability.ArkUI.ArkUI.Full
314   * @crossplatform
315   * @atomicservice
316   * @since 18
317   */
318  TEXT_ARROW = 0,
319  /**
320   * The Button style.
321   * @syscap SystemCapability.ArkUI.ArkUI.Full
322   * @crossplatform
323   * @atomicservice
324   * @since 18
325   */
326  BUTTON = 1,
327  /**
328   * The IconGroup style.
329   * @syscap SystemCapability.ArkUI.ArkUI.Full
330   * @crossplatform
331   * @atomicservice
332   * @since 18
333   */
334  ICON_GROUP = 2,
335  /**
336   * The LoadingProgress style.
337   * @syscap SystemCapability.ArkUI.ArkUI.Full
338   * @crossplatform
339   * @atomicservice
340   * @since 18
341   */
342  LOADING = 3
343}
344
345/**
346 * Defines the action callback of the SubHeaderV2OperationItem.
347 *
348 * @typedef { function } OnClicked
349 * @syscap SystemCapability.ArkUI.ArkUI.Full
350 * @crossplatform
351 * @atomicservice
352 * @since 18
353 */
354export type SubHeaderV2OperationItemAction = () => void;
355
356/**
357 * SubHeaderV2OperationItemType
358 *
359 * @typedef { ResourceStr | SymbolGlyphModifier } SubHeaderV2OperationItemType
360 * @syscap SystemCapability.ArkUI.ArkUI.Full
361 * @crossplatform
362 * @atomicservice
363 * @since 18
364 */
365declare type SubHeaderV2OperationItemType = ResourceStr | SymbolGlyphModifier;
366
367/**
368 * Defines the SubHeaderV2OperationItemOptions.
369 *
370 * @interface SubHeaderV2OperationItemOptions
371 * @syscap SystemCapability.ArkUI.ArkUI.Full
372 * @crossplatform
373 * @atomicservice
374 * @since 18
375 */
376export interface SubHeaderV2OperationItemOptions {
377  /**
378   * The content of text or the address of icon.
379   * @type { SubHeaderV2OperationItemType }.
380   * @syscap SystemCapability.ArkUI.ArkUI.Full
381   * @crossplatform
382   * @atomicservice
383   * @since 18
384   */
385  content: SubHeaderV2OperationItemType;
386  /**
387   * callback function when operate the text or icon.
388   * @type { ?SubHeaderV2OperationItemAction }.
389   * @syscap SystemCapability.ArkUI.ArkUI.Full
390   * @crossplatform
391   * @atomicservice
392   * @since 18
393   */
394  action?: SubHeaderV2OperationItemAction;
395  /**
396   * The accessibilityText of this text or icon.
397   * @type { ?ResourceStr }.
398   * @syscap SystemCapability.ArkUI.ArkUI.Full
399   * @crossplatform
400   * @atomicservice
401   * @since 18
402   */
403  accessibilityText?: ResourceStr;
404  /**
405   * The accessibilityDescription of this text or icon.
406   * @type { ?ResourceStr }
407   * @syscap SystemCapability.ArkUI.ArkUI.Full
408   * @crossplatform
409   * @atomicservice
410   * @since 18
411   */
412  accessibilityDescription?: ResourceStr;
413  /**
414   * The accessibilityLevel of this text or icon.
415   * @type { ?string }
416   * @default "auto".The options are as follows:<br/>
417   *     "auto":The value is converted to "yes" or "no" based on the component.
418   *     "yes": the current component is selectable for the accessibility service.
419   *     "no": The current component is not selectable for the accessibility service.
420   *     "no-hide-descendants":The current component and all its child components are not selectable<br/>
421   *     for the accessibility service.
422   * @syscap SystemCapability.ArkUI.ArkUI.Full
423   * @crossplatform
424   * @atomicservice
425   * @since 18
426   */
427  accessibilityLevel?: string;
428  /**
429   * Sets the default focus state of the text or icon.
430   * @type { ?boolean }
431   * @default false
432   * @syscap SystemCapability.ArkUI.ArkUI.Full
433   * @crossplatform
434   * @atomicservice
435   * @since 18
436   */
437  defaultFocus?: boolean;
438}
439
440/**
441 * Declare the SubHeaderV2OperationItem
442 * @syscap SystemCapability.ArkUI.ArkUI.Full
443 * @crossplatform
444 * @atomicservice
445 * @since 18
446 */
447@ObservedV2
448export declare class SubHeaderV2OperationItem {
449  /**
450   * The content of text or the address of icon.
451   * @type { SubHeaderV2OperationItemType }.
452   * @syscap SystemCapability.ArkUI.ArkUI.Full
453   * @crossplatform
454   * @atomicservice
455   * @since 18
456   */
457  @Trace content: SubHeaderV2OperationItemType;
458  /**
459   * callback function when operate the text or icon.
460   * @type { ?SubHeaderV2OperationItemAction }.
461   * @syscap SystemCapability.ArkUI.ArkUI.Full
462   * @crossplatform
463   * @atomicservice
464   * @since 18
465   */
466  @Trace action?: SubHeaderV2OperationItemAction;
467  /**
468   * The constructor of SubHeaderV2OperationItem
469   *
470   * @param options { SubHeaderV2OperationItemOptions } the options of the SubHeaderV2OperationItem
471   * @syscap SystemCapability.ArkUI.ArkUI.Full
472   * @crossplatform
473   * @atomicservice
474   * @since 18
475   */
476  constructor(options: SubHeaderV2OperationItemOptions);
477  /**
478   * The accessibilityText of this text or icon.
479   * @type { ?ResourceStr }.
480   * @syscap SystemCapability.ArkUI.ArkUI.Full
481   * @crossplatform
482   * @atomicservice
483   * @since 18
484   */
485  @Trace accessibilityText?: ResourceStr;
486  /**
487   * The accessibilityDescription of this text or icon.
488   * @type { ?ResourceStr }
489   * @syscap SystemCapability.ArkUI.ArkUI.Full
490   * @crossplatform
491   * @atomicservice
492   * @since 18
493   */
494  @Trace accessibilityDescription?: ResourceStr;
495  /**
496   * The accessibilityLevel of this text or icon.
497   * @type { ?string }
498   * @default "auto".The options are as follows:<br/>
499   *     "auto":The value is converted to "yes" or "no" based on the component.
500   *     "yes": the current component is selectable for the accessibility service.
501   *     "no": The current component is not selectable for the accessibility service.
502   *     "no-hide-descendants":The current component and all its child components are not selectable<br/>
503   *     for the accessibility service.
504   * @syscap SystemCapability.ArkUI.ArkUI.Full
505   * @crossplatform
506   * @atomicservice
507   * @since 18
508   */
509  @Trace accessibilityLevel?: string;
510  /**
511   * Sets the default focus state of the text or icon.
512   * @type { ?boolean }
513   * @default false
514   * @syscap SystemCapability.ArkUI.ArkUI.Full
515   * @crossplatform
516   * @atomicservice
517   * @since 18
518   */
519  @Trace defaultFocus?: boolean;
520}
521
522/**
523 * The callback function that will be invoked when the title build.
524 *
525 * @typedef { function } SubHeaderV2TitleBuilder
526 * @syscap SystemCapability.ArkUI.ArkUI.Full
527 * @crossplatform
528 * @atomicservice
529 * @since 18
530 */
531export type SubHeaderV2TitleBuilder = () => void;
532
533/**
534 * Defines struct SubHeaderV2.
535 *
536 * @struct SubHeaderV2
537 * @syscap SystemCapability.ArkUI.ArkUI.Full
538 * @crossplatform
539 * @atomicservice
540 * @since 18
541 */
542@ComponentV2
543export declare struct SubHeaderV2 {
544  /**
545   * Sets the icon of the SubHeaderV2.
546   *
547   * @type { ?SubHeaderV2IconType }
548   * @readonly
549   * @syscap SystemCapability.ArkUI.ArkUI.Full
550   * @crossplatform
551   * @atomicservice
552   * @since 18
553   */
554  @Param
555  readonly icon?: SubHeaderV2IconType;
556  /**
557   * Sets the title of the SubHeaderV2.
558   *
559   * @type { ?SubHeaderV2Title }
560   * @readonly
561   * @syscap SystemCapability.ArkUI.ArkUI.Full
562   * @crossplatform
563   * @atomicservice
564   * @since 18
565   */
566  @Param
567  readonly title?: SubHeaderV2Title;
568  /**
569   * Sets the select of the SubHeaderV2.
570   *
571   * @type { ?SubHeaderV2Select }
572   * @readonly
573   * @syscap SystemCapability.ArkUI.ArkUI.Full
574   * @crossplatform
575   * @atomicservice
576   * @since 18
577   */
578  @Param
579  readonly select?: SubHeaderV2Select;
580  /**
581   * Sets the operationType of the SubHeaderV2.
582   *
583   * @type { ?SubHeaderV2OperationType }
584   * @readonly
585   * @syscap SystemCapability.ArkUI.ArkUI.Full
586   * @crossplatform
587   * @atomicservice
588   * @since 18
589   */
590  @Param
591  readonly operationType?: SubHeaderV2OperationType;
592  /**
593   * Sets the operationItems of the SubHeaderV2.
594   *
595   * @type { ?SubHeaderV2OperationItem[] }
596   * @readonly
597   * @syscap SystemCapability.ArkUI.ArkUI.Full
598   * @crossplatform
599   * @atomicservice
600   * @since 18
601   */
602  @Param
603  readonly operationItems?: SubHeaderV2OperationItem[];
604  /**
605   * Set the title content.
606   * @type { ?SubHeaderV2TitleBuilder }
607   * @syscap SystemCapability.ArkUI.ArkUI.Full
608   * @crossplatform
609   * @atomicservice
610   * @since 18
611   */
612  @BuilderParam
613  titleBuilder?: SubHeaderV2TitleBuilder;
614}