2
* Copyright (c) 2021-2023 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
7
* http://www.apache.org/licenses/LICENSE-2.0
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.
22
* Define the contents of each selector item.
24
* @interface TextPickerRangeContent
25
* @syscap SystemCapability.ArkUI.ArkUI.Full
30
* Define the contents of each selector item.
32
* @interface TextPickerRangeContent
33
* @syscap SystemCapability.ArkUI.ArkUI.Full
38
declare interface TextPickerRangeContent {
40
* Specifies the icon content.
42
* @type { string | Resource }
43
* @syscap SystemCapability.ArkUI.ArkUI.Full
48
* Specifies the icon content.
50
* @type { string | Resource }
51
* @syscap SystemCapability.ArkUI.ArkUI.Full
56
icon: string | Resource;
59
* Specifies the text content.
61
* @type { ?(string | Resource) }
62
* @syscap SystemCapability.ArkUI.ArkUI.Full
67
* Specifies the text content.
69
* @type { ?(string | Resource) }
70
* @syscap SystemCapability.ArkUI.ArkUI.Full
75
text?: string | Resource;
79
* Define the contents of text cascade picker.
81
* @interface TextCascadePickerRangeContent
82
* @syscap SystemCapability.ArkUI.ArkUI.Full
86
* Define the contents of text cascade picker.
88
* @interface TextCascadePickerRangeContent
89
* @syscap SystemCapability.ArkUI.ArkUI.Full
94
declare interface TextCascadePickerRangeContent {
96
* Specifies the text content.
98
* @type { string | Resource }
99
* @syscap SystemCapability.ArkUI.ArkUI.Full
103
* Specifies the text content.
105
* @type { string | Resource }
106
* @syscap SystemCapability.ArkUI.ArkUI.Full
111
text: string | Resource;
114
* Defines the text cascade picker children.
116
* @type { ?TextCascadePickerRangeContent[] }
117
* @syscap SystemCapability.ArkUI.ArkUI.Full
121
* Defines the text cascade picker children.
123
* @type { ?TextCascadePickerRangeContent[] }
124
* @syscap SystemCapability.ArkUI.ArkUI.Full
129
children?: TextCascadePickerRangeContent[];
133
* Defines the options of TextPicker.
135
* @interface TextPickerOptions
136
* @syscap SystemCapability.ArkUI.ArkUI.Full
140
* Defines the options of TextPicker.
142
* @interface TextPickerOptions
143
* @syscap SystemCapability.ArkUI.ArkUI.Full
148
* Defines the options of TextPicker.
150
* @interface TextPickerOptions
151
* @syscap SystemCapability.ArkUI.ArkUI.Full
156
declare interface TextPickerOptions {
158
* Specifies the range of the text selector.
160
* @type {string[] | Resource}
161
* @syscap SystemCapability.ArkUI.ArkUI.Full
165
* Specifies the range of the selector.
166
* Support the display of pictures, text and pictures plus text, or multi column plain text.
168
* @type {string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[]}
169
* @syscap SystemCapability.ArkUI.ArkUI.Full
174
* Specifies the range of the selector.
175
* Support the display of pictures, text and pictures plus text, or multi column plain text.
177
* @type {string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[]}
178
* @syscap SystemCapability.ArkUI.ArkUI.Full
183
range: string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[];
186
* Value of the current selection.
189
* @syscap SystemCapability.ArkUI.ArkUI.Full
193
* Value of the current selection.
194
* Only valid when only text is displayed.
196
* @type { ?(string | string[]) }
197
* @syscap SystemCapability.ArkUI.ArkUI.Full
202
* Value of the current selection.
203
* Only valid when only text is displayed.
205
* @type { ?(string | string[]) }
206
* @syscap SystemCapability.ArkUI.ArkUI.Full
211
value?: string | string[];
214
* Current selected subscript.
217
* @syscap SystemCapability.ArkUI.ArkUI.Full
221
* Current selected subscript.
223
* @type { ?(number | number[]) }
224
* @syscap SystemCapability.ArkUI.ArkUI.Full
229
* Current selected subscript.
231
* @type { ?(number | number[]) }
232
* @syscap SystemCapability.ArkUI.ArkUI.Full
237
selected?: number | number[];
241
* TextPickerInterface
243
* @interface TextPickerInterface
244
* @syscap SystemCapability.ArkUI.ArkUI.Full
248
* TextPickerInterface
250
* @interface TextPickerInterface
251
* @syscap SystemCapability.ArkUI.ArkUI.Full
256
* TextPickerInterface
258
* @interface TextPickerInterface
259
* @syscap SystemCapability.ArkUI.ArkUI.Full
264
interface TextPickerInterface {
266
* Defines the TextPicker constructor.
268
* @param { TextPickerOptions } options
269
* @returns { TextPickerAttribute }
270
* @syscap SystemCapability.ArkUI.ArkUI.Full
274
* Defines the TextPicker constructor.
276
* @param { TextPickerOptions } options
277
* @returns { TextPickerAttribute }
278
* @syscap SystemCapability.ArkUI.ArkUI.Full
283
* Defines the TextPicker constructor.
285
* @param { TextPickerOptions } options
286
* @returns { TextPickerAttribute }
287
* @syscap SystemCapability.ArkUI.ArkUI.Full
292
(options?: TextPickerOptions): TextPickerAttribute;
296
* Defines the struct of DividerOptions.
298
* @interface DividerOptions
299
* @syscap SystemCapability.ArkUI.ArkUI.Full
303
declare interface DividerOptions {
305
* The strokeWidth of Divider.
307
* @type { ?Dimension }
308
* @syscap SystemCapability.ArkUI.ArkUI.Full
312
strokeWidth?: Dimension;
315
* The color of Divider.
317
* @type { ?ResourceColor }
318
* @syscap SystemCapability.ArkUI.ArkUI.Full
322
color?: ResourceColor;
325
* The startMargin of Divider.
327
* @type { ?Dimension }
328
* @syscap SystemCapability.ArkUI.ArkUI.Full
332
startMargin?: Dimension;
335
* The endMargin of Divider.
337
* @type { ?Dimension }
338
* @syscap SystemCapability.ArkUI.ArkUI.Full
342
endMargin?: Dimension;
346
* Style the text selector.
348
* @extends CommonMethod<TextPickerAttribute>
349
* @syscap SystemCapability.ArkUI.ArkUI.Full
353
* Style the text selector.
355
* @extends CommonMethod<TextPickerAttribute>
356
* @syscap SystemCapability.ArkUI.ArkUI.Full
361
* Style the text selector.
363
* @extends CommonMethod<TextPickerAttribute>
364
* @syscap SystemCapability.ArkUI.ArkUI.Full
369
declare class TextPickerAttribute extends CommonMethod<TextPickerAttribute> {
371
* Called when the default height of the selected element is set.
373
* @param { number | string } value
374
* @returns { TextPickerAttribute }
375
* @syscap SystemCapability.ArkUI.ArkUI.Full
379
* Called when the default height of the selected element is set.
381
* @param { number | string } value
382
* @returns { TextPickerAttribute }
383
* @syscap SystemCapability.ArkUI.ArkUI.Full
388
* Called when the default height of the selected element is set.
390
* @param { number | string } value
391
* @returns { TextPickerAttribute }
392
* @syscap SystemCapability.ArkUI.ArkUI.Full
397
defaultPickerItemHeight(value: number | string): TextPickerAttribute;
400
* Can scroll loop if true is set, on the contrary it can not.
402
* @param { boolean } value
403
* @returns { TextPickerAttribute }
404
* @syscap SystemCapability.ArkUI.ArkUI.Full
408
* Can scroll loop if true is set, on the contrary it can not.
410
* @param { boolean } value
411
* @returns { TextPickerAttribute }
412
* @syscap SystemCapability.ArkUI.ArkUI.Full
417
canLoop(value: boolean): TextPickerAttribute;
420
* Sets the text style of disappearing items
422
* @param { PickerTextStyle } value - indicates the text style of disappearing items.
423
* @returns { TextPickerAttribute }
424
* @syscap SystemCapability.ArkUI.ArkUI.Full
429
* Sets the text style of disappearing items
431
* @param { PickerTextStyle } value - indicates the text style of disappearing items.
432
* @returns { TextPickerAttribute }
433
* @syscap SystemCapability.ArkUI.ArkUI.Full
438
// disappearTextStyle(value: PickerTextStyle): TextPickerAttribute;
441
* Sets the text style of normal items
443
* @param { PickerTextStyle } value - indicates the text style of normal items.
444
* @returns { TextPickerAttribute }
445
* @syscap SystemCapability.ArkUI.ArkUI.Full
450
* Sets the text style of normal items
452
* @param { PickerTextStyle } value - indicates the text style of normal items.
453
* @returns { TextPickerAttribute }
454
* @syscap SystemCapability.ArkUI.ArkUI.Full
459
// textStyle(value: PickerTextStyle): TextPickerAttribute;
462
* Sets the text style of selected items
464
* @param { PickerTextStyle } value - indicates the text style of selected items.
465
* @returns { TextPickerAttribute }
466
* @syscap SystemCapability.ArkUI.ArkUI.Full
471
* Sets the text style of selected items
473
* @param { PickerTextStyle } value - indicates the text style of selected items.
474
* @returns { TextPickerAttribute }
475
* @syscap SystemCapability.ArkUI.ArkUI.Full
480
// selectedTextStyle(value: PickerTextStyle): TextPickerAttribute;
483
* Called when the pop-up value is returned.
485
* @param { function } callback
486
* @returns { TextPickerAttribute }
487
* @syscap SystemCapability.ArkUI.ArkUI.Full
489
* @deprecated since 10
491
onAccept(callback: (value: string, index: number) => void): TextPickerAttribute;
494
* Called when the Cancel button in the pop-up window is clicked.
496
* @param { function } callback
497
* @returns { TextPickerAttribute }
498
* @syscap SystemCapability.ArkUI.ArkUI.Full
500
* @deprecated since 10
502
onCancel(callback: () => void): TextPickerAttribute;
505
* Called when the OK button in the pop-up window is clicked.
507
* @param { function } callback - the callback of onChange.
508
* @returns { TextPickerAttribute }
509
* @syscap SystemCapability.ArkUI.ArkUI.Full
513
* This event is triggered when a TextPicker item is selected.
514
* Only valid when only text is displayed. When picture or picture plus text is displayed, the value is "".
516
* @param { function } callback - the callback of onChange.
517
* @returns { TextPickerAttribute }
518
* @syscap SystemCapability.ArkUI.ArkUI.Full
523
* This event is triggered when a TextPicker item is selected.
524
* Only valid when only text is displayed. When picture or picture plus text is displayed, the value is "".
526
* @param { function } callback - the callback of onChange.
527
* @returns { TextPickerAttribute }
528
* @syscap SystemCapability.ArkUI.ArkUI.Full
533
onChange(callback: (value: string | string[], index: number | number[]) => void): TextPickerAttribute;
536
* Set the selected indices.
537
* The array size is the total number of columns.
539
* @param { number | number[] } value - the selected indices.
540
* @returns { TextPickerAttribute }
541
* @syscap SystemCapability.ArkUI.ArkUI.Full
546
* Set the selected indices.
547
* The array size is the total number of columns.
549
* @param { number | number[] } value - the selected indices.
550
* @returns { TextPickerAttribute }
551
* @syscap SystemCapability.ArkUI.ArkUI.Full
556
selectedIndex(value: number | number[]): TextPickerAttribute;
559
* Set the divider of TextPicker
561
* @param { DividerOptions | null } value
562
* @returns { TextPickerAttribute }
563
* @syscap SystemCapability.ArkUI.ArkUI.Full
567
divider(value: DividerOptions | null): TextPickerAttribute;
570
* Called when set the height of gradient
572
* @param { Dimension } value - The value the gradient height
573
* @returns { TextPickerAttribute }
574
* @syscap SystemCapability.ArkUI.ArkUI.Full
578
gradientHeight(value: Dimension): TextPickerAttribute;
582
* Defines the struct of TextPickerResult.
584
* @interface TextPickerResult
585
* @syscap SystemCapability.ArkUI.ArkUI.Full
589
* Defines the struct of TextPickerResult.
591
* @interface TextPickerResult
592
* @syscap SystemCapability.ArkUI.ArkUI.Full
597
* Defines the struct of TextPickerResult.
599
* @interface TextPickerResult
600
* @syscap SystemCapability.ArkUI.ArkUI.Full
605
declare interface TextPickerResult {
607
* The currently selected value.
610
* @syscap SystemCapability.ArkUI.ArkUI.Full
614
* The currently selected value.
615
* Only valid when only text is displayed.When picture or picture plus text is displayed, the value of value is "".
617
* @type { string | string[] }
618
* @syscap SystemCapability.ArkUI.ArkUI.Full
623
* The currently selected value.
624
* Only valid when only text is displayed.When picture or picture plus text is displayed, the value of value is "".
626
* @type { string | string[] }
627
* @syscap SystemCapability.ArkUI.ArkUI.Full
632
value: string | string[];
635
* The subscript of the current selection.
638
* @syscap SystemCapability.ArkUI.ArkUI.Full
642
* The subscript of the current selection.
644
* @type { number | number[] }
645
* @syscap SystemCapability.ArkUI.ArkUI.Full
650
* The subscript of the current selection.
652
* @type { number | number[] }
653
* @syscap SystemCapability.ArkUI.ArkUI.Full
658
index: number | number[];
662
* Defines the TextPickerDialogOptions for Text Picker Dialog.
664
* @interface TextPickerDialogOptions
665
* @syscap SystemCapability.ArkUI.ArkUI.Full
669
* Defines the TextPickerDialogOptions for Text Picker Dialog.
671
* @interface TextPickerDialogOptions
672
* @syscap SystemCapability.ArkUI.ArkUI.Full
677
* Defines the TextPickerDialogOptions for Text Picker Dialog.
679
* @interface TextPickerDialogOptions
680
* @syscap SystemCapability.ArkUI.ArkUI.Full
685
declare interface TextPickerDialogOptions extends TextPickerOptions {
687
* Called when the default height of the selected element is set.
689
* @type { ?(number | string) }
690
* @syscap SystemCapability.ArkUI.ArkUI.Full
694
* Called when the default height of the selected element is set.
696
* @type { ?(number | string) }
697
* @syscap SystemCapability.ArkUI.ArkUI.Full
702
* Called when the default height of the selected element is set.
704
* @type { ?(number | string) }
705
* @syscap SystemCapability.ArkUI.ArkUI.Full
710
defaultPickerItemHeight?: number | string;
713
* Can scroll loop if true is set, on the contrary it can not.
717
* @syscap SystemCapability.ArkUI.ArkUI.Full
721
* Can scroll loop if true is set, on the contrary it can not.
725
* @syscap SystemCapability.ArkUI.ArkUI.Full
733
* Text style of disappearing items
735
* @type { ?PickerTextStyle }
736
* @syscap SystemCapability.ArkUI.ArkUI.Full
741
* Text style of disappearing items
743
* @type { ?PickerTextStyle }
744
* @syscap SystemCapability.ArkUI.ArkUI.Full
749
// disappearTextStyle?: PickerTextStyle;
752
* Text style of normal items
754
* @type { ?PickerTextStyle }
755
* @syscap SystemCapability.ArkUI.ArkUI.Full
760
* Text style of normal items
762
* @type { ?PickerTextStyle }
763
* @syscap SystemCapability.ArkUI.ArkUI.Full
768
// textStyle?: PickerTextStyle;
771
* Style of accept button.
773
* @type { ?PickerDialogButtonStyle }
774
* @syscap SystemCapability.ArkUI.ArkUI.Full
778
//acceptButtonStyle?: PickerDialogButtonStyle;
781
* Style of cancel button.
783
* @type { ?PickerDialogButtonStyle }
784
* @syscap SystemCapability.ArkUI.ArkUI.Full
788
//cancelButtonStyle?: PickerDialogButtonStyle;
791
* Text style of selected items
793
* @type { ?PickerTextStyle }
794
* @syscap SystemCapability.ArkUI.ArkUI.Full
799
* Text style of selected items
801
* @type { ?PickerTextStyle }
802
* @syscap SystemCapability.ArkUI.ArkUI.Full
807
// selectedTextStyle?: PickerTextStyle;
809
* Called when the OK button in the dialog is clicked.
811
* @type { ?function }
812
* @syscap SystemCapability.ArkUI.ArkUI.Full
816
* Called when the OK button in the dialog is clicked.
818
* @type { ?function }
819
* @syscap SystemCapability.ArkUI.ArkUI.Full
824
* Called when the OK button in the dialog is clicked.
826
* @type { ?function }
827
* @syscap SystemCapability.ArkUI.ArkUI.Full
832
onAccept?: (value: TextPickerResult) => void;
835
* Called when the Cancel button in the dialog is clicked.
837
* @type { ?function }
838
* @syscap SystemCapability.ArkUI.ArkUI.Full
842
* Called when the Cancel button in the dialog is clicked.
844
* @type { ?function }
845
* @syscap SystemCapability.ArkUI.ArkUI.Full
850
* Called when the Cancel button in the dialog is clicked.
852
* @type { ?function }
853
* @syscap SystemCapability.ArkUI.ArkUI.Full
858
onCancel?: () => void;
861
* This event is triggered when a TextPicker text is selected in dialog.
863
* @type { ?function }
864
* @syscap SystemCapability.ArkUI.ArkUI.Full
868
* This event is triggered when a TextPicker text is selected in dialog.
870
* @type { ?function }
871
* @syscap SystemCapability.ArkUI.ArkUI.Full
876
* This event is triggered when a TextPicker text is selected in dialog.
878
* @type { ?function }
879
* @syscap SystemCapability.ArkUI.ArkUI.Full
884
onChange?: (value: TextPickerResult) => void;
887
* Mask Region of dialog. The size cannot exceed the main window.
889
* @type { ?Rectangle }
890
* @syscap SystemCapability.ArkUI.ArkUI.Full
895
* Mask Region of dialog. The size cannot exceed the main window.
897
* @type { ?Rectangle }
898
* @syscap SystemCapability.ArkUI.ArkUI.Full
903
maskRect?: Rectangle;
906
* Defines the dialog alignment of the screen.
908
* @type { ?DialogAlignment }
909
* @syscap SystemCapability.ArkUI.ArkUI.Full
914
* Defines the dialog alignment of the screen.
916
* @type { ?DialogAlignment }
917
* @syscap SystemCapability.ArkUI.ArkUI.Full
922
//alignment?: DialogAlignment;
925
* Defines the dialog offset.
928
* @syscap SystemCapability.ArkUI.ArkUI.Full
933
* Defines the dialog offset.
936
* @syscap SystemCapability.ArkUI.ArkUI.Full
944
* Defines the textPickerDialog's background color
946
* @type { ?ResourceColor }
947
* @default Color.Transparent
948
* @syscap SystemCapability.ArkUI.ArkUI.Full
953
* Defines the textPickerDialog's background color
955
* @type { ?ResourceColor }
956
* @default Color.Transparent
957
* @syscap SystemCapability.ArkUI.ArkUI.Full
962
backgroundColor?: ResourceColor;
965
* Defines the textPickerDialog's background blur Style
967
* @type { ?BlurStyle }
968
* @default BlurStyle.COMPONENT_ULTRA_THICK
969
* @syscap SystemCapability.ArkUI.ArkUI.Full
974
* Defines the textPickerDialog's background blur Style
976
* @type { ?BlurStyle }
977
* @default BlurStyle.COMPONENT_ULTRA_THICK
978
* @syscap SystemCapability.ArkUI.ArkUI.Full
983
backgroundBlurStyle?: BlurStyle;
986
* Callback function when the dialog appears.
988
* @type { ?function }
989
* @syscap SystemCapability.ArkUI.ArkUI.Full
994
onDidAppear?: () => void;
997
* Callback function when the dialog disappears.
999
* @type { ?function }
1000
* @syscap SystemCapability.ArkUI.ArkUI.Full
1005
onDidDisappear?: () => void;
1008
* Callback function before the dialog openAnimation starts.
1010
* @type { ?function }
1011
* @syscap SystemCapability.ArkUI.ArkUI.Full
1015
onWillAppear?: () => void;
1018
* Callback function before the dialog closeAnimation starts.
1020
* @type { ?function }
1021
* @syscap SystemCapability.ArkUI.ArkUI.Full
1025
onWillDisappear?: () => void;
1028
* Defines the dialog's shadow.
1030
* @type { ?(ShadowOptions | ShadowStyle) }
1031
* @syscap SystemCapability.ArkUI.ArkUI.Full
1035
//shadow?: ShadowOptions | ShadowStyle;
1039
* Defines TextPickerDialog which uses show method to show TextPicker dialog.
1041
* @syscap SystemCapability.ArkUI.ArkUI.Full
1045
* Defines TextPickerDialog which uses show method to show TextPicker dialog.
1047
* @syscap SystemCapability.ArkUI.ArkUI.Full
1052
* Defines TextPickerDialog which uses show method to show TextPicker dialog.
1054
* @syscap SystemCapability.ArkUI.ArkUI.Full
1059
declare class TextPickerDialog {
1061
* Invoking method display.
1063
* @param { TextPickerDialogOptions } options
1064
* @syscap SystemCapability.ArkUI.ArkUI.Full
1068
* Invoking method display.
1070
* @param { TextPickerDialogOptions } options
1071
* @syscap SystemCapability.ArkUI.ArkUI.Full
1076
* Invoking method display.
1078
* @param { TextPickerDialogOptions } options
1079
* @syscap SystemCapability.ArkUI.ArkUI.Full
1084
static show(options?: TextPickerDialogOptions): undefined;
1088
* Defines TextPicker Component.
1090
* @syscap SystemCapability.ArkUI.ArkUI.Full
1094
* Defines TextPicker Component.
1096
* @syscap SystemCapability.ArkUI.ArkUI.Full
1101
* Defines TextPicker Component.
1103
* @syscap SystemCapability.ArkUI.ArkUI.Full
1108
declare const TextPicker: TextPickerInterface;
1111
* Defines TextPicker Component instance.
1113
* @syscap SystemCapability.ArkUI.ArkUI.Full
1117
* Defines TextPicker Component instance.
1119
* @syscap SystemCapability.ArkUI.ArkUI.Full
1124
* Defines TextPicker Component instance.
1126
* @syscap SystemCapability.ArkUI.ArkUI.Full
1131
declare const TextPickerInstance: TextPickerAttribute;
1133
declare module "textPickerDialogParam" {
1134
module "textPickerDialogParam" {
1136
export { TextPickerDialogOptions };