• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 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 initial state of the slidable panel.
18 *
19 * @enum { number }
20 * @syscap SystemCapability.ArkUI.ArkUI.Full
21 * @since 7
22 */
23/**
24 * Sets the initial state of the slidable panel.
25 *
26 * @enum { number }
27 * @syscap SystemCapability.ArkUI.ArkUI.Full
28 * @crossplatform
29 * @since 10
30 */
31declare enum PanelMode {
32  /**
33   * Minimum state.
34   *
35   * @syscap SystemCapability.ArkUI.ArkUI.Full
36   * @since 7
37   */
38  /**
39   * Minimum state.
40   *
41   * @syscap SystemCapability.ArkUI.ArkUI.Full
42   * @crossplatform
43   * @since 10
44   */
45  Mini,
46
47  /**
48   * SHalf-screen-like status
49   *
50   * @syscap SystemCapability.ArkUI.ArkUI.Full
51   * @since 7
52   */
53  /**
54   * SHalf-screen-like status
55   *
56   * @syscap SystemCapability.ArkUI.ArkUI.Full
57   * @crossplatform
58   * @since 10
59   */
60  Half,
61
62  /**
63   * Class Full Screen Status.
64   *
65   * @syscap SystemCapability.ArkUI.ArkUI.Full
66   * @since 7
67   */
68  /**
69   * Class Full Screen Status.
70   *
71   * @syscap SystemCapability.ArkUI.ArkUI.Full
72   * @crossplatform
73   * @since 10
74   */
75  Full,
76}
77
78/**
79 * Sets the type of sliding panel.
80 *
81 * @enum { number }
82 * @syscap SystemCapability.ArkUI.ArkUI.Full
83 * @since 7
84 */
85/**
86 * Sets the type of sliding panel.
87 *
88 * @enum { number }
89 * @syscap SystemCapability.ArkUI.ArkUI.Full
90 * @crossplatform
91 * @since 10
92 */
93declare enum PanelType {
94  /**
95   * The switch between the minibar and full-screen display is provided.
96   *
97   * @syscap SystemCapability.ArkUI.ArkUI.Full
98   * @since 7
99   */
100  /**
101   * The switch between the minibar and full-screen display is provided.
102   *
103   * @syscap SystemCapability.ArkUI.ArkUI.Full
104   * @crossplatform
105   * @since 10
106   */
107  Minibar = 0,
108
109  /**
110   * Permanent content display class.
111   * The switchover effect is provided in three sizes: large (full-screen), medium (half-screen), and small.
112   *
113   * @syscap SystemCapability.ArkUI.ArkUI.Full
114   * @since 7
115   */
116  /**
117   * Permanent content display class.
118   * The switchover effect is provided in three sizes: large (full-screen), medium (half-screen), and small.
119   *
120   * @syscap SystemCapability.ArkUI.ArkUI.Full
121   * @crossplatform
122   * @since 10
123   */
124  Foldable = 1,
125
126  /**
127   * Temporary content display area.
128   * The switchover effect is provided in three sizes: large (full-screen), medium (half-screen), and small.
129   *
130   * @syscap SystemCapability.ArkUI.ArkUI.Full
131   * @since 7
132   */
133  /**
134   * Temporary content display area.
135   * The switchover effect is provided in three sizes: large (full-screen), medium (half-screen), and small.
136   *
137   * @syscap SystemCapability.ArkUI.ArkUI.Full
138   * @crossplatform
139   * @since 10
140   */
141  Temporary = 2,
142
143  /**
144   * Custom content display area.
145   * The switchover effect is provided in three sizes: large (full-screen), medium (half-screen), and small.
146   * @syscap SystemCapability.ArkUI.ArkUI.Full
147   * @crossplatform
148   * @since 10
149   */
150  CUSTOM = 3,
151}
152
153/**
154 * Enum for custom content display area.
155 *
156 * @enum { string }
157 * @syscap SystemCapability.ArkUI.ArkUI.Full
158 * @crossplatform
159 * @since 10
160 */
161declare enum PanelHeight {
162  /**
163   * The Panel adapts to the content height.
164   *
165   * @syscap SystemCapability.ArkUI.ArkUI.Full
166   * @crossplatform
167   * @since 10
168   */
169  WRAP_CONTENT = 'wrapContent',
170}
171
172/**
173 * Provides a sliding panel interface.
174 *
175 * @interface PanelInterface
176 * @syscap SystemCapability.ArkUI.ArkUI.Full
177 * @since 7
178 */
179/**
180 * Provides a sliding panel interface.
181 *
182 * @interface PanelInterface
183 * @syscap SystemCapability.ArkUI.ArkUI.Full
184 * @crossplatform
185 * @since 10
186 */
187interface PanelInterface {
188  /**
189   * Called when the panel slidable panel pops up.
190   *
191   * @param { boolean } show
192   * @returns { PanelAttribute }
193   * @syscap SystemCapability.ArkUI.ArkUI.Full
194   * @since 7
195   */
196  /**
197   * Called when the panel slidable panel pops up.
198   *
199   * @param { boolean } show
200   * @returns { PanelAttribute }
201   * @syscap SystemCapability.ArkUI.ArkUI.Full
202   * @crossplatform
203   * @since 10
204   */
205  (show: boolean): PanelAttribute;
206}
207
208/**
209 * @extends CommonMethod
210 * @syscap SystemCapability.ArkUI.ArkUI.Full
211 * @since 7
212 */
213/**
214 * Pane Attribute.
215 *
216 * @extends CommonMethod
217 * @syscap SystemCapability.ArkUI.ArkUI.Full
218 * @crossplatform
219 * @since 10
220 */
221declare class PanelAttribute extends CommonMethod<PanelAttribute> {
222  /**
223   * Called when the initial state of the slidable panel is set.
224   *
225   * @param { PanelMode } value
226   * @returns { PanelAttribute }
227   * @syscap SystemCapability.ArkUI.ArkUI.Full
228   * @since 7
229   */
230  /**
231   * Called when the initial state of the slidable panel is set.
232   *
233   * @param { PanelMode } value
234   * @returns { PanelAttribute }
235   * @syscap SystemCapability.ArkUI.ArkUI.Full
236   * @crossplatform
237   * @since 10
238   */
239  mode(value: PanelMode): PanelAttribute;
240
241  /**
242   * Called when the slidable panel type is set.
243   *
244   * @param { PanelType } value
245   * @returns { PanelAttribute }
246   * @syscap SystemCapability.ArkUI.ArkUI.Full
247   * @since 7
248   */
249  /**
250   * Called when the slidable panel type is set.
251   *
252   * @param { PanelType } value
253   * @returns { PanelAttribute }
254   * @syscap SystemCapability.ArkUI.ArkUI.Full
255   * @crossplatform
256   * @since 10
257   */
258  type(value: PanelType): PanelAttribute;
259
260  /**
261   * Called when determining whether dragbar exists.
262   *
263   * @param { boolean } value
264   * @returns { PanelAttribute }
265   * @syscap SystemCapability.ArkUI.ArkUI.Full
266   * @since 7
267   */
268  /**
269   * Called when determining whether dragbar exists.
270   *
271   * @param { boolean } value
272   * @returns { PanelAttribute }
273   * @syscap SystemCapability.ArkUI.ArkUI.Full
274   * @crossplatform
275   * @since 10
276   */
277  dragBar(value: boolean): PanelAttribute;
278
279  /**
280   * Sets the height. It is valid only when PanelType is set to Custom.
281   * @param {Dimension | PanelHeight} value - value - Content height to set.
282   * @returns { PanelAttribute } Returns the component attribute.
283   * @syscap SystemCapability.ArkUI.ArkUI.Full
284   * @crossplatform
285   * @since 10
286   */
287  customHeight(value: Dimension | PanelHeight): PanelAttribute;
288
289  /**
290   * Called when the height in the full state is specified.
291   *
292   * @param { number | string } value
293   * @returns { PanelAttribute }
294   * @syscap SystemCapability.ArkUI.ArkUI.Full
295   * @since 7
296   */
297  /**
298   * Called when the height in the full state is specified.
299   *
300   * @param { number | string } value
301   * @returns { PanelAttribute }
302   * @syscap SystemCapability.ArkUI.ArkUI.Full
303   * @crossplatform
304   * @since 10
305   */
306  fullHeight(value: number | string): PanelAttribute;
307
308  /**
309   * Called when the height in the half state is specified.
310   *
311   * @param { number | string } value
312   * @returns { PanelAttribute }
313   * @syscap SystemCapability.ArkUI.ArkUI.Full
314   * @since 7
315   */
316  /**
317   * Called when the height in the half state is specified.
318   *
319   * @param { number | string } value
320   * @returns { PanelAttribute }
321   * @syscap SystemCapability.ArkUI.ArkUI.Full
322   * @crossplatform
323   * @since 10
324   */
325  halfHeight(value: number | string): PanelAttribute;
326
327  /**
328   * Called when the height in the mini state is specified.
329   *
330   * @param { number | string } value
331   * @returns { PanelAttribute }
332   * @syscap SystemCapability.ArkUI.ArkUI.Full
333   * @since 7
334   */
335  /**
336   * Called when the height in the mini state is specified.
337   *
338   * @param { number | string } value
339   * @returns { PanelAttribute }
340   * @syscap SystemCapability.ArkUI.ArkUI.Full
341   * @crossplatform
342   * @since 10
343   */
344  miniHeight(value: number | string): PanelAttribute;
345
346  /**
347   * Called when the panel slidable panel pops up.
348   *
349   * @param { boolean } value
350   * @returns { PanelAttribute }
351   * @syscap SystemCapability.ArkUI.ArkUI.Full
352   * @since 7
353   */
354  /**
355   * Called when the panel slidable panel pops up.
356   *
357   * @param { boolean } value
358   * @returns { PanelAttribute }
359   * @syscap SystemCapability.ArkUI.ArkUI.Full
360   * @crossplatform
361   * @since 10
362   */
363  show(value: boolean): PanelAttribute;
364
365  /**
366   * Called when the panel background mask is requested.
367   *
368   * @param { ResourceColor } color
369   * @returns { PanelAttribute }
370   * @syscap SystemCapability.ArkUI.ArkUI.Full
371   * @since 9
372   */
373  /**
374   * Called when the panel background mask is requested.
375   *
376   * @param { ResourceColor } color
377   * @returns { PanelAttribute }
378   * @syscap SystemCapability.ArkUI.ArkUI.Full
379   * @crossplatform
380   * @since 10
381   */
382  backgroundMask(color: ResourceColor): PanelAttribute;
383
384  /**
385   * Called when the panel show close icon.
386   *
387   * @param { boolean } value - used to set whether to display the close icon.
388   * @returns { PanelAttribute } return the component attribute.
389   * @syscap SystemCapability.ArkUI.ArkUI.Full
390   * @since 10
391   */
392  showCloseIcon(value: boolean): PanelAttribute;
393
394  /**
395   * Called when the state of the slidable panel changes.
396   *
397   * @param { function } event
398   * @returns { PanelAttribute }
399   * @syscap SystemCapability.ArkUI.ArkUI.Full
400   * @since 7
401   */
402  /**
403   * Called when the state of the slidable panel changes.
404   *
405   * @param { function } event
406   * @returns { PanelAttribute }
407   * @syscap SystemCapability.ArkUI.ArkUI.Full
408   * @crossplatform
409   * @since 10
410   */
411  onChange(
412    event: (
413      /**
414       * Width of content area.
415       *
416       * @syscap SystemCapability.ArkUI.ArkUI.Full
417       * @since 7
418       */
419      width: number,
420
421      /**
422       * Height of content area.
423       *
424       * @syscap SystemCapability.ArkUI.ArkUI.Full
425       * @since 7
426       */
427      height: number,
428
429      /**
430       * Initial state.
431       *
432       * @syscap SystemCapability.ArkUI.ArkUI.Full
433       * @since 7
434       */
435      mode: PanelMode,
436    ) => void,
437  ): PanelAttribute;
438
439  /**
440   * Called when height of the panel is changed
441   *
442   * @param { function } callback
443   * @returns { PanelAttribute }
444   * @syscap SystemCapability.ArkUI.ArkUI.Full
445   * @since 9
446   */
447  /**
448   * Called when height of the panel is changed
449   *
450   * @param { function } callback
451   * @returns { PanelAttribute }
452   * @syscap SystemCapability.ArkUI.ArkUI.Full
453   * @crossplatform
454   * @since 10
455   */
456  onHeightChange(callback: (value: number) => void): PanelAttribute;
457}
458
459/**
460 * Defines Panel Component.
461 *
462 * @syscap SystemCapability.ArkUI.ArkUI.Full
463 * @since 7
464 */
465/**
466 * Defines Panel Component.
467 *
468 * @syscap SystemCapability.ArkUI.ArkUI.Full
469 * @crossplatform
470 * @since 10
471 */
472declare const Panel: PanelInterface;
473
474/**
475 * Defines Panel Component instance.
476 *
477 * @syscap SystemCapability.ArkUI.ArkUI.Full
478 * @since 7
479 */
480/**
481 * Defines Panel Component instance.
482 *
483 * @syscap SystemCapability.ArkUI.ArkUI.Full
484 * @crossplatform
485 * @since 10
486 */
487declare const PanelInstance: PanelAttribute;
488