@aquera/nile-elements 2.0.11 → 2.0.13
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/README.md +7 -0
- package/demo/app-shell.html +21 -21
- package/dist/index.js +170 -167
- package/dist/nile-app-shell/nile-app-shell.cjs.js +1 -1
- package/dist/nile-app-shell/nile-app-shell.cjs.js.map +1 -1
- package/dist/nile-app-shell/nile-app-shell.css.cjs.js +1 -1
- package/dist/nile-app-shell/nile-app-shell.css.cjs.js.map +1 -1
- package/dist/nile-app-shell/nile-app-shell.css.esm.js +35 -32
- package/dist/nile-app-shell/nile-app-shell.esm.js +39 -34
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js +1 -1
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js.map +1 -1
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.esm.js +3 -1
- package/dist/nile-select/nile-select.cjs.js +2 -2
- package/dist/nile-select/nile-select.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.css.cjs.js +1 -1
- package/dist/nile-select/nile-select.css.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.css.esm.js +12 -17
- package/dist/nile-select/nile-select.esm.js +43 -42
- package/dist/nile-select/virtual-scroll-helper.cjs.js +1 -1
- package/dist/nile-select/virtual-scroll-helper.cjs.js.map +1 -1
- package/dist/nile-select/virtual-scroll-helper.esm.js +2 -0
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js +4 -4
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.css.cjs.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.css.cjs.js.map +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.css.esm.js +12 -17
- package/dist/nile-virtual-select/nile-virtual-select.esm.js +26 -26
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.js +9 -5
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.js.map +1 -1
- package/dist/src/nile-app-shell/nile-app-shell.css.js +33 -30
- package/dist/src/nile-app-shell/nile-app-shell.css.js.map +1 -1
- package/dist/src/nile-app-shell/nile-app-shell.d.ts +22 -22
- package/dist/src/nile-app-shell/nile-app-shell.js +86 -76
- package/dist/src/nile-app-shell/nile-app-shell.js.map +1 -1
- package/dist/src/nile-app-shell/nile-app-shell.test.d.ts +1 -0
- package/dist/src/nile-app-shell/nile-app-shell.test.js +307 -89
- package/dist/src/nile-app-shell/nile-app-shell.test.js.map +1 -1
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js +3 -1
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js.map +1 -1
- package/dist/src/nile-select/nile-select.css.js +12 -17
- package/dist/src/nile-select/nile-select.css.js.map +1 -1
- package/dist/src/nile-select/nile-select.d.ts +18 -2
- package/dist/src/nile-select/nile-select.js +226 -64
- package/dist/src/nile-select/nile-select.js.map +1 -1
- package/dist/src/nile-select/nile-select.test.d.ts +1 -0
- package/dist/src/nile-select/nile-select.test.js +896 -17
- package/dist/src/nile-select/nile-select.test.js.map +1 -1
- package/dist/src/nile-select/virtual-scroll-helper.js +2 -0
- package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.css.js +12 -17
- package/dist/src/nile-virtual-select/nile-virtual-select.css.js.map +1 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.d.ts +10 -2
- package/dist/src/nile-virtual-select/nile-virtual-select.js +142 -30
- package/dist/src/nile-virtual-select/nile-virtual-select.js.map +1 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.test.d.ts +1 -0
- package/dist/src/nile-virtual-select/nile-virtual-select.test.js +331 -16
- package/dist/src/nile-virtual-select/nile-virtual-select.test.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-app-shell/nile-app-shell-regions.test.ts +9 -5
- package/src/nile-app-shell/nile-app-shell.css.ts +33 -30
- package/src/nile-app-shell/nile-app-shell.test.ts +348 -105
- package/src/nile-app-shell/nile-app-shell.ts +89 -82
- package/src/nile-app-shell-panel/nile-app-shell-panel.css.ts +3 -1
- package/src/nile-select/nile-select.css.ts +12 -17
- package/src/nile-select/nile-select.test.ts +1112 -17
- package/src/nile-select/nile-select.ts +237 -67
- package/src/nile-select/virtual-scroll-helper.ts +2 -0
- package/src/nile-virtual-select/nile-virtual-select.css.ts +12 -17
- package/src/nile-virtual-select/nile-virtual-select.test.ts +404 -16
- package/src/nile-virtual-select/nile-virtual-select.ts +200 -79
- package/vscode-html-custom-data.json +36 -41
|
@@ -100,7 +100,15 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
100
100
|
this.requestUpdate('maxOptionsVisible', previous);
|
|
101
101
|
}
|
|
102
102
|
get chipFittingEnabled() {
|
|
103
|
-
return !!this.multiple && !this.maxOptionsVisibleExplicit;
|
|
103
|
+
return !!this.multiple && this.showTooltip && !this.maxOptionsVisibleExplicit;
|
|
104
|
+
}
|
|
105
|
+
get legacyTagFitEnabled() {
|
|
106
|
+
return !!this.multiple && !this.showTooltip;
|
|
107
|
+
}
|
|
108
|
+
setFittedMaxOptionsVisible(value) {
|
|
109
|
+
const previous = this._maxOptionsVisible;
|
|
110
|
+
this._maxOptionsVisible = value;
|
|
111
|
+
this.requestUpdate('maxOptionsVisible', previous);
|
|
104
112
|
}
|
|
105
113
|
/** Gets the validity state object */
|
|
106
114
|
get validity() {
|
|
@@ -118,6 +126,7 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
118
126
|
this.scrolling = false;
|
|
119
127
|
this.options = [];
|
|
120
128
|
this.resizeController = new ResizeController(this, {
|
|
129
|
+
target: null,
|
|
121
130
|
callback: (entries) => {
|
|
122
131
|
for (const entry of entries) {
|
|
123
132
|
if (entry.target.classList.contains('select__tags')) {
|
|
@@ -135,6 +144,7 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
135
144
|
this.selectedOptions = [];
|
|
136
145
|
this.oldValue = '';
|
|
137
146
|
this.hiddenChipCount = 0;
|
|
147
|
+
this.oldMaxOptionsVisible = 1;
|
|
138
148
|
/** Last measured width of the overflow button, in px. */
|
|
139
149
|
this.lastOverflowWidth = 0;
|
|
140
150
|
/** The name of the select, submitted as a name/value pair with form data. */
|
|
@@ -191,8 +201,9 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
191
201
|
/** Maximum width, in px, of a squeezed chip. Needs `showtooltip`. */
|
|
192
202
|
this.chipMaxWidth = 180;
|
|
193
203
|
/**
|
|
194
|
-
*
|
|
195
|
-
*
|
|
204
|
+
* Opts into the fitted chip row: chips are sized between chipMinWidth and chipMaxWidth, the
|
|
205
|
+
* rest collapse into a +N button, and a clipped chip shows its full value in a tooltip.
|
|
206
|
+
* Off by default, which keeps the pre-2.0.9 chip row.
|
|
196
207
|
*/
|
|
197
208
|
this.showTooltip = false;
|
|
198
209
|
/** Disables the select control. */
|
|
@@ -250,6 +261,7 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
250
261
|
this.handleWindowScroll = () => {
|
|
251
262
|
this.portalManager.updatePortalAppendPosition();
|
|
252
263
|
};
|
|
264
|
+
this.prefixCopies = new WeakMap();
|
|
253
265
|
}
|
|
254
266
|
connectedCallback() {
|
|
255
267
|
super.connectedCallback();
|
|
@@ -266,6 +278,9 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
266
278
|
this.handleWindowScroll = this.handleWindowScroll.bind(this);
|
|
267
279
|
// Because this is a form control, it shouldn't be opened initially
|
|
268
280
|
this.open = false;
|
|
281
|
+
if (this.hasUpdated && this.chipFittingEnabled) {
|
|
282
|
+
this.calculateTotalWidthOfTags();
|
|
283
|
+
}
|
|
269
284
|
this.emit('nile-init');
|
|
270
285
|
}
|
|
271
286
|
disconnectedCallback() {
|
|
@@ -282,7 +297,7 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
282
297
|
this.emit('nile-destroy');
|
|
283
298
|
}
|
|
284
299
|
setupResizeObserver() {
|
|
285
|
-
const wanted = this.autoResize && this.chipFittingEnabled
|
|
300
|
+
const wanted = this.autoResize && (this.chipFittingEnabled || this.legacyTagFitEnabled)
|
|
286
301
|
? this.shadowRoot?.querySelector('.select__tags') ??
|
|
287
302
|
undefined
|
|
288
303
|
: undefined;
|
|
@@ -312,6 +327,13 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
312
327
|
inner.maxOptionsVisible = this._maxOptionsVisible;
|
|
313
328
|
}
|
|
314
329
|
}
|
|
330
|
+
syncValueFromVirtualSelect(event) {
|
|
331
|
+
if (event.composedPath()[0] !== event.currentTarget)
|
|
332
|
+
return;
|
|
333
|
+
if (!event.detail || !('value' in event.detail))
|
|
334
|
+
return;
|
|
335
|
+
this.value = event.detail.value ?? (this.multiple ? [] : '');
|
|
336
|
+
}
|
|
315
337
|
updated(_changedProperties) {
|
|
316
338
|
if (_changedProperties.has('searchEnabled')) {
|
|
317
339
|
this.updateGroupStickyOffsets();
|
|
@@ -327,9 +349,15 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
327
349
|
}
|
|
328
350
|
if (_changedProperties.has('autoResize') ||
|
|
329
351
|
_changedProperties.has('multiple') ||
|
|
330
|
-
_changedProperties.has('maxOptionsVisible')
|
|
352
|
+
_changedProperties.has('maxOptionsVisible') ||
|
|
353
|
+
_changedProperties.has('showTooltip')) {
|
|
331
354
|
this.setupResizeObserver();
|
|
332
355
|
}
|
|
356
|
+
if (_changedProperties.has('showTooltip') &&
|
|
357
|
+
_changedProperties.get('showTooltip') !== undefined &&
|
|
358
|
+
this.legacyTagFitEnabled) {
|
|
359
|
+
this.calculateTotalWidthOfTags();
|
|
360
|
+
}
|
|
333
361
|
this.syncVirtualSelectMaxOptionsVisible();
|
|
334
362
|
if (_changedProperties.has('enableDescription')) {
|
|
335
363
|
this.setEnableDescriptionInOptions();
|
|
@@ -799,11 +827,23 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
799
827
|
}
|
|
800
828
|
return options;
|
|
801
829
|
}
|
|
802
|
-
getOptionPrefixNodes(option) {
|
|
830
|
+
getOptionPrefixNodes(option, site) {
|
|
803
831
|
const prefixSlot = option.shadowRoot?.querySelector('slot[name="prefix"]');
|
|
804
832
|
if (!prefixSlot)
|
|
805
833
|
return [];
|
|
806
|
-
|
|
834
|
+
const sources = prefixSlot.assignedElements();
|
|
835
|
+
const markup = sources.map(el => el.outerHTML).join('');
|
|
836
|
+
let sites = this.prefixCopies.get(option);
|
|
837
|
+
if (!sites) {
|
|
838
|
+
sites = new Map();
|
|
839
|
+
this.prefixCopies.set(option, sites);
|
|
840
|
+
}
|
|
841
|
+
const cached = sites.get(site);
|
|
842
|
+
if (cached && cached.markup === markup)
|
|
843
|
+
return cached.nodes;
|
|
844
|
+
const nodes = sources.map(el => el.cloneNode(true));
|
|
845
|
+
sites.set(site, { markup, nodes });
|
|
846
|
+
return nodes;
|
|
807
847
|
}
|
|
808
848
|
// Gets the first <nile-option> element
|
|
809
849
|
getFirstOption() {
|
|
@@ -1135,6 +1175,10 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
1135
1175
|
event.stopPropagation();
|
|
1136
1176
|
}
|
|
1137
1177
|
calculateTotalWidthOfTags() {
|
|
1178
|
+
if (this.legacyTagFitEnabled) {
|
|
1179
|
+
this.fitTagsLegacy();
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1138
1182
|
if (!this.chipFittingEnabled)
|
|
1139
1183
|
return;
|
|
1140
1184
|
if (this.chipFitFrame)
|
|
@@ -1144,6 +1188,49 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
1144
1188
|
this.layoutChips();
|
|
1145
1189
|
});
|
|
1146
1190
|
}
|
|
1191
|
+
calculateWidthOfSelectTagsDiv() {
|
|
1192
|
+
if (this.shadowRoot) {
|
|
1193
|
+
const selectTagsDiv = this.shadowRoot.querySelector('div.select__tags');
|
|
1194
|
+
if (selectTagsDiv instanceof HTMLElement) {
|
|
1195
|
+
const width = selectTagsDiv.offsetWidth;
|
|
1196
|
+
return width - 70;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
fitTagsLegacy() {
|
|
1201
|
+
if (this.maxOptionsVisible !== Infinity) {
|
|
1202
|
+
this.oldMaxOptionsVisible = this.maxOptionsVisible;
|
|
1203
|
+
}
|
|
1204
|
+
this.setFittedMaxOptionsVisible(Infinity);
|
|
1205
|
+
setTimeout(() => {
|
|
1206
|
+
const widths = [];
|
|
1207
|
+
if (this.shadowRoot) {
|
|
1208
|
+
const tags = this.shadowRoot.querySelectorAll('nile-tag');
|
|
1209
|
+
tags.forEach(tag => {
|
|
1210
|
+
if (tag instanceof HTMLElement) {
|
|
1211
|
+
widths.push(tag.offsetWidth);
|
|
1212
|
+
}
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
if (this.value.length !== widths.length) {
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
const widthOfSelectTagsDiv = this.calculateWidthOfSelectTagsDiv();
|
|
1219
|
+
if (!widthOfSelectTagsDiv) {
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
let summ = 0;
|
|
1223
|
+
let lastindex = 0;
|
|
1224
|
+
for (let i = 0; i < widths.length; i++) {
|
|
1225
|
+
summ += widths[i];
|
|
1226
|
+
if (summ > widthOfSelectTagsDiv) {
|
|
1227
|
+
lastindex = i;
|
|
1228
|
+
break;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
this.setFittedMaxOptionsVisible(lastindex);
|
|
1232
|
+
}, 1);
|
|
1233
|
+
}
|
|
1147
1234
|
allocateChipWidths(natural, available) {
|
|
1148
1235
|
const min = this.chipMinWidth;
|
|
1149
1236
|
const max = this.chipMaxWidth;
|
|
@@ -1223,6 +1310,11 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
1223
1310
|
this.hiddenChipCount = 0;
|
|
1224
1311
|
return;
|
|
1225
1312
|
}
|
|
1313
|
+
if (container.clientWidth === 0) {
|
|
1314
|
+
this.refitWhenMeasurable(container);
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1317
|
+
this.stopMeasurableWatch();
|
|
1226
1318
|
const overflowEl = container.querySelector('.select__tags-count');
|
|
1227
1319
|
for (const chip of chips) {
|
|
1228
1320
|
chip.style.display = '';
|
|
@@ -1268,13 +1360,45 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
1268
1360
|
}
|
|
1269
1361
|
this.refreshClippedChips();
|
|
1270
1362
|
}
|
|
1363
|
+
labelOverflows(content) {
|
|
1364
|
+
let left = Infinity;
|
|
1365
|
+
let right = -Infinity;
|
|
1366
|
+
const range = document.createRange();
|
|
1367
|
+
for (const node of content.assignedNodes({ flatten: true })) {
|
|
1368
|
+
let rect;
|
|
1369
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
1370
|
+
if (!node.textContent?.trim())
|
|
1371
|
+
continue;
|
|
1372
|
+
range.selectNodeContents(node);
|
|
1373
|
+
rect = range.getBoundingClientRect();
|
|
1374
|
+
}
|
|
1375
|
+
else if (node instanceof Element) {
|
|
1376
|
+
rect = node.getBoundingClientRect();
|
|
1377
|
+
}
|
|
1378
|
+
else {
|
|
1379
|
+
continue;
|
|
1380
|
+
}
|
|
1381
|
+
if (rect.width === 0)
|
|
1382
|
+
continue;
|
|
1383
|
+
left = Math.min(left, rect.left);
|
|
1384
|
+
right = Math.max(right, rect.right);
|
|
1385
|
+
}
|
|
1386
|
+
if (right < left)
|
|
1387
|
+
return false;
|
|
1388
|
+
const box = content.getBoundingClientRect();
|
|
1389
|
+
const styles = getComputedStyle(content);
|
|
1390
|
+
const boxLeft = box.left + parseFloat(styles.borderLeftWidth) + parseFloat(styles.paddingLeft);
|
|
1391
|
+
const boxRight = box.right - parseFloat(styles.borderRightWidth) - parseFloat(styles.paddingRight);
|
|
1392
|
+
const epsilon = 1 / 64;
|
|
1393
|
+
return right > boxRight + epsilon || left < boxLeft - epsilon;
|
|
1394
|
+
}
|
|
1271
1395
|
isChipClipped(el) {
|
|
1272
1396
|
if (!el)
|
|
1273
1397
|
return false;
|
|
1274
1398
|
const root = el.shadowRoot;
|
|
1275
1399
|
if (root) {
|
|
1276
1400
|
const content = root.querySelector('[part="content"]');
|
|
1277
|
-
if (content &&
|
|
1401
|
+
if (content && this.labelOverflows(content))
|
|
1278
1402
|
return true;
|
|
1279
1403
|
const inner = root.querySelector('[part="prefix_content_wrapper"]');
|
|
1280
1404
|
if (inner && inner.scrollWidth > inner.clientWidth + 1)
|
|
@@ -1316,6 +1440,26 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
1316
1440
|
cancelAnimationFrame(this.clipFrame);
|
|
1317
1441
|
this.clipFrame = 0;
|
|
1318
1442
|
this.lastChipLayout = { hidden: -1, visible: -1 };
|
|
1443
|
+
this.stopMeasurableWatch();
|
|
1444
|
+
}
|
|
1445
|
+
refitWhenMeasurable(container) {
|
|
1446
|
+
if (!this.isConnected)
|
|
1447
|
+
return;
|
|
1448
|
+
if (this.measurableWatch?.target === container)
|
|
1449
|
+
return;
|
|
1450
|
+
this.stopMeasurableWatch();
|
|
1451
|
+
const observer = new ResizeObserver(entries => {
|
|
1452
|
+
if (!entries.some(entry => entry.contentRect.width > 0))
|
|
1453
|
+
return;
|
|
1454
|
+
this.stopMeasurableWatch();
|
|
1455
|
+
this.calculateTotalWidthOfTags();
|
|
1456
|
+
});
|
|
1457
|
+
observer.observe(container);
|
|
1458
|
+
this.measurableWatch = { observer, target: container };
|
|
1459
|
+
}
|
|
1460
|
+
stopMeasurableWatch() {
|
|
1461
|
+
this.measurableWatch?.observer.disconnect();
|
|
1462
|
+
this.measurableWatch = undefined;
|
|
1319
1463
|
}
|
|
1320
1464
|
getChipLabel(option) {
|
|
1321
1465
|
return (option.getTextLabel?.() ?? '').trim();
|
|
@@ -1370,7 +1514,7 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
1370
1514
|
<div part="tags" class="select__tags select__tags--fitted">
|
|
1371
1515
|
${this.selectedOptions.map((option, index) => {
|
|
1372
1516
|
const label = this.getChipLabel(option);
|
|
1373
|
-
const prefixNodes = this.getOptionPrefixNodes(option);
|
|
1517
|
+
const prefixNodes = this.getOptionPrefixNodes(option, 'chip');
|
|
1374
1518
|
return html `
|
|
1375
1519
|
<nile-lite-tooltip
|
|
1376
1520
|
class="select__tag-tip"
|
|
@@ -1422,6 +1566,65 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
1422
1566
|
</div>
|
|
1423
1567
|
`;
|
|
1424
1568
|
}
|
|
1569
|
+
renderLegacyTags() {
|
|
1570
|
+
return html `
|
|
1571
|
+
<div part="tags" class="select__tags">
|
|
1572
|
+
${this.selectedOptions.map((option, index) => {
|
|
1573
|
+
if (index < this.maxOptionsVisible || this.maxOptionsVisible <= 0) {
|
|
1574
|
+
return this.showTooltip
|
|
1575
|
+
? html `<nile-lite-tooltip
|
|
1576
|
+
class="select__tag-tip"
|
|
1577
|
+
.content=${option.getTextLabel()}
|
|
1578
|
+
?disabled=${this.chipTooltipDisabled(index)}
|
|
1579
|
+
>${this.renderLegacyTag(option, index)}</nile-lite-tooltip
|
|
1580
|
+
>`
|
|
1581
|
+
: this.renderLegacyTag(option, index);
|
|
1582
|
+
}
|
|
1583
|
+
else if (index === this.maxOptionsVisible) {
|
|
1584
|
+
return html `
|
|
1585
|
+
<span class="select__tags-count"
|
|
1586
|
+
>+${this.selectedOptions.length - index} More
|
|
1587
|
+
</span>
|
|
1588
|
+
`;
|
|
1589
|
+
}
|
|
1590
|
+
else {
|
|
1591
|
+
return null;
|
|
1592
|
+
}
|
|
1593
|
+
})}
|
|
1594
|
+
</div>
|
|
1595
|
+
`;
|
|
1596
|
+
}
|
|
1597
|
+
renderLegacyTag(option, index) {
|
|
1598
|
+
const prefixNodes = this.getOptionPrefixNodes(option, 'chip');
|
|
1599
|
+
const classes = {
|
|
1600
|
+
select__invisible: index + 1 > this.oldMaxOptionsVisible &&
|
|
1601
|
+
this.maxOptionsVisible === Infinity,
|
|
1602
|
+
};
|
|
1603
|
+
return html `
|
|
1604
|
+
<nile-tag
|
|
1605
|
+
class=${classMap(classes)}
|
|
1606
|
+
part="tag"
|
|
1607
|
+
exportparts="
|
|
1608
|
+
base:tag__base,
|
|
1609
|
+
content:tag__content,
|
|
1610
|
+
remove-button:tag__remove-button,
|
|
1611
|
+
remove-button__base:tag__remove-button__base,
|
|
1612
|
+
prefix:tag__prefix,
|
|
1613
|
+
prefix_content_wrapper:tag__prefix_content_wrapper
|
|
1614
|
+
"
|
|
1615
|
+
style=${ifDefined(this.showTooltip ? `max-width:${this.chipMaxWidth}px` : undefined)}
|
|
1616
|
+
?pill=${this.pill}
|
|
1617
|
+
size=${this.size}
|
|
1618
|
+
removable
|
|
1619
|
+
@nile-remove=${(event) => this.handleTagRemove(event, option)}
|
|
1620
|
+
>
|
|
1621
|
+
${prefixNodes.length
|
|
1622
|
+
? html `<span class="tag__prefix" slot="prefix">${prefixNodes}</span>`
|
|
1623
|
+
: ''}
|
|
1624
|
+
${option.getTextLabel()}
|
|
1625
|
+
</nile-tag>
|
|
1626
|
+
`;
|
|
1627
|
+
}
|
|
1425
1628
|
handleInputAfterInit() {
|
|
1426
1629
|
this.shadowRoot?.querySelector('nile-input')?.inputFocus();
|
|
1427
1630
|
}
|
|
@@ -1439,7 +1642,7 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
1439
1642
|
const hasHelpText = (this.helpText || this.help_text) ? true : false;
|
|
1440
1643
|
const hasErrorMessage = this.errorMessage ? true : false;
|
|
1441
1644
|
const prefixNodes = this.selectedOptions[0]
|
|
1442
|
-
? this.getOptionPrefixNodes(this.selectedOptions[0])
|
|
1645
|
+
? this.getOptionPrefixNodes(this.selectedOptions[0], 'trigger')
|
|
1443
1646
|
: [];
|
|
1444
1647
|
return html `
|
|
1445
1648
|
<div
|
|
@@ -1553,57 +1756,7 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
1553
1756
|
${this.multiple
|
|
1554
1757
|
? this.chipFittingEnabled
|
|
1555
1758
|
? this.renderFittedTags()
|
|
1556
|
-
:
|
|
1557
|
-
<div part="tags" class="select__tags">
|
|
1558
|
-
${this.selectedOptions.map((option, index) => {
|
|
1559
|
-
if (index < this.maxOptionsVisible ||
|
|
1560
|
-
this.maxOptionsVisible <= 0) {
|
|
1561
|
-
const prefixNodes = this.getOptionPrefixNodes(option);
|
|
1562
|
-
return html `
|
|
1563
|
-
<nile-lite-tooltip
|
|
1564
|
-
class="select__tag-tip"
|
|
1565
|
-
.content=${option.getTextLabel()}
|
|
1566
|
-
?disabled=${this.chipTooltipDisabled(index)}
|
|
1567
|
-
>
|
|
1568
|
-
<nile-tag
|
|
1569
|
-
part="tag"
|
|
1570
|
-
exportparts="
|
|
1571
|
-
base:tag__base,
|
|
1572
|
-
content:tag__content,
|
|
1573
|
-
remove-button:tag__remove-button,
|
|
1574
|
-
remove-button__base:tag__remove-button__base,
|
|
1575
|
-
prefix:tag__prefix,
|
|
1576
|
-
prefix_content_wrapper:tag__prefix_content_wrapper
|
|
1577
|
-
"
|
|
1578
|
-
style="max-width:${this.chipMaxWidth}px"
|
|
1579
|
-
?pill=${this.pill}
|
|
1580
|
-
size=${this.size}
|
|
1581
|
-
removable
|
|
1582
|
-
@nile-remove=${(event) => this.handleTagRemove(event, option)}
|
|
1583
|
-
>
|
|
1584
|
-
${prefixNodes.length
|
|
1585
|
-
? html `<span class="tag__prefix" slot="prefix"
|
|
1586
|
-
>${prefixNodes}</span
|
|
1587
|
-
>`
|
|
1588
|
-
: ''}
|
|
1589
|
-
${option.getTextLabel()}
|
|
1590
|
-
</nile-tag>
|
|
1591
|
-
</nile-lite-tooltip>
|
|
1592
|
-
`;
|
|
1593
|
-
}
|
|
1594
|
-
else if (index === this.maxOptionsVisible) {
|
|
1595
|
-
return html `
|
|
1596
|
-
<span class="select__tags-count"
|
|
1597
|
-
>+${this.selectedOptions.length - index} More
|
|
1598
|
-
</span>
|
|
1599
|
-
`;
|
|
1600
|
-
}
|
|
1601
|
-
else {
|
|
1602
|
-
return null;
|
|
1603
|
-
}
|
|
1604
|
-
})}
|
|
1605
|
-
</div>
|
|
1606
|
-
`
|
|
1759
|
+
: this.renderLegacyTags()
|
|
1607
1760
|
: ''}
|
|
1608
1761
|
|
|
1609
1762
|
<input
|
|
@@ -1715,7 +1868,13 @@ let NileSelect = class NileSelect extends NileElement {
|
|
|
1715
1868
|
</div>
|
|
1716
1869
|
|
|
1717
1870
|
${this.hasSlotController.test('pre-footer') || this.multiple
|
|
1718
|
-
? html `<div
|
|
1871
|
+
? html `<div
|
|
1872
|
+
part="footer-area"
|
|
1873
|
+
class=${classMap({
|
|
1874
|
+
'select__pre-footer-area': true,
|
|
1875
|
+
'select__pre-footer-area--query': !this.noWidthSync || this.portal,
|
|
1876
|
+
})}
|
|
1877
|
+
>
|
|
1719
1878
|
${this.hasSlotController.test('pre-footer')
|
|
1720
1879
|
? html `
|
|
1721
1880
|
<div part="pre-footer" @click=${this.handlePreFooterClick}>
|
|
@@ -1827,6 +1986,9 @@ __decorate([
|
|
|
1827
1986
|
__decorate([
|
|
1828
1987
|
state()
|
|
1829
1988
|
], NileSelect.prototype, "hiddenChipCount", void 0);
|
|
1989
|
+
__decorate([
|
|
1990
|
+
state()
|
|
1991
|
+
], NileSelect.prototype, "oldMaxOptionsVisible", void 0);
|
|
1830
1992
|
__decorate([
|
|
1831
1993
|
property()
|
|
1832
1994
|
], NileSelect.prototype, "name", void 0);
|
|
@@ -1922,10 +2084,10 @@ __decorate([
|
|
|
1922
2084
|
property({ attribute: 'max-options-visible', type: Number })
|
|
1923
2085
|
], NileSelect.prototype, "maxOptionsVisible", null);
|
|
1924
2086
|
__decorate([
|
|
1925
|
-
property({ type: Number,
|
|
2087
|
+
property({ type: Number, attribute: true })
|
|
1926
2088
|
], NileSelect.prototype, "chipMinWidth", void 0);
|
|
1927
2089
|
__decorate([
|
|
1928
|
-
property({ type: Number,
|
|
2090
|
+
property({ type: Number, attribute: true })
|
|
1929
2091
|
], NileSelect.prototype, "chipMaxWidth", void 0);
|
|
1930
2092
|
__decorate([
|
|
1931
2093
|
property({ type: Boolean, attribute: true, reflect: true })
|