@aquera/nile-elements 1.2.6-beta-1.0 → 1.2.6-beta-1.3
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 +3 -0
- package/demo/index.html +38 -7
- package/dist/index.js +66 -66
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.esm.js +2 -2
- 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 +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js +2 -2
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.esm.js +13 -13
- package/dist/src/nile-select/nile-select.d.ts +12 -12
- package/dist/src/nile-select/nile-select.js +71 -71
- package/dist/src/nile-select/nile-select.js.map +1 -1
- package/dist/src/nile-select/virtual-scroll-helper.js +1 -1
- package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.d.ts +10 -10
- package/dist/src/nile-virtual-select/nile-virtual-select.js +119 -80
- package/dist/src/nile-virtual-select/nile-virtual-select.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-select/nile-select.ts +96 -101
- package/src/nile-select/virtual-scroll-helper.ts +1 -1
- package/src/nile-virtual-select/nile-virtual-select.ts +149 -115
- package/vscode-html-custom-data.json +22 -22
|
@@ -115,7 +115,6 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
115
115
|
this.searchValue = '';
|
|
116
116
|
/** Enable search functionality */
|
|
117
117
|
this.searchEnabled = false;
|
|
118
|
-
this.enableVisibilityEffect = false;
|
|
119
118
|
/** Search input placeholder */
|
|
120
119
|
this.internalSearchPlaceHolder = 'Search...';
|
|
121
120
|
/** Disable local search filtering */
|
|
@@ -132,6 +131,8 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
132
131
|
this.errorMessage = '';
|
|
133
132
|
/** Sets the input to a warning state */
|
|
134
133
|
this.warning = false;
|
|
134
|
+
this.enableVisibilityEffect = false;
|
|
135
|
+
this.enableTabClose = false;
|
|
135
136
|
/** Sets the input to an error state */
|
|
136
137
|
this.error = false;
|
|
137
138
|
/** Sets the input to a success state */
|
|
@@ -187,9 +188,19 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
187
188
|
*/
|
|
188
189
|
this.maxOptionsVisible = 3;
|
|
189
190
|
this.oldMaxOptionsVisible = 1;
|
|
190
|
-
this.enableTabClose = false;
|
|
191
191
|
this.showListbox = false;
|
|
192
192
|
this.wasShowSelectedCheckedOnClose = false;
|
|
193
|
+
this.handleDocumentMouseDown = (event) => {
|
|
194
|
+
if (!this.open)
|
|
195
|
+
return;
|
|
196
|
+
const path = event.composedPath();
|
|
197
|
+
const hitSelf = path.includes(this);
|
|
198
|
+
const hitPopup = this.popup && path.includes(this.popup);
|
|
199
|
+
const hitPortalAppend = this.portal && this.portalManager.portalContainerElement && path.includes(this.portalManager.portalContainerElement);
|
|
200
|
+
if (!hitSelf && !hitPopup && !hitPortalAppend) {
|
|
201
|
+
this.hide();
|
|
202
|
+
}
|
|
203
|
+
};
|
|
193
204
|
/** All active IntersectionObservers for visibility detection */
|
|
194
205
|
this.anchorVisibilityObservers = [];
|
|
195
206
|
/** Handles tab visibility (page hidden / tab switched) */
|
|
@@ -205,17 +216,6 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
205
216
|
});
|
|
206
217
|
}
|
|
207
218
|
};
|
|
208
|
-
this.handleDocumentMouseDown = (event) => {
|
|
209
|
-
if (!this.open)
|
|
210
|
-
return;
|
|
211
|
-
const path = event.composedPath();
|
|
212
|
-
const hitSelf = path.includes(this);
|
|
213
|
-
const hitPopup = this.popup && path.includes(this.popup);
|
|
214
|
-
const hitPortalAppend = this.portal && this.portalManager.portalContainerElement && path.includes(this.portalManager.portalContainerElement);
|
|
215
|
-
if (!hitSelf && !hitPopup && !hitPortalAppend) {
|
|
216
|
-
this.hide();
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
219
|
/**
|
|
220
220
|
* This is a workaround for an error in the Lit Labs virtualizer.
|
|
221
221
|
* Since there are no specific guidelines available to fix the issue,
|
|
@@ -352,6 +352,58 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
352
352
|
this.hasFocus = false;
|
|
353
353
|
this.emit('nile-blur');
|
|
354
354
|
}
|
|
355
|
+
handleDocumentFocusIn(event) {
|
|
356
|
+
if (!this.open)
|
|
357
|
+
return;
|
|
358
|
+
const path = event.composedPath();
|
|
359
|
+
const hitSelf = path.includes(this);
|
|
360
|
+
const hitPopup = this.popup && path.includes(this.popup);
|
|
361
|
+
const hitPortalAppend = this.portal && this.portalManager.portalContainerElement && path.includes(this.portalManager.portalContainerElement);
|
|
362
|
+
if (!hitSelf && !hitPopup && !hitPortalAppend) {
|
|
363
|
+
this.hide();
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
handleDocumentKeyDown(event) {
|
|
367
|
+
if (this.shouldIgnoreKeyPress(event)) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (this.isEscapeKey(event)) {
|
|
371
|
+
this.handleEscapeKey(event);
|
|
372
|
+
}
|
|
373
|
+
if (this.isEnterOrSpaceKey(event)) {
|
|
374
|
+
this.handleEnterOrSpaceKey(event);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
shouldIgnoreKeyPress(event) {
|
|
378
|
+
const target = event.target;
|
|
379
|
+
const isClearButton = target.closest('.select__clear') !== null;
|
|
380
|
+
const isIconButton = target.closest('nile-icon-button') !== null;
|
|
381
|
+
return isClearButton || isIconButton;
|
|
382
|
+
}
|
|
383
|
+
isEscapeKey(event) {
|
|
384
|
+
return event.key === 'Escape' && this.open;
|
|
385
|
+
}
|
|
386
|
+
handleEscapeKey(event) {
|
|
387
|
+
event.preventDefault();
|
|
388
|
+
event.stopPropagation();
|
|
389
|
+
this.hide();
|
|
390
|
+
this.displayInput.focus({ preventScroll: true });
|
|
391
|
+
}
|
|
392
|
+
isEnterOrSpaceKey(event) {
|
|
393
|
+
return event.key === 'Enter' || event.key === ' ';
|
|
394
|
+
}
|
|
395
|
+
handleEnterOrSpaceKey(event) {
|
|
396
|
+
event.preventDefault();
|
|
397
|
+
event.stopImmediatePropagation();
|
|
398
|
+
if (!this.open) {
|
|
399
|
+
this.show();
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (!this.multiple) {
|
|
403
|
+
this.hide();
|
|
404
|
+
this.displayInput.focus({ preventScroll: true });
|
|
405
|
+
}
|
|
406
|
+
}
|
|
355
407
|
/** Utility: find ALL scrollable ancestors (not just the nearest) */
|
|
356
408
|
getScrollableAncestors(element) {
|
|
357
409
|
const scrollables = [];
|
|
@@ -409,58 +461,6 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
409
461
|
// Always remove listener to avoid stale callbacks
|
|
410
462
|
document.removeEventListener('visibilitychange', this.handleDocumentVisibilityChange);
|
|
411
463
|
}
|
|
412
|
-
handleDocumentFocusIn(event) {
|
|
413
|
-
if (!this.open)
|
|
414
|
-
return;
|
|
415
|
-
const path = event.composedPath();
|
|
416
|
-
const hitSelf = path.includes(this);
|
|
417
|
-
const hitPopup = this.popup && path.includes(this.popup);
|
|
418
|
-
const hitPortalAppend = this.portal && this.portalManager.portalContainerElement && path.includes(this.portalManager.portalContainerElement);
|
|
419
|
-
if (!hitSelf && !hitPopup && !hitPortalAppend) {
|
|
420
|
-
this.hide();
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
handleDocumentKeyDown(event) {
|
|
424
|
-
if (this.shouldIgnoreKeyPress(event)) {
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
if (this.isEscapeKey(event)) {
|
|
428
|
-
this.handleEscapeKey(event);
|
|
429
|
-
}
|
|
430
|
-
if (this.isEnterOrSpaceKey(event)) {
|
|
431
|
-
this.handleEnterOrSpaceKey(event);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
shouldIgnoreKeyPress(event) {
|
|
435
|
-
const target = event.target;
|
|
436
|
-
const isClearButton = target.closest('.select__clear') !== null;
|
|
437
|
-
const isIconButton = target.closest('nile-icon-button') !== null;
|
|
438
|
-
return isClearButton || isIconButton;
|
|
439
|
-
}
|
|
440
|
-
isEscapeKey(event) {
|
|
441
|
-
return event.key === 'Escape' && this.open;
|
|
442
|
-
}
|
|
443
|
-
handleEscapeKey(event) {
|
|
444
|
-
event.preventDefault();
|
|
445
|
-
event.stopPropagation();
|
|
446
|
-
this.hide();
|
|
447
|
-
this.displayInput.focus({ preventScroll: true });
|
|
448
|
-
}
|
|
449
|
-
isEnterOrSpaceKey(event) {
|
|
450
|
-
return event.key === 'Enter' || event.key === ' ';
|
|
451
|
-
}
|
|
452
|
-
handleEnterOrSpaceKey(event) {
|
|
453
|
-
event.preventDefault();
|
|
454
|
-
event.stopImmediatePropagation();
|
|
455
|
-
if (!this.open) {
|
|
456
|
-
this.show();
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
if (!this.multiple) {
|
|
460
|
-
this.hide();
|
|
461
|
-
this.displayInput.focus({ preventScroll: true });
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
464
|
handleFooterClick(event) {
|
|
465
465
|
event.stopPropagation();
|
|
466
466
|
event.preventDefault();
|
|
@@ -648,6 +648,9 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
648
648
|
}
|
|
649
649
|
handleSearchChange(e) {
|
|
650
650
|
this.searchValue = e.detail.value;
|
|
651
|
+
if (this.portal) {
|
|
652
|
+
this.portalManager.updatePortalAppendPosition();
|
|
653
|
+
}
|
|
651
654
|
this.emit('nile-search', {
|
|
652
655
|
query: this.searchValue,
|
|
653
656
|
name: this.name
|
|
@@ -709,6 +712,19 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
709
712
|
}
|
|
710
713
|
filterVirtualOptions(searchValue) {
|
|
711
714
|
const result = VirtualSelectSearchManager.filterVirtualOptions(searchValue, this.originalOptionItems, this.data, this.getDisplayText.bind(this), this.renderItemConfig?.getSearchText);
|
|
715
|
+
if (this.portal) {
|
|
716
|
+
this.portalManager.updatePortalAppendPosition();
|
|
717
|
+
this.updateComplete.then(() => {
|
|
718
|
+
requestAnimationFrame(() => {
|
|
719
|
+
requestAnimationFrame(() => {
|
|
720
|
+
this.resetScrollPosition();
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
else {
|
|
726
|
+
this.resetScrollPosition();
|
|
727
|
+
}
|
|
712
728
|
this.data = result.filteredItems;
|
|
713
729
|
this.showNoResults = result.showNoResults;
|
|
714
730
|
this.showSelected = false;
|
|
@@ -1298,19 +1314,42 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
1298
1314
|
this.maxOptionsVisible = lastindex;
|
|
1299
1315
|
}, 1);
|
|
1300
1316
|
}
|
|
1301
|
-
resetScrollPosition() {
|
|
1302
|
-
this.updateComplete
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
if (
|
|
1307
|
-
listbox
|
|
1317
|
+
async resetScrollPosition() {
|
|
1318
|
+
await this.updateComplete;
|
|
1319
|
+
requestAnimationFrame(() => {
|
|
1320
|
+
requestAnimationFrame(() => {
|
|
1321
|
+
let listbox = null;
|
|
1322
|
+
if (this.portal && this.portalManager.portalContainerElement) {
|
|
1323
|
+
listbox = this.portalManager.portalContainerElement.querySelector('#listbox');
|
|
1324
|
+
}
|
|
1325
|
+
else {
|
|
1326
|
+
listbox = this.shadowRoot?.querySelector('#listbox');
|
|
1327
|
+
}
|
|
1328
|
+
if (!listbox || !listbox.isConnected)
|
|
1329
|
+
return;
|
|
1330
|
+
listbox.scrollTop = 0;
|
|
1331
|
+
const virtualized = listbox.querySelector('.virtualized');
|
|
1332
|
+
if (virtualized && virtualized.isConnected) {
|
|
1333
|
+
const fewItems = this.data.length <= 5;
|
|
1334
|
+
if (fewItems) {
|
|
1335
|
+
virtualized.style.overflowY = 'hidden';
|
|
1336
|
+
virtualized.style.maxHeight = 'none';
|
|
1337
|
+
listbox.style.overflowY = 'hidden';
|
|
1338
|
+
listbox.style.maxHeight = 'fit-content';
|
|
1339
|
+
}
|
|
1340
|
+
else {
|
|
1341
|
+
virtualized.style.overflowY = 'auto';
|
|
1342
|
+
virtualized.style.maxHeight = '';
|
|
1343
|
+
listbox.style.overflowY = 'auto';
|
|
1344
|
+
listbox.style.maxHeight = '';
|
|
1345
|
+
}
|
|
1346
|
+
virtualized.scrollTop = 0;
|
|
1308
1347
|
}
|
|
1309
|
-
const virtualizer =
|
|
1348
|
+
const virtualizer = listbox.querySelector('lit-virtualizer');
|
|
1310
1349
|
if (virtualizer && virtualizer.isConnected) {
|
|
1311
1350
|
virtualizer.scrollTop = 0;
|
|
1312
1351
|
}
|
|
1313
|
-
}
|
|
1352
|
+
});
|
|
1314
1353
|
});
|
|
1315
1354
|
}
|
|
1316
1355
|
};
|
|
@@ -1377,9 +1416,6 @@ __decorate([
|
|
|
1377
1416
|
__decorate([
|
|
1378
1417
|
property({ type: Boolean, reflect: true })
|
|
1379
1418
|
], NileVirtualSelect.prototype, "searchEnabled", void 0);
|
|
1380
|
-
__decorate([
|
|
1381
|
-
property({ type: Boolean, reflect: true, attribute: true })
|
|
1382
|
-
], NileVirtualSelect.prototype, "enableVisibilityEffect", void 0);
|
|
1383
1419
|
__decorate([
|
|
1384
1420
|
property({ attribute: 'internal-search-placeholder' })
|
|
1385
1421
|
], NileVirtualSelect.prototype, "internalSearchPlaceHolder", void 0);
|
|
@@ -1404,6 +1440,12 @@ __decorate([
|
|
|
1404
1440
|
__decorate([
|
|
1405
1441
|
property({ type: Boolean })
|
|
1406
1442
|
], NileVirtualSelect.prototype, "warning", void 0);
|
|
1443
|
+
__decorate([
|
|
1444
|
+
property({ type: Boolean, reflect: true, attribute: true })
|
|
1445
|
+
], NileVirtualSelect.prototype, "enableVisibilityEffect", void 0);
|
|
1446
|
+
__decorate([
|
|
1447
|
+
property({ type: Boolean, reflect: true, attribute: true })
|
|
1448
|
+
], NileVirtualSelect.prototype, "enableTabClose", void 0);
|
|
1407
1449
|
__decorate([
|
|
1408
1450
|
property({ type: Boolean })
|
|
1409
1451
|
], NileVirtualSelect.prototype, "error", void 0);
|
|
@@ -1467,9 +1509,6 @@ __decorate([
|
|
|
1467
1509
|
__decorate([
|
|
1468
1510
|
state()
|
|
1469
1511
|
], NileVirtualSelect.prototype, "oldMaxOptionsVisible", void 0);
|
|
1470
|
-
__decorate([
|
|
1471
|
-
property({ type: Boolean, reflect: true, attribute: true })
|
|
1472
|
-
], NileVirtualSelect.prototype, "enableTabClose", void 0);
|
|
1473
1512
|
__decorate([
|
|
1474
1513
|
state()
|
|
1475
1514
|
], NileVirtualSelect.prototype, "showListbox", void 0);
|