@iyulab/flex-table 0.48.6 → 0.49.1
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/CHANGELOG.md +38 -0
- package/README.md +12 -1
- package/dist/events.d.ts +199 -0
- package/dist/{flex-table-CoqeYojZ.js → flex-table-CpAhHipx.js} +210 -332
- package/dist/flex-table.d.ts +31 -0
- package/dist/flex-table.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/react.d.ts +32 -31
- package/dist/react.js +1 -1
- package/package.json +2 -1
- package/skills/iyulab-flex-table/references/api.md +2 -0
- package/dist/array/use-array-source.hooks.test.d.ts +0 -1
- package/dist/array/use-array-source.test.d.ts +0 -1
- package/dist/clipboard/clipboard.test.d.ts +0 -1
- package/dist/core/filtering.test.d.ts +0 -1
- package/dist/core/selection.test.d.ts +0 -1
- package/dist/core/sorting.test.d.ts +0 -1
- package/dist/core/undo.test.d.ts +0 -1
- package/dist/export/export.test.d.ts +0 -1
- package/dist/export/xlsx-deflate.test.d.ts +0 -1
- package/dist/export/xlsx-reader.test.d.ts +0 -1
- package/dist/flex-table.test.d.ts +0 -1
- package/dist/odata/index.test.d.ts +0 -1
- package/dist/odata/use-odata-source.hooks.test.d.ts +0 -1
- package/dist/odata/use-odata-source.test.d.ts +0 -1
- package/dist/react-events.test.d.ts +0 -1
- package/dist/renderers/format.test.d.ts +0 -1
- package/dist/styles/density-tokens.test.d.ts +0 -1
- package/dist/styles/token-derivation.test.d.ts +0 -1
|
@@ -1973,14 +1973,10 @@ var K = {
|
|
|
1973
1973
|
}
|
|
1974
1974
|
_dispatchRowSelectionEvent() {
|
|
1975
1975
|
let { selectedIndices: e, selectedRows: t } = this.getSelectedRows();
|
|
1976
|
-
this.
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
},
|
|
1981
|
-
bubbles: !0,
|
|
1982
|
-
composed: !0
|
|
1983
|
-
}));
|
|
1976
|
+
this._emit("selection-change", {
|
|
1977
|
+
selectedIndices: e,
|
|
1978
|
+
selectedRows: t
|
|
1979
|
+
});
|
|
1984
1980
|
}
|
|
1985
1981
|
setFilter(e, t) {
|
|
1986
1982
|
this._filters = this._filters.filter((t) => t.key !== e), this._filters.push({
|
|
@@ -2010,25 +2006,26 @@ var K = {
|
|
|
2010
2006
|
clearUndoHistory() {
|
|
2011
2007
|
this._undo.clear(), this._dispatchUndoStateEvent();
|
|
2012
2008
|
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
detail:
|
|
2016
|
-
canUndo: this.canUndo,
|
|
2017
|
-
canRedo: this.canRedo
|
|
2018
|
-
},
|
|
2009
|
+
_emit(e, t, n) {
|
|
2010
|
+
let r = new CustomEvent(e, {
|
|
2011
|
+
detail: t,
|
|
2019
2012
|
bubbles: !0,
|
|
2020
|
-
composed: !0
|
|
2021
|
-
|
|
2013
|
+
composed: !0,
|
|
2014
|
+
...n
|
|
2015
|
+
});
|
|
2016
|
+
return this.dispatchEvent(r), r;
|
|
2017
|
+
}
|
|
2018
|
+
_dispatchUndoStateEvent() {
|
|
2019
|
+
this._emit("undo-state-change", {
|
|
2020
|
+
canUndo: this.canUndo,
|
|
2021
|
+
canRedo: this.canRedo
|
|
2022
|
+
});
|
|
2022
2023
|
}
|
|
2023
2024
|
_dispatchFilterEvent() {
|
|
2024
|
-
this.
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
},
|
|
2029
|
-
bubbles: !0,
|
|
2030
|
-
composed: !0
|
|
2031
|
-
}));
|
|
2025
|
+
this._emit("filter-change", {
|
|
2026
|
+
keys: this.filterKeys,
|
|
2027
|
+
filteredCount: this.filteredRowCount
|
|
2028
|
+
});
|
|
2032
2029
|
}
|
|
2033
2030
|
addColumn(e, t) {
|
|
2034
2031
|
let n = t ?? this.columns.length;
|
|
@@ -2048,14 +2045,10 @@ var K = {
|
|
|
2048
2045
|
...this.columns.slice(n)
|
|
2049
2046
|
], this.requestUpdate();
|
|
2050
2047
|
}
|
|
2051
|
-
}), this.requestUpdate(), this.
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
},
|
|
2056
|
-
bubbles: !0,
|
|
2057
|
-
composed: !0
|
|
2058
|
-
})), this._dispatchUndoStateEvent(), e;
|
|
2048
|
+
}), this.requestUpdate(), this._emit("column-add", {
|
|
2049
|
+
column: e,
|
|
2050
|
+
index: n
|
|
2051
|
+
}), this._dispatchUndoStateEvent(), e;
|
|
2059
2052
|
}
|
|
2060
2053
|
deleteColumn(e) {
|
|
2061
2054
|
let t = this.columns.findIndex((t) => t.key === e);
|
|
@@ -2073,15 +2066,11 @@ var K = {
|
|
|
2073
2066
|
redo: () => {
|
|
2074
2067
|
this._filters = this._filters.filter((t) => t.key !== e), this._sortCriteria = this._sortCriteria.filter((t) => t.key !== e), this._columnWidths.delete(e), this.columns = this.columns.filter((t) => t.key !== e), this.requestUpdate();
|
|
2075
2068
|
}
|
|
2076
|
-
}), this._activeCell && this._activeCell.col >= this.visibleColumns.length && (this._selection.clear(), this._activeCell = null), this.requestUpdate(), this.
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
},
|
|
2082
|
-
bubbles: !0,
|
|
2083
|
-
composed: !0
|
|
2084
|
-
})), this._dispatchUndoStateEvent();
|
|
2069
|
+
}), this._activeCell && this._activeCell.col >= this.visibleColumns.length && (this._selection.clear(), this._activeCell = null), this.requestUpdate(), this._emit("column-delete", {
|
|
2070
|
+
column: n,
|
|
2071
|
+
key: e,
|
|
2072
|
+
index: t
|
|
2073
|
+
}), this._dispatchUndoStateEvent();
|
|
2085
2074
|
}
|
|
2086
2075
|
moveColumn(e, t) {
|
|
2087
2076
|
let n = this.columns.findIndex((t) => t.key === e);
|
|
@@ -2099,15 +2088,11 @@ var K = {
|
|
|
2099
2088
|
let e = [...this.columns];
|
|
2100
2089
|
e.splice(n, 1), e.splice(r, 0, i), this.columns = e, this.requestUpdate();
|
|
2101
2090
|
}
|
|
2102
|
-
}), this.requestUpdate(), this.
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
},
|
|
2108
|
-
bubbles: !0,
|
|
2109
|
-
composed: !0
|
|
2110
|
-
})), this._dispatchUndoStateEvent();
|
|
2091
|
+
}), this.requestUpdate(), this._emit("column-reorder", {
|
|
2092
|
+
key: e,
|
|
2093
|
+
oldIndex: n,
|
|
2094
|
+
newIndex: r
|
|
2095
|
+
}), this._dispatchUndoStateEvent();
|
|
2111
2096
|
}
|
|
2112
2097
|
hideColumn(e) {
|
|
2113
2098
|
let t = this.columns.findIndex((t) => t.key === e);
|
|
@@ -2142,14 +2127,10 @@ var K = {
|
|
|
2142
2127
|
n !== -1 && (this.columns = this.columns.map((e, r) => r === n ? {
|
|
2143
2128
|
...e,
|
|
2144
2129
|
hidden: t
|
|
2145
|
-
} : e), this.
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
},
|
|
2150
|
-
bubbles: !0,
|
|
2151
|
-
composed: !0
|
|
2152
|
-
})));
|
|
2130
|
+
} : e), this._emit("column-visibility-change", {
|
|
2131
|
+
key: e,
|
|
2132
|
+
hidden: t
|
|
2133
|
+
}));
|
|
2153
2134
|
}
|
|
2154
2135
|
getHiddenColumns() {
|
|
2155
2136
|
return this.columns.filter((e) => e.hidden);
|
|
@@ -2165,14 +2146,10 @@ var K = {
|
|
|
2165
2146
|
redo: () => {
|
|
2166
2147
|
this.data.splice(r, 0, n), this.requestUpdate();
|
|
2167
2148
|
}
|
|
2168
|
-
}), this.requestUpdate(), this.
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
},
|
|
2173
|
-
bubbles: !0,
|
|
2174
|
-
composed: !0
|
|
2175
|
-
})), this._dispatchUndoStateEvent(), n;
|
|
2149
|
+
}), this.requestUpdate(), this._emit("row-add", {
|
|
2150
|
+
row: n,
|
|
2151
|
+
index: r
|
|
2152
|
+
}), this._dispatchUndoStateEvent(), n;
|
|
2176
2153
|
}
|
|
2177
2154
|
deleteRows(e) {
|
|
2178
2155
|
let t = e ?? this._getSelectedDataRows();
|
|
@@ -2198,14 +2175,10 @@ var K = {
|
|
|
2198
2175
|
let e = this._toDataIndex(this._activeCell.row);
|
|
2199
2176
|
t.includes(e) && (this._selection.clear(), this._activeCell = null);
|
|
2200
2177
|
}
|
|
2201
|
-
this.requestUpdate(), this.
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
},
|
|
2206
|
-
bubbles: !0,
|
|
2207
|
-
composed: !0
|
|
2208
|
-
})), this._dispatchUndoStateEvent();
|
|
2178
|
+
this.requestUpdate(), this._emit("row-delete", {
|
|
2179
|
+
indices: r.map((e) => e.index),
|
|
2180
|
+
rows: r.map((e) => e.row)
|
|
2181
|
+
}), this._dispatchUndoStateEvent();
|
|
2209
2182
|
}
|
|
2210
2183
|
}
|
|
2211
2184
|
updateRows(e) {
|
|
@@ -2231,11 +2204,7 @@ var K = {
|
|
|
2231
2204
|
for (let e of t) this.data[e.row][e.key] = e.newValue;
|
|
2232
2205
|
this.requestUpdate();
|
|
2233
2206
|
}
|
|
2234
|
-
}), this.requestUpdate(), this.
|
|
2235
|
-
detail: { changes: t },
|
|
2236
|
-
bubbles: !0,
|
|
2237
|
-
composed: !0
|
|
2238
|
-
})), this._dispatchUndoStateEvent());
|
|
2207
|
+
}), this.requestUpdate(), this._emit("batch-update", { changes: t }), this._dispatchUndoStateEvent());
|
|
2239
2208
|
}
|
|
2240
2209
|
_createEmptyRow() {
|
|
2241
2210
|
let e = {};
|
|
@@ -2298,15 +2267,11 @@ var K = {
|
|
|
2298
2267
|
let n = this._comments.get(e);
|
|
2299
2268
|
n && (n.delete(t), n.size === 0 && this._comments.delete(e));
|
|
2300
2269
|
}
|
|
2301
|
-
this.
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
},
|
|
2307
|
-
bubbles: !0,
|
|
2308
|
-
composed: !0
|
|
2309
|
-
})), this.requestUpdate();
|
|
2270
|
+
this._emit("comment-change", {
|
|
2271
|
+
dataIndex: e,
|
|
2272
|
+
colKey: t,
|
|
2273
|
+
text: n ?? null
|
|
2274
|
+
}), this.requestUpdate();
|
|
2310
2275
|
}
|
|
2311
2276
|
getComment(e, t) {
|
|
2312
2277
|
return this._comments.get(e)?.get(t) ?? null;
|
|
@@ -2360,11 +2325,7 @@ var K = {
|
|
|
2360
2325
|
redo: () => {
|
|
2361
2326
|
this.data = n, this.requestUpdate();
|
|
2362
2327
|
}
|
|
2363
|
-
}), this.
|
|
2364
|
-
detail: { count: n.length },
|
|
2365
|
-
bubbles: !0,
|
|
2366
|
-
composed: !0
|
|
2367
|
-
}));
|
|
2328
|
+
}), this._emit("data-import", { count: n.length });
|
|
2368
2329
|
}
|
|
2369
2330
|
_applyImportedRows(e) {
|
|
2370
2331
|
if (e.length === 0) return;
|
|
@@ -2385,11 +2346,7 @@ var K = {
|
|
|
2385
2346
|
redo: () => {
|
|
2386
2347
|
this.data = r, this.requestUpdate();
|
|
2387
2348
|
}
|
|
2388
|
-
}), this.
|
|
2389
|
-
detail: { count: r.length },
|
|
2390
|
-
bubbles: !0,
|
|
2391
|
-
composed: !0
|
|
2392
|
-
}));
|
|
2349
|
+
}), this._emit("data-import", { count: r.length });
|
|
2393
2350
|
}
|
|
2394
2351
|
_buildHeaderColumnMap(e) {
|
|
2395
2352
|
let t = /* @__PURE__ */ new Map();
|
|
@@ -2528,15 +2485,11 @@ var K = {
|
|
|
2528
2485
|
return;
|
|
2529
2486
|
}
|
|
2530
2487
|
if (this._filteredIndices = ce(this.data, this._filters, (e, t, n) => {
|
|
2531
|
-
this.
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
},
|
|
2537
|
-
bubbles: !0,
|
|
2538
|
-
composed: !0
|
|
2539
|
-
}));
|
|
2488
|
+
this._emit("filter-error", {
|
|
2489
|
+
error: e,
|
|
2490
|
+
row: t,
|
|
2491
|
+
filterKey: n.key
|
|
2492
|
+
});
|
|
2540
2493
|
}), this._filters.length === 0 && this._sortCriteria.length === 0) this._sortedIndices = Array.from({ length: this.data.length }, (e, t) => t);
|
|
2541
2494
|
else if (this._sortCriteria.length === 0) this._sortedIndices = [...this._filteredIndices];
|
|
2542
2495
|
else {
|
|
@@ -2584,21 +2537,16 @@ var K = {
|
|
|
2584
2537
|
if (r < 0 || a < 0) return;
|
|
2585
2538
|
let o = this._toDataIndex(a), s = this.visibleColumns[r];
|
|
2586
2539
|
if (!s) return;
|
|
2587
|
-
let c =
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
bubbles: !0,
|
|
2598
|
-
composed: !0,
|
|
2599
|
-
cancelable: !0
|
|
2600
|
-
});
|
|
2601
|
-
this.dispatchEvent(c), this._cancelCommentPopup(), this.showContextMenu && !c.defaultPrevented && (this._bodyContextMenu = {
|
|
2540
|
+
let c = this._emit("context-menu", {
|
|
2541
|
+
x: e.clientX,
|
|
2542
|
+
y: e.clientY,
|
|
2543
|
+
row: o,
|
|
2544
|
+
col: r,
|
|
2545
|
+
key: s.key,
|
|
2546
|
+
value: this.data[o]?.[s.key],
|
|
2547
|
+
rowData: this.data[o]
|
|
2548
|
+
}, { cancelable: !0 });
|
|
2549
|
+
this._cancelCommentPopup(), this.showContextMenu && !c.defaultPrevented && (this._bodyContextMenu = {
|
|
2602
2550
|
rowIndex: a,
|
|
2603
2551
|
colIndex: r,
|
|
2604
2552
|
dataIndex: o,
|
|
@@ -2651,16 +2599,12 @@ var K = {
|
|
|
2651
2599
|
_fireRowActivate(e) {
|
|
2652
2600
|
if (!this._activeCell) return;
|
|
2653
2601
|
let t = this._toDataIndex(this._activeCell.row), n = this.data[t];
|
|
2654
|
-
n && this.
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
},
|
|
2661
|
-
bubbles: !0,
|
|
2662
|
-
composed: !0
|
|
2663
|
-
}));
|
|
2602
|
+
n && this._emit("row-activate", {
|
|
2603
|
+
row: n,
|
|
2604
|
+
index: t,
|
|
2605
|
+
col: this._activeCell.col,
|
|
2606
|
+
key: e?.key
|
|
2607
|
+
});
|
|
2664
2608
|
}
|
|
2665
2609
|
_startEdit() {
|
|
2666
2610
|
if (!this._activeCell) return;
|
|
@@ -2672,16 +2616,12 @@ var K = {
|
|
|
2672
2616
|
return;
|
|
2673
2617
|
}
|
|
2674
2618
|
let t = this._toDataIndex(this._activeCell.row), n = this.data[t];
|
|
2675
|
-
this._editing.start(this._activeCell, n[e.key]), this._editingCell = { ...this._activeCell }, this.
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
},
|
|
2682
|
-
bubbles: !0,
|
|
2683
|
-
composed: !0
|
|
2684
|
-
}));
|
|
2619
|
+
this._editing.start(this._activeCell, n[e.key]), this._editingCell = { ...this._activeCell }, this._emit("cell-edit-start", {
|
|
2620
|
+
row: t,
|
|
2621
|
+
col: this._activeCell.col,
|
|
2622
|
+
key: e.key,
|
|
2623
|
+
value: n[e.key]
|
|
2624
|
+
});
|
|
2685
2625
|
}
|
|
2686
2626
|
_commitEdit() {
|
|
2687
2627
|
if (!this._editing.current) return;
|
|
@@ -2722,48 +2662,36 @@ var K = {
|
|
|
2722
2662
|
let { row: n, col: r } = t.position, i = this._toDataIndex(n), a = this.visibleColumns[r], o = t.originalValue;
|
|
2723
2663
|
if (a.autocomplete === "strict" && e != null && e !== "" && !this._getAutocompleteCandidates(a, "").includes(String(e))) {
|
|
2724
2664
|
let t = k("notInList");
|
|
2725
|
-
this._markCellInvalid(n, r, t), this.
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
},
|
|
2733
|
-
bubbles: !0,
|
|
2734
|
-
composed: !0
|
|
2735
|
-
}));
|
|
2665
|
+
this._markCellInvalid(n, r, t), this._emit("validation-error", {
|
|
2666
|
+
row: i,
|
|
2667
|
+
col: r,
|
|
2668
|
+
key: a.key,
|
|
2669
|
+
value: e,
|
|
2670
|
+
error: t
|
|
2671
|
+
});
|
|
2736
2672
|
return;
|
|
2737
2673
|
}
|
|
2738
2674
|
if (a.type === "number" && typeof e == "string" || a.type === "date" && typeof e == "string" && f(e) === null || a.type === "datetime" && typeof e == "string" && p(e) === null) {
|
|
2739
2675
|
let t = k(a.type === "number" ? "notANumber" : a.type === "date" ? "notADate" : "notADateTime");
|
|
2740
|
-
this._markCellInvalid(n, r, t), this.
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
},
|
|
2748
|
-
bubbles: !0,
|
|
2749
|
-
composed: !0
|
|
2750
|
-
}));
|
|
2676
|
+
this._markCellInvalid(n, r, t), this._emit("validation-error", {
|
|
2677
|
+
row: i,
|
|
2678
|
+
col: r,
|
|
2679
|
+
key: a.key,
|
|
2680
|
+
value: e,
|
|
2681
|
+
error: t
|
|
2682
|
+
});
|
|
2751
2683
|
return;
|
|
2752
2684
|
}
|
|
2753
2685
|
if (a.validator) {
|
|
2754
2686
|
let t = a.validator(e, this.data[i], a);
|
|
2755
2687
|
if (t) {
|
|
2756
|
-
this._markCellInvalid(n, r, t), this.
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
},
|
|
2764
|
-
bubbles: !0,
|
|
2765
|
-
composed: !0
|
|
2766
|
-
}));
|
|
2688
|
+
this._markCellInvalid(n, r, t), this._emit("validation-error", {
|
|
2689
|
+
row: i,
|
|
2690
|
+
col: r,
|
|
2691
|
+
key: a.key,
|
|
2692
|
+
value: e,
|
|
2693
|
+
error: t
|
|
2694
|
+
});
|
|
2767
2695
|
return;
|
|
2768
2696
|
}
|
|
2769
2697
|
}
|
|
@@ -2775,29 +2703,21 @@ var K = {
|
|
|
2775
2703
|
redo: () => {
|
|
2776
2704
|
this.data[i][a.key] = e, this.requestUpdate();
|
|
2777
2705
|
}
|
|
2778
|
-
}), this.requestUpdate(), this.
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
},
|
|
2786
|
-
bubbles: !0,
|
|
2787
|
-
composed: !0
|
|
2788
|
-
})), this._dispatchUndoStateEvent();
|
|
2706
|
+
}), this.requestUpdate(), this._emit("cell-edit-commit", {
|
|
2707
|
+
row: i,
|
|
2708
|
+
col: r,
|
|
2709
|
+
key: a.key,
|
|
2710
|
+
oldValue: o,
|
|
2711
|
+
newValue: e
|
|
2712
|
+
}), this._dispatchUndoStateEvent();
|
|
2789
2713
|
}
|
|
2790
2714
|
_cancelEdit() {
|
|
2791
2715
|
this._autocompleteState = null;
|
|
2792
2716
|
let e = this._editing.cancel();
|
|
2793
|
-
this._editingCell = null, e && this.
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
},
|
|
2798
|
-
bubbles: !0,
|
|
2799
|
-
composed: !0
|
|
2800
|
-
}));
|
|
2717
|
+
this._editingCell = null, e && this._emit("cell-edit-cancel", {
|
|
2718
|
+
row: e.position.row,
|
|
2719
|
+
col: e.position.col
|
|
2720
|
+
});
|
|
2801
2721
|
}
|
|
2802
2722
|
_onEditorKeyDown(e) {
|
|
2803
2723
|
if (_(e)) return;
|
|
@@ -2942,15 +2862,11 @@ var K = {
|
|
|
2942
2862
|
let n = this.visibleColumns.findIndex((t) => t.key === e), r = this.visibleColumns[n];
|
|
2943
2863
|
if (!r) return;
|
|
2944
2864
|
let i = this._columnWidths.get(r.key) ?? r.width ?? q, a = r.minWidth ?? J, o = Math.max(a, i + t);
|
|
2945
|
-
this._columnWidths.set(r.key, o), this.requestUpdate(), this.
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
},
|
|
2951
|
-
bubbles: !0,
|
|
2952
|
-
composed: !0
|
|
2953
|
-
}));
|
|
2865
|
+
this._columnWidths.set(r.key, o), this.requestUpdate(), this._emit("column-resize", {
|
|
2866
|
+
key: r.key,
|
|
2867
|
+
width: o,
|
|
2868
|
+
colIndex: n
|
|
2869
|
+
});
|
|
2954
2870
|
}
|
|
2955
2871
|
_handleNavigation(e) {
|
|
2956
2872
|
switch (e.key) {
|
|
@@ -2987,24 +2903,16 @@ var K = {
|
|
|
2987
2903
|
}
|
|
2988
2904
|
}
|
|
2989
2905
|
_clipboardError(e, t) {
|
|
2990
|
-
this.
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
},
|
|
2995
|
-
bubbles: !0,
|
|
2996
|
-
composed: !0
|
|
2997
|
-
}));
|
|
2906
|
+
this._emit("clipboard-error", {
|
|
2907
|
+
action: e,
|
|
2908
|
+
error: t
|
|
2909
|
+
});
|
|
2998
2910
|
}
|
|
2999
2911
|
_afterCopy(e, t, n) {
|
|
3000
|
-
n && this._clearRange(e), this.
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
},
|
|
3005
|
-
bubbles: !0,
|
|
3006
|
-
composed: !0
|
|
3007
|
-
}));
|
|
2912
|
+
n && this._clearRange(e), this._emit(n ? "clipboard-cut" : "clipboard-copy", {
|
|
2913
|
+
range: e,
|
|
2914
|
+
text: t
|
|
2915
|
+
});
|
|
3008
2916
|
}
|
|
3009
2917
|
_pasteText(e) {
|
|
3010
2918
|
if (!this._activeCell) return;
|
|
@@ -3026,14 +2934,10 @@ var K = {
|
|
|
3026
2934
|
}
|
|
3027
2935
|
}), this._dispatchUndoStateEvent();
|
|
3028
2936
|
}
|
|
3029
|
-
this.requestUpdate(), this.
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
},
|
|
3034
|
-
bubbles: !0,
|
|
3035
|
-
composed: !0
|
|
3036
|
-
}));
|
|
2937
|
+
this.requestUpdate(), this._emit("clipboard-paste", {
|
|
2938
|
+
changes: r,
|
|
2939
|
+
addedRows: n.length
|
|
2940
|
+
});
|
|
3037
2941
|
}
|
|
3038
2942
|
_selectPastedRange(e, t) {
|
|
3039
2943
|
let n = Math.max(...t.map((e) => e.length)), r = Math.min(e.row + t.length, this._visibleRowCount) - 1, i = Math.min(e.col + n, this.visibleColumns.length) - 1;
|
|
@@ -3203,11 +3107,7 @@ var K = {
|
|
|
3203
3107
|
i < this.scrollLeft ? this.scrollLeft = i : a > this.scrollLeft + this.clientWidth && (this.scrollLeft = a - this.clientWidth);
|
|
3204
3108
|
}
|
|
3205
3109
|
_dispatchSelectionEvent() {
|
|
3206
|
-
this.
|
|
3207
|
-
detail: this._activeCell ? { ...this._activeCell } : null,
|
|
3208
|
-
bubbles: !0,
|
|
3209
|
-
composed: !0
|
|
3210
|
-
}));
|
|
3110
|
+
this._emit("cell-select", this._activeCell ? { ...this._activeCell } : null);
|
|
3211
3111
|
}
|
|
3212
3112
|
_onHeaderClick(t, n) {
|
|
3213
3113
|
if (this._wasHeaderDrag) {
|
|
@@ -3219,26 +3119,18 @@ var K = {
|
|
|
3219
3119
|
this._selectColumn(r);
|
|
3220
3120
|
return;
|
|
3221
3121
|
}
|
|
3222
|
-
n.sortable !== !1 && (this._sortCriteria = e(this._sortCriteria, n.key, t.shiftKey), this.dataMode !== "server" && this._recomputeView(), this.requestUpdate(), this.
|
|
3223
|
-
detail: { criteria: [...this._sortCriteria] },
|
|
3224
|
-
bubbles: !0,
|
|
3225
|
-
composed: !0
|
|
3226
|
-
})));
|
|
3122
|
+
n.sortable !== !1 && (this._sortCriteria = e(this._sortCriteria, n.key, t.shiftKey), this.dataMode !== "server" && this._recomputeView(), this.requestUpdate(), this._emit("sort-change", { criteria: [...this._sortCriteria] }));
|
|
3227
3123
|
}
|
|
3228
3124
|
_selectColumn(e) {
|
|
3229
3125
|
let t = this._visibleRowCount;
|
|
3230
3126
|
t === 0 || e < 0 || (this._selection.setActive(0, e), this._selection.setActiveWithRange(t - 1, e), this._activeCell = {
|
|
3231
3127
|
row: 0,
|
|
3232
3128
|
col: e
|
|
3233
|
-
}, this.requestUpdate(), this.
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
},
|
|
3239
|
-
bubbles: !0,
|
|
3240
|
-
composed: !0
|
|
3241
|
-
})));
|
|
3129
|
+
}, this.requestUpdate(), this._emit("column-select", {
|
|
3130
|
+
colIndex: e,
|
|
3131
|
+
key: this.visibleColumns[e]?.key,
|
|
3132
|
+
rowCount: t
|
|
3133
|
+
}));
|
|
3242
3134
|
}
|
|
3243
3135
|
selectColumn(e) {
|
|
3244
3136
|
this._selectColumn(e);
|
|
@@ -3294,6 +3186,7 @@ var K = {
|
|
|
3294
3186
|
${o >= 0 ? i`<span class="ft-sort-order">${o + 1}</span>` : ""}
|
|
3295
3187
|
<button class="ft-column-menu-btn ${s ? "ft-filter-active" : ""}"
|
|
3296
3188
|
type="button"
|
|
3189
|
+
data-key=${e.key}
|
|
3297
3190
|
title=${k("columnMenu")}
|
|
3298
3191
|
aria-label=${k("columnMenuFor", { header: e.label })}
|
|
3299
3192
|
aria-haspopup="menu"
|
|
@@ -3325,16 +3218,12 @@ var K = {
|
|
|
3325
3218
|
x: e.clientX,
|
|
3326
3219
|
y: e.clientY,
|
|
3327
3220
|
hiddenNeighbors: this._hiddenNeighbors(t)
|
|
3328
|
-
}, this.
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
},
|
|
3335
|
-
bubbles: !0,
|
|
3336
|
-
composed: !0
|
|
3337
|
-
})), requestAnimationFrame(() => {
|
|
3221
|
+
}, this._emit("header-context-menu", {
|
|
3222
|
+
key: t.key,
|
|
3223
|
+
label: t.label,
|
|
3224
|
+
x: e.clientX,
|
|
3225
|
+
y: e.clientY
|
|
3226
|
+
}), requestAnimationFrame(() => {
|
|
3338
3227
|
document.addEventListener("click", this._onDocumentClick, { once: !0 });
|
|
3339
3228
|
});
|
|
3340
3229
|
}
|
|
@@ -3519,11 +3408,7 @@ var K = {
|
|
|
3519
3408
|
n && n.sortable !== !1 && (this._sortCriteria = [{
|
|
3520
3409
|
key: e,
|
|
3521
3410
|
direction: t
|
|
3522
|
-
}], this.dataMode !== "server" && this._recomputeView(), this.requestUpdate(), this.
|
|
3523
|
-
detail: { criteria: [...this._sortCriteria] },
|
|
3524
|
-
bubbles: !0,
|
|
3525
|
-
composed: !0
|
|
3526
|
-
})));
|
|
3411
|
+
}], this.dataMode !== "server" && this._recomputeView(), this.requestUpdate(), this._emit("sort-change", { criteria: [...this._sortCriteria] }));
|
|
3527
3412
|
}
|
|
3528
3413
|
_keepMenuInView(e) {
|
|
3529
3414
|
let t = this.shadowRoot?.querySelector(e);
|
|
@@ -3540,11 +3425,28 @@ var K = {
|
|
|
3540
3425
|
let s = Math.max(4, Math.min(n.left, i - r.width - 4));
|
|
3541
3426
|
e.style.left = `${s}px`, e.style.top = `${o}px`;
|
|
3542
3427
|
}
|
|
3428
|
+
_closeFilterDropdown(e = !0) {
|
|
3429
|
+
let t = this._openFilterKey;
|
|
3430
|
+
this._openFilterKey = null, e && t !== null && this.updateComplete.then(() => {
|
|
3431
|
+
[...this.shadowRoot?.querySelectorAll(".ft-column-menu-btn") ?? []].find((e) => e.dataset.key === t)?.focus();
|
|
3432
|
+
});
|
|
3433
|
+
}
|
|
3434
|
+
_onFilterDialogKeydown(e) {
|
|
3435
|
+
if (e.key !== "Tab") return;
|
|
3436
|
+
let t = [...e.currentTarget.querySelectorAll("input, select, textarea, button, u-date-picker")].filter((e) => !e.disabled && e.getClientRects().length > 0);
|
|
3437
|
+
if (t.length === 0) return;
|
|
3438
|
+
let n = e.composedPath(), r = t.findIndex((e) => n.includes(e)), i = t.length - 1;
|
|
3439
|
+
e.shiftKey && r <= 0 ? (e.preventDefault(), t[i].focus()) : !e.shiftKey && (r === i || r === -1) && (e.preventDefault(), t[0].focus());
|
|
3440
|
+
}
|
|
3543
3441
|
_renderFilterDropdown(e) {
|
|
3544
3442
|
let t = e.type ?? "text";
|
|
3545
3443
|
return i`
|
|
3546
|
-
<div class="ft-filter-dropdown" role="
|
|
3547
|
-
@click=${(e) => e.stopPropagation()}
|
|
3444
|
+
<div class="ft-filter-dropdown" role="dialog" aria-label=${k("filterFor", { header: e.label })}
|
|
3445
|
+
@click=${(e) => e.stopPropagation()}
|
|
3446
|
+
@keydown=${{
|
|
3447
|
+
handleEvent: (e) => this._onFilterDialogKeydown(e),
|
|
3448
|
+
capture: !0
|
|
3449
|
+
}}>
|
|
3548
3450
|
${t === "boolean" ? this._renderBooleanFilter(e) : t === "number" ? this._renderNumberFilter(e) : t === "date" || t === "datetime" ? this._renderDateFilter(e) : this._renderTextFilter(e)}
|
|
3549
3451
|
<div class="ft-filter-actions">
|
|
3550
3452
|
<button class="ft-filter-clear" @click=${() => this._clearColumnFilter(e.key)}>${k("clear")}</button>
|
|
@@ -3588,7 +3490,7 @@ var K = {
|
|
|
3588
3490
|
(r === "" || r === "empty" || r === "non-empty") && (r ? this._emptyFilterState.set(e, r) : this._emptyFilterState.delete(e), t?.(), this._applyFilterForKey(e));
|
|
3589
3491
|
}}
|
|
3590
3492
|
@keydown=${(e) => {
|
|
3591
|
-
e.key === "Escape" &&
|
|
3493
|
+
e.key === "Escape" && this._closeFilterDropdown(), e.stopPropagation();
|
|
3592
3494
|
}}>
|
|
3593
3495
|
<option value="">${k("blankAll")}</option>
|
|
3594
3496
|
<option value="empty">${k("emptyOnly")}</option>
|
|
@@ -3666,7 +3568,7 @@ var K = {
|
|
|
3666
3568
|
}), this._applyTextFilter(e.key);
|
|
3667
3569
|
}}
|
|
3668
3570
|
@keydown=${(e) => {
|
|
3669
|
-
e.key === "Escape" &&
|
|
3571
|
+
e.key === "Escape" && this._closeFilterDropdown(), e.stopPropagation();
|
|
3670
3572
|
}}>
|
|
3671
3573
|
<option value="contains">${k("contains")}</option>
|
|
3672
3574
|
<option value="starts">${k("startsWith")}</option>
|
|
@@ -3687,7 +3589,7 @@ var K = {
|
|
|
3687
3589
|
}), this._emptyFilterState.delete(e.key), this._applyTextFilter(e.key);
|
|
3688
3590
|
}}
|
|
3689
3591
|
@keydown=${(e) => {
|
|
3690
|
-
e.key === "Escape" &&
|
|
3592
|
+
e.key === "Escape" && this._closeFilterDropdown(), e.stopPropagation();
|
|
3691
3593
|
}}>
|
|
3692
3594
|
${this._renderEmptyFilterRow(e.key, () => {
|
|
3693
3595
|
this._textFilterState.delete(e.key);
|
|
@@ -3721,7 +3623,7 @@ var K = {
|
|
|
3721
3623
|
}, this._numberFilterState.set(e, i), this._emptyFilterState.delete(e), this._applyFilterForKey(e);
|
|
3722
3624
|
}}
|
|
3723
3625
|
@keydown=${(e) => {
|
|
3724
|
-
e.key === "Escape" &&
|
|
3626
|
+
e.key === "Escape" && this._closeFilterDropdown(), e.stopPropagation();
|
|
3725
3627
|
}}>
|
|
3726
3628
|
${Object.keys(K).map((e) => i`<option value=${e}>${K[e]}</option>`)}
|
|
3727
3629
|
</select>
|
|
@@ -3738,7 +3640,7 @@ var K = {
|
|
|
3738
3640
|
}, this._numberFilterState.set(e, i), this._emptyFilterState.delete(e), this._applyFilterForKey(e);
|
|
3739
3641
|
}}
|
|
3740
3642
|
@keydown=${(e) => {
|
|
3741
|
-
e.key === "Escape" &&
|
|
3643
|
+
e.key === "Escape" && this._closeFilterDropdown(), e.stopPropagation();
|
|
3742
3644
|
}}>
|
|
3743
3645
|
</div>
|
|
3744
3646
|
`;
|
|
@@ -3755,7 +3657,7 @@ var K = {
|
|
|
3755
3657
|
r.join = n, this._numberFilterState.set(e.key, r), this._emptyFilterState.delete(e.key), this._applyFilterForKey(e.key);
|
|
3756
3658
|
}}
|
|
3757
3659
|
@keydown=${(e) => {
|
|
3758
|
-
e.key === "Escape" &&
|
|
3660
|
+
e.key === "Escape" && this._closeFilterDropdown(), e.stopPropagation();
|
|
3759
3661
|
}}>
|
|
3760
3662
|
<option value="and">AND</option>
|
|
3761
3663
|
<option value="or">OR</option>
|
|
@@ -3787,7 +3689,7 @@ var K = {
|
|
|
3787
3689
|
}
|
|
3788
3690
|
_renderDateFilter(e) {
|
|
3789
3691
|
let t = e.type === "datetime", n = this._dateFilterState.get(e.key) ?? {}, r = (e) => e?.slice(0, 10), o = (e) => {
|
|
3790
|
-
e.key === "Escape" && $(e.currentTarget) || (e.stopPropagation(), e.key === "Escape" &&
|
|
3692
|
+
e.key === "Escape" && $(e.currentTarget) || (e.stopPropagation(), e.key === "Escape" && this._closeFilterDropdown());
|
|
3791
3693
|
};
|
|
3792
3694
|
return i`
|
|
3793
3695
|
<div class="ft-filter-range ft-filter-range-dates">
|
|
@@ -3819,7 +3721,7 @@ var K = {
|
|
|
3819
3721
|
n === "all" ? this.removeFilter(e.key) : this.setFilter(e.key, (e) => !!e == (n === "true"));
|
|
3820
3722
|
}}
|
|
3821
3723
|
@keydown=${(e) => {
|
|
3822
|
-
e.key === "Escape" &&
|
|
3724
|
+
e.key === "Escape" && this._closeFilterDropdown(), e.stopPropagation();
|
|
3823
3725
|
}}>
|
|
3824
3726
|
<option value="all">${k("all")}</option>
|
|
3825
3727
|
<option value="true">\u2714 ${k("booleanTrue")}</option>
|
|
@@ -3837,15 +3739,11 @@ var K = {
|
|
|
3837
3739
|
let r = this.shadowRoot?.querySelectorAll(`.ft-cell[data-col-index="${t}"]`), i = 0, a = this.shadowRoot?.querySelector(`.ft-header-cell[data-col-index="${t}"]`);
|
|
3838
3740
|
if (a && (i = Math.max(i, a.scrollWidth)), r) for (let e of r) i = Math.max(i, e.scrollWidth);
|
|
3839
3741
|
let o = n.minWidth ?? J, s = Math.max(o, i + 8);
|
|
3840
|
-
this._columnWidths.set(n.key, s), this.requestUpdate(), this.
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
},
|
|
3846
|
-
bubbles: !0,
|
|
3847
|
-
composed: !0
|
|
3848
|
-
}));
|
|
3742
|
+
this._columnWidths.set(n.key, s), this.requestUpdate(), this._emit("column-resize", {
|
|
3743
|
+
key: n.key,
|
|
3744
|
+
width: s,
|
|
3745
|
+
colIndex: t
|
|
3746
|
+
});
|
|
3849
3747
|
}
|
|
3850
3748
|
_onResizeStart(e, t) {
|
|
3851
3749
|
e.preventDefault(), e.stopPropagation();
|
|
@@ -3864,15 +3762,11 @@ var K = {
|
|
|
3864
3762
|
}, o = () => {
|
|
3865
3763
|
if (a(), this._resizing) {
|
|
3866
3764
|
let e = this._columnWidths.get(n.key) ?? q;
|
|
3867
|
-
this.
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
},
|
|
3873
|
-
bubbles: !0,
|
|
3874
|
-
composed: !0
|
|
3875
|
-
})), this._resizing = null;
|
|
3765
|
+
this._emit("column-resize", {
|
|
3766
|
+
key: n.key,
|
|
3767
|
+
width: e,
|
|
3768
|
+
colIndex: t
|
|
3769
|
+
}), this._resizing = null;
|
|
3876
3770
|
}
|
|
3877
3771
|
};
|
|
3878
3772
|
document.addEventListener("mousemove", i), document.addEventListener("mouseup", o), this._resizeCleanup = a;
|
|
@@ -4001,15 +3895,11 @@ var K = {
|
|
|
4001
3895
|
for (let e of r) this.data[e.dataRow][e.key] = e.newValue;
|
|
4002
3896
|
this.requestUpdate();
|
|
4003
3897
|
}
|
|
4004
|
-
}), this._dispatchUndoStateEvent(), this.
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
},
|
|
4010
|
-
bubbles: !0,
|
|
4011
|
-
composed: !0
|
|
4012
|
-
}))), this.requestUpdate();
|
|
3898
|
+
}), this._dispatchUndoStateEvent(), this._emit("fill-handle-apply", {
|
|
3899
|
+
sourceRange: e,
|
|
3900
|
+
targetRange: t,
|
|
3901
|
+
cells: r
|
|
3902
|
+
})), this.requestUpdate();
|
|
4013
3903
|
}
|
|
4014
3904
|
_detectNumericSeries(e) {
|
|
4015
3905
|
if (e.length < 2) return null;
|
|
@@ -4101,14 +3991,10 @@ var K = {
|
|
|
4101
3991
|
redo: () => {
|
|
4102
3992
|
this.data = [...a], this.requestUpdate();
|
|
4103
3993
|
}
|
|
4104
|
-
}), this._dispatchUndoStateEvent(), this.
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
},
|
|
4109
|
-
bubbles: !0,
|
|
4110
|
-
composed: !0
|
|
4111
|
-
}));
|
|
3994
|
+
}), this._dispatchUndoStateEvent(), this._emit("row-reorder", {
|
|
3995
|
+
from: n,
|
|
3996
|
+
to: r
|
|
3997
|
+
});
|
|
4112
3998
|
}
|
|
4113
3999
|
_toggleFindPanel(e) {
|
|
4114
4000
|
if (this._findState?.mode === e) {
|
|
@@ -4191,19 +4077,15 @@ var K = {
|
|
|
4191
4077
|
for (let e of r) this.data[e.dataRow][e.key] = e.newValue;
|
|
4192
4078
|
this.requestUpdate();
|
|
4193
4079
|
}
|
|
4194
|
-
}), this._dispatchUndoStateEvent(), this.
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
},
|
|
4204
|
-
bubbles: !0,
|
|
4205
|
-
composed: !0
|
|
4206
|
-
}))), this._findState.results = [], this._findState.currentIndex = 0, this.requestUpdate();
|
|
4080
|
+
}), this._dispatchUndoStateEvent(), this._emit("find-replace", {
|
|
4081
|
+
type: "replace-all",
|
|
4082
|
+
cells: r.map((e) => ({
|
|
4083
|
+
row: e.dataRow,
|
|
4084
|
+
col: e.key,
|
|
4085
|
+
oldValue: e.oldValue,
|
|
4086
|
+
newValue: e.newValue
|
|
4087
|
+
}))
|
|
4088
|
+
})), this._findState.results = [], this._findState.currentIndex = 0, this.requestUpdate();
|
|
4207
4089
|
}
|
|
4208
4090
|
_replaceOne() {
|
|
4209
4091
|
if (!this._findState || this._findState.results.length === 0) return;
|
|
@@ -4216,19 +4098,15 @@ var K = {
|
|
|
4216
4098
|
redo: () => {
|
|
4217
4099
|
this.data[a][o] = n, this.requestUpdate();
|
|
4218
4100
|
}
|
|
4219
|
-
}), this._dispatchUndoStateEvent(), this.
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
},
|
|
4229
|
-
bubbles: !0,
|
|
4230
|
-
composed: !0
|
|
4231
|
-
})), this._findSearch(), this._findGoTo(Math.min(e, this._findState.results.length - 1));
|
|
4101
|
+
}), this._dispatchUndoStateEvent(), this._emit("find-replace", {
|
|
4102
|
+
type: "replace",
|
|
4103
|
+
cells: [{
|
|
4104
|
+
row: a,
|
|
4105
|
+
col: o,
|
|
4106
|
+
oldValue: s,
|
|
4107
|
+
newValue: n
|
|
4108
|
+
}]
|
|
4109
|
+
}), this._findSearch(), this._findGoTo(Math.min(e, this._findState.results.length - 1));
|
|
4232
4110
|
}
|
|
4233
4111
|
_renderFindPanel() {
|
|
4234
4112
|
if (!this._findState) return "";
|