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 { ResourceStr, Font, ResourceColor } from './units'; 23import { CommonMethod } from './common'; 24import { CustomBuilder } from './builder'; 25import { SymbolGlyphModifier } from '../../arkui/SymbolGlyphModifier'; 26/*** endif */ 27 28/** 29 * Defines the option of MenuItem. 30 * 31 * @interface MenuItemOptions 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @since 9 34 */ 35/** 36 * Defines the option of MenuItem. 37 * 38 * @interface MenuItemOptions 39 * @syscap SystemCapability.ArkUI.ArkUI.Full 40 * @crossplatform 41 * @since 10 42 */ 43/** 44 * Defines the option of MenuItem. 45 * 46 * @interface MenuItemOptions 47 * @syscap SystemCapability.ArkUI.ArkUI.Full 48 * @crossplatform 49 * @atomicservice 50 * @since arkts {'1.1':'11','1.2':'20'} 51 * @arkts 1.1&1.2 52 */ 53declare interface MenuItemOptions { 54 /** 55 * Defines the start display image info. 56 * 57 * @type { ?ResourceStr } 58 * @syscap SystemCapability.ArkUI.ArkUI.Full 59 * @since 9 60 */ 61 /** 62 * Defines the start display image info. 63 * 64 * @type { ?ResourceStr } 65 * @syscap SystemCapability.ArkUI.ArkUI.Full 66 * @crossplatform 67 * @since 10 68 */ 69 /** 70 * Defines the start display image info. 71 * 72 * @type { ?ResourceStr } 73 * @syscap SystemCapability.ArkUI.ArkUI.Full 74 * @crossplatform 75 * @atomicservice 76 * @since arkts {'1.1':'11','1.2':'20'} 77 * @arkts 1.1&1.2 78 */ 79 startIcon?: ResourceStr; 80 81 /** 82 * Defines the start display symbol info. 83 * 84 * @type { ?SymbolGlyphModifier } 85 * @syscap SystemCapability.ArkUI.ArkUI.Full 86 * @atomicservice 87 * @since 12 88 */ 89 /** 90 * Defines the start display symbol info. 91 * 92 * @type { ?SymbolGlyphModifier } 93 * @syscap SystemCapability.ArkUI.ArkUI.Full 94 * @crossplatform 95 * @atomicservice 96 * @since 20 97 * @arkts 1.1&1.2 98 */ 99 symbolStartIcon?: SymbolGlyphModifier; 100 101 /** 102 * Defines the content string display info. 103 * 104 * @type { ?ResourceStr } 105 * @syscap SystemCapability.ArkUI.ArkUI.Full 106 * @since 9 107 */ 108 /** 109 * Defines the content string display info. 110 * 111 * @type { ?ResourceStr } 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @crossplatform 114 * @since 10 115 */ 116 /** 117 * Defines the content string display info. 118 * 119 * @type { ?ResourceStr } 120 * @syscap SystemCapability.ArkUI.ArkUI.Full 121 * @crossplatform 122 * @atomicservice 123 * @since arkts {'1.1':'11','1.2':'20'} 124 * @arkts 1.1&1.2 125 */ 126 content?: ResourceStr; 127 128 /** 129 * Defines the end display image info. 130 * 131 * @type { ?ResourceStr } 132 * @syscap SystemCapability.ArkUI.ArkUI.Full 133 * @since 9 134 */ 135 /** 136 * Defines the end display image info. 137 * 138 * @type { ?ResourceStr } 139 * @syscap SystemCapability.ArkUI.ArkUI.Full 140 * @crossplatform 141 * @since 10 142 */ 143 /** 144 * Defines the end display image info. 145 * 146 * @type { ?ResourceStr } 147 * @syscap SystemCapability.ArkUI.ArkUI.Full 148 * @crossplatform 149 * @atomicservice 150 * @since arkts {'1.1':'11','1.2':'20'} 151 * @arkts 1.1&1.2 152 */ 153 endIcon?: ResourceStr; 154 155 /** 156 * Defines the end display symbol info. 157 * 158 * @type { ?SymbolGlyphModifier } 159 * @syscap SystemCapability.ArkUI.ArkUI.Full 160 * @atomicservice 161 * @since 12 162 */ 163 /** 164 * Defines the end display symbol info. 165 * 166 * @type { ?SymbolGlyphModifier } 167 * @syscap SystemCapability.ArkUI.ArkUI.Full 168 * @crossplatform 169 * @atomicservice 170 * @since 20 171 * @arkts 1.1&1.2 172 */ 173 symbolEndIcon?: SymbolGlyphModifier; 174 175 /** 176 * Defines the end label info like shortcut. 177 * 178 * @type { ?ResourceStr } 179 * @syscap SystemCapability.ArkUI.ArkUI.Full 180 * @since 9 181 */ 182 /** 183 * Defines the end label info like shortcut. 184 * 185 * @type { ?ResourceStr } 186 * @syscap SystemCapability.ArkUI.ArkUI.Full 187 * @crossplatform 188 * @since 10 189 */ 190 /** 191 * Defines the end label info like shortcut. 192 * 193 * @type { ?ResourceStr } 194 * @syscap SystemCapability.ArkUI.ArkUI.Full 195 * @crossplatform 196 * @atomicservice 197 * @since arkts {'1.1':'11','1.2':'20'} 198 * @arkts 1.1&1.2 199 */ 200 labelInfo?: ResourceStr; 201 202 /** 203 * Create the submenu. 204 * 205 * @type { ?CustomBuilder } 206 * @syscap SystemCapability.ArkUI.ArkUI.Full 207 * @since 9 208 */ 209 /** 210 * Create the submenu. 211 * 212 * @type { ?CustomBuilder } 213 * @syscap SystemCapability.ArkUI.ArkUI.Full 214 * @crossplatform 215 * @since 10 216 */ 217 /** 218 * Create the submenu. 219 * 220 * @type { ?CustomBuilder } 221 * @syscap SystemCapability.ArkUI.ArkUI.Full 222 * @crossplatform 223 * @atomicservice 224 * @since arkts {'1.1':'11','1.2':'20'} 225 * @arkts 1.1&1.2 226 */ 227 builder?: CustomBuilder; 228} 229 230/** 231 * Defines the MenuItem Component. 232 * 233 * @interface MenuItemInterface 234 * @syscap SystemCapability.ArkUI.ArkUI.Full 235 * @since 9 236 */ 237/** 238 * Defines the MenuItem Component. 239 * 240 * @interface MenuItemInterface 241 * @syscap SystemCapability.ArkUI.ArkUI.Full 242 * @crossplatform 243 * @since 10 244 */ 245/** 246 * Defines the MenuItem Component. 247 * 248 * @interface MenuItemInterface 249 * @syscap SystemCapability.ArkUI.ArkUI.Full 250 * @crossplatform 251 * @atomicservice 252 * @since arkts {'1.1':'11','1.2':'20'} 253 * @arkts 1.1&1.2 254 */ 255interface MenuItemInterface { 256 /** 257 * Creates the MenuItem component. 258 * 259 * @param { MenuItemOptions | CustomBuilder } value 260 * @returns { MenuItemAttribute } 261 * @syscap SystemCapability.ArkUI.ArkUI.Full 262 * @since 9 263 */ 264 /** 265 * Creates the MenuItem component. 266 * 267 * @param { MenuItemOptions | CustomBuilder } value 268 * @returns { MenuItemAttribute } 269 * @syscap SystemCapability.ArkUI.ArkUI.Full 270 * @crossplatform 271 * @since 10 272 */ 273 /** 274 * Creates the MenuItem component. 275 * 276 * @param { MenuItemOptions | CustomBuilder } value 277 * @returns { MenuItemAttribute } 278 * @syscap SystemCapability.ArkUI.ArkUI.Full 279 * @crossplatform 280 * @atomicservice 281 * @since arkts {'1.1':'11','1.2':'20'} 282 * @arkts 1.1&1.2 283 */ 284 (value?: MenuItemOptions | CustomBuilder): MenuItemAttribute; 285} 286 287/** 288 * Defines the MenuItem component attribute functions. 289 * 290 * @extends CommonMethod<MenuItemAttribute> 291 * @syscap SystemCapability.ArkUI.ArkUI.Full 292 * @since 9 293 */ 294/** 295 * Defines the MenuItem component attribute functions. 296 * 297 * @extends CommonMethod<MenuItemAttribute> 298 * @syscap SystemCapability.ArkUI.ArkUI.Full 299 * @crossplatform 300 * @since 10 301 */ 302/** 303 * Defines the MenuItem component attribute functions. 304 * 305 * @extends CommonMethod<MenuItemAttribute> 306 * @syscap SystemCapability.ArkUI.ArkUI.Full 307 * @crossplatform 308 * @atomicservice 309 * @since arkts {'1.1':'11','1.2':'20'} 310 * @arkts 1.1&1.2 311 */ 312declare class MenuItemAttribute extends CommonMethod<MenuItemAttribute> { 313 /** 314 * Setting whether menuItem is selected. 315 * 316 * @param { boolean } value 317 * @returns { MenuItemAttribute } 318 * @syscap SystemCapability.ArkUI.ArkUI.Full 319 * @since 9 320 */ 321 /** 322 * Setting whether menuItem is selected. 323 * 324 * @param { boolean } value 325 * @returns { MenuItemAttribute } 326 * @syscap SystemCapability.ArkUI.ArkUI.Full 327 * @crossplatform 328 * @since 10 329 */ 330 /** 331 * Setting whether menuItem is selected. 332 * 333 * @param { boolean } value 334 * @returns { MenuItemAttribute } 335 * @syscap SystemCapability.ArkUI.ArkUI.Full 336 * @crossplatform 337 * @atomicservice 338 * @since arkts {'1.1':'11','1.2':'20'} 339 * @arkts 1.1&1.2 340 */ 341 selected(value: boolean): MenuItemAttribute; 342 343 /** 344 * Whether the relevant check icon is displayed when a menu item is selected. 345 * 346 * @param { boolean } value - Indicates whether to display the check icon when selected. 347 * @returns { MenuItemAttribute } 348 * @syscap SystemCapability.ArkUI.ArkUI.Full 349 * @since 9 350 */ 351 /** 352 * Whether the relevant check icon is displayed when a menu item is selected. 353 * Use type ResourceStr to specify icon instead of the default check mark. 354 * 355 * @param { boolean | ResourceStr } value - Indicates whether to display icon when selected. 356 * true: displays the default check mark when selected. 357 * false: does not displays icon when selected. 358 * ResourceStr: displays the specified icon when selected. 359 * @returns { MenuItemAttribute } 360 * @syscap SystemCapability.ArkUI.ArkUI.Full 361 * @crossplatform 362 * @since 10 363 */ 364 /** 365 * Whether the relevant check icon is displayed when a menu item is selected. 366 * Use type ResourceStr to specify icon instead of the default check mark. 367 * 368 * @param { boolean | ResourceStr } value - Indicates whether to display icon when selected. 369 * true: displays the default check mark when selected. 370 * false: does not displays icon when selected. 371 * ResourceStr: displays the specified icon when selected. 372 * @returns { MenuItemAttribute } 373 * @syscap SystemCapability.ArkUI.ArkUI.Full 374 * @crossplatform 375 * @atomicservice 376 * @since 11 377 */ 378 /** 379 * Whether the relevant check icon is displayed when a menu item is selected. 380 * Use type ResourceStr or SymbolGlyphModifier to specify icon instead of the default check mark. 381 * 382 * @param { boolean | ResourceStr | SymbolGlyphModifier } value - Indicates whether to display icon when selected. 383 * <br>true: displays the default check mark when selected. 384 * <br>false: does not displays icon when selected. 385 * <br>ResourceStr or SymbolGlyphModifier: displays the specified icon when selected. 386 * @returns { MenuItemAttribute } 387 * @syscap SystemCapability.ArkUI.ArkUI.Full 388 * @crossplatform 389 * @atomicservice 390 * @since arkts {'1.1':'12','1.2':'20'} 391 * @arkts 1.1&1.2 392 */ 393 selectIcon(value: boolean | ResourceStr | SymbolGlyphModifier): MenuItemAttribute; 394 395 /** 396 * Triggers a callback when a menu item is selected or unchecked. 397 * 398 * @param { function } callback 399 * @returns { MenuItemAttribute } 400 * @syscap SystemCapability.ArkUI.ArkUI.Full 401 * @since 9 402 */ 403 /** 404 * Triggers a callback when a menu item is selected or unchecked. 405 * 406 * @param { function } callback 407 * @returns { MenuItemAttribute } 408 * @syscap SystemCapability.ArkUI.ArkUI.Full 409 * @crossplatform 410 * @since 10 411 */ 412 /** 413 * Triggers a callback when a menu item is selected or unchecked. 414 * 415 * @param { function } callback 416 * @returns { MenuItemAttribute } 417 * @syscap SystemCapability.ArkUI.ArkUI.Full 418 * @crossplatform 419 * @atomicservice 420 * @since arkts {'1.1':'11','1.2':'20'} 421 * @arkts 1.1&1.2 422 */ 423 onChange(callback: (selected: boolean) => void): MenuItemAttribute; 424 425 /** 426 * Sets the content font style. 427 * Family and style are not supported currently and will be fixed in future. 428 * 429 * @param { Font } value - Indicates the font style of content text. 430 * @returns { MenuItemAttribute } 431 * @syscap SystemCapability.ArkUI.ArkUI.Full 432 * @crossplatform 433 * @since 10 434 */ 435 /** 436 * Sets the content font style. 437 * Family and style are not supported currently and will be fixed in future. 438 * 439 * @param { Font } value - Indicates the font style of content text. 440 * @returns { MenuItemAttribute } 441 * @syscap SystemCapability.ArkUI.ArkUI.Full 442 * @crossplatform 443 * @atomicservice 444 * @since arkts {'1.1':'11','1.2':'20'} 445 * @arkts 1.1&1.2 446 */ 447 contentFont(value: Font): MenuItemAttribute; 448 449 /** 450 * Sets the font color of content text. 451 * 452 * @param { ResourceColor } value - Indicates the font color of content text. 453 * @returns { MenuItemAttribute } 454 * @syscap SystemCapability.ArkUI.ArkUI.Full 455 * @crossplatform 456 * @since 10 457 */ 458 /** 459 * Sets the font color of content text. 460 * 461 * @param { ResourceColor } value - Indicates the font color of content text. 462 * @returns { MenuItemAttribute } 463 * @syscap SystemCapability.ArkUI.ArkUI.Full 464 * @crossplatform 465 * @atomicservice 466 * @since arkts {'1.1':'11','1.2':'20'} 467 * @arkts 1.1&1.2 468 */ 469 contentFontColor(value: ResourceColor): MenuItemAttribute; 470 471 /** 472 * Sets the label info font style. 473 * Family and style are not supported currently and will be fixed in future. 474 * 475 * @param { Font } value - Indicates the font style of label info text. 476 * @returns { MenuItemAttribute } 477 * @syscap SystemCapability.ArkUI.ArkUI.Full 478 * @crossplatform 479 * @since 10 480 */ 481 /** 482 * Sets the label info font style. 483 * Family and style are not supported currently and will be fixed in future. 484 * 485 * @param { Font } value - Indicates the font style of label info text. 486 * @returns { MenuItemAttribute } 487 * @syscap SystemCapability.ArkUI.ArkUI.Full 488 * @crossplatform 489 * @atomicservice 490 * @since arkts {'1.1':'11','1.2':'20'} 491 * @arkts 1.1&1.2 492 */ 493 labelFont(value: Font): MenuItemAttribute; 494 495 /** 496 * Sets the font color of label info text. 497 * 498 * @param { ResourceColor } value - Indicates the font color of label info text. 499 * @returns { MenuItemAttribute } 500 * @syscap SystemCapability.ArkUI.ArkUI.Full 501 * @crossplatform 502 * @since 10 503 */ 504 /** 505 * Sets the font color of label info text. 506 * 507 * @param { ResourceColor } value - Indicates the font color of label info text. 508 * @returns { MenuItemAttribute } 509 * @syscap SystemCapability.ArkUI.ArkUI.Full 510 * @crossplatform 511 * @atomicservice 512 * @since arkts {'1.1':'11','1.2':'20'} 513 * @arkts 1.1&1.2 514 */ 515 labelFontColor(value: ResourceColor): MenuItemAttribute; 516} 517 518/** 519 * Defines MenuItem Component. 520 * 521 * @syscap SystemCapability.ArkUI.ArkUI.Full 522 * @since 9 523 */ 524/** 525 * Defines MenuItem Component. 526 * 527 * @syscap SystemCapability.ArkUI.ArkUI.Full 528 * @crossplatform 529 * @since 10 530 */ 531/** 532 * Defines MenuItem Component. 533 * 534 * @syscap SystemCapability.ArkUI.ArkUI.Full 535 * @crossplatform 536 * @atomicservice 537 * @since 11 538 */ 539declare const MenuItem: MenuItemInterface; 540 541/** 542 * Defines MenuItem Component instance. 543 * 544 * @syscap SystemCapability.ArkUI.ArkUI.Full 545 * @since 9 546 */ 547/** 548 * Defines MenuItem Component instance. 549 * 550 * @syscap SystemCapability.ArkUI.ArkUI.Full 551 * @crossplatform 552 * @since 10 553 */ 554/** 555 * Defines MenuItem Component instance. 556 * 557 * @syscap SystemCapability.ArkUI.ArkUI.Full 558 * @crossplatform 559 * @atomicservice 560 * @since 11 561 */ 562declare const MenuItemInstance: MenuItemAttribute; 563