@aquera/ngx-smart-table 0.0.5-alpha → 0.0.6-alpha
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/esm2020/lib/editors/nile-select-editor.mjs +52 -3
- package/fesm2015/aquera-ngx-smart-table.mjs +52 -2
- package/fesm2015/aquera-ngx-smart-table.mjs.map +1 -1
- package/fesm2020/aquera-ngx-smart-table.mjs +51 -2
- package/fesm2020/aquera-ngx-smart-table.mjs.map +1 -1
- package/lib/editors/nile-select-editor.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3626,6 +3626,11 @@ class NileSelectEditor {
|
|
|
3626
3626
|
setTimeout(() => {
|
|
3627
3627
|
this.select?.focus();
|
|
3628
3628
|
this.select?.click();
|
|
3629
|
+
// Find the portal div for multi-select click detection
|
|
3630
|
+
if (this.options.multiple) {
|
|
3631
|
+
// Portal div is appended to document body
|
|
3632
|
+
this.portalDiv = document.querySelector('.nile-select-portal-append');
|
|
3633
|
+
}
|
|
3629
3634
|
}, 0);
|
|
3630
3635
|
}
|
|
3631
3636
|
/**
|
|
@@ -3724,6 +3729,9 @@ class NileSelectEditor {
|
|
|
3724
3729
|
if (this.options.portal !== undefined) {
|
|
3725
3730
|
this.select.portal = this.options.portal;
|
|
3726
3731
|
}
|
|
3732
|
+
else {
|
|
3733
|
+
this.select.portal = true; // Default to portal mode for better positioning
|
|
3734
|
+
}
|
|
3727
3735
|
// Prevent width syncing issues in table cells
|
|
3728
3736
|
this.select.noWidthSync = true;
|
|
3729
3737
|
}
|
|
@@ -3801,7 +3809,11 @@ class NileSelectEditor {
|
|
|
3801
3809
|
this.select?.reportValidity();
|
|
3802
3810
|
return;
|
|
3803
3811
|
}
|
|
3804
|
-
|
|
3812
|
+
// Only save immediately for single-select
|
|
3813
|
+
// Multi-select saves on outside click
|
|
3814
|
+
if (!this.options.multiple) {
|
|
3815
|
+
context.onSave(this.parseValue(customEvent.detail.value));
|
|
3816
|
+
}
|
|
3805
3817
|
};
|
|
3806
3818
|
this.select.addEventListener('nile-change', changeHandler);
|
|
3807
3819
|
this.eventListeners.push({ event: 'nile-change', handler: changeHandler });
|
|
@@ -3833,6 +3845,35 @@ class NileSelectEditor {
|
|
|
3833
3845
|
this.select.addEventListener('nile-search', searchHandler);
|
|
3834
3846
|
this.eventListeners.push({ event: 'nile-search', handler: searchHandler });
|
|
3835
3847
|
}
|
|
3848
|
+
// For multi-select: detect clicks outside portal and select
|
|
3849
|
+
if (this.options.multiple) {
|
|
3850
|
+
const documentClickHandler = (e) => {
|
|
3851
|
+
const mouseEvent = e;
|
|
3852
|
+
const target = mouseEvent.target;
|
|
3853
|
+
// Check if portal div exists (might take a moment to render)
|
|
3854
|
+
if (!this.portalDiv) {
|
|
3855
|
+
this.portalDiv = document.querySelector('.nile-select-portal-append');
|
|
3856
|
+
}
|
|
3857
|
+
// Determine if click is inside the select or portal
|
|
3858
|
+
const clickedInsideSelect = this.select?.contains(target);
|
|
3859
|
+
const clickedInsidePortal = this.portalDiv?.contains(target);
|
|
3860
|
+
// If clicked outside both select and portal, save and close
|
|
3861
|
+
if (!clickedInsideSelect && !clickedInsidePortal) {
|
|
3862
|
+
if (validateOnSave && !this.select?.checkValidity()) {
|
|
3863
|
+
this.select?.reportValidity();
|
|
3864
|
+
return;
|
|
3865
|
+
}
|
|
3866
|
+
context.onSave(this.getCurrentValue());
|
|
3867
|
+
}
|
|
3868
|
+
// Otherwise, click is inside - do nothing (dropdown stays open)
|
|
3869
|
+
};
|
|
3870
|
+
// Add to document with capture phase
|
|
3871
|
+
document.addEventListener('click', documentClickHandler, true);
|
|
3872
|
+
this.eventListeners.push({
|
|
3873
|
+
event: 'document-click',
|
|
3874
|
+
handler: documentClickHandler
|
|
3875
|
+
});
|
|
3876
|
+
}
|
|
3836
3877
|
}
|
|
3837
3878
|
/**
|
|
3838
3879
|
* Parse value based on selection mode
|
|
@@ -3860,11 +3901,19 @@ class NileSelectEditor {
|
|
|
3860
3901
|
// Remove all event listeners
|
|
3861
3902
|
if (this.select) {
|
|
3862
3903
|
this.eventListeners.forEach(({ event, handler }) => {
|
|
3863
|
-
|
|
3904
|
+
if (event === 'document-click') {
|
|
3905
|
+
// Remove from document for multi-select click handler
|
|
3906
|
+
document.removeEventListener('click', handler, true);
|
|
3907
|
+
}
|
|
3908
|
+
else {
|
|
3909
|
+
// Remove from select element
|
|
3910
|
+
this.select?.removeEventListener(event, handler);
|
|
3911
|
+
}
|
|
3864
3912
|
});
|
|
3865
3913
|
this.eventListeners = [];
|
|
3866
3914
|
this.select.remove();
|
|
3867
3915
|
this.select = undefined;
|
|
3916
|
+
this.portalDiv = undefined; // Clean up portal reference
|
|
3868
3917
|
}
|
|
3869
3918
|
}
|
|
3870
3919
|
focus() {
|