@limetech/lime-elements 37.1.0-next.65 → 37.1.0-next.67
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/cjs/{component-9c3fa668.js → component-66df95e7.js} +935 -12
- package/dist/cjs/component-66df95e7.js.map +1 -0
- package/dist/cjs/index.es-75b5e7c4.js +222 -0
- package/dist/cjs/index.es-75b5e7c4.js.map +1 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-breadcrumbs_3.cjs.entry.js +190 -35
- package/dist/cjs/limel-breadcrumbs_3.cjs.entry.js.map +1 -1
- package/dist/cjs/{limel-list.cjs.entry.js → limel-input-field_3.cjs.entry.js} +820 -4
- package/dist/cjs/limel-input-field_3.cjs.entry.js.map +1 -0
- package/dist/cjs/limel-picker.cjs.entry.js +2 -218
- package/dist/cjs/limel-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/menu/menu.js +242 -21
- package/dist/collection/components/menu/menu.js.map +1 -1
- package/dist/collection/components/menu/menu.types.js.map +1 -1
- package/dist/collection/components/menu-list/menu-list-renderer.js +3 -1
- package/dist/collection/components/menu-list/menu-list-renderer.js.map +1 -1
- package/dist/esm/{component-0be247ac.js → component-fffa3419.js} +934 -13
- package/dist/esm/component-fffa3419.js.map +1 -0
- package/dist/esm/index.es-61c13ecf.js +220 -0
- package/dist/esm/index.es-61c13ecf.js.map +1 -0
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-breadcrumbs_3.entry.js +180 -25
- package/dist/esm/limel-breadcrumbs_3.entry.js.map +1 -1
- package/dist/esm/{limel-list.entry.js → limel-input-field_3.entry.js} +818 -4
- package/dist/esm/limel-input-field_3.entry.js.map +1 -0
- package/dist/esm/limel-picker.entry.js +1 -217
- package/dist/esm/limel-picker.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js.map +1 -1
- package/dist/lime-elements/p-78a442a0.entry.js +2 -0
- package/dist/lime-elements/p-78a442a0.entry.js.map +1 -0
- package/dist/lime-elements/p-97107e34.js +16 -0
- package/dist/lime-elements/p-97107e34.js.map +1 -0
- package/dist/lime-elements/p-ade5366a.entry.js +82 -0
- package/dist/lime-elements/p-ade5366a.entry.js.map +1 -0
- package/dist/lime-elements/p-dfba92de.js +206 -0
- package/dist/lime-elements/p-dfba92de.js.map +1 -0
- package/dist/lime-elements/p-dfc927a3.entry.js +2 -0
- package/dist/lime-elements/p-dfc927a3.entry.js.map +1 -0
- package/dist/types/components/menu/menu.d.ts +41 -7
- package/dist/types/components/menu/menu.types.d.ts +14 -3
- package/dist/types/components.d.ts +34 -2
- package/package.json +1 -1
- package/dist/cjs/component-9c3fa668.js.map +0 -1
- package/dist/cjs/component-a0124759.js +0 -929
- package/dist/cjs/component-a0124759.js.map +0 -1
- package/dist/cjs/limel-input-field.cjs.entry.js +0 -707
- package/dist/cjs/limel-input-field.cjs.entry.js.map +0 -1
- package/dist/cjs/limel-list.cjs.entry.js.map +0 -1
- package/dist/cjs/limel-menu-surface.cjs.entry.js +0 -130
- package/dist/cjs/limel-menu-surface.cjs.entry.js.map +0 -1
- package/dist/esm/component-0be247ac.js.map +0 -1
- package/dist/esm/component-6d079abe.js +0 -926
- package/dist/esm/component-6d079abe.js.map +0 -1
- package/dist/esm/limel-input-field.entry.js +0 -703
- package/dist/esm/limel-input-field.entry.js.map +0 -1
- package/dist/esm/limel-list.entry.js.map +0 -1
- package/dist/esm/limel-menu-surface.entry.js +0 -126
- package/dist/esm/limel-menu-surface.entry.js.map +0 -1
- package/dist/lime-elements/p-32ff1b76.entry.js +0 -2
- package/dist/lime-elements/p-32ff1b76.entry.js.map +0 -1
- package/dist/lime-elements/p-3efb6ac5.entry.js +0 -2
- package/dist/lime-elements/p-3efb6ac5.entry.js.map +0 -1
- package/dist/lime-elements/p-5dd6d677.js +0 -82
- package/dist/lime-elements/p-5dd6d677.js.map +0 -1
- package/dist/lime-elements/p-958a0086.entry.js +0 -82
- package/dist/lime-elements/p-958a0086.entry.js.map +0 -1
- package/dist/lime-elements/p-99b26036.entry.js +0 -2
- package/dist/lime-elements/p-99b26036.entry.js.map +0 -1
- package/dist/lime-elements/p-bbf317b8.entry.js +0 -16
- package/dist/lime-elements/p-bbf317b8.entry.js.map +0 -1
- package/dist/lime-elements/p-e3b16b61.js +0 -126
- package/dist/lime-elements/p-e3b16b61.js.map +0 -1
|
@@ -7,17 +7,17 @@ const makeEnterClickable = require('./make-enter-clickable-59460fd6.js');
|
|
|
7
7
|
const randomString = require('./random-string-c8445652.js');
|
|
8
8
|
const getIconProps = require('./get-icon-props-46a7e937.js');
|
|
9
9
|
const keycodes = require('./keycodes-3949f425.js');
|
|
10
|
+
const index_es = require('./index.es-75b5e7c4.js');
|
|
11
|
+
const eq = require('./eq-9a943b00.js');
|
|
10
12
|
const zipObject = require('./zipObject-93a471fa.js');
|
|
11
|
-
const component$
|
|
13
|
+
const component$1 = require('./component-67144c1c.js');
|
|
12
14
|
const ponyfill = require('./ponyfill-98ca4766.js');
|
|
13
|
-
const component
|
|
14
|
-
const component = require('./component-
|
|
15
|
-
|
|
15
|
+
const component = require('./component-66df95e7.js');
|
|
16
|
+
const component$2 = require('./component-cf490570.js');
|
|
17
|
+
require('./isObject-e28b7997.js');
|
|
16
18
|
require('./_assignValue-7c18d8d6.js');
|
|
17
19
|
require('./_defineProperty-8f56146d.js');
|
|
18
20
|
require('./_getNative-60328036.js');
|
|
19
|
-
require('./eq-9a943b00.js');
|
|
20
|
-
require('./isObject-e28b7997.js');
|
|
21
21
|
require('./keyboard-9477d3a8.js');
|
|
22
22
|
require('./util-b0f5741e.js');
|
|
23
23
|
|
|
@@ -103,12 +103,26 @@ Breadcrumbs.style = breadcrumbsCss;
|
|
|
103
103
|
|
|
104
104
|
const menuCss = ":host(limel-menu){isolation:isolate;position:relative;display:inline-block;--badge-background-color:var(\n --notification-badge-background-color,\n rgb(var(--color-red-default))\n );--badge-text-color:var(\n --notification-badge-text-color,\n rgb(var(--color-white))\n )}:host([hidden]){display:none}.menu__trigger{border-color:transparent;border-width:1px;border-style:solid;background:none;color:rgb(var(--contrast-800));height:2.25rem}.menu__trigger-enabled:hover{border-color:rgb(var(--contrast-800));color:rgb(var(--contrast-1100))}.mdc-menu-surface--anchor{position:relative}limel-badge{position:absolute;top:-0.25rem;right:-0.25rem}";
|
|
105
105
|
|
|
106
|
+
const SEARCH_DEBOUNCE = 500;
|
|
106
107
|
const Menu = class {
|
|
107
108
|
constructor(hostRef) {
|
|
108
109
|
index.registerInstance(this, hostRef);
|
|
109
110
|
this.cancel = index.createEvent(this, "cancel", 7);
|
|
110
111
|
this.select = index.createEvent(this, "select", 7);
|
|
111
112
|
this.navigateMenu = index.createEvent(this, "navigateMenu", 7);
|
|
113
|
+
this.renderLoader = () => {
|
|
114
|
+
if (!this.loadingSubItems && !this.loading) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const cssProperties = this.getCssProperties();
|
|
118
|
+
return (index.h("div", { style: {
|
|
119
|
+
width: cssProperties['--menu-surface-width'],
|
|
120
|
+
display: 'flex',
|
|
121
|
+
'align-items': 'center',
|
|
122
|
+
'justify-content': 'center',
|
|
123
|
+
padding: '0.5rem 0',
|
|
124
|
+
} }, index.h("limel-spinner", { size: "mini", limeBranded: false })));
|
|
125
|
+
};
|
|
112
126
|
this.renderBreadcrumb = () => {
|
|
113
127
|
var _a;
|
|
114
128
|
if (!((_a = this.menuBreadCrumb) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
@@ -123,12 +137,43 @@ const Menu = class {
|
|
|
123
137
|
if (!event.detail.menuItem) {
|
|
124
138
|
this.currentSubMenu = null;
|
|
125
139
|
this.navigateMenu.emit(null);
|
|
140
|
+
this.setFocus();
|
|
126
141
|
return;
|
|
127
142
|
}
|
|
128
143
|
this.handleSelect(event.detail.menuItem);
|
|
129
144
|
};
|
|
145
|
+
this.renderSearchField = () => {
|
|
146
|
+
if (!this.searcher) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
return (index.h("limel-input-field", { tabindex: "0", ref: this.setSearchElement, type: "search", leadingIcon: "search", style: {
|
|
150
|
+
padding: '0.25rem',
|
|
151
|
+
'box-sizing': 'border-box',
|
|
152
|
+
}, value: this.searchValue, onChange: this.handleTextInput, onKeyDown: this.handleInputKeyDown }));
|
|
153
|
+
};
|
|
154
|
+
this.renderEmptyMessage = () => {
|
|
155
|
+
var _a;
|
|
156
|
+
if (this.loading ||
|
|
157
|
+
this.loadingSubItems ||
|
|
158
|
+
!this.emptyResultMessage ||
|
|
159
|
+
!Array.isArray(this.searchResults) ||
|
|
160
|
+
((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
return (index.h("p", { style: {
|
|
164
|
+
padding: '0 1rem',
|
|
165
|
+
'text-align': 'center',
|
|
166
|
+
} }, this.emptyResultMessage));
|
|
167
|
+
};
|
|
130
168
|
this.renderMenuList = () => {
|
|
131
|
-
|
|
169
|
+
var _a;
|
|
170
|
+
let items = this.visibleItems;
|
|
171
|
+
if ((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.length) {
|
|
172
|
+
items = this.searchResults;
|
|
173
|
+
}
|
|
174
|
+
if (this.loadingSubItems || this.loading) {
|
|
175
|
+
items = [];
|
|
176
|
+
}
|
|
132
177
|
return (index.h("limel-menu-list", { style: {
|
|
133
178
|
'overflow-y': 'auto',
|
|
134
179
|
'flex-grow': '1',
|
|
@@ -136,19 +181,67 @@ const Menu = class {
|
|
|
136
181
|
'has-grid-layout has-interactive-items': this.gridLayout,
|
|
137
182
|
}, items: items, type: "menu", badgeIcons: this.badgeIcons, onSelect: this.onSelect, ref: this.setListElement, onKeyDown: this.handleMenuKeyDown }));
|
|
138
183
|
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
184
|
+
this.handleTextInput = async (event) => {
|
|
185
|
+
event.stopPropagation();
|
|
186
|
+
const query = event.detail;
|
|
187
|
+
this.searchValue = query;
|
|
188
|
+
if (query === '') {
|
|
189
|
+
this.searchResults = null;
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
this.loadingSubItems = true;
|
|
193
|
+
const result = await this.debouncedSearch(query);
|
|
194
|
+
this.searchResults = result;
|
|
195
|
+
this.loadingSubItems = false;
|
|
196
|
+
};
|
|
197
|
+
// Key handler for the input search field
|
|
198
|
+
// Will change focus to the first/last item in the dropdown
|
|
199
|
+
// list to enable selection with the keyboard
|
|
200
|
+
this.handleInputKeyDown = (event) => {
|
|
201
|
+
const isForwardTab = (event.key === keycodes.TAB || event.keyCode === keycodes.TAB_KEY_CODE) &&
|
|
202
|
+
!event.altKey &&
|
|
203
|
+
!event.metaKey &&
|
|
204
|
+
!event.shiftKey;
|
|
205
|
+
const isUp = event.key === keycodes.ARROW_UP || event.keyCode === keycodes.ARROW_UP_KEY_CODE;
|
|
206
|
+
const isDown = event.key === keycodes.ARROW_DOWN || event.keyCode === keycodes.ARROW_DOWN_KEY_CODE;
|
|
207
|
+
if (!isForwardTab && !isUp && !isDown) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (!this.list) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
event.stopPropagation();
|
|
214
|
+
event.preventDefault();
|
|
215
|
+
if (isForwardTab || isDown) {
|
|
216
|
+
const listElement = this.list.shadowRoot.querySelector('.mdc-deprecated-list-item:first-child');
|
|
217
|
+
listElement.focus();
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (isUp) {
|
|
221
|
+
const listElement = this.list.shadowRoot.querySelector('.mdc-deprecated-list-item:last-child');
|
|
222
|
+
listElement.focus();
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
// Key handler for the menu list
|
|
226
|
+
// Will change focus to the search field if using shift+tab
|
|
227
|
+
// And can go forward/back with righ/left arrow keys
|
|
145
228
|
this.handleMenuKeyDown = (event) => {
|
|
229
|
+
var _a;
|
|
230
|
+
const isBackwardTab = (event.key === keycodes.TAB || event.keyCode === keycodes.TAB_KEY_CODE) &&
|
|
231
|
+
!event.altKey &&
|
|
232
|
+
!event.metaKey &&
|
|
233
|
+
event.shiftKey;
|
|
146
234
|
const isLeft = event.key === keycodes.ARROW_LEFT || event.keyCode === keycodes.ARROW_LEFT_KEY_CODE;
|
|
147
235
|
const isRight = event.key === keycodes.ARROW_RIGHT || event.keyCode === keycodes.ARROW_RIGHT_KEY_CODE;
|
|
148
|
-
if (!isLeft && !isRight) {
|
|
236
|
+
if (!isBackwardTab && !isLeft && !isRight) {
|
|
149
237
|
return;
|
|
150
238
|
}
|
|
151
|
-
if (
|
|
239
|
+
if (isBackwardTab) {
|
|
240
|
+
event.stopPropagation();
|
|
241
|
+
event.preventDefault();
|
|
242
|
+
(_a = this.searchInput) === null || _a === void 0 ? void 0 : _a.focus();
|
|
243
|
+
}
|
|
244
|
+
else if (!this.gridLayout) {
|
|
152
245
|
const currentItem = this.getCurrentItem();
|
|
153
246
|
event.stopPropagation();
|
|
154
247
|
event.preventDefault();
|
|
@@ -160,6 +253,10 @@ const Menu = class {
|
|
|
160
253
|
}
|
|
161
254
|
}
|
|
162
255
|
};
|
|
256
|
+
this.clearSearch = () => {
|
|
257
|
+
this.searchValue = '';
|
|
258
|
+
this.searchResults = null;
|
|
259
|
+
};
|
|
163
260
|
this.getCurrentItem = () => {
|
|
164
261
|
var _a, _b, _c;
|
|
165
262
|
const activeItem = (_b = (_a = this.list) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('[role="menuitem"][tabindex="0"]');
|
|
@@ -181,6 +278,7 @@ const Menu = class {
|
|
|
181
278
|
// No need to load a sub-menu.
|
|
182
279
|
this.currentSubMenu = null;
|
|
183
280
|
this.navigateMenu.emit(null);
|
|
281
|
+
this.setFocus();
|
|
184
282
|
return;
|
|
185
283
|
}
|
|
186
284
|
this.handleSelect(parent);
|
|
@@ -213,18 +311,34 @@ const Menu = class {
|
|
|
213
311
|
}
|
|
214
312
|
this.open = !this.open;
|
|
215
313
|
};
|
|
216
|
-
this.handleSelect = (menuItem, selectOnEmptyChildren = true) => {
|
|
314
|
+
this.handleSelect = async (menuItem, selectOnEmptyChildren = true) => {
|
|
217
315
|
if (Array.isArray(menuItem === null || menuItem === void 0 ? void 0 : menuItem.items) && menuItem.items.length > 0) {
|
|
316
|
+
this.clearSearch();
|
|
218
317
|
this.currentSubMenu = menuItem;
|
|
219
318
|
this.navigateMenu.emit(menuItem);
|
|
319
|
+
this.setFocus();
|
|
220
320
|
return;
|
|
221
321
|
}
|
|
322
|
+
else if (eq.isFunction(menuItem === null || menuItem === void 0 ? void 0 : menuItem.items)) {
|
|
323
|
+
const menuLoader = menuItem.items;
|
|
324
|
+
this.loadingSubItems = true;
|
|
325
|
+
const subItems = await menuLoader(menuItem);
|
|
326
|
+
menuItem.items = subItems;
|
|
327
|
+
this.loadingSubItems = false;
|
|
328
|
+
if (subItems === null || subItems === void 0 ? void 0 : subItems.length) {
|
|
329
|
+
this.currentSubMenu = menuItem;
|
|
330
|
+
this.navigateMenu.emit(menuItem);
|
|
331
|
+
this.setFocus();
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
222
335
|
if (!selectOnEmptyChildren) {
|
|
223
336
|
return;
|
|
224
337
|
}
|
|
225
338
|
this.select.emit(menuItem);
|
|
226
339
|
this.open = false;
|
|
227
340
|
this.currentSubMenu = null;
|
|
341
|
+
this.setFocus();
|
|
228
342
|
};
|
|
229
343
|
this.onSelect = (event) => {
|
|
230
344
|
event.stopPropagation();
|
|
@@ -235,13 +349,28 @@ const Menu = class {
|
|
|
235
349
|
};
|
|
236
350
|
this.setFocus = () => {
|
|
237
351
|
setTimeout(() => {
|
|
238
|
-
|
|
239
|
-
observer
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
352
|
+
if (this.searchInput && this.searcher) {
|
|
353
|
+
const observer = new IntersectionObserver(() => {
|
|
354
|
+
observer.unobserve(this.searchInput);
|
|
355
|
+
if (this.searchInput === window.document.activeElement) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
this.searchInput.focus();
|
|
359
|
+
});
|
|
360
|
+
observer.observe(this.searchInput);
|
|
361
|
+
}
|
|
362
|
+
else if (this.list) {
|
|
363
|
+
const observer = new IntersectionObserver(() => {
|
|
364
|
+
observer.unobserve(this.list);
|
|
365
|
+
this.focusMenuItem();
|
|
366
|
+
});
|
|
367
|
+
observer.observe(this.list);
|
|
368
|
+
}
|
|
243
369
|
}, 0);
|
|
244
370
|
};
|
|
371
|
+
this.setSearchElement = (element) => {
|
|
372
|
+
this.searchInput = element;
|
|
373
|
+
};
|
|
245
374
|
this.focusMenuItem = () => {
|
|
246
375
|
var _a;
|
|
247
376
|
if (!this.list) {
|
|
@@ -249,8 +378,8 @@ const Menu = class {
|
|
|
249
378
|
}
|
|
250
379
|
const activeElement = this.list.shadowRoot.activeElement;
|
|
251
380
|
activeElement === null || activeElement === void 0 ? void 0 : activeElement.blur();
|
|
252
|
-
const
|
|
253
|
-
const selectedIndex = Math.max(
|
|
381
|
+
const menuItems = this.visibleItems.filter(this.isMenuItem);
|
|
382
|
+
const selectedIndex = Math.max(menuItems.findIndex((item) => item.selected), 0);
|
|
254
383
|
const menuElements = Array.from(this.list.shadowRoot.querySelectorAll('[role="menuitem"]'));
|
|
255
384
|
(_a = menuElements[selectedIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
256
385
|
};
|
|
@@ -270,10 +399,20 @@ const Menu = class {
|
|
|
270
399
|
this.open = false;
|
|
271
400
|
this.badgeIcons = false;
|
|
272
401
|
this.gridLayout = false;
|
|
402
|
+
this.loading = false;
|
|
273
403
|
this.currentSubMenu = undefined;
|
|
404
|
+
this.searcher = undefined;
|
|
405
|
+
this.emptyResultMessage = undefined;
|
|
406
|
+
this.loadingSubItems = undefined;
|
|
274
407
|
this.menuBreadCrumb = [];
|
|
408
|
+
this.searchValue = undefined;
|
|
409
|
+
this.searchResults = undefined;
|
|
410
|
+
this.createDebouncedSearcher = this.createDebouncedSearcher.bind(this);
|
|
275
411
|
this.portalId = randomString.createRandomString();
|
|
276
412
|
}
|
|
413
|
+
componentDidLoad() {
|
|
414
|
+
this.createDebouncedSearcher(this.searcher);
|
|
415
|
+
}
|
|
277
416
|
componentDidRender() {
|
|
278
417
|
const slotElement = this.host.shadowRoot.querySelector('slot');
|
|
279
418
|
slotElement.assignedElements().forEach(this.setTriggerAttributes);
|
|
@@ -284,17 +423,25 @@ const Menu = class {
|
|
|
284
423
|
const menuSurfaceWidth = this.getMenuSurfaceWidth(cssProperties['--menu-surface-width']);
|
|
285
424
|
return (index.h("div", { class: "mdc-menu-surface--anchor", onClick: this.onTriggerClick }, index.h("slot", { ref: this.setTriggerRef, name: "trigger" }), this.renderNotificationBadge(), index.h("limel-portal", { visible: this.open, containerId: this.portalId, openDirection: this.openDirection, position: "absolute", containerStyle: { 'z-index': dropdownZIndex } }, index.h("limel-menu-surface", { open: this.open, onDismiss: this.onClose, style: Object.assign(Object.assign({}, cssProperties), { '--mdc-menu-min-width': menuSurfaceWidth, '--limel-menu-surface-display': 'flex', '--limel-menu-surface-flex-direction': 'column' }), class: {
|
|
286
425
|
'has-grid-layout': this.gridLayout,
|
|
287
|
-
} }, this.renderBreadcrumb(), this.renderMenuList()))));
|
|
426
|
+
} }, this.renderSearchField(), this.renderBreadcrumb(), this.renderLoader(), this.renderEmptyMessage(), this.renderMenuList()))));
|
|
288
427
|
}
|
|
289
428
|
itemsWatcher() {
|
|
429
|
+
this.clearSearch();
|
|
290
430
|
this.setFocus();
|
|
291
431
|
}
|
|
292
432
|
openWatcher(newValue) {
|
|
293
433
|
if (newValue) {
|
|
294
434
|
this.setFocus();
|
|
295
435
|
}
|
|
436
|
+
else {
|
|
437
|
+
this.clearSearch();
|
|
438
|
+
}
|
|
296
439
|
}
|
|
297
440
|
currentSubMenuWatcher() {
|
|
441
|
+
if (this.searchValue) {
|
|
442
|
+
this.menuBreadCrumb = [];
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
298
445
|
const breadCrumbItems = [];
|
|
299
446
|
let currentItem = this.currentSubMenu;
|
|
300
447
|
while (currentItem) {
|
|
@@ -316,6 +463,12 @@ const Menu = class {
|
|
|
316
463
|
}
|
|
317
464
|
this.menuBreadCrumb = breadCrumbItems.reverse();
|
|
318
465
|
}
|
|
466
|
+
createDebouncedSearcher(newValue) {
|
|
467
|
+
if (typeof newValue !== 'function') {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
this.debouncedSearch = index_es.AwesomeDebouncePromise(newValue, SEARCH_DEBOUNCE);
|
|
471
|
+
}
|
|
319
472
|
getCssProperties() {
|
|
320
473
|
const propertyNames = [
|
|
321
474
|
'--menu-surface-width',
|
|
@@ -366,7 +519,8 @@ const Menu = class {
|
|
|
366
519
|
static get watchers() { return {
|
|
367
520
|
"items": ["itemsWatcher"],
|
|
368
521
|
"open": ["openWatcher"],
|
|
369
|
-
"currentSubMenu": ["currentSubMenuWatcher"]
|
|
522
|
+
"currentSubMenu": ["currentSubMenuWatcher"],
|
|
523
|
+
"searcher": ["createDebouncedSearcher"]
|
|
370
524
|
}; }
|
|
371
525
|
};
|
|
372
526
|
Menu.style = menuCss;
|
|
@@ -624,11 +778,11 @@ var MDCMenuFoundation = /** @class */ (function (_super) {
|
|
|
624
778
|
MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) {
|
|
625
779
|
this.validatedIndex(index);
|
|
626
780
|
if (isEnabled) {
|
|
627
|
-
this.adapter.removeClassFromElementAtIndex(index, component
|
|
781
|
+
this.adapter.removeClassFromElementAtIndex(index, component.cssClasses.LIST_ITEM_DISABLED_CLASS);
|
|
628
782
|
this.adapter.addAttributeToElementAtIndex(index, strings.ARIA_DISABLED_ATTR, 'false');
|
|
629
783
|
}
|
|
630
784
|
else {
|
|
631
|
-
this.adapter.addClassToElementAtIndex(index, component
|
|
785
|
+
this.adapter.addClassToElementAtIndex(index, component.cssClasses.LIST_ITEM_DISABLED_CLASS);
|
|
632
786
|
this.adapter.addAttributeToElementAtIndex(index, strings.ARIA_DISABLED_ATTR, 'true');
|
|
633
787
|
}
|
|
634
788
|
};
|
|
@@ -640,7 +794,7 @@ var MDCMenuFoundation = /** @class */ (function (_super) {
|
|
|
640
794
|
}
|
|
641
795
|
};
|
|
642
796
|
return MDCMenuFoundation;
|
|
643
|
-
}(component$
|
|
797
|
+
}(component$1.MDCFoundation));
|
|
644
798
|
|
|
645
799
|
/**
|
|
646
800
|
* @license
|
|
@@ -674,7 +828,7 @@ var MDCMenu = /** @class */ (function (_super) {
|
|
|
674
828
|
};
|
|
675
829
|
MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) {
|
|
676
830
|
if (menuSurfaceFactory === void 0) { menuSurfaceFactory = function (el) { return new component.MDCMenuSurface(el); }; }
|
|
677
|
-
if (listFactory === void 0) { listFactory = function (el) { return new component
|
|
831
|
+
if (listFactory === void 0) { listFactory = function (el) { return new component.MDCList(el); }; }
|
|
678
832
|
this.menuSurfaceFactory = menuSurfaceFactory;
|
|
679
833
|
this.listFactory = listFactory;
|
|
680
834
|
};
|
|
@@ -700,7 +854,7 @@ var MDCMenu = /** @class */ (function (_super) {
|
|
|
700
854
|
};
|
|
701
855
|
this.menuSurface.listen(component.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened);
|
|
702
856
|
this.listen('keydown', this.handleKeydown);
|
|
703
|
-
this.listen(component
|
|
857
|
+
this.listen(component.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction);
|
|
704
858
|
};
|
|
705
859
|
MDCMenu.prototype.destroy = function () {
|
|
706
860
|
if (this.list) {
|
|
@@ -709,7 +863,7 @@ var MDCMenu = /** @class */ (function (_super) {
|
|
|
709
863
|
this.menuSurface.destroy();
|
|
710
864
|
this.menuSurface.unlisten(component.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened);
|
|
711
865
|
this.unlisten('keydown', this.handleKeydown);
|
|
712
|
-
this.unlisten(component
|
|
866
|
+
this.unlisten(component.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction);
|
|
713
867
|
_super.prototype.destroy.call(this);
|
|
714
868
|
};
|
|
715
869
|
Object.defineProperty(MDCMenu.prototype, "open", {
|
|
@@ -824,7 +978,7 @@ var MDCMenu = /** @class */ (function (_super) {
|
|
|
824
978
|
* radio lists, and an array of numbers for checkbox lists.
|
|
825
979
|
*/
|
|
826
980
|
get: function () {
|
|
827
|
-
return this.list ? this.list.selectedIndex : component
|
|
981
|
+
return this.list ? this.list.selectedIndex : component.numbers.UNSET_INDEX;
|
|
828
982
|
},
|
|
829
983
|
/**
|
|
830
984
|
* Sets the selected index of the list. Only applicable to select menus.
|
|
@@ -976,7 +1130,7 @@ var MDCMenu = /** @class */ (function (_super) {
|
|
|
976
1130
|
return new MDCMenuFoundation(adapter);
|
|
977
1131
|
};
|
|
978
1132
|
return MDCMenu;
|
|
979
|
-
}(component$
|
|
1133
|
+
}(component$1.MDCComponent));
|
|
980
1134
|
|
|
981
1135
|
class MenuListRenderer {
|
|
982
1136
|
constructor() {
|
|
@@ -1113,7 +1267,8 @@ class MenuListRenderer {
|
|
|
1113
1267
|
return index.h("hr", { class: classes });
|
|
1114
1268
|
};
|
|
1115
1269
|
this.hasSubItems = (item) => {
|
|
1116
|
-
return Array.isArray(item.items) && item.items.length > 0
|
|
1270
|
+
return ((Array.isArray(item.items) && item.items.length > 0) ||
|
|
1271
|
+
eq.isFunction(item.items));
|
|
1117
1272
|
};
|
|
1118
1273
|
}
|
|
1119
1274
|
render(items, config = {}) {
|
|
@@ -1168,7 +1323,7 @@ const MenuList = class {
|
|
|
1168
1323
|
this.mdcMenu = new MDCMenu(element);
|
|
1169
1324
|
this.mdcMenu.hasTypeahead = true;
|
|
1170
1325
|
this.mdcMenu.wrapFocus = true;
|
|
1171
|
-
this.mdcMenu.items.forEach((item) => new component$
|
|
1326
|
+
this.mdcMenu.items.forEach((item) => new component$2.MDCRipple(item));
|
|
1172
1327
|
};
|
|
1173
1328
|
this.setupListeners = () => {
|
|
1174
1329
|
if (!this.mdcMenu) {
|