@aquera/ngx-smart-table 0.0.17-patch-0.7 → 0.0.17-patch-0.8
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 +119 -6
- package/esm2020/lib/renderer/components/st-cell/st-cell.component.mjs +9 -3
- package/fesm2015/aquera-ngx-smart-table.mjs +135 -12
- package/fesm2015/aquera-ngx-smart-table.mjs.map +1 -1
- package/fesm2020/aquera-ngx-smart-table.mjs +126 -7
- package/fesm2020/aquera-ngx-smart-table.mjs.map +1 -1
- package/lib/editors/nile-select-editor.d.ts +11 -0
- package/package.json +1 -1
|
@@ -3889,15 +3889,128 @@ class NileSelectEditor {
|
|
|
3889
3889
|
// Clear container and append select
|
|
3890
3890
|
context.container.innerHTML = '';
|
|
3891
3891
|
context.container.appendChild(this.select);
|
|
3892
|
-
// Focus
|
|
3892
|
+
// Focus after mount; open dropdown only once nile-popup exists (avoids null this.popup in nile-select)
|
|
3893
|
+
const openOnEdit = this.options.openDropdownOnEdit !== false;
|
|
3893
3894
|
setTimeout(() => {
|
|
3895
|
+
void this.activateSelectAfterMount(openOnEdit);
|
|
3896
|
+
}, 50);
|
|
3897
|
+
}
|
|
3898
|
+
async activateSelectAfterMount(openOnEdit) {
|
|
3899
|
+
try {
|
|
3900
|
+
this.select?.focus();
|
|
3901
|
+
}
|
|
3902
|
+
catch {
|
|
3903
|
+
// ignore
|
|
3904
|
+
}
|
|
3905
|
+
if (!openOnEdit || !this.select || this.options.disabled) {
|
|
3906
|
+
return;
|
|
3907
|
+
}
|
|
3908
|
+
await this.openNileSelectDropdownSafely();
|
|
3909
|
+
}
|
|
3910
|
+
/** Lit @query('nile-popup') / .select — must exist before handleOpenChange touches this.popup.popup */
|
|
3911
|
+
isNileSelectPopupMounted(select) {
|
|
3912
|
+
return !!select.shadowRoot?.querySelector('nile-popup');
|
|
3913
|
+
}
|
|
3914
|
+
async invokeShowHandlingPromise(host) {
|
|
3915
|
+
if (typeof host.show !== 'function') {
|
|
3916
|
+
return;
|
|
3917
|
+
}
|
|
3918
|
+
try {
|
|
3919
|
+
const out = host.show();
|
|
3920
|
+
if (out != null && typeof out.then === 'function') {
|
|
3921
|
+
await out.catch(() => undefined);
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
catch {
|
|
3925
|
+
// sync throw from show()
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
async openNileSelectDropdownSafely() {
|
|
3929
|
+
const select = this.select;
|
|
3930
|
+
if (!select) {
|
|
3931
|
+
return;
|
|
3932
|
+
}
|
|
3933
|
+
try {
|
|
3934
|
+
await customElements.whenDefined('nile-select');
|
|
3935
|
+
}
|
|
3936
|
+
catch {
|
|
3937
|
+
// ignore
|
|
3938
|
+
}
|
|
3939
|
+
if (this.options.enableVirtualScroll) {
|
|
3894
3940
|
try {
|
|
3895
|
-
|
|
3941
|
+
await customElements.whenDefined('nile-virtual-select');
|
|
3896
3942
|
}
|
|
3897
|
-
catch
|
|
3898
|
-
//
|
|
3943
|
+
catch {
|
|
3944
|
+
// ignore — not registered in all environments
|
|
3945
|
+
}
|
|
3946
|
+
// Same idea as nile-popup: inner host may not exist until Lit finishes a pass (or several).
|
|
3947
|
+
const maxVirtualWaitPasses = 50;
|
|
3948
|
+
for (let i = 0; i < maxVirtualWaitPasses; i++) {
|
|
3949
|
+
const vs = select.shadowRoot?.querySelector('nile-virtual-select');
|
|
3950
|
+
if (vs) {
|
|
3951
|
+
await this.invokeShowHandlingPromise(vs);
|
|
3952
|
+
return;
|
|
3953
|
+
}
|
|
3954
|
+
const lit = select;
|
|
3955
|
+
if (lit.updateComplete?.then) {
|
|
3956
|
+
try {
|
|
3957
|
+
await lit.updateComplete;
|
|
3958
|
+
}
|
|
3959
|
+
catch {
|
|
3960
|
+
// ignore
|
|
3961
|
+
}
|
|
3962
|
+
}
|
|
3963
|
+
await new Promise(resolve => requestAnimationFrame(() => resolve()));
|
|
3899
3964
|
}
|
|
3900
|
-
|
|
3965
|
+
return;
|
|
3966
|
+
}
|
|
3967
|
+
const maxWaitPasses = 50;
|
|
3968
|
+
for (let i = 0; i < maxWaitPasses; i++) {
|
|
3969
|
+
if (this.isNileSelectPopupMounted(select)) {
|
|
3970
|
+
break;
|
|
3971
|
+
}
|
|
3972
|
+
const lit = select;
|
|
3973
|
+
if (lit.updateComplete?.then) {
|
|
3974
|
+
try {
|
|
3975
|
+
await lit.updateComplete;
|
|
3976
|
+
}
|
|
3977
|
+
catch {
|
|
3978
|
+
// ignore
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
await new Promise(resolve => requestAnimationFrame(() => resolve()));
|
|
3982
|
+
}
|
|
3983
|
+
if (!this.isNileSelectPopupMounted(select)) {
|
|
3984
|
+
return;
|
|
3985
|
+
}
|
|
3986
|
+
const host = select;
|
|
3987
|
+
for (let attempt = 0; attempt < 5; attempt++) {
|
|
3988
|
+
if (!this.isNileSelectPopupMounted(select)) {
|
|
3989
|
+
return;
|
|
3990
|
+
}
|
|
3991
|
+
try {
|
|
3992
|
+
if (typeof host.show === 'function') {
|
|
3993
|
+
await this.invokeShowHandlingPromise(host);
|
|
3994
|
+
}
|
|
3995
|
+
else {
|
|
3996
|
+
host.open = true;
|
|
3997
|
+
}
|
|
3998
|
+
return;
|
|
3999
|
+
}
|
|
4000
|
+
catch {
|
|
4001
|
+
// ignore
|
|
4002
|
+
}
|
|
4003
|
+
await new Promise(resolve => setTimeout(resolve, 40));
|
|
4004
|
+
const lit = select;
|
|
4005
|
+
if (lit.updateComplete?.then) {
|
|
4006
|
+
try {
|
|
4007
|
+
await lit.updateComplete;
|
|
4008
|
+
}
|
|
4009
|
+
catch {
|
|
4010
|
+
// ignore
|
|
4011
|
+
}
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
3901
4014
|
}
|
|
3902
4015
|
/**
|
|
3903
4016
|
* Set the initial value for the select
|
|
@@ -6384,8 +6497,14 @@ class StCellComponent {
|
|
|
6384
6497
|
}
|
|
6385
6498
|
}
|
|
6386
6499
|
onCellClick() {
|
|
6387
|
-
//
|
|
6388
|
-
//
|
|
6500
|
+
// First click: parent <td> focuses this cell (bubbles after this handler).
|
|
6501
|
+
// Second click while already focused: enter edit (spreadsheet-style).
|
|
6502
|
+
if (this.isEditable &&
|
|
6503
|
+
!this.cellLoading &&
|
|
6504
|
+
!this.cell.isEditing() &&
|
|
6505
|
+
this.cell.isFocused()) {
|
|
6506
|
+
this.startEdit();
|
|
6507
|
+
}
|
|
6389
6508
|
}
|
|
6390
6509
|
onCellDoubleClick() {
|
|
6391
6510
|
// Double-click starts editing regardless of EditMode (Excel-like behavior)
|