/* * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Define the contents of each selector item. * * @interface TextPickerRangeContent * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare interface TextPickerRangeContent { /** * Specifies the icon content. * * @type { string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ icon: string | Resource; /** * Specifies the text content. * * @type { ?(string | Resource) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ text?: string | Resource; } /** * Define the contents of text cascade picker. * * @interface TextCascadePickerRangeContent * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ declare interface TextCascadePickerRangeContent { /** * Specifies the text content. * * @type { string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ text: string | Resource; /** * Defines the text cascade picker children. * * @type { ?TextCascadePickerRangeContent[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ children?: TextCascadePickerRangeContent[]; } /** * Defines the options of TextPicker. * * @interface TextPickerOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Defines the options of TextPicker. * * @interface TextPickerOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare interface TextPickerOptions { /** * Specifies the range of the text selector. * * @type {string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[]} * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Specifies the range of the selector. * Support the display of pictures, text and pictures plus text, or multi column plain text. * * @type {string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[]} * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ range: string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[]; /** * Value of the current selection. * * @type { ?(string | string[]) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Value of the current selection. * Only valid when only text is displayed. * * @type { ?(string | string[]) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ value?: string | string[]; /** * Current selected subscript. * * @type { ?(number | number[]) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Current selected subscript. * * @type { ?(number | number[]) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ selected?: number | number[]; } /** * TextPickerInterface * * @interface TextPickerInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * TextPickerInterface * * @interface TextPickerInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ interface TextPickerInterface { /** * Defines the TextPicker constructor. * * @param { TextPickerOptions } options * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Defines the TextPicker constructor. * * @param { TextPickerOptions } options * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ (options?: TextPickerOptions): TextPickerAttribute; } /** * Style the text selector. * * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Style the text selector. * * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare class TextPickerAttribute extends CommonMethod { /** * Called when the default height of the selected element is set. * * @param { number | string } value * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the default height of the selected element is set. * * @param { number | string } value * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ defaultPickerItemHeight(value: number | string): TextPickerAttribute; /** * Can scroll loop if true is set, on the contrary it can not. * * @param { boolean } value * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ canLoop(value: boolean): TextPickerAttribute; /** * Sets the text style of disappearing items * * @param { PickerTextStyle } value - indicates the text style of disappearing items. * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ disappearTextStyle(value: PickerTextStyle): TextPickerAttribute; /** * Sets the text style of normal items * * @param { PickerTextStyle } value - indicates the text style of normal items. * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ textStyle(value: PickerTextStyle): TextPickerAttribute; /** * Sets the text style of selected items * * @param { PickerTextStyle } value - indicates the text style of selected items. * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ selectedTextStyle(value: PickerTextStyle): TextPickerAttribute; /** * Called when the pop-up value is returned. * * @param { function } callback * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 * @deprecated since 10 */ onAccept(callback: (value: string, index: number) => void): TextPickerAttribute; /** * Called when the Cancel button in the pop-up window is clicked. * * @param { function } callback * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 * @deprecated since 10 */ onCancel(callback: () => void): TextPickerAttribute; /** * Called when the OK button in the pop-up window is clicked. * * @param { function } callback - the callback of onChange. * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * This event is triggered when a TextPicker item is selected. * Only valid when only text is displayed. When picture or picture plus text is displayed, the value is "". * * @param { function } callback - the callback of onChange. * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ onChange(callback: (value: string | string[], index: number | number[]) => void): TextPickerAttribute; /** * Set the selected indices. * The array size is the total number of columns. * * @param { number | number[] } value - the selected indices. * @returns { TextPickerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ selectedIndex(value: number | number[]): TextPickerAttribute; } /** * Defines the struct of TextPickerResult. * * @interface TextPickerResult * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Defines the struct of TextPickerResult. * * @interface TextPickerResult * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare interface TextPickerResult { /** * The currently selected value. * * @type { string | string[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * The currently selected value. * Only valid when only text is displayed.When picture or picture plus text is displayed, the value of value is "". * * @type { string | string[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ value: string | string[]; /** * The subscript of the current selection. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * The subscript of the current selection. * * @type { number | number[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ index: number | number[]; } /** * Defines the TextPickerDialogOptions for Text Picker Dialog. * * @interface TextPickerDialogOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Defines the TextPickerDialogOptions for Text Picker Dialog. * * @interface TextPickerDialogOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare interface TextPickerDialogOptions extends TextPickerOptions { /** * Called when the default height of the selected element is set. * * @type { ?(number | string) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the default height of the selected element is set. * * @type { ?(number | string) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ defaultPickerItemHeight?: number | string; /** * Can scroll loop if true is set, on the contrary it can not. * * @type { ?boolean } * @default true * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ canLoop?: boolean; /** * Text style of disappearing items * * @type { ?PickerTextStyle } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ disappearTextStyle?: PickerTextStyle; /** * Text style of normal items * * @type { ?PickerTextStyle } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ textStyle?: PickerTextStyle; /** * Text style of selected items * * @type { ?PickerTextStyle } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ selectedTextStyle?: PickerTextStyle; /** * Called when the OK button in the dialog is clicked. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the OK button in the dialog is clicked. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ onAccept?: (value: TextPickerResult) => void; /** * Called when the Cancel button in the dialog is clicked. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the Cancel button in the dialog is clicked. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ onCancel?: () => void; /** * This event is triggered when a TextPicker text is selected in dialog. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * This event is triggered when a TextPicker text is selected in dialog. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ onChange?: (value: TextPickerResult) => void; /** * Mask Region of dialog. The size cannot exceed the main window. * * @type { ?Rectangle } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ maskRect?: Rectangle; /** * Defines the dialog alignment of the screen. * * @type { ?DialogAlignment } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ alignment?: DialogAlignment; /** * Defines the dialog offset. * * @type { ?Offset } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ offset?: Offset; } /** * Defines TextPickerDialog which uses show method to show TextPicker dialog. * * @since 8 */ /** * Defines TextPickerDialog which uses show method to show TextPicker dialog. * * @crossplatform * @since 10 */ declare class TextPickerDialog { /** * Invoking method display. * * @param { TextPickerDialogOptions } options * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Invoking method display. * * @param { TextPickerDialogOptions } options * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ static show(options?: TextPickerDialogOptions); } /** * Defines TextPicker Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Defines TextPicker Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare const TextPicker: TextPickerInterface; /** * Defines TextPicker Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Defines TextPicker Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare const TextPickerInstance: TextPickerAttribute; declare module "textPickerDialogParam" { module "textPickerDialogParam" { // @ts-ignore export { TextPickerDialogOptions }; } }