From fd8ac3dc3b6739cbf647689573604c105f7459af Mon Sep 17 00:00:00 2001 From: yaoyuchi Date: Mon, 21 Feb 2022 14:59:30 +0800 Subject: [PATCH] fix picker api Signed-off-by: yaoyuchi --- api/@internal/component/ets/date_picker.d.ts | 36 +++---------- api/@internal/component/ets/text_picker.d.ts | 53 ++++++++------------ 2 files changed, 28 insertions(+), 61 deletions(-) diff --git a/api/@internal/component/ets/date_picker.d.ts b/api/@internal/component/ets/date_picker.d.ts index 160033b951..c226c22d01 100644 --- a/api/@internal/component/ets/date_picker.d.ts +++ b/api/@internal/component/ets/date_picker.d.ts @@ -162,48 +162,26 @@ declare interface DatePickerDialogOption extends DatePickerOption { * @since 8 */ lunar?: boolean; - /** * Time Selector: indicates whether to display the 24-hour clock. * @since 8 */ useMilitaryTime?: boolean; -} - -/** - * Defines the event callback status in the pop-up window state. - * @since 8 - */ -declare enum DialogStatus { - /** - * Triggered when a user clicks the OK button. - * @since 8 - */ - Accept, - /** - * Triggered when a user taps the Cancel button. + * Called when the OK button in the dialog is clicked. * @since 8 */ - Cancel, - + onAccept: (value: DatePickerResult) => void; /** - * Triggered when a user performs scrolling selection. + * Called when the Cancel button in the dialog is clicked. * @since 8 */ - Update, -} - -/** - * Defines the DatePickerDialogResult for DatePickerDialog. - * @since 8 - */ -declare interface DatePickerDialogResult extends DatePickerResult { + onCancel: () => void; /** - * Operation status of the current user. + * This event is triggered when a DatePicker date or time is selected in dialog. * @since 8 */ - status: DialogStatus; + onChange: (value: DatePickerResult) => void; } /** @@ -215,7 +193,7 @@ declare class DatePickerDialog { * Invoking method display. * @since 8 */ - static show(options?: DatePickerDialogOption, callback?: (value: DatePickerDialogResult) => void); + static show(options?: DatePickerDialogOption); } declare const DatePicker: DatePickerInterface; diff --git a/api/@internal/component/ets/text_picker.d.ts b/api/@internal/component/ets/text_picker.d.ts index ce575a7a00..02d18efba0 100644 --- a/api/@internal/component/ets/text_picker.d.ts +++ b/api/@internal/component/ets/text_picker.d.ts @@ -89,60 +89,49 @@ declare class TextPickerAttribute extends CommonMethod { } /** - * Defines the TextPickerDialogOption for Text Picker Dialog. + * Defines the struct of TextPickerResult. * @since 8 */ -declare interface TextPickerDialogOption extends TextPickerOption { +declare interface TextPickerResult { /** - * Called when the default height of the selected element is set. + * The currently selected value. * @since 8 */ - defaultPickerItemHeight?: number | string; + value: string; + /** + * The subscript of the current selection. + * @since 8 + */ + index: number; } /** - * Defines the event callback status in the pop-up window state. + * Defines the TextPickerDialogOption for Text Picker Dialog. * @since 8 */ -declare enum TextPickerDialogStatus { - /** - * Triggered when a user clicks the OK button. - * @since 8 - */ - Accept, +declare interface TextPickerDialogOption extends TextPickerOption { /** - * Triggered when a user taps the Cancel button. + * Called when the default height of the selected element is set. * @since 8 */ - Cancel, + defaultPickerItemHeight?: number | string; /** - * Triggered when a user performs scrolling selection. + * Called when the OK button in the dialog is clicked. * @since 8 */ - Update, -} - -/** - * Defines the TextPickerDialogResult for TextPickerDialog. - * @since 8 - */ -declare interface TextPickerDialogResult { - /** - * The currently selected value. - * @since 8 - */ - value: string; + onAccept: (value: TextPickerResult) => void; /** - * The subscript of the current selection. + * Called when the Cancel button in the dialog is clicked. * @since 8 */ - index: number; + onCancel: () => void; /** - * Operation status of the current user. + * This event is triggered when a TextPicker text is selected in dialog. * @since 8 */ - status: TextPickerDialogStatus; + onChange: (value: TextPickerResult) => void; } + /** * Defines TextPickerDialog which uses show method to show TextPicker dialog. * @since 8 @@ -152,7 +141,7 @@ declare class TextPickerDialog { * Invoking method display. * @since 8 */ - static show(options?: TextPickerDialogOption, callback?: (value: TextPickerDialogResult) => void); + static show(options?: TextPickerDialogOption); } declare const TextPicker: TextPickerInterface; -- Gitee