wj-elements 0.7.7 → 0.8.0
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/dist/animations.js +28 -51
- package/dist/animations.js.map +1 -1
- package/dist/base-path.js +19 -31
- package/dist/base-path.js.map +1 -1
- package/dist/custom-elements.json +11504 -11499
- package/dist/dark.css +1 -302
- package/dist/date.js +16 -36
- package/dist/date.js.map +1 -1
- package/dist/element-utils.js +20 -81
- package/dist/element-utils.js.map +1 -1
- package/dist/event.js +49 -165
- package/dist/event.js.map +1 -1
- package/dist/form-associated-element-BjeJn7j8.js +101 -0
- package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
- package/dist/icon-DmsqtDpL.js +102 -0
- package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
- package/dist/light.css +1 -731
- package/dist/localize.js +36 -111
- package/dist/localize.js.map +1 -1
- package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
- package/dist/permissions.js +14 -41
- package/dist/permissions.js.map +1 -1
- package/dist/popup.element-CbkhthPP.js +806 -0
- package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
- package/dist/router-links-CNsJ-elb.js +105 -0
- package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
- package/dist/skeleton.css +1 -197
- package/dist/styles.css +1 -866
- package/dist/universal-service.js +48 -109
- package/dist/universal-service.js.map +1 -1
- package/dist/utils.js +11 -18
- package/dist/utils.js.map +1 -1
- package/dist/web-types.json +760 -760
- package/dist/wje-accordion-item.js +33 -106
- package/dist/wje-accordion-item.js.map +1 -1
- package/dist/wje-accordion.js +19 -84
- package/dist/wje-accordion.js.map +1 -1
- package/dist/wje-animation.js +37 -4258
- package/dist/wje-animation.js.map +1 -1
- package/dist/wje-aside.js +9 -34
- package/dist/wje-aside.js.map +1 -1
- package/dist/wje-avatar.js +36 -126
- package/dist/wje-avatar.js.map +1 -1
- package/dist/wje-badge.js +10 -52
- package/dist/wje-badge.js.map +1 -1
- package/dist/wje-breadcrumb.js +205 -672
- package/dist/wje-breadcrumb.js.map +1 -1
- package/dist/wje-breadcrumbs.js +177 -633
- package/dist/wje-breadcrumbs.js.map +1 -1
- package/dist/wje-button-group.js +48 -153
- package/dist/wje-button-group.js.map +1 -1
- package/dist/wje-button.js +92 -413
- package/dist/wje-button.js.map +1 -1
- package/dist/wje-card-content.js +7 -30
- package/dist/wje-card-content.js.map +1 -1
- package/dist/wje-card-controls.js +7 -30
- package/dist/wje-card-controls.js.map +1 -1
- package/dist/wje-card-header.js +7 -30
- package/dist/wje-card-header.js.map +1 -1
- package/dist/wje-card-subtitle.js +7 -34
- package/dist/wje-card-subtitle.js.map +1 -1
- package/dist/wje-card-title.js +7 -34
- package/dist/wje-card-title.js.map +1 -1
- package/dist/wje-card.js +15 -71
- package/dist/wje-card.js.map +1 -1
- package/dist/wje-carousel-item.js +12 -56
- package/dist/wje-carousel-item.js.map +1 -1
- package/dist/wje-carousel.js +154 -509
- package/dist/wje-carousel.js.map +1 -1
- package/dist/wje-checkbox.js +50 -227
- package/dist/wje-checkbox.js.map +1 -1
- package/dist/wje-chip.js +43 -160
- package/dist/wje-chip.js.map +1 -1
- package/dist/wje-col.js +7 -20
- package/dist/wje-col.js.map +1 -1
- package/dist/wje-color-picker.js +445 -1464
- package/dist/wje-color-picker.js.map +1 -1
- package/dist/wje-container.js +9 -35
- package/dist/wje-container.js.map +1 -1
- package/dist/wje-copy-button.js +64 -204
- package/dist/wje-copy-button.js.map +1 -1
- package/dist/wje-dialog.js +85 -553
- package/dist/wje-dialog.js.map +1 -1
- package/dist/wje-divider.js +7 -34
- package/dist/wje-divider.js.map +1 -1
- package/dist/wje-dropdown.js +78 -305
- package/dist/wje-dropdown.js.map +1 -1
- package/dist/wje-element.js +191 -700
- package/dist/wje-element.js.map +1 -1
- package/dist/wje-file-upload-item.js +51 -156
- package/dist/wje-file-upload-item.js.map +1 -1
- package/dist/wje-file-upload.js +181 -619
- package/dist/wje-file-upload.js.map +1 -1
- package/dist/wje-footer.js +7 -31
- package/dist/wje-footer.js.map +1 -1
- package/dist/wje-form.js +7 -32
- package/dist/wje-form.js.map +1 -1
- package/dist/wje-format-digital.js +26 -118
- package/dist/wje-format-digital.js.map +1 -1
- package/dist/wje-grid.js +7 -33
- package/dist/wje-grid.js.map +1 -1
- package/dist/wje-header.js +9 -35
- package/dist/wje-header.js.map +1 -1
- package/dist/wje-icon-library.js +12 -18
- package/dist/wje-icon-library.js.map +1 -1
- package/dist/wje-icon-picker.js +65 -320
- package/dist/wje-icon-picker.js.map +1 -1
- package/dist/wje-icon.js +1 -1
- package/dist/wje-img-comparer.js +37 -114
- package/dist/wje-img-comparer.js.map +1 -1
- package/dist/wje-img.js +50 -198
- package/dist/wje-img.js.map +1 -1
- package/dist/wje-infinite-scroll.js +94 -346
- package/dist/wje-infinite-scroll.js.map +1 -1
- package/dist/wje-input-file.js +23 -84
- package/dist/wje-input-file.js.map +1 -1
- package/dist/wje-input.js +78 -392
- package/dist/wje-input.js.map +1 -1
- package/dist/wje-item.js +11 -64
- package/dist/wje-item.js.map +1 -1
- package/dist/wje-kanban.js +124 -401
- package/dist/wje-kanban.js.map +1 -1
- package/dist/wje-label.js +9 -32
- package/dist/wje-label.js.map +1 -1
- package/dist/wje-level-indicator.js +38 -157
- package/dist/wje-level-indicator.js.map +1 -1
- package/dist/wje-list.js +10 -40
- package/dist/wje-list.js.map +1 -1
- package/dist/wje-main.js +7 -31
- package/dist/wje-main.js.map +1 -1
- package/dist/wje-masonry.js +66 -211
- package/dist/wje-masonry.js.map +1 -1
- package/dist/wje-master.js +45 -161
- package/dist/wje-master.js.map +1 -1
- package/dist/wje-menu-button.js +10 -38
- package/dist/wje-menu-button.js.map +1 -1
- package/dist/wje-menu-item.js +127 -577
- package/dist/wje-menu-item.js.map +1 -1
- package/dist/wje-menu-label.js +9 -35
- package/dist/wje-menu-label.js.map +1 -1
- package/dist/wje-menu.js +14 -49
- package/dist/wje-menu.js.map +1 -1
- package/dist/wje-option.js +48 -279
- package/dist/wje-option.js.map +1 -1
- package/dist/wje-options.js +130 -384
- package/dist/wje-options.js.map +1 -1
- package/dist/wje-orgchart-group.js +16 -52
- package/dist/wje-orgchart-group.js.map +1 -1
- package/dist/wje-orgchart-item.js +24 -93
- package/dist/wje-orgchart-item.js.map +1 -1
- package/dist/wje-orgchart.js +18 -68
- package/dist/wje-orgchart.js.map +1 -1
- package/dist/wje-pagination.js +113 -397
- package/dist/wje-pagination.js.map +1 -1
- package/dist/wje-popup.js +3 -3
- package/dist/wje-popup.js.map +1 -1
- package/dist/wje-progress-bar.js +53 -205
- package/dist/wje-progress-bar.js.map +1 -1
- package/dist/wje-qr-code.js +398 -2980
- package/dist/wje-qr-code.js.map +1 -1
- package/dist/wje-radio-group.js +52 -190
- package/dist/wje-radio-group.js.map +1 -1
- package/dist/wje-radio.js +24 -118
- package/dist/wje-radio.js.map +1 -1
- package/dist/wje-rate.js +62 -266
- package/dist/wje-rate.js.map +1 -1
- package/dist/wje-relative-time.js +24 -99
- package/dist/wje-relative-time.js.map +1 -1
- package/dist/wje-reorder-dropzone.js +9 -31
- package/dist/wje-reorder-dropzone.js.map +1 -1
- package/dist/wje-reorder-handle.js +67 -204
- package/dist/wje-reorder-handle.js.map +1 -1
- package/dist/wje-reorder-item.js +14 -44
- package/dist/wje-reorder-item.js.map +1 -1
- package/dist/wje-reorder.js +61 -246
- package/dist/wje-reorder.js.map +1 -1
- package/dist/wje-route.js +6 -24
- package/dist/wje-route.js.map +1 -1
- package/dist/wje-router-link.js +11 -39
- package/dist/wje-router-link.js.map +1 -1
- package/dist/wje-router-outlet.js +76 -172
- package/dist/wje-router-outlet.js.map +1 -1
- package/dist/wje-routerx.js +537 -1331
- package/dist/wje-routerx.js.map +1 -1
- package/dist/wje-row.js +9 -31
- package/dist/wje-row.js.map +1 -1
- package/dist/wje-select.js +326 -1152
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-slider.js +44 -225
- package/dist/wje-slider.js.map +1 -1
- package/dist/wje-sliding-container.js +295 -1319
- package/dist/wje-sliding-container.js.map +1 -1
- package/dist/wje-split-view.js +35 -121
- package/dist/wje-split-view.js.map +1 -1
- package/dist/wje-status.js +14 -45
- package/dist/wje-status.js.map +1 -1
- package/dist/wje-step.js +9 -32
- package/dist/wje-step.js.map +1 -1
- package/dist/wje-stepper.js +109 -357
- package/dist/wje-stepper.js.map +1 -1
- package/dist/wje-store.js +67 -360
- package/dist/wje-store.js.map +1 -1
- package/dist/wje-tab-group.js +85 -314
- package/dist/wje-tab-group.js.map +1 -1
- package/dist/wje-tab-panel.js +7 -28
- package/dist/wje-tab-panel.js.map +1 -1
- package/dist/wje-tab.js +21 -198
- package/dist/wje-tab.js.map +1 -1
- package/dist/wje-textarea.js +64 -264
- package/dist/wje-textarea.js.map +1 -1
- package/dist/wje-thumbnail.js +10 -51
- package/dist/wje-thumbnail.js.map +1 -1
- package/dist/wje-toast.js +127 -632
- package/dist/wje-toast.js.map +1 -1
- package/dist/wje-toggle.js +52 -177
- package/dist/wje-toggle.js.map +1 -1
- package/dist/wje-toolbar-action.js +128 -456
- package/dist/wje-toolbar-action.js.map +1 -1
- package/dist/wje-toolbar.js +75 -270
- package/dist/wje-toolbar.js.map +1 -1
- package/dist/wje-tooltip.js +50 -161
- package/dist/wje-tooltip.js.map +1 -1
- package/dist/wje-tree-item.js +70 -301
- package/dist/wje-tree-item.js.map +1 -1
- package/dist/wje-tree.js +145 -489
- package/dist/wje-tree.js.map +1 -1
- package/dist/wje-visually-hidden.js +7 -34
- package/dist/wje-visually-hidden.js.map +1 -1
- package/package.json +3 -2
- package/dist/form-associated-element-DEQ4y-jn.js +0 -245
- package/dist/icon-CReYMzAK.js +0 -245
- package/dist/popup.element-CwXvVFK7.js +0 -2133
- package/dist/router-links-wjqCnncc.js +0 -156
package/dist/wje-menu-item.js
CHANGED
|
@@ -7,666 +7,216 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7
7
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
8
8
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
9
9
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
10
|
-
var
|
|
11
|
-
import { b as
|
|
12
|
-
import
|
|
13
|
-
import { WjElementUtils } from "./element-utils.js";
|
|
14
|
-
import { event } from "./event.js";
|
|
15
|
-
|
|
16
|
-
[ WJ Menu Item ]
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
:host {
|
|
20
|
-
--wje-menu-item-safe-triangle-cursor-x: 0;
|
|
21
|
-
--wje-menu-item-safe-triangle-cursor-y: 0;
|
|
22
|
-
--wje-menu-item-safe-triangle-submenu-start-x: 0;
|
|
23
|
-
--wje-menu-item-safe-triangle-submenu-start-y: 0;
|
|
24
|
-
--wje-menu-item-safe-triangle-submenu-end-x: 0;
|
|
25
|
-
--wje-menu-item-safe-triangle-submenu-end-y: 0;
|
|
26
|
-
|
|
27
|
-
display: block;
|
|
28
|
-
.native-menu-item {
|
|
29
|
-
font-size: var(--wje-menu-item-font-size);
|
|
30
|
-
background: var(--wje-menu-item-background);
|
|
31
|
-
position: relative;
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-wrap: nowrap;
|
|
34
|
-
align-items: center;
|
|
35
|
-
justify-content: var(--wje-menu-item-justify-content, center);
|
|
36
|
-
color: var(--wje-menu-item-color);
|
|
37
|
-
padding-top: var(--wje-menu-item-padding-top);
|
|
38
|
-
padding-bottom: var(--wje-menu-item-padding-bottom);
|
|
39
|
-
transition: var(--wje-transition-fast) fill;
|
|
40
|
-
user-select: none;
|
|
41
|
-
white-space: nowrap;
|
|
42
|
-
cursor: pointer;
|
|
43
|
-
width: 100%;
|
|
44
|
-
|
|
45
|
-
&:hover {
|
|
46
|
-
color: var(--wje-menu-item-color-hover);
|
|
47
|
-
background: var(--wje-menu-item-background-hover);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&:focus {
|
|
51
|
-
color: var(--wje-menu-item-color-focus);
|
|
52
|
-
background: var(--wje-menu-item-background-focus);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&:active {
|
|
56
|
-
color: var(--wje-menu-item-color-active);
|
|
57
|
-
background: var(--wje-menu-item-background-active);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.label {
|
|
61
|
-
flex: 1 1 auto;
|
|
62
|
-
display: inline-block;
|
|
63
|
-
text-overflow: ellipsis;
|
|
64
|
-
overflow: hidden;
|
|
65
|
-
line-height: normal;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.check-icon {
|
|
69
|
-
flex: 0 0 auto;
|
|
70
|
-
display: var(--wje-menu-item-check-icon-display, flex);
|
|
71
|
-
align-items: center;
|
|
72
|
-
justify-content: center;
|
|
73
|
-
width: var(--wje-menu-item-check-icon-width, 1.5rem);
|
|
74
|
-
visibility: hidden;
|
|
75
|
-
|
|
76
|
-
&.checked {
|
|
77
|
-
visibility: visible;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
&.expanded-submenu {
|
|
82
|
-
color: var(--wje-menu-item-color-active);
|
|
83
|
-
background: var(--wje-menu-item-background-active);
|
|
84
|
-
|
|
85
|
-
&:hover {
|
|
86
|
-
color: var(--wje-menu-item-color-hover);
|
|
87
|
-
background: var(--wje-menu-item-background-hover);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
&::after {
|
|
91
|
-
content: '';
|
|
92
|
-
position: fixed;
|
|
93
|
-
z-index: 1;
|
|
94
|
-
top: 0;
|
|
95
|
-
right: 0;
|
|
96
|
-
bottom: 0;
|
|
97
|
-
left: 0;
|
|
98
|
-
clip-path: polygon(
|
|
99
|
-
var(--wje-menu-item-safe-triangle-cursor-x) var(--wje-menu-item-safe-triangle-cursor-y),
|
|
100
|
-
var(--wje-menu-item-safe-triangle-submenu-start-x)
|
|
101
|
-
var(--wje-menu-item-safe-triangle-submenu-start-y),
|
|
102
|
-
var(--wje-menu-item-safe-triangle-submenu-end-x) var(--wje-menu-item-safe-triangle-submenu-end-y)
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
:host(.collapse) {
|
|
110
|
-
::slotted([slot='start']) {
|
|
111
|
-
margin: 0;
|
|
112
|
-
/*width: auto;*/
|
|
113
|
-
/*display: contents;*/
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
::slotted([slot='end']) {
|
|
117
|
-
display: none;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.label,
|
|
121
|
-
.check-icon,
|
|
122
|
-
.submenu-icon {
|
|
123
|
-
display: none;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
.submenu-icon {
|
|
127
|
-
--wje-icon-size: 14px !important;
|
|
128
|
-
flex: 0 0 auto;
|
|
129
|
-
display: flex;
|
|
130
|
-
align-items: center;
|
|
131
|
-
justify-content: center;
|
|
132
|
-
width: 1.5rem;
|
|
133
|
-
visibility: var(--wje-menu-item-icon-visibility);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.has-submenu {
|
|
137
|
-
.submenu-icon {
|
|
138
|
-
--wje-menu-item-icon-visibility: visible;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.submenu-icon.collapse {
|
|
143
|
-
flex: none;
|
|
144
|
-
/*right: 10px;*/
|
|
145
|
-
position: relative;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
:host(:focus-visible) {
|
|
149
|
-
outline: none;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
::slotted([slot='start']) {
|
|
153
|
-
flex: 0 0 auto;
|
|
154
|
-
display: flex;
|
|
155
|
-
align-items: center;
|
|
156
|
-
margin-inline-end: 0.5rem;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
::slotted([slot='end']) {
|
|
160
|
-
flex: 0 0 auto;
|
|
161
|
-
display: flex;
|
|
162
|
-
align-items: center;
|
|
163
|
-
margin-inline-start: 0.5rem;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
:host(.wje-menu-variant-nav) {
|
|
167
|
-
/*posun 2 a x urovne o 1 rem*/
|
|
168
|
-
::slotted([slot='submenu']) {
|
|
169
|
-
--wje-menu-border-width: 0 !important;
|
|
170
|
-
--wje-menu-margin-inline: 2rem 0 !important;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/*:host {*/
|
|
175
|
-
/* ::slotted([slot="start"]) {*/
|
|
176
|
-
/* width: 1.5rem;*/
|
|
177
|
-
/* }*/
|
|
178
|
-
/*}*/
|
|
179
|
-
|
|
180
|
-
:host(.wje-menu-variant-context) {
|
|
181
|
-
display: block;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
:host(.active) {
|
|
185
|
-
color: var(--wje-menu-item-color-active);
|
|
186
|
-
background: var(--wje-menu-item-background-active);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
:host(.open) {
|
|
190
|
-
color: var(--wje-menu-item-color-active);
|
|
191
|
-
background: var(--wje-menu-item-background-active);
|
|
192
|
-
}
|
|
193
|
-
`;
|
|
194
|
-
class MenuItem extends WJElement {
|
|
195
|
-
/**
|
|
196
|
-
* Constructor for MenuItem class.
|
|
197
|
-
* @class
|
|
198
|
-
*/
|
|
10
|
+
var _n_instances, e_fn;
|
|
11
|
+
import { b as e } from "./router-links-CNsJ-elb.js";
|
|
12
|
+
import t from "./wje-element.js";
|
|
13
|
+
import { WjElementUtils as s } from "./element-utils.js";
|
|
14
|
+
import { event as i } from "./event.js";
|
|
15
|
+
class n extends t {
|
|
199
16
|
constructor() {
|
|
200
17
|
super();
|
|
201
|
-
__privateAdd(this,
|
|
18
|
+
__privateAdd(this, _n_instances);
|
|
202
19
|
__publicField(this, "className", "MenuItem");
|
|
203
|
-
__publicField(this, "mouseenterHandler", (
|
|
204
|
-
if (this.collapse || this.variant
|
|
205
|
-
if (this.hasAttribute("manual") || this.variant
|
|
206
|
-
this.activateSubmenu(
|
|
207
|
-
e.stopPropagation();
|
|
208
|
-
this.showSubmenu();
|
|
20
|
+
__publicField(this, "mouseenterHandler", (e2) => {
|
|
21
|
+
if (this.collapse || "CONTEXT" === this.variant && this.hasSubmenu) {
|
|
22
|
+
if (this.hasAttribute("manual") || "NAV" === this.variant && this.collapse) return;
|
|
23
|
+
this.activateSubmenu(e2), e2.stopPropagation(), this.showSubmenu();
|
|
209
24
|
}
|
|
210
25
|
});
|
|
211
|
-
__publicField(this, "rebindRouterLinks", (
|
|
212
|
-
this.unbindPortalRouterLinks =
|
|
26
|
+
__publicField(this, "rebindRouterLinks", (t2) => {
|
|
27
|
+
this.unbindPortalRouterLinks = e(t2.detail.container, { selector: "[route]" });
|
|
213
28
|
});
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
* @param {object} e
|
|
217
|
-
*/
|
|
218
|
-
__publicField(this, "clickHandler", (e) => {
|
|
219
|
-
if (this.hasAttribute("disabled")) return;
|
|
220
|
-
switch (this.variant) {
|
|
29
|
+
__publicField(this, "clickHandler", (e2) => {
|
|
30
|
+
if (!this.hasAttribute("disabled")) switch (this.variant) {
|
|
221
31
|
case "NAV":
|
|
222
|
-
|
|
223
|
-
this.submenuToggle(e);
|
|
224
|
-
this.hideSubmenu();
|
|
225
|
-
e.stopPropagation();
|
|
226
|
-
} else {
|
|
227
|
-
event.dispatchCustomEvent(this, "wje-menu-item:click");
|
|
228
|
-
event.dispatchCustomEvent(this, this.dialog);
|
|
229
|
-
}
|
|
32
|
+
!this.collapse && this.hasSubmenu ? (this.submenuToggle(e2), this.hideSubmenu(), e2.stopPropagation()) : (i.dispatchCustomEvent(this, "wje-menu-item:click"), i.dispatchCustomEvent(this, this.dialog));
|
|
230
33
|
break;
|
|
231
34
|
case "CONTEXT":
|
|
232
35
|
if (!this.collapse && this.hasSubmenu) {
|
|
233
|
-
let
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
} else {
|
|
237
|
-
this.activateSubmenu(e);
|
|
238
|
-
this.showSubmenu(e);
|
|
239
|
-
}
|
|
240
|
-
} else {
|
|
241
|
-
event.dispatchCustomEvent(this, "wje-menu-item:click");
|
|
242
|
-
event.dispatchCustomEvent(this, this.dialog);
|
|
243
|
-
}
|
|
244
|
-
break;
|
|
36
|
+
let t2 = this.submenu.assignedElements({ flatten: true })[0];
|
|
37
|
+
(t2 == null ? void 0 : t2.hasAttribute("active")) ? this.shouldHideSubmenu(e2) : (this.activateSubmenu(e2), this.showSubmenu(e2));
|
|
38
|
+
} else i.dispatchCustomEvent(this, "wje-menu-item:click"), i.dispatchCustomEvent(this, this.dialog);
|
|
245
39
|
}
|
|
246
40
|
});
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
__publicField(this, "shouldHideSubmenu", (e) => {
|
|
252
|
-
if (this.collapse || this.variant === "CONTEXT" && this.hasSubmenu) {
|
|
253
|
-
if (e.relatedTarget && this.contains(e.relatedTarget) || this.variant === "NAV" && !this.collapse) {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
this.deactivateSubmenu();
|
|
257
|
-
this.hideSubmenu();
|
|
41
|
+
__publicField(this, "shouldHideSubmenu", (e2) => {
|
|
42
|
+
if (this.collapse || "CONTEXT" === this.variant && this.hasSubmenu) {
|
|
43
|
+
if (e2.relatedTarget && this.contains(e2.relatedTarget) || "NAV" === this.variant && !this.collapse) return;
|
|
44
|
+
this.deactivateSubmenu(), this.hideSubmenu();
|
|
258
45
|
}
|
|
259
46
|
});
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
*/
|
|
263
|
-
__publicField(this, "dispatchMove", (e) => {
|
|
264
|
-
this.style.setProperty("--wje-menu-item-safe-triangle-cursor-x", `${e.clientX}px`);
|
|
265
|
-
this.style.setProperty("--wje-menu-item-safe-triangle-cursor-y", `${e.clientY}px`);
|
|
47
|
+
__publicField(this, "dispatchMove", (e2) => {
|
|
48
|
+
this.style.setProperty("--wje-menu-item-safe-triangle-cursor-x", `${e2.clientX}px`), this.style.setProperty("--wje-menu-item-safe-triangle-cursor-y", `${e2.clientY}px`);
|
|
266
49
|
});
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
let submenu = this.submenu.assignedNodes()[0];
|
|
273
|
-
const { left, top, width, height } = submenu.getBoundingClientRect();
|
|
274
|
-
this.style.setProperty("--wje-menu-item-safe-triangle-submenu-start-x", `${left}px`);
|
|
275
|
-
this.style.setProperty("--wje-menu-item-safe-triangle-submenu-start-y", `${top}px`);
|
|
276
|
-
this.style.setProperty("--wje-menu-item-safe-triangle-submenu-end-x", `${left}px`);
|
|
277
|
-
this.style.setProperty("--wje-menu-item-safe-triangle-submenu-end-y", `${top + height}px`);
|
|
50
|
+
__publicField(this, "dispatchReposition", (e2) => {
|
|
51
|
+
if (0 === this.submenu.assignedNodes().length) return;
|
|
52
|
+
let t2 = this.submenu.assignedNodes()[0];
|
|
53
|
+
const { left: s2, top: i2, width: n2, height: a } = t2.getBoundingClientRect();
|
|
54
|
+
this.style.setProperty("--wje-menu-item-safe-triangle-submenu-start-x", `${s2}px`), this.style.setProperty("--wje-menu-item-safe-triangle-submenu-start-y", `${i2}px`), this.style.setProperty("--wje-menu-item-safe-triangle-submenu-end-x", `${s2}px`), this.style.setProperty("--wje-menu-item-safe-triangle-submenu-end-y", `${i2 + a}px`);
|
|
278
55
|
});
|
|
279
|
-
__publicField(this, "handleActiveClick", (
|
|
56
|
+
__publicField(this, "handleActiveClick", (e2) => {
|
|
280
57
|
var _a, _b, _c, _d;
|
|
281
|
-
const
|
|
282
|
-
if (!
|
|
283
|
-
let
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
rootMenu = parent;
|
|
289
|
-
currentMenu = parent;
|
|
58
|
+
const t2 = e2.target.closest("wje-menu-item");
|
|
59
|
+
if (!t2) return;
|
|
60
|
+
let s2 = t2.closest("wje-menu"), i2 = s2;
|
|
61
|
+
for (; i2 == null ? void 0 : i2.parentElement; ) {
|
|
62
|
+
const e3 = (_b = (_a = i2.parentElement).closest) == null ? void 0 : _b.call(_a, "wje-menu");
|
|
63
|
+
if (!e3) break;
|
|
64
|
+
s2 = e3, i2 = e3;
|
|
290
65
|
}
|
|
291
|
-
if (!
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
top = parent;
|
|
66
|
+
if (!s2) {
|
|
67
|
+
let t3 = ("function" == typeof e2.composedPath ? e2.composedPath() : []).find((e3) => e3 && "WJE-MENU" === e3.tagName);
|
|
68
|
+
if (t3) {
|
|
69
|
+
let e3 = t3;
|
|
70
|
+
for (; e3 && e3.parentElement; ) {
|
|
71
|
+
const t4 = (_d = (_c = e3.parentElement).closest) == null ? void 0 : _d.call(_c, "wje-menu");
|
|
72
|
+
if (!t4) break;
|
|
73
|
+
e3 = t4;
|
|
300
74
|
}
|
|
301
|
-
|
|
75
|
+
s2 = e3;
|
|
302
76
|
}
|
|
303
77
|
}
|
|
304
|
-
if (!
|
|
305
|
-
|
|
306
|
-
const
|
|
307
|
-
|
|
78
|
+
if (!s2) return;
|
|
79
|
+
s2.querySelectorAll("wje-menu-item").forEach((e3) => {
|
|
80
|
+
const t3 = e3.getAttribute("active-class");
|
|
81
|
+
t3 && e3.classList.remove(t3);
|
|
308
82
|
});
|
|
309
|
-
let
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
if (!
|
|
315
|
-
const
|
|
316
|
-
if (!
|
|
317
|
-
|
|
83
|
+
let n2 = t2;
|
|
84
|
+
for (; n2 && "WJE-MENU-ITEM" === n2.tagName; ) {
|
|
85
|
+
const e3 = n2.getAttribute("active-class");
|
|
86
|
+
e3 && n2.classList.add(e3);
|
|
87
|
+
const t3 = n2.closest("wje-menu");
|
|
88
|
+
if (!t3) break;
|
|
89
|
+
const s3 = t3.closest("wje-menu-item");
|
|
90
|
+
if (!s3) break;
|
|
91
|
+
n2 = s3;
|
|
318
92
|
}
|
|
319
93
|
});
|
|
320
94
|
this._bind = false;
|
|
321
95
|
}
|
|
322
|
-
/**
|
|
323
|
-
* Getter for placement attribute.
|
|
324
|
-
* @returns {string} The placement attribute of the menu or "right-start" if it doesn't exist.
|
|
325
|
-
*/
|
|
326
96
|
get placement() {
|
|
327
|
-
let
|
|
328
|
-
|
|
329
|
-
return menu.getAttribute("placement");
|
|
330
|
-
}
|
|
331
|
-
return "right-start";
|
|
97
|
+
let e2 = this.querySelector("wje-menu");
|
|
98
|
+
return (e2 == null ? void 0 : e2.hasAttribute("placement")) ? e2.getAttribute("placement") : "right-start";
|
|
332
99
|
}
|
|
333
|
-
/**
|
|
334
|
-
* Getter for offset attribute.
|
|
335
|
-
* @returns {string} The offset attribute of the menu or "0" if it doesn't exist.
|
|
336
|
-
*/
|
|
337
100
|
get offset() {
|
|
338
|
-
let
|
|
339
|
-
|
|
340
|
-
return menu.getAttribute("offset");
|
|
341
|
-
}
|
|
342
|
-
return "0";
|
|
101
|
+
let e2 = this.querySelector("wje-menu");
|
|
102
|
+
return (e2 == null ? void 0 : e2.hasAttribute("offset")) ? e2.getAttribute("offset") : "0";
|
|
343
103
|
}
|
|
344
|
-
/**
|
|
345
|
-
* Getter for variant attribute.
|
|
346
|
-
* @returns {string} The variant attribute of the menu or "CONTEXT" if it doesn't exist.
|
|
347
|
-
*/
|
|
348
104
|
get variant() {
|
|
349
|
-
let
|
|
350
|
-
|
|
351
|
-
return menu.getAttribute("variant").toUpperCase();
|
|
352
|
-
}
|
|
353
|
-
return "CONTEXT";
|
|
105
|
+
let e2 = this.querySelector("wje-menu");
|
|
106
|
+
return (e2 == null ? void 0 : e2.hasAttribute("variant")) && !this.collapse ? e2.getAttribute("variant").toUpperCase() : "CONTEXT";
|
|
354
107
|
}
|
|
355
|
-
/**
|
|
356
|
-
* Getter for collapse attribute.
|
|
357
|
-
* @returns {boolean} True if the closest parent has the collapse attribute, false otherwise.
|
|
358
|
-
*/
|
|
359
108
|
get collapse() {
|
|
360
|
-
|
|
361
|
-
return false;
|
|
109
|
+
return !!this.closest("[collapse]");
|
|
362
110
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
* @param {string} value The value to be assigned to the custom event attribute.
|
|
366
|
-
*/
|
|
367
|
-
set customEvent(value) {
|
|
368
|
-
this.setAttribute("custom-event", value);
|
|
111
|
+
set customEvent(e2) {
|
|
112
|
+
this.setAttribute("custom-event", e2);
|
|
369
113
|
}
|
|
370
|
-
/**
|
|
371
|
-
* Retrieves the value of the 'custom-event' attribute from the element.
|
|
372
|
-
* @returns {string | null} The value of the 'custom-event' attribute, or null if the attribute is not set.
|
|
373
|
-
*/
|
|
374
114
|
get customEvent() {
|
|
375
115
|
return this.getAttribute("custom-event");
|
|
376
116
|
}
|
|
377
|
-
/**
|
|
378
|
-
* Retrieves a mapped object containing custom event parameters extracted from the element's attributes.
|
|
379
|
-
* Attributes considered are those that begin with 'custom-event-'.
|
|
380
|
-
* The mapped object's keys are derived by removing the 'custom-event-' prefix from the attribute names,
|
|
381
|
-
* and the values are the corresponding attribute values.
|
|
382
|
-
* @returns {object} An object containing key-value pairs of custom event parameters.
|
|
383
|
-
*/
|
|
384
117
|
get customEventParameters() {
|
|
385
|
-
|
|
386
|
-
return attributes.reduce((acc, attr) => {
|
|
387
|
-
const key = attr.name.replace("custom-event-", "");
|
|
388
|
-
acc[key] = attr.value;
|
|
389
|
-
return acc;
|
|
390
|
-
}, {});
|
|
118
|
+
return Array.from(this.attributes).filter((e2) => e2.name.startsWith("custom-event-")).reduce((e2, t2) => (e2[t2.name.replace("custom-event-", "")] = t2.value, e2), {});
|
|
391
119
|
}
|
|
392
|
-
/**
|
|
393
|
-
* Getter for cssStyleSheet.
|
|
394
|
-
* @returns {string} The styles imported from styles.css.
|
|
395
|
-
*/
|
|
396
120
|
static get cssStyleSheet() {
|
|
397
|
-
return
|
|
121
|
+
return ':host{--wje-menu-item-safe-triangle-cursor-x: 0;--wje-menu-item-safe-triangle-cursor-y: 0;--wje-menu-item-safe-triangle-submenu-start-x: 0;--wje-menu-item-safe-triangle-submenu-start-y: 0;--wje-menu-item-safe-triangle-submenu-end-x: 0;--wje-menu-item-safe-triangle-submenu-end-y: 0;display:block}:host .native-menu-item{font-size:var(--wje-menu-item-font-size);background:var(--wje-menu-item-background);position:relative;display:flex;flex-wrap:nowrap;align-items:center;justify-content:var(--wje-menu-item-justify-content, center);color:var(--wje-menu-item-color);padding-top:var(--wje-menu-item-padding-top);padding-bottom:var(--wje-menu-item-padding-bottom);transition:var(--wje-transition-fast) fill;-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer;width:100%}:host .native-menu-item:hover{color:var(--wje-menu-item-color-hover);background:var(--wje-menu-item-background-hover)}:host .native-menu-item:focus{color:var(--wje-menu-item-color-focus);background:var(--wje-menu-item-background-focus)}:host .native-menu-item:active{color:var(--wje-menu-item-color-active);background:var(--wje-menu-item-background-active)}:host .native-menu-item .label{flex:1 1 auto;display:inline-block;text-overflow:ellipsis;overflow:hidden;line-height:normal}:host .native-menu-item .check-icon{flex:0 0 auto;display:var(--wje-menu-item-check-icon-display, flex);align-items:center;justify-content:center;width:var(--wje-menu-item-check-icon-width, 1.5rem);visibility:hidden}:host .native-menu-item .check-icon.checked{visibility:visible}:host .native-menu-item.expanded-submenu{color:var(--wje-menu-item-color-active);background:var(--wje-menu-item-background-active)}:host .native-menu-item.expanded-submenu:hover{color:var(--wje-menu-item-color-hover);background:var(--wje-menu-item-background-hover)}:host .native-menu-item.expanded-submenu:after{content:"";position:fixed;z-index:1;top:0;right:0;bottom:0;left:0;clip-path:polygon(var(--wje-menu-item-safe-triangle-cursor-x) var(--wje-menu-item-safe-triangle-cursor-y),var(--wje-menu-item-safe-triangle-submenu-start-x) var(--wje-menu-item-safe-triangle-submenu-start-y),var(--wje-menu-item-safe-triangle-submenu-end-x) var(--wje-menu-item-safe-triangle-submenu-end-y))}:host(.collapse) ::slotted([slot="start"]){margin:0}:host(.collapse) ::slotted([slot="end"]){display:none}:host(.collapse) .label,:host(.collapse) .check-icon,:host(.collapse) .submenu-icon{display:none}.submenu-icon{--wje-icon-size: 14px !important;flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:1.5rem;visibility:var(--wje-menu-item-icon-visibility)}.has-submenu .submenu-icon{--wje-menu-item-icon-visibility: visible}.submenu-icon.collapse{flex:none;position:relative}:host(:focus-visible){outline:none}::slotted([slot="start"]){flex:0 0 auto;display:flex;align-items:center;margin-inline-end:.5rem}::slotted([slot="end"]){flex:0 0 auto;display:flex;align-items:center;margin-inline-start:.5rem}:host(.wje-menu-variant-nav) ::slotted([slot="submenu"]){--wje-menu-border-width: 0 !important;--wje-menu-margin-inline: 2rem 0 !important}:host(.wje-menu-variant-context){display:block}:host(.active){color:var(--wje-menu-item-color-active);background:var(--wje-menu-item-background-active)}:host(.open){color:var(--wje-menu-item-color-active);background:var(--wje-menu-item-background-active)}';
|
|
398
122
|
}
|
|
399
|
-
/**
|
|
400
|
-
* Getter for observedAttributes.
|
|
401
|
-
* @returns {Array} An empty array as no attributes are being observed.
|
|
402
|
-
*/
|
|
403
123
|
static get observedAttributes() {
|
|
404
124
|
return [];
|
|
405
125
|
}
|
|
406
|
-
/**
|
|
407
|
-
* Sets up the attributes for the MenuItem element.
|
|
408
|
-
*/
|
|
409
126
|
setupAttributes() {
|
|
410
|
-
super.setupAttributes();
|
|
411
|
-
this.isShadowRoot = "open";
|
|
412
|
-
this.syncAria();
|
|
127
|
+
super.setupAttributes(), this.isShadowRoot = "open", this.syncAria();
|
|
413
128
|
}
|
|
414
|
-
/**
|
|
415
|
-
* Removes the active attribute from the menu before drawing the MenuItem.
|
|
416
|
-
*/
|
|
417
129
|
beforeDraw() {
|
|
418
130
|
var _a;
|
|
419
131
|
(_a = this.querySelector("wje-menu")) == null ? void 0 : _a.removeAttribute("active");
|
|
420
132
|
}
|
|
421
|
-
/**
|
|
422
|
-
* Draws the MenuItem element and sets the variant and collapse attributes.
|
|
423
|
-
* @returns {DocumentFragment} The fragment to be appended to the MenuItem.
|
|
424
|
-
*/
|
|
425
133
|
draw() {
|
|
426
134
|
var _a, _b, _c;
|
|
427
|
-
this.hasSubmenu =
|
|
428
|
-
let
|
|
429
|
-
this.setAttribute("tabindex", "0")
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
this.classList.remove("
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
let
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
let
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
start.name = "start";
|
|
454
|
-
let slot = document.createElement("slot");
|
|
455
|
-
slot.classList.add("label");
|
|
456
|
-
let end = document.createElement("slot");
|
|
457
|
-
end.setAttribute("part", "end");
|
|
458
|
-
end.name = "end";
|
|
459
|
-
let submenu = document.createElement("slot");
|
|
460
|
-
submenu.setAttribute("part", "submenu");
|
|
461
|
-
submenu.name = "submenu";
|
|
462
|
-
let submenuIconClass = this.collapse ? "collapse" : "expand";
|
|
463
|
-
let submenuIcon = document.createElement("span");
|
|
464
|
-
submenuIcon.setAttribute("part", "submenu-icon");
|
|
465
|
-
submenuIcon.classList.add("submenu-icon", submenuIconClass);
|
|
466
|
-
submenuIcon.innerHTML = this.collapse ? `<wje-icon name="chevron-down"></wje-icon>` : `<wje-icon name="chevron-right"></wje-icon>`;
|
|
467
|
-
if (this.hasSubmenu) native.classList.add("has-submenu");
|
|
468
|
-
else native.classList.remove("has-submenu");
|
|
469
|
-
native.appendChild(checkedIcon);
|
|
470
|
-
native.appendChild(start);
|
|
471
|
-
native.appendChild(slot);
|
|
472
|
-
native.appendChild(end);
|
|
473
|
-
native.appendChild(submenuIcon);
|
|
474
|
-
let isAppend = false;
|
|
475
|
-
if (this.variant === "CONTEXT" && this.hasSubmenu) {
|
|
476
|
-
native.setAttribute("slot", "anchor");
|
|
477
|
-
let popup = document.createElement("wje-popup");
|
|
478
|
-
popup.setAttribute("anchor", "anchor");
|
|
479
|
-
popup.setAttribute("placement", this.placement);
|
|
480
|
-
popup.setAttribute("offset", this.offset);
|
|
481
|
-
popup.appendChild(native);
|
|
482
|
-
popup.appendChild(submenu);
|
|
483
|
-
this.popup = popup;
|
|
484
|
-
fragment.appendChild(popup);
|
|
485
|
-
isAppend = true;
|
|
486
|
-
}
|
|
487
|
-
if (((_c = this.parentElement) == null ? void 0 : _c.hasAttribute("collapse")) && !this.hasSubmenu) {
|
|
488
|
-
fragment.appendChild(this.collapseItem(native));
|
|
489
|
-
} else if (!isAppend) {
|
|
490
|
-
fragment.appendChild(native);
|
|
491
|
-
}
|
|
492
|
-
if (!this.collapse && this.variant === "NAV" || this.variant === "MEGAMENU" && this.hasSubmenu) {
|
|
493
|
-
fragment.appendChild(submenu);
|
|
494
|
-
}
|
|
495
|
-
this.native = native;
|
|
496
|
-
this.submenu = submenu;
|
|
497
|
-
this.syncAria();
|
|
498
|
-
return fragment;
|
|
135
|
+
this.hasSubmenu = s.hasSlot(this, "submenu");
|
|
136
|
+
let e2 = document.createDocumentFragment();
|
|
137
|
+
this.setAttribute("tabindex", "0"), this.classList.forEach((e3) => {
|
|
138
|
+
e3.startsWith("wje-menu-variant-") && this.classList.remove(e3);
|
|
139
|
+
}), this.classList.remove("collapse"), this.classList.add("wje-menu-variant-" + this.variant.toLowerCase()), this.collapse ? ((_a = this.parentElement) == null ? void 0 : _a.hasAttribute("collapse")) && this.classList.add("collapse") : (_b = this.querySelector("wje-menu")) == null ? void 0 : _b.setAttribute("variant", this.variant.toLowerCase());
|
|
140
|
+
let t2 = document.createElement("div");
|
|
141
|
+
t2.setAttribute("part", "native"), t2.setAttribute("id", "anchor"), t2.classList.add("native-menu-item");
|
|
142
|
+
let i2 = document.createElement("span");
|
|
143
|
+
i2.setAttribute("part", "check"), i2.classList.add("check-icon"), i2.innerHTML = '<wje-icon name="check"></wje-icon>', this.hasAttribute("checked") ? i2.classList.add("checked") : i2.classList.remove("checked");
|
|
144
|
+
let n2 = document.createElement("slot");
|
|
145
|
+
n2.name = "start";
|
|
146
|
+
let a = document.createElement("slot");
|
|
147
|
+
a.classList.add("label");
|
|
148
|
+
let r = document.createElement("slot");
|
|
149
|
+
r.setAttribute("part", "end"), r.name = "end";
|
|
150
|
+
let o = document.createElement("slot");
|
|
151
|
+
o.setAttribute("part", "submenu"), o.name = "submenu";
|
|
152
|
+
let u = this.collapse ? "collapse" : "expand", l = document.createElement("span");
|
|
153
|
+
l.setAttribute("part", "submenu-icon"), l.classList.add("submenu-icon", u), l.innerHTML = this.collapse ? '<wje-icon name="chevron-down"></wje-icon>' : '<wje-icon name="chevron-right"></wje-icon>', this.hasSubmenu ? t2.classList.add("has-submenu") : t2.classList.remove("has-submenu"), t2.appendChild(i2), t2.appendChild(n2), t2.appendChild(a), t2.appendChild(r), t2.appendChild(l);
|
|
154
|
+
let m = false;
|
|
155
|
+
if ("CONTEXT" === this.variant && this.hasSubmenu) {
|
|
156
|
+
t2.setAttribute("slot", "anchor");
|
|
157
|
+
let s2 = document.createElement("wje-popup");
|
|
158
|
+
s2.setAttribute("anchor", "anchor"), s2.setAttribute("placement", this.placement), s2.setAttribute("offset", this.offset), s2.appendChild(t2), s2.appendChild(o), this.popup = s2, e2.appendChild(s2), m = true;
|
|
159
|
+
}
|
|
160
|
+
return ((_c = this.parentElement) == null ? void 0 : _c.hasAttribute("collapse")) && !this.hasSubmenu ? e2.appendChild(this.collapseItem(t2)) : m || e2.appendChild(t2), (!this.collapse && "NAV" === this.variant || "MEGAMENU" === this.variant && this.hasSubmenu) && e2.appendChild(o), this.native = t2, this.submenu = o, this.syncAria(), e2;
|
|
499
161
|
}
|
|
500
|
-
/**
|
|
501
|
-
* Adds event listeners after drawing the MenuItem.
|
|
502
|
-
*/
|
|
503
162
|
afterDraw() {
|
|
504
|
-
|
|
505
|
-
this.unbindRouterLinks = bindRouterLinks(this.parentElement, { selector: "[route]" });
|
|
506
|
-
}
|
|
507
|
-
document.addEventListener("wje-router:rebind", this.rebindRouterLinks);
|
|
508
|
-
this.addEventListener("mousemove", this.dispatchMove);
|
|
509
|
-
this.addEventListener("wje-popup:reposition", this.dispatchReposition);
|
|
510
|
-
event.addListener(this, "mouseenter", null, this.mouseenterHandler);
|
|
511
|
-
event.addListener(this, "mouseleave", null, this.shouldHideSubmenu);
|
|
512
|
-
event.addListener(this, "focusout", null, this.shouldHideSubmenu);
|
|
513
|
-
event.addListener(this, "click", null, this.clickHandler);
|
|
514
|
-
if (this.hasAttribute("custom-event")) {
|
|
515
|
-
event.addListener(this, "click", null, __privateMethod(this, _MenuItem_instances, populateCustomEvent_fn));
|
|
516
|
-
}
|
|
517
|
-
if (this.hasAttribute("active-class")) {
|
|
518
|
-
this.addEventListener("click", this.handleActiveClick);
|
|
519
|
-
}
|
|
163
|
+
this.parentElement && (this.unbindRouterLinks = e(this.parentElement, { selector: "[route]" })), document.addEventListener("wje-router:rebind", this.rebindRouterLinks), this.addEventListener("mousemove", this.dispatchMove), this.addEventListener("wje-popup:reposition", this.dispatchReposition), i.addListener(this, "mouseenter", null, this.mouseenterHandler), i.addListener(this, "mouseleave", null, this.shouldHideSubmenu), i.addListener(this, "focusout", null, this.shouldHideSubmenu), i.addListener(this, "click", null, this.clickHandler), this.hasAttribute("custom-event") && i.addListener(this, "click", null, __privateMethod(this, _n_instances, e_fn)), this.hasAttribute("active-class") && this.addEventListener("click", this.handleActiveClick);
|
|
520
164
|
}
|
|
521
|
-
/**
|
|
522
|
-
* Syncs ARIA attributes based on menu item state.
|
|
523
|
-
*/
|
|
524
165
|
syncAria() {
|
|
525
166
|
var _a, _b;
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
const disabled = this.hasAttribute("disabled");
|
|
529
|
-
this.setAriaState({
|
|
530
|
-
role: "menuitem",
|
|
531
|
-
disabled,
|
|
532
|
-
haspopup: hasSubmenu ? "menu" : void 0,
|
|
533
|
-
expanded: hasSubmenu ? expanded : void 0
|
|
534
|
-
});
|
|
167
|
+
const e2 = !!this.hasSubmenu, t2 = this.classList.contains("expanded-submenu") || ((_b = (_a = this.native) == null ? void 0 : _a.classList) == null ? void 0 : _b.contains("expanded-submenu")), s2 = this.hasAttribute("disabled");
|
|
168
|
+
this.setAriaState({ role: "menuitem", disabled: s2, haspopup: e2 ? "menu" : void 0, expanded: e2 ? t2 : void 0 });
|
|
535
169
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
tooltipStart.setAttribute("slot", "start");
|
|
544
|
-
tooltipStart.setAttribute("name", "tooltip-start");
|
|
545
|
-
let tooltipEnd = document.createElement("slot");
|
|
546
|
-
tooltipEnd.setAttribute("slot", "end");
|
|
547
|
-
tooltipEnd.setAttribute("name", "tooltip-end");
|
|
548
|
-
let tooltip = document.createElement("wje-tooltip");
|
|
549
|
-
tooltip.setAttribute("content", this.getTextFromElement(this));
|
|
550
|
-
tooltip.setAttribute("placement", "right");
|
|
551
|
-
tooltip.setAttribute("offset", this.offset || "0");
|
|
552
|
-
tooltip.appendChild(tooltipStart);
|
|
553
|
-
tooltip.appendChild(tooltipEnd);
|
|
554
|
-
tooltip.appendChild(native);
|
|
555
|
-
return tooltip;
|
|
170
|
+
collapseItem(e2) {
|
|
171
|
+
let t2 = document.createElement("slot");
|
|
172
|
+
t2.setAttribute("slot", "start"), t2.setAttribute("name", "tooltip-start");
|
|
173
|
+
let s2 = document.createElement("slot");
|
|
174
|
+
s2.setAttribute("slot", "end"), s2.setAttribute("name", "tooltip-end");
|
|
175
|
+
let i2 = document.createElement("wje-tooltip");
|
|
176
|
+
return i2.setAttribute("content", this.getTextFromElement(this)), i2.setAttribute("placement", "right"), i2.setAttribute("offset", this.offset || "0"), i2.appendChild(t2), i2.appendChild(s2), i2.appendChild(e2), i2;
|
|
556
177
|
}
|
|
557
|
-
/**
|
|
558
|
-
* Shows the submenu of the MenuItem.
|
|
559
|
-
*/
|
|
560
178
|
showSubmenu() {
|
|
561
179
|
var _a;
|
|
562
|
-
this.tabIndex = -1;
|
|
563
|
-
if (this.hasSubmenu) {
|
|
564
|
-
(_a = this.popup) == null ? void 0 : _a.show();
|
|
565
|
-
this.classList.add("expanded-submenu");
|
|
566
|
-
this.native.classList.add("expanded-submenu");
|
|
567
|
-
this.syncAria();
|
|
568
|
-
}
|
|
180
|
+
this.tabIndex = -1, this.hasSubmenu && ((_a = this.popup) == null ? void 0 : _a.show(), this.classList.add("expanded-submenu"), this.native.classList.add("expanded-submenu"), this.syncAria());
|
|
569
181
|
}
|
|
570
|
-
/**
|
|
571
|
-
* Hides the submenu of the MenuItem.
|
|
572
|
-
*/
|
|
573
182
|
hideSubmenu() {
|
|
574
183
|
var _a;
|
|
575
|
-
this.tabIndex = 0;
|
|
576
|
-
if (this.hasSubmenu) {
|
|
577
|
-
(_a = this.popup) == null ? void 0 : _a.hide();
|
|
578
|
-
this.classList.remove("expanded-submenu");
|
|
579
|
-
this.native.classList.remove("expanded-submenu");
|
|
580
|
-
this.syncAria();
|
|
581
|
-
}
|
|
184
|
+
this.tabIndex = 0, this.hasSubmenu && ((_a = this.popup) == null ? void 0 : _a.hide(), this.classList.remove("expanded-submenu"), this.native.classList.remove("expanded-submenu"), this.syncAria());
|
|
582
185
|
}
|
|
583
|
-
|
|
584
|
-
* Toggles the active state of the submenu element.
|
|
585
|
-
* If the submenu is not active, it sets the "active" attribute.
|
|
586
|
-
* If the submenu is already active, it removes the "active" attribute.
|
|
587
|
-
* @param {Event} e The event object.
|
|
588
|
-
*/
|
|
589
|
-
submenuToggle(e) {
|
|
186
|
+
submenuToggle(e2) {
|
|
590
187
|
if (this.hasSubmenu) {
|
|
591
|
-
let
|
|
592
|
-
|
|
593
|
-
submenuElements.setAttribute("active", "");
|
|
594
|
-
this.syncAria();
|
|
595
|
-
} else {
|
|
596
|
-
if (this === e.target) submenuElements.removeAttribute("active");
|
|
597
|
-
this.syncAria();
|
|
598
|
-
}
|
|
188
|
+
let t2 = this.submenu.assignedElements({ flatten: true })[0];
|
|
189
|
+
t2.hasAttribute("active") ? (this === e2.target && t2.removeAttribute("active"), this.syncAria()) : (t2.setAttribute("active", ""), this.syncAria());
|
|
599
190
|
}
|
|
600
191
|
}
|
|
601
|
-
/**
|
|
602
|
-
* Deactivates the submenu by removing the "active" attribute.
|
|
603
|
-
*/
|
|
604
192
|
deactivateSubmenu() {
|
|
605
193
|
if (this.hasSubmenu) {
|
|
606
|
-
let
|
|
607
|
-
|
|
608
|
-
submenuElements == null ? void 0 : submenuElements.removeAttribute("active");
|
|
609
|
-
this.syncAria();
|
|
610
|
-
}
|
|
194
|
+
let e2 = this.submenu.assignedElements({ flatten: true })[0];
|
|
195
|
+
(e2 == null ? void 0 : e2.hasAttribute("active")) && (e2 == null ? void 0 : e2.removeAttribute("active"), this.syncAria());
|
|
611
196
|
}
|
|
612
197
|
}
|
|
613
|
-
/**
|
|
614
|
-
* Activates the submenu of the menu item.
|
|
615
|
-
*/
|
|
616
198
|
activateSubmenu() {
|
|
617
199
|
if (this.hasSubmenu) {
|
|
618
|
-
let
|
|
619
|
-
|
|
620
|
-
submenuElements == null ? void 0 : submenuElements.setAttribute("active", "");
|
|
621
|
-
this.syncAria();
|
|
622
|
-
}
|
|
200
|
+
let e2 = this.submenu.assignedElements({ flatten: true })[0];
|
|
201
|
+
(e2 == null ? void 0 : e2.hasAttribute("active")) || (e2 == null ? void 0 : e2.setAttribute("active", ""), this.syncAria());
|
|
623
202
|
}
|
|
624
203
|
}
|
|
625
|
-
/**
|
|
626
|
-
* Gets the text from the element and returns it.
|
|
627
|
-
*/
|
|
628
204
|
beforeDisconnect() {
|
|
629
205
|
var _a, _b;
|
|
630
|
-
document.removeEventListener("wje-router:rebind", this.rebindRouterLinks);
|
|
631
|
-
this.removeEventListener("mousemove", this.dispatchMove);
|
|
632
|
-
this.removeEventListener("wje-popup:reposition", this.dispatchReposition);
|
|
633
|
-
event.removeListener(this, "mouseenter", null, this.mouseenterHandler);
|
|
634
|
-
event.removeListener(this, "mouseleave", null, this.shouldHideSubmenu);
|
|
635
|
-
event.removeListener(this, "focusout", null, this.shouldHideSubmenu);
|
|
636
|
-
event.removeListener(this, "click", null, this.clickHandler);
|
|
637
|
-
(_a = this.unbindRouterLinks) == null ? void 0 : _a.call(this);
|
|
638
|
-
(_b = this.unbindPortalRouterLinks) == null ? void 0 : _b.call(this);
|
|
206
|
+
document.removeEventListener("wje-router:rebind", this.rebindRouterLinks), this.removeEventListener("mousemove", this.dispatchMove), this.removeEventListener("wje-popup:reposition", this.dispatchReposition), i.removeListener(this, "mouseenter", null, this.mouseenterHandler), i.removeListener(this, "mouseleave", null, this.shouldHideSubmenu), i.removeListener(this, "focusout", null, this.shouldHideSubmenu), i.removeListener(this, "click", null, this.clickHandler), (_a = this.unbindRouterLinks) == null ? void 0 : _a.call(this), (_b = this.unbindPortalRouterLinks) == null ? void 0 : _b.call(this);
|
|
639
207
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
*/
|
|
645
|
-
getTextFromElement(element) {
|
|
646
|
-
let text = "";
|
|
647
|
-
for (let node of element.childNodes) {
|
|
648
|
-
if (node.nodeType === Node.TEXT_NODE) {
|
|
649
|
-
text += node.textContent;
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
return text.trim();
|
|
208
|
+
getTextFromElement(e2) {
|
|
209
|
+
let t2 = "";
|
|
210
|
+
for (let s2 of e2.childNodes) s2.nodeType === Node.TEXT_NODE && (t2 += s2.textContent);
|
|
211
|
+
return t2.trim();
|
|
653
212
|
}
|
|
654
213
|
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
* This method uses the `customEvent` and `customEventParameters` properties
|
|
659
|
-
* to create and dispatch a `CustomEvent`. The event is configured to be
|
|
660
|
-
* composed and bubbles up through the DOM.
|
|
661
|
-
* @returns {void} This method does not return a value.
|
|
662
|
-
*/
|
|
663
|
-
populateCustomEvent_fn = function() {
|
|
664
|
-
this.dispatchEvent(
|
|
665
|
-
new CustomEvent(this.customEvent, { detail: this.customEventParameters, composed: true, bubbles: true })
|
|
666
|
-
);
|
|
214
|
+
_n_instances = new WeakSet();
|
|
215
|
+
e_fn = function() {
|
|
216
|
+
this.dispatchEvent(new CustomEvent(this.customEvent, { detail: this.customEventParameters, composed: true, bubbles: true }));
|
|
667
217
|
};
|
|
668
|
-
|
|
218
|
+
n.define("wje-menu-item", n);
|
|
669
219
|
export {
|
|
670
|
-
|
|
220
|
+
n as default
|
|
671
221
|
};
|
|
672
222
|
//# sourceMappingURL=wje-menu-item.js.map
|