@iyulab/flex-table 0.64.0 → 0.64.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +3 -1
- package/dist/clipboard/clipboard.d.ts +2 -1
- package/dist/export/values.d.ts +6 -0
- package/dist/{flex-table-BufHlQ2v.js → flex-table-CYi9B4h_.js} +220 -213
- package/dist/flex-table.js +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/skills/iyulab-flex-table/references/api.md +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.64.1] - 2026-10-08
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **CSV/TSV write dates as the wall clock the table shows.** A `date`/`datetime` column's value — a `Date`, or an ISO
|
|
8
|
+
string as JSON sources (OData) send it — was written raw or as `toISOString()`: UTC, so outside UTC the time in the
|
|
9
|
+
file differed from the screen (9 hours in Korea), a local-midnight `Date` in a `date` column became the day before,
|
|
10
|
+
and Excel did not read `…T…Z` as a date. It is now `YYYY-MM-DD` in a `date` column and `YYYY-MM-DD HH:mm:ss`
|
|
11
|
+
otherwise — the value an XLSX export already puts in its date cell. A string that does not read as a date stays as
|
|
12
|
+
it is; JSON is unchanged.
|
|
13
|
+
- **A copied range writes dates the same way** — not the UTC string or `Date#toString()` — so it pastes into a
|
|
14
|
+
spreadsheet as a date and back into the table as the same local time.
|
|
15
|
+
|
|
3
16
|
## [0.64.0] - 2026-10-08
|
|
4
17
|
|
|
5
18
|
### Added
|
package/README.md
CHANGED
|
@@ -316,7 +316,9 @@ What goes into the file:
|
|
|
316
316
|
status code shown as a label: `{ key: 'status', render: …, exportValue: (v) => statusLabel(v) }`.
|
|
317
317
|
- **Dates**: in XLSX a `date`/`datetime` column is a date cell — a `Date`, or an ISO string as JSON sources (OData) send
|
|
318
318
|
it (`YYYY-MM-DD` is that day; a full ISO string is read with its offset), the same rule the cells display with. The
|
|
319
|
-
cell holds the wall-clock time the table shows.
|
|
319
|
+
cell holds the wall-clock time the table shows. In CSV/TSV (and a copied range) the same date is wall-clock text —
|
|
320
|
+
`YYYY-MM-DD` in a `date` column, `YYYY-MM-DD HH:mm:ss` otherwise — which spreadsheets read as a date. JSON keeps
|
|
321
|
+
`Date` values as ISO instants. A string that does not read as a date stays text.
|
|
320
322
|
- **BOM**: `{ bom: true }` starts CSV/TSV with a UTF-8 byte order mark so Excel on a non-UTF-8 system code page reads
|
|
321
323
|
non-ASCII text correctly — the default for `exportToFile`, off for `exportToString`/`exportToBlob`.
|
|
322
324
|
|
|
@@ -2,7 +2,8 @@ import type { CellRange } from '../core/selection.js';
|
|
|
2
2
|
import type { ColumnDefinition, DataRow } from '../models/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Copy selected range to clipboard as TSV — the spreadsheet clipboard format (see `encodeTsv`):
|
|
5
|
-
* a cell containing a tab, a line break or a quote is quoted, so it pastes into Excel as one cell.
|
|
5
|
+
* a cell containing a tab, a line break or a quote is quoted, so it pastes into Excel as one cell. A date is its
|
|
6
|
+
* wall-clock text (as in a CSV export), which a spreadsheet reads as a date and a paste here reads back.
|
|
6
7
|
*/
|
|
7
8
|
export declare function copyToClipboard(data: DataRow[], columns: ColumnDefinition[], range: CellRange): string;
|
|
8
9
|
export declare function parseValueForColumn(raw: string, col: ColumnDefinition): unknown;
|
package/dist/export/values.d.ts
CHANGED
|
@@ -15,3 +15,9 @@ export declare function exportDate(value: unknown, col: ColumnDefinition): Date
|
|
|
15
15
|
* 세면 로컬 자정의 날짜가 UTC 와 다른 시간대(한국 +09)에서 전날 오후로 들어가 날짜 서식에 전날이 보였다.
|
|
16
16
|
*/
|
|
17
17
|
export declare function excelSerial(d: Date): number;
|
|
18
|
+
/**
|
|
19
|
+
* 글자 형식(CSV·TSV)의 날짜 — **벽시계 글자**다(표가 보여 주는 로컬 날짜·시각, XLSX 의 날짜 셀과 같은 값). `date` 열은
|
|
20
|
+
* `YYYY-MM-DD`, 그 밖은 `YYYY-MM-DD HH:mm:ss` — 스프레드시트가 날짜로 읽는 모양이다. ISO(`toISOString`)는 UTC 라 UTC 가
|
|
21
|
+
* 아닌 시간대에서 시각이 화면과 달랐고, 로컬 자정의 날짜는 전날이 됐다.
|
|
22
|
+
*/
|
|
23
|
+
export declare function exportDateText(d: Date, col: ColumnDefinition): string;
|
|
@@ -1034,13 +1034,13 @@ var E = o`
|
|
|
1034
1034
|
`;
|
|
1035
1035
|
//#endregion
|
|
1036
1036
|
//#region src/renderers/format.ts
|
|
1037
|
-
function
|
|
1038
|
-
return e == null ? "" : typeof t == "function" ? t(e) :
|
|
1037
|
+
function D(e, t) {
|
|
1038
|
+
return e == null ? "" : typeof t == "function" ? t(e) : ee(t) ? ne(e, t) : te(e, t);
|
|
1039
1039
|
}
|
|
1040
|
-
function
|
|
1040
|
+
function ee(e) {
|
|
1041
1041
|
return /[yMdHhms]/.test(e);
|
|
1042
1042
|
}
|
|
1043
|
-
function
|
|
1043
|
+
function te(e, t) {
|
|
1044
1044
|
let n = typeof e == "number" ? e : Number(e);
|
|
1045
1045
|
if (isNaN(n)) return String(e);
|
|
1046
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 = {
|
|
@@ -1053,7 +1053,7 @@ function ne(e, t) {
|
|
|
1053
1053
|
style: "percent"
|
|
1054
1054
|
}).format(n) : (u = new Intl.NumberFormat(f.get(), l).format(n), a && (u = a + u)), u + "";
|
|
1055
1055
|
}
|
|
1056
|
-
function
|
|
1056
|
+
function ne(e, t) {
|
|
1057
1057
|
let n;
|
|
1058
1058
|
if (e instanceof Date) n = e;
|
|
1059
1059
|
else if (typeof e == "string" || typeof e == "number") n = new Date(e);
|
|
@@ -1064,26 +1064,26 @@ function re(e, t) {
|
|
|
1064
1064
|
}
|
|
1065
1065
|
//#endregion
|
|
1066
1066
|
//#region src/renderers/cell-renderer.ts
|
|
1067
|
-
function
|
|
1068
|
-
return n.render ? n.render(e, t, n) : n.format ? typeof n.format == "function" ? n.format(e, t, n) :
|
|
1067
|
+
function O(e, t, n) {
|
|
1068
|
+
return n.render ? n.render(e, t, n) : n.format ? typeof n.format == "function" ? n.format(e, t, n) : D(e, n.format) : re(e, n);
|
|
1069
1069
|
}
|
|
1070
|
-
function
|
|
1070
|
+
function re(e, t) {
|
|
1071
1071
|
if (e == null) return "";
|
|
1072
1072
|
switch (t.type) {
|
|
1073
|
-
case "number": return
|
|
1073
|
+
case "number": return oe(e);
|
|
1074
1074
|
case "boolean": return s`<span class="ft-bool">${e ? "✔" : ""}</span>`;
|
|
1075
|
-
case "date": return
|
|
1076
|
-
case "datetime": return
|
|
1077
|
-
case "select": return
|
|
1075
|
+
case "date": return se(e);
|
|
1076
|
+
case "datetime": return ce(e);
|
|
1077
|
+
case "select": return ie(e, t);
|
|
1078
1078
|
default: return String(e);
|
|
1079
1079
|
}
|
|
1080
1080
|
}
|
|
1081
|
-
function
|
|
1081
|
+
function ie(e, t) {
|
|
1082
1082
|
if (!t.options || t.options.length === 0 || typeof t.options[0] == "string") return e == null ? "" : String(e);
|
|
1083
1083
|
let n = t.options.find((t) => t.value === e);
|
|
1084
1084
|
return n ? n.label : e == null ? "" : String(e);
|
|
1085
1085
|
}
|
|
1086
|
-
var
|
|
1086
|
+
var ae = {
|
|
1087
1087
|
year: "numeric",
|
|
1088
1088
|
month: "numeric",
|
|
1089
1089
|
day: "numeric",
|
|
@@ -1091,18 +1091,18 @@ var se = {
|
|
|
1091
1091
|
minute: "numeric",
|
|
1092
1092
|
second: "numeric"
|
|
1093
1093
|
};
|
|
1094
|
-
function
|
|
1094
|
+
function oe(e) {
|
|
1095
1095
|
return typeof e == "number" ? Number.isInteger(e) ? m(e) : m(e, { minimumFractionDigits: 1 }) : String(e);
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1097
|
+
function se(e) {
|
|
1098
1098
|
return e instanceof Date || typeof e == "string" ? p(e) : String(e);
|
|
1099
1099
|
}
|
|
1100
|
-
function
|
|
1101
|
-
return e instanceof Date || typeof e == "string" ? p(e,
|
|
1100
|
+
function ce(e) {
|
|
1101
|
+
return e instanceof Date || typeof e == "string" ? p(e, ae) : String(e);
|
|
1102
1102
|
}
|
|
1103
1103
|
//#endregion
|
|
1104
1104
|
//#region src/core/selection.ts
|
|
1105
|
-
function
|
|
1105
|
+
function le(e) {
|
|
1106
1106
|
return {
|
|
1107
1107
|
startRow: Math.min(e.startRow, e.endRow),
|
|
1108
1108
|
startCol: Math.min(e.startCol, e.endCol),
|
|
@@ -1110,7 +1110,7 @@ function de(e) {
|
|
|
1110
1110
|
endCol: Math.max(e.startCol, e.endCol)
|
|
1111
1111
|
};
|
|
1112
1112
|
}
|
|
1113
|
-
var
|
|
1113
|
+
var ue = class {
|
|
1114
1114
|
constructor() {
|
|
1115
1115
|
this.activeCell = null, this.rangeAnchor = null, this.range = null, this.extraRanges = [], this._rowCount = 0, this._colCount = 0;
|
|
1116
1116
|
}
|
|
@@ -1137,7 +1137,7 @@ var fe = class {
|
|
|
1137
1137
|
return e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount || (!this.rangeAnchor && this.activeCell && (this.rangeAnchor = { ...this.activeCell }), this.activeCell = {
|
|
1138
1138
|
row: e,
|
|
1139
1139
|
col: t
|
|
1140
|
-
}, this.rangeAnchor && (this.range =
|
|
1140
|
+
}, this.rangeAnchor && (this.range = le({
|
|
1141
1141
|
startRow: this.rangeAnchor.row,
|
|
1142
1142
|
startCol: this.rangeAnchor.col,
|
|
1143
1143
|
endRow: e,
|
|
@@ -1208,7 +1208,7 @@ var fe = class {
|
|
|
1208
1208
|
shiftMoveRight() {
|
|
1209
1209
|
return this.activeCell ? this.setActiveWithRange(this.activeCell.row, this.activeCell.col + 1) : null;
|
|
1210
1210
|
}
|
|
1211
|
-
},
|
|
1211
|
+
}, de = class {
|
|
1212
1212
|
constructor() {
|
|
1213
1213
|
this.current = null;
|
|
1214
1214
|
}
|
|
@@ -1230,7 +1230,7 @@ var fe = class {
|
|
|
1230
1230
|
let e = this.current;
|
|
1231
1231
|
return this.current = null, e;
|
|
1232
1232
|
}
|
|
1233
|
-
},
|
|
1233
|
+
}, fe = class {
|
|
1234
1234
|
constructor() {
|
|
1235
1235
|
this._selected = /* @__PURE__ */ new Set(), this._mode = "multi";
|
|
1236
1236
|
}
|
|
@@ -1294,7 +1294,7 @@ var fe = class {
|
|
|
1294
1294
|
};
|
|
1295
1295
|
//#endregion
|
|
1296
1296
|
//#region src/core/filtering.ts
|
|
1297
|
-
function
|
|
1297
|
+
function pe(e, t, n) {
|
|
1298
1298
|
if (t.length === 0) return Array.from({ length: e.length }, (e, t) => t);
|
|
1299
1299
|
let i = [];
|
|
1300
1300
|
for (let a = 0; a < e.length; a++) {
|
|
@@ -1313,9 +1313,9 @@ function me(e, t, n) {
|
|
|
1313
1313
|
}
|
|
1314
1314
|
//#endregion
|
|
1315
1315
|
//#region src/core/undo.ts
|
|
1316
|
-
var
|
|
1316
|
+
var me = 100, k = class {
|
|
1317
1317
|
constructor() {
|
|
1318
|
-
this._undoStack = [], this._redoStack = [], this._maxSize =
|
|
1318
|
+
this._undoStack = [], this._redoStack = [], this._maxSize = me;
|
|
1319
1319
|
}
|
|
1320
1320
|
get maxSize() {
|
|
1321
1321
|
return this._maxSize;
|
|
@@ -1351,23 +1351,43 @@ var he = 100, O = class {
|
|
|
1351
1351
|
}
|
|
1352
1352
|
};
|
|
1353
1353
|
//#endregion
|
|
1354
|
+
//#region src/export/values.ts
|
|
1355
|
+
function A(e, t) {
|
|
1356
|
+
let n = r(e, t.key);
|
|
1357
|
+
return t.exportValue ? t.exportValue(n, e) : n;
|
|
1358
|
+
}
|
|
1359
|
+
function j(e, t) {
|
|
1360
|
+
if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : e;
|
|
1361
|
+
if (typeof e != "string" || t.type !== "date" && t.type !== "datetime") return null;
|
|
1362
|
+
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);
|
|
1363
|
+
return Number.isNaN(r.getTime()) ? null : r;
|
|
1364
|
+
}
|
|
1365
|
+
function he(e) {
|
|
1366
|
+
return (Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()) - Date.UTC(1899, 11, 30)) / 864e5;
|
|
1367
|
+
}
|
|
1368
|
+
var M = (e, t = 2) => String(e).padStart(t, "0");
|
|
1369
|
+
function N(e, t) {
|
|
1370
|
+
let n = `${M(e.getFullYear(), 4)}-${M(e.getMonth() + 1)}-${M(e.getDate())}`;
|
|
1371
|
+
return t.type === "date" ? n : `${n} ${M(e.getHours())}:${M(e.getMinutes())}:${M(e.getSeconds())}`;
|
|
1372
|
+
}
|
|
1373
|
+
//#endregion
|
|
1354
1374
|
//#region src/clipboard/clipboard.ts
|
|
1355
1375
|
function ge(e, t, n) {
|
|
1356
1376
|
let i = [];
|
|
1357
1377
|
for (let a = n.startRow; a <= n.endRow; a++) {
|
|
1358
1378
|
let o = e[a], s = [];
|
|
1359
1379
|
for (let e = n.startCol; e <= n.endCol; e++) {
|
|
1360
|
-
let n = t[e], i = r(o, n.key);
|
|
1361
|
-
s.push(i == null ? "" : String(i));
|
|
1380
|
+
let n = t[e], i = r(o, n.key), a = i == null ? null : j(i, n);
|
|
1381
|
+
s.push(i == null ? "" : a ? N(a, n) : String(i));
|
|
1362
1382
|
}
|
|
1363
1383
|
i.push(s);
|
|
1364
1384
|
}
|
|
1365
1385
|
return b(i);
|
|
1366
1386
|
}
|
|
1367
|
-
function
|
|
1368
|
-
return
|
|
1387
|
+
function P(e, t) {
|
|
1388
|
+
return F(e, t).value;
|
|
1369
1389
|
}
|
|
1370
|
-
function
|
|
1390
|
+
function F(e, t) {
|
|
1371
1391
|
if (e === "") return {
|
|
1372
1392
|
value: null,
|
|
1373
1393
|
failed: !1
|
|
@@ -1421,7 +1441,7 @@ function _e(t) {
|
|
|
1421
1441
|
].map((e) => e.trim().toLowerCase()).filter(Boolean));
|
|
1422
1442
|
return r("booleanTrueWords", "booleanTrue", ["true", "1"]).has(n) ? !0 : !r("booleanFalseWords", "booleanFalse", ["false", "0"]).has(n) && null;
|
|
1423
1443
|
}
|
|
1424
|
-
function
|
|
1444
|
+
function I(e) {
|
|
1425
1445
|
let t = String(e);
|
|
1426
1446
|
if (!Number.isFinite(e) || t.includes("e")) return t;
|
|
1427
1447
|
let n = new Intl.NumberFormat(f.get()).formatToParts(1.5).find((e) => e.type === "decimal")?.value;
|
|
@@ -1443,23 +1463,8 @@ function ye(e) {
|
|
|
1443
1463
|
return `${r.getFullYear()}-${i(r.getMonth() + 1)}-${i(r.getDate())} ${i(r.getHours())}:${i(r.getMinutes())}`;
|
|
1444
1464
|
}
|
|
1445
1465
|
//#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
|
|
1461
1466
|
//#region src/export/xlsx-writer.ts
|
|
1462
|
-
var
|
|
1467
|
+
var be = (() => {
|
|
1463
1468
|
let e = /* @__PURE__ */ new Uint32Array(256);
|
|
1464
1469
|
for (let t = 0; t < 256; t++) {
|
|
1465
1470
|
let n = t;
|
|
@@ -1468,23 +1473,23 @@ var xe = (() => {
|
|
|
1468
1473
|
}
|
|
1469
1474
|
return e;
|
|
1470
1475
|
})();
|
|
1471
|
-
function
|
|
1476
|
+
function xe(e) {
|
|
1472
1477
|
let t = 4294967295;
|
|
1473
|
-
for (let n = 0; n < e.length; n++) t =
|
|
1478
|
+
for (let n = 0; n < e.length; n++) t = be[(t ^ e[n]) & 255] ^ t >>> 8;
|
|
1474
1479
|
return (t ^ 4294967295) >>> 0;
|
|
1475
1480
|
}
|
|
1476
|
-
var
|
|
1477
|
-
function
|
|
1478
|
-
return
|
|
1481
|
+
var L = new TextEncoder();
|
|
1482
|
+
function Se(e) {
|
|
1483
|
+
return R(e.map((e) => ({
|
|
1479
1484
|
...e,
|
|
1480
1485
|
body: e.data,
|
|
1481
1486
|
method: 0
|
|
1482
1487
|
})));
|
|
1483
1488
|
}
|
|
1484
|
-
async function
|
|
1489
|
+
async function Ce(e) {
|
|
1485
1490
|
let t = [];
|
|
1486
1491
|
for (let n of e) {
|
|
1487
|
-
let e = await
|
|
1492
|
+
let e = await we(n.data);
|
|
1488
1493
|
t.push(e.length < n.data.length ? {
|
|
1489
1494
|
...n,
|
|
1490
1495
|
body: e,
|
|
@@ -1495,9 +1500,9 @@ async function we(e) {
|
|
|
1495
1500
|
method: 0
|
|
1496
1501
|
});
|
|
1497
1502
|
}
|
|
1498
|
-
return
|
|
1503
|
+
return R(t);
|
|
1499
1504
|
}
|
|
1500
|
-
async function
|
|
1505
|
+
async function we(e) {
|
|
1501
1506
|
let t = new CompressionStream("deflate-raw"), n = t.writable.getWriter(), r = t.readable.getReader();
|
|
1502
1507
|
n.write(e), n.close();
|
|
1503
1508
|
let i = [];
|
|
@@ -1506,50 +1511,50 @@ async function Te(e) {
|
|
|
1506
1511
|
if (e) break;
|
|
1507
1512
|
i.push(t);
|
|
1508
1513
|
}
|
|
1509
|
-
return
|
|
1514
|
+
return z(i);
|
|
1510
1515
|
}
|
|
1511
|
-
function
|
|
1516
|
+
function R(e) {
|
|
1512
1517
|
let t = [], n = [], r = 0;
|
|
1513
1518
|
for (let i of e) {
|
|
1514
|
-
let e =
|
|
1519
|
+
let e = L.encode(i.name), a = xe(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);
|
|
1515
1520
|
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);
|
|
1516
1521
|
let d = new ArrayBuffer(46 + e.length), f = new DataView(d);
|
|
1517
1522
|
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;
|
|
1518
1523
|
}
|
|
1519
|
-
let i =
|
|
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),
|
|
1524
|
+
let i = z(n), a = /* @__PURE__ */ new ArrayBuffer(22), o = new DataView(a);
|
|
1525
|
+
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), z([
|
|
1521
1526
|
...t,
|
|
1522
1527
|
i,
|
|
1523
1528
|
new Uint8Array(a)
|
|
1524
1529
|
]);
|
|
1525
1530
|
}
|
|
1526
|
-
function
|
|
1531
|
+
function z(e) {
|
|
1527
1532
|
let t = e.reduce((e, t) => e + t.length, 0), n = new Uint8Array(t), r = 0;
|
|
1528
1533
|
for (let t of e) n.set(t, r), r += t.length;
|
|
1529
1534
|
return n;
|
|
1530
1535
|
}
|
|
1531
|
-
function
|
|
1536
|
+
function B(e) {
|
|
1532
1537
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1533
1538
|
}
|
|
1534
|
-
function
|
|
1539
|
+
function Te(e) {
|
|
1535
1540
|
let t = "";
|
|
1536
1541
|
for (e++; e > 0;) t = String.fromCharCode(64 + (e % 26 || 26)) + t, e = Math.floor((e - 1) / 26);
|
|
1537
1542
|
return t;
|
|
1538
1543
|
}
|
|
1539
|
-
function
|
|
1540
|
-
return
|
|
1544
|
+
function V(e, t) {
|
|
1545
|
+
return Te(t) + (e + 1);
|
|
1541
1546
|
}
|
|
1542
|
-
var
|
|
1543
|
-
function
|
|
1544
|
-
let n = [], r = t.map((e, t) => `<c r="${
|
|
1547
|
+
var Ee = "<?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>", De = "<?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>", Oe = "<?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>", ke = "<?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>", Ae = "<?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>";
|
|
1548
|
+
function je(e, t) {
|
|
1549
|
+
let n = [], r = t.map((e, t) => `<c r="${V(0, t)}" t="str" s="2"><v>${B(e.label)}</v></c>`);
|
|
1545
1550
|
return n.push(`<row r="1">${r.join("")}</row>`), e.forEach((e, r) => {
|
|
1546
1551
|
let i = t.map((t, n) => {
|
|
1547
|
-
let i =
|
|
1552
|
+
let i = V(r + 1, n), a = A(e, t);
|
|
1548
1553
|
if (a == null) return `<c r="${i}" t="str"><v></v></c>`;
|
|
1549
1554
|
let o = t.type ?? "text";
|
|
1550
1555
|
if (o === "number" && typeof a == "number") return `<c r="${i}"><v>${a}</v></c>`;
|
|
1551
|
-
let s =
|
|
1552
|
-
return s ? `<c r="${i}" s="1"><v>${
|
|
1556
|
+
let s = j(a, t);
|
|
1557
|
+
return s ? `<c r="${i}" s="1"><v>${he(s).toFixed(6)}</v></c>` : o === "boolean" ? `<c r="${i}" t="b"><v>${+!!a}</v></c>` : `<c r="${i}" t="str"><v>${B(String(a))}</v></c>`;
|
|
1553
1558
|
});
|
|
1554
1559
|
n.push(`<row r="${r + 2}">${i.join("")}</row>`);
|
|
1555
1560
|
}), `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -1557,106 +1562,108 @@ function Me(e, t) {
|
|
|
1557
1562
|
<sheetData>${n.join("")}</sheetData>
|
|
1558
1563
|
</worksheet>`;
|
|
1559
1564
|
}
|
|
1560
|
-
function
|
|
1561
|
-
return
|
|
1565
|
+
function Me(e, t) {
|
|
1566
|
+
return Se(H(e, t));
|
|
1562
1567
|
}
|
|
1563
|
-
function
|
|
1564
|
-
return
|
|
1568
|
+
function Ne(e, t) {
|
|
1569
|
+
return Ce(H(e, t));
|
|
1565
1570
|
}
|
|
1566
|
-
function
|
|
1567
|
-
let n =
|
|
1571
|
+
function H(e, t) {
|
|
1572
|
+
let n = je(e, t);
|
|
1568
1573
|
return [
|
|
1569
1574
|
{
|
|
1570
1575
|
name: "[Content_Types].xml",
|
|
1571
|
-
data:
|
|
1576
|
+
data: L.encode(Ee)
|
|
1572
1577
|
},
|
|
1573
1578
|
{
|
|
1574
1579
|
name: "_rels/.rels",
|
|
1575
|
-
data:
|
|
1580
|
+
data: L.encode(De)
|
|
1576
1581
|
},
|
|
1577
1582
|
{
|
|
1578
1583
|
name: "xl/workbook.xml",
|
|
1579
|
-
data:
|
|
1584
|
+
data: L.encode(Oe)
|
|
1580
1585
|
},
|
|
1581
1586
|
{
|
|
1582
1587
|
name: "xl/_rels/workbook.xml.rels",
|
|
1583
|
-
data:
|
|
1588
|
+
data: L.encode(ke)
|
|
1584
1589
|
},
|
|
1585
1590
|
{
|
|
1586
1591
|
name: "xl/worksheets/sheet1.xml",
|
|
1587
|
-
data:
|
|
1592
|
+
data: L.encode(n)
|
|
1588
1593
|
},
|
|
1589
1594
|
{
|
|
1590
1595
|
name: "xl/styles.xml",
|
|
1591
|
-
data:
|
|
1596
|
+
data: L.encode(Ae)
|
|
1592
1597
|
}
|
|
1593
1598
|
];
|
|
1594
1599
|
}
|
|
1595
1600
|
//#endregion
|
|
1596
1601
|
//#region src/export/export.ts
|
|
1597
|
-
var
|
|
1598
|
-
function
|
|
1599
|
-
let i = r.bom ?
|
|
1602
|
+
var Pe = "";
|
|
1603
|
+
function U(e, t, n, r = {}) {
|
|
1604
|
+
let i = r.bom ? Pe : "";
|
|
1600
1605
|
switch (n) {
|
|
1601
|
-
case "csv": return i +
|
|
1602
|
-
case "tsv": return i +
|
|
1606
|
+
case "csv": return i + G(e, t, ",");
|
|
1607
|
+
case "tsv": return i + G(e, t, " ");
|
|
1603
1608
|
case "json": return Le(e, t);
|
|
1604
|
-
case "xlsx": return
|
|
1609
|
+
case "xlsx": return Me(e, t);
|
|
1605
1610
|
}
|
|
1606
1611
|
}
|
|
1607
|
-
async function
|
|
1608
|
-
let i = n === "xlsx" ? await
|
|
1609
|
-
return new Blob([i], { type:
|
|
1612
|
+
async function W(e, t, n, r = {}) {
|
|
1613
|
+
let i = n === "xlsx" ? await Ne(e, t) : U(e, t, n, r);
|
|
1614
|
+
return new Blob([i], { type: Ve(n) });
|
|
1610
1615
|
}
|
|
1611
|
-
function
|
|
1612
|
-
|
|
1616
|
+
function Fe(e, t) {
|
|
1617
|
+
if (e == null) return "";
|
|
1618
|
+
let n = j(e, t);
|
|
1619
|
+
return n ? N(n, t) : String(e);
|
|
1613
1620
|
}
|
|
1614
|
-
function
|
|
1615
|
-
return [t.map((e) =>
|
|
1621
|
+
function G(e, t, n) {
|
|
1622
|
+
return [t.map((e) => Ie(e.label, n)).join(n), ...e.map((e) => t.map((t) => Ie(Fe(A(e, t), t), n)).join(n))].join("\n");
|
|
1616
1623
|
}
|
|
1617
|
-
function
|
|
1624
|
+
function Ie(e, t) {
|
|
1618
1625
|
return e.includes(t) || e.includes("\"") || e.includes("\n") || e.includes("\r") ? "\"" + e.replace(/"/g, "\"\"") + "\"" : e;
|
|
1619
1626
|
}
|
|
1620
1627
|
function Le(e, t) {
|
|
1621
1628
|
let n = e.map((e) => {
|
|
1622
1629
|
let n = {};
|
|
1623
1630
|
for (let r of t) {
|
|
1624
|
-
let t =
|
|
1625
|
-
n[r.key] = t instanceof Date ?
|
|
1631
|
+
let t = A(e, r);
|
|
1632
|
+
n[r.key] = t instanceof Date ? j(t, r)?.toISOString() ?? null : t ?? null;
|
|
1626
1633
|
}
|
|
1627
1634
|
return n;
|
|
1628
1635
|
});
|
|
1629
1636
|
return JSON.stringify(n, null, 2);
|
|
1630
1637
|
}
|
|
1631
|
-
function
|
|
1638
|
+
function Re(e, t) {
|
|
1632
1639
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
1633
1640
|
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);
|
|
1634
1641
|
}
|
|
1635
|
-
var
|
|
1642
|
+
var ze = {
|
|
1636
1643
|
csv: "text/csv;charset=utf-8",
|
|
1637
1644
|
tsv: "text/tab-separated-values;charset=utf-8",
|
|
1638
1645
|
json: "application/json;charset=utf-8",
|
|
1639
1646
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
1640
|
-
},
|
|
1647
|
+
}, Be = {
|
|
1641
1648
|
csv: ".csv",
|
|
1642
1649
|
tsv: ".tsv",
|
|
1643
1650
|
json: ".json",
|
|
1644
1651
|
xlsx: ".xlsx"
|
|
1645
1652
|
};
|
|
1646
|
-
function Be(e) {
|
|
1647
|
-
return Re[e];
|
|
1648
|
-
}
|
|
1649
1653
|
function Ve(e) {
|
|
1650
1654
|
return ze[e];
|
|
1651
1655
|
}
|
|
1656
|
+
function He(e) {
|
|
1657
|
+
return Be[e];
|
|
1658
|
+
}
|
|
1652
1659
|
//#endregion
|
|
1653
1660
|
//#region src/export/xlsx-reader.ts
|
|
1654
|
-
function
|
|
1661
|
+
function Ue(e) {
|
|
1655
1662
|
for (let t = e.byteLength - 22; t >= 0; t--) if (e.getUint32(t, !0) === 101010256) return t;
|
|
1656
1663
|
throw Error("XLSX: End of central directory not found — not a valid ZIP file");
|
|
1657
1664
|
}
|
|
1658
|
-
function
|
|
1659
|
-
let t =
|
|
1665
|
+
function We(e) {
|
|
1666
|
+
let t = Ue(e), n = e.getUint32(t + 16, !0), r = e.getUint32(t + 12, !0), i = new TextDecoder("utf-8"), a = [], o = n, s = n + r;
|
|
1660
1667
|
for (; o < s && e.getUint32(o, !0) === 33639248;) {
|
|
1661
1668
|
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));
|
|
1662
1669
|
a.push({
|
|
@@ -1669,7 +1676,7 @@ function Ue(e) {
|
|
|
1669
1676
|
}
|
|
1670
1677
|
return a;
|
|
1671
1678
|
}
|
|
1672
|
-
async function
|
|
1679
|
+
async function Ge(e) {
|
|
1673
1680
|
let t = new DecompressionStream("deflate-raw"), n = t.writable.getWriter(), r = t.readable.getReader();
|
|
1674
1681
|
n.write(e), n.close();
|
|
1675
1682
|
let i = [];
|
|
@@ -1682,28 +1689,28 @@ async function We(e) {
|
|
|
1682
1689
|
for (let e of i) o.set(e, s), s += e.length;
|
|
1683
1690
|
return o;
|
|
1684
1691
|
}
|
|
1685
|
-
async function
|
|
1692
|
+
async function Ke(e, t) {
|
|
1686
1693
|
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);
|
|
1687
1694
|
if (t.compressionMethod === 0) return o.slice();
|
|
1688
|
-
if (t.compressionMethod === 8) return
|
|
1695
|
+
if (t.compressionMethod === 8) return Ge(o);
|
|
1689
1696
|
throw Error(`XLSX: Unsupported compression method ${t.compressionMethod}`);
|
|
1690
1697
|
}
|
|
1691
|
-
async function
|
|
1692
|
-
let t = new DataView(e), n =
|
|
1693
|
-
for (let e of n) e.compressedSize === 0 && e.name.endsWith("/") || r.set(e.name, await
|
|
1698
|
+
async function qe(e) {
|
|
1699
|
+
let t = new DataView(e), n = We(t), r = /* @__PURE__ */ new Map();
|
|
1700
|
+
for (let e of n) e.compressedSize === 0 && e.name.endsWith("/") || r.set(e.name, await Ke(t, e));
|
|
1694
1701
|
return r;
|
|
1695
1702
|
}
|
|
1696
|
-
var
|
|
1697
|
-
function
|
|
1698
|
-
let t =
|
|
1703
|
+
var Je = new TextDecoder("utf-8");
|
|
1704
|
+
function K(e) {
|
|
1705
|
+
let t = Je.decode(e);
|
|
1699
1706
|
return new DOMParser().parseFromString(t, "application/xml");
|
|
1700
1707
|
}
|
|
1701
|
-
function
|
|
1708
|
+
function Ye(e) {
|
|
1702
1709
|
if (!e) return [];
|
|
1703
|
-
let t =
|
|
1710
|
+
let t = K(e);
|
|
1704
1711
|
return Array.from(t.querySelectorAll("si")).map((e) => Array.from(e.querySelectorAll("t")).map((e) => e.textContent ?? "").join(""));
|
|
1705
1712
|
}
|
|
1706
|
-
var
|
|
1713
|
+
var Xe = /* @__PURE__ */ new Set([
|
|
1707
1714
|
14,
|
|
1708
1715
|
15,
|
|
1709
1716
|
16,
|
|
@@ -1723,37 +1730,37 @@ var Ye = /* @__PURE__ */ new Set([
|
|
|
1723
1730
|
57,
|
|
1724
1731
|
58
|
|
1725
1732
|
]);
|
|
1726
|
-
function
|
|
1733
|
+
function Ze(e) {
|
|
1727
1734
|
let t = e.replace(/"[^"]*"/g, "").replace(/\\./g, "").replace(/\[[^\]]*\]/g, "").split(";")[0];
|
|
1728
1735
|
return /[dy]/i.test(t);
|
|
1729
1736
|
}
|
|
1730
|
-
function
|
|
1737
|
+
function Qe(e) {
|
|
1731
1738
|
let t = /* @__PURE__ */ new Set();
|
|
1732
1739
|
if (!e) return t;
|
|
1733
|
-
let n =
|
|
1740
|
+
let n = K(e), r = /* @__PURE__ */ new Map();
|
|
1734
1741
|
for (let e of Array.from(n.querySelectorAll("numFmts > numFmt"))) r.set(parseInt(e.getAttribute("numFmtId") ?? "", 10), e.getAttribute("formatCode") ?? "");
|
|
1735
1742
|
return Array.from(n.querySelectorAll("cellXfs > xf")).forEach((e, n) => {
|
|
1736
1743
|
let i = parseInt(e.getAttribute("numFmtId") ?? "0", 10), a = r.get(i);
|
|
1737
|
-
(a === void 0 ?
|
|
1744
|
+
(a === void 0 ? Xe.has(i) : Ze(a)) && t.add(n);
|
|
1738
1745
|
}), t;
|
|
1739
1746
|
}
|
|
1740
|
-
function
|
|
1747
|
+
function $e(e) {
|
|
1741
1748
|
if (!e) return !1;
|
|
1742
|
-
let t =
|
|
1749
|
+
let t = K(e).querySelector("workbookPr")?.getAttribute("date1904");
|
|
1743
1750
|
return t === "1" || t === "true";
|
|
1744
1751
|
}
|
|
1745
|
-
function
|
|
1752
|
+
function et(e, t) {
|
|
1746
1753
|
return new Date((t ? Date.UTC(1904, 0, 1) : Date.UTC(1899, 11, 30)) + Math.floor(e) * 864e5).toISOString().slice(0, 10);
|
|
1747
1754
|
}
|
|
1748
|
-
function
|
|
1749
|
-
let i =
|
|
1755
|
+
function tt(e, t, n, r) {
|
|
1756
|
+
let i = K(e).querySelectorAll("row");
|
|
1750
1757
|
if (i.length === 0) return [];
|
|
1751
1758
|
let a = 0, o = /* @__PURE__ */ new Map();
|
|
1752
1759
|
for (let e of i) {
|
|
1753
1760
|
let i = parseInt(e.getAttribute("r") ?? "1", 10) - 1, s = /* @__PURE__ */ new Map();
|
|
1754
1761
|
o.set(i, s);
|
|
1755
1762
|
for (let i of e.querySelectorAll("c")) {
|
|
1756
|
-
let e =
|
|
1763
|
+
let e = nt(i.getAttribute("r") ?? "");
|
|
1757
1764
|
e > a && (a = e);
|
|
1758
1765
|
let o = i.getAttribute("t") ?? "", c = i.getAttribute("s") ?? "", l = i.querySelector("v")?.textContent ?? "", u = i.querySelector("is > t")?.textContent ?? null, d;
|
|
1759
1766
|
if (o === "s") d = t[parseInt(l, 10)] ?? "";
|
|
@@ -1762,7 +1769,7 @@ function et(e, t, n, r) {
|
|
|
1762
1769
|
else if (l === "") d = "";
|
|
1763
1770
|
else {
|
|
1764
1771
|
let e = parseFloat(l);
|
|
1765
|
-
d = c !== "" && n.has(parseInt(c, 10)) && !isNaN(e) && e >= 0 ?
|
|
1772
|
+
d = c !== "" && n.has(parseInt(c, 10)) && !isNaN(e) && e >= 0 ? et(e, r) : l;
|
|
1766
1773
|
}
|
|
1767
1774
|
s.set(e, d);
|
|
1768
1775
|
}
|
|
@@ -1776,13 +1783,13 @@ function et(e, t, n, r) {
|
|
|
1776
1783
|
}
|
|
1777
1784
|
return c;
|
|
1778
1785
|
}
|
|
1779
|
-
function
|
|
1786
|
+
function nt(e) {
|
|
1780
1787
|
let t = 0, n = 0;
|
|
1781
1788
|
for (; n < e.length && e[n] >= "A" && e[n] <= "Z";) t = t * 26 + (e.charCodeAt(n) - 64), n++;
|
|
1782
1789
|
return t - 1;
|
|
1783
1790
|
}
|
|
1784
|
-
async function
|
|
1785
|
-
let t = await
|
|
1791
|
+
async function rt(e) {
|
|
1792
|
+
let t = await qe(e), n = Ye(t.get("xl/sharedStrings.xml")), r = t.get("xl/worksheets/sheet1.xml");
|
|
1786
1793
|
if (!r) {
|
|
1787
1794
|
for (let [e, n] of t) if (e.toLowerCase().includes("worksheets/sheet")) {
|
|
1788
1795
|
r = n;
|
|
@@ -1790,7 +1797,7 @@ async function nt(e) {
|
|
|
1790
1797
|
}
|
|
1791
1798
|
}
|
|
1792
1799
|
if (!r) throw Error("XLSX: No worksheet found");
|
|
1793
|
-
let i =
|
|
1800
|
+
let i = Qe(t.get("xl/styles.xml")), a = $e(t.get("xl/workbook.xml")), o = tt(r, n, i, a);
|
|
1794
1801
|
return o.length === 0 ? {
|
|
1795
1802
|
headers: [],
|
|
1796
1803
|
rows: []
|
|
@@ -1801,13 +1808,13 @@ async function nt(e) {
|
|
|
1801
1808
|
}
|
|
1802
1809
|
//#endregion
|
|
1803
1810
|
//#region src/export/delimited-reader.ts
|
|
1804
|
-
var
|
|
1811
|
+
var it = [
|
|
1805
1812
|
",",
|
|
1806
1813
|
";",
|
|
1807
1814
|
" "
|
|
1808
1815
|
];
|
|
1809
|
-
function
|
|
1810
|
-
let t = new Map(
|
|
1816
|
+
function at(e) {
|
|
1817
|
+
let t = new Map(it.map((e) => [e, 0])), n = !1;
|
|
1811
1818
|
for (let r of e) if (r === "\"") n = !n;
|
|
1812
1819
|
else if (!n && (r === "\n" || r === "\r")) break;
|
|
1813
1820
|
else !n && t.has(r) && t.set(r, t.get(r) + 1);
|
|
@@ -1815,8 +1822,8 @@ function it(e) {
|
|
|
1815
1822
|
for (let [e, n] of t) n > i && (r = e, i = n);
|
|
1816
1823
|
return r;
|
|
1817
1824
|
}
|
|
1818
|
-
function
|
|
1819
|
-
let n = e.charCodeAt(0) === 65279 ? e.slice(1) : e, r = v(n, t === "tsv" ? " " :
|
|
1825
|
+
function ot(e, t) {
|
|
1826
|
+
let n = e.charCodeAt(0) === 65279 ? e.slice(1) : e, r = v(n, t === "tsv" ? " " : at(n));
|
|
1820
1827
|
return {
|
|
1821
1828
|
headers: r[0] ?? [],
|
|
1822
1829
|
rows: r.slice(1)
|
|
@@ -1824,19 +1831,19 @@ function at(e, t) {
|
|
|
1824
1831
|
}
|
|
1825
1832
|
//#endregion
|
|
1826
1833
|
//#region src/export/import.ts
|
|
1827
|
-
var
|
|
1828
|
-
function
|
|
1834
|
+
var st = (e) => e.trim().toLowerCase();
|
|
1835
|
+
function ct(e, t) {
|
|
1829
1836
|
let n = (e) => [e.label, ...e.importAliases ?? []], r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
1830
1837
|
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) =>
|
|
1838
|
+
let o = t.find((t) => !i.has(t.key) && n(t).includes(e)) ?? t.find((t) => !i.has(t.key) && n(t).some((t) => st(t) === st(e)));
|
|
1832
1839
|
o && (i.add(o.key), r.set(a, o.key));
|
|
1833
1840
|
}), r;
|
|
1834
1841
|
}
|
|
1835
|
-
function
|
|
1836
|
-
let r =
|
|
1842
|
+
function lt(e, n) {
|
|
1843
|
+
let r = ct(e.headers, n), i = new Map(n.map((e) => [e.key, e])), a = [], o = e.rows.map((e, n) => {
|
|
1837
1844
|
let o = {};
|
|
1838
1845
|
for (let [s, c] of r) {
|
|
1839
|
-
let { value: r, failed: l } =
|
|
1846
|
+
let { value: r, failed: l } = F(e[s] ?? "", i.get(c));
|
|
1840
1847
|
t(o, c, r), l && a.push({
|
|
1841
1848
|
row: n,
|
|
1842
1849
|
key: c,
|
|
@@ -1857,12 +1864,12 @@ function ct(e, n) {
|
|
|
1857
1864
|
}
|
|
1858
1865
|
//#endregion
|
|
1859
1866
|
//#region src/models/types.ts
|
|
1860
|
-
function
|
|
1867
|
+
function q(e) {
|
|
1861
1868
|
return e.align ? e.align : e.type === "number" ? "end" : e.type === "boolean" ? "center" : "start";
|
|
1862
1869
|
}
|
|
1863
1870
|
//#endregion
|
|
1864
1871
|
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
1865
|
-
function
|
|
1872
|
+
function J(e, t, n, r) {
|
|
1866
1873
|
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
1867
1874
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
1868
1875
|
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);
|
|
@@ -1870,16 +1877,16 @@ function q(e, t, n, r) {
|
|
|
1870
1877
|
}
|
|
1871
1878
|
//#endregion
|
|
1872
1879
|
//#region src/flex-table.ts
|
|
1873
|
-
var
|
|
1880
|
+
var ut = {
|
|
1874
1881
|
eq: "=",
|
|
1875
1882
|
neq: "≠",
|
|
1876
1883
|
gt: ">",
|
|
1877
1884
|
lt: "<",
|
|
1878
1885
|
gte: "≥",
|
|
1879
1886
|
lte: "≤"
|
|
1880
|
-
},
|
|
1887
|
+
}, Y = 120, X = 40, Z = 20, dt = 32, Q = 5, ft = 200, $ = class extends a {
|
|
1881
1888
|
constructor(...e) {
|
|
1882
|
-
super(...e), this.columns = [], this._data = [], this._inUndoRedo = !1, this.clearUndoOnDataChange = !1, this.clearSelectionOnDataChange = !1, this.rowKey = "_id", this._rowHeightFromCss =
|
|
1889
|
+
super(...e), this.columns = [], this._data = [], this._inUndoRedo = !1, this.clearUndoOnDataChange = !1, this.clearSelectionOnDataChange = !1, this.rowKey = "_id", this._rowHeightFromCss = dt, 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 ue(), this._editing = new de(), this._rowSelection = new fe(), this._undo = new k(), 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) => {
|
|
1883
1890
|
!this._editorMoving && e.currentTarget?.isConnected && this._commitEdit();
|
|
1884
1891
|
}, this._warnedUnconstrained = !1, this._onHostFocus = (e) => {
|
|
1885
1892
|
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);
|
|
@@ -1908,7 +1915,7 @@ var lt = {
|
|
|
1908
1915
|
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);
|
|
1909
1916
|
}
|
|
1910
1917
|
get rowHeight() {
|
|
1911
|
-
let e = this._rowHeightExplicit ?? this._rowHeightFromCss ??
|
|
1918
|
+
let e = this._rowHeightExplicit ?? this._rowHeightFromCss ?? dt;
|
|
1912
1919
|
return Math.max(e, this._targetFloor);
|
|
1913
1920
|
}
|
|
1914
1921
|
set rowHeight(e) {
|
|
@@ -2279,20 +2286,20 @@ var lt = {
|
|
|
2279
2286
|
}
|
|
2280
2287
|
exportToString(e, t) {
|
|
2281
2288
|
let n = this._exportSlice(t);
|
|
2282
|
-
return n ?
|
|
2289
|
+
return n ? U(n.rows, n.cols, e, { bom: t?.bom }) : "";
|
|
2283
2290
|
}
|
|
2284
2291
|
async exportToBlob(e, t) {
|
|
2285
2292
|
let n = this._exportSlice(t) ?? {
|
|
2286
2293
|
rows: [],
|
|
2287
2294
|
cols: []
|
|
2288
2295
|
};
|
|
2289
|
-
return
|
|
2296
|
+
return W(n.rows, n.cols, e, { bom: t?.bom });
|
|
2290
2297
|
}
|
|
2291
2298
|
async exportToFile(e, t, n) {
|
|
2292
|
-
|
|
2299
|
+
Re(await this.exportToBlob(e, {
|
|
2293
2300
|
...n,
|
|
2294
2301
|
bom: n?.bom ?? !0
|
|
2295
|
-
}), t ?? `export${
|
|
2302
|
+
}), t ?? `export${He(e)}`);
|
|
2296
2303
|
}
|
|
2297
2304
|
_exportSlice(e) {
|
|
2298
2305
|
if (e && "rows" in e && e.rows) return {
|
|
@@ -2372,13 +2379,13 @@ var lt = {
|
|
|
2372
2379
|
}
|
|
2373
2380
|
async importFromFile(e) {
|
|
2374
2381
|
let t = e.name.toLowerCase(), n;
|
|
2375
|
-
if (t.endsWith(".xlsx")) n = await
|
|
2376
|
-
else if (t.endsWith(".csv") || t.endsWith(".tsv")) n =
|
|
2382
|
+
if (t.endsWith(".xlsx")) n = await rt(await e.arrayBuffer());
|
|
2383
|
+
else if (t.endsWith(".csv") || t.endsWith(".tsv")) n = ot(await e.text(), t.endsWith(".tsv") ? "tsv" : "csv");
|
|
2377
2384
|
else return console.warn(`flex-table importFromFile: unsupported file type "${e.name}"`), null;
|
|
2378
2385
|
return this._applyImportedSheet(n);
|
|
2379
2386
|
}
|
|
2380
2387
|
_applyImportedSheet(e) {
|
|
2381
|
-
let { rows: t, report: n } =
|
|
2388
|
+
let { rows: t, report: n } = lt(e, this.columns), r = [...this.data];
|
|
2382
2389
|
return this.data = t, this._undo.push({
|
|
2383
2390
|
label: "import",
|
|
2384
2391
|
undo: () => {
|
|
@@ -2412,8 +2419,8 @@ var lt = {
|
|
|
2412
2419
|
return this._columnWidths.get(e);
|
|
2413
2420
|
}
|
|
2414
2421
|
_getColWidth(e) {
|
|
2415
|
-
let t = this._columnWidths.get(e.key) ?? e.width ??
|
|
2416
|
-
return Math.max(t, e.minWidth ??
|
|
2422
|
+
let t = this._columnWidths.get(e.key) ?? e.width ?? Y;
|
|
2423
|
+
return Math.max(t, e.minWidth ?? X);
|
|
2417
2424
|
}
|
|
2418
2425
|
get headerHeight() {
|
|
2419
2426
|
return this.rowHeight + 8;
|
|
@@ -2439,10 +2446,10 @@ var lt = {
|
|
|
2439
2446
|
return Math.max(0, this._visibleRowCount - this._frozenRowCount) * this.rowHeight;
|
|
2440
2447
|
}
|
|
2441
2448
|
get visibleRange() {
|
|
2442
|
-
let e = this._frozenRowCount, t = e + Math.floor(Math.max(0, this._scrollTop) / this.rowHeight), n = Math.max(e, t -
|
|
2449
|
+
let e = this._frozenRowCount, t = e + Math.floor(Math.max(0, this._scrollTop) / this.rowHeight), n = Math.max(e, t - Q), r = Math.max(0, this._viewportHeight - this.headerHeight - this.frozenRowsHeight), i = Math.ceil(r / this.rowHeight) + 1;
|
|
2443
2450
|
return {
|
|
2444
2451
|
start: n,
|
|
2445
|
-
end: Math.min(this._visibleRowCount, t + i +
|
|
2452
|
+
end: Math.min(this._visibleRowCount, t + i + Q)
|
|
2446
2453
|
};
|
|
2447
2454
|
}
|
|
2448
2455
|
connectedCallback() {
|
|
@@ -2485,13 +2492,13 @@ var lt = {
|
|
|
2485
2492
|
i = r;
|
|
2486
2493
|
break;
|
|
2487
2494
|
}
|
|
2488
|
-
i = Math.max(0, i -
|
|
2495
|
+
i = Math.max(0, i - Q);
|
|
2489
2496
|
let a = e.length;
|
|
2490
2497
|
for (let e = i; e < t.length; e++) if (t[e] > r) {
|
|
2491
2498
|
a = e;
|
|
2492
2499
|
break;
|
|
2493
2500
|
}
|
|
2494
|
-
return a = Math.min(e.length, a +
|
|
2501
|
+
return a = Math.min(e.length, a + Q), {
|
|
2495
2502
|
start: i,
|
|
2496
2503
|
end: a
|
|
2497
2504
|
};
|
|
@@ -2509,7 +2516,7 @@ var lt = {
|
|
|
2509
2516
|
}
|
|
2510
2517
|
_recomputeView() {
|
|
2511
2518
|
if (this.dataMode === "server") this._filteredIndices = Array.from({ length: this.data.length }, (e, t) => t), this._sortedIndices = this._filteredIndices;
|
|
2512
|
-
else if (this._filteredIndices =
|
|
2519
|
+
else if (this._filteredIndices = pe(this.data, this._filters, (e, t, n) => {
|
|
2513
2520
|
this._emit("filter-error", {
|
|
2514
2521
|
error: e,
|
|
2515
2522
|
row: t,
|
|
@@ -2560,7 +2567,7 @@ var lt = {
|
|
|
2560
2567
|
e !== this._viewportHeight && (this._viewportHeight = e), t !== this._viewportWidth && (this._viewportWidth = t), this._warnIfUnconstrained();
|
|
2561
2568
|
}
|
|
2562
2569
|
_warnIfUnconstrained() {
|
|
2563
|
-
this._warnedUnconstrained || process.env.NODE_ENV === "production" || this._visibleRowCount <
|
|
2570
|
+
this._warnedUnconstrained || process.env.NODE_ENV === "production" || this._visibleRowCount < ft || 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.`));
|
|
2564
2571
|
}
|
|
2565
2572
|
_onScroll() {
|
|
2566
2573
|
this._scrollTop = this.scrollTop, this._scrollLeft = this.scrollLeft;
|
|
@@ -2702,7 +2709,7 @@ var lt = {
|
|
|
2702
2709
|
}
|
|
2703
2710
|
let t = this.shadowRoot?.querySelector(".ft-editor");
|
|
2704
2711
|
if (t) {
|
|
2705
|
-
let n =
|
|
2712
|
+
let n = P(t.value, e);
|
|
2706
2713
|
this._applyEdit(n);
|
|
2707
2714
|
} else this._cancelEdit();
|
|
2708
2715
|
}
|
|
@@ -2779,7 +2786,7 @@ var lt = {
|
|
|
2779
2786
|
_onEditorKeyDown(e) {
|
|
2780
2787
|
if (x(e)) return;
|
|
2781
2788
|
let t = e.currentTarget;
|
|
2782
|
-
if (!(t?.localName === "u-date-picker" && (e.composedPath().some((e) => e instanceof Element && e.part?.contains("popover")) || e.key === "Escape" &&
|
|
2789
|
+
if (!(t?.localName === "u-date-picker" && (e.composedPath().some((e) => e instanceof Element && e.part?.contains("popover")) || e.key === "Escape" && mt(t)))) {
|
|
2783
2790
|
if (this._autocompleteState && this._autocompleteState.candidates.length > 0) {
|
|
2784
2791
|
if (e.key === "ArrowDown") {
|
|
2785
2792
|
e.preventDefault(), e.stopPropagation();
|
|
@@ -2897,7 +2904,7 @@ var lt = {
|
|
|
2897
2904
|
case "ArrowLeft":
|
|
2898
2905
|
case "ArrowRight":
|
|
2899
2906
|
if (e.altKey) {
|
|
2900
|
-
e.preventDefault(), this._resizeColumnBy(r.key, e.key === "ArrowRight" ?
|
|
2907
|
+
e.preventDefault(), this._resizeColumnBy(r.key, e.key === "ArrowRight" ? Z : -20);
|
|
2901
2908
|
return;
|
|
2902
2909
|
}
|
|
2903
2910
|
i = e.key === "ArrowLeft" ? Math.max(0, n - 1) : Math.min(t.length - 1, n + 1);
|
|
@@ -2972,12 +2979,12 @@ var lt = {
|
|
|
2972
2979
|
if (!e.altKey || !this._activeCell || e.key !== "ArrowLeft" && e.key !== "ArrowRight") return !1;
|
|
2973
2980
|
e.preventDefault();
|
|
2974
2981
|
let n = t[this._activeCell.col];
|
|
2975
|
-
return n && this._resizeColumnBy(n.key, e.key === "ArrowRight" ?
|
|
2982
|
+
return n && this._resizeColumnBy(n.key, e.key === "ArrowRight" ? Z : -20), !0;
|
|
2976
2983
|
}
|
|
2977
2984
|
_resizeColumnBy(e, t) {
|
|
2978
2985
|
let n = this.visibleColumns.findIndex((t) => t.key === e), r = this.visibleColumns[n];
|
|
2979
2986
|
if (!r) return;
|
|
2980
|
-
let i = this._columnWidths.get(r.key) ?? r.width ??
|
|
2987
|
+
let i = this._columnWidths.get(r.key) ?? r.width ?? Y, a = r.minWidth ?? X, o = Math.max(a, i + t);
|
|
2981
2988
|
this._columnWidths.set(r.key, o), this.requestUpdate(), this._emit("column-resize", {
|
|
2982
2989
|
key: r.key,
|
|
2983
2990
|
width: o,
|
|
@@ -3089,7 +3096,7 @@ var lt = {
|
|
|
3089
3096
|
for (let s = 0; s < n[o].length; s++) {
|
|
3090
3097
|
let l = e.col + s;
|
|
3091
3098
|
if (l >= i.length) break;
|
|
3092
|
-
let u = i[l], d = r(this.data[c], u.key), f =
|
|
3099
|
+
let u = i[l], d = r(this.data[c], u.key), f = P(n[o][s], u);
|
|
3093
3100
|
t(this.data[c], u.key, f), a.push({
|
|
3094
3101
|
row: c,
|
|
3095
3102
|
col: l,
|
|
@@ -3154,7 +3161,7 @@ var lt = {
|
|
|
3154
3161
|
for (let r = e.startCol + 1; r <= e.endCol; r++) {
|
|
3155
3162
|
let e = t[r];
|
|
3156
3163
|
if (!e || !this._isCellEditable(e)) continue;
|
|
3157
|
-
let i =
|
|
3164
|
+
let i = P(s == null ? "" : String(s), e);
|
|
3158
3165
|
n.push({
|
|
3159
3166
|
row: a,
|
|
3160
3167
|
key: e.key,
|
|
@@ -3284,7 +3291,7 @@ var lt = {
|
|
|
3284
3291
|
return Math.min(n, i);
|
|
3285
3292
|
}
|
|
3286
3293
|
_renderHeaderCell(t, n) {
|
|
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 ??
|
|
3294
|
+
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 ?? q(t), p = [
|
|
3288
3295
|
"ft-header-cell",
|
|
3289
3296
|
r ? "ft-sortable" : "",
|
|
3290
3297
|
d ? "ft-pinned" : "",
|
|
@@ -3455,7 +3462,7 @@ var lt = {
|
|
|
3455
3462
|
${i.map((t) => l("show", e("showColumn", { header: t.label }), () => this._setColumnHidden(t.key, !1)))}
|
|
3456
3463
|
<div class="ft-header-menu-separator" role="separator"></div>
|
|
3457
3464
|
${l("autofit", e("autoFitWidth"), () => this._autoFitColumn(t))}
|
|
3458
|
-
${l("wider", e("wider"), () => this._resizeColumnBy(t,
|
|
3465
|
+
${l("wider", e("wider"), () => this._resizeColumnBy(t, Z), !0)}
|
|
3459
3466
|
${l("narrower", e("narrower"), () => this._resizeColumnBy(t, -20), !0)}
|
|
3460
3467
|
</div>
|
|
3461
3468
|
`;
|
|
@@ -3755,11 +3762,11 @@ var lt = {
|
|
|
3755
3762
|
@keydown=${(e) => {
|
|
3756
3763
|
e.key === "Escape" && this._closeFilterDropdown(), e.stopPropagation();
|
|
3757
3764
|
}}>
|
|
3758
|
-
${Object.keys(
|
|
3765
|
+
${Object.keys(ut).map((e) => s`<option value=${e}>${ut[e]}</option>`)}
|
|
3759
3766
|
</select>
|
|
3760
3767
|
<input class="ft-filter-input ft-num-cond-input" type="text" inputmode="decimal" placeholder=${e("valuePlaceholder")}
|
|
3761
3768
|
aria-label=${e("conditionValue", { n: n === "cond1" ? 1 : 2 })}
|
|
3762
|
-
.value=${r.text ?? (r.value == null ? "" :
|
|
3769
|
+
.value=${r.text ?? (r.value == null ? "" : I(r.value))}
|
|
3763
3770
|
aria-invalid=${r.text && r.value == null ? "true" : "false"}
|
|
3764
3771
|
@input=${(e) => {
|
|
3765
3772
|
let r = e.target.value, i = this._numberFilterState.get(t) ?? this._defaultNumState();
|
|
@@ -3819,7 +3826,7 @@ var lt = {
|
|
|
3819
3826
|
}
|
|
3820
3827
|
_renderDateFilter(t) {
|
|
3821
3828
|
let n = t.type === "datetime", r = this._dateFilterState.get(t.key) ?? {}, i = (e) => e?.slice(0, 10), a = (e) => {
|
|
3822
|
-
e.key === "Escape" &&
|
|
3829
|
+
e.key === "Escape" && mt(e.currentTarget) || (e.stopPropagation(), e.key === "Escape" && this._closeFilterDropdown());
|
|
3823
3830
|
};
|
|
3824
3831
|
return s`
|
|
3825
3832
|
<div class="ft-filter-range ft-filter-range-dates">
|
|
@@ -3868,7 +3875,7 @@ var lt = {
|
|
|
3868
3875
|
if (!n) return;
|
|
3869
3876
|
let r = this.shadowRoot?.querySelectorAll(`.ft-cell[data-col-index="${t}"]`), i = 0, a = this.shadowRoot?.querySelector(`.ft-header-cell[data-col-index="${t}"]`);
|
|
3870
3877
|
if (a && (i = Math.max(i, a.scrollWidth)), r) for (let e of r) i = Math.max(i, e.scrollWidth);
|
|
3871
|
-
let o = n.minWidth ??
|
|
3878
|
+
let o = n.minWidth ?? X, s = Math.max(o, i + 8);
|
|
3872
3879
|
this._columnWidths.set(n.key, s), this.requestUpdate(), this._emit("column-resize", {
|
|
3873
3880
|
key: n.key,
|
|
3874
3881
|
width: s,
|
|
@@ -3877,7 +3884,7 @@ var lt = {
|
|
|
3877
3884
|
}
|
|
3878
3885
|
_onResizeStart(e, t) {
|
|
3879
3886
|
e.preventDefault(), e.stopPropagation();
|
|
3880
|
-
let n = this.visibleColumns[t], r = this._columnWidths.get(n.key) ?? n.width ??
|
|
3887
|
+
let n = this.visibleColumns[t], r = this._columnWidths.get(n.key) ?? n.width ?? Y;
|
|
3881
3888
|
this._resizing = {
|
|
3882
3889
|
colIndex: t,
|
|
3883
3890
|
startX: e.clientX,
|
|
@@ -3885,13 +3892,13 @@ var lt = {
|
|
|
3885
3892
|
};
|
|
3886
3893
|
let i = (e) => {
|
|
3887
3894
|
if (!this._resizing) return;
|
|
3888
|
-
let t = e.clientX - this._resizing.startX, r = n.minWidth ??
|
|
3895
|
+
let t = e.clientX - this._resizing.startX, r = n.minWidth ?? X, i = Math.max(r, this._resizing.startWidth + t);
|
|
3889
3896
|
this._columnWidths.set(n.key, i), this.requestUpdate();
|
|
3890
3897
|
}, a = () => {
|
|
3891
3898
|
document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", o), this._resizeCleanup = null;
|
|
3892
3899
|
}, o = () => {
|
|
3893
3900
|
if (a(), this._resizing) {
|
|
3894
|
-
let e = this._columnWidths.get(n.key) ??
|
|
3901
|
+
let e = this._columnWidths.get(n.key) ?? Y;
|
|
3895
3902
|
this._emit("column-resize", {
|
|
3896
3903
|
key: n.key,
|
|
3897
3904
|
width: e,
|
|
@@ -4466,7 +4473,7 @@ var lt = {
|
|
|
4466
4473
|
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 = [
|
|
4467
4474
|
"ft-cell",
|
|
4468
4475
|
`ft-type-${t.type ?? "text"}`,
|
|
4469
|
-
`ft-align-${
|
|
4476
|
+
`ft-align-${q(t)}`,
|
|
4470
4477
|
o ? "ft-active" : "",
|
|
4471
4478
|
u ? "ft-selected" : "",
|
|
4472
4479
|
p ? "ft-pinned" : "",
|
|
@@ -4476,7 +4483,7 @@ var lt = {
|
|
|
4476
4483
|
a?.continues ? "ft-merge-continued" : "",
|
|
4477
4484
|
a?.opensDown ? "ft-merge-open" : "",
|
|
4478
4485
|
t.reveal === "hover" ? "ft-reveal-hover" : ""
|
|
4479
|
-
].filter(Boolean).join(" "), T = this._comments.size > 0 ? this._comments.get(this.getRowId(e))?.get(t.key) ?? null : null, E = T !== null,
|
|
4486
|
+
].filter(Boolean).join(" "), T = this._comments.size > 0 ? this._comments.get(this.getRowId(e))?.get(t.key) ?? null : null, E = T !== null, D = E ? s`<div class="ft-comment-indicator" title=${T}></div>` : c;
|
|
4480
4487
|
return s`
|
|
4481
4488
|
<div class=${E ? w + " ft-has-comment" : w}
|
|
4482
4489
|
role="gridcell"
|
|
@@ -4492,8 +4499,8 @@ var lt = {
|
|
|
4492
4499
|
@mouseenter=${() => this._onCellMouseEnter(n, i)}
|
|
4493
4500
|
@click=${(e) => this._onCellClickEvent(e, n, i)}
|
|
4494
4501
|
@dblclick=${() => this._onCellDblClick(n, i)}>
|
|
4495
|
-
${
|
|
4496
|
-
${
|
|
4502
|
+
${D}
|
|
4503
|
+
${O(r(e, t.key), e, t)}
|
|
4497
4504
|
</div>
|
|
4498
4505
|
`;
|
|
4499
4506
|
}
|
|
@@ -4502,7 +4509,7 @@ var lt = {
|
|
|
4502
4509
|
let n = r(e, t.key), i = n == null ? "" : String(n);
|
|
4503
4510
|
if (t.type === "number") return s`
|
|
4504
4511
|
<input class="ft-editor ft-editor-number" type="text" inputmode="decimal" aria-label=${t.label}
|
|
4505
|
-
.value=${typeof n == "number" ?
|
|
4512
|
+
.value=${typeof n == "number" ? I(n) : i}
|
|
4506
4513
|
@keydown=${this._onEditorKeyDown}
|
|
4507
4514
|
@blur=${this._onEditorBlur}>
|
|
4508
4515
|
`;
|
|
@@ -4511,7 +4518,7 @@ var lt = {
|
|
|
4511
4518
|
return s`
|
|
4512
4519
|
<u-date-picker class="ft-editor ft-editor-${t.type}" size="sm" aria-label=${t.label}
|
|
4513
4520
|
mode=${e ? "datetime" : "date"} ?confirm=${e}
|
|
4514
|
-
.value=${
|
|
4521
|
+
.value=${pt(n, e)}
|
|
4515
4522
|
@keydown=${this._onEditorKeyDown}
|
|
4516
4523
|
@change=${() => this._commitEdit()}
|
|
4517
4524
|
@blur=${this._onEditorBlur}></u-date-picker>
|
|
@@ -4563,62 +4570,62 @@ var lt = {
|
|
|
4563
4570
|
`;
|
|
4564
4571
|
}
|
|
4565
4572
|
};
|
|
4566
|
-
|
|
4573
|
+
J([u({ type: Array })], $.prototype, "columns", void 0), J([u({
|
|
4567
4574
|
type: Array,
|
|
4568
4575
|
hasChanged: () => !0
|
|
4569
|
-
})],
|
|
4576
|
+
})], $.prototype, "data", null), J([u({
|
|
4570
4577
|
type: Boolean,
|
|
4571
4578
|
attribute: "clear-undo-on-data-change"
|
|
4572
|
-
})],
|
|
4579
|
+
})], $.prototype, "clearUndoOnDataChange", void 0), J([u({
|
|
4573
4580
|
type: Boolean,
|
|
4574
4581
|
attribute: "clear-selection-on-data-change"
|
|
4575
|
-
})],
|
|
4582
|
+
})], $.prototype, "clearSelectionOnDataChange", void 0), J([u({ attribute: "row-key" })], $.prototype, "rowKey", void 0), J([u({
|
|
4576
4583
|
type: Number,
|
|
4577
4584
|
attribute: "row-height"
|
|
4578
|
-
})],
|
|
4585
|
+
})], $.prototype, "rowHeight", null), J([u({
|
|
4579
4586
|
type: Boolean,
|
|
4580
4587
|
attribute: "show-row-numbers"
|
|
4581
|
-
})],
|
|
4588
|
+
})], $.prototype, "showRowNumbers", void 0), J([u({
|
|
4582
4589
|
type: String,
|
|
4583
4590
|
reflect: !0
|
|
4584
|
-
})],
|
|
4591
|
+
})], $.prototype, "theme", void 0), J([u({
|
|
4585
4592
|
type: Number,
|
|
4586
4593
|
attribute: "max-rows"
|
|
4587
|
-
})],
|
|
4594
|
+
})], $.prototype, "maxRows", void 0), J([u({ type: Boolean })], $.prototype, "editable", void 0), J([u({
|
|
4588
4595
|
type: Boolean,
|
|
4589
4596
|
attribute: "show-filters"
|
|
4590
|
-
})],
|
|
4597
|
+
})], $.prototype, "showFilters", void 0), J([u({
|
|
4591
4598
|
type: Boolean,
|
|
4592
4599
|
attribute: "show-context-menu"
|
|
4593
|
-
})],
|
|
4600
|
+
})], $.prototype, "showContextMenu", void 0), J([u({
|
|
4594
4601
|
type: Number,
|
|
4595
4602
|
attribute: "frozen-rows"
|
|
4596
|
-
})],
|
|
4603
|
+
})], $.prototype, "frozenRows", void 0), J([u({
|
|
4597
4604
|
type: String,
|
|
4598
4605
|
attribute: "empty-message"
|
|
4599
|
-
})],
|
|
4606
|
+
})], $.prototype, "emptyMessage", void 0), J([u({
|
|
4600
4607
|
type: String,
|
|
4601
4608
|
attribute: "no-matching-message"
|
|
4602
|
-
})],
|
|
4609
|
+
})], $.prototype, "noMatchingMessage", void 0), J([u({ attribute: !1 })], $.prototype, "error", void 0), J([u({
|
|
4603
4610
|
type: Boolean,
|
|
4604
4611
|
reflect: !0
|
|
4605
|
-
})],
|
|
4612
|
+
})], $.prototype, "loading", void 0), J([u({
|
|
4606
4613
|
type: Boolean,
|
|
4607
4614
|
attribute: "import-enabled"
|
|
4608
|
-
})],
|
|
4615
|
+
})], $.prototype, "importEnabled", void 0), J([u({ type: Boolean })], $.prototype, "selectable", void 0), J([u({
|
|
4609
4616
|
type: String,
|
|
4610
4617
|
attribute: "selection-mode"
|
|
4611
|
-
})],
|
|
4618
|
+
})], $.prototype, "selectionMode", null), J([u({
|
|
4612
4619
|
type: String,
|
|
4613
4620
|
attribute: "data-mode"
|
|
4614
|
-
})],
|
|
4621
|
+
})], $.prototype, "dataMode", void 0), J([u({
|
|
4615
4622
|
type: Object,
|
|
4616
4623
|
attribute: "footer-data"
|
|
4617
|
-
})],
|
|
4624
|
+
})], $.prototype, "footerData", void 0), J([u({ attribute: !1 })], $.prototype, "stylesheets", void 0), J([u({
|
|
4618
4625
|
type: Number,
|
|
4619
4626
|
attribute: "max-undo-size"
|
|
4620
|
-
})],
|
|
4621
|
-
function
|
|
4627
|
+
})], $.prototype, "maxUndoSize", null), J([d()], $.prototype, "_scrollTop", void 0), J([d()], $.prototype, "_scrollLeft", void 0), J([d()], $.prototype, "_viewportHeight", void 0), J([d()], $.prototype, "_viewportWidth", void 0), J([d()], $.prototype, "_activeCell", void 0), J([d()], $.prototype, "_headerCol", void 0), J([d()], $.prototype, "_editingCell", void 0), J([d()], $.prototype, "_sortCriteria", void 0), J([d()], $.prototype, "_openFilterKey", void 0), J([d()], $.prototype, "_rowSelectionVersion", void 0), J([d()], $.prototype, "_autocompleteState", void 0), J([d()], $.prototype, "_headerMenu", void 0), J([d()], $.prototype, "_bodyContextMenu", void 0), J([d()], $.prototype, "_commentPopup", void 0), J([d()], $.prototype, "_isDragOver", void 0), $ = J([l("flex-table")], $);
|
|
4628
|
+
function pt(e, t) {
|
|
4622
4629
|
if (t) {
|
|
4623
4630
|
let t = ye(e);
|
|
4624
4631
|
return /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(t) ? t.replace(" ", "T") : void 0;
|
|
@@ -4626,7 +4633,7 @@ function ft(e, t) {
|
|
|
4626
4633
|
let n = ve(e);
|
|
4627
4634
|
return /^\d{4}-\d{2}-\d{2}$/.test(n) ? n : void 0;
|
|
4628
4635
|
}
|
|
4629
|
-
function
|
|
4636
|
+
function mt(e) {
|
|
4630
4637
|
try {
|
|
4631
4638
|
return e.matches(":state(open)");
|
|
4632
4639
|
} catch {
|
|
@@ -4634,4 +4641,4 @@ function $(e) {
|
|
|
4634
4641
|
}
|
|
4635
4642
|
}
|
|
4636
4643
|
//#endregion
|
|
4637
|
-
export {
|
|
4644
|
+
export { W as a, O as c, U as i, q as n, k as o, Re as r, fe as s, $ as t };
|
package/dist/flex-table.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./flex-table-
|
|
1
|
+
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./flex-table-CYi9B4h_.js";
|
|
2
2
|
import { t as c } from "./locale-Covm8PfH.js";
|
|
3
3
|
import { i as l, r as u } from "./sorting-BJszwEHw.js";
|
|
4
4
|
export { s as FlexTable, o as RowSelectionState, i as UndoStack, a as downloadBlob, r as effectiveAlign, n as exportData, e as exportDataBlob, c as flexTableLocale, u as getCellValue, t as renderCell, l as setCellValue };
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./flex-table-
|
|
1
|
+
import { t as e } from "./flex-table-CYi9B4h_.js";
|
|
2
2
|
import { n as t, r as n, u as r } from "./fetch-all-DkdNzWrF.js";
|
|
3
3
|
import { t as i } from "./source-dm6qXFh1.js";
|
|
4
4
|
import { n as a, t as o } from "./view-DuDIMoXV.js";
|
package/package.json
CHANGED
|
@@ -140,7 +140,8 @@ A server-paged table holds one page. Export the list's whole result with
|
|
|
140
140
|
Table-less: `exportDataBlob(rows, columns, format, { bom? })` + `downloadBlob(blob, name)` from the root entry.
|
|
141
141
|
|
|
142
142
|
A column's `exportValue(value, row)` is what export writes for it (default: the raw value — `format`/`render` do not
|
|
143
|
-
apply). In XLSX a `date`/`datetime` column's ISO strings become date cells, at the wall-clock time the table shows
|
|
143
|
+
apply). In XLSX a `date`/`datetime` column's ISO strings become date cells, at the wall-clock time the table shows;
|
|
144
|
+
in CSV/TSV and a copied range they are wall-clock text (`YYYY-MM-DD` · `YYYY-MM-DD HH:mm:ss`), never the UTC string.
|
|
144
145
|
|
|
145
146
|
## Events
|
|
146
147
|
|