diff --git a/api/@ohos.arkui.UIContext.d.ts b/api/@ohos.arkui.UIContext.d.ts index 9278165b5bd7f616acb3e86bc9c9dc9e263c4191..1863f4b0e31a79fb47edab574b8c4a3cb5543899 100644 --- a/api/@ohos.arkui.UIContext.d.ts +++ b/api/@ohos.arkui.UIContext.d.ts @@ -2258,6 +2258,59 @@ export declare class UIObserver { */ off(type: 'didClick', callback?: ClickEventListenerCallback): void; + /** + * Registers a callback function to be called when text field's content is changed. + * + * @param { 'textChange' } type - The type of event to listen for. Must be 'textChange'. + * @param { Callback } callback - The callback function to be called when + * text field's content is changed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ + on(type: 'textChange', callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'textChange' } type - The type of event to remove the listener for. Must be 'textChange'. + * @param { Callback } [callback] - The callback function to remove. If not provided, + * all callbacks for the given event type will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ + off(type: 'textChange', callback?: Callback): void; + + + /** + * Registers a callback function to be called when text field's content is changed. + * + * @param { 'textChange' } type - The type of event to listen for. Must be 'textChange'. + * @param { observer.ObserverOptions } observerOptions - Options. + * @param { Callback } callback - The callback function to be called when the + * text field's content is changed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ + on(type: 'textChange', observerOptions: observer.ObserverOptions, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'textChange' } type - The type of event to remove the listener for. Must be 'textChange'. + * @param { observer.ObserverOptions } observerOptions - Options. + * @param { Callback } [callback] - The callback function to remove. If not provided, + * all callbacks for the given event type will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ + off(type: 'textChange', observerOptions: observer.ObserverOptions, callback?: Callback): void; + /** * Registers a callback function to be called before tapGesture is called. * diff --git a/api/@ohos.arkui.observer.d.ts b/api/@ohos.arkui.observer.d.ts index dcc34ce7762a7935db1f6c721c8b0778ea3d7cde..bc1fb4205fdccd13d82fec7be0727c2fbf3a98ba 100644 --- a/api/@ohos.arkui.observer.d.ts +++ b/api/@ohos.arkui.observer.d.ts @@ -518,6 +518,49 @@ declare namespace uiObserver { uniqueId?: number; } + /** + * Text change event info + * + * @interface TextChangeEventInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ +export interface TextChangeEventInfo { + /** + * The id of text field component. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ + id: string; + + /** + * The uniqueId of the text field component. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 21 + */ + uniqueId: number; + /** + * Current content of text field component . + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + content: string; +} + /** * Navigation info. *