@aquera/nile-elements 1.1.3-beta-1.4 → 1.1.3-beta-2.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/demo/index.html +124 -24
- package/dist/index.js +728 -770
- package/dist/nile-grid/nile-grid.cjs.js +1 -1
- package/dist/nile-grid/nile-grid.cjs.js.map +1 -1
- package/dist/nile-grid/nile-grid.css.cjs.js +1 -1
- package/dist/nile-grid/nile-grid.css.cjs.js.map +1 -1
- package/dist/nile-grid/nile-grid.css.esm.js +4 -8
- package/dist/nile-grid/nile-grid.esm.js +6 -6
- package/dist/nile-grid/nile-grid.utils.cjs.js +1 -1
- package/dist/nile-grid/nile-grid.utils.cjs.js.map +1 -1
- package/dist/nile-grid/nile-grid.utils.esm.js +1 -1
- package/dist/nile-grid-body/nile-grid-body.cjs.js +1 -1
- package/dist/nile-grid-body/nile-grid-body.cjs.js.map +1 -1
- package/dist/nile-grid-body/nile-grid-body.css.cjs.js +1 -1
- package/dist/nile-grid-body/nile-grid-body.css.cjs.js.map +1 -1
- package/dist/nile-grid-body/nile-grid-body.css.esm.js +4 -0
- package/dist/nile-grid-body/nile-grid-body.esm.js +3 -3
- package/dist/nile-grid-cell-item/nile-grid-cell-item.cjs.js +1 -1
- package/dist/nile-grid-cell-item/nile-grid-cell-item.cjs.js.map +1 -1
- package/dist/nile-grid-cell-item/nile-grid-cell-item.css.cjs.js +1 -1
- package/dist/nile-grid-cell-item/nile-grid-cell-item.css.cjs.js.map +1 -1
- package/dist/nile-grid-cell-item/nile-grid-cell-item.css.esm.js +3 -18
- package/dist/nile-grid-cell-item/nile-grid-cell-item.esm.js +3 -3
- package/dist/nile-grid-head/nile-grid-head.cjs.js +1 -1
- package/dist/nile-grid-head/nile-grid-head.cjs.js.map +1 -1
- package/dist/nile-grid-head/nile-grid-head.css.cjs.js +1 -1
- package/dist/nile-grid-head/nile-grid-head.css.cjs.js.map +1 -1
- package/dist/nile-grid-head/nile-grid-head.css.esm.js +1 -1
- package/dist/nile-grid-head/nile-grid-head.esm.js +3 -3
- package/dist/nile-grid-head-item/nile-grid-head-item.cjs.js +1 -1
- package/dist/nile-grid-head-item/nile-grid-head-item.cjs.js.map +1 -1
- package/dist/nile-grid-head-item/nile-grid-head-item.css.cjs.js +1 -1
- package/dist/nile-grid-head-item/nile-grid-head-item.css.cjs.js.map +1 -1
- package/dist/nile-grid-head-item/nile-grid-head-item.css.esm.js +5 -20
- package/dist/nile-grid-head-item/nile-grid-head-item.esm.js +3 -4
- package/dist/nile-grid-row/nile-grid-row.cjs.js +1 -1
- package/dist/nile-grid-row/nile-grid-row.cjs.js.map +1 -1
- package/dist/nile-grid-row/nile-grid-row.css.cjs.js +1 -1
- package/dist/nile-grid-row/nile-grid-row.css.cjs.js.map +1 -1
- package/dist/nile-grid-row/nile-grid-row.css.esm.js +5 -17
- package/dist/nile-grid-row/nile-grid-row.esm.js +5 -4
- 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 +7 -6
- package/dist/src/nile-grid/nile-grid.css.js +2 -6
- package/dist/src/nile-grid/nile-grid.css.js.map +1 -1
- package/dist/src/nile-grid/nile-grid.d.ts +3 -9
- package/dist/src/nile-grid/nile-grid.js +20 -96
- package/dist/src/nile-grid/nile-grid.js.map +1 -1
- package/dist/src/nile-grid/nile-grid.utils.d.ts +2 -3
- package/dist/src/nile-grid/nile-grid.utils.js +81 -223
- package/dist/src/nile-grid/nile-grid.utils.js.map +1 -1
- package/dist/src/nile-grid-body/nile-grid-body.css.js +4 -0
- package/dist/src/nile-grid-body/nile-grid-body.css.js.map +1 -1
- package/dist/src/nile-grid-body/nile-grid-body.js +1 -1
- package/dist/src/nile-grid-body/nile-grid-body.js.map +1 -1
- package/dist/src/nile-grid-cell-item/nile-grid-cell-item.css.js +2 -17
- package/dist/src/nile-grid-cell-item/nile-grid-cell-item.css.js.map +1 -1
- package/dist/src/nile-grid-cell-item/nile-grid-cell-item.d.ts +3 -0
- package/dist/src/nile-grid-cell-item/nile-grid-cell-item.js +11 -1
- package/dist/src/nile-grid-cell-item/nile-grid-cell-item.js.map +1 -1
- package/dist/src/nile-grid-head/nile-grid-head.css.js +1 -1
- package/dist/src/nile-grid-head/nile-grid-head.css.js.map +1 -1
- package/dist/src/nile-grid-head/nile-grid-head.js +1 -1
- package/dist/src/nile-grid-head/nile-grid-head.js.map +1 -1
- package/dist/src/nile-grid-head-item/nile-grid-head-item.css.js +3 -18
- package/dist/src/nile-grid-head-item/nile-grid-head-item.css.js.map +1 -1
- package/dist/src/nile-grid-head-item/nile-grid-head-item.d.ts +2 -3
- package/dist/src/nile-grid-head-item/nile-grid-head-item.js +11 -14
- package/dist/src/nile-grid-head-item/nile-grid-head-item.js.map +1 -1
- package/dist/src/nile-grid-row/nile-grid-row.css.js +5 -17
- package/dist/src/nile-grid-row/nile-grid-row.css.js.map +1 -1
- package/dist/src/nile-grid-row/nile-grid-row.d.ts +1 -4
- package/dist/src/nile-grid-row/nile-grid-row.js +4 -19
- package/dist/src/nile-grid-row/nile-grid-row.js.map +1 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.d.ts +18 -0
- package/dist/src/nile-virtual-select/nile-virtual-select.js +230 -3
- 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-grid/nile-grid.css.ts +2 -6
- package/src/nile-grid/nile-grid.ts +21 -124
- package/src/nile-grid/nile-grid.utils.ts +98 -353
- package/src/nile-grid-body/nile-grid-body.css.ts +4 -0
- package/src/nile-grid-body/nile-grid-body.ts +2 -2
- package/src/nile-grid-cell-item/nile-grid-cell-item.css.ts +2 -17
- package/src/nile-grid-cell-item/nile-grid-cell-item.ts +11 -3
- package/src/nile-grid-head/nile-grid-head.css.ts +1 -1
- package/src/nile-grid-head/nile-grid-head.ts +2 -2
- package/src/nile-grid-head-item/nile-grid-head-item.css.ts +3 -18
- package/src/nile-grid-head-item/nile-grid-head-item.ts +16 -8
- package/src/nile-grid-row/nile-grid-row.css.ts +5 -17
- package/src/nile-grid-row/nile-grid-row.ts +6 -9
- package/src/nile-virtual-select/nile-virtual-select.ts +257 -3
- package/vscode-html-custom-data.json +69 -37
- package/src/nile-grid/nile-grid.types.ts +0 -1
|
@@ -173,6 +173,11 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
173
173
|
this.blockValueChange = false;
|
|
174
174
|
/** Disable width synchronization */
|
|
175
175
|
this.noWidthSync = false;
|
|
176
|
+
/**
|
|
177
|
+
* When true, the listbox will be appended to the document body instead of the parent container.
|
|
178
|
+
* This is useful when the parent has overflow: hidden, clip-path, or transform applied.
|
|
179
|
+
*/
|
|
180
|
+
this.bodyAppend = false;
|
|
176
181
|
/**
|
|
177
182
|
* The maximum number of selected options to show when `multiple` is true. After the maximum, "+n" will be shown to
|
|
178
183
|
* indicate the number of additional items that are selected. Set to 0 to remove the limit.
|
|
@@ -180,13 +185,17 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
180
185
|
this.maxOptionsVisible = 3;
|
|
181
186
|
this.oldMaxOptionsVisible = 1;
|
|
182
187
|
this.showListbox = false;
|
|
188
|
+
// Body append-related state
|
|
189
|
+
this.bodyAppendContainer = null;
|
|
190
|
+
this.bodyAppendListbox = null;
|
|
183
191
|
this.handleDocumentMouseDown = (event) => {
|
|
184
192
|
if (!this.open)
|
|
185
193
|
return;
|
|
186
194
|
const path = event.composedPath();
|
|
187
195
|
const hitSelf = path.includes(this);
|
|
188
196
|
const hitPopup = this.popup && path.includes(this.popup);
|
|
189
|
-
|
|
197
|
+
const hitBodyAppend = this.bodyAppend && this.bodyAppendContainer && path.includes(this.bodyAppendContainer);
|
|
198
|
+
if (!hitSelf && !hitPopup && !hitBodyAppend) {
|
|
190
199
|
this.hide();
|
|
191
200
|
}
|
|
192
201
|
};
|
|
@@ -202,6 +211,12 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
202
211
|
return;
|
|
203
212
|
}
|
|
204
213
|
};
|
|
214
|
+
this.handleWindowResize = () => {
|
|
215
|
+
this.updateBodyAppendPosition();
|
|
216
|
+
};
|
|
217
|
+
this.handleWindowScroll = () => {
|
|
218
|
+
this.updateBodyAppendPosition();
|
|
219
|
+
};
|
|
205
220
|
this.resizeController = new ResizeController(this, {
|
|
206
221
|
callback: (entries) => {
|
|
207
222
|
for (const entry of entries) {
|
|
@@ -237,6 +252,8 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
237
252
|
clearTimeout(this.scrollTimeout);
|
|
238
253
|
this.scrollTimeout = undefined;
|
|
239
254
|
}
|
|
255
|
+
// Clean up body append elements
|
|
256
|
+
this.cleanupBodyAppend();
|
|
240
257
|
}
|
|
241
258
|
updated(changedProperties) {
|
|
242
259
|
if (changedProperties.has('value')) {
|
|
@@ -289,18 +306,26 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
289
306
|
this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);
|
|
290
307
|
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
|
291
308
|
this.handleWindowError = this.handleWindowError.bind(this);
|
|
309
|
+
this.handleWindowResize = this.handleWindowResize.bind(this);
|
|
310
|
+
this.handleWindowScroll = this.handleWindowScroll.bind(this);
|
|
292
311
|
}
|
|
293
312
|
addOpenListeners() {
|
|
294
313
|
document.addEventListener('focusin', this.handleDocumentFocusIn);
|
|
295
314
|
document.addEventListener('keydown', this.handleDocumentKeyDown);
|
|
296
315
|
document.addEventListener('mousedown', this.handleDocumentMouseDown);
|
|
297
316
|
window.addEventListener('error', this.handleWindowError);
|
|
317
|
+
if (this.bodyAppend) {
|
|
318
|
+
window.addEventListener('resize', this.handleWindowResize);
|
|
319
|
+
window.addEventListener('scroll', this.handleWindowScroll, true);
|
|
320
|
+
}
|
|
298
321
|
}
|
|
299
322
|
removeOpenListeners() {
|
|
300
323
|
document.removeEventListener('focusin', this.handleDocumentFocusIn);
|
|
301
324
|
document.removeEventListener('keydown', this.handleDocumentKeyDown);
|
|
302
325
|
document.removeEventListener('mousedown', this.handleDocumentMouseDown);
|
|
303
326
|
window.removeEventListener('error', this.handleWindowError);
|
|
327
|
+
window.removeEventListener('resize', this.handleWindowResize);
|
|
328
|
+
window.removeEventListener('scroll', this.handleWindowScroll, true);
|
|
304
329
|
}
|
|
305
330
|
handleFocus() {
|
|
306
331
|
this.hasFocus = true;
|
|
@@ -316,7 +341,8 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
316
341
|
const path = event.composedPath();
|
|
317
342
|
const hitSelf = path.includes(this);
|
|
318
343
|
const hitPopup = this.popup && path.includes(this.popup);
|
|
319
|
-
|
|
344
|
+
const hitBodyAppend = this.bodyAppend && this.bodyAppendContainer && path.includes(this.bodyAppendContainer);
|
|
345
|
+
if (!hitSelf && !hitPopup && !hitBodyAppend) {
|
|
320
346
|
this.hide();
|
|
321
347
|
}
|
|
322
348
|
}
|
|
@@ -634,6 +660,10 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
634
660
|
this.showNoResults = false;
|
|
635
661
|
}
|
|
636
662
|
this.requestUpdate();
|
|
663
|
+
// Update body append content if it's active
|
|
664
|
+
if (this.bodyAppend && this.bodyAppendContainer) {
|
|
665
|
+
this.updateBodyAppendContent();
|
|
666
|
+
}
|
|
637
667
|
}
|
|
638
668
|
handleRenderItemConfigChange() {
|
|
639
669
|
if (this.value && this.data.length > 0) {
|
|
@@ -647,15 +677,35 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
647
677
|
this.showNoResults = true;
|
|
648
678
|
}
|
|
649
679
|
this.requestUpdate();
|
|
680
|
+
// Update body append content if it's active
|
|
681
|
+
if (this.bodyAppend && this.bodyAppendContainer) {
|
|
682
|
+
this.updateBodyAppendContent();
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
handleBodyAppendChange() {
|
|
686
|
+
if (this.open) {
|
|
687
|
+
if (this.bodyAppend) {
|
|
688
|
+
this.setupBodyAppend();
|
|
689
|
+
}
|
|
690
|
+
else {
|
|
691
|
+
this.cleanupBodyAppend();
|
|
692
|
+
}
|
|
693
|
+
}
|
|
650
694
|
}
|
|
651
695
|
async handleOpenChange() {
|
|
652
696
|
if (this.open && !this.disabled) {
|
|
653
697
|
await this.handleOpen();
|
|
654
698
|
this.showListbox = true;
|
|
699
|
+
if (this.bodyAppend) {
|
|
700
|
+
this.setupBodyAppend();
|
|
701
|
+
}
|
|
655
702
|
}
|
|
656
703
|
else {
|
|
657
704
|
await this.handleClose();
|
|
658
705
|
this.showListbox = false;
|
|
706
|
+
if (this.bodyAppend) {
|
|
707
|
+
this.cleanupBodyAppend();
|
|
708
|
+
}
|
|
659
709
|
}
|
|
660
710
|
}
|
|
661
711
|
async handleOpen() {
|
|
@@ -998,9 +1048,10 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
998
1048
|
part="listbox"
|
|
999
1049
|
class="select__listbox ${this.searchEnabled
|
|
1000
1050
|
? 'select__search-enabled '
|
|
1001
|
-
: ''}"
|
|
1051
|
+
: ''} ${this.bodyAppend ? 'select__body-append-hidden' : ''}"
|
|
1002
1052
|
tabindex="-1"
|
|
1003
1053
|
@mouseup=${this.handleOptionClick}
|
|
1054
|
+
style=${this.bodyAppend ? 'display: none;' : ''}
|
|
1004
1055
|
>
|
|
1005
1056
|
${this.renderSearch()}
|
|
1006
1057
|
${this.renderLoader()}
|
|
@@ -1169,6 +1220,170 @@ let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
|
|
1169
1220
|
}
|
|
1170
1221
|
});
|
|
1171
1222
|
}
|
|
1223
|
+
createBodyAppendContainer() {
|
|
1224
|
+
const container = document.createElement('div');
|
|
1225
|
+
container.style.position = 'absolute';
|
|
1226
|
+
container.style.zIndex = '9999';
|
|
1227
|
+
container.style.pointerEvents = 'none';
|
|
1228
|
+
container.className = 'nile-virtual-select-body-append';
|
|
1229
|
+
// Apply additional styling to match the original popup
|
|
1230
|
+
container.style.background = 'white';
|
|
1231
|
+
container.style.border = '1px solid #e0e0e0';
|
|
1232
|
+
container.style.borderRadius = '4px';
|
|
1233
|
+
container.style.boxShadow = '0 4px 6px rgba(0, 0, 0, 0.1)';
|
|
1234
|
+
container.style.maxHeight = '300px';
|
|
1235
|
+
container.style.overflow = 'hidden';
|
|
1236
|
+
return container;
|
|
1237
|
+
}
|
|
1238
|
+
createBodyAppendListbox() {
|
|
1239
|
+
const listbox = document.createElement('div');
|
|
1240
|
+
listbox.id = 'listbox';
|
|
1241
|
+
listbox.setAttribute('role', 'listbox');
|
|
1242
|
+
listbox.setAttribute('aria-expanded', this.open ? 'true' : 'false');
|
|
1243
|
+
listbox.setAttribute('aria-multiselectable', this.multiple ? 'true' : 'false');
|
|
1244
|
+
listbox.setAttribute('aria-labelledby', 'label');
|
|
1245
|
+
listbox.setAttribute('part', 'listbox');
|
|
1246
|
+
listbox.className = `select__listbox ${this.searchEnabled ? 'select__search-enabled ' : ''}`;
|
|
1247
|
+
listbox.setAttribute('tabindex', '-1');
|
|
1248
|
+
// Apply styling to match the original listbox
|
|
1249
|
+
listbox.style.background = 'white';
|
|
1250
|
+
listbox.style.border = 'none';
|
|
1251
|
+
listbox.style.borderRadius = '4px';
|
|
1252
|
+
listbox.style.maxHeight = '300px';
|
|
1253
|
+
listbox.style.overflowY = 'auto';
|
|
1254
|
+
listbox.addEventListener('mouseup', this.handleOptionClick.bind(this));
|
|
1255
|
+
return listbox;
|
|
1256
|
+
}
|
|
1257
|
+
positionBodyAppend() {
|
|
1258
|
+
if (!this.bodyAppendContainer || !this.popup)
|
|
1259
|
+
return;
|
|
1260
|
+
const rect = this.getBoundingClientRect();
|
|
1261
|
+
// Position the body append container to match the popup position
|
|
1262
|
+
this.bodyAppendContainer.style.left = `${rect.left}px`;
|
|
1263
|
+
this.bodyAppendContainer.style.top = `${rect.bottom + 6}px`; // 6px is the distance from the popup
|
|
1264
|
+
this.bodyAppendContainer.style.width = `${rect.width}px`;
|
|
1265
|
+
this.bodyAppendContainer.style.pointerEvents = 'auto';
|
|
1266
|
+
}
|
|
1267
|
+
updateBodyAppendPosition() {
|
|
1268
|
+
if (this.bodyAppend && this.bodyAppendContainer) {
|
|
1269
|
+
this.positionBodyAppend();
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
async updateBodyAppendContent() {
|
|
1273
|
+
if (!this.bodyAppendListbox)
|
|
1274
|
+
return;
|
|
1275
|
+
// Clear the body append listbox
|
|
1276
|
+
this.bodyAppendListbox.innerHTML = '';
|
|
1277
|
+
// Create a new listbox element
|
|
1278
|
+
const listbox = document.createElement('div');
|
|
1279
|
+
listbox.id = 'listbox';
|
|
1280
|
+
listbox.setAttribute('role', 'listbox');
|
|
1281
|
+
listbox.setAttribute('aria-expanded', this.open ? 'true' : 'false');
|
|
1282
|
+
listbox.setAttribute('aria-multiselectable', this.multiple ? 'true' : 'false');
|
|
1283
|
+
listbox.setAttribute('aria-labelledby', 'label');
|
|
1284
|
+
listbox.setAttribute('part', 'listbox');
|
|
1285
|
+
listbox.className = `select__listbox ${this.searchEnabled ? 'select__search-enabled ' : ''}`;
|
|
1286
|
+
listbox.setAttribute('tabindex', '-1');
|
|
1287
|
+
// Render the content using Lit's render function
|
|
1288
|
+
const { render } = await import('lit');
|
|
1289
|
+
// Render search
|
|
1290
|
+
if (this.searchEnabled) {
|
|
1291
|
+
const searchContent = this.renderSearch();
|
|
1292
|
+
const searchDiv = document.createElement('div');
|
|
1293
|
+
render(searchContent, searchDiv);
|
|
1294
|
+
listbox.appendChild(searchDiv.firstElementChild);
|
|
1295
|
+
}
|
|
1296
|
+
// Render loader
|
|
1297
|
+
const loaderContent = this.renderLoader();
|
|
1298
|
+
const loaderDiv = document.createElement('div');
|
|
1299
|
+
render(loaderContent, loaderDiv);
|
|
1300
|
+
if (loaderDiv.firstElementChild) {
|
|
1301
|
+
listbox.appendChild(loaderDiv.firstElementChild);
|
|
1302
|
+
}
|
|
1303
|
+
// Render virtualized content
|
|
1304
|
+
const virtualizedContent = this.getVirtualizedContent();
|
|
1305
|
+
const virtualizedDiv = document.createElement('div');
|
|
1306
|
+
render(virtualizedContent, virtualizedDiv);
|
|
1307
|
+
if (virtualizedDiv.firstElementChild) {
|
|
1308
|
+
listbox.appendChild(virtualizedDiv.firstElementChild);
|
|
1309
|
+
}
|
|
1310
|
+
// Render footer
|
|
1311
|
+
if (this.multiple) {
|
|
1312
|
+
const footerContent = this.renderFooter();
|
|
1313
|
+
const footerDiv = document.createElement('div');
|
|
1314
|
+
render(footerContent, footerDiv);
|
|
1315
|
+
if (footerDiv.firstElementChild) {
|
|
1316
|
+
listbox.appendChild(footerDiv.firstElementChild);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
// Append the listbox to the body append container
|
|
1320
|
+
this.bodyAppendListbox.appendChild(listbox);
|
|
1321
|
+
// Re-attach event listeners
|
|
1322
|
+
this.attachBodyAppendEventListeners();
|
|
1323
|
+
}
|
|
1324
|
+
attachBodyAppendEventListeners() {
|
|
1325
|
+
if (!this.bodyAppendListbox)
|
|
1326
|
+
return;
|
|
1327
|
+
// Find the cloned listbox within the body append container
|
|
1328
|
+
const clonedListbox = this.bodyAppendListbox.querySelector('.select__listbox');
|
|
1329
|
+
if (!clonedListbox)
|
|
1330
|
+
return;
|
|
1331
|
+
// Re-attach the option click handler - use event delegation for better performance
|
|
1332
|
+
clonedListbox.addEventListener('mouseup', this.handleOptionClick.bind(this));
|
|
1333
|
+
// Also add click handler for nile-option elements specifically
|
|
1334
|
+
clonedListbox.addEventListener('click', (event) => {
|
|
1335
|
+
const target = event.target;
|
|
1336
|
+
const option = target.closest('nile-option');
|
|
1337
|
+
if (option) {
|
|
1338
|
+
event.preventDefault();
|
|
1339
|
+
event.stopPropagation();
|
|
1340
|
+
this.handleOptionClick(event);
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
// Re-attach search handlers if search is enabled
|
|
1344
|
+
const searchInput = clonedListbox.querySelector('nile-input');
|
|
1345
|
+
if (searchInput) {
|
|
1346
|
+
searchInput.addEventListener('nile-input', this.handleSearchChange.bind(this));
|
|
1347
|
+
searchInput.addEventListener('nile-focus', this.handleSearchFocus.bind(this));
|
|
1348
|
+
searchInput.addEventListener('nile-change', this.onInputChange.bind(this));
|
|
1349
|
+
}
|
|
1350
|
+
// Re-attach scroll handler
|
|
1351
|
+
const virtualizedContainer = clonedListbox.querySelector('.virtualized');
|
|
1352
|
+
if (virtualizedContainer) {
|
|
1353
|
+
virtualizedContainer.addEventListener('scroll', this.handleScroll.bind(this));
|
|
1354
|
+
}
|
|
1355
|
+
// Re-attach footer handlers if multiple
|
|
1356
|
+
if (this.multiple) {
|
|
1357
|
+
const showSelectedSpan = clonedListbox.querySelector('.select__footer span[style*="cursor: pointer"]');
|
|
1358
|
+
if (showSelectedSpan) {
|
|
1359
|
+
showSelectedSpan.addEventListener('click', this.toggleShowSelected.bind(this));
|
|
1360
|
+
}
|
|
1361
|
+
const clearSpan = clonedListbox.querySelector('.select__clear');
|
|
1362
|
+
if (clearSpan) {
|
|
1363
|
+
clearSpan.addEventListener('click', this.unSelectAll.bind(this));
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
setupBodyAppend() {
|
|
1368
|
+
if (!this.bodyAppend)
|
|
1369
|
+
return;
|
|
1370
|
+
this.bodyAppendContainer = this.createBodyAppendContainer();
|
|
1371
|
+
this.bodyAppendListbox = this.createBodyAppendListbox();
|
|
1372
|
+
this.bodyAppendContainer.appendChild(this.bodyAppendListbox);
|
|
1373
|
+
document.body.appendChild(this.bodyAppendContainer);
|
|
1374
|
+
this.positionBodyAppend();
|
|
1375
|
+
// Wait for the next tick to ensure the original listbox is rendered
|
|
1376
|
+
this.updateComplete.then(async () => {
|
|
1377
|
+
await this.updateBodyAppendContent();
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
cleanupBodyAppend() {
|
|
1381
|
+
if (this.bodyAppendContainer && this.bodyAppendContainer.parentNode) {
|
|
1382
|
+
this.bodyAppendContainer.parentNode.removeChild(this.bodyAppendContainer);
|
|
1383
|
+
}
|
|
1384
|
+
this.bodyAppendContainer = null;
|
|
1385
|
+
this.bodyAppendListbox = null;
|
|
1386
|
+
}
|
|
1172
1387
|
};
|
|
1173
1388
|
NileVirtualSelect.styles = styles;
|
|
1174
1389
|
__decorate([
|
|
@@ -1308,6 +1523,9 @@ __decorate([
|
|
|
1308
1523
|
__decorate([
|
|
1309
1524
|
property({ type: Boolean, reflect: true })
|
|
1310
1525
|
], NileVirtualSelect.prototype, "noWidthSync", void 0);
|
|
1526
|
+
__decorate([
|
|
1527
|
+
property({ type: Boolean, reflect: true })
|
|
1528
|
+
], NileVirtualSelect.prototype, "bodyAppend", void 0);
|
|
1311
1529
|
__decorate([
|
|
1312
1530
|
property({ attribute: 'max-options-visible', type: Number })
|
|
1313
1531
|
], NileVirtualSelect.prototype, "maxOptionsVisible", void 0);
|
|
@@ -1317,6 +1535,12 @@ __decorate([
|
|
|
1317
1535
|
__decorate([
|
|
1318
1536
|
state()
|
|
1319
1537
|
], NileVirtualSelect.prototype, "showListbox", void 0);
|
|
1538
|
+
__decorate([
|
|
1539
|
+
state()
|
|
1540
|
+
], NileVirtualSelect.prototype, "bodyAppendContainer", void 0);
|
|
1541
|
+
__decorate([
|
|
1542
|
+
state()
|
|
1543
|
+
], NileVirtualSelect.prototype, "bodyAppendListbox", void 0);
|
|
1320
1544
|
__decorate([
|
|
1321
1545
|
watch('disabled', { waitUntilFirstUpdate: true })
|
|
1322
1546
|
], NileVirtualSelect.prototype, "handleDisabledChange", null);
|
|
@@ -1332,6 +1556,9 @@ __decorate([
|
|
|
1332
1556
|
__decorate([
|
|
1333
1557
|
watch('optionsLoading', { waitUntilFirstUpdate: true })
|
|
1334
1558
|
], NileVirtualSelect.prototype, "handleOptionsLoadingChange", null);
|
|
1559
|
+
__decorate([
|
|
1560
|
+
watch('bodyAppend', { waitUntilFirstUpdate: true })
|
|
1561
|
+
], NileVirtualSelect.prototype, "handleBodyAppendChange", null);
|
|
1335
1562
|
__decorate([
|
|
1336
1563
|
watch('open', { waitUntilFirstUpdate: true })
|
|
1337
1564
|
], NileVirtualSelect.prototype, "handleOpenChange", null);
|