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