@iyulab/flex-table 0.61.0 → 0.62.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 +18 -0
- package/README.md +13 -2
- package/dist/export/export.d.ts +11 -2
- package/dist/export/values.d.ts +17 -0
- package/dist/{flex-table-BD_T3SqO.js → flex-table-CbBVOhRQ.js} +248 -289
- package/dist/flex-table.d.ts +7 -1
- package/dist/flex-table.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/models/types.d.ts +6 -0
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/skills/iyulab-flex-table/references/api.md +5 -2
|
@@ -1113,10 +1113,10 @@ var ce = class {
|
|
|
1113
1113
|
this._rowCount = e, this._colCount = t;
|
|
1114
1114
|
}
|
|
1115
1115
|
setActive(e, t) {
|
|
1116
|
-
return e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount
|
|
1116
|
+
return e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount || (this.activeCell = {
|
|
1117
1117
|
row: e,
|
|
1118
1118
|
col: t
|
|
1119
|
-
}, this.rangeAnchor = null, this.range = null, this.extraRanges = [], this.activeCell
|
|
1119
|
+
}, this.rangeAnchor = null, this.range = null, this.extraRanges = []), this.activeCell;
|
|
1120
1120
|
}
|
|
1121
1121
|
toggleCell(e, t) {
|
|
1122
1122
|
if (e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount) return;
|
|
@@ -1129,7 +1129,7 @@ var ce = class {
|
|
|
1129
1129
|
});
|
|
1130
1130
|
}
|
|
1131
1131
|
setActiveWithRange(e, t) {
|
|
1132
|
-
return e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount
|
|
1132
|
+
return e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount || (!this.rangeAnchor && this.activeCell && (this.rangeAnchor = { ...this.activeCell }), this.activeCell = {
|
|
1133
1133
|
row: e,
|
|
1134
1134
|
col: t
|
|
1135
1135
|
}, this.rangeAnchor && (this.range = se({
|
|
@@ -1137,7 +1137,7 @@ var ce = class {
|
|
|
1137
1137
|
startCol: this.rangeAnchor.col,
|
|
1138
1138
|
endRow: e,
|
|
1139
1139
|
endCol: t
|
|
1140
|
-
})), this.activeCell
|
|
1140
|
+
}))), this.activeCell;
|
|
1141
1141
|
}
|
|
1142
1142
|
isInRange(e, t) {
|
|
1143
1143
|
if (this.range) {
|
|
@@ -1225,7 +1225,7 @@ var ce = class {
|
|
|
1225
1225
|
let e = this.current;
|
|
1226
1226
|
return this.current = null, e;
|
|
1227
1227
|
}
|
|
1228
|
-
},
|
|
1228
|
+
}, ue = class {
|
|
1229
1229
|
constructor() {
|
|
1230
1230
|
this._selected = /* @__PURE__ */ new Set(), this._mode = "multi";
|
|
1231
1231
|
}
|
|
@@ -1283,16 +1283,13 @@ var ce = class {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
selectRange(e, t, n) {
|
|
1285
1285
|
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]);
|
|
1286
|
+
if (this._mode === "single" || r < 0 || i < 0) this.select(n);
|
|
1287
|
+
else for (let t = Math.min(r, i); t <= Math.max(r, i); t++) this._selected.add(e[t]);
|
|
1291
1288
|
}
|
|
1292
1289
|
};
|
|
1293
1290
|
//#endregion
|
|
1294
1291
|
//#region src/core/filtering.ts
|
|
1295
|
-
function
|
|
1292
|
+
function de(e, t, n) {
|
|
1296
1293
|
if (t.length === 0) return Array.from({ length: e.length }, (e, t) => t);
|
|
1297
1294
|
let r = [];
|
|
1298
1295
|
for (let i = 0; i < e.length; i++) {
|
|
@@ -1311,9 +1308,9 @@ function ue(e, t, n) {
|
|
|
1311
1308
|
}
|
|
1312
1309
|
//#endregion
|
|
1313
1310
|
//#region src/core/undo.ts
|
|
1314
|
-
var
|
|
1311
|
+
var fe = 100, O = class {
|
|
1315
1312
|
constructor() {
|
|
1316
|
-
this._undoStack = [], this._redoStack = [], this._maxSize =
|
|
1313
|
+
this._undoStack = [], this._redoStack = [], this._maxSize = fe;
|
|
1317
1314
|
}
|
|
1318
1315
|
get maxSize() {
|
|
1319
1316
|
return this._maxSize;
|
|
@@ -1350,7 +1347,7 @@ var de = 100, k = class {
|
|
|
1350
1347
|
};
|
|
1351
1348
|
//#endregion
|
|
1352
1349
|
//#region src/clipboard/clipboard.ts
|
|
1353
|
-
function
|
|
1350
|
+
function pe(e, t, n) {
|
|
1354
1351
|
let r = [];
|
|
1355
1352
|
for (let i = n.startRow; i <= n.endRow; i++) {
|
|
1356
1353
|
let a = e[i], o = [];
|
|
@@ -1362,7 +1359,7 @@ function fe(e, t, n) {
|
|
|
1362
1359
|
}
|
|
1363
1360
|
return _(r);
|
|
1364
1361
|
}
|
|
1365
|
-
function
|
|
1362
|
+
function k(e, t) {
|
|
1366
1363
|
if (e === "") return null;
|
|
1367
1364
|
switch (t.type) {
|
|
1368
1365
|
case "number": {
|
|
@@ -1377,19 +1374,19 @@ function A(e, t) {
|
|
|
1377
1374
|
default: return e;
|
|
1378
1375
|
}
|
|
1379
1376
|
}
|
|
1380
|
-
function
|
|
1377
|
+
function A(e) {
|
|
1381
1378
|
let t = String(e);
|
|
1382
1379
|
if (!Number.isFinite(e) || t.includes("e")) return t;
|
|
1383
1380
|
let n = new Intl.NumberFormat(u.get()).formatToParts(1.5).find((e) => e.type === "decimal")?.value;
|
|
1384
1381
|
return n && n !== "." ? t.replace(".", n) : t;
|
|
1385
1382
|
}
|
|
1386
|
-
function
|
|
1383
|
+
function me(e) {
|
|
1387
1384
|
if (e == null || e === "") return "";
|
|
1388
1385
|
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
1386
|
let t = String(e), n = /^(\d{4}-\d{2}-\d{2})(?:$|T)/.exec(t);
|
|
1390
1387
|
return n ? n[1] : t;
|
|
1391
1388
|
}
|
|
1392
|
-
function
|
|
1389
|
+
function he(e) {
|
|
1393
1390
|
if (e == null || e === "") return "";
|
|
1394
1391
|
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
1392
|
if (n) return `${n[1]} ${n[2]}`;
|
|
@@ -1399,8 +1396,23 @@ function me(e) {
|
|
|
1399
1396
|
return `${r.getFullYear()}-${i(r.getMonth() + 1)}-${i(r.getDate())} ${i(r.getHours())}:${i(r.getMinutes())}`;
|
|
1400
1397
|
}
|
|
1401
1398
|
//#endregion
|
|
1399
|
+
//#region src/export/values.ts
|
|
1400
|
+
function j(e, t) {
|
|
1401
|
+
let n = e[t.key];
|
|
1402
|
+
return t.exportValue ? t.exportValue(n, e) : n;
|
|
1403
|
+
}
|
|
1404
|
+
function M(e, t) {
|
|
1405
|
+
if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : e;
|
|
1406
|
+
if (typeof e != "string" || t.type !== "date" && t.type !== "datetime") return null;
|
|
1407
|
+
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);
|
|
1408
|
+
return Number.isNaN(r.getTime()) ? null : r;
|
|
1409
|
+
}
|
|
1410
|
+
function ge(e) {
|
|
1411
|
+
return (Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()) - Date.UTC(1899, 11, 30)) / 864e5;
|
|
1412
|
+
}
|
|
1413
|
+
//#endregion
|
|
1402
1414
|
//#region src/export/xlsx-writer.ts
|
|
1403
|
-
var
|
|
1415
|
+
var _e = (() => {
|
|
1404
1416
|
let e = /* @__PURE__ */ new Uint32Array(256);
|
|
1405
1417
|
for (let t = 0; t < 256; t++) {
|
|
1406
1418
|
let n = t;
|
|
@@ -1409,23 +1421,23 @@ var he = (() => {
|
|
|
1409
1421
|
}
|
|
1410
1422
|
return e;
|
|
1411
1423
|
})();
|
|
1412
|
-
function
|
|
1424
|
+
function ve(e) {
|
|
1413
1425
|
let t = 4294967295;
|
|
1414
|
-
for (let n = 0; n < e.length; n++) t =
|
|
1426
|
+
for (let n = 0; n < e.length; n++) t = _e[(t ^ e[n]) & 255] ^ t >>> 8;
|
|
1415
1427
|
return (t ^ 4294967295) >>> 0;
|
|
1416
1428
|
}
|
|
1417
|
-
var
|
|
1418
|
-
function
|
|
1419
|
-
return
|
|
1429
|
+
var N = new TextEncoder();
|
|
1430
|
+
function ye(e) {
|
|
1431
|
+
return P(e.map((e) => ({
|
|
1420
1432
|
...e,
|
|
1421
1433
|
body: e.data,
|
|
1422
1434
|
method: 0
|
|
1423
1435
|
})));
|
|
1424
1436
|
}
|
|
1425
|
-
async function
|
|
1437
|
+
async function be(e) {
|
|
1426
1438
|
let t = [];
|
|
1427
1439
|
for (let n of e) {
|
|
1428
|
-
let e = await
|
|
1440
|
+
let e = await xe(n.data);
|
|
1429
1441
|
t.push(e.length < n.data.length ? {
|
|
1430
1442
|
...n,
|
|
1431
1443
|
body: e,
|
|
@@ -1436,9 +1448,9 @@ async function ve(e) {
|
|
|
1436
1448
|
method: 0
|
|
1437
1449
|
});
|
|
1438
1450
|
}
|
|
1439
|
-
return
|
|
1451
|
+
return P(t);
|
|
1440
1452
|
}
|
|
1441
|
-
async function
|
|
1453
|
+
async function xe(e) {
|
|
1442
1454
|
let t = new CompressionStream("deflate-raw"), n = t.writable.getWriter(), r = t.readable.getReader();
|
|
1443
1455
|
n.write(e), n.close();
|
|
1444
1456
|
let i = [];
|
|
@@ -1447,52 +1459,50 @@ async function ye(e) {
|
|
|
1447
1459
|
if (e) break;
|
|
1448
1460
|
i.push(t);
|
|
1449
1461
|
}
|
|
1450
|
-
return
|
|
1462
|
+
return F(i);
|
|
1451
1463
|
}
|
|
1452
|
-
function
|
|
1464
|
+
function P(e) {
|
|
1453
1465
|
let t = [], n = [], r = 0;
|
|
1454
1466
|
for (let i of e) {
|
|
1455
|
-
let e =
|
|
1467
|
+
let e = N.encode(i.name), a = ve(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
1468
|
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
1469
|
let d = new ArrayBuffer(46 + e.length), f = new DataView(d);
|
|
1458
1470
|
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
1471
|
}
|
|
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),
|
|
1472
|
+
let i = F(n), a = /* @__PURE__ */ new ArrayBuffer(22), o = new DataView(a);
|
|
1473
|
+
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), F([
|
|
1462
1474
|
...t,
|
|
1463
1475
|
i,
|
|
1464
1476
|
new Uint8Array(a)
|
|
1465
1477
|
]);
|
|
1466
1478
|
}
|
|
1467
|
-
function
|
|
1479
|
+
function F(e) {
|
|
1468
1480
|
let t = e.reduce((e, t) => e + t.length, 0), n = new Uint8Array(t), r = 0;
|
|
1469
1481
|
for (let t of e) n.set(t, r), r += t.length;
|
|
1470
1482
|
return n;
|
|
1471
1483
|
}
|
|
1472
|
-
function
|
|
1484
|
+
function I(e) {
|
|
1473
1485
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1474
1486
|
}
|
|
1475
|
-
function
|
|
1487
|
+
function Se(e) {
|
|
1476
1488
|
let t = "";
|
|
1477
1489
|
for (e++; e > 0;) t = String.fromCharCode(64 + (e % 26 || 26)) + t, e = Math.floor((e - 1) / 26);
|
|
1478
1490
|
return t;
|
|
1479
1491
|
}
|
|
1480
|
-
function
|
|
1481
|
-
return
|
|
1482
|
-
}
|
|
1483
|
-
function xe(e) {
|
|
1484
|
-
let t = Date.UTC(1899, 11, 30);
|
|
1485
|
-
return (e.getTime() - t) / 864e5;
|
|
1492
|
+
function L(e, t) {
|
|
1493
|
+
return Se(t) + (e + 1);
|
|
1486
1494
|
}
|
|
1487
|
-
var
|
|
1488
|
-
function
|
|
1489
|
-
let n = [], r = t.map((e, t) => `<c r="${
|
|
1495
|
+
var Ce = "<?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>", we = "<?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>", Te = "<?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>", Ee = "<?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>", De = "<?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>";
|
|
1496
|
+
function Oe(e, t) {
|
|
1497
|
+
let n = [], r = t.map((e, t) => `<c r="${L(0, t)}" t="str" s="2"><v>${I(e.label)}</v></c>`);
|
|
1490
1498
|
return n.push(`<row r="1">${r.join("")}</row>`), e.forEach((e, r) => {
|
|
1491
1499
|
let i = t.map((t, n) => {
|
|
1492
|
-
let i =
|
|
1500
|
+
let i = L(r + 1, n), a = j(e, t);
|
|
1493
1501
|
if (a == null) return `<c r="${i}" t="str"><v></v></c>`;
|
|
1494
1502
|
let o = t.type ?? "text";
|
|
1495
|
-
|
|
1503
|
+
if (o === "number" && typeof a == "number") return `<c r="${i}"><v>${a}</v></c>`;
|
|
1504
|
+
let s = M(a, t);
|
|
1505
|
+
return s ? `<c r="${i}" s="1"><v>${ge(s).toFixed(6)}</v></c>` : o === "boolean" ? `<c r="${i}" t="b"><v>${+!!a}</v></c>` : `<c r="${i}" t="str"><v>${I(String(a))}</v></c>`;
|
|
1496
1506
|
});
|
|
1497
1507
|
n.push(`<row r="${r + 2}">${i.join("")}</row>`);
|
|
1498
1508
|
}), `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -1500,104 +1510,106 @@ function De(e, t) {
|
|
|
1500
1510
|
<sheetData>${n.join("")}</sheetData>
|
|
1501
1511
|
</worksheet>`;
|
|
1502
1512
|
}
|
|
1503
|
-
function Oe(e, t) {
|
|
1504
|
-
return _e(L(e, t));
|
|
1505
|
-
}
|
|
1506
1513
|
function ke(e, t) {
|
|
1507
|
-
return
|
|
1514
|
+
return ye(R(e, t));
|
|
1508
1515
|
}
|
|
1509
|
-
function
|
|
1510
|
-
|
|
1516
|
+
function Ae(e, t) {
|
|
1517
|
+
return be(R(e, t));
|
|
1518
|
+
}
|
|
1519
|
+
function R(e, t) {
|
|
1520
|
+
let n = Oe(e, t);
|
|
1511
1521
|
return [
|
|
1512
1522
|
{
|
|
1513
1523
|
name: "[Content_Types].xml",
|
|
1514
|
-
data:
|
|
1524
|
+
data: N.encode(Ce)
|
|
1515
1525
|
},
|
|
1516
1526
|
{
|
|
1517
1527
|
name: "_rels/.rels",
|
|
1518
|
-
data:
|
|
1528
|
+
data: N.encode(we)
|
|
1519
1529
|
},
|
|
1520
1530
|
{
|
|
1521
1531
|
name: "xl/workbook.xml",
|
|
1522
|
-
data:
|
|
1532
|
+
data: N.encode(Te)
|
|
1523
1533
|
},
|
|
1524
1534
|
{
|
|
1525
1535
|
name: "xl/_rels/workbook.xml.rels",
|
|
1526
|
-
data:
|
|
1536
|
+
data: N.encode(Ee)
|
|
1527
1537
|
},
|
|
1528
1538
|
{
|
|
1529
1539
|
name: "xl/worksheets/sheet1.xml",
|
|
1530
|
-
data:
|
|
1540
|
+
data: N.encode(n)
|
|
1531
1541
|
},
|
|
1532
1542
|
{
|
|
1533
1543
|
name: "xl/styles.xml",
|
|
1534
|
-
data:
|
|
1544
|
+
data: N.encode(De)
|
|
1535
1545
|
}
|
|
1536
1546
|
];
|
|
1537
1547
|
}
|
|
1538
1548
|
//#endregion
|
|
1539
1549
|
//#region src/export/export.ts
|
|
1540
|
-
|
|
1550
|
+
var je = "";
|
|
1551
|
+
function z(e, t, n, r = {}) {
|
|
1552
|
+
let i = r.bom ? je : "";
|
|
1541
1553
|
switch (n) {
|
|
1542
|
-
case "csv": return
|
|
1543
|
-
case "tsv": return
|
|
1544
|
-
case "json": return
|
|
1545
|
-
case "xlsx": return
|
|
1554
|
+
case "csv": return i + V(e, t, ",");
|
|
1555
|
+
case "tsv": return i + V(e, t, " ");
|
|
1556
|
+
case "json": return Ne(e, t);
|
|
1557
|
+
case "xlsx": return ke(e, t);
|
|
1546
1558
|
}
|
|
1547
1559
|
}
|
|
1548
|
-
async function
|
|
1549
|
-
let
|
|
1550
|
-
return new Blob([
|
|
1560
|
+
async function B(e, t, n, r = {}) {
|
|
1561
|
+
let i = n === "xlsx" ? await Ae(e, t) : z(e, t, n, r);
|
|
1562
|
+
return new Blob([i], { type: Ie(n) });
|
|
1551
1563
|
}
|
|
1552
|
-
function
|
|
1553
|
-
return e == null ? "" :
|
|
1564
|
+
function Me(e) {
|
|
1565
|
+
return e == null ? "" : e instanceof Date ? e.toISOString() : String(e);
|
|
1554
1566
|
}
|
|
1555
|
-
function
|
|
1556
|
-
return [t.map((e) =>
|
|
1567
|
+
function V(e, t, n) {
|
|
1568
|
+
return [t.map((e) => H(e.label, n)).join(n), ...e.map((e) => t.map((t) => H(Me(j(e, t)), n)).join(n))].join("\n");
|
|
1557
1569
|
}
|
|
1558
|
-
function
|
|
1570
|
+
function H(e, t) {
|
|
1559
1571
|
return e.includes(t) || e.includes("\"") || e.includes("\n") || e.includes("\r") ? "\"" + e.replace(/"/g, "\"\"") + "\"" : e;
|
|
1560
1572
|
}
|
|
1561
|
-
function
|
|
1573
|
+
function Ne(e, t) {
|
|
1562
1574
|
let n = e.map((e) => {
|
|
1563
1575
|
let n = {};
|
|
1564
1576
|
for (let r of t) {
|
|
1565
|
-
let t = e
|
|
1566
|
-
|
|
1577
|
+
let t = j(e, r);
|
|
1578
|
+
n[r.key] = t instanceof Date ? M(t, r)?.toISOString() ?? null : t ?? null;
|
|
1567
1579
|
}
|
|
1568
1580
|
return n;
|
|
1569
1581
|
});
|
|
1570
1582
|
return JSON.stringify(n, null, 2);
|
|
1571
1583
|
}
|
|
1572
|
-
function
|
|
1584
|
+
function U(e, t) {
|
|
1573
1585
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
1574
1586
|
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
1587
|
}
|
|
1576
|
-
var
|
|
1588
|
+
var Pe = {
|
|
1577
1589
|
csv: "text/csv;charset=utf-8",
|
|
1578
1590
|
tsv: "text/tab-separated-values;charset=utf-8",
|
|
1579
1591
|
json: "application/json;charset=utf-8",
|
|
1580
1592
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
1581
|
-
},
|
|
1593
|
+
}, Fe = {
|
|
1582
1594
|
csv: ".csv",
|
|
1583
1595
|
tsv: ".tsv",
|
|
1584
1596
|
json: ".json",
|
|
1585
1597
|
xlsx: ".xlsx"
|
|
1586
1598
|
};
|
|
1587
|
-
function
|
|
1588
|
-
return
|
|
1599
|
+
function Ie(e) {
|
|
1600
|
+
return Pe[e];
|
|
1589
1601
|
}
|
|
1590
|
-
function
|
|
1591
|
-
return
|
|
1602
|
+
function Le(e) {
|
|
1603
|
+
return Fe[e];
|
|
1592
1604
|
}
|
|
1593
1605
|
//#endregion
|
|
1594
1606
|
//#region src/export/xlsx-reader.ts
|
|
1595
|
-
function
|
|
1607
|
+
function Re(e) {
|
|
1596
1608
|
for (let t = e.byteLength - 22; t >= 0; t--) if (e.getUint32(t, !0) === 101010256) return t;
|
|
1597
1609
|
throw Error("XLSX: End of central directory not found — not a valid ZIP file");
|
|
1598
1610
|
}
|
|
1599
|
-
function
|
|
1600
|
-
let t =
|
|
1611
|
+
function ze(e) {
|
|
1612
|
+
let t = Re(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
1613
|
for (; o < s && e.getUint32(o, !0) === 33639248;) {
|
|
1602
1614
|
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
1615
|
a.push({
|
|
@@ -1610,7 +1622,7 @@ function Le(e) {
|
|
|
1610
1622
|
}
|
|
1611
1623
|
return a;
|
|
1612
1624
|
}
|
|
1613
|
-
async function
|
|
1625
|
+
async function Be(e) {
|
|
1614
1626
|
let t = new DecompressionStream("deflate-raw"), n = t.writable.getWriter(), r = t.readable.getReader();
|
|
1615
1627
|
n.write(e), n.close();
|
|
1616
1628
|
let i = [];
|
|
@@ -1623,28 +1635,28 @@ async function Re(e) {
|
|
|
1623
1635
|
for (let e of i) o.set(e, s), s += e.length;
|
|
1624
1636
|
return o;
|
|
1625
1637
|
}
|
|
1626
|
-
async function
|
|
1638
|
+
async function Ve(e, t) {
|
|
1627
1639
|
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
1640
|
if (t.compressionMethod === 0) return o.slice();
|
|
1629
|
-
if (t.compressionMethod === 8) return
|
|
1641
|
+
if (t.compressionMethod === 8) return Be(o);
|
|
1630
1642
|
throw Error(`XLSX: Unsupported compression method ${t.compressionMethod}`);
|
|
1631
1643
|
}
|
|
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
|
|
1644
|
+
async function He(e) {
|
|
1645
|
+
let t = new DataView(e), n = ze(t), r = /* @__PURE__ */ new Map();
|
|
1646
|
+
for (let e of n) e.compressedSize === 0 && e.name.endsWith("/") || r.set(e.name, await Ve(t, e));
|
|
1635
1647
|
return r;
|
|
1636
1648
|
}
|
|
1637
|
-
var
|
|
1638
|
-
function
|
|
1639
|
-
let t =
|
|
1649
|
+
var Ue = new TextDecoder("utf-8");
|
|
1650
|
+
function W(e) {
|
|
1651
|
+
let t = Ue.decode(e);
|
|
1640
1652
|
return new DOMParser().parseFromString(t, "application/xml");
|
|
1641
1653
|
}
|
|
1642
|
-
function
|
|
1654
|
+
function We(e) {
|
|
1643
1655
|
if (!e) return [];
|
|
1644
|
-
let t =
|
|
1656
|
+
let t = W(e);
|
|
1645
1657
|
return Array.from(t.querySelectorAll("si")).map((e) => Array.from(e.querySelectorAll("t")).map((e) => e.textContent ?? "").join(""));
|
|
1646
1658
|
}
|
|
1647
|
-
var
|
|
1659
|
+
var Ge = /* @__PURE__ */ new Set([
|
|
1648
1660
|
14,
|
|
1649
1661
|
15,
|
|
1650
1662
|
16,
|
|
@@ -1664,37 +1676,37 @@ var Ue = /* @__PURE__ */ new Set([
|
|
|
1664
1676
|
57,
|
|
1665
1677
|
58
|
|
1666
1678
|
]);
|
|
1667
|
-
function
|
|
1679
|
+
function Ke(e) {
|
|
1668
1680
|
let t = e.replace(/"[^"]*"/g, "").replace(/\\./g, "").replace(/\[[^\]]*\]/g, "").split(";")[0];
|
|
1669
1681
|
return /[dy]/i.test(t);
|
|
1670
1682
|
}
|
|
1671
|
-
function
|
|
1683
|
+
function qe(e) {
|
|
1672
1684
|
let t = /* @__PURE__ */ new Set();
|
|
1673
1685
|
if (!e) return t;
|
|
1674
|
-
let n =
|
|
1686
|
+
let n = W(e), r = /* @__PURE__ */ new Map();
|
|
1675
1687
|
for (let e of Array.from(n.querySelectorAll("numFmts > numFmt"))) r.set(parseInt(e.getAttribute("numFmtId") ?? "", 10), e.getAttribute("formatCode") ?? "");
|
|
1676
1688
|
return Array.from(n.querySelectorAll("cellXfs > xf")).forEach((e, n) => {
|
|
1677
1689
|
let i = parseInt(e.getAttribute("numFmtId") ?? "0", 10), a = r.get(i);
|
|
1678
|
-
(a === void 0 ?
|
|
1690
|
+
(a === void 0 ? Ge.has(i) : Ke(a)) && t.add(n);
|
|
1679
1691
|
}), t;
|
|
1680
1692
|
}
|
|
1681
|
-
function
|
|
1693
|
+
function Je(e) {
|
|
1682
1694
|
if (!e) return !1;
|
|
1683
|
-
let t =
|
|
1695
|
+
let t = W(e).querySelector("workbookPr")?.getAttribute("date1904");
|
|
1684
1696
|
return t === "1" || t === "true";
|
|
1685
1697
|
}
|
|
1686
|
-
function
|
|
1698
|
+
function Ye(e, t) {
|
|
1687
1699
|
return new Date((t ? Date.UTC(1904, 0, 1) : Date.UTC(1899, 11, 30)) + Math.floor(e) * 864e5).toISOString().slice(0, 10);
|
|
1688
1700
|
}
|
|
1689
|
-
function
|
|
1690
|
-
let i =
|
|
1701
|
+
function Xe(e, t, n, r) {
|
|
1702
|
+
let i = W(e).querySelectorAll("row");
|
|
1691
1703
|
if (i.length === 0) return [];
|
|
1692
1704
|
let a = 0, o = /* @__PURE__ */ new Map();
|
|
1693
1705
|
for (let e of i) {
|
|
1694
1706
|
let i = parseInt(e.getAttribute("r") ?? "1", 10) - 1, s = /* @__PURE__ */ new Map();
|
|
1695
1707
|
o.set(i, s);
|
|
1696
1708
|
for (let i of e.querySelectorAll("c")) {
|
|
1697
|
-
let e =
|
|
1709
|
+
let e = Ze(i.getAttribute("r") ?? "");
|
|
1698
1710
|
e > a && (a = e);
|
|
1699
1711
|
let o = i.getAttribute("t") ?? "", c = i.getAttribute("s") ?? "", l = i.querySelector("v")?.textContent ?? "", u = i.querySelector("is > t")?.textContent ?? null, d;
|
|
1700
1712
|
if (o === "s") d = t[parseInt(l, 10)] ?? "";
|
|
@@ -1703,7 +1715,7 @@ function Je(e, t, n, r) {
|
|
|
1703
1715
|
else if (l === "") d = "";
|
|
1704
1716
|
else {
|
|
1705
1717
|
let e = parseFloat(l);
|
|
1706
|
-
d = c !== "" && n.has(parseInt(c, 10)) && !isNaN(e) && e >= 0 ?
|
|
1718
|
+
d = c !== "" && n.has(parseInt(c, 10)) && !isNaN(e) && e >= 0 ? Ye(e, r) : l;
|
|
1707
1719
|
}
|
|
1708
1720
|
s.set(e, d);
|
|
1709
1721
|
}
|
|
@@ -1717,13 +1729,13 @@ function Je(e, t, n, r) {
|
|
|
1717
1729
|
}
|
|
1718
1730
|
return c;
|
|
1719
1731
|
}
|
|
1720
|
-
function
|
|
1732
|
+
function Ze(e) {
|
|
1721
1733
|
let t = 0, n = 0;
|
|
1722
1734
|
for (; n < e.length && e[n] >= "A" && e[n] <= "Z";) t = t * 26 + (e.charCodeAt(n) - 64), n++;
|
|
1723
1735
|
return t - 1;
|
|
1724
1736
|
}
|
|
1725
|
-
async function
|
|
1726
|
-
let t = await
|
|
1737
|
+
async function Qe(e) {
|
|
1738
|
+
let t = await He(e), n = We(t.get("xl/sharedStrings.xml")), r = t.get("xl/worksheets/sheet1.xml");
|
|
1727
1739
|
if (!r) {
|
|
1728
1740
|
for (let [e, n] of t) if (e.toLowerCase().includes("worksheets/sheet")) {
|
|
1729
1741
|
r = n;
|
|
@@ -1731,7 +1743,7 @@ async function Xe(e) {
|
|
|
1731
1743
|
}
|
|
1732
1744
|
}
|
|
1733
1745
|
if (!r) throw Error("XLSX: No worksheet found");
|
|
1734
|
-
let i =
|
|
1746
|
+
let i = qe(t.get("xl/styles.xml")), a = Je(t.get("xl/workbook.xml")), o = Xe(r, n, i, a);
|
|
1735
1747
|
return o.length === 0 ? {
|
|
1736
1748
|
headers: [],
|
|
1737
1749
|
rows: []
|
|
@@ -1742,12 +1754,12 @@ async function Xe(e) {
|
|
|
1742
1754
|
}
|
|
1743
1755
|
//#endregion
|
|
1744
1756
|
//#region src/models/types.ts
|
|
1745
|
-
function
|
|
1757
|
+
function G(e) {
|
|
1746
1758
|
return e.align ? e.align : e.type === "number" ? "end" : e.type === "boolean" ? "center" : "start";
|
|
1747
1759
|
}
|
|
1748
1760
|
//#endregion
|
|
1749
|
-
//#region \0@oxc-project+runtime@0.
|
|
1750
|
-
function
|
|
1761
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
1762
|
+
function K(e, t, n, r) {
|
|
1751
1763
|
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
1752
1764
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
1753
1765
|
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 +1767,16 @@ function G(e, t, n, r) {
|
|
|
1755
1767
|
}
|
|
1756
1768
|
//#endregion
|
|
1757
1769
|
//#region src/flex-table.ts
|
|
1758
|
-
var
|
|
1770
|
+
var q = {
|
|
1759
1771
|
eq: "=",
|
|
1760
1772
|
neq: "≠",
|
|
1761
1773
|
gt: ">",
|
|
1762
1774
|
lt: "<",
|
|
1763
1775
|
gte: "≥",
|
|
1764
1776
|
lte: "≤"
|
|
1765
|
-
},
|
|
1777
|
+
}, J = 120, Y = 40, X = 20, Z = 32, Q = 5, $e = 200, $ = class extends r {
|
|
1766
1778
|
constructor(...e) {
|
|
1767
|
-
super(...e), this.columns = [], this._data = [], this._inUndoRedo = !1, this.clearUndoOnDataChange = !1, this.clearSelectionOnDataChange = !1, this.rowKey = "_id", this._rowHeightFromCss =
|
|
1779
|
+
super(...e), this.columns = [], this._data = [], this._inUndoRedo = !1, this.clearUndoOnDataChange = !1, this.clearSelectionOnDataChange = !1, this.rowKey = "_id", this._rowHeightFromCss = Z, 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 ce(), this._editing = new le(), this._rowSelection = new ue(), 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
1780
|
!this._editorMoving && e.currentTarget?.isConnected && this._commitEdit();
|
|
1769
1781
|
}, this._warnedUnconstrained = !1, this._onHostFocus = (e) => {
|
|
1770
1782
|
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,11 +1788,7 @@ var K = {
|
|
|
1776
1788
|
if (t && (t === this || this.contains(t) || this.shadowRoot?.contains(t))) return;
|
|
1777
1789
|
let n = e.composedPath()[0];
|
|
1778
1790
|
requestAnimationFrame(() => {
|
|
1779
|
-
|
|
1780
|
-
this._syncGridFocus();
|
|
1781
|
-
return;
|
|
1782
|
-
}
|
|
1783
|
-
document.activeElement !== this && (this._focusedCellEl = null, this._hostTabIndexLowered && (this._hostTabIndexLowered = !1, this.tabIndex = 0));
|
|
1791
|
+
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
1792
|
});
|
|
1785
1793
|
}, this._hostTabIndexLowered = !1, this._onCommentPopupOutsideClick = () => {
|
|
1786
1794
|
this._commitCommentPopup();
|
|
@@ -1797,7 +1805,7 @@ var K = {
|
|
|
1797
1805
|
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
1806
|
}
|
|
1799
1807
|
get rowHeight() {
|
|
1800
|
-
let e = this._rowHeightExplicit ?? this._rowHeightFromCss ??
|
|
1808
|
+
let e = this._rowHeightExplicit ?? this._rowHeightFromCss ?? Z;
|
|
1801
1809
|
return Math.max(e, this._targetFloor);
|
|
1802
1810
|
}
|
|
1803
1811
|
set rowHeight(e) {
|
|
@@ -2168,17 +2176,20 @@ var K = {
|
|
|
2168
2176
|
}
|
|
2169
2177
|
exportToString(e, t) {
|
|
2170
2178
|
let n = this._exportSlice(t);
|
|
2171
|
-
return n ?
|
|
2179
|
+
return n ? z(n.rows, n.cols, e, { bom: t?.bom }) : "";
|
|
2172
2180
|
}
|
|
2173
2181
|
async exportToBlob(e, t) {
|
|
2174
2182
|
let n = this._exportSlice(t) ?? {
|
|
2175
2183
|
rows: [],
|
|
2176
2184
|
cols: []
|
|
2177
2185
|
};
|
|
2178
|
-
return
|
|
2186
|
+
return B(n.rows, n.cols, e, { bom: t?.bom });
|
|
2179
2187
|
}
|
|
2180
2188
|
async exportToFile(e, t, n) {
|
|
2181
|
-
|
|
2189
|
+
U(await this.exportToBlob(e, {
|
|
2190
|
+
...n,
|
|
2191
|
+
bom: n?.bom ?? !0
|
|
2192
|
+
}), t ?? `export${Le(e)}`);
|
|
2182
2193
|
}
|
|
2183
2194
|
_exportSlice(e) {
|
|
2184
2195
|
if (e && "rows" in e && e.rows) return {
|
|
@@ -2259,7 +2270,7 @@ var K = {
|
|
|
2259
2270
|
async importFromFile(e) {
|
|
2260
2271
|
let t = e.name.toLowerCase();
|
|
2261
2272
|
if (t.endsWith(".xlsx")) {
|
|
2262
|
-
let t = await
|
|
2273
|
+
let t = await Qe(await e.arrayBuffer());
|
|
2263
2274
|
this._applyImportedSheet(t);
|
|
2264
2275
|
} else if (t.endsWith(".csv") || t.endsWith(".tsv")) {
|
|
2265
2276
|
let t = await e.text(), n = g(t);
|
|
@@ -2273,7 +2284,7 @@ var K = {
|
|
|
2273
2284
|
let a = t.get(e);
|
|
2274
2285
|
if (!a) return;
|
|
2275
2286
|
let o = this.columns.find((e) => e.key === a);
|
|
2276
|
-
r[a] = o ?
|
|
2287
|
+
r[a] = o ? k(n[i] ?? "", o) : n[i] ?? null;
|
|
2277
2288
|
}), r;
|
|
2278
2289
|
}), r = [...this.data];
|
|
2279
2290
|
this.data = n, this._undo.push({
|
|
@@ -2294,7 +2305,7 @@ var K = {
|
|
|
2294
2305
|
let a = n.get(t);
|
|
2295
2306
|
if (!a) return;
|
|
2296
2307
|
let o = this.columns.find((e) => e.key === a);
|
|
2297
|
-
r[a] = o ?
|
|
2308
|
+
r[a] = o ? k(e[i] ?? "", o) : e[i] ?? null;
|
|
2298
2309
|
}), r;
|
|
2299
2310
|
}), i = [...this.data];
|
|
2300
2311
|
this.data = r, this._undo.push({
|
|
@@ -2343,8 +2354,8 @@ var K = {
|
|
|
2343
2354
|
return this._columnWidths.get(e);
|
|
2344
2355
|
}
|
|
2345
2356
|
_getColWidth(e) {
|
|
2346
|
-
let t = this._columnWidths.get(e.key) ?? e.width ??
|
|
2347
|
-
return Math.max(t, e.minWidth ??
|
|
2357
|
+
let t = this._columnWidths.get(e.key) ?? e.width ?? J;
|
|
2358
|
+
return Math.max(t, e.minWidth ?? Y);
|
|
2348
2359
|
}
|
|
2349
2360
|
get headerHeight() {
|
|
2350
2361
|
return this.rowHeight + 8;
|
|
@@ -2370,10 +2381,10 @@ var K = {
|
|
|
2370
2381
|
return Math.max(0, this._visibleRowCount - this._frozenRowCount) * this.rowHeight;
|
|
2371
2382
|
}
|
|
2372
2383
|
get visibleRange() {
|
|
2373
|
-
let e = this._frozenRowCount, t = e + Math.floor(Math.max(0, this._scrollTop) / this.rowHeight), n = Math.max(e, t -
|
|
2384
|
+
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;
|
|
2374
2385
|
return {
|
|
2375
2386
|
start: n,
|
|
2376
|
-
end: Math.min(this._visibleRowCount, t + i +
|
|
2387
|
+
end: Math.min(this._visibleRowCount, t + i + Q)
|
|
2377
2388
|
};
|
|
2378
2389
|
}
|
|
2379
2390
|
connectedCallback() {
|
|
@@ -2416,13 +2427,13 @@ var K = {
|
|
|
2416
2427
|
i = r;
|
|
2417
2428
|
break;
|
|
2418
2429
|
}
|
|
2419
|
-
i = Math.max(0, i -
|
|
2430
|
+
i = Math.max(0, i - Q);
|
|
2420
2431
|
let a = e.length;
|
|
2421
2432
|
for (let e = i; e < t.length; e++) if (t[e] > r) {
|
|
2422
2433
|
a = e;
|
|
2423
2434
|
break;
|
|
2424
2435
|
}
|
|
2425
|
-
return a = Math.min(e.length, a +
|
|
2436
|
+
return a = Math.min(e.length, a + Q), {
|
|
2426
2437
|
start: i,
|
|
2427
2438
|
end: a
|
|
2428
2439
|
};
|
|
@@ -2439,11 +2450,8 @@ var K = {
|
|
|
2439
2450
|
}
|
|
2440
2451
|
}
|
|
2441
2452
|
_recomputeView() {
|
|
2442
|
-
if (this.dataMode === "server") {
|
|
2443
|
-
|
|
2444
|
-
return;
|
|
2445
|
-
}
|
|
2446
|
-
if (this._filteredIndices = ue(this.data, this._filters, (e, t, n) => {
|
|
2453
|
+
if (this.dataMode === "server") this._filteredIndices = Array.from({ length: this.data.length }, (e, t) => t), this._sortedIndices = this._filteredIndices;
|
|
2454
|
+
else if (this._filteredIndices = de(this.data, this._filters, (e, t, n) => {
|
|
2447
2455
|
this._emit("filter-error", {
|
|
2448
2456
|
error: e,
|
|
2449
2457
|
row: t,
|
|
@@ -2480,17 +2488,13 @@ var K = {
|
|
|
2480
2488
|
if (e && t?.draft !== void 0) {
|
|
2481
2489
|
let n = t.draft;
|
|
2482
2490
|
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) {
|
|
2491
|
+
} else if (e && this.shadowRoot.activeElement !== e) {
|
|
2486
2492
|
if (e.localName === "u-date-picker") {
|
|
2487
2493
|
let t = e;
|
|
2488
2494
|
t.updateComplete.then(() => {
|
|
2489
2495
|
t.isConnected && this.shadowRoot.activeElement !== t && (t.focus(), t.shadowRoot?.querySelector("[part~=\"input\"]")?.select());
|
|
2490
2496
|
});
|
|
2491
|
-
|
|
2492
|
-
}
|
|
2493
|
-
e.focus(), e.type === "text" && e.select();
|
|
2497
|
+
} else e.focus(), e.type === "text" && e.select();
|
|
2494
2498
|
}
|
|
2495
2499
|
}
|
|
2496
2500
|
_measureViewport() {
|
|
@@ -2498,7 +2502,7 @@ var K = {
|
|
|
2498
2502
|
e !== this._viewportHeight && (this._viewportHeight = e), t !== this._viewportWidth && (this._viewportWidth = t), this._warnIfUnconstrained();
|
|
2499
2503
|
}
|
|
2500
2504
|
_warnIfUnconstrained() {
|
|
2501
|
-
this._warnedUnconstrained || process.env.NODE_ENV === "production" || this._visibleRowCount <
|
|
2505
|
+
this._warnedUnconstrained || process.env.NODE_ENV === "production" || this._visibleRowCount < $e || 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
2506
|
}
|
|
2503
2507
|
_onScroll() {
|
|
2504
2508
|
this._scrollTop = this.scrollTop, this._scrollLeft = this.scrollLeft;
|
|
@@ -2640,7 +2644,7 @@ var K = {
|
|
|
2640
2644
|
}
|
|
2641
2645
|
let t = this.shadowRoot?.querySelector(".ft-editor");
|
|
2642
2646
|
if (t) {
|
|
2643
|
-
let n =
|
|
2647
|
+
let n = k(t.value, e);
|
|
2644
2648
|
this._applyEdit(n);
|
|
2645
2649
|
} else this._cancelEdit();
|
|
2646
2650
|
}
|
|
@@ -2666,9 +2670,7 @@ var K = {
|
|
|
2666
2670
|
value: t,
|
|
2667
2671
|
error: n
|
|
2668
2672
|
});
|
|
2669
|
-
|
|
2670
|
-
}
|
|
2671
|
-
if (o.type === "number" && typeof t == "string" || o.type === "date" && typeof t == "string" && p(t) === null || o.type === "datetime" && typeof t == "string" && m(t) === null) {
|
|
2673
|
+
} else if (o.type === "number" && typeof t == "string" || o.type === "date" && typeof t == "string" && p(t) === null || o.type === "datetime" && typeof t == "string" && m(t) === null) {
|
|
2672
2674
|
let n = o.type === "number" ? "notANumber" : o.type === "date" ? "notADate" : "notADateTime", s = e(n);
|
|
2673
2675
|
this._markCellInvalid(i, o, () => e(n)), this._emit("validation-error", {
|
|
2674
2676
|
row: a,
|
|
@@ -2677,36 +2679,36 @@ var K = {
|
|
|
2677
2679
|
value: t,
|
|
2678
2680
|
error: s
|
|
2679
2681
|
});
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2682
|
+
} else {
|
|
2683
|
+
if (o.validator) {
|
|
2684
|
+
let e = o.validator(t, i, o);
|
|
2685
|
+
if (e) {
|
|
2686
|
+
this._markCellInvalid(i, o, e), this._emit("validation-error", {
|
|
2687
|
+
row: a,
|
|
2688
|
+
col: r,
|
|
2689
|
+
key: o.key,
|
|
2690
|
+
value: t,
|
|
2691
|
+
error: e
|
|
2692
|
+
});
|
|
2693
|
+
return;
|
|
2694
|
+
}
|
|
2693
2695
|
}
|
|
2696
|
+
i[o.key] = t, this._undo.push({
|
|
2697
|
+
label: "cell-edit",
|
|
2698
|
+
undo: () => {
|
|
2699
|
+
i[o.key] = s, this.requestUpdate();
|
|
2700
|
+
},
|
|
2701
|
+
redo: () => {
|
|
2702
|
+
i[o.key] = t, this.requestUpdate();
|
|
2703
|
+
}
|
|
2704
|
+
}), this.requestUpdate(), this._emit("cell-edit-commit", {
|
|
2705
|
+
row: a,
|
|
2706
|
+
col: r,
|
|
2707
|
+
key: o.key,
|
|
2708
|
+
oldValue: s,
|
|
2709
|
+
newValue: t
|
|
2710
|
+
}), this._dispatchUndoStateEvent();
|
|
2694
2711
|
}
|
|
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
2712
|
}
|
|
2711
2713
|
_cancelEdit() {
|
|
2712
2714
|
this._autocompleteState = null;
|
|
@@ -2719,7 +2721,7 @@ var K = {
|
|
|
2719
2721
|
_onEditorKeyDown(e) {
|
|
2720
2722
|
if (v(e)) return;
|
|
2721
2723
|
let t = e.currentTarget;
|
|
2722
|
-
if (!(t?.localName === "u-date-picker" && (e.composedPath().some((e) => e instanceof Element && e.part?.contains("popover")) || e.key === "Escape" &&
|
|
2724
|
+
if (!(t?.localName === "u-date-picker" && (e.composedPath().some((e) => e instanceof Element && e.part?.contains("popover")) || e.key === "Escape" && tt(t)))) {
|
|
2723
2725
|
if (this._autocompleteState && this._autocompleteState.candidates.length > 0) {
|
|
2724
2726
|
if (e.key === "ArrowDown") {
|
|
2725
2727
|
e.preventDefault(), e.stopPropagation();
|
|
@@ -2787,28 +2789,20 @@ var K = {
|
|
|
2787
2789
|
].includes(t) && this._handleCtrlKey(e)) return;
|
|
2788
2790
|
}
|
|
2789
2791
|
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)) {
|
|
2792
|
+
if (this._headerCol !== null) this._onHeaderKeyDown(e, t);
|
|
2793
|
+
else if (this._visibleRowCount === 0) [
|
|
2794
|
+
"ArrowDown",
|
|
2795
|
+
"ArrowUp",
|
|
2796
|
+
"ArrowLeft",
|
|
2797
|
+
"ArrowRight",
|
|
2798
|
+
"Home",
|
|
2799
|
+
"End"
|
|
2800
|
+
].includes(e.key) && (e.preventDefault(), this._headerCol = 0);
|
|
2801
|
+
else if ((e.key === "Enter" || e.key === "F2") && this._activeCell && !v(e)) {
|
|
2806
2802
|
e.preventDefault();
|
|
2807
2803
|
let n = t[this._activeCell.col];
|
|
2808
2804
|
n && this._isCellEditable(n) ? this._startEdit() : e.key === "Enter" && this._fireRowActivate(n, "keyboard");
|
|
2809
|
-
|
|
2810
|
-
}
|
|
2811
|
-
if (!this._selection.activeCell) {
|
|
2805
|
+
} else if (!this._selection.activeCell) {
|
|
2812
2806
|
if ([
|
|
2813
2807
|
"ArrowDown",
|
|
2814
2808
|
"ArrowUp",
|
|
@@ -2824,27 +2818,17 @@ var K = {
|
|
|
2824
2818
|
this._closeFindPanel(), e.preventDefault();
|
|
2825
2819
|
return;
|
|
2826
2820
|
}
|
|
2827
|
-
|
|
2828
|
-
}
|
|
2829
|
-
if (!this._handleCtrlKey(e) && !this._handleAltKey(e, t)) {
|
|
2821
|
+
} else if (!this._handleCtrlKey(e) && !this._handleAltKey(e, t)) {
|
|
2830
2822
|
if (e.key === " " && e.shiftKey && this.selectable && this._activeCell && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
2831
2823
|
e.preventDefault();
|
|
2832
2824
|
let t = this.data[this._toDataIndex(this._activeCell.row)];
|
|
2833
2825
|
if (!t) return;
|
|
2834
2826
|
let n = this.getRowId(t);
|
|
2835
2827
|
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) {
|
|
2828
|
+
} else if (this._activeCell && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
2839
2829
|
let e = t[this._activeCell.col];
|
|
2840
2830
|
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());
|
|
2831
|
+
} 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
2832
|
}
|
|
2849
2833
|
}
|
|
2850
2834
|
}
|
|
@@ -2855,7 +2839,7 @@ var K = {
|
|
|
2855
2839
|
case "ArrowLeft":
|
|
2856
2840
|
case "ArrowRight":
|
|
2857
2841
|
if (e.altKey) {
|
|
2858
|
-
e.preventDefault(), this._resizeColumnBy(r.key, e.key === "ArrowRight" ?
|
|
2842
|
+
e.preventDefault(), this._resizeColumnBy(r.key, e.key === "ArrowRight" ? X : -20);
|
|
2859
2843
|
return;
|
|
2860
2844
|
}
|
|
2861
2845
|
i = e.key === "ArrowLeft" ? Math.max(0, n - 1) : Math.min(t.length - 1, n + 1);
|
|
@@ -2930,12 +2914,12 @@ var K = {
|
|
|
2930
2914
|
if (!e.altKey || !this._activeCell || e.key !== "ArrowLeft" && e.key !== "ArrowRight") return !1;
|
|
2931
2915
|
e.preventDefault();
|
|
2932
2916
|
let n = t[this._activeCell.col];
|
|
2933
|
-
return n && this._resizeColumnBy(n.key, e.key === "ArrowRight" ?
|
|
2917
|
+
return n && this._resizeColumnBy(n.key, e.key === "ArrowRight" ? X : -20), !0;
|
|
2934
2918
|
}
|
|
2935
2919
|
_resizeColumnBy(e, t) {
|
|
2936
2920
|
let n = this.visibleColumns.findIndex((t) => t.key === e), r = this.visibleColumns[n];
|
|
2937
2921
|
if (!r) return;
|
|
2938
|
-
let i = this._columnWidths.get(r.key) ?? r.width ??
|
|
2922
|
+
let i = this._columnWidths.get(r.key) ?? r.width ?? J, a = r.minWidth ?? Y, o = Math.max(a, i + t);
|
|
2939
2923
|
this._columnWidths.set(r.key, o), this.requestUpdate(), this._emit("column-resize", {
|
|
2940
2924
|
key: r.key,
|
|
2941
2925
|
width: o,
|
|
@@ -2964,7 +2948,7 @@ var K = {
|
|
|
2964
2948
|
let e = this._selection.getEffectiveRange();
|
|
2965
2949
|
return e ? {
|
|
2966
2950
|
range: e,
|
|
2967
|
-
text:
|
|
2951
|
+
text: pe(this._sortedIndices.map((e) => this.data[e]), this.visibleColumns, e)
|
|
2968
2952
|
} : null;
|
|
2969
2953
|
}
|
|
2970
2954
|
async _copyFromMenu() {
|
|
@@ -3047,7 +3031,7 @@ var K = {
|
|
|
3047
3031
|
for (let a = 0; a < t[i].length; a++) {
|
|
3048
3032
|
let s = e.col + a;
|
|
3049
3033
|
if (s >= n.length) break;
|
|
3050
|
-
let c = n[s], l = this.data[o][c.key], u =
|
|
3034
|
+
let c = n[s], l = this.data[o][c.key], u = k(t[i][a], c);
|
|
3051
3035
|
this.data[o][c.key] = u, r.push({
|
|
3052
3036
|
row: o,
|
|
3053
3037
|
col: s,
|
|
@@ -3112,7 +3096,7 @@ var K = {
|
|
|
3112
3096
|
for (let r = e.startCol + 1; r <= e.endCol; r++) {
|
|
3113
3097
|
let e = t[r];
|
|
3114
3098
|
if (!e || !this._isCellEditable(e)) continue;
|
|
3115
|
-
let a =
|
|
3099
|
+
let a = k(o == null ? "" : String(o), e);
|
|
3116
3100
|
n.push({
|
|
3117
3101
|
row: i,
|
|
3118
3102
|
key: e.key,
|
|
@@ -3205,11 +3189,7 @@ var K = {
|
|
|
3205
3189
|
return;
|
|
3206
3190
|
}
|
|
3207
3191
|
let n = this.visibleColumns.indexOf(t);
|
|
3208
|
-
|
|
3209
|
-
this._selectColumn(n);
|
|
3210
|
-
return;
|
|
3211
|
-
}
|
|
3212
|
-
t.sortable !== !1 && this._toggleSort(t, e.shiftKey);
|
|
3192
|
+
e.ctrlKey || e.metaKey ? this._selectColumn(n) : t.sortable !== !1 && this._toggleSort(t, e.shiftKey);
|
|
3213
3193
|
}
|
|
3214
3194
|
_toggleSort(e, n) {
|
|
3215
3195
|
this._sortCriteria = t(this._sortCriteria, e.key, n), this.dataMode !== "server" && this._recomputeView(), this.requestUpdate(), this._emit("sort-change", { criteria: [...this._sortCriteria] });
|
|
@@ -3246,7 +3226,7 @@ var K = {
|
|
|
3246
3226
|
return Math.min(n, i);
|
|
3247
3227
|
}
|
|
3248
3228
|
_renderHeaderCell(t, n) {
|
|
3249
|
-
let r = t.sortable !== !1, i = this._sortCriteria.find((e) => e.key === t.key), s = this._sortCriteria.length > 1 ? this._sortCriteria.findIndex((e) => e.key === t.key) : -1, c = this._filters.some((e) => e.key === t.key), l = t.pinned === "left", u = t.pinned === "right", d = l || u, f = t.headerAlign ??
|
|
3229
|
+
let r = t.sortable !== !1, i = this._sortCriteria.find((e) => e.key === t.key), s = this._sortCriteria.length > 1 ? this._sortCriteria.findIndex((e) => e.key === t.key) : -1, c = this._filters.some((e) => e.key === t.key), l = t.pinned === "left", u = t.pinned === "right", d = l || u, f = t.headerAlign ?? G(t), p = [
|
|
3250
3230
|
"ft-header-cell",
|
|
3251
3231
|
r ? "ft-sortable" : "",
|
|
3252
3232
|
d ? "ft-pinned" : "",
|
|
@@ -3324,11 +3304,7 @@ var K = {
|
|
|
3324
3304
|
});
|
|
3325
3305
|
}
|
|
3326
3306
|
_onColumnMenuBtnClick(e, t) {
|
|
3327
|
-
|
|
3328
|
-
this._headerMenu = null;
|
|
3329
|
-
return;
|
|
3330
|
-
}
|
|
3331
|
-
this._openColumnMenu(t, e.currentTarget);
|
|
3307
|
+
e.preventDefault(), e.stopPropagation(), this._headerMenu?.key === t.key ? this._headerMenu = null : this._openColumnMenu(t, e.currentTarget);
|
|
3332
3308
|
}
|
|
3333
3309
|
_openColumnMenu(e, t = this._columnMenuButton(e.key)) {
|
|
3334
3310
|
let n = t?.getBoundingClientRect();
|
|
@@ -3421,7 +3397,7 @@ var K = {
|
|
|
3421
3397
|
${i.map((t) => l("show", e("showColumn", { header: t.label }), () => this._setColumnHidden(t.key, !1)))}
|
|
3422
3398
|
<div class="ft-header-menu-separator" role="separator"></div>
|
|
3423
3399
|
${l("autofit", e("autoFitWidth"), () => this._autoFitColumn(t))}
|
|
3424
|
-
${l("wider", e("wider"), () => this._resizeColumnBy(t,
|
|
3400
|
+
${l("wider", e("wider"), () => this._resizeColumnBy(t, X), !0)}
|
|
3425
3401
|
${l("narrower", e("narrower"), () => this._resizeColumnBy(t, -20), !0)}
|
|
3426
3402
|
</div>
|
|
3427
3403
|
`;
|
|
@@ -3526,15 +3502,9 @@ var K = {
|
|
|
3526
3502
|
}
|
|
3527
3503
|
_closeFilterDropdown(e = !0) {
|
|
3528
3504
|
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
|
-
}
|
|
3505
|
+
this._openFilterKey = null, e && t !== null && (this._headerCol === null ? this.updateComplete.then(() => {
|
|
3506
|
+
[...this.shadowRoot?.querySelectorAll(".ft-column-menu-btn") ?? []].find((e) => e.dataset.key === t)?.focus();
|
|
3507
|
+
}) : this.focus());
|
|
3538
3508
|
}
|
|
3539
3509
|
_onFilterDialogKeydown(e) {
|
|
3540
3510
|
if (e.key !== "Tab") return;
|
|
@@ -3640,11 +3610,8 @@ var K = {
|
|
|
3640
3610
|
}
|
|
3641
3611
|
_applyFilterForKey(e) {
|
|
3642
3612
|
let t = this._emptyFilterState.get(e);
|
|
3643
|
-
if (t)
|
|
3644
|
-
|
|
3645
|
-
return;
|
|
3646
|
-
}
|
|
3647
|
-
if (this._textFilterState.has(e)) this._applyTextFilter(e);
|
|
3613
|
+
if (t) this.setFilter(e, this._buildEmptyPredicate(t));
|
|
3614
|
+
else if (this._textFilterState.has(e)) this._applyTextFilter(e);
|
|
3648
3615
|
else if (this._numberFilterState.has(e)) {
|
|
3649
3616
|
let t = this._buildNumberPredicate(this._numberFilterState.get(e));
|
|
3650
3617
|
t ? this.setFilter(e, t) : this.removeFilter(e);
|
|
@@ -3730,11 +3697,11 @@ var K = {
|
|
|
3730
3697
|
@keydown=${(e) => {
|
|
3731
3698
|
e.key === "Escape" && this._closeFilterDropdown(), e.stopPropagation();
|
|
3732
3699
|
}}>
|
|
3733
|
-
${Object.keys(
|
|
3700
|
+
${Object.keys(q).map((e) => a`<option value=${e}>${q[e]}</option>`)}
|
|
3734
3701
|
</select>
|
|
3735
3702
|
<input class="ft-filter-input ft-num-cond-input" type="text" inputmode="decimal" placeholder=${e("valuePlaceholder")}
|
|
3736
3703
|
aria-label=${e("conditionValue", { n: n === "cond1" ? 1 : 2 })}
|
|
3737
|
-
.value=${r.text ?? (r.value == null ? "" :
|
|
3704
|
+
.value=${r.text ?? (r.value == null ? "" : A(r.value))}
|
|
3738
3705
|
aria-invalid=${r.text && r.value == null ? "true" : "false"}
|
|
3739
3706
|
@input=${(e) => {
|
|
3740
3707
|
let r = e.target.value, i = this._numberFilterState.get(t) ?? this._defaultNumState();
|
|
@@ -3794,7 +3761,7 @@ var K = {
|
|
|
3794
3761
|
}
|
|
3795
3762
|
_renderDateFilter(t) {
|
|
3796
3763
|
let n = t.type === "datetime", r = this._dateFilterState.get(t.key) ?? {}, i = (e) => e?.slice(0, 10), s = (e) => {
|
|
3797
|
-
e.key === "Escape" &&
|
|
3764
|
+
e.key === "Escape" && tt(e.currentTarget) || (e.stopPropagation(), e.key === "Escape" && this._closeFilterDropdown());
|
|
3798
3765
|
};
|
|
3799
3766
|
return a`
|
|
3800
3767
|
<div class="ft-filter-range ft-filter-range-dates">
|
|
@@ -3843,7 +3810,7 @@ var K = {
|
|
|
3843
3810
|
if (!n) return;
|
|
3844
3811
|
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
3812
|
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 ??
|
|
3813
|
+
let o = n.minWidth ?? Y, s = Math.max(o, i + 8);
|
|
3847
3814
|
this._columnWidths.set(n.key, s), this.requestUpdate(), this._emit("column-resize", {
|
|
3848
3815
|
key: n.key,
|
|
3849
3816
|
width: s,
|
|
@@ -3852,7 +3819,7 @@ var K = {
|
|
|
3852
3819
|
}
|
|
3853
3820
|
_onResizeStart(e, t) {
|
|
3854
3821
|
e.preventDefault(), e.stopPropagation();
|
|
3855
|
-
let n = this.visibleColumns[t], r = this._columnWidths.get(n.key) ?? n.width ??
|
|
3822
|
+
let n = this.visibleColumns[t], r = this._columnWidths.get(n.key) ?? n.width ?? J;
|
|
3856
3823
|
this._resizing = {
|
|
3857
3824
|
colIndex: t,
|
|
3858
3825
|
startX: e.clientX,
|
|
@@ -3860,13 +3827,13 @@ var K = {
|
|
|
3860
3827
|
};
|
|
3861
3828
|
let i = (e) => {
|
|
3862
3829
|
if (!this._resizing) return;
|
|
3863
|
-
let t = e.clientX - this._resizing.startX, r = n.minWidth ??
|
|
3830
|
+
let t = e.clientX - this._resizing.startX, r = n.minWidth ?? Y, i = Math.max(r, this._resizing.startWidth + t);
|
|
3864
3831
|
this._columnWidths.set(n.key, i), this.requestUpdate();
|
|
3865
3832
|
}, a = () => {
|
|
3866
3833
|
document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", o), this._resizeCleanup = null;
|
|
3867
3834
|
}, o = () => {
|
|
3868
3835
|
if (a(), this._resizing) {
|
|
3869
|
-
let e = this._columnWidths.get(n.key) ??
|
|
3836
|
+
let e = this._columnWidths.get(n.key) ?? J;
|
|
3870
3837
|
this._emit("column-resize", {
|
|
3871
3838
|
key: n.key,
|
|
3872
3839
|
width: e,
|
|
@@ -4104,11 +4071,7 @@ var K = {
|
|
|
4104
4071
|
});
|
|
4105
4072
|
}
|
|
4106
4073
|
_toggleFindPanel(e) {
|
|
4107
|
-
|
|
4108
|
-
this._closeFindPanel();
|
|
4109
|
-
return;
|
|
4110
|
-
}
|
|
4111
|
-
this._openFindPanel(e);
|
|
4074
|
+
this._findState?.mode === e ? this._closeFindPanel() : this._openFindPanel(e);
|
|
4112
4075
|
}
|
|
4113
4076
|
_openFindPanel(e) {
|
|
4114
4077
|
this._findState = {
|
|
@@ -4223,11 +4186,7 @@ var K = {
|
|
|
4223
4186
|
return a`
|
|
4224
4187
|
<div class="ft-find-panel"
|
|
4225
4188
|
@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());
|
|
4189
|
+
e.stopPropagation(), e.key === "Escape" ? this._closeFindPanel() : e.key === "Enter" && !v(e) && e.target instanceof HTMLInputElement && e.target.classList.contains("ft-find-input") && (e.shiftKey ? this._findPrev() : this._findNext());
|
|
4231
4190
|
}}>
|
|
4232
4191
|
<div class="ft-find-row">
|
|
4233
4192
|
<input class="ft-find-input" type="text" placeholder=${e("findPlaceholder")} aria-label=${e("findInput")}
|
|
@@ -4449,7 +4408,7 @@ var K = {
|
|
|
4449
4408
|
let v = s || l, y = this._isCellInvalid(e, t), b = (this._findState?.results ?? []).findIndex((e) => e.row === n && e.col === r), x = b >= 0, S = x && b === this._findState.currentIndex, C = [
|
|
4450
4409
|
"ft-cell",
|
|
4451
4410
|
`ft-type-${t.type ?? "text"}`,
|
|
4452
|
-
`ft-align-${
|
|
4411
|
+
`ft-align-${G(t)}`,
|
|
4453
4412
|
s ? "ft-active" : "",
|
|
4454
4413
|
l ? "ft-selected" : "",
|
|
4455
4414
|
f ? "ft-pinned" : "",
|
|
@@ -4485,7 +4444,7 @@ var K = {
|
|
|
4485
4444
|
let n = e[t.key], r = n == null ? "" : String(n);
|
|
4486
4445
|
if (t.type === "number") return a`
|
|
4487
4446
|
<input class="ft-editor ft-editor-number" type="text" inputmode="decimal" aria-label=${t.label}
|
|
4488
|
-
.value=${typeof n == "number" ?
|
|
4447
|
+
.value=${typeof n == "number" ? A(n) : r}
|
|
4489
4448
|
@keydown=${this._onEditorKeyDown}
|
|
4490
4449
|
@blur=${this._onEditorBlur}>
|
|
4491
4450
|
`;
|
|
@@ -4494,7 +4453,7 @@ var K = {
|
|
|
4494
4453
|
return a`
|
|
4495
4454
|
<u-date-picker class="ft-editor ft-editor-${t.type}" size="sm" aria-label=${t.label}
|
|
4496
4455
|
mode=${e ? "datetime" : "date"} ?confirm=${e}
|
|
4497
|
-
.value=${
|
|
4456
|
+
.value=${et(n, e)}
|
|
4498
4457
|
@keydown=${this._onEditorKeyDown}
|
|
4499
4458
|
@change=${() => this._commitEdit()}
|
|
4500
4459
|
@blur=${this._onEditorBlur}></u-date-picker>
|
|
@@ -4546,70 +4505,70 @@ var K = {
|
|
|
4546
4505
|
`;
|
|
4547
4506
|
}
|
|
4548
4507
|
};
|
|
4549
|
-
|
|
4508
|
+
K([c({ type: Array })], $.prototype, "columns", void 0), K([c({
|
|
4550
4509
|
type: Array,
|
|
4551
4510
|
hasChanged: () => !0
|
|
4552
|
-
})],
|
|
4511
|
+
})], $.prototype, "data", null), K([c({
|
|
4553
4512
|
type: Boolean,
|
|
4554
4513
|
attribute: "clear-undo-on-data-change"
|
|
4555
|
-
})],
|
|
4514
|
+
})], $.prototype, "clearUndoOnDataChange", void 0), K([c({
|
|
4556
4515
|
type: Boolean,
|
|
4557
4516
|
attribute: "clear-selection-on-data-change"
|
|
4558
|
-
})],
|
|
4517
|
+
})], $.prototype, "clearSelectionOnDataChange", void 0), K([c({ attribute: "row-key" })], $.prototype, "rowKey", void 0), K([c({
|
|
4559
4518
|
type: Number,
|
|
4560
4519
|
attribute: "row-height"
|
|
4561
|
-
})],
|
|
4520
|
+
})], $.prototype, "rowHeight", null), K([c({
|
|
4562
4521
|
type: Boolean,
|
|
4563
4522
|
attribute: "show-row-numbers"
|
|
4564
|
-
})],
|
|
4523
|
+
})], $.prototype, "showRowNumbers", void 0), K([c({
|
|
4565
4524
|
type: String,
|
|
4566
4525
|
reflect: !0
|
|
4567
|
-
})],
|
|
4526
|
+
})], $.prototype, "theme", void 0), K([c({
|
|
4568
4527
|
type: Number,
|
|
4569
4528
|
attribute: "max-rows"
|
|
4570
|
-
})],
|
|
4529
|
+
})], $.prototype, "maxRows", void 0), K([c({ type: Boolean })], $.prototype, "editable", void 0), K([c({
|
|
4571
4530
|
type: Boolean,
|
|
4572
4531
|
attribute: "show-filters"
|
|
4573
|
-
})],
|
|
4532
|
+
})], $.prototype, "showFilters", void 0), K([c({
|
|
4574
4533
|
type: Boolean,
|
|
4575
4534
|
attribute: "show-context-menu"
|
|
4576
|
-
})],
|
|
4535
|
+
})], $.prototype, "showContextMenu", void 0), K([c({
|
|
4577
4536
|
type: Number,
|
|
4578
4537
|
attribute: "frozen-rows"
|
|
4579
|
-
})],
|
|
4538
|
+
})], $.prototype, "frozenRows", void 0), K([c({
|
|
4580
4539
|
type: String,
|
|
4581
4540
|
attribute: "empty-message"
|
|
4582
|
-
})],
|
|
4541
|
+
})], $.prototype, "emptyMessage", void 0), K([c({
|
|
4583
4542
|
type: String,
|
|
4584
4543
|
attribute: "no-matching-message"
|
|
4585
|
-
})],
|
|
4544
|
+
})], $.prototype, "noMatchingMessage", void 0), K([c({ attribute: !1 })], $.prototype, "error", void 0), K([c({
|
|
4586
4545
|
type: Boolean,
|
|
4587
4546
|
reflect: !0
|
|
4588
|
-
})],
|
|
4547
|
+
})], $.prototype, "loading", void 0), K([c({
|
|
4589
4548
|
type: Boolean,
|
|
4590
4549
|
attribute: "import-enabled"
|
|
4591
|
-
})],
|
|
4550
|
+
})], $.prototype, "importEnabled", void 0), K([c({ type: Boolean })], $.prototype, "selectable", void 0), K([c({
|
|
4592
4551
|
type: String,
|
|
4593
4552
|
attribute: "selection-mode"
|
|
4594
|
-
})],
|
|
4553
|
+
})], $.prototype, "selectionMode", null), K([c({
|
|
4595
4554
|
type: String,
|
|
4596
4555
|
attribute: "data-mode"
|
|
4597
|
-
})],
|
|
4556
|
+
})], $.prototype, "dataMode", void 0), K([c({
|
|
4598
4557
|
type: Object,
|
|
4599
4558
|
attribute: "footer-data"
|
|
4600
|
-
})],
|
|
4559
|
+
})], $.prototype, "footerData", void 0), K([c({ attribute: !1 })], $.prototype, "stylesheets", void 0), K([c({
|
|
4601
4560
|
type: Number,
|
|
4602
4561
|
attribute: "max-undo-size"
|
|
4603
|
-
})],
|
|
4604
|
-
function
|
|
4562
|
+
})], $.prototype, "maxUndoSize", null), K([l()], $.prototype, "_scrollTop", void 0), K([l()], $.prototype, "_scrollLeft", void 0), K([l()], $.prototype, "_viewportHeight", void 0), K([l()], $.prototype, "_viewportWidth", void 0), K([l()], $.prototype, "_activeCell", void 0), K([l()], $.prototype, "_headerCol", void 0), K([l()], $.prototype, "_editingCell", void 0), K([l()], $.prototype, "_sortCriteria", void 0), K([l()], $.prototype, "_openFilterKey", void 0), K([l()], $.prototype, "_rowSelectionVersion", void 0), K([l()], $.prototype, "_autocompleteState", void 0), K([l()], $.prototype, "_headerMenu", void 0), K([l()], $.prototype, "_bodyContextMenu", void 0), K([l()], $.prototype, "_commentPopup", void 0), K([l()], $.prototype, "_isDragOver", void 0), $ = K([s("flex-table")], $);
|
|
4563
|
+
function et(e, t) {
|
|
4605
4564
|
if (t) {
|
|
4606
|
-
let t =
|
|
4565
|
+
let t = he(e);
|
|
4607
4566
|
return /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(t) ? t.replace(" ", "T") : void 0;
|
|
4608
4567
|
}
|
|
4609
|
-
let n =
|
|
4568
|
+
let n = me(e);
|
|
4610
4569
|
return /^\d{4}-\d{2}-\d{2}$/.test(n) ? n : void 0;
|
|
4611
4570
|
}
|
|
4612
|
-
function
|
|
4571
|
+
function tt(e) {
|
|
4613
4572
|
try {
|
|
4614
4573
|
return e.matches(":state(open)");
|
|
4615
4574
|
} catch {
|
|
@@ -4617,4 +4576,4 @@ function $(e) {
|
|
|
4617
4576
|
}
|
|
4618
4577
|
}
|
|
4619
4578
|
//#endregion
|
|
4620
|
-
export {
|
|
4579
|
+
export { B as a, D as c, z as i, G as n, O as o, U as r, ue as s, $ as t };
|