From af9bccd51f5041381bf157eb461beb75375c96cb Mon Sep 17 00:00:00 2001 From: lizhouze Date: Thu, 2 Jun 2022 14:57:07 +0800 Subject: [PATCH] lizhouze@huawei.com Signed-off-by: lizhouze --- BUILD.gn | 1 + .../component/ets/common_ts_ets_api.ts | 422 ++++++++++++++++++ api/@internal/component/ets/index-full.d.ts | 1 + .../component/ets/state_management.d.ts | 405 ----------------- 4 files changed, 424 insertions(+), 405 deletions(-) create mode 100644 api/@internal/component/ets/common_ts_ets_api.ts diff --git a/BUILD.gn b/BUILD.gn index 96aa78f91e..8e952ed637 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -115,6 +115,7 @@ ohos_copy("ets_component") { "api/@internal/component/ets/video.d.ts", "api/@internal/component/ets/web.d.ts", "api/@internal/component/ets/xcomponent.d.ts", + "api/@internal/component/ets/common_ts_ets_api.d.ts", ] outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] module_source_dir = target_out_dir + "/$target_name" diff --git a/api/@internal/component/ets/common_ts_ets_api.ts b/api/@internal/component/ets/common_ts_ets_api.ts new file mode 100644 index 0000000000..11b4292e10 --- /dev/null +++ b/api/@internal/component/ets/common_ts_ets_api.ts @@ -0,0 +1,422 @@ +/* + * Copyright (c) 2021 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; +} + + + +/** + * Used for ide. + * @since 7 + * @systemapi + * @hide + */ + declare const appStorage: AppStorage; \ No newline at end of file diff --git a/api/@internal/component/ets/index-full.d.ts b/api/@internal/component/ets/index-full.d.ts index 49f67636a8..c9c94a9415 100644 --- a/api/@internal/component/ets/index-full.d.ts +++ b/api/@internal/component/ets/index-full.d.ts @@ -102,3 +102,4 @@ /// /// /// +/// diff --git a/api/@internal/component/ets/state_management.d.ts b/api/@internal/component/ets/state_management.d.ts index 7054019e1a..89ce682768 100644 --- a/api/@internal/component/ets/state_management.d.ts +++ b/api/@internal/component/ets/state_management.d.ts @@ -13,352 +13,11 @@ * 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. @@ -529,62 +188,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 @@ -676,11 +279,3 @@ declare class LocalStorage { */ clear(): boolean; } - -/** - * Used for ide. - * @since 7 - * @systemapi - * @hide - */ -declare const appStorage: AppStorage; -- Gitee