@iyulab/flex-table 0.61.0 → 0.63.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/CHANGELOG.md +58 -0
- package/README.md +60 -4
- package/dist/array/index.js +2 -2
- package/dist/clipboard/clipboard.d.ts +11 -0
- package/dist/core/cell-value.d.ts +13 -0
- package/dist/events.d.ts +3 -4
- package/dist/export/delimited-reader.d.ts +11 -0
- package/dist/export/export.d.ts +11 -2
- package/dist/export/import.d.ts +30 -0
- package/dist/export/values.d.ts +17 -0
- package/dist/{fetch-all-J37bOtgc.js → fetch-all-DkdNzWrF.js} +22 -19
- package/dist/{flex-table-BD_T3SqO.js → flex-table-BufHlQ2v.js} +781 -764
- package/dist/flex-table.d.ts +14 -7
- package/dist/flex-table.js +4 -3
- package/dist/index.d.ts +3 -1
- package/dist/{locale-D9g0ksXq.js → locale-Covm8PfH.js} +4 -0
- package/dist/locale.d.ts +1 -1
- package/dist/models/types.d.ts +11 -0
- package/dist/odata/index.js +2 -2
- package/dist/odata/query.d.ts +6 -0
- package/dist/odata/source.d.ts +7 -0
- package/dist/react.js +4 -4
- package/dist/sorting-BJszwEHw.js +75 -0
- package/dist/{source-DNPtWmC3.js → source-dm6qXFh1.js} +9 -3
- package/dist/{view-BtoXdUGF.js → view-DuDIMoXV.js} +2 -2
- package/package.json +2 -2
- package/skills/iyulab-flex-table/references/api.md +8 -5
- package/skills/iyulab-flex-table/references/react.md +2 -0
- package/dist/sorting-CjfjRxwL.js +0 -51
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { n as e } from "./locale-
|
|
2
|
-
import {
|
|
3
|
-
import { LitElement as
|
|
4
|
-
import { customElement as
|
|
5
|
-
import { Locale as
|
|
6
|
-
import { formatDate as
|
|
7
|
-
import { decodeTsv as
|
|
1
|
+
import { n as e } from "./locale-Covm8PfH.js";
|
|
2
|
+
import { i as t, n, r, t as i } from "./sorting-BJszwEHw.js";
|
|
3
|
+
import { LitElement as a, css as o, html as s, nothing as c } from "lit";
|
|
4
|
+
import { customElement as l, property as u, state as d } from "lit/decorators.js";
|
|
5
|
+
import { Locale as f } from "@iyulab/components/dist/utilities/Locale.js";
|
|
6
|
+
import { formatDate as p, formatNumber as m, parseDate as h, parseDateTime as g, parseNumber as _ } from "@iyulab/components/dist/utilities/format.js";
|
|
7
|
+
import { decodeDelimited as v, decodeTsv as y, encodeTsv as b } from "@iyulab/components/dist/utilities/tsv.js";
|
|
8
8
|
import "@iyulab/components/dist/components/date-picker/UDatePicker.js";
|
|
9
|
-
import { isImeComposing as
|
|
10
|
-
import { copyFromKey as
|
|
11
|
-
import { isFromControl as
|
|
9
|
+
import { isImeComposing as x } from "@iyulab/components/dist/utilities/keyboard.js";
|
|
10
|
+
import { copyFromKey as S, isTextEntry as C, pasteFromKey as w } from "@iyulab/components/dist/utilities/clipboard.js";
|
|
11
|
+
import { isFromControl as T } from "@iyulab/components/dist/utilities/elements.js";
|
|
12
12
|
//#region src/styles/flex-table.styles.ts
|
|
13
|
-
var
|
|
13
|
+
var E = o`
|
|
14
14
|
/* --- Theme Variables (Light defaults) --- */
|
|
15
15
|
:host {
|
|
16
16
|
--ft-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
@@ -120,6 +120,11 @@ var C = i`
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/* --- Layout --- */
|
|
123
|
+
/* 아래 display 가 [hidden] 의 UA 규칙을 이긴다 — 숨긴 표가 그려지지 않게(목록 골격이 보이지 않는 뷰에 hidden 을 건다). */
|
|
124
|
+
:host([hidden]) {
|
|
125
|
+
display: none !important;
|
|
126
|
+
}
|
|
127
|
+
|
|
123
128
|
:host {
|
|
124
129
|
display: block;
|
|
125
130
|
position: relative;
|
|
@@ -1029,26 +1034,26 @@ var C = i`
|
|
|
1029
1034
|
`;
|
|
1030
1035
|
//#endregion
|
|
1031
1036
|
//#region src/renderers/format.ts
|
|
1032
|
-
function
|
|
1033
|
-
return e == null ? "" : typeof t == "function" ? t(e) :
|
|
1037
|
+
function ee(e, t) {
|
|
1038
|
+
return e == null ? "" : typeof t == "function" ? t(e) : te(t) ? re(e, t) : ne(e, t);
|
|
1034
1039
|
}
|
|
1035
|
-
function
|
|
1040
|
+
function te(e) {
|
|
1036
1041
|
return /[yMdHhms]/.test(e);
|
|
1037
1042
|
}
|
|
1038
|
-
function
|
|
1043
|
+
function ne(e, t) {
|
|
1039
1044
|
let n = typeof e == "number" ? e : Number(e);
|
|
1040
1045
|
if (isNaN(n)) return String(e);
|
|
1041
1046
|
let r = t.endsWith("%"), i = t.match(/^([^#0.,%]+)/), a = i ? i[1] : "", o = t.replace(/^[^#0.,%]+/, "").replace(/%$/, ""), s = o.match(/\.([0#]+)$/), c = s ? s[1].length : 0, l = {
|
|
1042
1047
|
minimumFractionDigits: c,
|
|
1043
1048
|
maximumFractionDigits: c,
|
|
1044
1049
|
useGrouping: o.includes(",")
|
|
1045
|
-
},
|
|
1046
|
-
return r ?
|
|
1050
|
+
}, u;
|
|
1051
|
+
return r ? u = new Intl.NumberFormat(f.get(), {
|
|
1047
1052
|
...l,
|
|
1048
1053
|
style: "percent"
|
|
1049
|
-
}).format(n) : (
|
|
1054
|
+
}).format(n) : (u = new Intl.NumberFormat(f.get(), l).format(n), a && (u = a + u)), u + "";
|
|
1050
1055
|
}
|
|
1051
|
-
function
|
|
1056
|
+
function re(e, t) {
|
|
1052
1057
|
let n;
|
|
1053
1058
|
if (e instanceof Date) n = e;
|
|
1054
1059
|
else if (typeof e == "string" || typeof e == "number") n = new Date(e);
|
|
@@ -1059,26 +1064,26 @@ function ee(e, t) {
|
|
|
1059
1064
|
}
|
|
1060
1065
|
//#endregion
|
|
1061
1066
|
//#region src/renderers/cell-renderer.ts
|
|
1062
|
-
function
|
|
1063
|
-
return n.render ? n.render(e, t, n) : n.format ? typeof n.format == "function" ? n.format(e, t, n) :
|
|
1067
|
+
function ie(e, t, n) {
|
|
1068
|
+
return n.render ? n.render(e, t, n) : n.format ? typeof n.format == "function" ? n.format(e, t, n) : ee(e, n.format) : ae(e, n);
|
|
1064
1069
|
}
|
|
1065
|
-
function
|
|
1070
|
+
function ae(e, t) {
|
|
1066
1071
|
if (e == null) return "";
|
|
1067
1072
|
switch (t.type) {
|
|
1068
|
-
case "number": return
|
|
1069
|
-
case "boolean": return
|
|
1070
|
-
case "date": return
|
|
1071
|
-
case "datetime": return
|
|
1072
|
-
case "select": return
|
|
1073
|
+
case "number": return ce(e);
|
|
1074
|
+
case "boolean": return s`<span class="ft-bool">${e ? "✔" : ""}</span>`;
|
|
1075
|
+
case "date": return le(e);
|
|
1076
|
+
case "datetime": return ue(e);
|
|
1077
|
+
case "select": return oe(e, t);
|
|
1073
1078
|
default: return String(e);
|
|
1074
1079
|
}
|
|
1075
1080
|
}
|
|
1076
|
-
function
|
|
1081
|
+
function oe(e, t) {
|
|
1077
1082
|
if (!t.options || t.options.length === 0 || typeof t.options[0] == "string") return e == null ? "" : String(e);
|
|
1078
1083
|
let n = t.options.find((t) => t.value === e);
|
|
1079
1084
|
return n ? n.label : e == null ? "" : String(e);
|
|
1080
1085
|
}
|
|
1081
|
-
var
|
|
1086
|
+
var se = {
|
|
1082
1087
|
year: "numeric",
|
|
1083
1088
|
month: "numeric",
|
|
1084
1089
|
day: "numeric",
|
|
@@ -1086,18 +1091,18 @@ var re = {
|
|
|
1086
1091
|
minute: "numeric",
|
|
1087
1092
|
second: "numeric"
|
|
1088
1093
|
};
|
|
1089
|
-
function
|
|
1090
|
-
return typeof e == "number" ? Number.isInteger(e) ?
|
|
1094
|
+
function ce(e) {
|
|
1095
|
+
return typeof e == "number" ? Number.isInteger(e) ? m(e) : m(e, { minimumFractionDigits: 1 }) : String(e);
|
|
1091
1096
|
}
|
|
1092
|
-
function
|
|
1093
|
-
return e instanceof Date || typeof e == "string" ?
|
|
1097
|
+
function le(e) {
|
|
1098
|
+
return e instanceof Date || typeof e == "string" ? p(e) : String(e);
|
|
1094
1099
|
}
|
|
1095
|
-
function
|
|
1096
|
-
return e instanceof Date || typeof e == "string" ?
|
|
1100
|
+
function ue(e) {
|
|
1101
|
+
return e instanceof Date || typeof e == "string" ? p(e, se) : String(e);
|
|
1097
1102
|
}
|
|
1098
1103
|
//#endregion
|
|
1099
1104
|
//#region src/core/selection.ts
|
|
1100
|
-
function
|
|
1105
|
+
function de(e) {
|
|
1101
1106
|
return {
|
|
1102
1107
|
startRow: Math.min(e.startRow, e.endRow),
|
|
1103
1108
|
startCol: Math.min(e.startCol, e.endCol),
|
|
@@ -1105,7 +1110,7 @@ function se(e) {
|
|
|
1105
1110
|
endCol: Math.max(e.startCol, e.endCol)
|
|
1106
1111
|
};
|
|
1107
1112
|
}
|
|
1108
|
-
var
|
|
1113
|
+
var fe = class {
|
|
1109
1114
|
constructor() {
|
|
1110
1115
|
this.activeCell = null, this.rangeAnchor = null, this.range = null, this.extraRanges = [], this._rowCount = 0, this._colCount = 0;
|
|
1111
1116
|
}
|
|
@@ -1113,10 +1118,10 @@ var ce = class {
|
|
|
1113
1118
|
this._rowCount = e, this._colCount = t;
|
|
1114
1119
|
}
|
|
1115
1120
|
setActive(e, t) {
|
|
1116
|
-
return e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount
|
|
1121
|
+
return e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount || (this.activeCell = {
|
|
1117
1122
|
row: e,
|
|
1118
1123
|
col: t
|
|
1119
|
-
}, this.rangeAnchor = null, this.range = null, this.extraRanges = [], this.activeCell
|
|
1124
|
+
}, this.rangeAnchor = null, this.range = null, this.extraRanges = []), this.activeCell;
|
|
1120
1125
|
}
|
|
1121
1126
|
toggleCell(e, t) {
|
|
1122
1127
|
if (e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount) return;
|
|
@@ -1129,15 +1134,15 @@ var ce = class {
|
|
|
1129
1134
|
});
|
|
1130
1135
|
}
|
|
1131
1136
|
setActiveWithRange(e, t) {
|
|
1132
|
-
return e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount
|
|
1137
|
+
return e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount || (!this.rangeAnchor && this.activeCell && (this.rangeAnchor = { ...this.activeCell }), this.activeCell = {
|
|
1133
1138
|
row: e,
|
|
1134
1139
|
col: t
|
|
1135
|
-
}, this.rangeAnchor && (this.range =
|
|
1140
|
+
}, this.rangeAnchor && (this.range = de({
|
|
1136
1141
|
startRow: this.rangeAnchor.row,
|
|
1137
1142
|
startCol: this.rangeAnchor.col,
|
|
1138
1143
|
endRow: e,
|
|
1139
1144
|
endCol: t
|
|
1140
|
-
})), this.activeCell
|
|
1145
|
+
}))), this.activeCell;
|
|
1141
1146
|
}
|
|
1142
1147
|
isInRange(e, t) {
|
|
1143
1148
|
if (this.range) {
|
|
@@ -1203,7 +1208,7 @@ var ce = class {
|
|
|
1203
1208
|
shiftMoveRight() {
|
|
1204
1209
|
return this.activeCell ? this.setActiveWithRange(this.activeCell.row, this.activeCell.col + 1) : null;
|
|
1205
1210
|
}
|
|
1206
|
-
},
|
|
1211
|
+
}, pe = class {
|
|
1207
1212
|
constructor() {
|
|
1208
1213
|
this.current = null;
|
|
1209
1214
|
}
|
|
@@ -1225,7 +1230,7 @@ var ce = class {
|
|
|
1225
1230
|
let e = this.current;
|
|
1226
1231
|
return this.current = null, e;
|
|
1227
1232
|
}
|
|
1228
|
-
},
|
|
1233
|
+
}, D = class {
|
|
1229
1234
|
constructor() {
|
|
1230
1235
|
this._selected = /* @__PURE__ */ new Set(), this._mode = "multi";
|
|
1231
1236
|
}
|
|
@@ -1283,37 +1288,34 @@ var ce = class {
|
|
|
1283
1288
|
}
|
|
1284
1289
|
selectRange(e, t, n) {
|
|
1285
1290
|
let r = e.indexOf(t), i = e.indexOf(n);
|
|
1286
|
-
if (this._mode === "single" || r < 0 || i < 0)
|
|
1287
|
-
|
|
1288
|
-
return;
|
|
1289
|
-
}
|
|
1290
|
-
for (let t = Math.min(r, i); t <= Math.max(r, i); t++) this._selected.add(e[t]);
|
|
1291
|
+
if (this._mode === "single" || r < 0 || i < 0) this.select(n);
|
|
1292
|
+
else for (let t = Math.min(r, i); t <= Math.max(r, i); t++) this._selected.add(e[t]);
|
|
1291
1293
|
}
|
|
1292
1294
|
};
|
|
1293
1295
|
//#endregion
|
|
1294
1296
|
//#region src/core/filtering.ts
|
|
1295
|
-
function
|
|
1297
|
+
function me(e, t, n) {
|
|
1296
1298
|
if (t.length === 0) return Array.from({ length: e.length }, (e, t) => t);
|
|
1297
|
-
let
|
|
1298
|
-
for (let
|
|
1299
|
-
let
|
|
1299
|
+
let i = [];
|
|
1300
|
+
for (let a = 0; a < e.length; a++) {
|
|
1301
|
+
let o = e[a], s = !0;
|
|
1300
1302
|
for (let e of t) try {
|
|
1301
|
-
if (!e.predicate(
|
|
1302
|
-
|
|
1303
|
+
if (!e.predicate(r(o, e.key), o)) {
|
|
1304
|
+
s = !1;
|
|
1303
1305
|
break;
|
|
1304
1306
|
}
|
|
1305
1307
|
} catch (t) {
|
|
1306
|
-
console.warn("Filter predicate error for key \"%s\":", e.key, t), n && n(t,
|
|
1308
|
+
console.warn("Filter predicate error for key \"%s\":", e.key, t), n && n(t, o, e);
|
|
1307
1309
|
}
|
|
1308
|
-
|
|
1310
|
+
s && i.push(a);
|
|
1309
1311
|
}
|
|
1310
|
-
return
|
|
1312
|
+
return i;
|
|
1311
1313
|
}
|
|
1312
1314
|
//#endregion
|
|
1313
1315
|
//#region src/core/undo.ts
|
|
1314
|
-
var
|
|
1316
|
+
var he = 100, O = class {
|
|
1315
1317
|
constructor() {
|
|
1316
|
-
this._undoStack = [], this._redoStack = [], this._maxSize =
|
|
1318
|
+
this._undoStack = [], this._redoStack = [], this._maxSize = he;
|
|
1317
1319
|
}
|
|
1318
1320
|
get maxSize() {
|
|
1319
1321
|
return this._maxSize;
|
|
@@ -1350,46 +1352,88 @@ var de = 100, k = class {
|
|
|
1350
1352
|
};
|
|
1351
1353
|
//#endregion
|
|
1352
1354
|
//#region src/clipboard/clipboard.ts
|
|
1353
|
-
function
|
|
1354
|
-
let
|
|
1355
|
-
for (let
|
|
1356
|
-
let
|
|
1355
|
+
function ge(e, t, n) {
|
|
1356
|
+
let i = [];
|
|
1357
|
+
for (let a = n.startRow; a <= n.endRow; a++) {
|
|
1358
|
+
let o = e[a], s = [];
|
|
1357
1359
|
for (let e = n.startCol; e <= n.endCol; e++) {
|
|
1358
|
-
let n =
|
|
1359
|
-
|
|
1360
|
+
let n = t[e], i = r(o, n.key);
|
|
1361
|
+
s.push(i == null ? "" : String(i));
|
|
1360
1362
|
}
|
|
1361
|
-
|
|
1363
|
+
i.push(s);
|
|
1362
1364
|
}
|
|
1363
|
-
return
|
|
1365
|
+
return b(i);
|
|
1366
|
+
}
|
|
1367
|
+
function k(e, t) {
|
|
1368
|
+
return A(e, t).value;
|
|
1364
1369
|
}
|
|
1365
1370
|
function A(e, t) {
|
|
1366
|
-
if (e === "") return
|
|
1371
|
+
if (e === "") return {
|
|
1372
|
+
value: null,
|
|
1373
|
+
failed: !1
|
|
1374
|
+
};
|
|
1375
|
+
let n = (t) => t === null ? {
|
|
1376
|
+
value: e,
|
|
1377
|
+
failed: !0
|
|
1378
|
+
} : {
|
|
1379
|
+
value: t,
|
|
1380
|
+
failed: !1
|
|
1381
|
+
};
|
|
1367
1382
|
switch (t.type) {
|
|
1368
1383
|
case "number": {
|
|
1369
|
-
let t =
|
|
1370
|
-
if (t !== null) return
|
|
1384
|
+
let t = _(e);
|
|
1385
|
+
if (t !== null) return {
|
|
1386
|
+
value: t,
|
|
1387
|
+
failed: !1
|
|
1388
|
+
};
|
|
1371
1389
|
let n = Number(e.trim());
|
|
1372
|
-
return e.trim() !== "" && Number.isFinite(n) ?
|
|
1390
|
+
return e.trim() !== "" && Number.isFinite(n) ? {
|
|
1391
|
+
value: n,
|
|
1392
|
+
failed: !1
|
|
1393
|
+
} : {
|
|
1394
|
+
value: e,
|
|
1395
|
+
failed: !0
|
|
1396
|
+
};
|
|
1373
1397
|
}
|
|
1374
|
-
case "boolean":
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1398
|
+
case "boolean": {
|
|
1399
|
+
let t = _e(e);
|
|
1400
|
+
return t === null ? {
|
|
1401
|
+
value: e,
|
|
1402
|
+
failed: !0
|
|
1403
|
+
} : {
|
|
1404
|
+
value: t,
|
|
1405
|
+
failed: !1
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
case "date": return n(h(e));
|
|
1409
|
+
case "datetime": return n(g(e));
|
|
1410
|
+
default: return {
|
|
1411
|
+
value: e,
|
|
1412
|
+
failed: !1
|
|
1413
|
+
};
|
|
1378
1414
|
}
|
|
1379
1415
|
}
|
|
1416
|
+
function _e(t) {
|
|
1417
|
+
let n = t.trim().toLowerCase(), r = (t, n, r) => new Set([
|
|
1418
|
+
...r,
|
|
1419
|
+
e(n),
|
|
1420
|
+
...e(t).split(",")
|
|
1421
|
+
].map((e) => e.trim().toLowerCase()).filter(Boolean));
|
|
1422
|
+
return r("booleanTrueWords", "booleanTrue", ["true", "1"]).has(n) ? !0 : !r("booleanFalseWords", "booleanFalse", ["false", "0"]).has(n) && null;
|
|
1423
|
+
}
|
|
1380
1424
|
function j(e) {
|
|
1381
1425
|
let t = String(e);
|
|
1382
1426
|
if (!Number.isFinite(e) || t.includes("e")) return t;
|
|
1383
|
-
let n = new Intl.NumberFormat(
|
|
1427
|
+
let n = new Intl.NumberFormat(f.get()).formatToParts(1.5).find((e) => e.type === "decimal")?.value;
|
|
1384
1428
|
return n && n !== "." ? t.replace(".", n) : t;
|
|
1385
1429
|
}
|
|
1386
|
-
function
|
|
1430
|
+
function ve(e) {
|
|
1387
1431
|
if (e == null || e === "") return "";
|
|
1388
1432
|
if (e instanceof Date) return Number.isNaN(e.getTime()) ? "" : `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
1389
1433
|
let t = String(e), n = /^(\d{4}-\d{2}-\d{2})(?:$|T)/.exec(t);
|
|
1390
1434
|
return n ? n[1] : t;
|
|
1391
1435
|
}
|
|
1392
|
-
function
|
|
1436
|
+
function ye(e) {
|
|
1393
1437
|
if (e == null || e === "") return "";
|
|
1394
1438
|
let t = e instanceof Date ? "" : String(e), n = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})(?::\d{2}(?:\.\d+)?)?$/.exec(t);
|
|
1395
1439
|
if (n) return `${n[1]} ${n[2]}`;
|
|
@@ -1399,8 +1443,23 @@ function me(e) {
|
|
|
1399
1443
|
return `${r.getFullYear()}-${i(r.getMonth() + 1)}-${i(r.getDate())} ${i(r.getHours())}:${i(r.getMinutes())}`;
|
|
1400
1444
|
}
|
|
1401
1445
|
//#endregion
|
|
1446
|
+
//#region src/export/values.ts
|
|
1447
|
+
function M(e, t) {
|
|
1448
|
+
let n = r(e, t.key);
|
|
1449
|
+
return t.exportValue ? t.exportValue(n, e) : n;
|
|
1450
|
+
}
|
|
1451
|
+
function N(e, t) {
|
|
1452
|
+
if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : e;
|
|
1453
|
+
if (typeof e != "string" || t.type !== "date" && t.type !== "datetime") return null;
|
|
1454
|
+
let n = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e), r = n ? new Date(Number(n[1]), Number(n[2]) - 1, Number(n[3])) : new Date(e);
|
|
1455
|
+
return Number.isNaN(r.getTime()) ? null : r;
|
|
1456
|
+
}
|
|
1457
|
+
function be(e) {
|
|
1458
|
+
return (Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()) - Date.UTC(1899, 11, 30)) / 864e5;
|
|
1459
|
+
}
|
|
1460
|
+
//#endregion
|
|
1402
1461
|
//#region src/export/xlsx-writer.ts
|
|
1403
|
-
var
|
|
1462
|
+
var xe = (() => {
|
|
1404
1463
|
let e = /* @__PURE__ */ new Uint32Array(256);
|
|
1405
1464
|
for (let t = 0; t < 256; t++) {
|
|
1406
1465
|
let n = t;
|
|
@@ -1409,23 +1468,23 @@ var he = (() => {
|
|
|
1409
1468
|
}
|
|
1410
1469
|
return e;
|
|
1411
1470
|
})();
|
|
1412
|
-
function
|
|
1471
|
+
function Se(e) {
|
|
1413
1472
|
let t = 4294967295;
|
|
1414
|
-
for (let n = 0; n < e.length; n++) t =
|
|
1473
|
+
for (let n = 0; n < e.length; n++) t = xe[(t ^ e[n]) & 255] ^ t >>> 8;
|
|
1415
1474
|
return (t ^ 4294967295) >>> 0;
|
|
1416
1475
|
}
|
|
1417
|
-
var
|
|
1418
|
-
function
|
|
1419
|
-
return
|
|
1476
|
+
var P = new TextEncoder();
|
|
1477
|
+
function Ce(e) {
|
|
1478
|
+
return F(e.map((e) => ({
|
|
1420
1479
|
...e,
|
|
1421
1480
|
body: e.data,
|
|
1422
1481
|
method: 0
|
|
1423
1482
|
})));
|
|
1424
1483
|
}
|
|
1425
|
-
async function
|
|
1484
|
+
async function we(e) {
|
|
1426
1485
|
let t = [];
|
|
1427
1486
|
for (let n of e) {
|
|
1428
|
-
let e = await
|
|
1487
|
+
let e = await Te(n.data);
|
|
1429
1488
|
t.push(e.length < n.data.length ? {
|
|
1430
1489
|
...n,
|
|
1431
1490
|
body: e,
|
|
@@ -1436,9 +1495,9 @@ async function ve(e) {
|
|
|
1436
1495
|
method: 0
|
|
1437
1496
|
});
|
|
1438
1497
|
}
|
|
1439
|
-
return
|
|
1498
|
+
return F(t);
|
|
1440
1499
|
}
|
|
1441
|
-
async function
|
|
1500
|
+
async function Te(e) {
|
|
1442
1501
|
let t = new CompressionStream("deflate-raw"), n = t.writable.getWriter(), r = t.readable.getReader();
|
|
1443
1502
|
n.write(e), n.close();
|
|
1444
1503
|
let i = [];
|
|
@@ -1447,52 +1506,50 @@ async function ye(e) {
|
|
|
1447
1506
|
if (e) break;
|
|
1448
1507
|
i.push(t);
|
|
1449
1508
|
}
|
|
1450
|
-
return
|
|
1509
|
+
return I(i);
|
|
1451
1510
|
}
|
|
1452
|
-
function
|
|
1511
|
+
function F(e) {
|
|
1453
1512
|
let t = [], n = [], r = 0;
|
|
1454
1513
|
for (let i of e) {
|
|
1455
|
-
let e =
|
|
1514
|
+
let e = P.encode(i.name), a = Se(i.data), o = i.data.length, s = i.body.length, c = i.method === 8 ? 20 : 10, l = new ArrayBuffer(30 + e.length), u = new DataView(l);
|
|
1456
1515
|
u.setUint32(0, 67324752, !0), u.setUint16(4, c, !0), u.setUint16(6, 0, !0), u.setUint16(8, i.method, !0), u.setUint16(10, 0, !0), u.setUint16(12, 33, !0), u.setUint32(14, a, !0), u.setUint32(18, s, !0), u.setUint32(22, o, !0), u.setUint16(26, e.length, !0), u.setUint16(28, 0, !0), new Uint8Array(l, 30).set(e), t.push(new Uint8Array(l)), t.push(i.body);
|
|
1457
1516
|
let d = new ArrayBuffer(46 + e.length), f = new DataView(d);
|
|
1458
1517
|
f.setUint32(0, 33639248, !0), f.setUint16(4, 20, !0), f.setUint16(6, c, !0), f.setUint16(8, 0, !0), f.setUint16(10, i.method, !0), f.setUint16(12, 0, !0), f.setUint16(14, 33, !0), f.setUint32(16, a, !0), f.setUint32(20, s, !0), f.setUint32(24, o, !0), f.setUint16(28, e.length, !0), f.setUint16(30, 0, !0), f.setUint16(32, 0, !0), f.setUint16(34, 0, !0), f.setUint16(36, 0, !0), f.setUint32(38, 0, !0), f.setUint32(42, r, !0), new Uint8Array(d, 46).set(e), n.push(new Uint8Array(d)), r += 30 + e.length + s;
|
|
1459
1518
|
}
|
|
1460
|
-
let i =
|
|
1461
|
-
return o.setUint32(0, 101010256, !0), o.setUint16(4, 0, !0), o.setUint16(6, 0, !0), o.setUint16(8, e.length, !0), o.setUint16(10, e.length, !0), o.setUint32(12, i.length, !0), o.setUint32(16, r, !0), o.setUint16(20, 0, !0),
|
|
1519
|
+
let i = I(n), a = /* @__PURE__ */ new ArrayBuffer(22), o = new DataView(a);
|
|
1520
|
+
return o.setUint32(0, 101010256, !0), o.setUint16(4, 0, !0), o.setUint16(6, 0, !0), o.setUint16(8, e.length, !0), o.setUint16(10, e.length, !0), o.setUint32(12, i.length, !0), o.setUint32(16, r, !0), o.setUint16(20, 0, !0), I([
|
|
1462
1521
|
...t,
|
|
1463
1522
|
i,
|
|
1464
1523
|
new Uint8Array(a)
|
|
1465
1524
|
]);
|
|
1466
1525
|
}
|
|
1467
|
-
function
|
|
1526
|
+
function I(e) {
|
|
1468
1527
|
let t = e.reduce((e, t) => e + t.length, 0), n = new Uint8Array(t), r = 0;
|
|
1469
1528
|
for (let t of e) n.set(t, r), r += t.length;
|
|
1470
1529
|
return n;
|
|
1471
1530
|
}
|
|
1472
|
-
function
|
|
1531
|
+
function L(e) {
|
|
1473
1532
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1474
1533
|
}
|
|
1475
|
-
function
|
|
1534
|
+
function Ee(e) {
|
|
1476
1535
|
let t = "";
|
|
1477
1536
|
for (e++; e > 0;) t = String.fromCharCode(64 + (e % 26 || 26)) + t, e = Math.floor((e - 1) / 26);
|
|
1478
1537
|
return t;
|
|
1479
1538
|
}
|
|
1480
|
-
function
|
|
1481
|
-
return
|
|
1482
|
-
}
|
|
1483
|
-
function xe(e) {
|
|
1484
|
-
let t = Date.UTC(1899, 11, 30);
|
|
1485
|
-
return (e.getTime() - t) / 864e5;
|
|
1539
|
+
function R(e, t) {
|
|
1540
|
+
return Ee(t) + (e + 1);
|
|
1486
1541
|
}
|
|
1487
|
-
var
|
|
1488
|
-
function
|
|
1489
|
-
let n = [], r = t.map((e, t) => `<c r="${
|
|
1542
|
+
var De = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\n <Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/>\n <Default Extension=\"xml\" ContentType=\"application/xml\"/>\n <Override PartName=\"/xl/workbook.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\"/>\n <Override PartName=\"/xl/worksheets/sheet1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/>\n <Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/>\n</Types>", Oe = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n <Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"xl/workbook.xml\"/>\n</Relationships>", ke = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">\n <sheets><sheet name=\"Sheet1\" sheetId=\"1\" r:id=\"rId1\"/></sheets>\n</workbook>", Ae = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n <Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\" Target=\"worksheets/sheet1.xml\"/>\n <Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/>\n</Relationships>", je = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">\n <numFmts count=\"1\"><numFmt numFmtId=\"164\" formatCode=\"yyyy-mm-dd\"/></numFmts>\n <fonts count=\"2\">\n <font><sz val=\"11\"/><name val=\"Calibri\"/></font>\n <font><sz val=\"11\"/><b/><name val=\"Calibri\"/></font>\n </fonts>\n <fills count=\"2\">\n <fill><patternFill patternType=\"none\"/></fill>\n <fill><patternFill patternType=\"gray125\"/></fill>\n </fills>\n <borders count=\"1\"><border><left/><right/><top/><bottom/><diagonal/></border></borders>\n <cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs>\n <cellXfs count=\"3\">\n <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\"/>\n <xf numFmtId=\"164\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyNumberFormat=\"1\"/>\n <xf numFmtId=\"0\" fontId=\"1\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyFont=\"1\"/>\n </cellXfs>\n</styleSheet>";
|
|
1543
|
+
function Me(e, t) {
|
|
1544
|
+
let n = [], r = t.map((e, t) => `<c r="${R(0, t)}" t="str" s="2"><v>${L(e.label)}</v></c>`);
|
|
1490
1545
|
return n.push(`<row r="1">${r.join("")}</row>`), e.forEach((e, r) => {
|
|
1491
1546
|
let i = t.map((t, n) => {
|
|
1492
|
-
let i =
|
|
1547
|
+
let i = R(r + 1, n), a = M(e, t);
|
|
1493
1548
|
if (a == null) return `<c r="${i}" t="str"><v></v></c>`;
|
|
1494
1549
|
let o = t.type ?? "text";
|
|
1495
|
-
|
|
1550
|
+
if (o === "number" && typeof a == "number") return `<c r="${i}"><v>${a}</v></c>`;
|
|
1551
|
+
let s = N(a, t);
|
|
1552
|
+
return s ? `<c r="${i}" s="1"><v>${be(s).toFixed(6)}</v></c>` : o === "boolean" ? `<c r="${i}" t="b"><v>${+!!a}</v></c>` : `<c r="${i}" t="str"><v>${L(String(a))}</v></c>`;
|
|
1496
1553
|
});
|
|
1497
1554
|
n.push(`<row r="${r + 2}">${i.join("")}</row>`);
|
|
1498
1555
|
}), `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -1500,104 +1557,106 @@ function De(e, t) {
|
|
|
1500
1557
|
<sheetData>${n.join("")}</sheetData>
|
|
1501
1558
|
</worksheet>`;
|
|
1502
1559
|
}
|
|
1503
|
-
function
|
|
1504
|
-
return
|
|
1560
|
+
function Ne(e, t) {
|
|
1561
|
+
return Ce(z(e, t));
|
|
1505
1562
|
}
|
|
1506
|
-
function
|
|
1507
|
-
return
|
|
1563
|
+
function Pe(e, t) {
|
|
1564
|
+
return we(z(e, t));
|
|
1508
1565
|
}
|
|
1509
|
-
function
|
|
1510
|
-
let n =
|
|
1566
|
+
function z(e, t) {
|
|
1567
|
+
let n = Me(e, t);
|
|
1511
1568
|
return [
|
|
1512
1569
|
{
|
|
1513
1570
|
name: "[Content_Types].xml",
|
|
1514
|
-
data:
|
|
1571
|
+
data: P.encode(De)
|
|
1515
1572
|
},
|
|
1516
1573
|
{
|
|
1517
1574
|
name: "_rels/.rels",
|
|
1518
|
-
data:
|
|
1575
|
+
data: P.encode(Oe)
|
|
1519
1576
|
},
|
|
1520
1577
|
{
|
|
1521
1578
|
name: "xl/workbook.xml",
|
|
1522
|
-
data:
|
|
1579
|
+
data: P.encode(ke)
|
|
1523
1580
|
},
|
|
1524
1581
|
{
|
|
1525
1582
|
name: "xl/_rels/workbook.xml.rels",
|
|
1526
|
-
data:
|
|
1583
|
+
data: P.encode(Ae)
|
|
1527
1584
|
},
|
|
1528
1585
|
{
|
|
1529
1586
|
name: "xl/worksheets/sheet1.xml",
|
|
1530
|
-
data:
|
|
1587
|
+
data: P.encode(n)
|
|
1531
1588
|
},
|
|
1532
1589
|
{
|
|
1533
1590
|
name: "xl/styles.xml",
|
|
1534
|
-
data:
|
|
1591
|
+
data: P.encode(je)
|
|
1535
1592
|
}
|
|
1536
1593
|
];
|
|
1537
1594
|
}
|
|
1538
1595
|
//#endregion
|
|
1539
1596
|
//#region src/export/export.ts
|
|
1540
|
-
|
|
1597
|
+
var Fe = "";
|
|
1598
|
+
function B(e, t, n, r = {}) {
|
|
1599
|
+
let i = r.bom ? Fe : "";
|
|
1541
1600
|
switch (n) {
|
|
1542
|
-
case "csv": return
|
|
1543
|
-
case "tsv": return
|
|
1544
|
-
case "json": return
|
|
1545
|
-
case "xlsx": return
|
|
1601
|
+
case "csv": return i + H(e, t, ",");
|
|
1602
|
+
case "tsv": return i + H(e, t, " ");
|
|
1603
|
+
case "json": return Le(e, t);
|
|
1604
|
+
case "xlsx": return Ne(e, t);
|
|
1546
1605
|
}
|
|
1547
1606
|
}
|
|
1548
|
-
async function
|
|
1549
|
-
let
|
|
1550
|
-
return new Blob([
|
|
1607
|
+
async function V(e, t, n, r = {}) {
|
|
1608
|
+
let i = n === "xlsx" ? await Pe(e, t) : B(e, t, n, r);
|
|
1609
|
+
return new Blob([i], { type: Be(n) });
|
|
1551
1610
|
}
|
|
1552
|
-
function
|
|
1553
|
-
return e == null ? "" :
|
|
1611
|
+
function Ie(e) {
|
|
1612
|
+
return e == null ? "" : e instanceof Date ? e.toISOString() : String(e);
|
|
1554
1613
|
}
|
|
1555
|
-
function
|
|
1556
|
-
return [t.map((e) =>
|
|
1614
|
+
function H(e, t, n) {
|
|
1615
|
+
return [t.map((e) => U(e.label, n)).join(n), ...e.map((e) => t.map((t) => U(Ie(M(e, t)), n)).join(n))].join("\n");
|
|
1557
1616
|
}
|
|
1558
|
-
function
|
|
1617
|
+
function U(e, t) {
|
|
1559
1618
|
return e.includes(t) || e.includes("\"") || e.includes("\n") || e.includes("\r") ? "\"" + e.replace(/"/g, "\"\"") + "\"" : e;
|
|
1560
1619
|
}
|
|
1561
|
-
function
|
|
1620
|
+
function Le(e, t) {
|
|
1562
1621
|
let n = e.map((e) => {
|
|
1563
1622
|
let n = {};
|
|
1564
1623
|
for (let r of t) {
|
|
1565
|
-
let t = e
|
|
1566
|
-
|
|
1624
|
+
let t = M(e, r);
|
|
1625
|
+
n[r.key] = t instanceof Date ? N(t, r)?.toISOString() ?? null : t ?? null;
|
|
1567
1626
|
}
|
|
1568
1627
|
return n;
|
|
1569
1628
|
});
|
|
1570
1629
|
return JSON.stringify(n, null, 2);
|
|
1571
1630
|
}
|
|
1572
|
-
function
|
|
1631
|
+
function W(e, t) {
|
|
1573
1632
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
1574
1633
|
r.href = n, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), setTimeout(() => URL.revokeObjectURL(n), 100);
|
|
1575
1634
|
}
|
|
1576
|
-
var
|
|
1635
|
+
var Re = {
|
|
1577
1636
|
csv: "text/csv;charset=utf-8",
|
|
1578
1637
|
tsv: "text/tab-separated-values;charset=utf-8",
|
|
1579
1638
|
json: "application/json;charset=utf-8",
|
|
1580
1639
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
1581
|
-
},
|
|
1640
|
+
}, ze = {
|
|
1582
1641
|
csv: ".csv",
|
|
1583
1642
|
tsv: ".tsv",
|
|
1584
1643
|
json: ".json",
|
|
1585
1644
|
xlsx: ".xlsx"
|
|
1586
1645
|
};
|
|
1587
|
-
function
|
|
1588
|
-
return
|
|
1646
|
+
function Be(e) {
|
|
1647
|
+
return Re[e];
|
|
1589
1648
|
}
|
|
1590
|
-
function
|
|
1591
|
-
return
|
|
1649
|
+
function Ve(e) {
|
|
1650
|
+
return ze[e];
|
|
1592
1651
|
}
|
|
1593
1652
|
//#endregion
|
|
1594
1653
|
//#region src/export/xlsx-reader.ts
|
|
1595
|
-
function
|
|
1654
|
+
function He(e) {
|
|
1596
1655
|
for (let t = e.byteLength - 22; t >= 0; t--) if (e.getUint32(t, !0) === 101010256) return t;
|
|
1597
1656
|
throw Error("XLSX: End of central directory not found — not a valid ZIP file");
|
|
1598
1657
|
}
|
|
1599
|
-
function
|
|
1600
|
-
let t =
|
|
1658
|
+
function Ue(e) {
|
|
1659
|
+
let t = He(e), n = e.getUint32(t + 16, !0), r = e.getUint32(t + 12, !0), i = new TextDecoder("utf-8"), a = [], o = n, s = n + r;
|
|
1601
1660
|
for (; o < s && e.getUint32(o, !0) === 33639248;) {
|
|
1602
1661
|
let t = e.getUint16(o + 10, !0), n = e.getUint32(o + 20, !0), r = e.getUint32(o + 24, !0), s = e.getUint16(o + 28, !0), c = e.getUint16(o + 30, !0), l = e.getUint16(o + 32, !0), u = e.getUint32(o + 42, !0), d = i.decode(new Uint8Array(e.buffer, o + 46, s));
|
|
1603
1662
|
a.push({
|
|
@@ -1610,7 +1669,7 @@ function Le(e) {
|
|
|
1610
1669
|
}
|
|
1611
1670
|
return a;
|
|
1612
1671
|
}
|
|
1613
|
-
async function
|
|
1672
|
+
async function We(e) {
|
|
1614
1673
|
let t = new DecompressionStream("deflate-raw"), n = t.writable.getWriter(), r = t.readable.getReader();
|
|
1615
1674
|
n.write(e), n.close();
|
|
1616
1675
|
let i = [];
|
|
@@ -1623,28 +1682,28 @@ async function Re(e) {
|
|
|
1623
1682
|
for (let e of i) o.set(e, s), s += e.length;
|
|
1624
1683
|
return o;
|
|
1625
1684
|
}
|
|
1626
|
-
async function
|
|
1685
|
+
async function Ge(e, t) {
|
|
1627
1686
|
let n = t.localHeaderOffset, r = e.getUint16(n + 26, !0), i = e.getUint16(n + 28, !0), a = n + 30 + r + i, o = new Uint8Array(e.buffer, a, t.compressedSize);
|
|
1628
1687
|
if (t.compressionMethod === 0) return o.slice();
|
|
1629
|
-
if (t.compressionMethod === 8) return
|
|
1688
|
+
if (t.compressionMethod === 8) return We(o);
|
|
1630
1689
|
throw Error(`XLSX: Unsupported compression method ${t.compressionMethod}`);
|
|
1631
1690
|
}
|
|
1632
|
-
async function
|
|
1633
|
-
let t = new DataView(e), n =
|
|
1634
|
-
for (let e of n) e.compressedSize === 0 && e.name.endsWith("/") || r.set(e.name, await
|
|
1691
|
+
async function Ke(e) {
|
|
1692
|
+
let t = new DataView(e), n = Ue(t), r = /* @__PURE__ */ new Map();
|
|
1693
|
+
for (let e of n) e.compressedSize === 0 && e.name.endsWith("/") || r.set(e.name, await Ge(t, e));
|
|
1635
1694
|
return r;
|
|
1636
1695
|
}
|
|
1637
|
-
var
|
|
1638
|
-
function
|
|
1639
|
-
let t =
|
|
1696
|
+
var qe = new TextDecoder("utf-8");
|
|
1697
|
+
function G(e) {
|
|
1698
|
+
let t = qe.decode(e);
|
|
1640
1699
|
return new DOMParser().parseFromString(t, "application/xml");
|
|
1641
1700
|
}
|
|
1642
|
-
function
|
|
1701
|
+
function Je(e) {
|
|
1643
1702
|
if (!e) return [];
|
|
1644
|
-
let t =
|
|
1703
|
+
let t = G(e);
|
|
1645
1704
|
return Array.from(t.querySelectorAll("si")).map((e) => Array.from(e.querySelectorAll("t")).map((e) => e.textContent ?? "").join(""));
|
|
1646
1705
|
}
|
|
1647
|
-
var
|
|
1706
|
+
var Ye = /* @__PURE__ */ new Set([
|
|
1648
1707
|
14,
|
|
1649
1708
|
15,
|
|
1650
1709
|
16,
|
|
@@ -1664,37 +1723,37 @@ var Ue = /* @__PURE__ */ new Set([
|
|
|
1664
1723
|
57,
|
|
1665
1724
|
58
|
|
1666
1725
|
]);
|
|
1667
|
-
function
|
|
1726
|
+
function Xe(e) {
|
|
1668
1727
|
let t = e.replace(/"[^"]*"/g, "").replace(/\\./g, "").replace(/\[[^\]]*\]/g, "").split(";")[0];
|
|
1669
1728
|
return /[dy]/i.test(t);
|
|
1670
1729
|
}
|
|
1671
|
-
function
|
|
1730
|
+
function Ze(e) {
|
|
1672
1731
|
let t = /* @__PURE__ */ new Set();
|
|
1673
1732
|
if (!e) return t;
|
|
1674
|
-
let n =
|
|
1733
|
+
let n = G(e), r = /* @__PURE__ */ new Map();
|
|
1675
1734
|
for (let e of Array.from(n.querySelectorAll("numFmts > numFmt"))) r.set(parseInt(e.getAttribute("numFmtId") ?? "", 10), e.getAttribute("formatCode") ?? "");
|
|
1676
1735
|
return Array.from(n.querySelectorAll("cellXfs > xf")).forEach((e, n) => {
|
|
1677
1736
|
let i = parseInt(e.getAttribute("numFmtId") ?? "0", 10), a = r.get(i);
|
|
1678
|
-
(a === void 0 ?
|
|
1737
|
+
(a === void 0 ? Ye.has(i) : Xe(a)) && t.add(n);
|
|
1679
1738
|
}), t;
|
|
1680
1739
|
}
|
|
1681
|
-
function
|
|
1740
|
+
function Qe(e) {
|
|
1682
1741
|
if (!e) return !1;
|
|
1683
|
-
let t =
|
|
1742
|
+
let t = G(e).querySelector("workbookPr")?.getAttribute("date1904");
|
|
1684
1743
|
return t === "1" || t === "true";
|
|
1685
1744
|
}
|
|
1686
|
-
function
|
|
1745
|
+
function $e(e, t) {
|
|
1687
1746
|
return new Date((t ? Date.UTC(1904, 0, 1) : Date.UTC(1899, 11, 30)) + Math.floor(e) * 864e5).toISOString().slice(0, 10);
|
|
1688
1747
|
}
|
|
1689
|
-
function
|
|
1690
|
-
let i =
|
|
1748
|
+
function et(e, t, n, r) {
|
|
1749
|
+
let i = G(e).querySelectorAll("row");
|
|
1691
1750
|
if (i.length === 0) return [];
|
|
1692
1751
|
let a = 0, o = /* @__PURE__ */ new Map();
|
|
1693
1752
|
for (let e of i) {
|
|
1694
1753
|
let i = parseInt(e.getAttribute("r") ?? "1", 10) - 1, s = /* @__PURE__ */ new Map();
|
|
1695
1754
|
o.set(i, s);
|
|
1696
1755
|
for (let i of e.querySelectorAll("c")) {
|
|
1697
|
-
let e =
|
|
1756
|
+
let e = tt(i.getAttribute("r") ?? "");
|
|
1698
1757
|
e > a && (a = e);
|
|
1699
1758
|
let o = i.getAttribute("t") ?? "", c = i.getAttribute("s") ?? "", l = i.querySelector("v")?.textContent ?? "", u = i.querySelector("is > t")?.textContent ?? null, d;
|
|
1700
1759
|
if (o === "s") d = t[parseInt(l, 10)] ?? "";
|
|
@@ -1703,7 +1762,7 @@ function Je(e, t, n, r) {
|
|
|
1703
1762
|
else if (l === "") d = "";
|
|
1704
1763
|
else {
|
|
1705
1764
|
let e = parseFloat(l);
|
|
1706
|
-
d = c !== "" && n.has(parseInt(c, 10)) && !isNaN(e) && e >= 0 ?
|
|
1765
|
+
d = c !== "" && n.has(parseInt(c, 10)) && !isNaN(e) && e >= 0 ? $e(e, r) : l;
|
|
1707
1766
|
}
|
|
1708
1767
|
s.set(e, d);
|
|
1709
1768
|
}
|
|
@@ -1717,13 +1776,13 @@ function Je(e, t, n, r) {
|
|
|
1717
1776
|
}
|
|
1718
1777
|
return c;
|
|
1719
1778
|
}
|
|
1720
|
-
function
|
|
1779
|
+
function tt(e) {
|
|
1721
1780
|
let t = 0, n = 0;
|
|
1722
1781
|
for (; n < e.length && e[n] >= "A" && e[n] <= "Z";) t = t * 26 + (e.charCodeAt(n) - 64), n++;
|
|
1723
1782
|
return t - 1;
|
|
1724
1783
|
}
|
|
1725
|
-
async function
|
|
1726
|
-
let t = await
|
|
1784
|
+
async function nt(e) {
|
|
1785
|
+
let t = await Ke(e), n = Je(t.get("xl/sharedStrings.xml")), r = t.get("xl/worksheets/sheet1.xml");
|
|
1727
1786
|
if (!r) {
|
|
1728
1787
|
for (let [e, n] of t) if (e.toLowerCase().includes("worksheets/sheet")) {
|
|
1729
1788
|
r = n;
|
|
@@ -1731,7 +1790,7 @@ async function Xe(e) {
|
|
|
1731
1790
|
}
|
|
1732
1791
|
}
|
|
1733
1792
|
if (!r) throw Error("XLSX: No worksheet found");
|
|
1734
|
-
let i =
|
|
1793
|
+
let i = Ze(t.get("xl/styles.xml")), a = Qe(t.get("xl/workbook.xml")), o = et(r, n, i, a);
|
|
1735
1794
|
return o.length === 0 ? {
|
|
1736
1795
|
headers: [],
|
|
1737
1796
|
rows: []
|
|
@@ -1741,13 +1800,69 @@ async function Xe(e) {
|
|
|
1741
1800
|
};
|
|
1742
1801
|
}
|
|
1743
1802
|
//#endregion
|
|
1803
|
+
//#region src/export/delimited-reader.ts
|
|
1804
|
+
var rt = [
|
|
1805
|
+
",",
|
|
1806
|
+
";",
|
|
1807
|
+
" "
|
|
1808
|
+
];
|
|
1809
|
+
function it(e) {
|
|
1810
|
+
let t = new Map(rt.map((e) => [e, 0])), n = !1;
|
|
1811
|
+
for (let r of e) if (r === "\"") n = !n;
|
|
1812
|
+
else if (!n && (r === "\n" || r === "\r")) break;
|
|
1813
|
+
else !n && t.has(r) && t.set(r, t.get(r) + 1);
|
|
1814
|
+
let r = ",", i = 0;
|
|
1815
|
+
for (let [e, n] of t) n > i && (r = e, i = n);
|
|
1816
|
+
return r;
|
|
1817
|
+
}
|
|
1818
|
+
function at(e, t) {
|
|
1819
|
+
let n = e.charCodeAt(0) === 65279 ? e.slice(1) : e, r = v(n, t === "tsv" ? " " : it(n));
|
|
1820
|
+
return {
|
|
1821
|
+
headers: r[0] ?? [],
|
|
1822
|
+
rows: r.slice(1)
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
//#endregion
|
|
1826
|
+
//#region src/export/import.ts
|
|
1827
|
+
var ot = (e) => e.trim().toLowerCase();
|
|
1828
|
+
function st(e, t) {
|
|
1829
|
+
let n = (e) => [e.label, ...e.importAliases ?? []], r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
1830
|
+
return e.forEach((e, a) => {
|
|
1831
|
+
let o = t.find((t) => !i.has(t.key) && n(t).includes(e)) ?? t.find((t) => !i.has(t.key) && n(t).some((t) => ot(t) === ot(e)));
|
|
1832
|
+
o && (i.add(o.key), r.set(a, o.key));
|
|
1833
|
+
}), r;
|
|
1834
|
+
}
|
|
1835
|
+
function ct(e, n) {
|
|
1836
|
+
let r = st(e.headers, n), i = new Map(n.map((e) => [e.key, e])), a = [], o = e.rows.map((e, n) => {
|
|
1837
|
+
let o = {};
|
|
1838
|
+
for (let [s, c] of r) {
|
|
1839
|
+
let { value: r, failed: l } = A(e[s] ?? "", i.get(c));
|
|
1840
|
+
t(o, c, r), l && a.push({
|
|
1841
|
+
row: n,
|
|
1842
|
+
key: c,
|
|
1843
|
+
raw: e[s] ?? ""
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
return o;
|
|
1847
|
+
}), s = new Set(r.values());
|
|
1848
|
+
return {
|
|
1849
|
+
rows: o,
|
|
1850
|
+
report: {
|
|
1851
|
+
count: o.length,
|
|
1852
|
+
unmatchedHeaders: e.headers.filter((e, t) => !r.has(t) && e.trim() !== ""),
|
|
1853
|
+
missingColumns: n.filter((e) => !s.has(e.key)).map((e) => e.key),
|
|
1854
|
+
coercionFailures: a
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
}
|
|
1858
|
+
//#endregion
|
|
1744
1859
|
//#region src/models/types.ts
|
|
1745
|
-
function
|
|
1860
|
+
function K(e) {
|
|
1746
1861
|
return e.align ? e.align : e.type === "number" ? "end" : e.type === "boolean" ? "center" : "start";
|
|
1747
1862
|
}
|
|
1748
1863
|
//#endregion
|
|
1749
|
-
//#region \0@oxc-project+runtime@0.
|
|
1750
|
-
function
|
|
1864
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
1865
|
+
function q(e, t, n, r) {
|
|
1751
1866
|
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
1752
1867
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
1753
1868
|
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
@@ -1755,16 +1870,16 @@ function G(e, t, n, r) {
|
|
|
1755
1870
|
}
|
|
1756
1871
|
//#endregion
|
|
1757
1872
|
//#region src/flex-table.ts
|
|
1758
|
-
var
|
|
1873
|
+
var lt = {
|
|
1759
1874
|
eq: "=",
|
|
1760
1875
|
neq: "≠",
|
|
1761
1876
|
gt: ">",
|
|
1762
1877
|
lt: "<",
|
|
1763
1878
|
gte: "≥",
|
|
1764
1879
|
lte: "≤"
|
|
1765
|
-
},
|
|
1880
|
+
}, J = 120, Y = 40, X = 20, ut = 32, Z = 5, dt = 200, Q = class extends a {
|
|
1766
1881
|
constructor(...e) {
|
|
1767
|
-
super(...e), this.columns = [], this._data = [], this._inUndoRedo = !1, this.clearUndoOnDataChange = !1, this.clearSelectionOnDataChange = !1, this.rowKey = "_id", this._rowHeightFromCss =
|
|
1882
|
+
super(...e), this.columns = [], this._data = [], this._inUndoRedo = !1, this.clearUndoOnDataChange = !1, this.clearSelectionOnDataChange = !1, this.rowKey = "_id", this._rowHeightFromCss = ut, this._targetFloor = 0, this.showRowNumbers = !1, this.theme = void 0, this.maxRows = 0, this.editable = !0, this.showFilters = !1, this.showContextMenu = !1, this.frozenRows = 0, this.emptyMessage = "", this.noMatchingMessage = "", this.error = null, this.loading = !1, this.importEnabled = !1, this.selectable = !1, this.dataMode = "client", this.footerData = null, this.stylesheets = [], this._scrollTop = 0, this._scrollLeft = 0, this._viewportHeight = 0, this._viewportWidth = 0, this._colLeftOffsets = [], this._totalRowWidth = 0, this._baseStyleSheets = [], this._activeCell = null, this._headerCol = null, this._focusedCellEl = null, this._editingCell = null, this._sortCriteria = [], this._selection = new fe(), this._editing = new pe(), this._rowSelection = new D(), this._undo = new O(), this._filters = [], this._filteredIndices = [], this._sortedIndices = [], this._openFilterKey = null, this._rowSelectionVersion = 0, this._lastCheckboxRowId = null, this._unkeyedIds = /* @__PURE__ */ new WeakMap(), this._unkeyedSeq = 0, this._visibleIdsCache = null, this._checkboxShiftPending = !1, this._autocompleteState = null, this._headerMenu = null, this._bodyContextMenu = null, this._commentPopup = null, this._viewDirty = !0, this._isDragging = !1, this._wasDrag = !1, this._resizing = null, this._resizeCleanup = null, this._wasHeaderDrag = !1, this._wasRowDrag = !1, this._colDrag = null, this._colDragIndicatorLeft = null, this._fillDrag = null, this._rowDrag = null, this._rowDragIndicatorY = null, this._findState = null, this._columnWidths = /* @__PURE__ */ new Map(), this._hostResizeObserver = null, this._comments = /* @__PURE__ */ new Map(), this._isDragOver = !1, this._editorMoving = !1, this._onEditorBlur = (e) => {
|
|
1768
1883
|
!this._editorMoving && e.currentTarget?.isConnected && this._commitEdit();
|
|
1769
1884
|
}, this._warnedUnconstrained = !1, this._onHostFocus = (e) => {
|
|
1770
1885
|
e.composedPath()[0] !== this || this._activeCell || this._headerCol !== null || this.visibleColumns.length !== 0 && this.matches(":focus-visible") && (this._visibleRowCount > 0 ? (this._selection.setActive(0, 0), this._syncActiveCell()) : this._headerCol = 0);
|
|
@@ -1776,18 +1891,14 @@ var K = {
|
|
|
1776
1891
|
if (t && (t === this || this.contains(t) || this.shadowRoot?.contains(t))) return;
|
|
1777
1892
|
let n = e.composedPath()[0];
|
|
1778
1893
|
requestAnimationFrame(() => {
|
|
1779
|
-
|
|
1780
|
-
this._syncGridFocus();
|
|
1781
|
-
return;
|
|
1782
|
-
}
|
|
1783
|
-
document.activeElement !== this && (this._focusedCellEl = null, this._hostTabIndexLowered && (this._hostTabIndexLowered = !1, this.tabIndex = 0));
|
|
1894
|
+
n instanceof HTMLElement && n === this._focusedCellEl && !n.isConnected ? this._syncGridFocus() : document.activeElement !== this && (this._focusedCellEl = null, this._hostTabIndexLowered && (this._hostTabIndexLowered = !1, this.tabIndex = 0));
|
|
1784
1895
|
});
|
|
1785
1896
|
}, this._hostTabIndexLowered = !1, this._onCommentPopupOutsideClick = () => {
|
|
1786
1897
|
this._commitCommentPopup();
|
|
1787
1898
|
}, this._invalidCells = /* @__PURE__ */ new Map(), this._textFilterState = /* @__PURE__ */ new Map(), this._numberFilterState = /* @__PURE__ */ new Map(), this._dateFilterState = /* @__PURE__ */ new Map(), this._emptyFilterState = /* @__PURE__ */ new Map();
|
|
1788
1899
|
}
|
|
1789
1900
|
static {
|
|
1790
|
-
this.styles =
|
|
1901
|
+
this.styles = E;
|
|
1791
1902
|
}
|
|
1792
1903
|
get data() {
|
|
1793
1904
|
return this._data;
|
|
@@ -1797,7 +1908,7 @@ var K = {
|
|
|
1797
1908
|
this._data = e, n && !this._inUndoRedo && (this.clearUndoOnDataChange && this._undo.clear(), this._comments.size > 0 && this._pruneGoneUnkeyedComments(), this._rowSelection.selectedCount > 0 && (this.clearSelectionOnDataChange ? (this._rowSelection.deselectAll(), 1) : this._pruneGoneUnkeyedRows()) && (this._rowSelectionVersion++, this._dispatchRowSelectionEvent())), this.requestUpdate("data", t);
|
|
1798
1909
|
}
|
|
1799
1910
|
get rowHeight() {
|
|
1800
|
-
let e = this._rowHeightExplicit ?? this._rowHeightFromCss ??
|
|
1911
|
+
let e = this._rowHeightExplicit ?? this._rowHeightFromCss ?? ut;
|
|
1801
1912
|
return Math.max(e, this._targetFloor);
|
|
1802
1913
|
}
|
|
1803
1914
|
set rowHeight(e) {
|
|
@@ -2128,57 +2239,60 @@ var K = {
|
|
|
2128
2239
|
}
|
|
2129
2240
|
updateRows(e) {
|
|
2130
2241
|
if (e.length === 0) return;
|
|
2131
|
-
let
|
|
2132
|
-
for (let
|
|
2133
|
-
if (
|
|
2134
|
-
let e = this.data[
|
|
2135
|
-
this.data[
|
|
2136
|
-
row:
|
|
2137
|
-
key:
|
|
2242
|
+
let n = [], i = [];
|
|
2243
|
+
for (let a of e) {
|
|
2244
|
+
if (a.row < 0 || a.row >= this.data.length) continue;
|
|
2245
|
+
let e = r(this.data[a.row], a.key);
|
|
2246
|
+
t(this.data[a.row], a.key, a.value), n.push({
|
|
2247
|
+
row: a.row,
|
|
2248
|
+
key: a.key,
|
|
2138
2249
|
oldValue: e,
|
|
2139
|
-
newValue:
|
|
2140
|
-
}),
|
|
2250
|
+
newValue: a.value
|
|
2251
|
+
}), i.push(this.data[a.row]);
|
|
2141
2252
|
}
|
|
2142
|
-
|
|
2253
|
+
n.length !== 0 && (this._undo.push({
|
|
2143
2254
|
label: "batch-update",
|
|
2144
2255
|
undo: () => {
|
|
2145
|
-
|
|
2146
|
-
n
|
|
2256
|
+
n.forEach((e, n) => {
|
|
2257
|
+
t(i[n], e.key, e.oldValue);
|
|
2147
2258
|
}), this.requestUpdate();
|
|
2148
2259
|
},
|
|
2149
2260
|
redo: () => {
|
|
2150
|
-
|
|
2151
|
-
n
|
|
2261
|
+
n.forEach((e, n) => {
|
|
2262
|
+
t(i[n], e.key, e.newValue);
|
|
2152
2263
|
}), this.requestUpdate();
|
|
2153
2264
|
}
|
|
2154
|
-
}), this.requestUpdate(), this._emit("batch-update", { changes:
|
|
2265
|
+
}), this.requestUpdate(), this._emit("batch-update", { changes: n }), this._dispatchUndoStateEvent());
|
|
2155
2266
|
}
|
|
2156
2267
|
_createEmptyRow() {
|
|
2157
2268
|
let e = {};
|
|
2158
|
-
for (let
|
|
2269
|
+
for (let n of this.columns) switch (n.type) {
|
|
2159
2270
|
case "number":
|
|
2160
|
-
e
|
|
2271
|
+
t(e, n.key, 0);
|
|
2161
2272
|
break;
|
|
2162
2273
|
case "boolean":
|
|
2163
|
-
e
|
|
2274
|
+
t(e, n.key, !1);
|
|
2164
2275
|
break;
|
|
2165
|
-
default: e
|
|
2276
|
+
default: t(e, n.key, "");
|
|
2166
2277
|
}
|
|
2167
2278
|
return e;
|
|
2168
2279
|
}
|
|
2169
2280
|
exportToString(e, t) {
|
|
2170
2281
|
let n = this._exportSlice(t);
|
|
2171
|
-
return n ?
|
|
2282
|
+
return n ? B(n.rows, n.cols, e, { bom: t?.bom }) : "";
|
|
2172
2283
|
}
|
|
2173
2284
|
async exportToBlob(e, t) {
|
|
2174
2285
|
let n = this._exportSlice(t) ?? {
|
|
2175
2286
|
rows: [],
|
|
2176
2287
|
cols: []
|
|
2177
2288
|
};
|
|
2178
|
-
return
|
|
2289
|
+
return V(n.rows, n.cols, e, { bom: t?.bom });
|
|
2179
2290
|
}
|
|
2180
2291
|
async exportToFile(e, t, n) {
|
|
2181
|
-
|
|
2292
|
+
W(await this.exportToBlob(e, {
|
|
2293
|
+
...n,
|
|
2294
|
+
bom: n?.bom ?? !0
|
|
2295
|
+
}), t ?? `export${Ve(e)}`);
|
|
2182
2296
|
}
|
|
2183
2297
|
_exportSlice(e) {
|
|
2184
2298
|
if (e && "rows" in e && e.rows) return {
|
|
@@ -2257,68 +2371,23 @@ var K = {
|
|
|
2257
2371
|
});
|
|
2258
2372
|
}
|
|
2259
2373
|
async importFromFile(e) {
|
|
2260
|
-
let t = e.name.toLowerCase();
|
|
2261
|
-
if (t.endsWith(".xlsx"))
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
let t = await e.text(), n = g(t);
|
|
2266
|
-
this._applyImportedRows(n);
|
|
2267
|
-
} else console.warn(`flex-table importFromFile: unsupported file type "${e.name}"`);
|
|
2374
|
+
let t = e.name.toLowerCase(), n;
|
|
2375
|
+
if (t.endsWith(".xlsx")) n = await nt(await e.arrayBuffer());
|
|
2376
|
+
else if (t.endsWith(".csv") || t.endsWith(".tsv")) n = at(await e.text(), t.endsWith(".tsv") ? "tsv" : "csv");
|
|
2377
|
+
else return console.warn(`flex-table importFromFile: unsupported file type "${e.name}"`), null;
|
|
2378
|
+
return this._applyImportedSheet(n);
|
|
2268
2379
|
}
|
|
2269
2380
|
_applyImportedSheet(e) {
|
|
2270
|
-
let t =
|
|
2271
|
-
|
|
2272
|
-
return e.headers.forEach((e, i) => {
|
|
2273
|
-
let a = t.get(e);
|
|
2274
|
-
if (!a) return;
|
|
2275
|
-
let o = this.columns.find((e) => e.key === a);
|
|
2276
|
-
r[a] = o ? A(n[i] ?? "", o) : n[i] ?? null;
|
|
2277
|
-
}), r;
|
|
2278
|
-
}), r = [...this.data];
|
|
2279
|
-
this.data = n, this._undo.push({
|
|
2381
|
+
let { rows: t, report: n } = ct(e, this.columns), r = [...this.data];
|
|
2382
|
+
return this.data = t, this._undo.push({
|
|
2280
2383
|
label: "import",
|
|
2281
2384
|
undo: () => {
|
|
2282
2385
|
this.data = r, this.requestUpdate();
|
|
2283
2386
|
},
|
|
2284
2387
|
redo: () => {
|
|
2285
|
-
this.data =
|
|
2388
|
+
this.data = t, this.requestUpdate();
|
|
2286
2389
|
}
|
|
2287
|
-
}), this._emit("data-import",
|
|
2288
|
-
}
|
|
2289
|
-
_applyImportedRows(e) {
|
|
2290
|
-
if (e.length === 0) return;
|
|
2291
|
-
let t = e[0], n = this._buildHeaderColumnMap(t), r = e.slice(1).map((e) => {
|
|
2292
|
-
let r = {};
|
|
2293
|
-
return t.forEach((t, i) => {
|
|
2294
|
-
let a = n.get(t);
|
|
2295
|
-
if (!a) return;
|
|
2296
|
-
let o = this.columns.find((e) => e.key === a);
|
|
2297
|
-
r[a] = o ? A(e[i] ?? "", o) : e[i] ?? null;
|
|
2298
|
-
}), r;
|
|
2299
|
-
}), i = [...this.data];
|
|
2300
|
-
this.data = r, this._undo.push({
|
|
2301
|
-
label: "import",
|
|
2302
|
-
undo: () => {
|
|
2303
|
-
this.data = i, this.requestUpdate();
|
|
2304
|
-
},
|
|
2305
|
-
redo: () => {
|
|
2306
|
-
this.data = r, this.requestUpdate();
|
|
2307
|
-
}
|
|
2308
|
-
}), this._emit("data-import", { count: r.length });
|
|
2309
|
-
}
|
|
2310
|
-
_buildHeaderColumnMap(e) {
|
|
2311
|
-
let t = /* @__PURE__ */ new Map();
|
|
2312
|
-
for (let n of e) {
|
|
2313
|
-
let e = this.columns.find((e) => e.label === n);
|
|
2314
|
-
if (e) {
|
|
2315
|
-
t.set(n, e.key);
|
|
2316
|
-
continue;
|
|
2317
|
-
}
|
|
2318
|
-
let r = this.columns.find((e) => e.label.toLowerCase() === n.toLowerCase());
|
|
2319
|
-
r && t.set(n, r.key);
|
|
2320
|
-
}
|
|
2321
|
-
return t;
|
|
2390
|
+
}), this._emit("data-import", n), n;
|
|
2322
2391
|
}
|
|
2323
2392
|
_onDragover(e) {
|
|
2324
2393
|
this.importEnabled && (e.dataTransfer?.types.includes("Files") ?? !1) && (e.preventDefault(), e.dataTransfer.dropEffect = "copy", this._isDragOver = !0);
|
|
@@ -2343,8 +2412,8 @@ var K = {
|
|
|
2343
2412
|
return this._columnWidths.get(e);
|
|
2344
2413
|
}
|
|
2345
2414
|
_getColWidth(e) {
|
|
2346
|
-
let t = this._columnWidths.get(e.key) ?? e.width ??
|
|
2347
|
-
return Math.max(t, e.minWidth ??
|
|
2415
|
+
let t = this._columnWidths.get(e.key) ?? e.width ?? J;
|
|
2416
|
+
return Math.max(t, e.minWidth ?? Y);
|
|
2348
2417
|
}
|
|
2349
2418
|
get headerHeight() {
|
|
2350
2419
|
return this.rowHeight + 8;
|
|
@@ -2377,10 +2446,10 @@ var K = {
|
|
|
2377
2446
|
};
|
|
2378
2447
|
}
|
|
2379
2448
|
connectedCallback() {
|
|
2380
|
-
super.connectedCallback(), this._unsubscribeLocale =
|
|
2449
|
+
super.connectedCallback(), this._unsubscribeLocale = f.subscribe(() => this.requestUpdate()), this._detachedLocaleRevision !== void 0 && this._detachedLocaleRevision !== f.revision && this.requestUpdate(), this._detachedLocaleRevision = void 0, this._onScroll = this._onScroll.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onDocumentClick = this._onDocumentClick.bind(this), this._onContextMenu = this._onContextMenu.bind(this), this._onDragover = this._onDragover.bind(this), this._onDragleave = this._onDragleave.bind(this), this._onDrop = this._onDrop.bind(this), this.addEventListener("scroll", this._onScroll, { passive: !0 }), this.addEventListener("keydown", this._onKeyDown), this.addEventListener("focus", this._onHostFocus), this.renderRoot.addEventListener("focusin", this._onFocusIn), this.renderRoot.addEventListener("focusout", this._onFocusOut), this.addEventListener("contextmenu", this._onContextMenu), this.addEventListener("dragover", this._onDragover), this.addEventListener("dragleave", this._onDragleave), this.addEventListener("drop", this._onDrop), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.setAttribute("role", "grid"), typeof ResizeObserver < "u" && (this._hostResizeObserver = new ResizeObserver(() => this._measureViewport()), this._hostResizeObserver.observe(this));
|
|
2381
2450
|
}
|
|
2382
2451
|
disconnectedCallback() {
|
|
2383
|
-
super.disconnectedCallback(), this._unsubscribeLocale?.(), this._unsubscribeLocale = void 0, this._detachedLocaleRevision =
|
|
2452
|
+
super.disconnectedCallback(), this._unsubscribeLocale?.(), this._unsubscribeLocale = void 0, this._detachedLocaleRevision = f.revision, this.removeEventListener("scroll", this._onScroll), this.removeEventListener("keydown", this._onKeyDown), this.removeEventListener("focus", this._onHostFocus), this.renderRoot.removeEventListener("focusin", this._onFocusIn), this.renderRoot.removeEventListener("focusout", this._onFocusOut), this.removeEventListener("contextmenu", this._onContextMenu), this.removeEventListener("dragover", this._onDragover), this.removeEventListener("dragleave", this._onDragleave), this.removeEventListener("drop", this._onDrop), document.removeEventListener("click", this._onDocumentClick), document.removeEventListener("mousedown", this._onCommentPopupOutsideClick), this._isDragging = !1, this._wasDrag = !1, this._resizeCleanup &&= (this._resizeCleanup(), null), this._hostResizeObserver &&= (this._hostResizeObserver.disconnect(), null);
|
|
2384
2453
|
}
|
|
2385
2454
|
firstUpdated() {
|
|
2386
2455
|
this._readDensityTokens(), this._measureViewport(), this.shadowRoot && Array.isArray(this.shadowRoot.adoptedStyleSheets) && (this._baseStyleSheets = [...this.shadowRoot.adoptedStyleSheets]), this._syncStylesheets();
|
|
@@ -2439,11 +2508,8 @@ var K = {
|
|
|
2439
2508
|
}
|
|
2440
2509
|
}
|
|
2441
2510
|
_recomputeView() {
|
|
2442
|
-
if (this.dataMode === "server") {
|
|
2443
|
-
|
|
2444
|
-
return;
|
|
2445
|
-
}
|
|
2446
|
-
if (this._filteredIndices = ue(this.data, this._filters, (e, t, n) => {
|
|
2511
|
+
if (this.dataMode === "server") this._filteredIndices = Array.from({ length: this.data.length }, (e, t) => t), this._sortedIndices = this._filteredIndices;
|
|
2512
|
+
else if (this._filteredIndices = me(this.data, this._filters, (e, t, n) => {
|
|
2447
2513
|
this._emit("filter-error", {
|
|
2448
2514
|
error: e,
|
|
2449
2515
|
row: t,
|
|
@@ -2452,7 +2518,7 @@ var K = {
|
|
|
2452
2518
|
}), this._filters.length === 0 && this._sortCriteria.length === 0) this._sortedIndices = Array.from({ length: this.data.length }, (e, t) => t);
|
|
2453
2519
|
else if (this._sortCriteria.length === 0) this._sortedIndices = [...this._filteredIndices];
|
|
2454
2520
|
else {
|
|
2455
|
-
let e = this._filteredIndices.map((e) => this.data[e]), t =
|
|
2521
|
+
let e = this._filteredIndices.map((e) => this.data[e]), t = i(e, this._sortCriteria, this.visibleColumns);
|
|
2456
2522
|
this._sortedIndices = t.map((e) => this._filteredIndices[e]);
|
|
2457
2523
|
}
|
|
2458
2524
|
}
|
|
@@ -2480,17 +2546,13 @@ var K = {
|
|
|
2480
2546
|
if (e && t?.draft !== void 0) {
|
|
2481
2547
|
let n = t.draft;
|
|
2482
2548
|
t.draft = void 0, e.value = n, e.focus(), e.type === "text" && e.setSelectionRange(e.value.length, e.value.length);
|
|
2483
|
-
|
|
2484
|
-
}
|
|
2485
|
-
if (e && this.shadowRoot.activeElement !== e) {
|
|
2549
|
+
} else if (e && this.shadowRoot.activeElement !== e) {
|
|
2486
2550
|
if (e.localName === "u-date-picker") {
|
|
2487
2551
|
let t = e;
|
|
2488
2552
|
t.updateComplete.then(() => {
|
|
2489
2553
|
t.isConnected && this.shadowRoot.activeElement !== t && (t.focus(), t.shadowRoot?.querySelector("[part~=\"input\"]")?.select());
|
|
2490
2554
|
});
|
|
2491
|
-
|
|
2492
|
-
}
|
|
2493
|
-
e.focus(), e.type === "text" && e.select();
|
|
2555
|
+
} else e.focus(), e.type === "text" && e.select();
|
|
2494
2556
|
}
|
|
2495
2557
|
}
|
|
2496
2558
|
_measureViewport() {
|
|
@@ -2498,7 +2560,7 @@ var K = {
|
|
|
2498
2560
|
e !== this._viewportHeight && (this._viewportHeight = e), t !== this._viewportWidth && (this._viewportWidth = t), this._warnIfUnconstrained();
|
|
2499
2561
|
}
|
|
2500
2562
|
_warnIfUnconstrained() {
|
|
2501
|
-
this._warnedUnconstrained || process.env.NODE_ENV === "production" || this._visibleRowCount <
|
|
2563
|
+
this._warnedUnconstrained || process.env.NODE_ENV === "production" || this._visibleRowCount < dt || this.scrollHeight > this.clientHeight + 1 || (this._warnedUnconstrained = !0, console.warn(`[@iyulab/flex-table] ${this._visibleRowCount} rows but the host has no height constraint — it grew to fit every row, so virtual scrolling is off and all rows are rendered. Give the host a height (e.g. height: 400px, or flex: 1 1 auto with min-height: 0 inside a sized parent) so it becomes the scroll container.`));
|
|
2502
2564
|
}
|
|
2503
2565
|
_onScroll() {
|
|
2504
2566
|
this._scrollTop = this.scrollTop, this._scrollLeft = this.scrollLeft;
|
|
@@ -2516,25 +2578,25 @@ var K = {
|
|
|
2516
2578
|
return;
|
|
2517
2579
|
}
|
|
2518
2580
|
e.preventDefault();
|
|
2519
|
-
let
|
|
2520
|
-
if (!
|
|
2521
|
-
let
|
|
2522
|
-
if (
|
|
2523
|
-
let
|
|
2524
|
-
if (!
|
|
2525
|
-
let
|
|
2581
|
+
let i = n.parentElement;
|
|
2582
|
+
if (!i || !i.classList.contains("ft-row")) return;
|
|
2583
|
+
let a = parseInt(n.dataset.colIndex ?? "-1", 10), o = i.style.top, s = Math.round(parseInt(o, 10) / this.rowHeight);
|
|
2584
|
+
if (a < 0 || s < 0) return;
|
|
2585
|
+
let c = this._toDataIndex(s), l = this.visibleColumns[a];
|
|
2586
|
+
if (!l) return;
|
|
2587
|
+
let u = this._emit("context-menu", {
|
|
2526
2588
|
x: e.clientX,
|
|
2527
2589
|
y: e.clientY,
|
|
2528
|
-
row:
|
|
2529
|
-
col:
|
|
2530
|
-
key:
|
|
2531
|
-
value: this.data[
|
|
2532
|
-
rowData: this.data[
|
|
2590
|
+
row: c,
|
|
2591
|
+
col: a,
|
|
2592
|
+
key: l.key,
|
|
2593
|
+
value: r(this.data[c], l.key),
|
|
2594
|
+
rowData: this.data[c]
|
|
2533
2595
|
}, { cancelable: !0 });
|
|
2534
|
-
this._cancelCommentPopup(), this.showContextMenu && !
|
|
2535
|
-
rowIndex:
|
|
2536
|
-
colIndex:
|
|
2537
|
-
dataIndex:
|
|
2596
|
+
this._cancelCommentPopup(), this.showContextMenu && !u.defaultPrevented && (this._bodyContextMenu = {
|
|
2597
|
+
rowIndex: s,
|
|
2598
|
+
colIndex: a,
|
|
2599
|
+
dataIndex: c,
|
|
2538
2600
|
x: e.clientX,
|
|
2539
2601
|
y: e.clientY
|
|
2540
2602
|
}, requestAnimationFrame(() => {
|
|
@@ -2548,7 +2610,7 @@ var K = {
|
|
|
2548
2610
|
}
|
|
2549
2611
|
this._isDragging = !1, this._editing.current && this._commitEdit();
|
|
2550
2612
|
let r = e.shiftKey || e.ctrlKey || e.metaKey;
|
|
2551
|
-
e.shiftKey ? this._selection.setActiveWithRange(t, n) : e.ctrlKey || e.metaKey ? this._selection.toggleCell(t, n) : this._selection.setActive(t, n), this._activeCell = this._selection.activeCell ? { ...this._selection.activeCell } : null, this._dispatchSelectionEvent(), this.requestUpdate(), !r && !
|
|
2613
|
+
e.shiftKey ? this._selection.setActiveWithRange(t, n) : e.ctrlKey || e.metaKey ? this._selection.toggleCell(t, n) : this._selection.setActive(t, n), this._activeCell = this._selection.activeCell ? { ...this._selection.activeCell } : null, this._dispatchSelectionEvent(), this.requestUpdate(), !r && !T(e, e.currentTarget) && this._fireRowActivate(this.visibleColumns[n], "click");
|
|
2552
2614
|
}
|
|
2553
2615
|
_onCellMouseDown(e, t, n) {
|
|
2554
2616
|
if (e.button !== 0 || e.shiftKey) return;
|
|
@@ -2600,16 +2662,16 @@ var K = {
|
|
|
2600
2662
|
let e = this.visibleColumns[this._activeCell.col];
|
|
2601
2663
|
if (!e || !this._isCellEditable(e)) return;
|
|
2602
2664
|
if (e.type === "boolean") {
|
|
2603
|
-
let t = this.data[this._toDataIndex(this._activeCell.row)]
|
|
2604
|
-
this._applyEdit(!
|
|
2665
|
+
let t = this.data[this._toDataIndex(this._activeCell.row)], n = r(t, e.key);
|
|
2666
|
+
this._applyEdit(!n);
|
|
2605
2667
|
return;
|
|
2606
2668
|
}
|
|
2607
2669
|
let t = this._toDataIndex(this._activeCell.row), n = this.data[t];
|
|
2608
|
-
this._editing.start(this._activeCell, n
|
|
2670
|
+
this._editing.start(this._activeCell, r(n, e.key), n), this._editingCell = { ...this._activeCell }, this._emit("cell-edit-start", {
|
|
2609
2671
|
row: t,
|
|
2610
2672
|
col: this._activeCell.col,
|
|
2611
2673
|
key: e.key,
|
|
2612
|
-
value: n
|
|
2674
|
+
value: r(n, e.key)
|
|
2613
2675
|
});
|
|
2614
2676
|
}
|
|
2615
2677
|
_commitEdit() {
|
|
@@ -2640,73 +2702,71 @@ var K = {
|
|
|
2640
2702
|
}
|
|
2641
2703
|
let t = this.shadowRoot?.querySelector(".ft-editor");
|
|
2642
2704
|
if (t) {
|
|
2643
|
-
let n =
|
|
2705
|
+
let n = k(t.value, e);
|
|
2644
2706
|
this._applyEdit(n);
|
|
2645
2707
|
} else this._cancelEdit();
|
|
2646
2708
|
}
|
|
2647
|
-
_applyEdit(
|
|
2709
|
+
_applyEdit(n) {
|
|
2648
2710
|
this._autocompleteState = null;
|
|
2649
|
-
let
|
|
2650
|
-
if (this._editingCell = null, !
|
|
2651
|
-
let { col:
|
|
2652
|
-
if (
|
|
2711
|
+
let r = this._editing.commit();
|
|
2712
|
+
if (this._editingCell = null, !r) return;
|
|
2713
|
+
let { col: i } = r.position, a = r.row, o = this.data.indexOf(a);
|
|
2714
|
+
if (o < 0) {
|
|
2653
2715
|
this._emit("cell-edit-cancel", {
|
|
2654
2716
|
row: -1,
|
|
2655
|
-
col:
|
|
2717
|
+
col: i
|
|
2656
2718
|
});
|
|
2657
2719
|
return;
|
|
2658
2720
|
}
|
|
2659
|
-
let
|
|
2660
|
-
if (
|
|
2661
|
-
let
|
|
2662
|
-
this._markCellInvalid(
|
|
2663
|
-
row:
|
|
2664
|
-
col:
|
|
2665
|
-
key:
|
|
2666
|
-
value:
|
|
2667
|
-
error:
|
|
2721
|
+
let s = this.visibleColumns[i], c = r.originalValue;
|
|
2722
|
+
if (s.autocomplete === "strict" && n != null && n !== "" && !this._getAutocompleteCandidates(s, "").includes(String(n))) {
|
|
2723
|
+
let t = e("notInList");
|
|
2724
|
+
this._markCellInvalid(a, s, () => e("notInList")), this._emit("validation-error", {
|
|
2725
|
+
row: o,
|
|
2726
|
+
col: i,
|
|
2727
|
+
key: s.key,
|
|
2728
|
+
value: n,
|
|
2729
|
+
error: t
|
|
2668
2730
|
});
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
value: t,
|
|
2678
|
-
error: s
|
|
2731
|
+
} else if (s.type === "number" && typeof n == "string" || s.type === "date" && typeof n == "string" && h(n) === null || s.type === "datetime" && typeof n == "string" && g(n) === null) {
|
|
2732
|
+
let t = s.type === "number" ? "notANumber" : s.type === "date" ? "notADate" : "notADateTime", r = e(t);
|
|
2733
|
+
this._markCellInvalid(a, s, () => e(t)), this._emit("validation-error", {
|
|
2734
|
+
row: o,
|
|
2735
|
+
col: i,
|
|
2736
|
+
key: s.key,
|
|
2737
|
+
value: n,
|
|
2738
|
+
error: r
|
|
2679
2739
|
});
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2740
|
+
} else {
|
|
2741
|
+
if (s.validator) {
|
|
2742
|
+
let e = s.validator(n, a, s);
|
|
2743
|
+
if (e) {
|
|
2744
|
+
this._markCellInvalid(a, s, e), this._emit("validation-error", {
|
|
2745
|
+
row: o,
|
|
2746
|
+
col: i,
|
|
2747
|
+
key: s.key,
|
|
2748
|
+
value: n,
|
|
2749
|
+
error: e
|
|
2750
|
+
});
|
|
2751
|
+
return;
|
|
2752
|
+
}
|
|
2693
2753
|
}
|
|
2754
|
+
t(a, s.key, n), this._undo.push({
|
|
2755
|
+
label: "cell-edit",
|
|
2756
|
+
undo: () => {
|
|
2757
|
+
t(a, s.key, c), this.requestUpdate();
|
|
2758
|
+
},
|
|
2759
|
+
redo: () => {
|
|
2760
|
+
t(a, s.key, n), this.requestUpdate();
|
|
2761
|
+
}
|
|
2762
|
+
}), this.requestUpdate(), this._emit("cell-edit-commit", {
|
|
2763
|
+
row: o,
|
|
2764
|
+
col: i,
|
|
2765
|
+
key: s.key,
|
|
2766
|
+
oldValue: c,
|
|
2767
|
+
newValue: n
|
|
2768
|
+
}), this._dispatchUndoStateEvent();
|
|
2694
2769
|
}
|
|
2695
|
-
i[o.key] = t, this._undo.push({
|
|
2696
|
-
label: "cell-edit",
|
|
2697
|
-
undo: () => {
|
|
2698
|
-
i[o.key] = s, this.requestUpdate();
|
|
2699
|
-
},
|
|
2700
|
-
redo: () => {
|
|
2701
|
-
i[o.key] = t, this.requestUpdate();
|
|
2702
|
-
}
|
|
2703
|
-
}), this.requestUpdate(), this._emit("cell-edit-commit", {
|
|
2704
|
-
row: a,
|
|
2705
|
-
col: r,
|
|
2706
|
-
key: o.key,
|
|
2707
|
-
oldValue: s,
|
|
2708
|
-
newValue: t
|
|
2709
|
-
}), this._dispatchUndoStateEvent();
|
|
2710
2770
|
}
|
|
2711
2771
|
_cancelEdit() {
|
|
2712
2772
|
this._autocompleteState = null;
|
|
@@ -2717,7 +2777,7 @@ var K = {
|
|
|
2717
2777
|
});
|
|
2718
2778
|
}
|
|
2719
2779
|
_onEditorKeyDown(e) {
|
|
2720
|
-
if (
|
|
2780
|
+
if (x(e)) return;
|
|
2721
2781
|
let t = e.currentTarget;
|
|
2722
2782
|
if (!(t?.localName === "u-date-picker" && (e.composedPath().some((e) => e instanceof Element && e.part?.contains("popover")) || e.key === "Escape" && $(t)))) {
|
|
2723
2783
|
if (this._autocompleteState && this._autocompleteState.candidates.length > 0) {
|
|
@@ -2752,14 +2812,14 @@ var K = {
|
|
|
2752
2812
|
}
|
|
2753
2813
|
}
|
|
2754
2814
|
_getAutocompleteCandidates(e, t) {
|
|
2755
|
-
let n = t.toLowerCase(),
|
|
2756
|
-
for (let
|
|
2757
|
-
let
|
|
2758
|
-
if (
|
|
2759
|
-
let
|
|
2760
|
-
if (!
|
|
2815
|
+
let n = t.toLowerCase(), i = /* @__PURE__ */ new Set(), a = [];
|
|
2816
|
+
for (let o of this.data) {
|
|
2817
|
+
let s = r(o, e.key);
|
|
2818
|
+
if (s == null) continue;
|
|
2819
|
+
let c = String(s);
|
|
2820
|
+
if (!i.has(c) && (t === "" || c.toLowerCase().includes(n)) && (i.add(c), a.push(c), a.length >= 20)) break;
|
|
2761
2821
|
}
|
|
2762
|
-
return
|
|
2822
|
+
return a;
|
|
2763
2823
|
}
|
|
2764
2824
|
_onAutocompleteInput(e, t) {
|
|
2765
2825
|
let n = e.target.value, r = this._getAutocompleteCandidates(t, n).filter((e) => e !== n);
|
|
@@ -2787,28 +2847,20 @@ var K = {
|
|
|
2787
2847
|
].includes(t) && this._handleCtrlKey(e)) return;
|
|
2788
2848
|
}
|
|
2789
2849
|
if (t.length !== 0 && (this._isGridSurface(e.composedPath()[0]) || e.ctrlKey || e.metaKey)) {
|
|
2790
|
-
if (this._headerCol !== null)
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
"Home",
|
|
2801
|
-
"End"
|
|
2802
|
-
].includes(e.key) && (e.preventDefault(), this._headerCol = 0);
|
|
2803
|
-
return;
|
|
2804
|
-
}
|
|
2805
|
-
if ((e.key === "Enter" || e.key === "F2") && this._activeCell && !v(e)) {
|
|
2850
|
+
if (this._headerCol !== null) this._onHeaderKeyDown(e, t);
|
|
2851
|
+
else if (this._visibleRowCount === 0) [
|
|
2852
|
+
"ArrowDown",
|
|
2853
|
+
"ArrowUp",
|
|
2854
|
+
"ArrowLeft",
|
|
2855
|
+
"ArrowRight",
|
|
2856
|
+
"Home",
|
|
2857
|
+
"End"
|
|
2858
|
+
].includes(e.key) && (e.preventDefault(), this._headerCol = 0);
|
|
2859
|
+
else if ((e.key === "Enter" || e.key === "F2") && this._activeCell && !x(e)) {
|
|
2806
2860
|
e.preventDefault();
|
|
2807
2861
|
let n = t[this._activeCell.col];
|
|
2808
2862
|
n && this._isCellEditable(n) ? this._startEdit() : e.key === "Enter" && this._fireRowActivate(n, "keyboard");
|
|
2809
|
-
|
|
2810
|
-
}
|
|
2811
|
-
if (!this._selection.activeCell) {
|
|
2863
|
+
} else if (!this._selection.activeCell) {
|
|
2812
2864
|
if ([
|
|
2813
2865
|
"ArrowDown",
|
|
2814
2866
|
"ArrowUp",
|
|
@@ -2824,27 +2876,17 @@ var K = {
|
|
|
2824
2876
|
this._closeFindPanel(), e.preventDefault();
|
|
2825
2877
|
return;
|
|
2826
2878
|
}
|
|
2827
|
-
|
|
2828
|
-
}
|
|
2829
|
-
if (!this._handleCtrlKey(e) && !this._handleAltKey(e, t)) {
|
|
2879
|
+
} else if (!this._handleCtrlKey(e) && !this._handleAltKey(e, t)) {
|
|
2830
2880
|
if (e.key === " " && e.shiftKey && this.selectable && this._activeCell && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
2831
2881
|
e.preventDefault();
|
|
2832
2882
|
let t = this.data[this._toDataIndex(this._activeCell.row)];
|
|
2833
2883
|
if (!t) return;
|
|
2834
2884
|
let n = this.getRowId(t);
|
|
2835
2885
|
this._rowSelection.toggle(n), this._lastCheckboxRowId = n, this._rowSelectionVersion++, this._dispatchRowSelectionEvent();
|
|
2836
|
-
|
|
2837
|
-
}
|
|
2838
|
-
if (this._activeCell && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
2886
|
+
} else if (this._activeCell && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
2839
2887
|
let e = t[this._activeCell.col];
|
|
2840
2888
|
e && this._isCellEditable(e) && this._startEdit();
|
|
2841
|
-
|
|
2842
|
-
}
|
|
2843
|
-
if (e.key === "ArrowUp" && !e.shiftKey && !e.altKey && this._activeCell?.row === 0) {
|
|
2844
|
-
e.preventDefault(), this._enterHeader(this._activeCell.col);
|
|
2845
|
-
return;
|
|
2846
|
-
}
|
|
2847
|
-
this._handleNavigation(e) && (e.preventDefault(), this._syncActiveCell());
|
|
2889
|
+
} else e.key === "ArrowUp" && !e.shiftKey && !e.altKey && this._activeCell?.row === 0 ? (e.preventDefault(), this._enterHeader(this._activeCell.col)) : this._handleNavigation(e) && (e.preventDefault(), this._syncActiveCell());
|
|
2848
2890
|
}
|
|
2849
2891
|
}
|
|
2850
2892
|
}
|
|
@@ -2855,7 +2897,7 @@ var K = {
|
|
|
2855
2897
|
case "ArrowLeft":
|
|
2856
2898
|
case "ArrowRight":
|
|
2857
2899
|
if (e.altKey) {
|
|
2858
|
-
e.preventDefault(), this._resizeColumnBy(r.key, e.key === "ArrowRight" ?
|
|
2900
|
+
e.preventDefault(), this._resizeColumnBy(r.key, e.key === "ArrowRight" ? X : -20);
|
|
2859
2901
|
return;
|
|
2860
2902
|
}
|
|
2861
2903
|
i = e.key === "ArrowLeft" ? Math.max(0, n - 1) : Math.min(t.length - 1, n + 1);
|
|
@@ -2871,7 +2913,7 @@ var K = {
|
|
|
2871
2913
|
return;
|
|
2872
2914
|
case "Enter":
|
|
2873
2915
|
case " ":
|
|
2874
|
-
if (
|
|
2916
|
+
if (x(e)) return;
|
|
2875
2917
|
e.preventDefault(), r.sortable !== !1 && this._toggleSort(r, e.shiftKey);
|
|
2876
2918
|
return;
|
|
2877
2919
|
default: return;
|
|
@@ -2910,15 +2952,15 @@ var K = {
|
|
|
2910
2952
|
case "y": return e.preventDefault(), this.redo(), !0;
|
|
2911
2953
|
case "c":
|
|
2912
2954
|
case "x": {
|
|
2913
|
-
if (
|
|
2955
|
+
if (C(e.composedPath()[0])) return !0;
|
|
2914
2956
|
let t = this._selectionTsv();
|
|
2915
2957
|
if (!t) return !0;
|
|
2916
2958
|
let n = e.key.toLowerCase() === "x" && this.editable;
|
|
2917
|
-
return
|
|
2959
|
+
return S(t.text).then((e) => {
|
|
2918
2960
|
e ? this._afterCopy(t.range, t.text, n) : this._clipboardError("copy", /* @__PURE__ */ Error("The clipboard did not take the copied text"));
|
|
2919
2961
|
}), !0;
|
|
2920
2962
|
}
|
|
2921
|
-
case "v": return
|
|
2963
|
+
case "v": return C(e.composedPath()[0]) || !this.editable || !this._activeCell || w().then((e) => this._pasteText(e), (e) => this._clipboardError("paste", e)), !0;
|
|
2922
2964
|
case "d": return e.preventDefault(), this.editable && this._handleFillDown(), !0;
|
|
2923
2965
|
case "r": return e.preventDefault(), this.editable && this._handleFillRight(), !0;
|
|
2924
2966
|
case "f": return e.preventDefault(), this._toggleFindPanel("find"), !0;
|
|
@@ -2930,12 +2972,12 @@ var K = {
|
|
|
2930
2972
|
if (!e.altKey || !this._activeCell || e.key !== "ArrowLeft" && e.key !== "ArrowRight") return !1;
|
|
2931
2973
|
e.preventDefault();
|
|
2932
2974
|
let n = t[this._activeCell.col];
|
|
2933
|
-
return n && this._resizeColumnBy(n.key, e.key === "ArrowRight" ?
|
|
2975
|
+
return n && this._resizeColumnBy(n.key, e.key === "ArrowRight" ? X : -20), !0;
|
|
2934
2976
|
}
|
|
2935
2977
|
_resizeColumnBy(e, t) {
|
|
2936
2978
|
let n = this.visibleColumns.findIndex((t) => t.key === e), r = this.visibleColumns[n];
|
|
2937
2979
|
if (!r) return;
|
|
2938
|
-
let i = this._columnWidths.get(r.key) ?? r.width ??
|
|
2980
|
+
let i = this._columnWidths.get(r.key) ?? r.width ?? J, a = r.minWidth ?? Y, o = Math.max(a, i + t);
|
|
2939
2981
|
this._columnWidths.set(r.key, o), this.requestUpdate(), this._emit("column-resize", {
|
|
2940
2982
|
key: r.key,
|
|
2941
2983
|
width: o,
|
|
@@ -2964,7 +3006,7 @@ var K = {
|
|
|
2964
3006
|
let e = this._selection.getEffectiveRange();
|
|
2965
3007
|
return e ? {
|
|
2966
3008
|
range: e,
|
|
2967
|
-
text:
|
|
3009
|
+
text: ge(this._sortedIndices.map((e) => this.data[e]), this.visibleColumns, e)
|
|
2968
3010
|
} : null;
|
|
2969
3011
|
}
|
|
2970
3012
|
async _copyFromMenu() {
|
|
@@ -2993,34 +3035,34 @@ var K = {
|
|
|
2993
3035
|
}
|
|
2994
3036
|
_pasteText(e) {
|
|
2995
3037
|
if (!this._activeCell) return;
|
|
2996
|
-
let
|
|
2997
|
-
if (
|
|
2998
|
-
let
|
|
2999
|
-
if (this._selectPastedRange(this._activeCell,
|
|
3000
|
-
let e =
|
|
3038
|
+
let n = y(e);
|
|
3039
|
+
if (n.length === 0) return;
|
|
3040
|
+
let r = this._expandRowsForPaste(this._activeCell.row, n.length), i = this._applyPasteData(this._activeCell, n);
|
|
3041
|
+
if (this._selectPastedRange(this._activeCell, n), i.length > 0 || r.length > 0) {
|
|
3042
|
+
let e = i.map((e) => this.data[e.row]), n = r.map((e) => this.data[e]);
|
|
3001
3043
|
this._undo.push({
|
|
3002
3044
|
label: "paste",
|
|
3003
3045
|
undo: () => {
|
|
3004
|
-
|
|
3005
|
-
e[n
|
|
3046
|
+
i.forEach((n, r) => {
|
|
3047
|
+
t(e[r], n.key, n.oldValue);
|
|
3006
3048
|
});
|
|
3007
|
-
for (let e of
|
|
3049
|
+
for (let e of n) {
|
|
3008
3050
|
let t = this.data.indexOf(e);
|
|
3009
3051
|
t >= 0 && this.data.splice(t, 1);
|
|
3010
3052
|
}
|
|
3011
3053
|
this.requestUpdate();
|
|
3012
3054
|
},
|
|
3013
3055
|
redo: () => {
|
|
3014
|
-
for (let e of
|
|
3015
|
-
|
|
3016
|
-
e[n
|
|
3056
|
+
for (let e of n) this.data.push(e);
|
|
3057
|
+
i.forEach((n, r) => {
|
|
3058
|
+
t(e[r], n.key, n.newValue);
|
|
3017
3059
|
}), this.requestUpdate();
|
|
3018
3060
|
}
|
|
3019
3061
|
}), this._dispatchUndoStateEvent();
|
|
3020
3062
|
}
|
|
3021
3063
|
this.requestUpdate(), this._emit("clipboard-paste", {
|
|
3022
|
-
changes:
|
|
3023
|
-
addedRows:
|
|
3064
|
+
changes: i,
|
|
3065
|
+
addedRows: r.length
|
|
3024
3066
|
});
|
|
3025
3067
|
}
|
|
3026
3068
|
_selectPastedRange(e, t) {
|
|
@@ -3038,26 +3080,26 @@ var K = {
|
|
|
3038
3080
|
}
|
|
3039
3081
|
return n.length > 0 && this._recomputeView(), n;
|
|
3040
3082
|
}
|
|
3041
|
-
_applyPasteData(e,
|
|
3042
|
-
let
|
|
3043
|
-
for (let
|
|
3044
|
-
let
|
|
3045
|
-
if (
|
|
3046
|
-
let
|
|
3047
|
-
for (let
|
|
3048
|
-
let
|
|
3049
|
-
if (
|
|
3050
|
-
let
|
|
3051
|
-
this.data[
|
|
3052
|
-
row:
|
|
3053
|
-
col:
|
|
3054
|
-
key:
|
|
3055
|
-
oldValue:
|
|
3056
|
-
newValue:
|
|
3083
|
+
_applyPasteData(e, n) {
|
|
3084
|
+
let i = this.visibleColumns, a = [];
|
|
3085
|
+
for (let o = 0; o < n.length; o++) {
|
|
3086
|
+
let s = e.row + o;
|
|
3087
|
+
if (s >= this._visibleRowCount) break;
|
|
3088
|
+
let c = this._toDataIndex(s);
|
|
3089
|
+
for (let s = 0; s < n[o].length; s++) {
|
|
3090
|
+
let l = e.col + s;
|
|
3091
|
+
if (l >= i.length) break;
|
|
3092
|
+
let u = i[l], d = r(this.data[c], u.key), f = k(n[o][s], u);
|
|
3093
|
+
t(this.data[c], u.key, f), a.push({
|
|
3094
|
+
row: c,
|
|
3095
|
+
col: l,
|
|
3096
|
+
key: u.key,
|
|
3097
|
+
oldValue: d,
|
|
3098
|
+
newValue: f
|
|
3057
3099
|
});
|
|
3058
3100
|
}
|
|
3059
3101
|
}
|
|
3060
|
-
return
|
|
3102
|
+
return a;
|
|
3061
3103
|
}
|
|
3062
3104
|
_handleFillDown() {
|
|
3063
3105
|
let e = this._selection.getEffectiveRange();
|
|
@@ -3067,23 +3109,23 @@ var K = {
|
|
|
3067
3109
|
if (e.startRow === 0) return;
|
|
3068
3110
|
let n = t[e.startCol];
|
|
3069
3111
|
if (!n || !this._isCellEditable(n)) return;
|
|
3070
|
-
let
|
|
3112
|
+
let i = this._toDataIndex(e.startRow - 1), a = this._toDataIndex(e.startRow);
|
|
3071
3113
|
this.updateRows([{
|
|
3072
|
-
row:
|
|
3114
|
+
row: a,
|
|
3073
3115
|
key: n.key,
|
|
3074
|
-
value: this.data[
|
|
3116
|
+
value: r(this.data[i], n.key)
|
|
3075
3117
|
}]);
|
|
3076
3118
|
return;
|
|
3077
3119
|
}
|
|
3078
3120
|
let n = [];
|
|
3079
|
-
for (let
|
|
3080
|
-
let
|
|
3081
|
-
if (!
|
|
3082
|
-
let
|
|
3121
|
+
for (let i = e.startCol; i <= e.endCol; i++) {
|
|
3122
|
+
let a = t[i];
|
|
3123
|
+
if (!a || !this._isCellEditable(a)) continue;
|
|
3124
|
+
let o = r(this.data[this._toDataIndex(e.startRow)], a.key);
|
|
3083
3125
|
for (let t = e.startRow + 1; t <= e.endRow; t++) n.push({
|
|
3084
3126
|
row: this._toDataIndex(t),
|
|
3085
|
-
key:
|
|
3086
|
-
value:
|
|
3127
|
+
key: a.key,
|
|
3128
|
+
value: o
|
|
3087
3129
|
});
|
|
3088
3130
|
}
|
|
3089
3131
|
n.length > 0 && this.updateRows(n);
|
|
@@ -3094,29 +3136,29 @@ var K = {
|
|
|
3094
3136
|
let t = this.visibleColumns;
|
|
3095
3137
|
if (e.startRow === e.endRow && e.startCol === e.endCol) {
|
|
3096
3138
|
if (e.startCol === 0) return;
|
|
3097
|
-
let n = t[e.startCol],
|
|
3098
|
-
if (!n || !this._isCellEditable(n) || !
|
|
3099
|
-
let
|
|
3139
|
+
let n = t[e.startCol], i = t[e.startCol - 1];
|
|
3140
|
+
if (!n || !this._isCellEditable(n) || !i) return;
|
|
3141
|
+
let a = this._toDataIndex(e.startRow);
|
|
3100
3142
|
this.updateRows([{
|
|
3101
|
-
row:
|
|
3143
|
+
row: a,
|
|
3102
3144
|
key: n.key,
|
|
3103
|
-
value: this.data[i
|
|
3145
|
+
value: r(this.data[a], i.key)
|
|
3104
3146
|
}]);
|
|
3105
3147
|
return;
|
|
3106
3148
|
}
|
|
3107
3149
|
let n = [];
|
|
3108
|
-
for (let
|
|
3109
|
-
let
|
|
3110
|
-
if (!
|
|
3111
|
-
let
|
|
3150
|
+
for (let i = e.startRow; i <= e.endRow; i++) {
|
|
3151
|
+
let a = this._toDataIndex(i), o = t[e.startCol];
|
|
3152
|
+
if (!o) continue;
|
|
3153
|
+
let s = r(this.data[a], o.key);
|
|
3112
3154
|
for (let r = e.startCol + 1; r <= e.endCol; r++) {
|
|
3113
3155
|
let e = t[r];
|
|
3114
3156
|
if (!e || !this._isCellEditable(e)) continue;
|
|
3115
|
-
let
|
|
3157
|
+
let i = k(s == null ? "" : String(s), e);
|
|
3116
3158
|
n.push({
|
|
3117
|
-
row:
|
|
3159
|
+
row: a,
|
|
3118
3160
|
key: e.key,
|
|
3119
|
-
value:
|
|
3161
|
+
value: i
|
|
3120
3162
|
});
|
|
3121
3163
|
}
|
|
3122
3164
|
}
|
|
@@ -3129,56 +3171,56 @@ var K = {
|
|
|
3129
3171
|
this._clearRanges(n);
|
|
3130
3172
|
}
|
|
3131
3173
|
_clearRanges(e) {
|
|
3132
|
-
let
|
|
3133
|
-
for (let
|
|
3134
|
-
let
|
|
3135
|
-
for (let e =
|
|
3136
|
-
let
|
|
3137
|
-
if (
|
|
3138
|
-
|
|
3139
|
-
let
|
|
3140
|
-
this.data[
|
|
3141
|
-
target: this.data[
|
|
3142
|
-
key:
|
|
3143
|
-
oldValue:
|
|
3144
|
-
clearValue:
|
|
3174
|
+
let n = this.visibleColumns, i = [], a = /* @__PURE__ */ new Set();
|
|
3175
|
+
for (let o of e) for (let e = o.startRow; e <= o.endRow; e++) {
|
|
3176
|
+
let s = this._toDataIndex(e);
|
|
3177
|
+
for (let e = o.startCol; e <= o.endCol; e++) {
|
|
3178
|
+
let o = `${s}:${e}`;
|
|
3179
|
+
if (a.has(o)) continue;
|
|
3180
|
+
a.add(o);
|
|
3181
|
+
let c = n[e], l = r(this.data[s], c.key), u = c.type === "boolean" ? !1 : c.type === "number" ? 0 : "";
|
|
3182
|
+
t(this.data[s], c.key, u), i.push({
|
|
3183
|
+
target: this.data[s],
|
|
3184
|
+
key: c.key,
|
|
3185
|
+
oldValue: l,
|
|
3186
|
+
clearValue: u
|
|
3145
3187
|
});
|
|
3146
3188
|
}
|
|
3147
3189
|
}
|
|
3148
|
-
|
|
3190
|
+
i.length > 0 && (this._undo.push({
|
|
3149
3191
|
label: "clear",
|
|
3150
3192
|
undo: () => {
|
|
3151
|
-
for (let e of
|
|
3193
|
+
for (let e of i) t(e.target, e.key, e.oldValue);
|
|
3152
3194
|
this.requestUpdate();
|
|
3153
3195
|
},
|
|
3154
3196
|
redo: () => {
|
|
3155
|
-
for (let e of
|
|
3197
|
+
for (let e of i) t(e.target, e.key, e.clearValue);
|
|
3156
3198
|
this.requestUpdate();
|
|
3157
3199
|
}
|
|
3158
3200
|
}), this._dispatchUndoStateEvent()), this.requestUpdate();
|
|
3159
3201
|
}
|
|
3160
3202
|
_clearRange(e) {
|
|
3161
|
-
let
|
|
3162
|
-
for (let
|
|
3163
|
-
let
|
|
3164
|
-
for (let
|
|
3165
|
-
let e =
|
|
3166
|
-
this.data[
|
|
3167
|
-
target: this.data[
|
|
3203
|
+
let n = this.visibleColumns, i = [];
|
|
3204
|
+
for (let a = e.startRow; a <= e.endRow; a++) {
|
|
3205
|
+
let o = this._toDataIndex(a);
|
|
3206
|
+
for (let a = e.startCol; a <= e.endCol; a++) {
|
|
3207
|
+
let e = n[a], s = r(this.data[o], e.key), c = e.type === "boolean" ? !1 : e.type === "number" ? 0 : "";
|
|
3208
|
+
t(this.data[o], e.key, c), i.push({
|
|
3209
|
+
target: this.data[o],
|
|
3168
3210
|
key: e.key,
|
|
3169
|
-
oldValue:
|
|
3170
|
-
clearValue:
|
|
3211
|
+
oldValue: s,
|
|
3212
|
+
clearValue: c
|
|
3171
3213
|
});
|
|
3172
3214
|
}
|
|
3173
3215
|
}
|
|
3174
|
-
|
|
3216
|
+
i.length > 0 && (this._undo.push({
|
|
3175
3217
|
label: "clear",
|
|
3176
3218
|
undo: () => {
|
|
3177
|
-
for (let e of
|
|
3219
|
+
for (let e of i) t(e.target, e.key, e.oldValue);
|
|
3178
3220
|
this.requestUpdate();
|
|
3179
3221
|
},
|
|
3180
3222
|
redo: () => {
|
|
3181
|
-
for (let e of
|
|
3223
|
+
for (let e of i) t(e.target, e.key, e.clearValue);
|
|
3182
3224
|
this.requestUpdate();
|
|
3183
3225
|
}
|
|
3184
3226
|
}), this._dispatchUndoStateEvent()), this.requestUpdate();
|
|
@@ -3205,14 +3247,10 @@ var K = {
|
|
|
3205
3247
|
return;
|
|
3206
3248
|
}
|
|
3207
3249
|
let n = this.visibleColumns.indexOf(t);
|
|
3208
|
-
|
|
3209
|
-
this._selectColumn(n);
|
|
3210
|
-
return;
|
|
3211
|
-
}
|
|
3212
|
-
t.sortable !== !1 && this._toggleSort(t, e.shiftKey);
|
|
3250
|
+
e.ctrlKey || e.metaKey ? this._selectColumn(n) : t.sortable !== !1 && this._toggleSort(t, e.shiftKey);
|
|
3213
3251
|
}
|
|
3214
|
-
_toggleSort(e,
|
|
3215
|
-
this._sortCriteria =
|
|
3252
|
+
_toggleSort(e, t) {
|
|
3253
|
+
this._sortCriteria = n(this._sortCriteria, e.key, t), this.dataMode !== "server" && this._recomputeView(), this.requestUpdate(), this._emit("sort-change", { criteria: [...this._sortCriteria] });
|
|
3216
3254
|
}
|
|
3217
3255
|
_selectColumn(e) {
|
|
3218
3256
|
let t = this._visibleRowCount;
|
|
@@ -3246,7 +3284,7 @@ var K = {
|
|
|
3246
3284
|
return Math.min(n, i);
|
|
3247
3285
|
}
|
|
3248
3286
|
_renderHeaderCell(t, n) {
|
|
3249
|
-
let r = t.sortable !== !1, i = this._sortCriteria.find((e) => e.key === t.key),
|
|
3287
|
+
let r = t.sortable !== !1, i = this._sortCriteria.find((e) => e.key === t.key), a = this._sortCriteria.length > 1 ? this._sortCriteria.findIndex((e) => e.key === t.key) : -1, o = this._filters.some((e) => e.key === t.key), l = t.pinned === "left", u = t.pinned === "right", d = l || u, f = t.headerAlign ?? K(t), p = [
|
|
3250
3288
|
"ft-header-cell",
|
|
3251
3289
|
r ? "ft-sortable" : "",
|
|
3252
3290
|
d ? "ft-pinned" : "",
|
|
@@ -3258,18 +3296,18 @@ var K = {
|
|
|
3258
3296
|
let y = this._colDrag?.active && this._colDrag.colIndex === n, b = [...p.split(" "), y ? "ft-col-dragging" : ""].filter(Boolean).join(" "), x = this.columns, S = x.findIndex((e) => e.key === t.key), C = [];
|
|
3259
3297
|
if (S > 0) for (let e = S - 1; e >= 0 && x[e].hidden; e--) C.push(x[e]);
|
|
3260
3298
|
let w = C.length > 0;
|
|
3261
|
-
return
|
|
3299
|
+
return s`
|
|
3262
3300
|
<div class=${b}
|
|
3263
3301
|
role="columnheader"
|
|
3264
3302
|
tabindex="-1"
|
|
3265
3303
|
aria-colindex=${n + 1}
|
|
3266
3304
|
data-col-index=${n}
|
|
3267
3305
|
style=${v}
|
|
3268
|
-
aria-sort=${m ??
|
|
3306
|
+
aria-sort=${m ?? c}
|
|
3269
3307
|
@contextmenu=${(e) => this._onHeaderContextMenu(e, t)}
|
|
3270
3308
|
@mousedown=${(e) => this._onHeaderMouseDown(e, t, n)}
|
|
3271
3309
|
@click=${r ? (e) => this._onHeaderClick(e, t) : void 0}>
|
|
3272
|
-
${w ?
|
|
3310
|
+
${w ? s`
|
|
3273
3311
|
<button class="ft-hidden-col-indicator" tabindex="-1"
|
|
3274
3312
|
title=${e("showHiddenColumns")}
|
|
3275
3313
|
@click=${(e) => {
|
|
@@ -3277,9 +3315,9 @@ var K = {
|
|
|
3277
3315
|
}}>❯</button>
|
|
3278
3316
|
` : ""}
|
|
3279
3317
|
<span>${t.label}</span>
|
|
3280
|
-
${i ?
|
|
3281
|
-
${
|
|
3282
|
-
<button class="ft-column-menu-btn ${
|
|
3318
|
+
${i ? s`<span class="ft-sort-indicator">${i.direction === "asc" ? "▲" : "▼"}</span>` : ""}
|
|
3319
|
+
${a >= 0 ? s`<span class="ft-sort-order">${a + 1}</span>` : ""}
|
|
3320
|
+
<button class="ft-column-menu-btn ${o ? "ft-filter-active" : ""}"
|
|
3283
3321
|
type="button"
|
|
3284
3322
|
tabindex="-1"
|
|
3285
3323
|
data-key=${t.key}
|
|
@@ -3324,11 +3362,7 @@ var K = {
|
|
|
3324
3362
|
});
|
|
3325
3363
|
}
|
|
3326
3364
|
_onColumnMenuBtnClick(e, t) {
|
|
3327
|
-
|
|
3328
|
-
this._headerMenu = null;
|
|
3329
|
-
return;
|
|
3330
|
-
}
|
|
3331
|
-
this._openColumnMenu(t, e.currentTarget);
|
|
3365
|
+
e.preventDefault(), e.stopPropagation(), this._headerMenu?.key === t.key ? this._headerMenu = null : this._openColumnMenu(t, e.currentTarget);
|
|
3332
3366
|
}
|
|
3333
3367
|
_openColumnMenu(e, t = this._columnMenuButton(e.key)) {
|
|
3334
3368
|
let n = t?.getBoundingClientRect();
|
|
@@ -3393,73 +3427,73 @@ var K = {
|
|
|
3393
3427
|
for (let e = n - 1; e >= 0 && t[e].hidden; e--) this._setColumnHidden(t[e].key, !1);
|
|
3394
3428
|
}
|
|
3395
3429
|
_renderHeaderContextMenu() {
|
|
3396
|
-
if (!this._headerMenu) return
|
|
3397
|
-
let { key: t, x: n, y: r, hiddenNeighbors: i } = this._headerMenu,
|
|
3398
|
-
if (!
|
|
3399
|
-
let
|
|
3430
|
+
if (!this._headerMenu) return c;
|
|
3431
|
+
let { key: t, x: n, y: r, hiddenNeighbors: i } = this._headerMenu, a = this.columns.find((e) => e.key === t);
|
|
3432
|
+
if (!a) return c;
|
|
3433
|
+
let o = this._filters.some((e) => e.key === t), l = (e, t, n, r = !1) => s`
|
|
3400
3434
|
<button type="button" role="menuitem" class="ft-header-menu-item" data-action=${e}
|
|
3401
3435
|
@click=${(e) => {
|
|
3402
3436
|
e.stopPropagation(), r || (this._headerMenu = null), n();
|
|
3403
3437
|
}}>${t}</button>
|
|
3404
3438
|
`;
|
|
3405
|
-
return
|
|
3406
|
-
<div class="ft-header-menu" role="menu" aria-label=${e("columnMenuRegion", { header:
|
|
3439
|
+
return s`
|
|
3440
|
+
<div class="ft-header-menu" role="menu" aria-label=${e("columnMenuRegion", { header: a.label })}
|
|
3407
3441
|
style="position: fixed; left: ${n}px; top: ${r}px; z-index: var(--u-layer-floating, 1000);"
|
|
3408
3442
|
@mousedown=${(e) => e.stopPropagation()}
|
|
3409
3443
|
@keydown=${(e) => this._onHeaderMenuKeydown(e)}>
|
|
3410
|
-
${
|
|
3444
|
+
${a.sortable === !1 ? c : s`
|
|
3411
3445
|
${l("sort-asc", e("sortAscending"), () => this._applySortFromMenu(t, "asc"))}
|
|
3412
3446
|
${l("sort-desc", e("sortDescending"), () => this._applySortFromMenu(t, "desc"))}
|
|
3413
3447
|
<div class="ft-header-menu-separator" role="separator"></div>
|
|
3414
3448
|
`}
|
|
3415
|
-
${this.showFilters ?
|
|
3449
|
+
${this.showFilters ? s`
|
|
3416
3450
|
${l("filter", e("filter"), () => this._openFilterFromMenu(t))}
|
|
3417
|
-
${
|
|
3451
|
+
${o ? l("clear-filter", e("clearFilter"), () => this._clearColumnFilter(t)) : c}
|
|
3418
3452
|
<div class="ft-header-menu-separator" role="separator"></div>
|
|
3419
|
-
` :
|
|
3453
|
+
` : c}
|
|
3420
3454
|
${l("hide", e("hideColumn"), () => this._setColumnHidden(t, !0))}
|
|
3421
3455
|
${i.map((t) => l("show", e("showColumn", { header: t.label }), () => this._setColumnHidden(t.key, !1)))}
|
|
3422
3456
|
<div class="ft-header-menu-separator" role="separator"></div>
|
|
3423
3457
|
${l("autofit", e("autoFitWidth"), () => this._autoFitColumn(t))}
|
|
3424
|
-
${l("wider", e("wider"), () => this._resizeColumnBy(t,
|
|
3458
|
+
${l("wider", e("wider"), () => this._resizeColumnBy(t, X), !0)}
|
|
3425
3459
|
${l("narrower", e("narrower"), () => this._resizeColumnBy(t, -20), !0)}
|
|
3426
3460
|
</div>
|
|
3427
3461
|
`;
|
|
3428
3462
|
}
|
|
3429
3463
|
_renderBodyContextMenu() {
|
|
3430
|
-
if (!this._bodyContextMenu) return
|
|
3431
|
-
let { colIndex: t, dataIndex: n, x:
|
|
3432
|
-
if (!
|
|
3433
|
-
let
|
|
3464
|
+
if (!this._bodyContextMenu) return c;
|
|
3465
|
+
let { colIndex: t, dataIndex: n, x: i, y: a } = this._bodyContextMenu, o = this.visibleColumns[t];
|
|
3466
|
+
if (!o) return c;
|
|
3467
|
+
let l = r(this.data[n], o.key), u = this._filters.some((e) => e.key === o.key), d = (e = !1) => {
|
|
3434
3468
|
this._bodyContextMenu = null, e && this.focus();
|
|
3435
|
-
},
|
|
3469
|
+
}, f = !!this.getComment(n, o.key), p = (e, t, n = !1) => s`
|
|
3436
3470
|
<button type="button" role="menuitem"
|
|
3437
3471
|
class="ft-context-menu-item ${n ? "ft-context-menu-danger" : ""}"
|
|
3438
3472
|
@click=${() => {
|
|
3439
|
-
t(),
|
|
3473
|
+
t(), d();
|
|
3440
3474
|
}}>${e}</button>
|
|
3441
|
-
`,
|
|
3442
|
-
return
|
|
3475
|
+
`, m = s`<div class="ft-context-menu-separator" role="separator"></div>`;
|
|
3476
|
+
return s`
|
|
3443
3477
|
<div class="ft-body-context-menu" role="menu" aria-label=${e("cellActions")}
|
|
3444
|
-
style="position: fixed; left: ${
|
|
3478
|
+
style="position: fixed; left: ${i}px; top: ${a}px; z-index: var(--u-layer-floating, 1000);"
|
|
3445
3479
|
@mousedown=${(e) => e.stopPropagation()}
|
|
3446
|
-
@keydown=${(e) => this._onMenuKeydown(e, ".ft-body-context-menu",
|
|
3447
|
-
${
|
|
3448
|
-
${
|
|
3449
|
-
${
|
|
3450
|
-
${
|
|
3451
|
-
${
|
|
3452
|
-
${
|
|
3453
|
-
${
|
|
3454
|
-
${
|
|
3455
|
-
${
|
|
3456
|
-
${
|
|
3457
|
-
${
|
|
3458
|
-
${
|
|
3459
|
-
${
|
|
3460
|
-
${
|
|
3461
|
-
${
|
|
3462
|
-
${
|
|
3480
|
+
@keydown=${(e) => this._onMenuKeydown(e, ".ft-body-context-menu", d)}>
|
|
3481
|
+
${p(e("copy"), () => this._copyFromMenu())}
|
|
3482
|
+
${m}
|
|
3483
|
+
${p(e("insertRowAbove"), () => this.addRow(void 0, n))}
|
|
3484
|
+
${p(e("insertRowBelow"), () => this.addRow(void 0, n + 1))}
|
|
3485
|
+
${p(e("deleteRow"), () => this.deleteRows([n]), !0)}
|
|
3486
|
+
${m}
|
|
3487
|
+
${p(e("hideColumn"), () => this._setColumnHidden(o.key, !0))}
|
|
3488
|
+
${m}
|
|
3489
|
+
${p(`${e("sortAscending")} ↑`, () => this._applySortFromMenu(o.key, "asc"))}
|
|
3490
|
+
${p(`${e("sortDescending")} ↓`, () => this._applySortFromMenu(o.key, "desc"))}
|
|
3491
|
+
${m}
|
|
3492
|
+
${p(e("filterByThisValue"), () => this.setFilter(o.key, (e) => e === l))}
|
|
3493
|
+
${u ? p(e("clearFilter"), () => this.removeFilter(o.key)) : c}
|
|
3494
|
+
${m}
|
|
3495
|
+
${p(e(f ? "editComment" : "addComment"), () => this._openCommentPopup(n, o.key, i, a))}
|
|
3496
|
+
${f ? p(e("deleteComment"), () => this.setComment(n, o.key, null), !0) : c}
|
|
3463
3497
|
</div>
|
|
3464
3498
|
`;
|
|
3465
3499
|
}
|
|
@@ -3483,9 +3517,9 @@ var K = {
|
|
|
3483
3517
|
this._commentPopup &&= (document.removeEventListener("mousedown", this._onCommentPopupOutsideClick), null);
|
|
3484
3518
|
}
|
|
3485
3519
|
_renderCommentPopup() {
|
|
3486
|
-
if (!this._commentPopup) return
|
|
3520
|
+
if (!this._commentPopup) return c;
|
|
3487
3521
|
let { x: t, y: n } = this._commentPopup, r = t + 240 > window.innerWidth ? t - 240 : t, i = n + 150 > window.innerHeight ? n - 150 : n;
|
|
3488
|
-
return
|
|
3522
|
+
return s`
|
|
3489
3523
|
<div class="ft-comment-popup"
|
|
3490
3524
|
style="position: fixed; left: ${r}px; top: ${i}px; z-index: calc(var(--u-layer-floating, 1000) + 1);"
|
|
3491
3525
|
@mousedown=${(e) => e.stopPropagation()}>
|
|
@@ -3526,15 +3560,9 @@ var K = {
|
|
|
3526
3560
|
}
|
|
3527
3561
|
_closeFilterDropdown(e = !0) {
|
|
3528
3562
|
let t = this._openFilterKey;
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
return;
|
|
3533
|
-
}
|
|
3534
|
-
this.updateComplete.then(() => {
|
|
3535
|
-
[...this.shadowRoot?.querySelectorAll(".ft-column-menu-btn") ?? []].find((e) => e.dataset.key === t)?.focus();
|
|
3536
|
-
});
|
|
3537
|
-
}
|
|
3563
|
+
this._openFilterKey = null, e && t !== null && (this._headerCol === null ? this.updateComplete.then(() => {
|
|
3564
|
+
[...this.shadowRoot?.querySelectorAll(".ft-column-menu-btn") ?? []].find((e) => e.dataset.key === t)?.focus();
|
|
3565
|
+
}) : this.focus());
|
|
3538
3566
|
}
|
|
3539
3567
|
_onFilterDialogKeydown(e) {
|
|
3540
3568
|
if (e.key !== "Tab") return;
|
|
@@ -3545,7 +3573,7 @@ var K = {
|
|
|
3545
3573
|
}
|
|
3546
3574
|
_renderFilterDropdown(t) {
|
|
3547
3575
|
let n = t.type ?? "text";
|
|
3548
|
-
return
|
|
3576
|
+
return s`
|
|
3549
3577
|
<div class="ft-filter-dropdown" role="dialog" aria-label=${e("filterFor", { header: t.label })}
|
|
3550
3578
|
@click=${(e) => e.stopPropagation()}
|
|
3551
3579
|
@keydown=${{
|
|
@@ -3585,7 +3613,7 @@ var K = {
|
|
|
3585
3613
|
}
|
|
3586
3614
|
_renderEmptyFilterRow(t, n) {
|
|
3587
3615
|
let r = this._emptyFilterState.get(t) ?? "";
|
|
3588
|
-
return
|
|
3616
|
+
return s`
|
|
3589
3617
|
<div class="ft-filter-empty-row">
|
|
3590
3618
|
<label>${e("blankCells")}</label>
|
|
3591
3619
|
<select class="ft-filter-mode-select" aria-label=${e("blankCells")}
|
|
@@ -3640,11 +3668,8 @@ var K = {
|
|
|
3640
3668
|
}
|
|
3641
3669
|
_applyFilterForKey(e) {
|
|
3642
3670
|
let t = this._emptyFilterState.get(e);
|
|
3643
|
-
if (t)
|
|
3644
|
-
|
|
3645
|
-
return;
|
|
3646
|
-
}
|
|
3647
|
-
if (this._textFilterState.has(e)) this._applyTextFilter(e);
|
|
3671
|
+
if (t) this.setFilter(e, this._buildEmptyPredicate(t));
|
|
3672
|
+
else if (this._textFilterState.has(e)) this._applyTextFilter(e);
|
|
3648
3673
|
else if (this._numberFilterState.has(e)) {
|
|
3649
3674
|
let t = this._buildNumberPredicate(this._numberFilterState.get(e));
|
|
3650
3675
|
t ? this.setFilter(e, t) : this.removeFilter(e);
|
|
@@ -3658,7 +3683,7 @@ var K = {
|
|
|
3658
3683
|
value: "",
|
|
3659
3684
|
mode: "contains"
|
|
3660
3685
|
};
|
|
3661
|
-
return
|
|
3686
|
+
return s`
|
|
3662
3687
|
<div class="ft-filter-mode-row">
|
|
3663
3688
|
<select class="ft-filter-mode-select" aria-label=${e("filterMatchMode")}
|
|
3664
3689
|
.value=${n.mode}
|
|
@@ -3716,7 +3741,7 @@ var K = {
|
|
|
3716
3741
|
}
|
|
3717
3742
|
_renderNumCondRow(t, n) {
|
|
3718
3743
|
let r = (this._numberFilterState.get(t) ?? this._defaultNumState())[n];
|
|
3719
|
-
return
|
|
3744
|
+
return s`
|
|
3720
3745
|
<div class="ft-num-cond-row">
|
|
3721
3746
|
<select class="ft-filter-mode-select ft-num-op-select" aria-label=${e("conditionOperator", { n: n === "cond1" ? 1 : 2 })}
|
|
3722
3747
|
.value=${r.op}
|
|
@@ -3730,7 +3755,7 @@ var K = {
|
|
|
3730
3755
|
@keydown=${(e) => {
|
|
3731
3756
|
e.key === "Escape" && this._closeFilterDropdown(), e.stopPropagation();
|
|
3732
3757
|
}}>
|
|
3733
|
-
${Object.keys(
|
|
3758
|
+
${Object.keys(lt).map((e) => s`<option value=${e}>${lt[e]}</option>`)}
|
|
3734
3759
|
</select>
|
|
3735
3760
|
<input class="ft-filter-input ft-num-cond-input" type="text" inputmode="decimal" placeholder=${e("valuePlaceholder")}
|
|
3736
3761
|
aria-label=${e("conditionValue", { n: n === "cond1" ? 1 : 2 })}
|
|
@@ -3741,7 +3766,7 @@ var K = {
|
|
|
3741
3766
|
i[n] = {
|
|
3742
3767
|
...i[n],
|
|
3743
3768
|
text: r,
|
|
3744
|
-
value: r.trim() === "" ? null :
|
|
3769
|
+
value: r.trim() === "" ? null : _(r)
|
|
3745
3770
|
}, this._numberFilterState.set(t, i), this._emptyFilterState.delete(t), this._applyFilterForKey(t);
|
|
3746
3771
|
}}
|
|
3747
3772
|
@keydown=${(e) => {
|
|
@@ -3752,7 +3777,7 @@ var K = {
|
|
|
3752
3777
|
}
|
|
3753
3778
|
_renderNumberFilter(t) {
|
|
3754
3779
|
let n = this._numberFilterState.get(t.key) ?? this._defaultNumState();
|
|
3755
|
-
return
|
|
3780
|
+
return s`
|
|
3756
3781
|
${this._renderNumCondRow(t.key, "cond1")}
|
|
3757
3782
|
<div class="ft-filter-mode-row">
|
|
3758
3783
|
<select class="ft-filter-mode-select" aria-label=${e("conditionJoin")}
|
|
@@ -3793,21 +3818,21 @@ var K = {
|
|
|
3793
3818
|
return n ? typeof n.error == "function" ? n.error() : n.error : null;
|
|
3794
3819
|
}
|
|
3795
3820
|
_renderDateFilter(t) {
|
|
3796
|
-
let n = t.type === "datetime", r = this._dateFilterState.get(t.key) ?? {}, i = (e) => e?.slice(0, 10),
|
|
3821
|
+
let n = t.type === "datetime", r = this._dateFilterState.get(t.key) ?? {}, i = (e) => e?.slice(0, 10), a = (e) => {
|
|
3797
3822
|
e.key === "Escape" && $(e.currentTarget) || (e.stopPropagation(), e.key === "Escape" && this._closeFilterDropdown());
|
|
3798
3823
|
};
|
|
3799
|
-
return
|
|
3824
|
+
return s`
|
|
3800
3825
|
<div class="ft-filter-range ft-filter-range-dates">
|
|
3801
3826
|
<u-date-picker class="ft-filter-date" size="sm" clearable
|
|
3802
3827
|
mode=${n ? "datetime" : "date"} label=${e("fromPlaceholder")}
|
|
3803
|
-
.value=${r.from ?? ""} max=${i(r.to) ??
|
|
3828
|
+
.value=${r.from ?? ""} max=${i(r.to) ?? c}
|
|
3804
3829
|
@change=${(e) => this._applyDateFilter(t.key, e, "from")}
|
|
3805
|
-
@keydown=${
|
|
3830
|
+
@keydown=${a}></u-date-picker>
|
|
3806
3831
|
<u-date-picker class="ft-filter-date" size="sm" clearable
|
|
3807
3832
|
mode=${n ? "datetime" : "date"} label=${e("toPlaceholder")}
|
|
3808
|
-
.value=${r.to ?? ""} min=${i(r.from) ??
|
|
3833
|
+
.value=${r.to ?? ""} min=${i(r.from) ?? c}
|
|
3809
3834
|
@change=${(e) => this._applyDateFilter(t.key, e, "to")}
|
|
3810
|
-
@keydown=${
|
|
3835
|
+
@keydown=${a}></u-date-picker>
|
|
3811
3836
|
</div>
|
|
3812
3837
|
${this._renderEmptyFilterRow(t.key, () => {
|
|
3813
3838
|
this._dateFilterState.delete(t.key);
|
|
@@ -3819,7 +3844,7 @@ var K = {
|
|
|
3819
3844
|
r === "" ? delete i[n] : i[n] = r, this._dateFilterState.set(e, i), this._emptyFilterState.delete(e), this._applyFilterForKey(e);
|
|
3820
3845
|
}
|
|
3821
3846
|
_renderBooleanFilter(t) {
|
|
3822
|
-
return
|
|
3847
|
+
return s`
|
|
3823
3848
|
<select class="ft-filter-input" aria-label=${e("filterFor", { header: t.label })}
|
|
3824
3849
|
@change=${(e) => {
|
|
3825
3850
|
let n = e.target.value;
|
|
@@ -3843,7 +3868,7 @@ var K = {
|
|
|
3843
3868
|
if (!n) return;
|
|
3844
3869
|
let r = this.shadowRoot?.querySelectorAll(`.ft-cell[data-col-index="${t}"]`), i = 0, a = this.shadowRoot?.querySelector(`.ft-header-cell[data-col-index="${t}"]`);
|
|
3845
3870
|
if (a && (i = Math.max(i, a.scrollWidth)), r) for (let e of r) i = Math.max(i, e.scrollWidth);
|
|
3846
|
-
let o = n.minWidth ??
|
|
3871
|
+
let o = n.minWidth ?? Y, s = Math.max(o, i + 8);
|
|
3847
3872
|
this._columnWidths.set(n.key, s), this.requestUpdate(), this._emit("column-resize", {
|
|
3848
3873
|
key: n.key,
|
|
3849
3874
|
width: s,
|
|
@@ -3852,7 +3877,7 @@ var K = {
|
|
|
3852
3877
|
}
|
|
3853
3878
|
_onResizeStart(e, t) {
|
|
3854
3879
|
e.preventDefault(), e.stopPropagation();
|
|
3855
|
-
let n = this.visibleColumns[t], r = this._columnWidths.get(n.key) ?? n.width ??
|
|
3880
|
+
let n = this.visibleColumns[t], r = this._columnWidths.get(n.key) ?? n.width ?? J;
|
|
3856
3881
|
this._resizing = {
|
|
3857
3882
|
colIndex: t,
|
|
3858
3883
|
startX: e.clientX,
|
|
@@ -3860,13 +3885,13 @@ var K = {
|
|
|
3860
3885
|
};
|
|
3861
3886
|
let i = (e) => {
|
|
3862
3887
|
if (!this._resizing) return;
|
|
3863
|
-
let t = e.clientX - this._resizing.startX, r = n.minWidth ??
|
|
3888
|
+
let t = e.clientX - this._resizing.startX, r = n.minWidth ?? Y, i = Math.max(r, this._resizing.startWidth + t);
|
|
3864
3889
|
this._columnWidths.set(n.key, i), this.requestUpdate();
|
|
3865
3890
|
}, a = () => {
|
|
3866
3891
|
document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", o), this._resizeCleanup = null;
|
|
3867
3892
|
}, o = () => {
|
|
3868
3893
|
if (a(), this._resizing) {
|
|
3869
|
-
let e = this._columnWidths.get(n.key) ??
|
|
3894
|
+
let e = this._columnWidths.get(n.key) ?? J;
|
|
3870
3895
|
this._emit("column-resize", {
|
|
3871
3896
|
key: n.key,
|
|
3872
3897
|
width: e,
|
|
@@ -3966,46 +3991,46 @@ var K = {
|
|
|
3966
3991
|
startCol: Math.min(a, s.startCol)
|
|
3967
3992
|
}, this._fillDrag.targetRange = u, this.requestUpdate();
|
|
3968
3993
|
}
|
|
3969
|
-
_applyFillHandle(e,
|
|
3970
|
-
let
|
|
3971
|
-
for (let
|
|
3972
|
-
let
|
|
3973
|
-
for (let t = e.startRow; t <= e.endRow; t++)
|
|
3974
|
-
let
|
|
3975
|
-
for (let
|
|
3976
|
-
if (
|
|
3977
|
-
let
|
|
3978
|
-
if (
|
|
3979
|
-
let t =
|
|
3980
|
-
|
|
3994
|
+
_applyFillHandle(e, n) {
|
|
3995
|
+
let i = this.visibleColumns, a = [], o = [];
|
|
3996
|
+
for (let s = n.startCol; s <= n.endCol; s++) {
|
|
3997
|
+
let c = i[s], l = [];
|
|
3998
|
+
for (let t = e.startRow; t <= e.endRow; t++) l.push(r(this.data[this._toDataIndex(t)], c.key));
|
|
3999
|
+
let u = this._detectNumericSeries(l);
|
|
4000
|
+
for (let i = n.startRow; i <= n.endRow; i++) {
|
|
4001
|
+
if (i >= e.startRow && i <= e.endRow) continue;
|
|
4002
|
+
let n = this._toDataIndex(i), s = r(this.data[n], c.key), d;
|
|
4003
|
+
if (u && i > e.endRow) {
|
|
4004
|
+
let t = i - e.endRow, n = u.last + u.diff * t;
|
|
4005
|
+
d = c.type === "number" ? n : String(n);
|
|
3981
4006
|
} else {
|
|
3982
|
-
let t = (
|
|
3983
|
-
|
|
4007
|
+
let t = (i - e.startRow) % l.length;
|
|
4008
|
+
d = l[t < 0 ? t + l.length : t];
|
|
3984
4009
|
}
|
|
3985
|
-
this.data[
|
|
3986
|
-
dataRow:
|
|
3987
|
-
key:
|
|
3988
|
-
oldValue:
|
|
3989
|
-
newValue:
|
|
3990
|
-
}),
|
|
4010
|
+
t(this.data[n], c.key, d), a.push({
|
|
4011
|
+
dataRow: n,
|
|
4012
|
+
key: c.key,
|
|
4013
|
+
oldValue: s,
|
|
4014
|
+
newValue: d
|
|
4015
|
+
}), o.push(this.data[n]);
|
|
3991
4016
|
}
|
|
3992
4017
|
}
|
|
3993
|
-
|
|
4018
|
+
a.length > 0 && (this._undo.push({
|
|
3994
4019
|
label: "fill-handle",
|
|
3995
4020
|
undo: () => {
|
|
3996
|
-
|
|
3997
|
-
|
|
4021
|
+
a.forEach((e, n) => {
|
|
4022
|
+
t(o[n], e.key, e.oldValue);
|
|
3998
4023
|
}), this.requestUpdate();
|
|
3999
4024
|
},
|
|
4000
4025
|
redo: () => {
|
|
4001
|
-
|
|
4002
|
-
|
|
4026
|
+
a.forEach((e, n) => {
|
|
4027
|
+
t(o[n], e.key, e.newValue);
|
|
4003
4028
|
}), this.requestUpdate();
|
|
4004
4029
|
}
|
|
4005
4030
|
}), this._dispatchUndoStateEvent(), this._emit("fill-handle-apply", {
|
|
4006
4031
|
sourceRange: e,
|
|
4007
|
-
targetRange:
|
|
4008
|
-
cells:
|
|
4032
|
+
targetRange: n,
|
|
4033
|
+
cells: a
|
|
4009
4034
|
})), this.requestUpdate();
|
|
4010
4035
|
}
|
|
4011
4036
|
_detectNumericSeries(e) {
|
|
@@ -4028,7 +4053,7 @@ var K = {
|
|
|
4028
4053
|
let n = (this._colLeftOffsets[e.endCol] ?? 0) + this._getColWidth(t[e.endCol]) - this._scrollLeft - 4, r = this.headerHeight + (e.endRow + 1) * this.rowHeight - this._scrollTop - 4;
|
|
4029
4054
|
if (n < 0 || r < this.headerHeight) return "";
|
|
4030
4055
|
let i = this._fillDrag?.active && this._fillDrag.targetRange ? this._renderFillPreview(this._fillDrag.targetRange) : "";
|
|
4031
|
-
return
|
|
4056
|
+
return s`
|
|
4032
4057
|
${i}
|
|
4033
4058
|
<div class="ft-fill-handle"
|
|
4034
4059
|
style="left:${n}px;top:${r}px;"
|
|
@@ -4039,8 +4064,8 @@ var K = {
|
|
|
4039
4064
|
_renderFillPreview(e) {
|
|
4040
4065
|
let t = this.visibleColumns;
|
|
4041
4066
|
if (e.endCol >= t.length || e.endRow >= this._visibleRowCount) return "";
|
|
4042
|
-
let n = (this._colLeftOffsets[e.startCol] ?? 0) - this._scrollLeft, r = this.headerHeight + e.startRow * this.rowHeight - this._scrollTop, i = (this._colLeftOffsets[e.endCol] ?? 0) + this._getColWidth(t[e.endCol]) - (this._colLeftOffsets[e.startCol] ?? 0),
|
|
4043
|
-
return
|
|
4067
|
+
let n = (this._colLeftOffsets[e.startCol] ?? 0) - this._scrollLeft, r = this.headerHeight + e.startRow * this.rowHeight - this._scrollTop, i = (this._colLeftOffsets[e.endCol] ?? 0) + this._getColWidth(t[e.endCol]) - (this._colLeftOffsets[e.startCol] ?? 0), a = (e.endRow - e.startRow + 1) * this.rowHeight;
|
|
4068
|
+
return s`<div class="ft-fill-preview" style="left:${n}px;top:${r}px;width:${i}px;height:${a}px;"></div>`;
|
|
4044
4069
|
}
|
|
4045
4070
|
_onRowNumMouseDown(e, t) {
|
|
4046
4071
|
if (e.button !== 0) return;
|
|
@@ -4104,11 +4129,7 @@ var K = {
|
|
|
4104
4129
|
});
|
|
4105
4130
|
}
|
|
4106
4131
|
_toggleFindPanel(e) {
|
|
4107
|
-
|
|
4108
|
-
this._closeFindPanel();
|
|
4109
|
-
return;
|
|
4110
|
-
}
|
|
4111
|
-
this._openFindPanel(e);
|
|
4132
|
+
this._findState?.mode === e ? this._closeFindPanel() : this._openFindPanel(e);
|
|
4112
4133
|
}
|
|
4113
4134
|
_openFindPanel(e) {
|
|
4114
4135
|
this._findState = {
|
|
@@ -4164,31 +4185,31 @@ var K = {
|
|
|
4164
4185
|
}
|
|
4165
4186
|
_replaceAll() {
|
|
4166
4187
|
if (!this._findState || this._findState.results.length === 0) return;
|
|
4167
|
-
let { results: e, replaceWith:
|
|
4168
|
-
for (let { row:
|
|
4169
|
-
let e = this._toDataIndex(
|
|
4170
|
-
this.data[e]
|
|
4188
|
+
let { results: e, replaceWith: n } = this._findState, i = this.visibleColumns, a = [], o = [];
|
|
4189
|
+
for (let { row: s, col: c } of e) {
|
|
4190
|
+
let e = this._toDataIndex(s), l = i[c].key, u = r(this.data[e], l);
|
|
4191
|
+
t(this.data[e], l, n), a.push({
|
|
4171
4192
|
dataRow: e,
|
|
4172
|
-
key:
|
|
4173
|
-
oldValue:
|
|
4174
|
-
newValue:
|
|
4175
|
-
}),
|
|
4193
|
+
key: l,
|
|
4194
|
+
oldValue: u,
|
|
4195
|
+
newValue: n
|
|
4196
|
+
}), o.push(this.data[e]);
|
|
4176
4197
|
}
|
|
4177
|
-
|
|
4198
|
+
a.length > 0 && (this._undo.push({
|
|
4178
4199
|
label: "replace-all",
|
|
4179
4200
|
undo: () => {
|
|
4180
|
-
|
|
4181
|
-
|
|
4201
|
+
a.forEach((e, n) => {
|
|
4202
|
+
t(o[n], e.key, e.oldValue);
|
|
4182
4203
|
}), this.requestUpdate();
|
|
4183
4204
|
},
|
|
4184
4205
|
redo: () => {
|
|
4185
|
-
|
|
4186
|
-
|
|
4206
|
+
a.forEach((e, n) => {
|
|
4207
|
+
t(o[n], e.key, e.newValue);
|
|
4187
4208
|
}), this.requestUpdate();
|
|
4188
4209
|
}
|
|
4189
4210
|
}), this._dispatchUndoStateEvent(), this._emit("find-replace", {
|
|
4190
4211
|
type: "replace-all",
|
|
4191
|
-
cells:
|
|
4212
|
+
cells: a.map((e) => ({
|
|
4192
4213
|
row: e.dataRow,
|
|
4193
4214
|
col: e.key,
|
|
4194
4215
|
oldValue: e.oldValue,
|
|
@@ -4198,36 +4219,32 @@ var K = {
|
|
|
4198
4219
|
}
|
|
4199
4220
|
_replaceOne() {
|
|
4200
4221
|
if (!this._findState || this._findState.results.length === 0) return;
|
|
4201
|
-
let { currentIndex: e, results:
|
|
4202
|
-
|
|
4222
|
+
let { currentIndex: e, results: n, replaceWith: i } = this._findState, { row: a, col: o } = n[e], s = this._toDataIndex(a), c = this.visibleColumns[o].key, l = this.data[s], u = r(l, c);
|
|
4223
|
+
t(l, c, i), this._undo.push({
|
|
4203
4224
|
label: "replace",
|
|
4204
4225
|
undo: () => {
|
|
4205
|
-
|
|
4226
|
+
t(l, c, u), this.requestUpdate();
|
|
4206
4227
|
},
|
|
4207
4228
|
redo: () => {
|
|
4208
|
-
|
|
4229
|
+
t(l, c, i), this.requestUpdate();
|
|
4209
4230
|
}
|
|
4210
4231
|
}), this._dispatchUndoStateEvent(), this._emit("find-replace", {
|
|
4211
4232
|
type: "replace",
|
|
4212
4233
|
cells: [{
|
|
4213
|
-
row:
|
|
4214
|
-
col:
|
|
4215
|
-
oldValue:
|
|
4216
|
-
newValue:
|
|
4234
|
+
row: s,
|
|
4235
|
+
col: c,
|
|
4236
|
+
oldValue: u,
|
|
4237
|
+
newValue: i
|
|
4217
4238
|
}]
|
|
4218
4239
|
}), this._findSearch(), this._findGoTo(Math.min(e, this._findState.results.length - 1));
|
|
4219
4240
|
}
|
|
4220
4241
|
_renderFindPanel() {
|
|
4221
4242
|
if (!this._findState) return "";
|
|
4222
|
-
let { mode: t, query: n, replaceWith: r, matchCase: i, wholeCell:
|
|
4223
|
-
return
|
|
4243
|
+
let { mode: t, query: n, replaceWith: r, matchCase: i, wholeCell: a, results: o, currentIndex: c } = this._findState, l = o.length, u = l > 0 ? c + 1 : 0;
|
|
4244
|
+
return s`
|
|
4224
4245
|
<div class="ft-find-panel"
|
|
4225
4246
|
@keydown=${(e) => {
|
|
4226
|
-
|
|
4227
|
-
this._closeFindPanel();
|
|
4228
|
-
return;
|
|
4229
|
-
}
|
|
4230
|
-
e.key === "Enter" && !v(e) && e.target instanceof HTMLInputElement && e.target.classList.contains("ft-find-input") && (e.shiftKey ? this._findPrev() : this._findNext());
|
|
4247
|
+
e.stopPropagation(), e.key === "Escape" ? this._closeFindPanel() : e.key === "Enter" && !x(e) && e.target instanceof HTMLInputElement && e.target.classList.contains("ft-find-input") && (e.shiftKey ? this._findPrev() : this._findNext());
|
|
4231
4248
|
}}>
|
|
4232
4249
|
<div class="ft-find-row">
|
|
4233
4250
|
<input class="ft-find-input" type="text" placeholder=${e("findPlaceholder")} aria-label=${e("findInput")}
|
|
@@ -4242,12 +4259,12 @@ var K = {
|
|
|
4242
4259
|
<label title=${e("matchCase")}><input type="checkbox" aria-label=${e("matchCase")} ?checked=${i} @change=${(e) => {
|
|
4243
4260
|
this._findState.matchCase = e.target.checked, this._findSearch();
|
|
4244
4261
|
}}> Aa</label>
|
|
4245
|
-
<label title=${e("wholeCell")}><input type="checkbox" aria-label=${e("wholeCell")} ?checked=${
|
|
4262
|
+
<label title=${e("wholeCell")}><input type="checkbox" aria-label=${e("wholeCell")} ?checked=${a} @change=${(e) => {
|
|
4246
4263
|
this._findState.wholeCell = e.target.checked, this._findSearch();
|
|
4247
4264
|
}}> [ ]</label>
|
|
4248
4265
|
<button @click=${() => this._closeFindPanel()} aria-label=${e("closeFind")} aria-keyshortcuts="Escape" title=${`${e("closeFind")} (Escape)`}>✕</button>
|
|
4249
4266
|
</div>
|
|
4250
|
-
${t === "replace" ?
|
|
4267
|
+
${t === "replace" ? s`
|
|
4251
4268
|
<div class="ft-find-row">
|
|
4252
4269
|
<input class="ft-find-replace-input" type="text" placeholder=${e("replaceWithPlaceholder")} aria-label=${e("replaceInput")}
|
|
4253
4270
|
.value=${r}
|
|
@@ -4262,13 +4279,13 @@ var K = {
|
|
|
4262
4279
|
`;
|
|
4263
4280
|
}
|
|
4264
4281
|
render() {
|
|
4265
|
-
let t = this.visibleColumns, n = this.importEnabled && this._isDragOver ?
|
|
4266
|
-
if (t.length === 0) return
|
|
4267
|
-
let i = this.headerHeight,
|
|
4268
|
-
for (let e = 0; e < t.length; e++) (t[e].pinned === "left" || t[e].pinned === "right") && (e <
|
|
4269
|
-
let d = 0, f = this._scrollLeft, p = this.selectable ?
|
|
4282
|
+
let t = this.visibleColumns, n = this.importEnabled && this._isDragOver ? s`<div class="ft-import-overlay">${e("dropFileToImport")}</div>` : c, r = this.loading ? s`<div class="ft-loading-overlay"></div>` : c;
|
|
4283
|
+
if (t.length === 0) return s`${n}${r}<div class="ft-empty">${e("noColumnsDefined")}</div>`;
|
|
4284
|
+
let i = this.headerHeight, a = this._totalRowWidth, { start: o, end: l } = this.visibleColRange, u = [];
|
|
4285
|
+
for (let e = 0; e < t.length; e++) (t[e].pinned === "left" || t[e].pinned === "right") && (e < o || e >= l) && u.push(e);
|
|
4286
|
+
let d = 0, f = this._scrollLeft, p = this.selectable ? s`<div class="ft-checkbox-header"
|
|
4270
4287
|
style="position: absolute; top: 0; left: ${f + d}px; width: ${this._checkboxColWidth}px; height: ${i}px; z-index: 4;">
|
|
4271
|
-
${this._rowSelection.mode === "multi" ?
|
|
4288
|
+
${this._rowSelection.mode === "multi" ? s`
|
|
4272
4289
|
<!-- 칸 전체가 누르는 자리다(라벨) — 체크 상자는 16px 그대로. -->
|
|
4273
4290
|
<label class="ft-checkbox-hit"><input type="checkbox" tabindex="-1" aria-label=${e("selectAllRows")}
|
|
4274
4291
|
.checked=${this._rowSelection.isAllSelected(this._visibleRowIds())}
|
|
@@ -4277,16 +4294,16 @@ var K = {
|
|
|
4277
4294
|
` : ""}
|
|
4278
4295
|
</div>` : "";
|
|
4279
4296
|
this.selectable && (d += this._checkboxColWidth);
|
|
4280
|
-
let m = this.showRowNumbers ?
|
|
4297
|
+
let m = this.showRowNumbers ? s`<div class="ft-row-num-header"
|
|
4281
4298
|
style="position: absolute; top: 0; left: ${f + d}px; width: 48px; height: ${i}px; z-index: 4;">#</div>` : "", h = [];
|
|
4282
4299
|
for (let e of u) h.push(this._renderHeaderCell(t[e], e));
|
|
4283
|
-
for (let e =
|
|
4284
|
-
let g = this._colDragIndicatorLeft == null ? "" :
|
|
4300
|
+
for (let e = o; e < l; e++) h.push(this._renderHeaderCell(t[e], e));
|
|
4301
|
+
let g = this._colDragIndicatorLeft == null ? "" : s`<div class="ft-drop-indicator" style="left:${this._colDragIndicatorLeft}px"></div>`;
|
|
4285
4302
|
if (this.error || this.data.length === 0 || this._visibleRowCount === 0) {
|
|
4286
|
-
let t = this.error ?
|
|
4287
|
-
return
|
|
4303
|
+
let t = this.error ? s`<div class="ft-empty ft-error" role="alert">${this.error.message}</div>` : s`<div class="ft-empty">${this.data.length === 0 ? this.emptyMessage || e("noData") : this.noMatchingMessage || e("noMatchingData")}</div>`;
|
|
4304
|
+
return s`
|
|
4288
4305
|
${r}
|
|
4289
|
-
<div class="ft-header" role="row" aria-rowindex="1" style="width: ${
|
|
4306
|
+
<div class="ft-header" role="row" aria-rowindex="1" style="width: ${a}px; height: ${i}px;">
|
|
4290
4307
|
${p}${m}
|
|
4291
4308
|
${h}
|
|
4292
4309
|
${g}
|
|
@@ -4295,22 +4312,22 @@ var K = {
|
|
|
4295
4312
|
`;
|
|
4296
4313
|
}
|
|
4297
4314
|
let { start: _, end: v } = this.visibleRange, y = this._frozenRowCount, b = [];
|
|
4298
|
-
for (let e = _; e < v; e++) b.push(this._renderRow(e,
|
|
4299
|
-
let x = this._renderFillHandle(), S = this._rowDragIndicatorY == null ? "" :
|
|
4300
|
-
return
|
|
4315
|
+
for (let e = _; e < v; e++) b.push(this._renderRow(e, o, l, u, (e - y) * this.rowHeight));
|
|
4316
|
+
let x = this._renderFillHandle(), S = this._rowDragIndicatorY == null ? "" : s`<div class="ft-row-drop-indicator" style="top:${this._rowDragIndicatorY}px;width:${a}px;"></div>`;
|
|
4317
|
+
return s`
|
|
4301
4318
|
${n}
|
|
4302
4319
|
${r}
|
|
4303
4320
|
${this._renderFindPanel()}
|
|
4304
|
-
<div class="ft-header" role="row" aria-rowindex="1" style="width: ${
|
|
4321
|
+
<div class="ft-header" role="row" aria-rowindex="1" style="width: ${a}px; height: ${i}px;">
|
|
4305
4322
|
${p}${m}
|
|
4306
4323
|
${h}
|
|
4307
4324
|
${g}
|
|
4308
4325
|
</div>
|
|
4309
|
-
${this._renderFrozenRows(
|
|
4310
|
-
<div class="ft-body" style="height: ${this.totalBodyHeight}px; width: ${
|
|
4326
|
+
${this._renderFrozenRows(o, l, u)}
|
|
4327
|
+
<div class="ft-body" style="height: ${this.totalBodyHeight}px; width: ${a}px;">
|
|
4311
4328
|
${b}
|
|
4312
4329
|
</div>
|
|
4313
|
-
${this.footerData ? this._renderFooter(
|
|
4330
|
+
${this.footerData ? this._renderFooter(o, l, u) : ""}
|
|
4314
4331
|
${S}
|
|
4315
4332
|
${x}
|
|
4316
4333
|
${this._renderHeaderContextMenu()}
|
|
@@ -4333,45 +4350,45 @@ var K = {
|
|
|
4333
4350
|
}
|
|
4334
4351
|
_renderFrozenRows(e, t, n) {
|
|
4335
4352
|
let r = this._frozenRowCount;
|
|
4336
|
-
if (r === 0) return
|
|
4337
|
-
let i = this._totalRowWidth,
|
|
4338
|
-
for (let i = 0; i < r; i++)
|
|
4339
|
-
return
|
|
4353
|
+
if (r === 0) return c;
|
|
4354
|
+
let i = this._totalRowWidth, a = [];
|
|
4355
|
+
for (let i = 0; i < r; i++) a.push(this._renderRow(i, e, t, n, i * this.rowHeight));
|
|
4356
|
+
return s`
|
|
4340
4357
|
<div class="ft-frozen-rows" style="top: ${this.headerHeight}px; height: ${this.frozenRowsHeight}px; width: ${i}px;">
|
|
4341
|
-
${
|
|
4358
|
+
${a}
|
|
4342
4359
|
</div>
|
|
4343
4360
|
`;
|
|
4344
4361
|
}
|
|
4345
4362
|
_renderFooter(e, t, n) {
|
|
4346
4363
|
if (!this.footerData) return "";
|
|
4347
|
-
let r = this.visibleColumns, i = this.rowHeight,
|
|
4348
|
-
style="position: absolute; top: 0; left: ${
|
|
4364
|
+
let r = this.visibleColumns, i = this.rowHeight, a = this._totalRowWidth, o = this._scrollLeft, c = 0, l = this.selectable ? s`<div class="ft-footer-cell ft-checkbox-cell"
|
|
4365
|
+
style="position: absolute; top: 0; left: ${o + c}px; width: ${this._checkboxColWidth}px; height: ${i}px; z-index: 2;"></div>` : "";
|
|
4349
4366
|
this.selectable && (c += this._checkboxColWidth);
|
|
4350
|
-
let u = this.showRowNumbers ?
|
|
4351
|
-
style="position: absolute; top: 0; left: ${
|
|
4367
|
+
let u = this.showRowNumbers ? s`<div class="ft-footer-cell ft-row-num"
|
|
4368
|
+
style="position: absolute; top: 0; left: ${o + c}px; width: 48px; height: ${i}px; z-index: 2;"></div>` : "", d = [];
|
|
4352
4369
|
for (let e of n) {
|
|
4353
|
-
let t = r[e], n = this._getColWidth(t),
|
|
4354
|
-
d.push(
|
|
4355
|
-
<div class="ft-footer-cell ft-pinned" role="gridcell" aria-colindex=${e + 1} style=${
|
|
4370
|
+
let t = r[e], n = this._getColWidth(t), a = t.pinned === "right" ? `position: absolute; top: 0; left: ${this._getPinnedRightLeft(e)}px; width: ${n}px; height: ${i}px; z-index: 2;` : `position: absolute; top: 0; left: ${o + this._getPinnedLeft(e)}px; width: ${n}px; height: ${i}px; z-index: 2;`;
|
|
4371
|
+
d.push(s`
|
|
4372
|
+
<div class="ft-footer-cell ft-pinned" role="gridcell" aria-colindex=${e + 1} style=${a}>
|
|
4356
4373
|
${this.footerData[t.key] ?? ""}</div>
|
|
4357
4374
|
`);
|
|
4358
4375
|
}
|
|
4359
4376
|
for (let n = e; n < t; n++) {
|
|
4360
|
-
let e = r[n], t = this._getColWidth(e),
|
|
4361
|
-
f = c ? `position: absolute; top: 0; left: ${
|
|
4377
|
+
let e = r[n], t = this._getColWidth(e), a = this._colLeftOffsets[n] ?? 0, c = e.pinned === "left", l = e.pinned === "right", u = c || l, f;
|
|
4378
|
+
f = c ? `position: absolute; top: 0; left: ${o + this._getPinnedLeft(n)}px; width: ${t}px; height: ${i}px; z-index: 2;` : l ? `position: absolute; top: 0; right: ${-o + this._getPinnedRight(n)}px; width: ${t}px; height: ${i}px; z-index: 2;` : `left: ${a}px; width: ${t}px; height: ${i}px;`, d.push(s`
|
|
4362
4379
|
<div class="ft-footer-cell ${u ? "ft-pinned" : ""}" role="gridcell" aria-colindex=${n + 1} style=${f}>
|
|
4363
4380
|
${this.footerData[e.key] ?? ""}</div>
|
|
4364
4381
|
`);
|
|
4365
4382
|
}
|
|
4366
|
-
return
|
|
4367
|
-
<div class="ft-footer" role="row" aria-rowindex=${this._visibleRowCount + 2} style="width: ${
|
|
4383
|
+
return s`
|
|
4384
|
+
<div class="ft-footer" role="row" aria-rowindex=${this._visibleRowCount + 2} style="width: ${a}px; height: ${i}px;">
|
|
4368
4385
|
${l}${u}
|
|
4369
4386
|
${d}
|
|
4370
4387
|
</div>
|
|
4371
4388
|
`;
|
|
4372
4389
|
}
|
|
4373
|
-
_renderRow(t, n, r, i,
|
|
4374
|
-
let
|
|
4390
|
+
_renderRow(t, n, r, i, a) {
|
|
4391
|
+
let o = this.visibleColumns, c = this._toDataIndex(t), l = this.data[c], u = a ?? t * this.rowHeight, d = this.rowHeight, f = this._totalRowWidth, p = t % 2 == 0 ? "ft-row-even" : "ft-row-odd", m = this.selectable && l !== void 0 && this._rowSelection.isSelected(this.getRowId(l)), h = this._scrollLeft, g = 0, _ = this.selectable ? s`
|
|
4375
4392
|
<div class="ft-checkbox-cell"
|
|
4376
4393
|
style="position: absolute; top: 0; left: ${h + g}px; width: ${this._checkboxColWidth}px; height: ${d}px; z-index: 2;">
|
|
4377
4394
|
<!-- 행 체크박스는 Tab 정지점이 아니다 — 그리드(호스트)가 하나의 정지점이고 행 선택은 Shift+Space 다.
|
|
@@ -4383,15 +4400,15 @@ var K = {
|
|
|
4383
4400
|
</div>
|
|
4384
4401
|
` : "";
|
|
4385
4402
|
this.selectable && (g += this._checkboxColWidth);
|
|
4386
|
-
let v = this._rowDrag?.active && this._rowDrag.rowIndex === t, y = this.showRowNumbers ?
|
|
4403
|
+
let v = this._rowDrag?.active && this._rowDrag.rowIndex === t, y = this.showRowNumbers ? s`
|
|
4387
4404
|
<div class="ft-row-num ${v ? "ft-col-dragging" : ""}"
|
|
4388
4405
|
style="position: absolute; top: 0; left: ${h + g}px; width: 48px; height: ${d}px; z-index: 2; cursor: grab;"
|
|
4389
4406
|
@mousedown=${(e) => this._onRowNumMouseDown(e, t)}
|
|
4390
4407
|
@click=${() => this._onRowNumberClick(t)}>${c + 1}</div>
|
|
4391
4408
|
` : "", b = [];
|
|
4392
|
-
for (let e of i) b.push(this._renderCell(l,
|
|
4393
|
-
for (let e = n; e < r; e++) b.push(this._renderCell(l,
|
|
4394
|
-
return
|
|
4409
|
+
for (let e of i) b.push(this._renderCell(l, o[e], t, e, this._mergeState(o[e], t)));
|
|
4410
|
+
for (let e = n; e < r; e++) b.push(this._renderCell(l, o[e], t, e, this._mergeState(o[e], t)));
|
|
4411
|
+
return s`
|
|
4395
4412
|
<div class="ft-row ${p} ${m ? "ft-row-selected" : ""}" role="row" aria-rowindex=${t + 2}
|
|
4396
4413
|
style="top: ${u}px; height: ${d}px; width: ${f}px;">
|
|
4397
4414
|
${_}${y}
|
|
@@ -4402,13 +4419,13 @@ var K = {
|
|
|
4402
4419
|
_continuesRun(e, t) {
|
|
4403
4420
|
let n = e.mergeRepeated;
|
|
4404
4421
|
if (!n || t <= 0 || t >= this._visibleRowCount) return !1;
|
|
4405
|
-
let
|
|
4406
|
-
if (!
|
|
4407
|
-
if (typeof n == "function") return n(
|
|
4408
|
-
let
|
|
4409
|
-
if (
|
|
4410
|
-
let
|
|
4411
|
-
return
|
|
4422
|
+
let i = this.data[this._toDataIndex(t)], a = this.data[this._toDataIndex(t - 1)];
|
|
4423
|
+
if (!i || !a) return !1;
|
|
4424
|
+
if (typeof n == "function") return n(i, a, e);
|
|
4425
|
+
let o = r(i, e.key);
|
|
4426
|
+
if (o == null || o === "") return !1;
|
|
4427
|
+
let s = r(a, e.key);
|
|
4428
|
+
return o instanceof Date && s instanceof Date ? o.getTime() === s.getTime() : Object.is(o, s);
|
|
4412
4429
|
}
|
|
4413
4430
|
_isForcedRunHead(e) {
|
|
4414
4431
|
let t = this._frozenRowCount;
|
|
@@ -4426,75 +4443,75 @@ var K = {
|
|
|
4426
4443
|
headParity: i % 2 == 0 ? "even" : "odd"
|
|
4427
4444
|
};
|
|
4428
4445
|
}
|
|
4429
|
-
_renderCell(e, t, n,
|
|
4430
|
-
let
|
|
4431
|
-
|
|
4432
|
-
let
|
|
4446
|
+
_renderCell(e, t, n, i, a = null) {
|
|
4447
|
+
let o = this._activeCell?.row === n && this._activeCell?.col === i, l = this._editingCell?.row === n && this._editingCell?.col === i, u = this._selection.isInRange(n, i), d = t.pinned === "left", f = t.pinned === "right", p = d || f, m = this._getColWidth(t), h = this.rowHeight, g = this._colLeftOffsets[i] ?? 0, _;
|
|
4448
|
+
_ = d ? `position: absolute; top: 0; left: ${this._scrollLeft + this._getPinnedLeft(i)}px; width: ${m}px; height: ${h}px; z-index: 2;` : f ? `position: absolute; top: 0; left: ${this._getPinnedRightLeft(i)}px; width: ${m}px; height: ${h}px; z-index: 2;` : `left: ${g}px; width: ${m}px; height: ${h}px;`;
|
|
4449
|
+
let v = !this._isCellEditable(t);
|
|
4433
4450
|
if (t.conditionalRules && t.conditionalRules.length > 0) {
|
|
4434
|
-
let n = e
|
|
4435
|
-
for (let
|
|
4436
|
-
let
|
|
4437
|
-
|
|
4451
|
+
let n = r(e, t.key), i = {};
|
|
4452
|
+
for (let r of t.conditionalRules) r.when(n, e, t) && (r.style.background && (i.background = r.style.background), r.style.color && (i.color = r.style.color), r.style.fontWeight && (i["font-weight"] = r.style.fontWeight), r.style.fontStyle && (i["font-style"] = r.style.fontStyle));
|
|
4453
|
+
let a = Object.entries(i).map(([e, t]) => `${e}: ${t}`).join("; ");
|
|
4454
|
+
a && (_ += " " + a + ";");
|
|
4438
4455
|
}
|
|
4439
|
-
if (
|
|
4440
|
-
<div class="ft-cell ft-editing ft-active ${
|
|
4441
|
-
aria-colindex=${
|
|
4442
|
-
data-col-index=${
|
|
4456
|
+
if (l) return s`
|
|
4457
|
+
<div class="ft-cell ft-editing ft-active ${p ? "ft-pinned" : ""}" role="gridcell"
|
|
4458
|
+
aria-colindex=${i + 1}
|
|
4459
|
+
data-col-index=${i}
|
|
4443
4460
|
aria-selected="true"
|
|
4444
|
-
aria-readonly=${
|
|
4445
|
-
style=${
|
|
4461
|
+
aria-readonly=${v ? "true" : c}
|
|
4462
|
+
style=${_}>
|
|
4446
4463
|
${this._renderEditor(e, t)}
|
|
4447
4464
|
</div>
|
|
4448
4465
|
`;
|
|
4449
|
-
let
|
|
4466
|
+
let y = o || u, b = this._isCellInvalid(e, t), x = (this._findState?.results ?? []).findIndex((e) => e.row === n && e.col === i), S = x >= 0, C = S && x === this._findState.currentIndex, w = [
|
|
4450
4467
|
"ft-cell",
|
|
4451
4468
|
`ft-type-${t.type ?? "text"}`,
|
|
4452
|
-
`ft-align-${
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4469
|
+
`ft-align-${K(t)}`,
|
|
4470
|
+
o ? "ft-active" : "",
|
|
4471
|
+
u ? "ft-selected" : "",
|
|
4472
|
+
p ? "ft-pinned" : "",
|
|
4473
|
+
b ? "ft-invalid" : "",
|
|
4474
|
+
C ? "ft-find-current" : S ? "ft-find-match" : "",
|
|
4475
|
+
a ? `ft-merge-${a.headParity}` : "",
|
|
4476
|
+
a?.continues ? "ft-merge-continued" : "",
|
|
4477
|
+
a?.opensDown ? "ft-merge-open" : "",
|
|
4461
4478
|
t.reveal === "hover" ? "ft-reveal-hover" : ""
|
|
4462
|
-
].filter(Boolean).join(" "),
|
|
4463
|
-
return
|
|
4464
|
-
<div class=${
|
|
4479
|
+
].filter(Boolean).join(" "), T = this._comments.size > 0 ? this._comments.get(this.getRowId(e))?.get(t.key) ?? null : null, E = T !== null, ee = E ? s`<div class="ft-comment-indicator" title=${T}></div>` : c;
|
|
4480
|
+
return s`
|
|
4481
|
+
<div class=${E ? w + " ft-has-comment" : w}
|
|
4465
4482
|
role="gridcell"
|
|
4466
4483
|
tabindex="-1"
|
|
4467
|
-
aria-colindex=${
|
|
4468
|
-
data-col-index=${
|
|
4469
|
-
aria-selected=${
|
|
4470
|
-
aria-readonly=${
|
|
4471
|
-
aria-invalid=${
|
|
4472
|
-
title=${
|
|
4473
|
-
style=${
|
|
4474
|
-
@mousedown=${(e) => this._onCellMouseDown(e, n,
|
|
4475
|
-
@mouseenter=${() => this._onCellMouseEnter(n,
|
|
4476
|
-
@click=${(e) => this._onCellClickEvent(e, n,
|
|
4477
|
-
@dblclick=${() => this._onCellDblClick(n,
|
|
4478
|
-
${
|
|
4479
|
-
${
|
|
4484
|
+
aria-colindex=${i + 1}
|
|
4485
|
+
data-col-index=${i}
|
|
4486
|
+
aria-selected=${y ? "true" : "false"}
|
|
4487
|
+
aria-readonly=${v ? "true" : c}
|
|
4488
|
+
aria-invalid=${b ? "true" : c}
|
|
4489
|
+
title=${b ?? c}
|
|
4490
|
+
style=${_}
|
|
4491
|
+
@mousedown=${(e) => this._onCellMouseDown(e, n, i)}
|
|
4492
|
+
@mouseenter=${() => this._onCellMouseEnter(n, i)}
|
|
4493
|
+
@click=${(e) => this._onCellClickEvent(e, n, i)}
|
|
4494
|
+
@dblclick=${() => this._onCellDblClick(n, i)}>
|
|
4495
|
+
${ee}
|
|
4496
|
+
${ie(r(e, t.key), e, t)}
|
|
4480
4497
|
</div>
|
|
4481
4498
|
`;
|
|
4482
4499
|
}
|
|
4483
4500
|
_renderEditor(e, t) {
|
|
4484
|
-
if (t.editor) return t.editor(e
|
|
4485
|
-
let n = e
|
|
4486
|
-
if (t.type === "number") return
|
|
4501
|
+
if (t.editor) return t.editor(r(e, t.key), e, t);
|
|
4502
|
+
let n = r(e, t.key), i = n == null ? "" : String(n);
|
|
4503
|
+
if (t.type === "number") return s`
|
|
4487
4504
|
<input class="ft-editor ft-editor-number" type="text" inputmode="decimal" aria-label=${t.label}
|
|
4488
|
-
.value=${typeof n == "number" ? j(n) :
|
|
4505
|
+
.value=${typeof n == "number" ? j(n) : i}
|
|
4489
4506
|
@keydown=${this._onEditorKeyDown}
|
|
4490
4507
|
@blur=${this._onEditorBlur}>
|
|
4491
4508
|
`;
|
|
4492
4509
|
if (t.type === "date" || t.type === "datetime") {
|
|
4493
4510
|
let e = t.type === "datetime";
|
|
4494
|
-
return
|
|
4511
|
+
return s`
|
|
4495
4512
|
<u-date-picker class="ft-editor ft-editor-${t.type}" size="sm" aria-label=${t.label}
|
|
4496
4513
|
mode=${e ? "datetime" : "date"} ?confirm=${e}
|
|
4497
|
-
.value=${
|
|
4514
|
+
.value=${ft(n, e)}
|
|
4498
4515
|
@keydown=${this._onEditorKeyDown}
|
|
4499
4516
|
@change=${() => this._commitEdit()}
|
|
4500
4517
|
@blur=${this._onEditorBlur}></u-date-picker>
|
|
@@ -4502,30 +4519,30 @@ var K = {
|
|
|
4502
4519
|
}
|
|
4503
4520
|
if (t.type === "select" && t.options && t.options.length > 0) {
|
|
4504
4521
|
let e = t.options, r = typeof e[0] == "string";
|
|
4505
|
-
return
|
|
4522
|
+
return s`
|
|
4506
4523
|
<select class="ft-editor" aria-label=${t.label}
|
|
4507
4524
|
@keydown=${this._onEditorKeyDown}
|
|
4508
4525
|
@blur=${this._onEditorBlur}
|
|
4509
4526
|
@change=${() => this._commitEdit()}>
|
|
4510
|
-
${r ? e.map((e) =>
|
|
4527
|
+
${r ? e.map((e) => s`<option value=${e} ?selected=${e === n}>${e}</option>`) : e.map((e) => s`<option value=${String(e.value)} ?selected=${e.value === n}>${e.label}</option>`)}
|
|
4511
4528
|
</select>
|
|
4512
4529
|
`;
|
|
4513
4530
|
}
|
|
4514
4531
|
if (t.autocomplete) {
|
|
4515
4532
|
let e = this._autocompleteState?.candidates ?? [], n = this._autocompleteState?.activeIndex ?? -1;
|
|
4516
|
-
return
|
|
4533
|
+
return s`
|
|
4517
4534
|
<input class="ft-editor" type="text" aria-label=${t.label}
|
|
4518
4535
|
role="combobox" aria-autocomplete="list"
|
|
4519
4536
|
aria-expanded=${e.length > 0 ? "true" : "false"}
|
|
4520
4537
|
aria-controls="ft-autocomplete-list"
|
|
4521
|
-
aria-activedescendant=${n >= 0 && e.length > 0 ? `ft-autocomplete-${n}` :
|
|
4522
|
-
.value=${
|
|
4538
|
+
aria-activedescendant=${n >= 0 && e.length > 0 ? `ft-autocomplete-${n}` : c}
|
|
4539
|
+
.value=${i}
|
|
4523
4540
|
@input=${(e) => this._onAutocompleteInput(e, t)}
|
|
4524
4541
|
@keydown=${this._onEditorKeyDown}
|
|
4525
4542
|
@blur=${this._onEditorBlur}>
|
|
4526
|
-
${e.length > 0 ?
|
|
4543
|
+
${e.length > 0 ? s`
|
|
4527
4544
|
<div class="ft-autocomplete-dropdown" id="ft-autocomplete-list" role="listbox" aria-label=${t.label}>
|
|
4528
|
-
${e.map((e, t) =>
|
|
4545
|
+
${e.map((e, t) => s`
|
|
4529
4546
|
<div class="ft-autocomplete-item ${t === n ? "ft-autocomplete-active" : ""}"
|
|
4530
4547
|
id=${`ft-autocomplete-${t}`} role="option" aria-selected=${t === n ? "true" : "false"}
|
|
4531
4548
|
@mousedown=${(t) => {
|
|
@@ -4535,78 +4552,78 @@ var K = {
|
|
|
4535
4552
|
</div>
|
|
4536
4553
|
`)}
|
|
4537
4554
|
</div>
|
|
4538
|
-
` :
|
|
4555
|
+
` : c}
|
|
4539
4556
|
`;
|
|
4540
4557
|
}
|
|
4541
|
-
return
|
|
4558
|
+
return s`
|
|
4542
4559
|
<input class="ft-editor" type="text" aria-label=${t.label}
|
|
4543
|
-
.value=${
|
|
4560
|
+
.value=${i}
|
|
4544
4561
|
@keydown=${this._onEditorKeyDown}
|
|
4545
4562
|
@blur=${this._onEditorBlur}>
|
|
4546
4563
|
`;
|
|
4547
4564
|
}
|
|
4548
4565
|
};
|
|
4549
|
-
|
|
4566
|
+
q([u({ type: Array })], Q.prototype, "columns", void 0), q([u({
|
|
4550
4567
|
type: Array,
|
|
4551
4568
|
hasChanged: () => !0
|
|
4552
|
-
})], Q.prototype, "data", null),
|
|
4569
|
+
})], Q.prototype, "data", null), q([u({
|
|
4553
4570
|
type: Boolean,
|
|
4554
4571
|
attribute: "clear-undo-on-data-change"
|
|
4555
|
-
})], Q.prototype, "clearUndoOnDataChange", void 0),
|
|
4572
|
+
})], Q.prototype, "clearUndoOnDataChange", void 0), q([u({
|
|
4556
4573
|
type: Boolean,
|
|
4557
4574
|
attribute: "clear-selection-on-data-change"
|
|
4558
|
-
})], Q.prototype, "clearSelectionOnDataChange", void 0),
|
|
4575
|
+
})], Q.prototype, "clearSelectionOnDataChange", void 0), q([u({ attribute: "row-key" })], Q.prototype, "rowKey", void 0), q([u({
|
|
4559
4576
|
type: Number,
|
|
4560
4577
|
attribute: "row-height"
|
|
4561
|
-
})], Q.prototype, "rowHeight", null),
|
|
4578
|
+
})], Q.prototype, "rowHeight", null), q([u({
|
|
4562
4579
|
type: Boolean,
|
|
4563
4580
|
attribute: "show-row-numbers"
|
|
4564
|
-
})], Q.prototype, "showRowNumbers", void 0),
|
|
4581
|
+
})], Q.prototype, "showRowNumbers", void 0), q([u({
|
|
4565
4582
|
type: String,
|
|
4566
4583
|
reflect: !0
|
|
4567
|
-
})], Q.prototype, "theme", void 0),
|
|
4584
|
+
})], Q.prototype, "theme", void 0), q([u({
|
|
4568
4585
|
type: Number,
|
|
4569
4586
|
attribute: "max-rows"
|
|
4570
|
-
})], Q.prototype, "maxRows", void 0),
|
|
4587
|
+
})], Q.prototype, "maxRows", void 0), q([u({ type: Boolean })], Q.prototype, "editable", void 0), q([u({
|
|
4571
4588
|
type: Boolean,
|
|
4572
4589
|
attribute: "show-filters"
|
|
4573
|
-
})], Q.prototype, "showFilters", void 0),
|
|
4590
|
+
})], Q.prototype, "showFilters", void 0), q([u({
|
|
4574
4591
|
type: Boolean,
|
|
4575
4592
|
attribute: "show-context-menu"
|
|
4576
|
-
})], Q.prototype, "showContextMenu", void 0),
|
|
4593
|
+
})], Q.prototype, "showContextMenu", void 0), q([u({
|
|
4577
4594
|
type: Number,
|
|
4578
4595
|
attribute: "frozen-rows"
|
|
4579
|
-
})], Q.prototype, "frozenRows", void 0),
|
|
4596
|
+
})], Q.prototype, "frozenRows", void 0), q([u({
|
|
4580
4597
|
type: String,
|
|
4581
4598
|
attribute: "empty-message"
|
|
4582
|
-
})], Q.prototype, "emptyMessage", void 0),
|
|
4599
|
+
})], Q.prototype, "emptyMessage", void 0), q([u({
|
|
4583
4600
|
type: String,
|
|
4584
4601
|
attribute: "no-matching-message"
|
|
4585
|
-
})], Q.prototype, "noMatchingMessage", void 0),
|
|
4602
|
+
})], Q.prototype, "noMatchingMessage", void 0), q([u({ attribute: !1 })], Q.prototype, "error", void 0), q([u({
|
|
4586
4603
|
type: Boolean,
|
|
4587
4604
|
reflect: !0
|
|
4588
|
-
})], Q.prototype, "loading", void 0),
|
|
4605
|
+
})], Q.prototype, "loading", void 0), q([u({
|
|
4589
4606
|
type: Boolean,
|
|
4590
4607
|
attribute: "import-enabled"
|
|
4591
|
-
})], Q.prototype, "importEnabled", void 0),
|
|
4608
|
+
})], Q.prototype, "importEnabled", void 0), q([u({ type: Boolean })], Q.prototype, "selectable", void 0), q([u({
|
|
4592
4609
|
type: String,
|
|
4593
4610
|
attribute: "selection-mode"
|
|
4594
|
-
})], Q.prototype, "selectionMode", null),
|
|
4611
|
+
})], Q.prototype, "selectionMode", null), q([u({
|
|
4595
4612
|
type: String,
|
|
4596
4613
|
attribute: "data-mode"
|
|
4597
|
-
})], Q.prototype, "dataMode", void 0),
|
|
4614
|
+
})], Q.prototype, "dataMode", void 0), q([u({
|
|
4598
4615
|
type: Object,
|
|
4599
4616
|
attribute: "footer-data"
|
|
4600
|
-
})], Q.prototype, "footerData", void 0),
|
|
4617
|
+
})], Q.prototype, "footerData", void 0), q([u({ attribute: !1 })], Q.prototype, "stylesheets", void 0), q([u({
|
|
4601
4618
|
type: Number,
|
|
4602
4619
|
attribute: "max-undo-size"
|
|
4603
|
-
})], Q.prototype, "maxUndoSize", null),
|
|
4604
|
-
function
|
|
4620
|
+
})], Q.prototype, "maxUndoSize", null), q([d()], Q.prototype, "_scrollTop", void 0), q([d()], Q.prototype, "_scrollLeft", void 0), q([d()], Q.prototype, "_viewportHeight", void 0), q([d()], Q.prototype, "_viewportWidth", void 0), q([d()], Q.prototype, "_activeCell", void 0), q([d()], Q.prototype, "_headerCol", void 0), q([d()], Q.prototype, "_editingCell", void 0), q([d()], Q.prototype, "_sortCriteria", void 0), q([d()], Q.prototype, "_openFilterKey", void 0), q([d()], Q.prototype, "_rowSelectionVersion", void 0), q([d()], Q.prototype, "_autocompleteState", void 0), q([d()], Q.prototype, "_headerMenu", void 0), q([d()], Q.prototype, "_bodyContextMenu", void 0), q([d()], Q.prototype, "_commentPopup", void 0), q([d()], Q.prototype, "_isDragOver", void 0), Q = q([l("flex-table")], Q);
|
|
4621
|
+
function ft(e, t) {
|
|
4605
4622
|
if (t) {
|
|
4606
|
-
let t =
|
|
4623
|
+
let t = ye(e);
|
|
4607
4624
|
return /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(t) ? t.replace(" ", "T") : void 0;
|
|
4608
4625
|
}
|
|
4609
|
-
let n =
|
|
4626
|
+
let n = ve(e);
|
|
4610
4627
|
return /^\d{4}-\d{2}-\d{2}$/.test(n) ? n : void 0;
|
|
4611
4628
|
}
|
|
4612
4629
|
function $(e) {
|
|
@@ -4617,4 +4634,4 @@ function $(e) {
|
|
|
4617
4634
|
}
|
|
4618
4635
|
}
|
|
4619
4636
|
//#endregion
|
|
4620
|
-
export {
|
|
4637
|
+
export { V as a, ie as c, B as i, K as n, O as o, W as r, D as s, Q as t };
|