From 3f55bf36349e28e52b44fd679882d54f9f4a1ce2 Mon Sep 17 00:00:00 2001 From: lizhouze Date: Tue, 7 Jun 2022 14:19:50 +0800 Subject: [PATCH] lizhouze@huawei.com Signed-off-by: lizhouze --- BUILD.gn | 1 + .../component/ets/common_ts_ets_api.d.ts | 501 ++++++++++++++++++ .../component/ets/state_management.d.ts | 493 +---------------- 3 files changed, 503 insertions(+), 492 deletions(-) create mode 100644 api/@internal/component/ets/common_ts_ets_api.d.ts diff --git a/BUILD.gn b/BUILD.gn index 96aa78f91e..6ee98ed20e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -44,6 +44,7 @@ ohos_copy("ets_component") { "api/@internal/component/ets/column.d.ts", "api/@internal/component/ets/column_split.d.ts", "api/@internal/component/ets/common.d.ts", + "api/@internal/component/ets/common_ts_ets_api.d.ts", "api/@internal/component/ets/context_menu.d.ts", "api/@internal/component/ets/counter.d.ts", "api/@internal/component/ets/custom_dialog_controller.d.ts", diff --git a/api/@internal/component/ets/common_ts_ets_api.d.ts b/api/@internal/component/ets/common_ts_ets_api.d.ts new file mode 100644 index 0000000000..1416b44d75 --- /dev/null +++ b/api/@internal/component/ets/common_ts_ets_api.d.ts @@ -0,0 +1,501 @@ +/* + * Copyright (c) 2022 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. + */ + +/** + * Defines the AppStorage interface. + * @since 7 + */ +declare class AppStorage { + /** + * Called when a link is set. + * @since 7 + */ + static Link(propName: string): any; + + /** + * Called when a hyperlink is set. + * @since 7 + */ + static SetAndLink(propName: string, defaultValue: T): SubscribedAbstractProperty; + + /** + * Called when a property is set. + * @since 7 + */ + static Prop(propName: string): any; + + /** + * Called when dynamic properties are set. + * @since 7 + */ + static SetAndProp(propName: string, defaultValue: S): SubscribedAbstractProperty; + + /** + * Called when owning or not. + * @since 7 + */ + static Has(propName: string): boolean; + + /** + * Called when data is obtained. + * @since 7 + */ + static Get(propName: string): T | undefined; + + /** + * Called when setting. + * @since 7 + */ + static Set(propName: string, newValue: T): boolean; + + /** + * Called when setting or creating. + * @since 7 + */ + static SetOrCreate(propName: string, newValue: T): void; + + /** + * Called when a deletion is made. + * @since 7 + */ + static Delete(propName: string): boolean; + + /** + * Called when a dictionary is sorted. + * @since 7 + */ + static Keys(): IterableIterator; + + /** + * Called when a cleanup occurs. + * @since 7 + */ + static staticClear(): boolean; + + /** + * Called when the data can be changed. + * @since 7 + */ + static IsMutable(propName: string): boolean; + + /** + * Called when you check how much data is stored. + * @since 7 + */ + static Size(): number; +} + +/** + * Defines the subscribed abstract property. + * @since 7 + * @systemapi + */ +declare abstract class SubscribedAbstractProperty { + /** + * Setting Subscribers. + * @since 7 + * @systemapi + */ + protected subscribers_: Set; + + /** + * Private user ID. + * @since 7 + * @systemapi + */ + private id_; + + /** + * Private user information. + * @since 7 + * @systemapi + */ + private info_?; + + /** + * @since 7 + * @systemapi + */ + constructor( + /** + * Subscriber IPropertySubscriber. + * @since 7 + * @systemapi + */ + subscribeMe?: IPropertySubscriber, + /** + * Subscriber info. + * @since 7 + * @systemapi + */ + info?: string, + ); + + /** + * Called when the subscriber ID is entered. + * @since 7 + * @systemapi + */ + id(): number; + + /** + * Called when a subscriber information description is entered. + * @since 7 + * @systemapi + */ + info(): string; + + /** + * Called when data is obtained. + * @since 7 + * @systemapi + */ + abstract get(): T; + + /** + * Called when data is created. + * @since 7 + * @systemapi + */ + abstract set(newValue: T): void; + + /** + * Called when a two-way synchronization is created. + * @since 7 + * @systemapi + */ + createTwoWaySync(subscribeMe?: IPropertySubscriber, info?: string): SyncedPropertyTwoWay; + + /** + * Called when a one-way synchronization is created. + * @since 7 + * @systemapi + */ + createOneWaySync(subscribeMe?: IPropertySubscriber, info?: string): SyncedPropertyOneWay; + + /** + * Called when the subscriber is unlinked. + * @since 7 + * @systemapi + */ + unlinkSuscriber(subscriberId: number): void; + + /** + * Called when the notification has changed. + * @since 7 + * @systemapi + */ + protected notifyHasChanged(newValue: T): void; + + /** + * Called when the notification property is read. + * @since 7 + * @systemapi + */ + protected notifyPropertyRead(): void; + + /** + * Called when the number of users is queried. + * @since 7 + * @systemapi + */ + numberOfSubscrbers(): number; +} + +/** + * Provides an interface for attribute subscribers. + * @since 7 + * @systemapi + */ +interface IPropertySubscriber { + /** + * Called when the ID of the property subscriber is queried. + * @since 7 + * @systemapi + */ + id(): number; + + /** + * Provides a single attribute change user interface. + * @since 7 + * @systemapi + */ + aboutToBeDeleted(owningView?: IPropertySubscriber): void; +} + +/** + * Defines the state value. + * @since 7 + * @systemapi + */ +declare class SyncedPropertyTwoWay extends SubscribedAbstractProperty + implements ISinglePropertyChangeSubscriber { + /** + * Sources of synchronization attributes bidirectionally. + * @since 7 + * @systemapi + */ + private source_; + + /** + * constructor parameters. + * @since 7 + * @systemapi + */ + constructor(source: SubscribedAbstractProperty, subscribeMe?: IPropertySubscriber, info?: string); + + /** + * Called when processing information about to be deleted. + * @since 7 + * @systemapi + */ + aboutToBeDeleted(unsubscribeMe?: IPropertySubscriber): void; + + /** + * Information Changed. + * @since 7 + * @systemapi + */ + hasChanged(newValue: T): void; + + /** + * Called when data is obtained. + * @since 7 + * @systemapi + */ + get(): T; + + /** + * Called when data is created. + * @since 7 + * @systemapi + */ + set(newValue: T): void; +} + +/** +* Defines the prop state value. +* @since 7 +* @systemapi +*/ +declare class SyncedPropertyOneWay extends SubscribedAbstractProperty + implements ISinglePropertyChangeSubscriber { + /** + * Pack value for single-item binding. + * @since 7 + * @systemapi + */ + private wrappedValue_; + + /** + * Sources of synchronization attributes bidirectionally. + * @since 7 + * @systemapi + */ + private source_; + + /** + * Constructor parameters. + * @since 7 + * @systemapi + */ + constructor(source: SubscribedAbstractProperty, subscribeMe?: IPropertySubscriber, info?: string); + + /** + * Called when processing information about to be deleted. + * @since 7 + * @systemapi + */ + aboutToBeDeleted(unsubscribeMe?: IPropertySubscriber): void; + + /** + * Information Changed. + * @since 7 + * @systemapi + */ + hasChanged(newValue: T): void; + + /** + * Called when data is obtained. + * @since 7 + * @systemapi + */ + get(): T; + + /** + * Called when data is created. + * @since 7 + * @systemapi + */ + set(newValue: T): void; +} + +/** + * Defines the subscriber. + * @since 7 + * @systemapi + */ +interface ISinglePropertyChangeSubscriber extends IPropertySubscriber { + /** + * Provides a single attribute change user interface. + * @since 7 + * @systemapi + */ + hasChanged(newValue: T): void; +} + +/** + * Defines the Subscribale base class. + * @since 7 + * @systemapi + * @hide + */ +declare abstract class SubscribaleAbstract { + /** + * Returns the ownership attribute set by the. + * @since 7 + * @systemapi + * @hide + */ + private owningProperties_: Set; + + /** + * Constructor. + * @since 7 + * @systemapi + * @hide + */ + constructor(); + + /** + * Called when the notification property has changed. + * @since 7 + * @systemapi + * @hide + */ + protected notifyPropertyHasChanged(propName: string, newValue: any): void; + + /** + * Called when adding an already owned property. + * @since 7 + * @systemapi + * @hide + */ + public addOwningProperty(subscriber: IPropertySubscriber): void; + + /** + * Called when an already owned property is deleted. + * @since 7 + * @systemapi + * @hide + */ + public removeOwningProperty(property: IPropertySubscriber): void; + + /** + * Called when an already owned property is deleted by ID + * @since 7 + * @systemapi + * @hide + */ + public removeOwningPropertyById(subscriberId: number): void; +} + +/** + * Defines the Environment interface. + * @since 7 + */ +declare class Environment { + /** + * Constructor. + * @since 7 + * @systemapi + * @hide + */ + constructor(); + + /** + * Called when a property value is checked. + * @since 7 + */ + static EnvProp(key: string, value: S): boolean; + + /** + * Called when multiple property values are checked. + * @since 7 + */ + static EnvProps( + props: { + key: string; + defaultValue: any; + }[], + ): void; + + /** + * Set the key value. + * @since 7 + */ + static Keys(): Array; +} + +/** + * Defines the PersistentStorage interface. + * @since 7 + */ +declare class PersistentStorage { + /** + * Constructor parameters. + * @since 7 + * @systemapi + * @hide + */ + constructor(appStorage: AppStorage, storage: Storage); + + /** + * Called when a persistence property is stored. + * @since 7 + */ + static PersistProp(key: string, defaultValue: T): void; + + /** + * Called when a property is deleted. + * @since 7 + */ + static DeleteProp(key: string): void; + + /** + * Called when multiple persistence properties are stored. + * @since 7 + */ + static PersistProps( + properties: { + key: string; + defaultValue: any; + }[], + ): void; + + /** + * Set the key value. + * @since 7 + */ + static Keys(): Array; +} + +/** + * Used for ide. + * @since 7 + * @systemapi + * @hide + */ +declare const appStorage: AppStorage; \ No newline at end of file diff --git a/api/@internal/component/ets/state_management.d.ts b/api/@internal/component/ets/state_management.d.ts index 7054019e1a..fbbbef9b4e 100644 --- a/api/@internal/component/ets/state_management.d.ts +++ b/api/@internal/component/ets/state_management.d.ts @@ -13,390 +13,6 @@ * limitations under the License. */ -/** - * Provides an interface for attribute subscribers. - * @since 7 - * @systemapi - */ -interface IPropertySubscriber { - /** - * Called when the ID of the property subscriber is queried. - * @since 7 - * @systemapi - */ - id(): number; - - /** - * Provides a single attribute change user interface. - * @since 7 - * @systemapi - */ - aboutToBeDeleted(owningView?: IPropertySubscriber): void; -} - -/** - * Defines the subscriber. - * @since 7 - * @systemapi - */ -interface ISinglePropertyChangeSubscriber extends IPropertySubscriber { - /** - * Provides a single attribute change user interface. - * @since 7 - * @systemapi - */ - hasChanged(newValue: T): void; -} - -/** - * Defines the subscribed abstract property. - * @since 7 - * @systemapi - */ -declare abstract class SubscribedAbstractProperty { - /** - * Setting Subscribers. - * @since 7 - * @systemapi - */ - protected subscribers_: Set; - - /** - * Private user ID. - * @since 7 - * @systemapi - */ - private id_; - - /** - * Private user information. - * @since 7 - * @systemapi - */ - private info_?; - - /** - * @since 7 - * @systemapi - */ - constructor( - /** - * Subscriber IPropertySubscriber. - * @since 7 - * @systemapi - */ - subscribeMe?: IPropertySubscriber, - /** - * Subscriber info. - * @since 7 - * @systemapi - */ - info?: string, - ); - - /** - * Called when the subscriber ID is entered. - * @since 7 - * @systemapi - */ - id(): number; - - /** - * Called when a subscriber information description is entered. - * @since 7 - * @systemapi - */ - info(): string; - - /** - * Called when data is obtained. - * @since 7 - * @systemapi - */ - abstract get(): T; - - /** - * Called when data is created. - * @since 7 - * @systemapi - */ - abstract set(newValue: T): void; - - /** - * Called when a two-way synchronization is created. - * @since 7 - * @systemapi - */ - createTwoWaySync(subscribeMe?: IPropertySubscriber, info?: string): SyncedPropertyTwoWay; - - /** - * Called when a one-way synchronization is created. - * @since 7 - * @systemapi - */ - createOneWaySync(subscribeMe?: IPropertySubscriber, info?: string): SyncedPropertyOneWay; - - /** - * Called when the subscriber is unlinked. - * @since 7 - * @systemapi - */ - unlinkSuscriber(subscriberId: number): void; - - /** - * Called when the notification has changed. - * @since 7 - * @systemapi - */ - protected notifyHasChanged(newValue: T): void; - - /** - * Called when the notification property is read. - * @since 7 - * @systemapi - */ - protected notifyPropertyRead(): void; - - /** - * Called when the number of users is queried. - * @since 7 - * @systemapi - */ - numberOfSubscrbers(): number; -} - -/** - * Defines the state value. - * @since 7 - * @systemapi - */ -declare class SyncedPropertyTwoWay - extends SubscribedAbstractProperty - implements ISinglePropertyChangeSubscriber -{ - /** - * Sources of synchronization attributes bidirectionally. - * @since 7 - * @systemapi - */ - private source_; - - /** - * constructor parameters. - * @since 7 - * @systemapi - */ - constructor(source: SubscribedAbstractProperty, subscribeMe?: IPropertySubscriber, info?: string); - - /** - * Called when processing information about to be deleted. - * @since 7 - * @systemapi - */ - aboutToBeDeleted(unsubscribeMe?: IPropertySubscriber): void; - - /** - * Information Changed. - * @since 7 - * @systemapi - */ - hasChanged(newValue: T): void; - - /** - * Called when data is obtained. - * @since 7 - * @systemapi - */ - get(): T; - - /** - * Called when data is created. - * @since 7 - * @systemapi - */ - set(newValue: T): void; -} - -/** - * Defines the prop state value. - * @since 7 - * @systemapi - */ -declare class SyncedPropertyOneWay - extends SubscribedAbstractProperty - implements ISinglePropertyChangeSubscriber -{ - /** - * Pack value for single-item binding. - * @since 7 - * @systemapi - */ - private wrappedValue_; - - /** - * Sources of synchronization attributes bidirectionally. - * @since 7 - * @systemapi - */ - private source_; - - /** - * Constructor parameters. - * @since 7 - * @systemapi - */ - constructor(source: SubscribedAbstractProperty, subscribeMe?: IPropertySubscriber, info?: string); - - /** - * Called when processing information about to be deleted. - * @since 7 - * @systemapi - */ - aboutToBeDeleted(unsubscribeMe?: IPropertySubscriber): void; - - /** - * Information Changed. - * @since 7 - * @systemapi - */ - hasChanged(newValue: T): void; - - /** - * Called when data is obtained. - * @since 7 - * @systemapi - */ - get(): T; - - /** - * Called when data is created. - * @since 7 - * @systemapi - */ - set(newValue: T): void; -} - -/** - * Defines the AppStorage interface. - * @since 7 - */ -declare class AppStorage { - /** - * Called when a link is set. - * @since 7 - */ - static Link(propName: string): any; - - /** - * Called when a hyperlink is set. - * @since 7 - */ - static SetAndLink(propName: string, defaultValue: T): SubscribedAbstractProperty; - - /** - * Called when a property is set. - * @since 7 - */ - static Prop(propName: string): any; - - /** - * Called when dynamic properties are set. - * @since 7 - */ - static SetAndProp(propName: string, defaultValue: S): SubscribedAbstractProperty; - - /** - * Called when owning or not. - * @since 7 - */ - static Has(propName: string): boolean; - - /** - * Called when data is obtained. - * @since 7 - */ - static Get(propName: string): T | undefined; - - /** - * Called when setting. - * @since 7 - */ - static Set(propName: string, newValue: T): boolean; - - /** - * Called when setting or creating. - * @since 7 - */ - static SetOrCreate(propName: string, newValue: T): void; - - /** - * Called when a deletion is made. - * @since 7 - */ - static Delete(propName: string): boolean; - - /** - * Called when a dictionary is sorted. - * @since 7 - */ - static Keys(): IterableIterator; - - /** - * Called when a cleanup occurs. - * @since 7 - */ - static staticClear(): boolean; - - /** - * Called when the data can be changed. - * @since 7 - */ - static IsMutable(propName: string): boolean; - - /** - * Called when you check how much data is stored. - * @since 7 - */ - static Size(): number; -} - -/** - * Defines the Environment interface. - * @since 7 - */ -declare class Environment { - /** - * Constructor. - * @since 7 - * @systemapi - * @hide - */ - constructor(); - - /** - * Called when a property value is checked. - * @since 7 - */ - static EnvProp(key: string, value: S): boolean; - - /** - * Called when multiple property values are checked. - * @since 7 - */ - static EnvProps( - props: { - key: string; - defaultValue: any; - }[], - ): void; - - /** - * Set the key value. - * @since 7 - */ - static Keys(): Array; -} - /** * Defines the ColorMode of device. * @since 7 @@ -439,49 +55,6 @@ declare enum LayoutDirection { Auto, } -/** - * Defines the PersistentStorage interface. - * @since 7 - */ -declare class PersistentStorage { - /** - * Constructor parameters. - * @since 7 - * @systemapi - * @hide - */ - constructor(appStorage: AppStorage, storage: Storage); - - /** - * Called when a persistence property is stored. - * @since 7 - */ - static PersistProp(key: string, defaultValue: T): void; - - /** - * Called when a property is deleted. - * @since 7 - */ - static DeleteProp(key: string): void; - - /** - * Called when multiple persistence properties are stored. - * @since 7 - */ - static PersistProps( - properties: { - key: string; - defaultValue: any; - }[], - ): void; - - /** - * Set the key value. - * @since 7 - */ - static Keys(): Array; -} - /** * Defines the base class of storage. * @since 7 @@ -529,62 +102,6 @@ declare class Storage { delete(key: string): void; } -/** - * Defines the Subscribale base class. - * @since 7 - * @systemapi - * @hide - */ -declare abstract class SubscribaleAbstract { - /** - * Returns the ownership attribute set by the. - * @since 7 - * @systemapi - * @hide - */ - private owningProperties_: Set; - - /** - * Constructor. - * @since 7 - * @systemapi - * @hide - */ - constructor(); - - /** - * Called when the notification property has changed. - * @since 7 - * @systemapi - * @hide - */ - protected notifyPropertyHasChanged(propName: string, newValue: any): void; - - /** - * Called when adding an already owned property. - * @since 7 - * @systemapi - * @hide - */ - public addOwningProperty(subscriber: IPropertySubscriber): void; - - /** - * Called when an already owned property is deleted. - * @since 7 - * @systemapi - * @hide - */ - public removeOwningProperty(property: IPropertySubscriber): void; - - /** - * Called when an already owned property is deleted by ID - * @since 7 - * @systemapi - * @hide - */ - public removeOwningPropertyById(subscriberId: number): void; -} - /** * Defining LocalStorage. * @since 9 @@ -675,12 +192,4 @@ declare class LocalStorage { * @since 9 */ clear(): boolean; -} - -/** - * Used for ide. - * @since 7 - * @systemapi - * @hide - */ -declare const appStorage: AppStorage; +} \ No newline at end of file -- Gitee