• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * Sets the sidebar style of showing
18 * @since 8
19 */
20declare enum SideBarContainerType {
21  /**
22   * The sidebar invisible
23   * @since 8
24   */
25  Embed,
26  /**
27   * The sidebar visible
28   * @since 8
29   */
30  Overlay,
31}
32
33/**
34 * Sets the sidebar position of showing
35 * @since 9
36 */
37declare enum SideBarPosition {
38  /**
39   * The sidebar is on the Start of the container
40   * @since 9
41   */
42  Start,
43  /**
44   * The sidebar is on the End of the container
45   * @since 9
46   */
47  End,
48}
49
50/**
51 * Sets the control button style
52 * @since 8
53 */
54declare interface ButtonStyle {
55  /**
56   * Set the left of control button
57   * @since 8
58   */
59  left?: number;
60  /**
61   * Set the top of control button
62   * @since 8
63   */
64  top?: number;
65  /**
66   * Set the width of control button
67   * @since 8
68   */
69  width?: number;
70
71  /**
72   * Set the height of control button
73   * @since 8
74   */
75  height?: number;
76
77  /**
78   * Set the button icon when sidebar status has changed
79   * @since 8
80   */
81  icons?: {
82    shown: string | PixelMap | Resource;
83    hidden: string | PixelMap | Resource;
84    switching?: string | PixelMap | Resource;
85  };
86}
87
88/**
89 * The construct function of sidebar
90 * @since 8
91 */
92interface SideBarContainerInterface {
93  /**
94   * Called when showing the sidebar of a block entry.
95   * @since 8
96   */
97  (type?: SideBarContainerType): SideBarContainerAttribute;
98}
99
100/**
101 * The attribute function of sidebar
102 * @since 8
103 */
104declare class SideBarContainerAttribute extends CommonMethod<SideBarContainerAttribute> {
105  /**
106   * Callback showControlButton function when setting the status of sidebar
107   * @since 8
108   */
109  showSideBar(value: boolean): SideBarContainerAttribute;
110  /**
111   * Callback controlButton function when setting the style of button
112   * @since 8
113   */
114  controlButton(value: ButtonStyle): SideBarContainerAttribute;
115  /**
116   * Callback showControlButton function when setting the status of button
117   * @since 8
118   */
119  showControlButton(value: boolean): SideBarContainerAttribute;
120  /**
121   * Trigger callback when sidebar style of showing change finished.
122   * @since 8
123   */
124  onChange(callback: (value: boolean) => void): SideBarContainerAttribute;
125  /**
126   * Sets the length of sidebar.
127   * @since 8
128   */
129  sideBarWidth(value: number): SideBarContainerAttribute;
130  /**
131   * Sets the min length of sidebar.
132   * default value is 200vp.
133   * @since 8
134   */
135  minSideBarWidth(value: number): SideBarContainerAttribute;
136  /**
137   * Sets the max length of sidebar.
138   * default value is 280vp.
139   * @since 8
140   */
141  maxSideBarWidth(value: number): SideBarContainerAttribute;
142  /**
143   * Sets the length of sidebar.
144   * @since 9
145   */
146  sideBarWidth(value: Length): SideBarContainerAttribute;
147  /**
148   * Sets the min length of sidebar.
149   * default value is 200vp.
150   * @since 9
151   */
152  minSideBarWidth(value: Length): SideBarContainerAttribute;
153  /**
154   * Sets the max length of sidebar.
155   * default value is 280vp.
156   * @since 9
157   */
158  maxSideBarWidth(value: Length): SideBarContainerAttribute;
159  /**
160   * Sets whether to automatically hide when drag sidebar width is less than the minimum width.
161   * default value is true.
162   * @since 9
163   */
164  autoHide(value: boolean): SideBarContainerAttribute;
165  /**
166   * Called when determining the location of the sidebar.
167   * default value is Start.
168   * @since 9
169   */
170  sideBarPosition(value: SideBarPosition): SideBarContainerAttribute;
171}
172
173/**
174 * Defines SideBarContainer Component.
175 * @since 8
176 */
177declare const SideBarContainer: SideBarContainerInterface;
178
179/**
180 * Defines SideBarContainer Component instance.
181 * @since 8
182 */
183declare const SideBarContainerInstance: SideBarContainerAttribute;
184