1/* 2 * Copyright (c) 2022-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 * @file 18 * @kit ArkUI 19 */ 20 21/*** if arkts 1.2 */ 22import { CommonMethod } from './common'; 23import { Length, Font, ResourceColor, Dimension, BorderRadiuses, DividerStyleOptions } from './units'; 24/*** endif */ 25 26/** 27 * Defines the Menu Component. 28 * 29 * @interface MenuInterface 30 * @syscap SystemCapability.ArkUI.ArkUI.Full 31 * @since 9 32 */ 33/** 34 * Defines the Menu Component. 35 * 36 * @interface MenuInterface 37 * @syscap SystemCapability.ArkUI.ArkUI.Full 38 * @crossplatform 39 * @since 10 40 */ 41/** 42 * Defines the Menu Component. 43 * 44 * @interface MenuInterface 45 * @syscap SystemCapability.ArkUI.ArkUI.Full 46 * @crossplatform 47 * @atomicservice 48 * @since arkts {'1.1':'11','1.2':'20'} 49 * @arkts 1.1&1.2 50 */ 51interface MenuInterface { 52 /** 53 * Creates the menu component. 54 * 55 * @returns { MenuAttribute } 56 * @syscap SystemCapability.ArkUI.ArkUI.Full 57 * @since 9 58 */ 59 /** 60 * Creates the menu component. 61 * 62 * @returns { MenuAttribute } 63 * @syscap SystemCapability.ArkUI.ArkUI.Full 64 * @crossplatform 65 * @since 10 66 */ 67 /** 68 * Creates the menu component. 69 * 70 * @returns { MenuAttribute } 71 * @syscap SystemCapability.ArkUI.ArkUI.Full 72 * @crossplatform 73 * @atomicservice 74 * @since arkts {'1.1':'11','1.2':'20'} 75 * @arkts 1.1&1.2 76 */ 77 (): MenuAttribute; 78} 79 80/** 81 * Declare SubMenuExpandingMode 82 * 83 * @enum { number } 84 * @syscap SystemCapability.ArkUI.ArkUI.Full 85 * @crossplatform 86 * @atomicservice 87 * @since arkts {'1.1':'12','1.2':'20'} 88 * @arkts 1.1&1.2 89 */ 90declare enum SubMenuExpandingMode { 91 /** 92 * Sub-menu will expand besides main menu 93 * 94 * @syscap SystemCapability.ArkUI.ArkUI.Full 95 * @crossplatform 96 * @atomicservice 97 * @since arkts {'1.1':'12','1.2':'20'} 98 * @arkts 1.1&1.2 99 */ 100 SIDE_EXPAND = 0, 101 102 /** 103 * Sub-menu will expand embedded in main menu 104 * 105 * @syscap SystemCapability.ArkUI.ArkUI.Full 106 * @crossplatform 107 * @atomicservice 108 * @since arkts {'1.1':'12','1.2':'20'} 109 * @arkts 1.1&1.2 110 */ 111 EMBEDDED_EXPAND = 1, 112 113 /** 114 * Sub-menu will expand over main menu 115 * 116 * @syscap SystemCapability.ArkUI.ArkUI.Full 117 * @crossplatform 118 * @atomicservice 119 * @since arkts {'1.1':'12','1.2':'20'} 120 * @arkts 1.1&1.2 121 */ 122 STACK_EXPAND = 2, 123} 124 125/** 126 * Defines the Menu component attribute functions. 127 * 128 * @extends CommonMethod<MenuAttribute> 129 * @syscap SystemCapability.ArkUI.ArkUI.Full 130 * @since 9 131 */ 132/** 133 * Defines the Menu component attribute functions. 134 * 135 * @extends CommonMethod<MenuAttribute> 136 * @syscap SystemCapability.ArkUI.ArkUI.Full 137 * @crossplatform 138 * @since 10 139 */ 140/** 141 * Defines the Menu component attribute functions. 142 * 143 * @extends CommonMethod<MenuAttribute> 144 * @syscap SystemCapability.ArkUI.ArkUI.Full 145 * @crossplatform 146 * @atomicservice 147 * @since arkts {'1.1':'11','1.2':'20'} 148 * @arkts 1.1&1.2 149 */ 150declare class MenuAttribute extends CommonMethod<MenuAttribute> { 151 /** 152 * Sets the Menu text size. 153 * 154 * @param { Length } value - Indicates the font size of menu item. 155 * @returns { MenuAttribute } 156 * @syscap SystemCapability.ArkUI.ArkUI.Full 157 * @since 9 158 * @deprecated since 10 159 * @useinstead font 160 */ 161 fontSize(value: Length): MenuAttribute; 162 163 /** 164 * Sets the font style. 165 * Family and style are not supported currently and will be fixed in future. 166 * 167 * @param { Font } value - Indicates the font style of menu item. 168 * @returns { MenuAttribute } 169 * @syscap SystemCapability.ArkUI.ArkUI.Full 170 * @crossplatform 171 * @since 10 172 */ 173 /** 174 * Sets the font style. 175 * Family and style are not supported currently and will be fixed in future. 176 * 177 * @param { Font } value - Indicates the font style of menu item. 178 * @returns { MenuAttribute } 179 * @syscap SystemCapability.ArkUI.ArkUI.Full 180 * @crossplatform 181 * @atomicservice 182 * @since arkts {'1.1':'11','1.2':'20'} 183 * @arkts 1.1&1.2 184 */ 185 font(value: Font): MenuAttribute; 186 187 /** 188 * Sets the Menu font color. 189 * 190 * @param { ResourceColor } value - Indicates the font color of menu item. 191 * @returns { MenuAttribute } 192 * @syscap SystemCapability.ArkUI.ArkUI.Full 193 * @crossplatform 194 * @since 10 195 */ 196 /** 197 * Sets the Menu font color. 198 * 199 * @param { ResourceColor } value - Indicates the font color of menu item. 200 * @returns { MenuAttribute } 201 * @syscap SystemCapability.ArkUI.ArkUI.Full 202 * @crossplatform 203 * @atomicservice 204 * @since arkts {'1.1':'11','1.2':'20'} 205 * @arkts 1.1&1.2 206 */ 207 fontColor(value: ResourceColor): MenuAttribute; 208 209 /** 210 * Sets the radius of the corner around the menu. 211 * When the radius is less than the menu width, the default border radius is used. 212 * 213 * @param { Dimension | BorderRadiuses } value - the border radius. 214 * @returns { MenuAttribute } 215 * @syscap SystemCapability.ArkUI.ArkUI.Full 216 * @crossplatform 217 * @since 10 218 */ 219 /** 220 * Sets the radius of the corner around the menu. 221 * When the radius is less than the menu width, the default border radius is used. 222 * 223 * @param { Dimension | BorderRadiuses } value - the border radius. 224 * @returns { MenuAttribute } 225 * @syscap SystemCapability.ArkUI.ArkUI.Full 226 * @crossplatform 227 * @atomicservice 228 * @since arkts {'1.1':'11','1.2':'20'} 229 * @arkts 1.1&1.2 230 */ 231 radius(value: Dimension | BorderRadiuses): MenuAttribute; 232 233 /** 234 * Set the divider of menu item 235 * 236 * @param { DividerStyleOptions | undefined } options 237 * @returns { MenuAttribute } 238 * @syscap SystemCapability.ArkUI.ArkUI.Full 239 * @crossplatform 240 * @atomicservice 241 * @since arkts {'1.1':'12','1.2':'20'} 242 * @arkts 1.1&1.2 243 */ 244 menuItemDivider(options: DividerStyleOptions | undefined): MenuAttribute; 245 246 /** 247 * Set the divider of menu item group 248 * 249 * @param { DividerStyleOptions | undefined } options 250 * @returns { MenuAttribute } 251 * @syscap SystemCapability.ArkUI.ArkUI.Full 252 * @crossplatform 253 * @atomicservice 254 * @since arkts {'1.1':'12','1.2':'20'} 255 * @arkts 1.1&1.2 256 */ 257 menuItemGroupDivider(options: DividerStyleOptions | undefined): MenuAttribute; 258 259 /** 260 * Set the expanding mode of sub-menu 261 * 262 * @param { SubMenuExpandingMode } mode 263 * @returns { MenuAttribute } 264 * @syscap SystemCapability.ArkUI.ArkUI.Full 265 * @crossplatform 266 * @atomicservice 267 * @since arkts {'1.1':'12','1.2':'20'} 268 * @arkts 1.1&1.2 269 */ 270 subMenuExpandingMode(mode: SubMenuExpandingMode): MenuAttribute; 271 272 /** 273 * Set the expand symbol of sub-menu. 274 * 275 * @param { SymbolGlyphModifier } symbol 276 * @returns { MenuAttribute } 277 * @syscap SystemCapability.ArkUI.ArkUI.Full 278 * @atomicservice 279 * @since 20 280 */ 281 subMenuExpandSymbol(symbol: SymbolGlyphModifier): MenuAttribute; 282} 283 284/** 285 * Defines Menu Component. 286 * 287 * @syscap SystemCapability.ArkUI.ArkUI.Full 288 * @since 9 289 */ 290/** 291 * Defines Menu Component. 292 * 293 * @syscap SystemCapability.ArkUI.ArkUI.Full 294 * @crossplatform 295 * @since 10 296 */ 297/** 298 * Defines Menu Component. 299 * 300 * @syscap SystemCapability.ArkUI.ArkUI.Full 301 * @crossplatform 302 * @atomicservice 303 * @since 11 304 */ 305declare const Menu: MenuInterface; 306 307/** 308 * Defines Menu Component instance. 309 * 310 * @syscap SystemCapability.ArkUI.ArkUI.Full 311 * @since 9 312 */ 313/** 314 * Defines Menu Component instance. 315 * 316 * @syscap SystemCapability.ArkUI.ArkUI.Full 317 * @crossplatform 318 * @since 10 319 */ 320/** 321 * Defines Menu Component instance. 322 * 323 * @syscap SystemCapability.ArkUI.ArkUI.Full 324 * @crossplatform 325 * @atomicservice 326 * @since 11 327 */ 328declare const MenuInstance: MenuAttribute; 329