From 5c598487195b6d910aabb6860f256e09c604b96a Mon Sep 17 00:00:00 2001 From: Yao yuchi Date: Mon, 3 Jan 2022 16:50:42 +0800 Subject: [PATCH] d.ts commit Signed-off-by: Yao yuchi --- BUILD.gn | 2 + .../component/ets/alphabet_indexer.d.ts | 14 ++- api/@internal/component/ets/grid.d.ts | 102 ++++++++++++++++ api/@internal/component/ets/index.d.ts | 2 + api/@internal/component/ets/pattern_lock.d.ts | 110 ++++++++++++++++++ .../component/ets/plugin_component.d.ts | 52 +++++++++ api/@ohos.plugincomponent.d.ts | 109 +++++++++++++++++ 7 files changed, 390 insertions(+), 1 deletion(-) create mode 100644 api/@internal/component/ets/pattern_lock.d.ts create mode 100644 api/@internal/component/ets/plugin_component.d.ts create mode 100644 api/@ohos.plugincomponent.d.ts diff --git a/BUILD.gn b/BUILD.gn index 38c871c843..c7eaf82c4c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -70,7 +70,9 @@ ohos_copy("ets_component") { "api/@internal/component/ets/pageTransition.d.ts", "api/@internal/component/ets/panel.d.ts", "api/@internal/component/ets/path.d.ts", + "api/@internal/component/ets/pattern_lock.d.ts", "api/@internal/component/ets/piece.d.ts", + "api/@internal/component/ets/plugin_component.d.ts", "api/@internal/component/ets/polygon.d.ts", "api/@internal/component/ets/polyline.d.ts", "api/@internal/component/ets/progress.d.ts", diff --git a/api/@internal/component/ets/alphabet_indexer.d.ts b/api/@internal/component/ets/alphabet_indexer.d.ts index 57aa49bc45..e49c2cb517 100644 --- a/api/@internal/component/ets/alphabet_indexer.d.ts +++ b/api/@internal/component/ets/alphabet_indexer.d.ts @@ -54,7 +54,7 @@ interface AlphabetIndexer extends AlphabetIndexerAttribute { declare class AlphabetIndexerAttribute extends CommonMethod { /** * Index bar selection callback. - * @since 7 + * @since 8 */ onSelected(event: (index: number) => void): T; @@ -123,6 +123,18 @@ declare class AlphabetIndexerAttribute extends CommonMethod { * @since 7 */ alignStyle(value: IndexerAlign): T; + + /** + * Index bar selection callback and return the strings which display on pop-up. + * @since 8 + */ + onRequestPopupData(event: (index: number) => Array): T; + + /** + * Pop-up selection callback. + * @since 8 + */ + onPopupSelected(event: (index: number) => void): T; } export declare const AlphabetIndexerInterface: AlphabetIndexer; diff --git a/api/@internal/component/ets/grid.d.ts b/api/@internal/component/ets/grid.d.ts index 227084a5ab..e89e9fce8d 100644 --- a/api/@internal/component/ets/grid.d.ts +++ b/api/@internal/component/ets/grid.d.ts @@ -29,6 +29,36 @@ interface Grid extends GridAttribute { (scroller?: Scroller): Grid; } +/** + * The item drag pos.(x y) + * @since 7 + */ +interface ItemDragInfo { + x: number; + y: number; +} + +/** + * The enum of property layoutDirection + * @since 7 + */ +declare enum LayoutDirection { + Row, + Column, + RowReverse, + ColumnReverse +} + +/** + * The enum of property direction + * @since 7 + */ +declare enum GridDirection { + LTR, + RTL, + Auto +} + /** * @since 7 */ @@ -86,6 +116,78 @@ declare class GridAttribute extends CommonMethod { * @since 7 */ cachedCount(value: number): T; + + /** + * control if the item could be draged. + * @since 7 + */ + editMode(value: boolean): T; + + /** + * control the max row or colum of the dynamicGrid. + * @since 7 + */ + maxCount(value: number): T; + + /** + * control the min row or colum of the dynamicGrid. + * @since 7 + */ + minCount(value: number): T; + + /** + * control the height or width of the grid cell. + * @since 7 + */ + cellLength(value: number): T; + + /** + * control layoutDirection of the grid. + * @since 7 + */ + layoutDirection(value: LayoutDirection): T; + + /** + * control grid is left to right or right to left. + * @since 7 + */ + direction(value: GridDirection): T; + + /** + * control if the grid supports animation. + * @since 7 + */ + supportAnimation(value: boolean): T; + + /** + * the event called when drag enter a grid. + * @since 7 + */ + onItemDragEnter(event: (event: ItemDragInfo) => void): T; + + /** + * the event called when drag the item moving. + * @since 7 + */ + onItemDragMove(event: (event: ItemDragInfo, itemIndex: number, insertIndex: number) => void): T; + + /** + * the event called when drag leave a grid. + * @since 7 + */ + onItemDragLeave(event: (event: ItemDragInfo, itemIndex: number) => void): T; + + /** + * the event called when drag start. + * @since 7 + */ + onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => ((() => any) | void)): T; + + /** + * the event called when drop a item. + * @since 7 + */ + onItemDrop(event: (event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => void): T; } export declare class GridExtend extends GridAttribute {} diff --git a/api/@internal/component/ets/index.d.ts b/api/@internal/component/ets/index.d.ts index e15f82249f..bdf662ef18 100644 --- a/api/@internal/component/ets/index.d.ts +++ b/api/@internal/component/ets/index.d.ts @@ -55,7 +55,9 @@ export * from "./navigator"; export * from "./pageTransition"; export * from "./panel"; export * from "./path"; +export * from "./pattern_lock"; export * from "./piece"; +export * from "./plugin_component"; export * from "./polygon"; export * from "./polyline"; export * from "./progress"; diff --git a/api/@internal/component/ets/pattern_lock.d.ts b/api/@internal/component/ets/pattern_lock.d.ts new file mode 100644 index 0000000000..f7ad544fea --- /dev/null +++ b/api/@internal/component/ets/pattern_lock.d.ts @@ -0,0 +1,110 @@ +/* + * 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. + */ + +import { CommonMethod } from "./common" +import { Length, ResourceColor } from "./units"; + +/** + * Provides methods for control pattern lock component. + * @since 8 + */ +export declare class PatternLockController { + /** + * constructor. + */ + constructor(); + + /** + * Reset pattern lock. + */ + reset(); +} + +/** + * Provides an interface for generating PatternLock. + * @since 8 + */ +interface PatternLock extends PatternLockAttribute { + (controller?: PatternLockController): PatternLock; +} + +/** + * @since 8 + */ +declare class PatternLockAttribute extends CommonMethod { + + /** + * The square side length of pattern lock component. + * @since 8 + */ + sideLength(value: Length): T; + + /** + * Circle radius. + * @since 8 + */ + circleRadius(value: Length): T; + + /** + * The background color. + * @since 8 + */ + backgroundColor(value: ResourceColor): T; + + /** + * Regular color. + * @since 8 + */ + regularColor(value: ResourceColor): T; + + /** + * The color when cell is selected. + * @since 8 + */ + selectedColor(value: ResourceColor): T; + + /** + * The color when cell is active state. + * @since 8 + */ + activeColor(value: ResourceColor): T; + + /** + * The path line color. + * @since 8 + */ + pathColor(value: ResourceColor): T; + + /** + * The path line stroke width. + * @since 8 + */ + pathStrokeWidth(value: number | string): T; + + /** + * Called when the pattern input completed. + * @since 8 + */ + onPatternComplete(callback: (input: Array) => void): T; + + /** + * Called when judging whether the input state can be reset by touch pattern lock. + * @since 8 + */ + autoReset(value: boolean): T; +} + +export declare class PatternLockExtend extends PatternLockAttribute {} +export declare const PatternLockInterface: PatternLock; diff --git a/api/@internal/component/ets/plugin_component.d.ts b/api/@internal/component/ets/plugin_component.d.ts new file mode 100644 index 0000000000..a04f9c59e8 --- /dev/null +++ b/api/@internal/component/ets/plugin_component.d.ts @@ -0,0 +1,52 @@ +/* + * 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. + */ + +import {CommonMethod} from "./common"; +import {PluginComponentTemplate} from "../../../@ohos.plugincomponent" + +/** + * Plugin component property. + * @since 8 + */ +export declare class PluginComponentExtend extends PluginComponentAttribute { +} + +/** + * Plugin component interface. + * @since 8 + */ +interface PluginComponent extends PluginComponentAttribute { + (value: {template: PluginComponentTemplate, data: Object}): PluginComponent; +} + +/** + * Defines plugin component attribute functions. + * @since 8 + */ +declare class PluginComponentAttribute extends CommonMethod { + /** + * Plugin component complete callback. + * @since 8 + */ + onComplete(callback: () => void): T; + + /** + * Plugin component error callback. + * @since 8 + */ + onError(callback: (info: {errcode: number, msg: string}) => void): T; +} + +export declare const PluginComponentInterface: PluginComponent; diff --git a/api/@ohos.plugincomponent.d.ts b/api/@ohos.plugincomponent.d.ts new file mode 100644 index 0000000000..69fe481ec8 --- /dev/null +++ b/api/@ohos.plugincomponent.d.ts @@ -0,0 +1,109 @@ +/* + * 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. + */ + +import { AsyncCallback } from './basic'; +import { Want } from './ability/want'; + +/** + * Plugin component template property. + * @since 8 + */ +export declare interface PluginComponentTemplate { + source: string; + ability: string; +} + +/** + * Plugin component manager interface. + * @since 8 + */ +export declare namespace pluginComponentManager { + type KVObject = {[key: string]: number | string | boolean | [] | KVObject} + + /** + * Plugin component push parameters. + * @since 8 + */ + interface PushParameters { + want: Want; + name: string; + data: KVObject; + extraData: KVObject; + jsonPath?: string; + } + + /** + * Plugin component request parameters. + * @since 8 + */ + interface RequestParameters { + want: Want; + name: string; + data: KVObject; + jsonPath?: string; + } + + /** + * Plugin component request callback parameters. + * @since 8 + */ + interface RequestCallbackParameters { + componentTemplate: PluginComponentTemplate; + data: KVObject; + extraData: KVObject; + } + + /** + * Plugin component request event result value. + * @since 8 + */ + interface RequestEventResult { + template?: string; + data?: KVObject; + extraData?: KVObject; + } + + /** + * Plugin component push event callback. + * @since 8 + */ + type OnPushEventCallback = (source: Want, template: PluginComponentTemplate, data: KVObject, extraData: KVObject) => void; + + /** + * Plugin component request event callback. + * @since 8 + */ + + type OnRequestEventCallback = (source: Want, name: string, data: KVObject) => RequestEventResult; + + /** + * Plugin component push method. + * @since 8 + */ + function push(param: PushParameters, callback: AsyncCallback): void; + + /** + * Plugin component request method. + * @since 8 + */ + function request(param: RequestParameters, callback: AsyncCallback): void; + + /** + * Plugin component event listener. + * @since 8 + */ + function on(eventType: string, callback: OnPushEventCallback | OnRequestEventCallback): void; +} +export default pluginComponentManager; \ No newline at end of file -- Gitee