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