• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/*** if arkts 1.2 */
24import { Resource, ResourceStr, ResourceColor, LocalizedPadding, LocalizedMargin } from './arkui/component/units';
25import { SymbolEffectStrategy, SymbolRenderingStrategy } from './arkui/component/symbolglyph';
26import { SelectOption } from './arkui/component/select';
27import { Prop, BuilderParam } from './arkui/stateManagement/common';
28import { Component } from './arkui/component/customComponent';
29import { FontWeight } from './arkui/component/enums';
30/*** endif */
31
32/**
33 * Control style of operation element
34 * @enum { OperationStyle }
35 * @syscap SystemCapability.ArkUI.ArkUI.Full
36 * @since 10
37 */
38/**
39 * Control style of operation element
40 * @enum { OperationStyle }
41 * @syscap SystemCapability.ArkUI.ArkUI.Full
42 * @atomicservice
43 * @since 11
44 */
45/**
46 * Control style of operation element
47 * @enum { OperationStyle }
48 * @syscap SystemCapability.ArkUI.ArkUI.Full
49 * @crossplatform
50 * @atomicservice
51 * @since arkts {'1.1':'18','1.2':'20'}
52 * @arkts 1.1&1.2
53 */
54export declare enum OperationType {
55  /**
56   * The TextArrow style.
57   * @syscap SystemCapability.ArkUI.ArkUI.Full
58   * @since 10
59   */
60  /**
61   * The TextArrow style.
62   * @syscap SystemCapability.ArkUI.ArkUI.Full
63   * @atomicservice
64   * @since 11
65   */
66  /**
67   * The TextArrow style.
68   * @syscap SystemCapability.ArkUI.ArkUI.Full
69   * @crossplatform
70   * @atomicservice
71   * @since arkts {'1.1':'18','1.2':'20'}
72   * @arkts 1.1&1.2
73   */
74  TEXT_ARROW = 0,
75
76  /**
77   * The Button style.
78   * @syscap SystemCapability.ArkUI.ArkUI.Full
79   * @since 10
80   */
81  /**
82   * The Button style.
83   * @syscap SystemCapability.ArkUI.ArkUI.Full
84   * @atomicservice
85   * @since 11
86   */
87  /**
88   * The Button style.
89   * @syscap SystemCapability.ArkUI.ArkUI.Full
90   * @crossplatform
91   * @atomicservice
92   * @since arkts {'1.1':'18','1.2':'20'}
93   * @arkts 1.1&1.2
94   */
95  BUTTON = 1,
96
97  /**
98   * The IconGroup style.
99   * @syscap SystemCapability.ArkUI.ArkUI.Full
100   * @since 10
101   */
102  /**
103   * The IconGroup style.
104   * @syscap SystemCapability.ArkUI.ArkUI.Full
105   * @atomicservice
106   * @since 11
107   */
108  /**
109   * The IconGroup style.
110   * @syscap SystemCapability.ArkUI.ArkUI.Full
111   * @crossplatform
112   * @atomicservice
113   * @since arkts {'1.1':'18','1.2':'20'}
114   * @arkts 1.1&1.2
115   */
116  ICON_GROUP = 2,
117
118  /**
119   * The LoadingProgress style.
120   * @syscap SystemCapability.ArkUI.ArkUI.Full
121   * @since 10
122   */
123  /**
124   * The LoadingProgress style.
125   * @syscap SystemCapability.ArkUI.ArkUI.Full
126   * @atomicservice
127   * @since 11
128   */
129  /**
130   * The LoadingProgress style.
131   * @syscap SystemCapability.ArkUI.ArkUI.Full
132   * @crossplatform
133   * @atomicservice
134   * @since arkts {'1.1':'18','1.2':'20'}
135   * @arkts 1.1&1.2
136   */
137  LOADING = 3
138}
139
140/**
141 * Declare type OperationOption
142 * @syscap SystemCapability.ArkUI.ArkUI.Full
143 * @since 10
144 */
145/**
146 * Declare type OperationOption
147 * @syscap SystemCapability.ArkUI.ArkUI.Full
148 * @atomicservice
149 * @since 11
150 */
151/**
152 * Declare type OperationOption
153 * @syscap SystemCapability.ArkUI.ArkUI.Full
154 * @crossplatform
155 * @atomicservice
156 * @since arkts {'1.1':'18','1.2':'20'}
157 * @arkts 1.1&1.2
158 */
159export declare class OperationOption {
160  /**
161   * The content of text or the address of icon.
162   * @type { ResourceStr }.
163   * @syscap SystemCapability.ArkUI.ArkUI.Full
164   * @since 10
165   */
166  /**
167   * The content of text or the address of icon.
168   * @type { ResourceStr }.
169   * @syscap SystemCapability.ArkUI.ArkUI.Full
170   * @atomicservice
171   * @since 11
172   */
173  /**
174   * The content of text or the address of icon.
175   * @type { ResourceStr }.
176   * @syscap SystemCapability.ArkUI.ArkUI.Full
177   * @crossplatform
178   * @atomicservice
179   * @since arkts {'1.1':'18','1.2':'20'}
180   * @arkts 1.1&1.2
181   */
182  value: ResourceStr;
183
184  /**
185   * callback function when operate the text or icon.
186   * @type { () => void }.
187   * @syscap SystemCapability.ArkUI.ArkUI.Full
188   * @since 10
189   */
190  /**
191   * callback function when operate the text or icon.
192   * @type { () => void }.
193   * @syscap SystemCapability.ArkUI.ArkUI.Full
194   * @atomicservice
195   * @since 11
196   */
197  /**
198   * callback function when operate the text or icon.
199   * @type { () => void }.
200   * @syscap SystemCapability.ArkUI.ArkUI.Full
201   * @crossplatform
202   * @atomicservice
203   * @since arkts {'1.1':'18','1.2':'20'}
204   * @arkts 1.1&1.2
205   */
206  action?: () => void;
207
208  /**
209   * The accessibilityText of this text or icon.
210   * @type { ?ResourceStr }.
211   * @syscap SystemCapability.ArkUI.ArkUI.Full
212   * @atomicservice
213   * @since 18
214   */
215  accessibilityText?: ResourceStr;
216
217  /**
218   * The accessibilityDescription of this text or icon.
219   * @type { ?ResourceStr }
220   * @syscap SystemCapability.ArkUI.ArkUI.Full
221   * @atomicservice
222   * @since 18
223   */
224  accessibilityDescription?: ResourceStr;
225
226  /**
227   * The accessibilityLevel of this text or icon.
228   * @type { ?string }
229   * @default "auto"
230   * @syscap SystemCapability.ArkUI.ArkUI.Full
231   * @atomicservice
232   * @since 18
233   */
234  accessibilityLevel?: string;
235
236  /**
237   * Sets the default focus state of the text or icon.
238   * @type { ?boolean }.
239   * @default { false }
240   * @syscap SystemCapability.ArkUI.ArkUI.Full
241   * @atomicservice
242   * @since 18
243   */
244  defaultFocus?: boolean;
245}
246
247/**
248 * Declare type SelectOption
249 * @syscap SystemCapability.ArkUI.ArkUI.Full
250 * @since 10
251 */
252/**
253 * Declare type SelectOption
254 * @syscap SystemCapability.ArkUI.ArkUI.Full
255 * @atomicservice
256 * @since 11
257 */
258/**
259 * Declare type SelectOption
260 * @syscap SystemCapability.ArkUI.ArkUI.Full
261 * @crossplatform
262 * @atomicservice
263 * @since arkts {'1.1':'18','1.2':'20'}
264 * @arkts 1.1&1.2
265 */
266export declare class SelectOptions {
267  /**
268   * SubOption array of the select.
269   * @type { Array<SelectSubOption> }.
270   * @syscap SystemCapability.ArkUI.ArkUI.Full
271   * @since 10
272   */
273  /**
274   * SubOption array of the select.
275   * @type { Array<SelectSubOption> }.
276   * @syscap SystemCapability.ArkUI.ArkUI.Full
277   * @atomicservice
278   * @since 11
279   */
280  /**
281   * SubOption array of the select.
282   * @type { Array<SelectSubOption> }.
283   * @syscap SystemCapability.ArkUI.ArkUI.Full
284   * @crossplatform
285   * @atomicservice
286   * @since arkts {'1.1':'18','1.2':'20'}
287   * @arkts 1.1&1.2
288   */
289  options: Array<SelectOption>;
290
291  /**
292   * The default selected index.
293   * @type { number }.
294   * @syscap SystemCapability.ArkUI.ArkUI.Full
295   * @since 10
296   */
297  /**
298   * The default selected index.
299   * @type { number }.
300   * @syscap SystemCapability.ArkUI.ArkUI.Full
301   * @atomicservice
302   * @since 11
303   */
304  /**
305   * The default selected index.
306   * @type { number }.
307   * @syscap SystemCapability.ArkUI.ArkUI.Full
308   * @crossplatform
309   * @atomicservice
310   * @since arkts {'1.1':'18','1.2':'20'}
311   * @arkts 1.1&1.2
312   */
313  selected?: number;
314
315  /**
316   * The default text value.
317   * @type { string }.
318   * @syscap SystemCapability.ArkUI.ArkUI.Full
319   * @since 10
320   */
321  /**
322   * The default text value.
323   * @type { string }.
324   * @syscap SystemCapability.ArkUI.ArkUI.Full
325   * @atomicservice
326   * @since 11
327   */
328  /**
329   * The default text value.
330   * @type { string }.
331   * @syscap SystemCapability.ArkUI.ArkUI.Full
332   * @crossplatform
333   * @atomicservice
334   * @since 18
335   */
336  /**
337   * The default text value.
338   * @type { ?ResourceStr }.
339   * @syscap SystemCapability.ArkUI.ArkUI.Full
340   * @crossplatform
341   * @atomicservice
342   * @since 20
343   */
344  value?: ResourceStr;
345
346  /**
347   * The default text value.
348   * @type { string }.
349   * @syscap SystemCapability.ArkUI.ArkUI.Full
350   * @crossplatform
351   * @atomicservice
352   * @since 20
353   * @arkts 1.2
354   */
355  value?: string;
356
357 /**
358  * Callback when the select is selected.
359  * @type { (index: number, value?: string) => void }.
360  * @syscap SystemCapability.ArkUI.ArkUI.Full
361  * @since 10
362  */
363 /**
364  * Callback when the select is selected.
365  * @type { (index: number, value?: string) => void }.
366  * @syscap SystemCapability.ArkUI.ArkUI.Full
367  * @atomicservice
368  * @since 11
369  */
370 /**
371  * Callback when the select is selected.
372  * @type { (index: number, value?: string) => void }.
373  * @syscap SystemCapability.ArkUI.ArkUI.Full
374  * @crossplatform
375  * @atomicservice
376  * @since arkts {'1.1':'18','1.2':'20'}
377  * @arkts 1.1&1.2
378  */
379  onSelect?: (index: number, value?: string) => void;
380
381  /**
382   * Sets the default focus state of select.
383   * @type { ?boolean }.
384   * @default { false }
385   * @syscap SystemCapability.ArkUI.ArkUI.Full
386   * @atomicservice
387   * @since 18
388   */
389  defaultFocus?: boolean;
390}
391
392/**
393 * Declare type SymbolOptions
394 * @syscap SystemCapability.ArkUI.ArkUI.Full
395 * @atomicservice
396 * @since 12
397 */
398 /**
399 * Declare type SymbolOptions
400 * @syscap SystemCapability.ArkUI.ArkUI.Full
401 * @crossplatform
402 * @atomicservice
403 * @since 18
404 */
405export declare class SymbolOptions {
406  /**
407   * The size of symbol icon.
408   * @type { ?(number | string | Resource) }.
409   * @syscap SystemCapability.ArkUI.ArkUI.Full
410   * @atomicservice
411   * @since 12
412   */
413  /**
414   * The size of symbol icon.
415   * @type { ?(number | string | Resource) }.
416   * @syscap SystemCapability.ArkUI.ArkUI.Full
417   * @crossplatform
418   * @atomicservice
419   * @since 18
420   */
421  fontSize?: number | string | Resource;
422
423  /**
424   * The color of symbol icon.
425   * @type { ?(Array<ResourceColor>) }.
426   * @syscap SystemCapability.ArkUI.ArkUI.Full
427   * @atomicservice
428   * @since 12
429   */
430  /**
431   * The color of symbol icon.
432   * @type { ?(Array<ResourceColor>) }.
433   * @syscap SystemCapability.ArkUI.ArkUI.Full
434   * @crossplatform
435   * @atomicservice
436   * @since 18
437   */
438  fontColor?: Array<ResourceColor>;
439
440  /**
441   * The fontWeight of symbol icon.
442   * @type { ?(number | FontWeight | string) }.
443   * @syscap SystemCapability.ArkUI.ArkUI.Full
444   * @atomicservice
445   * @since 12
446   */
447  /**
448   * The fontWeight of symbol icon.
449   * @type { ?(number | FontWeight | string) }.
450   * @syscap SystemCapability.ArkUI.ArkUI.Full
451   * @crossplatform
452   * @atomicservice
453   * @since 18
454   */
455  fontWeight?: number | FontWeight | string;
456
457  /**
458   * The effect strategy of symbol icon.
459   * @type { ?(SymbolEffectStrategy) }.
460   * @syscap SystemCapability.ArkUI.ArkUI.Full
461   * @atomicservice
462   * @since 12
463   */
464  /**
465   * The effect strategy of symbol icon.
466   * @type { ?(SymbolEffectStrategy) }.
467   * @syscap SystemCapability.ArkUI.ArkUI.Full
468   * @crossplatform
469   * @atomicservice
470   * @since 18
471   */
472  effectStrategy?: SymbolEffectStrategy;
473
474  /**
475   * The rendering strategy of symbol icon.
476   * @type { ?(SymbolRenderingStrategy) }.
477   * @syscap SystemCapability.ArkUI.ArkUI.Full
478   * @atomicservice
479   * @since 12
480   */
481  /**
482   * The rendering strategy of symbol icon.
483   * @type { ?(SymbolRenderingStrategy) }.
484   * @syscap SystemCapability.ArkUI.ArkUI.Full
485   * @crossplatform
486   * @atomicservice
487   * @since 18
488   */
489  renderingStrategy?: SymbolRenderingStrategy;
490}
491
492/**
493 * Declare struct SubHeader
494 * @syscap SystemCapability.ArkUI.ArkUI.Full
495 * @since 10
496 */
497/**
498 * Declare struct SubHeader
499 * @syscap SystemCapability.ArkUI.ArkUI.Full
500 * @atomicservice
501 * @since 11
502 */
503/**
504 * Declare struct SubHeader
505 * @syscap SystemCapability.ArkUI.ArkUI.Full
506 * @crossplatform
507 * @atomicservice
508 * @since arkts {'1.1':'18','1.2':'20'}
509 * @arkts 1.1&1.2
510 */
511@Component
512export declare struct SubHeader {
513
514  /**
515   * Icon resource of content area.
516   * @type { ResourceStr }.
517   * @syscap SystemCapability.ArkUI.ArkUI.Full
518   * @since 10
519   */
520  /**
521   * Icon resource of content area.
522   * @type { ResourceStr }.
523   * @syscap SystemCapability.ArkUI.ArkUI.Full
524   * @atomicservice
525   * @since 11
526   */
527  /**
528   * Icon resource of content area.
529   * @type { ResourceStr }.
530   * @syscap SystemCapability.ArkUI.ArkUI.Full
531   * @crossplatform
532   * @atomicservice
533   * @since arkts {'1.1':'18','1.2':'20'}
534   * @arkts 1.1&1.2
535   */
536  @Prop icon?: ResourceStr;
537
538  /**
539   * Attributes of Symbol icon.
540   * @type { SymbolOptions}.
541   * @syscap SystemCapability.ArkUI.ArkUI.Full
542   * @atomicservice
543   * @since 12
544   */
545  /**
546   * Attributes of Symbol icon.
547   * @type { SymbolOptions}.
548   * @syscap SystemCapability.ArkUI.ArkUI.Full
549   * @atomicservice
550   * @since 18
551   */
552  iconSymbolOptions?: SymbolOptions;
553
554  /**
555   * The first line text of content area.
556   * @type { ResourceStr }.
557   * @syscap SystemCapability.ArkUI.ArkUI.Full
558   * @since 10
559   */
560  /**
561   * The first line text of content area.
562   * @type { ResourceStr }.
563   * @syscap SystemCapability.ArkUI.ArkUI.Full
564   * @atomicservice
565   * @since 11
566   */
567  /**
568   * The first line text of content area.
569   * @type { ResourceStr }.
570   * @syscap SystemCapability.ArkUI.ArkUI.Full
571   * @crossplatform
572   * @atomicservice
573   * @since arkts {'1.1':'18','1.2':'20'}
574   * @arkts 1.1&1.2
575   */
576  @Prop primaryTitle?: ResourceStr;
577
578  /**
579   * The secondary line text of content area.
580   * @type { ResourceStr }.
581   * @syscap SystemCapability.ArkUI.ArkUI.Full
582   * @since 10
583   */
584  /**
585   * The secondary line text of content area.
586   * @type { ResourceStr }.
587   * @syscap SystemCapability.ArkUI.ArkUI.Full
588   * @atomicservice
589   * @since 11
590   */
591  /**
592   * The secondary line text of content area.
593   * @type { ResourceStr }.
594   * @syscap SystemCapability.ArkUI.ArkUI.Full
595   * @crossplatform
596   * @atomicservice
597   * @since arkts {'1.1':'18','1.2':'20'}
598   * @arkts 1.1&1.2
599   */
600  @Prop secondaryTitle?: ResourceStr;
601
602  /**
603   * Select option of content area.
604   * @type { SelectOptions }.
605   * @syscap SystemCapability.ArkUI.ArkUI.Full
606   * @since 10
607   */
608  /**
609   * Select option of content area.
610   * @type { SelectOptions }.
611   * @syscap SystemCapability.ArkUI.ArkUI.Full
612   * @atomicservice
613   * @since 11
614   */
615  /**
616   * Select option of content area.
617   * @type { SelectOptions }.
618   * @syscap SystemCapability.ArkUI.ArkUI.Full
619   * @crossplatform
620   * @atomicservice
621   * @since arkts {'1.1':'18','1.2':'20'}
622   * @arkts 1.1&1.2
623   */
624  select?: SelectOptions;
625
626  /**
627   * Operation style of SubHeader.
628   * @type { OperationStyle }.
629   * @syscap SystemCapability.ArkUI.ArkUI.Full
630   * @since 10
631   */
632  /**
633   * Operation style of SubHeader.
634   * @type { OperationStyle }.
635   * @syscap SystemCapability.ArkUI.ArkUI.Full
636   * @atomicservice
637   * @since 11
638   */
639  /**
640   * Operation style of SubHeader.
641   * @type { OperationStyle }.
642   * @syscap SystemCapability.ArkUI.ArkUI.Full
643   * @crossplatform
644   * @atomicservice
645   * @since arkts {'1.1':'18','1.2':'20'}
646   * @arkts 1.1&1.2
647   */
648  @Prop operationType?: OperationType;
649
650  /**
651   * operation item.
652   * @type { Array<OperationOption> }.
653   * @syscap SystemCapability.ArkUI.ArkUI.Full
654   * @since 10
655   */
656  /**
657   * operation item.
658   * @type { Array<OperationOption> }.
659   * @syscap SystemCapability.ArkUI.ArkUI.Full
660   * @atomicservice
661   * @since 11
662   */
663  /**
664   * operation item.
665   * @type { Array<OperationOption> }.
666   * @syscap SystemCapability.ArkUI.ArkUI.Full
667   * @crossplatform
668   * @atomicservice
669   * @since arkts {'1.1':'18','1.2':'20'}
670   * @arkts 1.1&1.2
671   */
672  operationItem?: Array<OperationOption>;
673
674  /**
675   * Attributes of Symbol icons in operation area.
676   * @type { Array<SymbolOptions> }.
677   * @syscap SystemCapability.ArkUI.ArkUI.Full
678   * @atomicservice
679   * @since 12
680   */
681  /**
682   * Attributes of Symbol icons in operation area.
683   * @type { Array<SymbolOptions> }.
684   * @syscap SystemCapability.ArkUI.ArkUI.Full
685   * @atomicservice
686   * @since 18
687   */
688  operationSymbolOptions?: Array<SymbolOptions>;
689
690  /**
691   * Text modifier for primary title.
692   * @type { TextModifier }.
693   * @syscap SystemCapability.ArkUI.ArkUI.Full
694   * @atomicservice
695   * @since 12
696   */
697  /**
698   * Text modifier for primary title.
699   * @type { TextModifier }.
700   * @syscap SystemCapability.ArkUI.ArkUI.Full
701   * @crossplatform
702   * @atomicservice
703   * @since 18
704   */
705  primaryTitleModifier?: TextModifier;
706
707  /**
708   * Text modifier for secondary title.
709   * @type { TextModifier }.
710   * @syscap SystemCapability.ArkUI.ArkUI.Full
711   * @atomicservice
712   * @since 12
713   */
714  /**
715   * Text modifier for secondary title.
716   * @type { TextModifier }.
717   * @syscap SystemCapability.ArkUI.ArkUI.Full
718   * @crossplatform
719   * @atomicservice
720   * @since 18
721   */
722  secondaryTitleModifier?: TextModifier;
723
724  /**
725   * Set the title content.
726   * @type { () => void }
727   * @syscap SystemCapability.ArkUI.ArkUI.Full
728   * @atomicservice
729   * @since 12
730   */
731  /**
732   * Set the title content.
733   * @type { () => void }
734   * @syscap SystemCapability.ArkUI.ArkUI.Full
735   * @crossplatform
736   * @atomicservice
737   * @since 18
738   */
739  @BuilderParam titleBuilder?: () => void;
740
741  /**
742   * Set the content margin.
743   * @type { ?LocalizedMargin }
744   * @default {start: LengthMetrics.resource($r('sys.float.margin_left')),
745   * <br> end: LengthMetrics.resource($r('sys.float.margin_right'))}
746   * @syscap SystemCapability.ArkUI.ArkUI.Full
747   * @atomicservice
748   * @since 12
749   */
750  /**
751   * Set the content margin.
752   * @type { ?LocalizedMargin }
753   * @default {start: LengthMetrics.resource($r('sys.float.margin_left')),
754   * <br> end: LengthMetrics.resource($r('sys.float.margin_right'))}
755   * @syscap SystemCapability.ArkUI.ArkUI.Full
756   * @crossplatform
757   * @atomicservice
758   * @since 18
759   */
760  @Prop contentMargin?: LocalizedMargin;
761
762  /**
763   * Set the content padding.
764   * @type { ?LocalizedPadding }
765   * @default set different default values according to the width of the subHeader:
766   * <br> When the left area is secondaryTitle or the group of secondaryTitle and icon,
767   * <br> the default value is {start: LengthMetrics.vp(12), end: LengthMetrics.vp(12)};
768   * @syscap SystemCapability.ArkUI.ArkUI.Full
769   * @atomicservice
770   * @since 12
771   */
772  /**
773   * Set the content padding.
774   * @type { ?LocalizedPadding }
775   * @default set different default values according to the width of the subHeader:
776   * <br> When the left area is secondaryTitle or the group of secondaryTitle and icon,
777   * <br> the default value is {start: LengthMetrics.vp(12), end: LengthMetrics.vp(12)};
778   * @syscap SystemCapability.ArkUI.ArkUI.Full
779   * @crossplatform
780   * @atomicservice
781   * @since 18
782   */
783  @Prop contentPadding?: LocalizedPadding;
784}