diff --git a/BUILD.gn b/BUILD.gn index b475a6938fcb2f42bfcfa789d8b595043202e293..c3244d0bb32f281bd99e5efb044e8e31d6e7aa64 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 de7da7d6607a8e89e97c75839b41b9be9e082303..7596be204b7d245406541292f0e6ebeb116ec6bb 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 0000000000000000000000000000000000000000..d03148ce7d619b89f07524da54f550743e71da0c --- /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