From 1131c27a254c602fcd3761f0750401f7005cd798 Mon Sep 17 00:00:00 2001 From: yaoyuchi Date: Fri, 28 Jan 2022 09:24:25 +0800 Subject: [PATCH] sidebar dts code commit Signed-off-by: yaoyuchi --- BUILD.gn | 1 + api/@internal/component/ets/index.d.ts | 1 + api/@internal/component/ets/sidebar.d.ts | 117 +++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 api/@internal/component/ets/sidebar.d.ts diff --git a/BUILD.gn b/BUILD.gn index b475a6938f..c3244d0bb3 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -87,6 +87,7 @@ ohos_copy("ets_component") { "api/@internal/component/ets/search.d.ts", "api/@internal/component/ets/shape.d.ts", "api/@internal/component/ets/sheet.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", diff --git a/api/@internal/component/ets/index.d.ts b/api/@internal/component/ets/index.d.ts index de7da7d660..7596be204b 100644 --- a/api/@internal/component/ets/index.d.ts +++ b/api/@internal/component/ets/index.d.ts @@ -97,3 +97,4 @@ /// /// /// +/// diff --git a/api/@internal/component/ets/sidebar.d.ts b/api/@internal/component/ets/sidebar.d.ts new file mode 100644 index 0000000000..d03148ce7d --- /dev/null +++ b/api/@internal/component/ets/sidebar.d.ts @@ -0,0 +1,117 @@ +/* + * 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. + */ + +/** + * Sets the sidebar style of showing + * @since 8 + */ +declare enum SideBarContainerStyle { + /** + * The sidebar invisible + * @since 8 + */ + Embed, + /** + * The sidebar visible + * @since 8 + */ + Overlay +} + +/** + * Sets the control button style + * @since 8 + */ +declare interface ButtonStyle { + /** + * Set the left of control button + * @since 8 + */ + left?: number; + /** + * Set the top of control button + * @since 8 + */ + top?: number; + /** + * Set the width of control button + * @since 8 + */ + width?: number; + + /** + * Set the heigth of control button + * @since 8 + */ + height?: number; + + /** + * Set the button icon when sidebar status has changed + * @since 8 + */ + icons?: {shown:string, hidden: string, switching?: string} +} + +/** + * The construct function of sidebar + * @since 8 + */ +interface SideBarContainerInterface { + /** + * Called when showing the sidebar of a block entry. + * @since 8 + */ + (options?: { showSideBarContainer?: boolean, + style?: SideBarContainerStyle, + buttonAtt?: ButtonStyle}): SideBarContainerAttribute; +} + +/** + * The attribute function of sidebar + * @since 8 + */ + +declare class SideBarContainerAttribute extends CommonMethod { + /** + * Callback showControlButton function when setting the status of button + * @since 8 + */ + showControlButton(value: boolean): SideBarContainerAttribute; + /** + * Callback onChange function when sidebar style of showing has changed + * @since 8 + */ + onChange(callback: (value: boolean) => void): SideBarContainerAttribute; + /** + * Sets the length of sidebar. + * @since 8 + */ + sideBarWidth(value: number): SideBarContainerAttribute; + /** + * Sets the min length of sidebar. + * default value is 200vp. + * @since 8 + */ + minSideBarWidth(value: number): SideBarContainerAttribute; + /** + * Sets the max length of sidebar. + * default value is 280vp. + * @since 8 + */ + maxSideBarWidth(value: number): SideBarContainerAttribute; +} + +declare const SideBarContainer: SideBarContainerInterface; +declare const SideBarContainerInstance: SideBarContainerAttribute; \ No newline at end of file -- Gitee