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 initial state of the slidable panel. 18 * @since 7 19 */ 20declare enum PanelMode { 21 /** 22 * Minimum state. 23 * @since 7 24 */ 25 Mini, 26 27 /** 28 * SHalf-screen-like status 29 * @since 7 30 */ 31 Half, 32 33 /** 34 * Class Full Screen Status. 35 * @since 7 36 */ 37 Full, 38} 39 40/** 41 * Sets the type of sliding panel. 42 * @since 7 43 */ 44declare enum PanelType { 45 /** 46 * The switch between the minibar and full-screen display is provided. 47 * @since 7 48 */ 49 Minibar, 50 51 /** 52 * Permanent content display class. 53 * The switchover effect is provided in three sizes: large (full-screen), medium (half-screen), and small. 54 * @since 7 55 */ 56 Foldable, 57 58 /** 59 * Temporary content display area. 60 * The switchover effect is provided in three sizes: large (full-screen), medium (half-screen), and small. 61 * @since 7 62 */ 63 Temporary, 64} 65 66/** 67 * Provides a sliding panel interface. 68 * @since 7 69 */ 70interface PanelInterface { 71 /** 72 * Called when the panel slidable panel pops up. 73 * @since 7 74 */ 75 (show: boolean): PanelAttribute; 76} 77 78/** 79 * @since 7 80 */ 81declare class PanelAttribute extends CommonMethod<PanelAttribute> { 82 /** 83 * Called when the initial state of the slidable panel is set. 84 * @since 7 85 */ 86 mode(value: PanelMode): PanelAttribute; 87 88 /** 89 * Called when the slidable panel type is set. 90 * @since 7 91 */ 92 type(value: PanelType): PanelAttribute; 93 94 /** 95 * Called when determining whether dragBar exists. 96 * @since 7 97 */ 98 dragBar(value: boolean): PanelAttribute; 99 100 /** 101 * Called when the height in the full state is specified. 102 * @since 7 103 */ 104 fullHeight(value: number | string): PanelAttribute; 105 106 /** 107 * Called when the height in the half state is specified. 108 * @since 7 109 */ 110 halfHeight(value: number | string): PanelAttribute; 111 112 /** 113 * Called when the height in the mini state is specified. 114 * @since 7 115 */ 116 miniHeight(value: number | string): PanelAttribute; 117 118 /** 119 * Called when the panel slidable panel pops up. 120 * @since 7 121 */ 122 show(value: boolean): PanelAttribute; 123 124 /** 125 * Called when the panel background mask is requested. 126 * @since 9 127 */ 128 backgroundMask(color: ResourceColor): PanelAttribute; 129 130 /** 131 * Called when the state of the slidable panel changes. 132 * @since 7 133 */ 134 onChange( 135 event: ( 136 /** 137 * Width of content area. 138 * @since 7 139 */ 140 width: number, 141 142 /** 143 * Height of content area. 144 * @since 7 145 */ 146 height: number, 147 148 /** 149 * Initial state. 150 * @since 7 151 */ 152 mode: PanelMode, 153 ) => void, 154 ): PanelAttribute; 155 156 /** 157 * Called when height of the panel is changed 158 * @since 9 159 */ 160 onHeightChange(callback: (value: number) => void): PanelAttribute; 161} 162 163/** 164 * Defines Panel Component. 165 * @since 7 166 */ 167declare const Panel: PanelInterface; 168 169/** 170 * Defines Panel Component instance. 171 * @since 7 172 */ 173declare const PanelInstance: PanelAttribute; 174