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