@vaadin/context-menu 25.3.0-alpha6 → 25.3.0-alpha7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +304 -4
- package/package.json +13 -13
- package/src/lit/renderer-directives.d.ts +1 -0
- package/src/lit/renderer-directives.js +1 -0
- package/src/vaadin-context-menu-item.d.ts +33 -1
- package/src/vaadin-context-menu-item.js +33 -2
- package/src/vaadin-context-menu-list-box.d.ts +20 -1
- package/src/vaadin-context-menu-list-box.js +20 -2
- package/src/vaadin-context-menu-mixin.d.ts +5 -3
- package/src/vaadin-context-menu-mixin.js +44 -21
- package/src/vaadin-context-menu.d.ts +28 -18
- package/src/vaadin-context-menu.js +23 -13
- package/src/vaadin-contextmenu-items-mixin.d.ts +8 -3
- package/src/vaadin-contextmenu-items-mixin.js +16 -8
- package/src/vaadin-menu-overlay-mixin.js +1 -1
- package/vaadin-context-menu-item.d.ts +1 -0
- package/vaadin-context-menu-item.js +2 -0
- package/vaadin-context-menu-list-box.d.ts +1 -0
- package/vaadin-context-menu-list-box.js +2 -0
- package/web-types.json +128 -3
- package/web-types.lit.json +51 -2
package/custom-elements.json
CHANGED
|
@@ -17,6 +17,302 @@
|
|
|
17
17
|
}
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "javascript-module",
|
|
22
|
+
"path": "vaadin-context-menu-list-box.js",
|
|
23
|
+
"declarations": [],
|
|
24
|
+
"exports": [
|
|
25
|
+
{
|
|
26
|
+
"kind": "js",
|
|
27
|
+
"name": "*",
|
|
28
|
+
"declaration": {
|
|
29
|
+
"name": "*",
|
|
30
|
+
"module": "src/vaadin-context-menu-list-box.js"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"kind": "javascript-module",
|
|
37
|
+
"path": "vaadin-context-menu-item.js",
|
|
38
|
+
"declarations": [],
|
|
39
|
+
"exports": [
|
|
40
|
+
{
|
|
41
|
+
"kind": "js",
|
|
42
|
+
"name": "*",
|
|
43
|
+
"declaration": {
|
|
44
|
+
"name": "*",
|
|
45
|
+
"module": "src/vaadin-context-menu-item.js"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"kind": "javascript-module",
|
|
52
|
+
"path": "src/vaadin-context-menu-item.js",
|
|
53
|
+
"declarations": [
|
|
54
|
+
{
|
|
55
|
+
"kind": "class",
|
|
56
|
+
"description": "`<vaadin-context-menu-item>` is a Web Component for creating `<vaadin-context-menu>` items.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-------------|----------------\n`checkmark` | The graphical checkmark shown for a checked item\n`content` | The element that wraps the slot\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`active` | Set when the item is pressed down, either with mouse, touch or the keyboard.\n`disabled` | Set when the item is disabled.\n`focus-ring` | Set when the item is focused using the keyboard.\n`focused` | Set when the item is focused.\n`expanded` | Set when the item has a sub-menu and it is opened.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------|\n| `--vaadin-item-border-radius` |\n| `--vaadin-item-checkmark-color` |\n| `--vaadin-item-gap` |\n| `--vaadin-item-height` |\n| `--vaadin-item-padding` |\n| `--vaadin-item-text-align` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
57
|
+
"name": "ContextMenuItem",
|
|
58
|
+
"members": [
|
|
59
|
+
{
|
|
60
|
+
"kind": "field",
|
|
61
|
+
"name": "disabled",
|
|
62
|
+
"privacy": "public",
|
|
63
|
+
"type": {
|
|
64
|
+
"text": "boolean"
|
|
65
|
+
},
|
|
66
|
+
"description": "If true, the user cannot interact with this element.",
|
|
67
|
+
"attribute": "disabled",
|
|
68
|
+
"inheritedFrom": {
|
|
69
|
+
"name": "DisabledMixin",
|
|
70
|
+
"package": "@vaadin/a11y-base/src/disabled-mixin.js"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"kind": "field",
|
|
75
|
+
"name": "selected",
|
|
76
|
+
"privacy": "public",
|
|
77
|
+
"type": {
|
|
78
|
+
"text": "boolean"
|
|
79
|
+
},
|
|
80
|
+
"description": "If true, the item is in selected state.",
|
|
81
|
+
"attribute": "selected",
|
|
82
|
+
"inheritedFrom": {
|
|
83
|
+
"name": "ItemMixin",
|
|
84
|
+
"package": "@vaadin/item/src/vaadin-item-mixin.js"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"kind": "field",
|
|
89
|
+
"name": "value",
|
|
90
|
+
"description": "Submittable string value. The default value is the trimmed text content of the element.",
|
|
91
|
+
"type": {
|
|
92
|
+
"text": "string"
|
|
93
|
+
},
|
|
94
|
+
"inheritedFrom": {
|
|
95
|
+
"name": "ItemMixin",
|
|
96
|
+
"package": "@vaadin/item/src/vaadin-item-mixin.js"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"mixins": [
|
|
101
|
+
{
|
|
102
|
+
"name": "ItemMixin",
|
|
103
|
+
"package": "@vaadin/item/src/vaadin-item-mixin.js"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "ThemableMixin",
|
|
107
|
+
"package": "@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "DirMixin",
|
|
111
|
+
"package": "@vaadin/component-base/src/dir-mixin.js"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "PolylitMixin",
|
|
115
|
+
"package": "@vaadin/component-base/src/polylit-mixin.js"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "LumoInjectionMixin",
|
|
119
|
+
"package": "@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"superclass": {
|
|
123
|
+
"name": "LitElement",
|
|
124
|
+
"package": "lit"
|
|
125
|
+
},
|
|
126
|
+
"tagName": "vaadin-context-menu-item",
|
|
127
|
+
"customElement": true,
|
|
128
|
+
"attributes": [
|
|
129
|
+
{
|
|
130
|
+
"name": "disabled",
|
|
131
|
+
"type": {
|
|
132
|
+
"text": "boolean"
|
|
133
|
+
},
|
|
134
|
+
"description": "If true, the user cannot interact with this element.",
|
|
135
|
+
"fieldName": "disabled",
|
|
136
|
+
"inheritedFrom": {
|
|
137
|
+
"name": "DisabledMixin",
|
|
138
|
+
"package": "@vaadin/a11y-base/src/disabled-mixin.js"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "selected",
|
|
143
|
+
"type": {
|
|
144
|
+
"text": "boolean"
|
|
145
|
+
},
|
|
146
|
+
"description": "If true, the item is in selected state.",
|
|
147
|
+
"fieldName": "selected",
|
|
148
|
+
"inheritedFrom": {
|
|
149
|
+
"name": "ItemMixin",
|
|
150
|
+
"package": "@vaadin/item/src/vaadin-item-mixin.js"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
"events": []
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"exports": [
|
|
158
|
+
{
|
|
159
|
+
"kind": "js",
|
|
160
|
+
"name": "ContextMenuItem",
|
|
161
|
+
"declaration": {
|
|
162
|
+
"name": "ContextMenuItem",
|
|
163
|
+
"module": "src/vaadin-context-menu-item.js"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"kind": "javascript-module",
|
|
170
|
+
"path": "src/vaadin-context-menu-list-box.js",
|
|
171
|
+
"declarations": [
|
|
172
|
+
{
|
|
173
|
+
"kind": "class",
|
|
174
|
+
"description": "`<vaadin-context-menu-list-box>` is a Web Component for wrapping `<vaadin-context-menu>` items.\n\n```html\n<vaadin-context-menu>\n <vaadin-context-menu-list-box slot=\"overlay\">\n <vaadin-context-menu-item>Edit</vaadin-context-menu-item>\n <vaadin-context-menu-item>Delete</vaadin-context-menu-item>\n </vaadin-context-menu-list-box>\n</vaadin-context-menu>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n------------------|------------------------\n`items` | The items container\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
175
|
+
"name": "ContextMenuListBox",
|
|
176
|
+
"members": [
|
|
177
|
+
{
|
|
178
|
+
"kind": "field",
|
|
179
|
+
"name": "disabled",
|
|
180
|
+
"privacy": "public",
|
|
181
|
+
"type": {
|
|
182
|
+
"text": "boolean"
|
|
183
|
+
},
|
|
184
|
+
"description": "If true, the user cannot interact with this element.\nWhen the element is disabled, the selected item is\nnot updated when `selected` property is changed.",
|
|
185
|
+
"attribute": "disabled",
|
|
186
|
+
"inheritedFrom": {
|
|
187
|
+
"name": "ListMixin",
|
|
188
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"kind": "field",
|
|
193
|
+
"name": "items",
|
|
194
|
+
"privacy": "public",
|
|
195
|
+
"type": {
|
|
196
|
+
"text": "!Array<!Element> | undefined"
|
|
197
|
+
},
|
|
198
|
+
"description": "A read-only list of items from which a selection can be made.\nIt is populated from the elements passed to the light DOM,\nand updated dynamically when adding or removing items.",
|
|
199
|
+
"attribute": "items",
|
|
200
|
+
"readonly": true,
|
|
201
|
+
"inheritedFrom": {
|
|
202
|
+
"name": "ListMixin",
|
|
203
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"kind": "field",
|
|
208
|
+
"name": "orientation",
|
|
209
|
+
"privacy": "public",
|
|
210
|
+
"type": {
|
|
211
|
+
"text": "string"
|
|
212
|
+
},
|
|
213
|
+
"description": "Define how items are disposed in the dom.\nPossible values are: `horizontal|vertical`.\nIt also changes navigation keys from left/right to up/down.",
|
|
214
|
+
"attribute": "orientation",
|
|
215
|
+
"readonly": true,
|
|
216
|
+
"inheritedFrom": {
|
|
217
|
+
"name": "ListMixin",
|
|
218
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"kind": "field",
|
|
223
|
+
"name": "selected",
|
|
224
|
+
"privacy": "public",
|
|
225
|
+
"type": {
|
|
226
|
+
"text": "number"
|
|
227
|
+
},
|
|
228
|
+
"description": "The index of the item selected in the items array.\nNote: Not updated when used in `multiple` selection mode.",
|
|
229
|
+
"attribute": "selected",
|
|
230
|
+
"inheritedFrom": {
|
|
231
|
+
"name": "ListMixin",
|
|
232
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
],
|
|
236
|
+
"attributes": [
|
|
237
|
+
{
|
|
238
|
+
"name": "disabled",
|
|
239
|
+
"type": {
|
|
240
|
+
"text": "boolean"
|
|
241
|
+
},
|
|
242
|
+
"description": "If true, the user cannot interact with this element.\nWhen the element is disabled, the selected item is\nnot updated when `selected` property is changed.",
|
|
243
|
+
"fieldName": "disabled",
|
|
244
|
+
"inheritedFrom": {
|
|
245
|
+
"name": "ListMixin",
|
|
246
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"name": "orientation",
|
|
251
|
+
"type": {
|
|
252
|
+
"text": "string"
|
|
253
|
+
},
|
|
254
|
+
"description": "Define how items are disposed in the dom.\nPossible values are: `horizontal|vertical`.\nIt also changes navigation keys from left/right to up/down.",
|
|
255
|
+
"fieldName": "orientation",
|
|
256
|
+
"inheritedFrom": {
|
|
257
|
+
"name": "ListMixin",
|
|
258
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"name": "selected",
|
|
263
|
+
"type": {
|
|
264
|
+
"text": "number"
|
|
265
|
+
},
|
|
266
|
+
"description": "The index of the item selected in the items array.\nNote: Not updated when used in `multiple` selection mode.",
|
|
267
|
+
"fieldName": "selected",
|
|
268
|
+
"inheritedFrom": {
|
|
269
|
+
"name": "ListMixin",
|
|
270
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
"mixins": [
|
|
275
|
+
{
|
|
276
|
+
"name": "ListMixin",
|
|
277
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"name": "ThemableMixin",
|
|
281
|
+
"package": "@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"name": "DirMixin",
|
|
285
|
+
"package": "@vaadin/component-base/src/dir-mixin.js"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"name": "PolylitMixin",
|
|
289
|
+
"package": "@vaadin/component-base/src/polylit-mixin.js"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"name": "LumoInjectionMixin",
|
|
293
|
+
"package": "@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js"
|
|
294
|
+
}
|
|
295
|
+
],
|
|
296
|
+
"superclass": {
|
|
297
|
+
"name": "LitElement",
|
|
298
|
+
"package": "lit"
|
|
299
|
+
},
|
|
300
|
+
"tagName": "vaadin-context-menu-list-box",
|
|
301
|
+
"customElement": true,
|
|
302
|
+
"events": []
|
|
303
|
+
}
|
|
304
|
+
],
|
|
305
|
+
"exports": [
|
|
306
|
+
{
|
|
307
|
+
"kind": "js",
|
|
308
|
+
"name": "ContextMenuListBox",
|
|
309
|
+
"declaration": {
|
|
310
|
+
"name": "ContextMenuListBox",
|
|
311
|
+
"module": "src/vaadin-context-menu-list-box.js"
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
},
|
|
20
316
|
{
|
|
21
317
|
"kind": "javascript-module",
|
|
22
318
|
"path": "src/vaadin-context-menu-mixin.js",
|
|
@@ -50,7 +346,7 @@
|
|
|
50
346
|
"name": "items",
|
|
51
347
|
"privacy": "public",
|
|
52
348
|
"type": {
|
|
53
|
-
"text": "!Array<!
|
|
349
|
+
"text": "!Array<!ContextMenuItemData> | undefined"
|
|
54
350
|
},
|
|
55
351
|
"description": "Defines a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nThe items API can't be used together with a renderer!\n\n#### Example\n\n```javascript\ncontextMenu.items = [\n { text: 'Menu Item 1', theme: 'primary', className: 'first', children:\n [\n { text: 'Menu Item 1-1', checked: true, keepOpen: true },\n { text: 'Menu Item 1-2' }\n ]\n },\n { component: 'hr' },\n { text: 'Menu Item 2', children:\n [\n { text: 'Menu Item 2-1' },\n { text: 'Menu Item 2-2', disabled: true }\n ]\n },\n { text: 'Menu Item 3', disabled: true, className: 'last' }\n];\n```\n\n#### Item tooltips\n\nMenu items can have tooltips that are shown on hover and keyboard\nfocus. To enable them, add a slotted `<vaadin-tooltip>` element\nand set the `tooltip` property on each item that should have one:\n\n```html\n<vaadin-context-menu>\n <vaadin-tooltip slot=\"tooltip\"></vaadin-tooltip>\n</vaadin-context-menu>\n```",
|
|
56
352
|
"attribute": "items",
|
|
@@ -113,6 +409,7 @@
|
|
|
113
409
|
"text": "ContextMenuRenderer | undefined"
|
|
114
410
|
},
|
|
115
411
|
"description": "Custom function for rendering the content of the menu overlay.\nReceives three arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `contextMenu` The reference to the `<vaadin-context-menu>` element.\n- `context` The object with the menu context, contains:\n - `context.target` the target of the menu opening event,\n - `context.detail` the menu opening event detail.",
|
|
412
|
+
"deprecated": "Use a slotted `<vaadin-context-menu-list-box>` or the `items` property instead",
|
|
116
413
|
"attribute": "renderer"
|
|
117
414
|
},
|
|
118
415
|
{
|
|
@@ -199,6 +496,7 @@
|
|
|
199
496
|
"text": "ContextMenuRenderer | undefined"
|
|
200
497
|
},
|
|
201
498
|
"description": "Custom function for rendering the content of the menu overlay.\nReceives three arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `contextMenu` The reference to the `<vaadin-context-menu>` element.\n- `context` The object with the menu context, contains:\n - `context.target` the target of the menu opening event,\n - `context.detail` the menu opening event detail.",
|
|
499
|
+
"deprecated": "Use a slotted `<vaadin-context-menu-list-box>` or the `items` property instead",
|
|
202
500
|
"fieldName": "renderer"
|
|
203
501
|
},
|
|
204
502
|
{
|
|
@@ -319,7 +617,7 @@
|
|
|
319
617
|
"declarations": [
|
|
320
618
|
{
|
|
321
619
|
"kind": "class",
|
|
322
|
-
"description": "`<vaadin-context-menu>` is a Web Component for creating context menus.\n\n### Items\n\nItems is a higher level convenience API for defining a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nWhen an item is selected, `<vaadin-context-menu>` dispatches an \"item-selected\" event\nwith the selected item as `event.detail.value` property.\nIf item does not have `keepOpen` property the menu will be closed.\n\n```javascript\ncontextMenu.items = [\n { text: 'Menu Item 1', theme: 'primary', className: 'first', children:\n [\n { text: 'Menu Item 1-1', checked: true, keepOpen: true },\n { text: 'Menu Item 1-2' }\n ]\n },\n { component: 'hr' },\n { text: 'Menu Item 2', children:\n [\n { text: 'Menu Item 2-1' },\n { text: 'Menu Item 2-2', disabled: true }\n ]\n },\n { text: 'Menu Item 3', disabled: true, className: 'last' }\n];\n\ncontextMenu.addEventListener('item-selected', e => {\n const item = e.detail.value;\n console.log(`${item.text} selected`);\n});\n```\n\n**NOTE:** when the `items` array is defined, the renderer cannot be used.\n\n#### Disabled menu items\n\nWhen disabled, menu items are rendered as \"dimmed\".\n\nBy default, disabled items are not focusable and don't react to hover.\nAs a result, they are hidden from assistive technologies, and it's not\npossible to show a tooltip to explain why they are disabled. This can\nbe addressed by enabling the feature flag `accessibleDisabledMenuItems`,\nwhich makes disabled items focusable and hoverable, while still\npreventing them from being activated:\n\n```js\n// Set before any context menu is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledMenuItems = true;\n```\n\n#### Item tooltips\n\nMenu items can have tooltips that are shown on hover and keyboard\nfocus. To enable them, add a slotted `<vaadin-tooltip>` element\nand set the `tooltip` property on each item that should have one:\n\n```html\n<vaadin-context-menu>\n <vaadin-tooltip slot=\"tooltip\"></vaadin-tooltip>\n</vaadin-context-menu>\n```\n\n### Rendering\n\nThe content of the menu can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `contextMenu`, `model` arguments when applicable.\nGenerate DOM content by using `model` object properties if needed, append it to the `root`\nelement and control the state of the host element by accessing `contextMenu`. Before generating\nnew content, the renderer function should check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-context-menu id=\"contextMenu\">\n <p>This paragraph has a context menu.</p>\n</vaadin-context-menu>\n```\n```js\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.renderer = (root, contextMenu, context) => {\n let listBox = root.firstElementChild;\n if (!listBox) {\n listBox = document.createElement('vaadin-list-box');\n root.appendChild(listBox);\n }\n\n let item = listBox.querySelector('vaadin-item');\n if (!item) {\n item = document.createElement('vaadin-item');\n listBox.appendChild(item);\n }\n item.textContent = 'Content of the selector: ' + context.target.textContent;\n};\n```\n\nYou can access the menu context inside the renderer using\n`context.target` and `context.detail`.\n\nRenderer is called on the opening of the context-menu and each time the related context is updated.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### `vaadin-contextmenu` Gesture Event\n\n`vaadin-contextmenu` is a gesture event (a custom event),\nwhich is dispatched after either `contextmenu` or long touch events.\nThis enables support for both mouse and touch environments in a uniform way.\n\n`<vaadin-context-menu>` opens the menu overlay on the `vaadin-contextmenu`\nevent by default.\n\n### Menu Listener\n\nBy default, the `<vaadin-context-menu>` element listens for the menu opening\nevent on itself. In case if you do not want to wrap the target, you can listen for\nevents on an element outside the `<vaadin-context-menu>` by setting the\n`listenOn` property:\n\n```html\n<vaadin-context-menu id=\"contextMenu\"></vaadin-context-menu>\n\n<div id=\"menuListener\">The element that listens for the contextmenu event.</div>\n```\n```javascript\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.listenOn = document.querySelector('#menuListener');\n```\n\n### Filtering Menu Targets\n\nBy default, the listener element and all its descendants open the context\nmenu. You can filter the menu targets to a smaller set of elements inside\nthe listener element by setting the `selector` property.\n\nIn the following example, only the elements matching `.has-menu` will open the context menu:\n\n```html\n<vaadin-context-menu selector=\".has-menu\">\n <p class=\"has-menu\">This paragraph opens the context menu</p>\n <p>This paragraph does not open the context menu</p>\n</vaadin-context-menu>\n```\n\n### Menu Context\n\nThe following properties are available in the `context` argument:\n\n- `target` is the menu opening event target, which is the element that\nthe user has called the context menu for\n- `detail` is the menu opening event detail\n\nIn the following example, the menu item text is composed with the contents\nof the element that opened the menu:\n\n```html\n<vaadin-context-menu selector=\"li\" id=\"contextMenu\">\n <ul>\n <li>Foo</li>\n <li>Bar</li>\n <li>Baz</li>\n </ul>\n</vaadin-context-menu>\n```\n```js\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.renderer = (root, contextMenu, context) => {\n let listBox = root.firstElementChild;\n if (!listBox) {\n listBox = document.createElement('vaadin-list-box');\n root.appendChild(listBox);\n }\n\n let item = listBox.querySelector('vaadin-item');\n if (!item) {\n item = document.createElement('vaadin-item');\n listBox.appendChild(item);\n }\n item.textContent = 'The menu target: ' + context.target.textContent;\n};\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|-------------------------------------------\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n\n### Custom CSS Properties\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property | Description\n--------------------------------------|-------------\n`--vaadin-context-menu-offset-top` | Used as an offset when using `position` and the context menu is aligned vertically below the target\n`--vaadin-context-menu-offset-bottom` | Used as an offset when using `position` and the context menu is aligned vertically above the target\n`--vaadin-context-menu-offset-start` | Used as an offset when using `position` and the context menu is aligned horizontally after the target\n`--vaadin-context-menu-offset-end` | Used as an offset when using `position` and the context menu is aligned horizontally before the target\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n###
|
|
620
|
+
"description": "`<vaadin-context-menu>` is a Web Component for creating context menus.\n\n### Items\n\nItems is a higher level convenience API for defining a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nWhen an item is selected, `<vaadin-context-menu>` dispatches an \"item-selected\" event\nwith the selected item as `event.detail.value` property.\nIf item does not have `keepOpen` property the menu will be closed.\n\n```javascript\ncontextMenu.items = [\n { text: 'Menu Item 1', theme: 'primary', className: 'first', children:\n [\n { text: 'Menu Item 1-1', checked: true, keepOpen: true },\n { text: 'Menu Item 1-2' }\n ]\n },\n { component: 'hr' },\n { text: 'Menu Item 2', children:\n [\n { text: 'Menu Item 2-1' },\n { text: 'Menu Item 2-2', disabled: true }\n ]\n },\n { text: 'Menu Item 3', disabled: true, className: 'last' }\n];\n\ncontextMenu.addEventListener('item-selected', e => {\n const item = e.detail.value;\n console.log(`${item.text} selected`);\n});\n```\n\n**NOTE:** when the `items` array is defined, the renderer cannot be used.\n\n#### Disabled menu items\n\nWhen disabled, menu items are rendered as \"dimmed\".\n\nBy default, disabled items are not focusable and don't react to hover.\nAs a result, they are hidden from assistive technologies, and it's not\npossible to show a tooltip to explain why they are disabled. This can\nbe addressed by enabling the feature flag `accessibleDisabledMenuItems`,\nwhich makes disabled items focusable and hoverable, while still\npreventing them from being activated:\n\n```js\n// Set before any context menu is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledMenuItems = true;\n```\n\n#### Item tooltips\n\nMenu items can have tooltips that are shown on hover and keyboard\nfocus. To enable them, add a slotted `<vaadin-tooltip>` element\nand set the `tooltip` property on each item that should have one:\n\n```html\n<vaadin-context-menu>\n <vaadin-tooltip slot=\"tooltip\"></vaadin-tooltip>\n</vaadin-context-menu>\n```\n\n### Slotted list-box\n\nThe content of the menu can also be populated by providing a custom\n`<vaadin-context-menu-list-box>` with the `overlay` slot:\n\n```html\n<vaadin-context-menu>\n <vaadin-context-menu-list-box slot=\"overlay\">\n <vaadin-context-menu-item>Edit</vaadin-context-menu-item>\n <vaadin-context-menu-item>Delete</vaadin-context-menu-item>\n </vaadin-context-menu-list-box>\n</vaadin-context-menu>\n```\n\n**Note:** slotted list-box supports a single root-level menu only and\ncannot be combined with the `items` or `renderer` API.\n\n### Rendering\n\nThe content of the menu can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `contextMenu`, `model` arguments when applicable.\nGenerate DOM content by using `model` object properties if needed, append it to the `root`\nelement and control the state of the host element by accessing `contextMenu`. Before generating\nnew content, the renderer function should check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-context-menu id=\"contextMenu\">\n <p>This paragraph has a context menu.</p>\n</vaadin-context-menu>\n```\n```js\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.renderer = (root, contextMenu, context) => {\n let listBox = root.firstElementChild;\n if (!listBox) {\n listBox = document.createElement('vaadin-list-box');\n root.appendChild(listBox);\n }\n\n let item = listBox.querySelector('vaadin-item');\n if (!item) {\n item = document.createElement('vaadin-item');\n listBox.appendChild(item);\n }\n item.textContent = 'Content of the selector: ' + context.target.textContent;\n};\n```\n\nYou can access the menu context inside the renderer using\n`context.target` and `context.detail`.\n\nRenderer is called on the opening of the context-menu and each time the related context is updated.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### `vaadin-contextmenu` Gesture Event\n\n`vaadin-contextmenu` is a gesture event (a custom event),\nwhich is dispatched after either `contextmenu` or long touch events.\nThis enables support for both mouse and touch environments in a uniform way.\n\n`<vaadin-context-menu>` opens the menu overlay on the `vaadin-contextmenu`\nevent by default.\n\n### Menu Listener\n\nBy default, the `<vaadin-context-menu>` element listens for the menu opening\nevent on itself. In case if you do not want to wrap the target, you can listen for\nevents on an element outside the `<vaadin-context-menu>` by setting the\n`listenOn` property:\n\n```html\n<vaadin-context-menu id=\"contextMenu\"></vaadin-context-menu>\n\n<div id=\"menuListener\">The element that listens for the contextmenu event.</div>\n```\n```javascript\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.listenOn = document.querySelector('#menuListener');\n```\n\n### Filtering Menu Targets\n\nBy default, the listener element and all its descendants open the context\nmenu. You can filter the menu targets to a smaller set of elements inside\nthe listener element by setting the `selector` property.\n\nIn the following example, only the elements matching `.has-menu` will open the context menu:\n\n```html\n<vaadin-context-menu selector=\".has-menu\">\n <p class=\"has-menu\">This paragraph opens the context menu</p>\n <p>This paragraph does not open the context menu</p>\n</vaadin-context-menu>\n```\n\n### Menu Context\n\nThe following properties are available in the `context` argument:\n\n- `target` is the menu opening event target, which is the element that\nthe user has called the context menu for\n- `detail` is the menu opening event detail\n\nIn the following example, the menu item text is composed with the contents\nof the element that opened the menu:\n\n```html\n<vaadin-context-menu selector=\"li\" id=\"contextMenu\">\n <ul>\n <li>Foo</li>\n <li>Bar</li>\n <li>Baz</li>\n </ul>\n</vaadin-context-menu>\n```\n```js\nconst contextMenu = document.querySelector('#contextMenu');\ncontextMenu.renderer = (root, contextMenu, context) => {\n let listBox = root.firstElementChild;\n if (!listBox) {\n listBox = document.createElement('vaadin-list-box');\n root.appendChild(listBox);\n }\n\n let item = listBox.querySelector('vaadin-item');\n if (!item) {\n item = document.createElement('vaadin-item');\n listBox.appendChild(item);\n }\n item.textContent = 'The menu target: ' + context.target.textContent;\n};\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|-------------------------------------------\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n\n### Custom CSS Properties\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property | Description\n--------------------------------------|-------------\n`--vaadin-context-menu-offset-top` | Used as an offset when using `position` and the context menu is aligned vertically below the target\n`--vaadin-context-menu-offset-bottom` | Used as an offset when using `position` and the context menu is aligned vertically above the target\n`--vaadin-context-menu-offset-start` | Used as an offset when using `position` and the context menu is aligned horizontally after the target\n`--vaadin-context-menu-offset-end` | Used as an offset when using `position` and the context menu is aligned horizontally before the target\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Related components\n\nIn addition to `<vaadin-context-menu>` itself, the following components are themable:\n\n- [`<vaadin-context-menu-item>`](#/elements/vaadin-context-menu-item) - an item element.\n- [`<vaadin-context-menu-list-box>`](#/elements/vaadin-context-menu-list-box) - a list-box element.",
|
|
323
621
|
"name": "ContextMenu",
|
|
324
622
|
"members": [
|
|
325
623
|
{
|
|
@@ -350,7 +648,7 @@
|
|
|
350
648
|
"name": "items",
|
|
351
649
|
"privacy": "public",
|
|
352
650
|
"type": {
|
|
353
|
-
"text": "!Array<!
|
|
651
|
+
"text": "!Array<!ContextMenuItemData> | undefined"
|
|
354
652
|
},
|
|
355
653
|
"description": "Defines a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nThe items API can't be used together with a renderer!\n\n#### Example\n\n```javascript\ncontextMenu.items = [\n { text: 'Menu Item 1', theme: 'primary', className: 'first', children:\n [\n { text: 'Menu Item 1-1', checked: true, keepOpen: true },\n { text: 'Menu Item 1-2' }\n ]\n },\n { component: 'hr' },\n { text: 'Menu Item 2', children:\n [\n { text: 'Menu Item 2-1' },\n { text: 'Menu Item 2-2', disabled: true }\n ]\n },\n { text: 'Menu Item 3', disabled: true, className: 'last' }\n];\n```\n\n#### Item tooltips\n\nMenu items can have tooltips that are shown on hover and keyboard\nfocus. To enable them, add a slotted `<vaadin-tooltip>` element\nand set the `tooltip` property on each item that should have one:\n\n```html\n<vaadin-context-menu>\n <vaadin-tooltip slot=\"tooltip\"></vaadin-tooltip>\n</vaadin-context-menu>\n```",
|
|
356
654
|
"attribute": "items",
|
|
@@ -439,6 +737,7 @@
|
|
|
439
737
|
"text": "ContextMenuRenderer | undefined"
|
|
440
738
|
},
|
|
441
739
|
"description": "Custom function for rendering the content of the menu overlay.\nReceives three arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `contextMenu` The reference to the `<vaadin-context-menu>` element.\n- `context` The object with the menu context, contains:\n - `context.target` the target of the menu opening event,\n - `context.detail` the menu opening event detail.",
|
|
740
|
+
"deprecated": "Use a slotted `<vaadin-context-menu-list-box>` or the `items` property instead",
|
|
442
741
|
"attribute": "renderer",
|
|
443
742
|
"inheritedFrom": {
|
|
444
743
|
"name": "ContextMenuMixin",
|
|
@@ -582,6 +881,7 @@
|
|
|
582
881
|
"text": "ContextMenuRenderer | undefined"
|
|
583
882
|
},
|
|
584
883
|
"description": "Custom function for rendering the content of the menu overlay.\nReceives three arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `contextMenu` The reference to the `<vaadin-context-menu>` element.\n- `context` The object with the menu context, contains:\n - `context.target` the target of the menu opening event,\n - `context.detail` the menu opening event detail.",
|
|
884
|
+
"deprecated": "Use a slotted `<vaadin-context-menu-list-box>` or the `items` property instead",
|
|
585
885
|
"fieldName": "renderer",
|
|
586
886
|
"inheritedFrom": {
|
|
587
887
|
"name": "ContextMenuMixin",
|
|
@@ -656,7 +956,7 @@
|
|
|
656
956
|
"name": "items",
|
|
657
957
|
"privacy": "public",
|
|
658
958
|
"type": {
|
|
659
|
-
"text": "!Array<!
|
|
959
|
+
"text": "!Array<!ContextMenuItemData> | undefined"
|
|
660
960
|
},
|
|
661
961
|
"description": "Defines a (hierarchical) menu structure for the component.\nIf a menu item has a non-empty `children` set, a sub-menu with the child items is opened\nnext to the parent menu on mouseover, tap or a right arrow keypress.\n\nThe items API can't be used together with a renderer!\n\n#### Example\n\n```javascript\ncontextMenu.items = [\n { text: 'Menu Item 1', theme: 'primary', className: 'first', children:\n [\n { text: 'Menu Item 1-1', checked: true, keepOpen: true },\n { text: 'Menu Item 1-2' }\n ]\n },\n { component: 'hr' },\n { text: 'Menu Item 2', children:\n [\n { text: 'Menu Item 2-1' },\n { text: 'Menu Item 2-2', disabled: true }\n ]\n },\n { text: 'Menu Item 3', disabled: true, className: 'last' }\n];\n```\n\n#### Item tooltips\n\nMenu items can have tooltips that are shown on hover and keyboard\nfocus. To enable them, add a slotted `<vaadin-tooltip>` element\nand set the `tooltip` property on each item that should have one:\n\n```html\n<vaadin-context-menu>\n <vaadin-tooltip slot=\"tooltip\"></vaadin-tooltip>\n</vaadin-context-menu>\n```",
|
|
662
962
|
"attribute": "items"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/context-menu",
|
|
3
|
-
"version": "25.3.0-
|
|
3
|
+
"version": "25.3.0-alpha7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/a11y-base": "25.3.0-
|
|
41
|
-
"@vaadin/component-base": "25.3.0-
|
|
42
|
-
"@vaadin/item": "25.3.0-
|
|
43
|
-
"@vaadin/list-box": "25.3.0-
|
|
44
|
-
"@vaadin/lit-renderer": "25.3.0-
|
|
45
|
-
"@vaadin/overlay": "25.3.0-
|
|
46
|
-
"@vaadin/vaadin-themable-mixin": "25.3.0-
|
|
40
|
+
"@vaadin/a11y-base": "25.3.0-alpha7",
|
|
41
|
+
"@vaadin/component-base": "25.3.0-alpha7",
|
|
42
|
+
"@vaadin/item": "25.3.0-alpha7",
|
|
43
|
+
"@vaadin/list-box": "25.3.0-alpha7",
|
|
44
|
+
"@vaadin/lit-renderer": "25.3.0-alpha7",
|
|
45
|
+
"@vaadin/overlay": "25.3.0-alpha7",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "25.3.0-alpha7",
|
|
47
47
|
"lit": "^3.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@vaadin/aura": "25.3.0-
|
|
51
|
-
"@vaadin/chai-plugins": "25.3.0-
|
|
52
|
-
"@vaadin/test-runner-commands": "25.3.0-
|
|
50
|
+
"@vaadin/aura": "25.3.0-alpha7",
|
|
51
|
+
"@vaadin/chai-plugins": "25.3.0-alpha7",
|
|
52
|
+
"@vaadin/test-runner-commands": "25.3.0-alpha7",
|
|
53
53
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
54
|
-
"@vaadin/vaadin-lumo-styles": "25.3.0-
|
|
54
|
+
"@vaadin/vaadin-lumo-styles": "25.3.0-alpha7",
|
|
55
55
|
"sinon": "^22.0.0"
|
|
56
56
|
},
|
|
57
57
|
"customElements": "custom-elements.json",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"web-types.json",
|
|
60
60
|
"web-types.lit.json"
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "ae7b9823df5598faebd7a482993029ee489c35ae"
|
|
63
63
|
}
|
|
@@ -52,6 +52,7 @@ export class ContextMenuRendererDirective extends LitRendererDirective<ContextMe
|
|
|
52
52
|
* @param renderer the renderer callback that returns a Lit template.
|
|
53
53
|
* @param dependencies a single dependency or an array of dependencies
|
|
54
54
|
* which trigger a re-render when changed.
|
|
55
|
+
* @deprecated Use a slotted `<vaadin-context-menu-list-box>` or the `items` property instead
|
|
55
56
|
*/
|
|
56
57
|
export declare function contextMenuRenderer(
|
|
57
58
|
renderer: ContextMenuLitRenderer,
|
|
@@ -56,5 +56,6 @@ export class ContextMenuRendererDirective extends LitRendererDirective {
|
|
|
56
56
|
* @param renderer the renderer callback that returns a Lit template.
|
|
57
57
|
* @param dependencies a single dependency or an array of dependencies
|
|
58
58
|
* which trigger a re-render when changed.
|
|
59
|
+
* @deprecated Use a slotted `<vaadin-context-menu-list-box>` or the `items` property instead
|
|
59
60
|
*/
|
|
60
61
|
export const contextMenuRenderer = directive(ContextMenuRendererDirective);
|
|
@@ -8,7 +8,39 @@ import { ItemMixin } from '@vaadin/item/src/vaadin-item-mixin.js';
|
|
|
8
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* `<vaadin-context-menu-item>` is a Web Component for creating `<vaadin-context-menu>` items.
|
|
12
|
+
*
|
|
13
|
+
* ### Styling
|
|
14
|
+
*
|
|
15
|
+
* The following shadow DOM parts are available for styling:
|
|
16
|
+
*
|
|
17
|
+
* Part name | Description
|
|
18
|
+
* -------------|----------------
|
|
19
|
+
* `checkmark` | The graphical checkmark shown for a checked item
|
|
20
|
+
* `content` | The element that wraps the slot
|
|
21
|
+
*
|
|
22
|
+
* The following state attributes are available for styling:
|
|
23
|
+
*
|
|
24
|
+
* Attribute | Description
|
|
25
|
+
* -------------|-------------
|
|
26
|
+
* `active` | Set when the item is pressed down, either with mouse, touch or the keyboard.
|
|
27
|
+
* `disabled` | Set when the item is disabled.
|
|
28
|
+
* `focus-ring` | Set when the item is focused using the keyboard.
|
|
29
|
+
* `focused` | Set when the item is focused.
|
|
30
|
+
* `expanded` | Set when the item has a sub-menu and it is opened.
|
|
31
|
+
*
|
|
32
|
+
* The following custom CSS properties are available for styling:
|
|
33
|
+
*
|
|
34
|
+
* Custom CSS property |
|
|
35
|
+
* :----------------------------------|
|
|
36
|
+
* | `--vaadin-item-border-radius` |
|
|
37
|
+
* | `--vaadin-item-checkmark-color` |
|
|
38
|
+
* | `--vaadin-item-gap` |
|
|
39
|
+
* | `--vaadin-item-height` |
|
|
40
|
+
* | `--vaadin-item-padding` |
|
|
41
|
+
* | `--vaadin-item-text-align` |
|
|
42
|
+
*
|
|
43
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
12
44
|
*/
|
|
13
45
|
declare class ContextMenuItem extends ItemMixin(DirMixin(ThemableMixin(HTMLElement))) {}
|
|
14
46
|
|
|
@@ -13,11 +13,42 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
13
13
|
import { contextMenuItemStyles } from './styles/vaadin-context-menu-item-base-styles.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* `<vaadin-context-menu-item>` is a Web Component for creating `<vaadin-context-menu>` items.
|
|
17
|
+
*
|
|
18
|
+
* ### Styling
|
|
19
|
+
*
|
|
20
|
+
* The following shadow DOM parts are available for styling:
|
|
21
|
+
*
|
|
22
|
+
* Part name | Description
|
|
23
|
+
* -------------|----------------
|
|
24
|
+
* `checkmark` | The graphical checkmark shown for a checked item
|
|
25
|
+
* `content` | The element that wraps the slot
|
|
26
|
+
*
|
|
27
|
+
* The following state attributes are available for styling:
|
|
28
|
+
*
|
|
29
|
+
* Attribute | Description
|
|
30
|
+
* -------------|-------------
|
|
31
|
+
* `active` | Set when the item is pressed down, either with mouse, touch or the keyboard.
|
|
32
|
+
* `disabled` | Set when the item is disabled.
|
|
33
|
+
* `focus-ring` | Set when the item is focused using the keyboard.
|
|
34
|
+
* `focused` | Set when the item is focused.
|
|
35
|
+
* `expanded` | Set when the item has a sub-menu and it is opened.
|
|
36
|
+
*
|
|
37
|
+
* The following custom CSS properties are available for styling:
|
|
38
|
+
*
|
|
39
|
+
* Custom CSS property |
|
|
40
|
+
* :----------------------------------|
|
|
41
|
+
* | `--vaadin-item-border-radius` |
|
|
42
|
+
* | `--vaadin-item-checkmark-color` |
|
|
43
|
+
* | `--vaadin-item-gap` |
|
|
44
|
+
* | `--vaadin-item-height` |
|
|
45
|
+
* | `--vaadin-item-padding` |
|
|
46
|
+
* | `--vaadin-item-text-align` |
|
|
47
|
+
*
|
|
48
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
17
49
|
*
|
|
18
50
|
* @customElement vaadin-context-menu-item
|
|
19
51
|
* @extends HTMLElement
|
|
20
|
-
* @protected
|
|
21
52
|
*/
|
|
22
53
|
class ContextMenuItem extends ItemMixin(ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
23
54
|
static get is() {
|
|
@@ -8,7 +8,26 @@ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
|
8
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* `<vaadin-context-menu-list-box>` is a Web Component for wrapping `<vaadin-context-menu>` items.
|
|
12
|
+
*
|
|
13
|
+
* ```html
|
|
14
|
+
* <vaadin-context-menu>
|
|
15
|
+
* <vaadin-context-menu-list-box slot="overlay">
|
|
16
|
+
* <vaadin-context-menu-item>Edit</vaadin-context-menu-item>
|
|
17
|
+
* <vaadin-context-menu-item>Delete</vaadin-context-menu-item>
|
|
18
|
+
* </vaadin-context-menu-list-box>
|
|
19
|
+
* </vaadin-context-menu>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* ### Styling
|
|
23
|
+
*
|
|
24
|
+
* The following shadow DOM parts are available for styling:
|
|
25
|
+
*
|
|
26
|
+
* Part name | Description
|
|
27
|
+
* ------------------|------------------------
|
|
28
|
+
* `items` | The items container
|
|
29
|
+
*
|
|
30
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
12
31
|
*/
|
|
13
32
|
declare class ContextMenuListBox extends ListMixin(DirMixin(ThemableMixin(HTMLElement))) {}
|
|
14
33
|
|
|
@@ -13,11 +13,29 @@ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection
|
|
|
13
13
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* `<vaadin-context-menu-list-box>` is a Web Component for wrapping `<vaadin-context-menu>` items.
|
|
17
|
+
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <vaadin-context-menu>
|
|
20
|
+
* <vaadin-context-menu-list-box slot="overlay">
|
|
21
|
+
* <vaadin-context-menu-item>Edit</vaadin-context-menu-item>
|
|
22
|
+
* <vaadin-context-menu-item>Delete</vaadin-context-menu-item>
|
|
23
|
+
* </vaadin-context-menu-list-box>
|
|
24
|
+
* </vaadin-context-menu>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* ### Styling
|
|
28
|
+
*
|
|
29
|
+
* The following shadow DOM parts are available for styling:
|
|
30
|
+
*
|
|
31
|
+
* Part name | Description
|
|
32
|
+
* ------------------|------------------------
|
|
33
|
+
* `items` | The items container
|
|
34
|
+
*
|
|
35
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
17
36
|
*
|
|
18
37
|
* @customElement vaadin-context-menu-list-box
|
|
19
38
|
* @extends HTMLElement
|
|
20
|
-
* @protected
|
|
21
39
|
*/
|
|
22
40
|
class ContextMenuListBox extends ListMixin(ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
23
41
|
static get is() {
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
import type { ContextMenuRenderer } from './vaadin-context-menu.js';
|
|
8
|
-
import type {
|
|
8
|
+
import type { ContextMenuItemData, ItemsMixinClass } from './vaadin-contextmenu-items-mixin.js';
|
|
9
9
|
|
|
10
10
|
export declare function ContextMenuMixin<
|
|
11
11
|
T extends Constructor<HTMLElement>,
|
|
12
|
-
TItem extends
|
|
12
|
+
TItem extends ContextMenuItemData = ContextMenuItemData,
|
|
13
13
|
>(base: T): Constructor<ContextMenuMixinClass> & Constructor<ItemsMixinClass<TItem>> & T;
|
|
14
14
|
|
|
15
15
|
export declare class ContextMenuMixinClass {
|
|
@@ -52,6 +52,8 @@ export declare class ContextMenuMixinClass {
|
|
|
52
52
|
* - `context` The object with the menu context, contains:
|
|
53
53
|
* - `context.target` the target of the menu opening event,
|
|
54
54
|
* - `context.detail` the menu opening event detail.
|
|
55
|
+
*
|
|
56
|
+
* @deprecated Use a slotted `<vaadin-context-menu-list-box>` or the `items` property instead
|
|
55
57
|
*/
|
|
56
58
|
renderer: ContextMenuRenderer | null | undefined;
|
|
57
59
|
|
|
@@ -83,5 +85,5 @@ export declare class ContextMenuMixinClass {
|
|
|
83
85
|
|
|
84
86
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
85
87
|
export declare interface ContextMenuMixinClass<
|
|
86
|
-
TItem extends
|
|
88
|
+
TItem extends ContextMenuItemData = ContextMenuItemData,
|
|
87
89
|
> extends ItemsMixinClass<TItem> {}
|