@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BehaviorSubject, Subject, isObservable, fromEvent, merge } from 'rxjs';
|
|
2
2
|
import { distinctUntilChanged, map, throttleTime, takeUntil, tap, debounceTime } from 'rxjs/operators';
|
|
3
|
+
import { __awaiter } from 'tslib';
|
|
3
4
|
import * as i0 from '@angular/core';
|
|
4
5
|
import { EventEmitter, ElementRef, Component, Input, Output, ViewChild, HostListener, Injectable, ChangeDetectionStrategy, Directive, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
5
6
|
import * as i1 from '@angular/common';
|
|
@@ -7,7 +8,6 @@ import { CommonModule } from '@angular/common';
|
|
|
7
8
|
import Ajv from 'ajv';
|
|
8
9
|
import * as i1$1 from '@angular/forms';
|
|
9
10
|
import { Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
10
|
-
import { __awaiter } from 'tslib';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Base type definitions for cell configuration model
|
|
@@ -3678,10 +3678,6 @@ class NileInputEditor {
|
|
|
3678
3678
|
}
|
|
3679
3679
|
}
|
|
3680
3680
|
|
|
3681
|
-
/**
|
|
3682
|
-
* Custom editor using NileSelect from @aquera/nile-elements
|
|
3683
|
-
* This demonstrates how to create dropdown/select editors for ngx-smart-table
|
|
3684
|
-
*/
|
|
3685
3681
|
/**
|
|
3686
3682
|
* Inject global styles for nile-select dropdown height limit
|
|
3687
3683
|
*/
|
|
@@ -3814,16 +3810,137 @@ class NileSelectEditor {
|
|
|
3814
3810
|
// Clear container and append select
|
|
3815
3811
|
context.container.innerHTML = '';
|
|
3816
3812
|
context.container.appendChild(this.select);
|
|
3817
|
-
// Focus
|
|
3813
|
+
// Focus after mount; open dropdown only once nile-popup exists (avoids null this.popup in nile-select)
|
|
3814
|
+
const openOnEdit = this.options.openDropdownOnEdit !== false;
|
|
3818
3815
|
setTimeout(() => {
|
|
3819
|
-
|
|
3816
|
+
void this.activateSelectAfterMount(openOnEdit);
|
|
3817
|
+
}, 50);
|
|
3818
|
+
}
|
|
3819
|
+
activateSelectAfterMount(openOnEdit) {
|
|
3820
|
+
var _a;
|
|
3821
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3820
3822
|
try {
|
|
3821
3823
|
(_a = this.select) === null || _a === void 0 ? void 0 : _a.focus();
|
|
3822
3824
|
}
|
|
3823
|
-
catch (
|
|
3824
|
-
//
|
|
3825
|
+
catch (_b) {
|
|
3826
|
+
// ignore
|
|
3825
3827
|
}
|
|
3826
|
-
|
|
3828
|
+
if (!openOnEdit || !this.select || this.options.disabled) {
|
|
3829
|
+
return;
|
|
3830
|
+
}
|
|
3831
|
+
yield this.openNileSelectDropdownSafely();
|
|
3832
|
+
});
|
|
3833
|
+
}
|
|
3834
|
+
/** Lit @query('nile-popup') / .select — must exist before handleOpenChange touches this.popup.popup */
|
|
3835
|
+
isNileSelectPopupMounted(select) {
|
|
3836
|
+
var _a;
|
|
3837
|
+
return !!((_a = select.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('nile-popup'));
|
|
3838
|
+
}
|
|
3839
|
+
invokeShowHandlingPromise(host) {
|
|
3840
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3841
|
+
if (typeof host.show !== 'function') {
|
|
3842
|
+
return;
|
|
3843
|
+
}
|
|
3844
|
+
try {
|
|
3845
|
+
const out = host.show();
|
|
3846
|
+
if (out != null && typeof out.then === 'function') {
|
|
3847
|
+
yield out.catch(() => undefined);
|
|
3848
|
+
}
|
|
3849
|
+
}
|
|
3850
|
+
catch (_a) {
|
|
3851
|
+
// sync throw from show()
|
|
3852
|
+
}
|
|
3853
|
+
});
|
|
3854
|
+
}
|
|
3855
|
+
openNileSelectDropdownSafely() {
|
|
3856
|
+
var _a, _b, _c, _d;
|
|
3857
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3858
|
+
const select = this.select;
|
|
3859
|
+
if (!select) {
|
|
3860
|
+
return;
|
|
3861
|
+
}
|
|
3862
|
+
try {
|
|
3863
|
+
yield customElements.whenDefined('nile-select');
|
|
3864
|
+
}
|
|
3865
|
+
catch (_e) {
|
|
3866
|
+
// ignore
|
|
3867
|
+
}
|
|
3868
|
+
if (this.options.enableVirtualScroll) {
|
|
3869
|
+
try {
|
|
3870
|
+
yield customElements.whenDefined('nile-virtual-select');
|
|
3871
|
+
}
|
|
3872
|
+
catch (_f) {
|
|
3873
|
+
// ignore — not registered in all environments
|
|
3874
|
+
}
|
|
3875
|
+
// Same idea as nile-popup: inner host may not exist until Lit finishes a pass (or several).
|
|
3876
|
+
const maxVirtualWaitPasses = 50;
|
|
3877
|
+
for (let i = 0; i < maxVirtualWaitPasses; i++) {
|
|
3878
|
+
const vs = (_a = select.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('nile-virtual-select');
|
|
3879
|
+
if (vs) {
|
|
3880
|
+
yield this.invokeShowHandlingPromise(vs);
|
|
3881
|
+
return;
|
|
3882
|
+
}
|
|
3883
|
+
const lit = select;
|
|
3884
|
+
if ((_b = lit.updateComplete) === null || _b === void 0 ? void 0 : _b.then) {
|
|
3885
|
+
try {
|
|
3886
|
+
yield lit.updateComplete;
|
|
3887
|
+
}
|
|
3888
|
+
catch (_g) {
|
|
3889
|
+
// ignore
|
|
3890
|
+
}
|
|
3891
|
+
}
|
|
3892
|
+
yield new Promise(resolve => requestAnimationFrame(() => resolve()));
|
|
3893
|
+
}
|
|
3894
|
+
return;
|
|
3895
|
+
}
|
|
3896
|
+
const maxWaitPasses = 50;
|
|
3897
|
+
for (let i = 0; i < maxWaitPasses; i++) {
|
|
3898
|
+
if (this.isNileSelectPopupMounted(select)) {
|
|
3899
|
+
break;
|
|
3900
|
+
}
|
|
3901
|
+
const lit = select;
|
|
3902
|
+
if ((_c = lit.updateComplete) === null || _c === void 0 ? void 0 : _c.then) {
|
|
3903
|
+
try {
|
|
3904
|
+
yield lit.updateComplete;
|
|
3905
|
+
}
|
|
3906
|
+
catch (_h) {
|
|
3907
|
+
// ignore
|
|
3908
|
+
}
|
|
3909
|
+
}
|
|
3910
|
+
yield new Promise(resolve => requestAnimationFrame(() => resolve()));
|
|
3911
|
+
}
|
|
3912
|
+
if (!this.isNileSelectPopupMounted(select)) {
|
|
3913
|
+
return;
|
|
3914
|
+
}
|
|
3915
|
+
const host = select;
|
|
3916
|
+
for (let attempt = 0; attempt < 5; attempt++) {
|
|
3917
|
+
if (!this.isNileSelectPopupMounted(select)) {
|
|
3918
|
+
return;
|
|
3919
|
+
}
|
|
3920
|
+
try {
|
|
3921
|
+
if (typeof host.show === 'function') {
|
|
3922
|
+
yield this.invokeShowHandlingPromise(host);
|
|
3923
|
+
}
|
|
3924
|
+
else {
|
|
3925
|
+
host.open = true;
|
|
3926
|
+
}
|
|
3927
|
+
return;
|
|
3928
|
+
}
|
|
3929
|
+
catch (_j) {
|
|
3930
|
+
// ignore
|
|
3931
|
+
}
|
|
3932
|
+
yield new Promise(resolve => setTimeout(resolve, 40));
|
|
3933
|
+
const lit = select;
|
|
3934
|
+
if ((_d = lit.updateComplete) === null || _d === void 0 ? void 0 : _d.then) {
|
|
3935
|
+
try {
|
|
3936
|
+
yield lit.updateComplete;
|
|
3937
|
+
}
|
|
3938
|
+
catch (_k) {
|
|
3939
|
+
// ignore
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
});
|
|
3827
3944
|
}
|
|
3828
3945
|
/**
|
|
3829
3946
|
* Set the initial value for the select
|
|
@@ -6333,8 +6450,14 @@ class StCellComponent {
|
|
|
6333
6450
|
}
|
|
6334
6451
|
}
|
|
6335
6452
|
onCellClick() {
|
|
6336
|
-
//
|
|
6337
|
-
//
|
|
6453
|
+
// First click: parent <td> focuses this cell (bubbles after this handler).
|
|
6454
|
+
// Second click while already focused: enter edit (spreadsheet-style).
|
|
6455
|
+
if (this.isEditable &&
|
|
6456
|
+
!this.cellLoading &&
|
|
6457
|
+
!this.cell.isEditing() &&
|
|
6458
|
+
this.cell.isFocused()) {
|
|
6459
|
+
this.startEdit();
|
|
6460
|
+
}
|
|
6338
6461
|
}
|
|
6339
6462
|
onCellDoubleClick() {
|
|
6340
6463
|
// Double-click starts editing regardless of EditMode (Excel-like behavior)
|