diff --git a/BUILD.gn b/BUILD.gn index f7d21c2b719f1c13aeff64807f7f9667bf0501ae..563ce5ae6056ecafba5ba9d855bb7401e8bd8e58 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021-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 @@ -14,6 +14,7 @@ import("//build/ohos.gni") import("//build/ohos/notice/notice.gni") import("//build/templates/metadata/module_info.gni") +import("interface_config.gni") ohos_copy("ets_internal_api") { sources = [ @@ -28,7 +29,6 @@ ohos_copy("ets_internal_api") { ohos_copy("ets_component") { sources = [ - "api/@internal/component/ets/ability_component.d.ts", "api/@internal/component/ets/action_sheet.d.ts", "api/@internal/component/ets/alert_dialog.d.ts", "api/@internal/component/ets/alphabet_indexer.d.ts", @@ -37,22 +37,26 @@ ohos_copy("ets_component") { "api/@internal/component/ets/blank.d.ts", "api/@internal/component/ets/button.d.ts", "api/@internal/component/ets/calendar.d.ts", - "api/@internal/component/ets/camera.d.ts", + "api/@internal/component/ets/canvas.d.ts", + "api/@internal/component/ets/checkbox.d.ts", + "api/@internal/component/ets/checkboxgroup.d.ts", "api/@internal/component/ets/circle.d.ts", "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", - "api/@internal/component/ets/datapanel.d.ts", - "api/@internal/component/ets/datePicker.d.ts", + "api/@internal/component/ets/data_panel.d.ts", + "api/@internal/component/ets/date_picker.d.ts", "api/@internal/component/ets/divider.d.ts", "api/@internal/component/ets/ellipse.d.ts", + "api/@internal/component/ets/enums.d.ts", "api/@internal/component/ets/flex.d.ts", - "api/@internal/component/ets/forEach.d.ts", + "api/@internal/component/ets/for_each.d.ts", "api/@internal/component/ets/form_component.d.ts", "api/@internal/component/ets/gauge.d.ts", - "api/@internal/component/ets/geometryView.d.ts", "api/@internal/component/ets/gesture.d.ts", "api/@internal/component/ets/grid.d.ts", "api/@internal/component/ets/gridItem.d.ts", @@ -60,21 +64,20 @@ ohos_copy("ets_component") { "api/@internal/component/ets/hyperlink.d.ts", "api/@internal/component/ets/image.d.ts", "api/@internal/component/ets/image_animator.d.ts", - "api/@internal/component/ets/index.d.ts", - "api/@internal/component/ets/lazyForEach.d.ts", + "api/@internal/component/ets/index-full.d.ts", + "api/@internal/component/ets/lazy_for_each.d.ts", "api/@internal/component/ets/line.d.ts", "api/@internal/component/ets/list.d.ts", - "api/@internal/component/ets/listItem.d.ts", - "api/@internal/component/ets/loadingProgress.d.ts", + "api/@internal/component/ets/list_item.d.ts", + "api/@internal/component/ets/loading_progress.d.ts", "api/@internal/component/ets/marquee.d.ts", - "api/@internal/component/ets/menu.d.ts", + "api/@internal/component/ets/navigation.d.ts", "api/@internal/component/ets/navigator.d.ts", - "api/@internal/component/ets/navigatorView.d.ts", - "api/@internal/component/ets/option.d.ts", - "api/@internal/component/ets/pageTransition.d.ts", + "api/@internal/component/ets/page_transition.d.ts", "api/@internal/component/ets/panel.d.ts", "api/@internal/component/ets/path.d.ts", - "api/@internal/component/ets/piece.d.ts", + "api/@internal/component/ets/pattern_lock.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", @@ -82,23 +85,41 @@ ohos_copy("ets_component") { "api/@internal/component/ets/radio.d.ts", "api/@internal/component/ets/rating.d.ts", "api/@internal/component/ets/rect.d.ts", + "api/@internal/component/ets/refresh.d.ts", + "api/@internal/component/ets/relative_container.d.ts", + "api/@internal/component/ets/remote_window.d.ts", + "api/@internal/component/ets/rich_text.d.ts", "api/@internal/component/ets/row.d.ts", "api/@internal/component/ets/row_split.d.ts", "api/@internal/component/ets/scroll.d.ts", + "api/@internal/component/ets/scroll_bar.d.ts", + "api/@internal/component/ets/search.d.ts", + "api/@internal/component/ets/select.d.ts", "api/@internal/component/ets/shape.d.ts", + "api/@internal/component/ets/sidebar.d.ts", "api/@internal/component/ets/slider.d.ts", "api/@internal/component/ets/span.d.ts", "api/@internal/component/ets/stack.d.ts", - "api/@internal/component/ets/stateManagement.d.ts", + "api/@internal/component/ets/state_management.d.ts", + "api/@internal/component/ets/stepper.d.ts", + "api/@internal/component/ets/stepper_item.d.ts", "api/@internal/component/ets/swiper.d.ts", "api/@internal/component/ets/tab_content.d.ts", "api/@internal/component/ets/tabs.d.ts", "api/@internal/component/ets/text.d.ts", - "api/@internal/component/ets/textPicker.d.ts", - "api/@internal/component/ets/textarea.d.ts", - "api/@internal/component/ets/textinput.d.ts", + "api/@internal/component/ets/text_area.d.ts", + "api/@internal/component/ets/text_clock.d.ts", + "api/@internal/component/ets/text_input.d.ts", + "api/@internal/component/ets/text_picker.d.ts", + "api/@internal/component/ets/text_timer.d.ts", + "api/@internal/component/ets/time_picker.d.ts", "api/@internal/component/ets/toggle.d.ts", + "api/@internal/component/ets/units.d.ts", "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/grid_col.d.ts", + "api/@internal/component/ets/grid_row.d.ts", ] outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] module_source_dir = target_out_dir + "/$target_name" @@ -106,28 +127,14 @@ ohos_copy("ets_component") { } ohos_copy("common_api") { - sources = [ - "api/common/@system.app.d.ts", - "api/common/@system.battery.d.ts", - "api/common/@system.bluetooth.d.ts", - "api/common/@system.brightness.d.ts", - "api/common/@system.cipher.d.ts", - "api/common/@system.configuration.d.ts", - "api/common/@system.device.d.ts", - "api/common/@system.fetch.d.ts", - "api/common/@system.file.d.ts", - "api/common/@system.geolocation.d.ts", - "api/common/@system.mediaquery.d.ts", - "api/common/@system.network.d.ts", - "api/common/@system.notification.d.ts", - "api/common/@system.package.d.ts", - "api/common/@system.prompt.d.ts", - "api/common/@system.request.d.ts", - "api/common/@system.router.d.ts", - "api/common/@system.sensor.d.ts", - "api/common/@system.storage.d.ts", - "api/common/@system.vibrator.d.ts", - ] + sources = common_api_src + outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] + module_source_dir = target_out_dir + "/$target_name" + module_install_name = "" +} + +ohos_copy("bundle_api") { + sources = [ "api/bundle/bundleStatusCallback.d.ts" ] outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] module_source_dir = target_out_dir + "/$target_name" module_install_name = "" @@ -137,7 +144,7 @@ template("ohos_declaration_template") { forward_variables_from(invoker, "*") action_with_pydeps(target_name) { script = "//interface/sdk-js/remove_internal.py" - outputs = [ root_out_dir + "/$target_name/" ] + outputs = [ root_out_dir + "/ohos_declaration/$target_name" ] args = [ "--input", rebase_path("//interface/sdk-js/api", root_build_dir), @@ -159,13 +166,62 @@ template("ohos_declaration_template") { ohos_declaration_template("ohos_declaration_ets") { } -ohos_declaration_template("ohos_declaration_phone") { +ohos_declaration_template("ohos_declaration_common") { +} + +ohos_copy("internal_full") { + sources = [ + "api/common/full/console.d.ts", + "api/common/full/dom.d.ts", + "api/common/full/featureability.d.ts", + "api/common/full/global.d.ts", + "api/common/full/index.d.ts", + "api/common/full/viewmodel.d.ts", + ] + outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] + module_source_dir = target_out_dir + "/$target_name" + module_install_name = "" +} + +ohos_copy("internal_lite") { + sources = [ + "api/common/lite/console.d.ts", + "api/common/lite/featureability.d.ts", + "api/common/lite/global.d.ts", + "api/common/lite/index.d.ts", + "api/common/lite/viewmodel.d.ts", + ] + outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] + module_source_dir = target_out_dir + "/$target_name" + module_install_name = "" +} + +ohos_copy("syscap_check") { + sources = [ "api/syscapCheck/sysCapSchema.json" ] + outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] + module_source_dir = target_out_dir + "/$target_name" + module_install_name = "" +} + +ohos_copy("system_api") { + sources = [ + "api/@system.app.d.ts", + "api/@system.cipher.d.ts", + "api/@system.configuration.d.ts", + "api/@system.file.d.ts", + "api/@system.mediaquery.d.ts", + "api/@system.prompt.d.ts", + "api/@system.router.d.ts", + ] + outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] + module_source_dir = target_out_dir + "/$target_name" + module_install_name = "" } -ohos_copy("ace_platform") { +ohos_copy("config") { sources = [ - "api/config", - "api/phone", + "api/config/css", + "api/config/hml", ] outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] module_source_dir = target_out_dir + "/$target_name" diff --git a/OAT.xml b/OAT.xml index 63d6db0d996949d97aa23e700794ea21f2674d34..54d143702bcb0a239baf3c871e46e17d8eeda208 100644 --- a/OAT.xml +++ b/OAT.xml @@ -54,6 +54,7 @@ Note:If the text contains special characters, please escape them according to th < == > > == > --> + diff --git a/README_en.md b/README_en.md new file mode 100644 index 0000000000000000000000000000000000000000..e5bb3ba338d79016b453e9bec2a46634aab11039 --- /dev/null +++ b/README_en.md @@ -0,0 +1,8 @@ +# API Declaration File Public Repository + +- [Introduction](#section11660541593) + +## Introduction + +JavaScript API public repository which is used to submit API d.ts Declaration File. + diff --git a/api/@internal/component/ets/ability_component.d.ts b/api/@internal/component/ets/ability_component.d.ts index 2ca00277284586bbe46e14156c25f717b9f2f150..359bba529746a7a02d5220f5639ddec85edd40b7 100644 --- a/api/@internal/component/ets/ability_component.d.ts +++ b/api/@internal/component/ets/ability_component.d.ts @@ -1,41 +1,47 @@ -/* - * 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 {Want} from "../api/common/ability/want"; - -export declare class AbilityController { - constructor(); - startAbility(value: Want); - performBackPress(); - getStackCount(); -} - -export declare class AbilityComponentExtend extends AbilityComponentAttribute { -} - -interface AbilityComponent extends AbilityComponentAttribute { - (value: { want: Want, controller?: AbilityController }): AbilityComponent; -} - -declare class AbilityComponentAttribute extends CommonMethod { - onReady(event: () => void): T; - onDestroy(event: () => void): T; - onAbilityCreated(event: (name: string) => void): T; - onAbilityMoveToFront(event: () => void): T; - onAbilityWillRemove(event: () => void): T; -} - -export declare const AbilityComponentInterface: AbilityComponent; +/* + * 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. + */ + +/** + * Provides an interface for the ability component. + * @since 9 + */ +interface AbilityComponentInterface { + /** + * Construct the ability component. + * Called when the ability component is used. + * @since 9 + */ + (want: Want): AbilityComponentAttribute; +} + +/** + * Defines the attribute functions of ability component. + * @since 9 + */ +declare class AbilityComponentAttribute extends CommonMethod { + /** + * Called when the component connected with ability. + * @since 9 + */ + onConnect(callback: () => void): AbilityComponentAttribute; + /** + * Called when the component onDisconnected with ability. + * @since 9 + */ + onDisconnect(callback: () => void): AbilityComponentAttribute; +} + +declare const AbilityComponent: AbilityComponentInterface; +declare const AbilityComponentInstance: AbilityComponentAttribute; diff --git a/api/@internal/component/ets/action_sheet.d.ts b/api/@internal/component/ets/action_sheet.d.ts index 26a0620988ba02a72140f0e6594110ea990e3817..05b10052b23ea2fdb1ee38e134bd4d4e79796505 100644 --- a/api/@internal/component/ets/action_sheet.d.ts +++ b/api/@internal/component/ets/action_sheet.d.ts @@ -13,35 +13,99 @@ * limitations under the License. */ -import { DialogAlignment } from "./alert_dialog"; -import {CommonMethod, Resource} from "./common" +/** + * The information of sheet. + * @since 8 + */ interface SheetInfo { + /** + * Title Properties + * @since 8 + */ title: string | Resource; - icon?: string | Resource; - action: () => void; -} -export declare class ActionSheetExtend extends ActionSheetAttribute { -} + /** + * Icon Properties. + * @since 8 + */ + icon?: string | Resource; -interface ActionSheet extends ActionSheetAttribute { + /** + * Callback method after the operation. + * @since 8 + */ + action: () => void; } -declare class ActionSheetAttribute extends CommonMethod { - show(value: { +/** + * Declare the ActionSheet + * @since 8 + */ +declare class ActionSheet { + /** + * Invoking method display. + * @since 8 + */ + static show(value: { + /** + * Title Properties + * @since 8 + */ title: string | Resource; + + /** + * message Properties + * @since 8 + */ message: string | Resource; + + /** + * Invoke the commit function. + * @since 8 + */ confirm?: { + /** + * Text content of the confirmation button. + * @since 8 + */ value: string | Resource; + + /** + * Method executed by the callback. + * @since 8 + */ action: () => void; }; + + /** + * Execute Cancel Function. + * @since 8 + */ cancel?: () => void; + + /** + * The Array of sheets + * @since 8 + */ sheets: Array; + + /** + * Allows users to click the mask layer to exit. + * @since 8 + */ autoCancel?: boolean; + + /** + * Alignment in the vertical direction. + * @since 8 + */ alignment?: DialogAlignment; - offset?: { dx: number | string | Resource, dy: number | string | Resource }; + + /** + * Offset of the pop-up window relative to the alignment position. + * @since 8 + */ + offset?: { dx: number | string | Resource; dy: number | string | Resource }; }); } - -export declare const ActionSheetInterface: ActionSheet; diff --git a/api/@internal/component/ets/alert_dialog.d.ts b/api/@internal/component/ets/alert_dialog.d.ts index 361b9823cc132048c5780b626f13d481cb3cfdf3..56f25ee6597851a4b30fd03e152a70bc925bda60 100644 --- a/api/@internal/component/ets/alert_dialog.d.ts +++ b/api/@internal/component/ets/alert_dialog.d.ts @@ -1,55 +1,242 @@ -/* - * 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, Resource} from "./common" - -export declare enum DialogAlignment { - Top, - Center, - Bottom, - Default -} - -interface AlertDialog { - show(value: { - title?: string | Resource; - message: string | Resource; - autoCancel?: boolean; - confirm?: { - value: string | Resource; - action: () => void; - }; - cancel?: () => void; - alignment?: DialogAlignment; - offset?: { dx: number | string | Resource, dy: number | string | Resource }; - } | { - title?: string | Resource; - message: string | Resource; - autoCancel?: boolean; - primaryButton: { - value: string | Resource; - action: () => void; - }; - secondaryButton: { - value: string | Resource; - action: () => void; - }; - cancel?: () => void; - alignment?: DialogAlignment; - offset?: { dx: number | string | Resource, dy: number | string | Resource }; - }); -} - -export declare const AlertDialogInterface: AlertDialog; +/* + * 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. + */ + +/** + * The alignment of dialog, + * @since 7 + */ +declare enum DialogAlignment { + /** + * Vertical top alignment. + * @since 7 + */ + Top, + + /** + * Align vertically to the center. + * @since 7 + */ + Center, + + /** + * Vertical bottom alignment. + * @since 7 + */ + Bottom, + + /** + * Default alignment. + * @since 7 + */ + Default, + + /** + * Align the upper left corner. + * @since 8 + */ + TopStart, + + /** + * Align the upper right corner. + * @since 8 + */ + TopEnd, + + /** + * Left center alignment. + * @since 8 + */ + CenterStart, + + /** + * Right center alignment. + * @since 8 + */ + CenterEnd, + + /** + * Align the lower left corner. + * @since 8 + */ + BottomStart, + + /** + * Align the lower right corner. + * @since 8 + */ + BottomEnd, +} + +/** + * Base param used for AlertDialog.show method. + * @since 7 + */ +declare interface AlertDialogParam { + /** + * Title Properties + * @since 7 + */ + title?: ResourceStr; + + /** + * message Properties + * @since 7 + */ + message: ResourceStr; + + /** + * Allows users to click the mask layer to exit. + * @since 7 + */ + autoCancel?: boolean; + + /** + * Execute Cancel Function. + * @since 7 + */ + cancel?: () => void; + + /** + * Alignment in the vertical direction. + * @since 7 + */ + alignment?: DialogAlignment; + + /** + * Offset of the pop-up window relative to the alignment position. + * @since 7 + */ + offset?: Offset; + + /** + * Grid count of dialog. + * @since 7 + */ + gridCount?: number; +} + +/** + * Defines the AlertDialog with confirm button. + * @since 7 + */ +declare interface AlertDialogParamWithConfirm extends AlertDialogParam { + /** + * Invoke the commit function. + * @since 7 + */ + confirm?: { + /** + * Text content of the confirmation button. + * @since 7 + */ + value: ResourceStr; + + /** + * Text color of the confirmation button. + * @since 7 + */ + fontColor?: ResourceColor; + + /** + * Background color of the confirmation button. + * @since 7 + */ + backgroundColor?: ResourceColor; + + /** + * Method executed by the callback. + * @since 7 + */ + action: () => void; + }; +} + +/** + * Defines the dialog param with buttons. + * @since 7 + */ +declare interface AlertDialogParamWithButtons extends AlertDialogParam { + /** + * First button. + * @since 7 + */ + primaryButton: { + /** + * Text content of the confirmation button. + * @since 7 + */ + value: ResourceStr; + + /** + * Text color of the confirmation button. + * @since 7 + */ + fontColor?: ResourceColor; + + /** + * Background color of the confirmation button. + * @since 7 + */ + backgroundColor?: ResourceColor; + + /** + * Method executed by the callback. + * @since 7 + */ + action: () => void; + }; + + /** + * Second button. + * @since 7 + */ + secondaryButton: { + /** + * Text content of the confirmation button. + * @since 7 + */ + value: ResourceStr; + + /** + * Text color of the confirmation button. + * @since 7 + */ + fontColor?: ResourceColor; + + /** + * Background color of the confirmation button. + * @since 7 + */ + backgroundColor?: ResourceColor; + + /** + * Method executed by the callback. + * @since 7 + */ + action: () => void; + }; +} + +/** + * Defines AlertDialog which uses show method to show alert dialog. + * @since 7 + */ +declare class AlertDialog { + /** + * Invoking method display. + * @since 7 + */ + static show(value: AlertDialogParamWithConfirm | AlertDialogParamWithButtons); +} diff --git a/api/@internal/component/ets/alphabet_indexer.d.ts b/api/@internal/component/ets/alphabet_indexer.d.ts index 27d0858af6d35065cd5795a3082390cb79f7ef05..42a4b1694a04863d01bae5fc71a2ace9462f4fe4 100644 --- a/api/@internal/component/ets/alphabet_indexer.d.ts +++ b/api/@internal/component/ets/alphabet_indexer.d.ts @@ -13,45 +13,145 @@ * limitations under the License. */ -import {CommonMethod, Color, Resource} from "./common"; -import {FontWeight, FontStyle} from "./text"; - -export declare enum IndexerAlign { +/** + * indexer align property. + * @since 7 + */ +declare enum IndexerAlign { + /** + * A dialog box is displayed on the right of the index bar. + * @since 7 + */ Left, - Right -} -export declare class AlphabetIndexerExtend extends AlphabetIndexerAttribute { + /** + * A dialog box is displayed on the left of the index bar. + * @since 7 + */ + Right, } -interface AlphabetIndexer extends AlphabetIndexerAttribute { - (value: {ArrayValue : Array, selected : number}): AlphabetIndexer; +/** + * Alphabet index bar. + * @since 7 + */ +interface AlphabetIndexerInterface { + /** + * ArrayValue: Alphabetical index string array. + * selected: ID of the selected item. + * @since 7 + */ + (value: { arrayValue: Array; selected: number }): AlphabetIndexerAttribute; } -declare class AlphabetIndexerAttribute extends CommonMethod { - onSelected(event: (index: number) => void): T; - - color(value: Color | number | string | Resource): T; - - selectedColor(value: Color | number | string | Resource): T; - - popupColor(value: Color | number | string | Resource): T; - - selectedBackgroundColor(value: Color | number | string | Resource): T; - - popupBackground(value: Color | number | string | Resource): T; - - usingPopup(value: boolean): T; - - selectedFont(value: { size?: number, weight?: FontWeight, family?: string, style?: FontStyle}): T; - - popupFont(value: { size?: number, weight?: FontWeight, family?: string, style?: FontStyle}): T; - - itemSize(value: string | number): T; - - font(value: { size?: number, weight?: FontWeight, family?: string, style?: FontStyle}): T; - - alignStyle(value: IndexerAlign): T; +/** + * Defines the alphabet index bar attribute functions. + * @since 7 + */ +declare class AlphabetIndexerAttribute extends CommonMethod { + /** + * Index bar selection callback. + * @since 7 + * @deprecated since 8 + */ + onSelected(callback: (index: number) => void): AlphabetIndexerAttribute; + + /** + * Definitions color. + * @since 7 + */ + color(value: ResourceColor): AlphabetIndexerAttribute; + + /** + * Select the text color. + * @since 7 + */ + selectedColor(value: ResourceColor): AlphabetIndexerAttribute; + + /** + * Font color of the pop-up prompt text. + * @since 7 + */ + popupColor(value: ResourceColor): AlphabetIndexerAttribute; + + /** + * Select the text background color. + * @since 7 + */ + selectedBackgroundColor(value: ResourceColor): AlphabetIndexerAttribute; + + /** + * Background color of the pop-up window index. + * @since 7 + */ + popupBackground(value: ResourceColor): AlphabetIndexerAttribute; + + /** + * Whether to use pop-up index hints. + * @since 7 + */ + usingPopup(value: boolean): AlphabetIndexerAttribute; + + /** + * Select the text text style, + * @since 7 + */ + selectedFont(value: Font): AlphabetIndexerAttribute; + + /** + * Select the text background color. + * @since 7 + */ + popupFont(value: Font): AlphabetIndexerAttribute; + + /** + * Size of the letter area on the letter index bar. The letter area is a square. Set the length of the square side. + * @since 7 + */ + itemSize(value: string | number): AlphabetIndexerAttribute; + + /** + * Definitions fonts. + * @since 7 + */ + font(value: Font): AlphabetIndexerAttribute; + + /** + * Alphabet index bar alignment style. The left and right alignment styles are supported, which affects the pop-up position of the pop-up window. + * @since 7 + */ + alignStyle(value: IndexerAlign): AlphabetIndexerAttribute; + + /** + * Index bar selection callback. + * @since 8 + */ + onSelect(callback: (index: number) => void): AlphabetIndexerAttribute; + + /** + * Index bar selection callback and return the strings which display on pop-up. + * @since 8 + */ + onRequestPopupData(callback: (index: number) => Array): AlphabetIndexerAttribute; + + /** + * Pop-up selection callback. + * @since 8 + */ + onPopupSelect(callback: (index: number) => void): AlphabetIndexerAttribute; + + /** + * Sets the selected index. + * @since 8 + */ + selected(index: number): AlphabetIndexerAttribute; + + /** + * Position of the pop-up windows, relative to the midpoint of the top border of the indexer bar. + * @since 8 + */ + popupPosition(value: Position): AlphabetIndexerAttribute; } -export declare const AlphabetIndexerInterface: AlphabetIndexer; +declare const AlphabetIndexer: AlphabetIndexerInterface; +declare const AlphabetIndexerInstance: AlphabetIndexerAttribute; diff --git a/api/@internal/component/ets/animator.d.ts b/api/@internal/component/ets/animator.d.ts index 2e51167d79395db85b2229575965e5b04518afca..ff253c2ebaa90bfc339572b4c13555577ca65064 100644 --- a/api/@internal/component/ets/animator.d.ts +++ b/api/@internal/component/ets/animator.d.ts @@ -13,59 +13,180 @@ * limitations under the License. */ -import {CommonMethod, AnimationStatus, Curve, FillMode, PlayMode} from "./common"; - -export declare class SpringProp { +/** + * Customize spring properties. + * @since 7 + * @systemapi + */ +declare class SpringProp { + /** + * Constructor parameters + * @since 7 + * @systemapi + */ constructor(mass: number, stiffness: number, damping: number); } -export declare class SpringMotion { +/** + * Spring animation model. You can build a spring animation based on the start point, end point, initial speed, and spring attributes. + * @since 7 + * @systemapi + */ +declare class SpringMotion { + /** + * Constructor parameters + * @since 7 + * @systemapi + */ constructor(start: number, end: number, velocity: number, prop: SpringProp); } -export declare class FrictionMotion { +/** + * Friction animation model. You can build friction animation by friction force, initial position, and initial velocity. + * @since 7 + * @systemapi + */ +declare class FrictionMotion { + /** + * Constructor parameters + * @since 7 + * @systemapi + */ constructor(friction: number, position: number, velocity: number); } -export declare class ScrollMotion { +/** + * Rolling animation model: You can build rolling animation based on the initial position, initial speed, boundary position, and spring attributes. + * @since 7 + * @systemapi + */ +declare class ScrollMotion { + /** + * Constructor parameters + * @since 7 + * @systemapi + */ constructor(position: number, velocity: number, min: number, max: number, prop: SpringProp); } -export declare class AnimatorExtend extends AnimatorAttribute { -} - -interface Animator extends AnimatorAttribute { - (value: string): Animator; +/** + * Defines Animtor. + * @since 7 + * @systemapi + */ +interface AnimatorInterface { + /** + * Constructor parameters + * @since 7 + * @systemapi + */ + (value: string): AnimatorAttribute; } -declare class AnimatorAttribute extends CommonMethod { - state(value: AnimationStatus): T; - - duration(value: number): T; - - curve(value: Curve): T; - - delay(value: number): T; - - fillMode(value: FillMode): T; - - iterations(value: number): T; - - playMode(value: PlayMode): T; - - motion(value: SpringMotion | FrictionMotion | ScrollMotion): T; - - onStart(event: () => void): T; - - onPause(event: () => void): T; - - onRepeat(event: () => void): T; - - onCancel(event: () => void): T; - - onFinish(event: () => void): T; - - onFrame(event: (value: number) => void): T; +/** + * Defines AnimatorAttribute. + * @since 7 + * @systemapi + */ +declare class AnimatorAttribute extends CommonMethod { + /** + * Controls the playback status. The default value is the initial state. + * @since 7 + * @systemapi + */ + state(value: AnimationStatus): AnimatorAttribute; + + /** + * Animation duration, in milliseconds. + * @since 7 + * @systemapi + */ + duration(value: number): AnimatorAttribute; + + /** + * Animation curve, default to linear curve + * @since 7 + * @systemapi + */ + curve(value: Curve): AnimatorAttribute; + + /** + * Delayed animation playback duration, in milliseconds. By default, the animation is not delayed. + * @since 7 + * @systemapi + */ + delay(value: number): AnimatorAttribute; + + /** + * Sets the state before and after the animation starts. + * @since 7 + * @systemapi + */ + fillMode(value: FillMode): AnimatorAttribute; + + /** + * The default playback is once. If the value is -1, the playback is unlimited. + * @since 7 + * @systemapi + */ + iterations(value: number): AnimatorAttribute; + + /** + * Sets the animation playback mode. By default, the animation starts to play again after the playback is complete. + * @since 7 + * @systemapi + */ + playMode(value: PlayMode): AnimatorAttribute; + + /** + * Configure the physical animation algorithm. + * @since 7 + * @systemapi + */ + motion(value: SpringMotion | FrictionMotion | ScrollMotion): AnimatorAttribute; + + /** + * Status callback, which is triggered when the animation starts to play. + * @since 7 + * @systemapi + */ + onStart(event: () => void): AnimatorAttribute; + + /** + * Status callback, triggered when the animation pauses. + * @since 7 + * @systemapi + */ + onPause(event: () => void): AnimatorAttribute; + + /** + * Status callback, triggered when the animation is replayed. + * @since 7 + * @systemapi + */ + onRepeat(event: () => void): AnimatorAttribute; + + /** + * Status callback, which is triggered when the animation is canceled. + * @since 7 + * @systemapi + */ + onCancel(event: () => void): AnimatorAttribute; + + /** + * Status callback, which is triggered when the animation playback is complete. + * @since 7 + * @systemapi + */ + onFinish(event: () => void): AnimatorAttribute; + + /** + * The callback input parameter is the interpolation during animation playback. + * @since 7 + * @systemapi + */ + onFrame(event: (value: number) => void): AnimatorAttribute; } -export declare const AnimatorInterface: Animator; \ No newline at end of file +declare const Animator: AnimatorInterface; +declare const AnimatorInstance: AnimatorAttribute; diff --git a/api/@internal/component/ets/badge.d.ts b/api/@internal/component/ets/badge.d.ts index 49587d21ee2bd80205bd31d44c626d767193c63c..6c6ef7b5936c4e46a99a4a1cd8780479c6f19028 100644 --- a/api/@internal/component/ets/badge.d.ts +++ b/api/@internal/component/ets/badge.d.ts @@ -1,42 +1,149 @@ -/* - * 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, Color} from "./common" - -declare enum BadgePosition { - Right, - RightTop, - Left -} - -interface BadgeStyle { - color?: Color; - fontSize?: number | string; - badgeSize?: number | string; - badgeColor: Color; -} - -export declare class BadgeExtend extends BadgeAttribute { -} - -interface Badge extends BadgeAttribute { - (value: {count: number, position?: BadgePosition, maxCount?: number, style?: BadgeStyle}): Badge; - (value: {value: string, position?: BadgePosition, maxCount?: number, style?: BadgeStyle}): Badge; -} - -declare class BadgeAttribute extends CommonMethod { -} - -export declare const BadgeInterface: Badge \ No newline at end of file +/* + * 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 badge position property. + * @since 7 + */ +declare enum BadgePosition { + /** + * The dot is displayed vertically centered on the right. + * @since 7 + */ + RightTop, + + /** + * Dots are displayed in the upper right corner. + * @since 7 + */ + Right, + + /** + * The dot is displayed in the left vertical center. + * @since 7 + */ + Left, +} + +/** + * BadgeStyle object + * @since 7 + */ +declare interface BadgeStyle { + /** + * Text Color + * @since 7 + */ + color?: ResourceColor; + + /** + * Text size. + * @since 7 + */ + fontSize?: number | string; + + /** + * Size of a badge. + * @since 7 + */ + badgeSize?: number | string; + + /** + * Color of the badge. + * @since 7 + */ + badgeColor?: ResourceColor; +} + +/** + * Defines the base param of badge. + * @since 7 + */ +declare interface BadgeParam { + /** + * Set the display position of the prompt point. + * @since 7 + */ + position?: BadgePosition; + + /** + * Defines the style of the Badge component, including the text color, size, dot color, and size. + * @since 7 + */ + style: BadgeStyle; +} + +/** + * Defines the badge param with count and maxCount. + * @since 7 + */ +declare interface BadgeParamWithNumber extends BadgeParam { + /** + * Set the number of reminder messages. + * @since 7 + */ + count: number; + + /** + * Maximum number of messages. If the number of messages exceeds the maximum, only maxCount+ is displayed. + * @since 7 + */ + maxCount?: number; +} + +/** + * Defines the badge param with string value. + * @since 7 + */ +declare interface BadgeParamWithString extends BadgeParam { + /** + * Text string of the prompt content. + * @since 7 + */ + value: string; +} + +/** + * Defines Badge Componrnt. + * @since 7 + */ +interface BadgeInterface { + /** + * position: Set the display position of the prompt point. + * maxCount: Maximum number of messages. If the number of messages exceeds the maximum, only maxCount+ is displayed. + * count: Set the number of reminder messages. + * style: You can set the style of the Badge component, including the text color, size, dot color, and size. + * @since 7 + */ + (value: BadgeParamWithNumber): BadgeAttribute; + + /** + * value: Text string of the prompt content. + * position: Set the display position of the prompt point. + * maxCount: Maximum number of messages. If the number of messages exceeds the maximum, only maxCount+ is displayed. + * style: You can set the style of the Badge component, including the text color, size, dot color, and size. + * @since 7 + */ + (value: BadgeParamWithString): BadgeAttribute; +} + +/** + * Defines Badge Componrnt attribute. + * @since 7 + */ +declare class BadgeAttribute extends CommonMethod {} + +declare const Badge: BadgeInterface; +declare const BadgeInstance: BadgeAttribute; diff --git a/api/@internal/component/ets/blank.d.ts b/api/@internal/component/ets/blank.d.ts index 42a841d29d59dd3b8c6f03ffbf8ae2ab277b198a..327a53ef07df5b396233d579af5981d57c9008cd 100644 --- a/api/@internal/component/ets/blank.d.ts +++ b/api/@internal/component/ets/blank.d.ts @@ -13,17 +13,29 @@ * limitations under the License. */ -import {CommonMethod, Color, Resource} from "./common" - -export declare class BlankExtend extends BlankAttribute { -} - -interface Blank extends BlankAttribute { - (min?: number | string): Blank; +/** + * Create Blank. + * @since 7 + */ +interface BlankInterface { + /** + * The minimum size of the blank fill assembly on the container spindle. + * @since 7 + */ + (min?: number | string): BlankAttribute; } -declare class BlankAttribute extends CommonMethod { - color(value: Color | number | string | Resource): T; +/** + * Inheritance CommonMethod Set Styles + * @since 7 + */ +declare class BlankAttribute extends CommonMethod { + /** + * color: set color. + * @since 7 + */ + color(value: ResourceColor): BlankAttribute; } -export declare const BlankInterface: Blank \ No newline at end of file +declare const Blank: BlankInterface; +declare const BlankInstance: BlankAttribute; diff --git a/api/@internal/component/ets/button.d.ts b/api/@internal/component/ets/button.d.ts index 8f7fd66a661e841cab04781a665e23344d266a7b..3ad3db720fe0169a43cd945cc9f01a02d853fcac 100644 --- a/api/@internal/component/ets/button.d.ts +++ b/api/@internal/component/ets/button.d.ts @@ -13,37 +13,119 @@ * limitations under the License. */ -import {CommonMethod, Color, Resource} from "./common" -import {FontWeight} from "./text" - -export declare enum ButtonType { +/** + * Provides a button component. + * @since 7 + */ +declare enum ButtonType { + /** + * Capsule button (rounded corners default to half the height). + * @since 7 + */ Capsule, + + /** + * Round buttons. + * @since 7 + */ Circle, - Arc, - Normal + + /** + * Common button (no rounded corners by default). + * @since 7 + */ + Normal, } -export declare class ButtonExtend extends ButtonAttribute { +/** + * Defines the button options. + * @since 7 + */ +declare interface ButtonOptions { + /** + * Describes the button style. + * @since 7 + */ + type?: ButtonType; + + /** + * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled. + * @since 7 + */ + stateEffect?: boolean; } -interface Button extends ButtonAttribute