@iyulab/flex-table 0.45.0 → 0.47.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.
@@ -2,11 +2,12 @@ import { n as e, t } from "./sorting-CjfjRxwL.js";
2
2
  import { LitElement as n, css as r, html as i, nothing as a } from "lit";
3
3
  import { customElement as o, property as s, state as c } from "lit/decorators.js";
4
4
  import { Locale as l } from "@iyulab/components/dist/utilities/Locale.js";
5
- import { dateTextPattern as u, formatDate as d, formatNumber as f, parseDate as p, parseDateTime as m, parseNumber as h } from "@iyulab/components/dist/utilities/format.js";
6
- import { decodeTsv as g, encodeTsv as _ } from "@iyulab/components/dist/utilities/tsv.js";
7
- import { isImeComposing as v } from "@iyulab/components/dist/utilities/keyboard.js";
5
+ import { formatDate as u, formatNumber as d, parseDate as f, parseDateTime as p, parseNumber as m } from "@iyulab/components/dist/utilities/format.js";
6
+ import { decodeTsv as h, encodeTsv as g } from "@iyulab/components/dist/utilities/tsv.js";
7
+ import "@iyulab/components/dist/components/date-picker/UDatePicker.js";
8
+ import { isImeComposing as _ } from "@iyulab/components/dist/utilities/keyboard.js";
8
9
  //#region src/styles/flex-table.styles.ts
9
- var y = r`
10
+ var v = r`
10
11
  /* --- Theme Variables (Light defaults) --- */
11
12
  :host {
12
13
  --ft-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
@@ -306,6 +307,35 @@ var y = r`
306
307
 
307
308
  .ft-editor-number { text-align: right; }
308
309
 
310
+ /* 날짜 편집기(u-date-picker) — 텍스트 편집기와 같은 자리·여백·초점선으로 셀을 채운다. 테두리는
311
+ 셀의 것이고, 달력은 피커 자신의 팝오버다. */
312
+ u-date-picker.ft-editor {
313
+ display: block;
314
+ padding: 0;
315
+ background: none;
316
+ --u-date-picker-display: block;
317
+ --u-date-picker-width: 100%;
318
+ }
319
+ u-date-picker.ft-editor:focus { outline: none; }
320
+ u-date-picker.ft-editor:focus-within {
321
+ outline: 2px solid var(--ft-active-color);
322
+ outline-offset: -2px;
323
+ }
324
+ u-date-picker.ft-editor::part(field) { height: 100%; }
325
+ u-date-picker.ft-editor::part(container) {
326
+ height: 100%;
327
+ min-height: 0;
328
+ border: none;
329
+ border-radius: 0;
330
+ box-shadow: none;
331
+ background: var(--ft-editor-bg);
332
+ padding: var(--ft-cell-padding-block) var(--ft-cell-padding-inline);
333
+ }
334
+ u-date-picker.ft-editor::part(input) {
335
+ font: inherit;
336
+ color: var(--ft-text-color);
337
+ }
338
+
309
339
  select.ft-editor {
310
340
  cursor: pointer;
311
341
  padding: 4px 6px;
@@ -537,6 +567,19 @@ var y = r`
537
567
  width: 50%;
538
568
  }
539
569
 
570
+ /* Date bounds stack: side by side, half of the dropdown is narrower than a date (and far narrower
571
+ than a date and a time) plus the calendar button. */
572
+ .ft-filter-range-dates {
573
+ flex-direction: column;
574
+ gap: 6px;
575
+ }
576
+
577
+ .ft-filter-date {
578
+ display: block;
579
+ width: 100%;
580
+ min-width: 0;
581
+ }
582
+
540
583
  .ft-filter-actions {
541
584
  margin-top: 6px;
542
585
  text-align: right;
@@ -974,13 +1017,13 @@ var y = r`
974
1017
  `;
975
1018
  //#endregion
976
1019
  //#region src/renderers/format.ts
977
- function b(e, t) {
978
- return e == null ? "" : typeof t == "function" ? t(e) : x(t) ? C(e, t) : S(e, t);
1020
+ function y(e, t) {
1021
+ return e == null ? "" : typeof t == "function" ? t(e) : b(t) ? S(e, t) : x(e, t);
979
1022
  }
980
- function x(e) {
1023
+ function b(e) {
981
1024
  return /[yMdHhms]/.test(e);
982
1025
  }
983
- function S(e, t) {
1026
+ function x(e, t) {
984
1027
  let n = typeof e == "number" ? e : Number(e);
985
1028
  if (isNaN(n)) return String(e);
986
1029
  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, u = {
@@ -993,7 +1036,7 @@ function S(e, t) {
993
1036
  style: "percent"
994
1037
  }).format(n) : (d = new Intl.NumberFormat(l.get(), u).format(n), a && (d = a + d)), d + "";
995
1038
  }
996
- function C(e, t) {
1039
+ function S(e, t) {
997
1040
  let n;
998
1041
  if (e instanceof Date) n = e;
999
1042
  else if (typeof e == "string" || typeof e == "number") n = new Date(e);
@@ -1004,26 +1047,26 @@ function C(e, t) {
1004
1047
  }
1005
1048
  //#endregion
1006
1049
  //#region src/renderers/cell-renderer.ts
1007
- function w(e, t, n) {
1008
- return n.render ? n.render(e, t, n) : n.format ? typeof n.format == "function" ? n.format(e, t, n) : b(e, n.format) : T(e, n);
1050
+ function C(e, t, n) {
1051
+ return n.render ? n.render(e, t, n) : n.format ? typeof n.format == "function" ? n.format(e, t, n) : y(e, n.format) : w(e, n);
1009
1052
  }
1010
- function T(e, t) {
1053
+ function w(e, t) {
1011
1054
  if (e == null) return "";
1012
1055
  switch (t.type) {
1013
- case "number": return O(e);
1056
+ case "number": return D(e);
1014
1057
  case "boolean": return i`<span class="ft-bool">${e ? "✔" : ""}</span>`;
1015
- case "date": return ee(e);
1016
- case "datetime": return te(e);
1017
- case "select": return E(e, t);
1058
+ case "date": return O(e);
1059
+ case "datetime": return ee(e);
1060
+ case "select": return T(e, t);
1018
1061
  default: return String(e);
1019
1062
  }
1020
1063
  }
1021
- function E(e, t) {
1064
+ function T(e, t) {
1022
1065
  if (!t.options || t.options.length === 0 || typeof t.options[0] == "string") return e == null ? "" : String(e);
1023
1066
  let n = t.options.find((t) => t.value === e);
1024
1067
  return n ? n.label : e == null ? "" : String(e);
1025
1068
  }
1026
- var D = {
1069
+ var E = {
1027
1070
  year: "numeric",
1028
1071
  month: "numeric",
1029
1072
  day: "numeric",
@@ -1031,14 +1074,14 @@ var D = {
1031
1074
  minute: "numeric",
1032
1075
  second: "numeric"
1033
1076
  };
1077
+ function D(e) {
1078
+ return typeof e == "number" ? Number.isInteger(e) ? d(e) : d(e, { minimumFractionDigits: 1 }) : String(e);
1079
+ }
1034
1080
  function O(e) {
1035
- return typeof e == "number" ? Number.isInteger(e) ? f(e) : f(e, { minimumFractionDigits: 1 }) : String(e);
1081
+ return e instanceof Date || typeof e == "string" ? u(e) : String(e);
1036
1082
  }
1037
1083
  function ee(e) {
1038
- return e instanceof Date || typeof e == "string" ? d(e) : String(e);
1039
- }
1040
- function te(e) {
1041
- return e instanceof Date || typeof e == "string" ? d(e, D) : String(e);
1084
+ return e instanceof Date || typeof e == "string" ? u(e, E) : String(e);
1042
1085
  }
1043
1086
  //#endregion
1044
1087
  //#region src/locale.ts
@@ -1161,7 +1204,7 @@ k.register("en", {
1161
1204
  var A = (e, t) => k.text(e, t);
1162
1205
  //#endregion
1163
1206
  //#region src/core/selection.ts
1164
- function ne(e) {
1207
+ function te(e) {
1165
1208
  return {
1166
1209
  startRow: Math.min(e.startRow, e.endRow),
1167
1210
  startCol: Math.min(e.startCol, e.endCol),
@@ -1169,7 +1212,7 @@ function ne(e) {
1169
1212
  endCol: Math.max(e.startCol, e.endCol)
1170
1213
  };
1171
1214
  }
1172
- var re = class {
1215
+ var ne = class {
1173
1216
  constructor() {
1174
1217
  this.activeCell = null, this.rangeAnchor = null, this.range = null, this.extraRanges = [], this._rowCount = 0, this._colCount = 0;
1175
1218
  }
@@ -1196,7 +1239,7 @@ var re = class {
1196
1239
  return e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount ? this.activeCell : (!this.rangeAnchor && this.activeCell && (this.rangeAnchor = { ...this.activeCell }), this.activeCell = {
1197
1240
  row: e,
1198
1241
  col: t
1199
- }, this.rangeAnchor && (this.range = ne({
1242
+ }, this.rangeAnchor && (this.range = te({
1200
1243
  startRow: this.rangeAnchor.row,
1201
1244
  startCol: this.rangeAnchor.col,
1202
1245
  endRow: e,
@@ -1267,7 +1310,7 @@ var re = class {
1267
1310
  shiftMoveRight() {
1268
1311
  return this.activeCell ? this.setActiveWithRange(this.activeCell.row, this.activeCell.col + 1) : null;
1269
1312
  }
1270
- }, ie = class {
1313
+ }, re = class {
1271
1314
  constructor() {
1272
1315
  this.current = null;
1273
1316
  }
@@ -1349,7 +1392,7 @@ var re = class {
1349
1392
  };
1350
1393
  //#endregion
1351
1394
  //#region src/core/filtering.ts
1352
- function ae(e, t, n) {
1395
+ function ie(e, t, n) {
1353
1396
  if (t.length === 0) return Array.from({ length: e.length }, (e, t) => t);
1354
1397
  let r = [];
1355
1398
  for (let i = 0; i < e.length; i++) {
@@ -1368,9 +1411,9 @@ function ae(e, t, n) {
1368
1411
  }
1369
1412
  //#endregion
1370
1413
  //#region src/core/undo.ts
1371
- var oe = 100, M = class {
1414
+ var ae = 100, M = class {
1372
1415
  constructor() {
1373
- this._undoStack = [], this._redoStack = [], this._maxSize = oe;
1416
+ this._undoStack = [], this._redoStack = [], this._maxSize = ae;
1374
1417
  }
1375
1418
  get maxSize() {
1376
1419
  return this._maxSize;
@@ -1407,7 +1450,7 @@ var oe = 100, M = class {
1407
1450
  };
1408
1451
  //#endregion
1409
1452
  //#region src/clipboard/clipboard.ts
1410
- function se(e, t, n) {
1453
+ function oe(e, t, n) {
1411
1454
  let r = [];
1412
1455
  for (let i = n.startRow; i <= n.endRow; i++) {
1413
1456
  let a = e[i], o = [];
@@ -1417,24 +1460,24 @@ function se(e, t, n) {
1417
1460
  }
1418
1461
  r.push(o);
1419
1462
  }
1420
- return _(r);
1463
+ return g(r);
1421
1464
  }
1422
1465
  function N(e, t) {
1423
1466
  if (e === "") return null;
1424
1467
  switch (t.type) {
1425
1468
  case "number": {
1426
- let t = h(e);
1469
+ let t = m(e);
1427
1470
  if (t !== null) return t;
1428
1471
  let n = Number(e.trim());
1429
1472
  return e.trim() !== "" && Number.isFinite(n) ? n : e;
1430
1473
  }
1431
1474
  case "boolean": return e.toLowerCase() === "true" || e === "1";
1432
- case "date": return p(e) ?? e;
1433
- case "datetime": return m(e) ?? e;
1475
+ case "date": return f(e) ?? e;
1476
+ case "datetime": return p(e) ?? e;
1434
1477
  default: return e;
1435
1478
  }
1436
1479
  }
1437
- function P(e) {
1480
+ function se(e) {
1438
1481
  let t = String(e);
1439
1482
  if (!Number.isFinite(e) || t.includes("e")) return t;
1440
1483
  let n = new Intl.NumberFormat(l.get()).formatToParts(1.5).find((e) => e.type === "decimal")?.value;
@@ -1471,9 +1514,9 @@ function de(e) {
1471
1514
  for (let n = 0; n < e.length; n++) t = ue[(t ^ e[n]) & 255] ^ t >>> 8;
1472
1515
  return (t ^ 4294967295) >>> 0;
1473
1516
  }
1474
- var F = new TextEncoder();
1517
+ var P = new TextEncoder();
1475
1518
  function fe(e) {
1476
- return I(e.map((e) => ({
1519
+ return F(e.map((e) => ({
1477
1520
  ...e,
1478
1521
  body: e.data,
1479
1522
  method: 0
@@ -1493,7 +1536,7 @@ async function pe(e) {
1493
1536
  method: 0
1494
1537
  });
1495
1538
  }
1496
- return I(t);
1539
+ return F(t);
1497
1540
  }
1498
1541
  async function me(e) {
1499
1542
  let t = new CompressionStream("deflate-raw"), n = t.writable.getWriter(), r = t.readable.getReader();
@@ -1504,29 +1547,29 @@ async function me(e) {
1504
1547
  if (e) break;
1505
1548
  i.push(t);
1506
1549
  }
1507
- return L(i);
1550
+ return I(i);
1508
1551
  }
1509
- function I(e) {
1552
+ function F(e) {
1510
1553
  let t = [], n = [], r = 0;
1511
1554
  for (let i of e) {
1512
- let e = F.encode(i.name), a = de(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);
1555
+ let e = P.encode(i.name), a = de(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);
1513
1556
  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);
1514
1557
  let d = new ArrayBuffer(46 + e.length), f = new DataView(d);
1515
1558
  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;
1516
1559
  }
1517
- let i = L(n), a = /* @__PURE__ */ new ArrayBuffer(22), o = new DataView(a);
1518
- 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), L([
1560
+ let i = I(n), a = /* @__PURE__ */ new ArrayBuffer(22), o = new DataView(a);
1561
+ 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([
1519
1562
  ...t,
1520
1563
  i,
1521
1564
  new Uint8Array(a)
1522
1565
  ]);
1523
1566
  }
1524
- function L(e) {
1567
+ function I(e) {
1525
1568
  let t = e.reduce((e, t) => e + t.length, 0), n = new Uint8Array(t), r = 0;
1526
1569
  for (let t of e) n.set(t, r), r += t.length;
1527
1570
  return n;
1528
1571
  }
1529
- function R(e) {
1572
+ function L(e) {
1530
1573
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1531
1574
  }
1532
1575
  function he(e) {
@@ -1534,7 +1577,7 @@ function he(e) {
1534
1577
  for (e++; e > 0;) t = String.fromCharCode(64 + (e % 26 || 26)) + t, e = Math.floor((e - 1) / 26);
1535
1578
  return t;
1536
1579
  }
1537
- function z(e, t) {
1580
+ function R(e, t) {
1538
1581
  return he(t) + (e + 1);
1539
1582
  }
1540
1583
  function ge(e) {
@@ -1543,13 +1586,13 @@ function ge(e) {
1543
1586
  }
1544
1587
  var _e = "<?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>", ve = "<?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>", ye = "<?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>", be = "<?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>", xe = "<?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>";
1545
1588
  function Se(e, t) {
1546
- let n = [], r = t.map((e, t) => `<c r="${z(0, t)}" t="str" s="2"><v>${R(e.label)}</v></c>`);
1589
+ let n = [], r = t.map((e, t) => `<c r="${R(0, t)}" t="str" s="2"><v>${L(e.label)}</v></c>`);
1547
1590
  return n.push(`<row r="1">${r.join("")}</row>`), e.forEach((e, r) => {
1548
1591
  let i = t.map((t, n) => {
1549
- let i = z(r + 1, n), a = e[t.key];
1592
+ let i = R(r + 1, n), a = e[t.key];
1550
1593
  if (a == null) return `<c r="${i}" t="str"><v></v></c>`;
1551
1594
  let o = t.type ?? "text";
1552
- return o === "number" && typeof a == "number" ? `<c r="${i}"><v>${a}</v></c>` : (o === "date" || o === "datetime") && a instanceof Date ? `<c r="${i}" s="1"><v>${ge(a).toFixed(6)}</v></c>` : o === "boolean" ? `<c r="${i}" t="b"><v>${+!!a}</v></c>` : `<c r="${i}" t="str"><v>${R(String(a))}</v></c>`;
1595
+ return o === "number" && typeof a == "number" ? `<c r="${i}"><v>${a}</v></c>` : (o === "date" || o === "datetime") && a instanceof Date ? `<c r="${i}" s="1"><v>${ge(a).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>`;
1553
1596
  });
1554
1597
  n.push(`<row r="${r + 2}">${i.join("")}</row>`);
1555
1598
  }), `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
@@ -1558,61 +1601,61 @@ function Se(e, t) {
1558
1601
  </worksheet>`;
1559
1602
  }
1560
1603
  function Ce(e, t) {
1561
- return fe(B(e, t));
1604
+ return fe(z(e, t));
1562
1605
  }
1563
1606
  function we(e, t) {
1564
- return pe(B(e, t));
1607
+ return pe(z(e, t));
1565
1608
  }
1566
- function B(e, t) {
1609
+ function z(e, t) {
1567
1610
  let n = Se(e, t);
1568
1611
  return [
1569
1612
  {
1570
1613
  name: "[Content_Types].xml",
1571
- data: F.encode(_e)
1614
+ data: P.encode(_e)
1572
1615
  },
1573
1616
  {
1574
1617
  name: "_rels/.rels",
1575
- data: F.encode(ve)
1618
+ data: P.encode(ve)
1576
1619
  },
1577
1620
  {
1578
1621
  name: "xl/workbook.xml",
1579
- data: F.encode(ye)
1622
+ data: P.encode(ye)
1580
1623
  },
1581
1624
  {
1582
1625
  name: "xl/_rels/workbook.xml.rels",
1583
- data: F.encode(be)
1626
+ data: P.encode(be)
1584
1627
  },
1585
1628
  {
1586
1629
  name: "xl/worksheets/sheet1.xml",
1587
- data: F.encode(n)
1630
+ data: P.encode(n)
1588
1631
  },
1589
1632
  {
1590
1633
  name: "xl/styles.xml",
1591
- data: F.encode(xe)
1634
+ data: P.encode(xe)
1592
1635
  }
1593
1636
  ];
1594
1637
  }
1595
1638
  //#endregion
1596
1639
  //#region src/export/export.ts
1597
- function V(e, t, n) {
1640
+ function B(e, t, n) {
1598
1641
  switch (n) {
1599
- case "csv": return H(e, t, ",");
1600
- case "tsv": return H(e, t, " ");
1642
+ case "csv": return V(e, t, ",");
1643
+ case "tsv": return V(e, t, " ");
1601
1644
  case "json": return De(e, t);
1602
1645
  case "xlsx": return Ce(e, t);
1603
1646
  }
1604
1647
  }
1605
1648
  async function Te(e, t, n) {
1606
- let r = n === "xlsx" ? await we(e, t) : V(e, t, n);
1649
+ let r = n === "xlsx" ? await we(e, t) : B(e, t, n);
1607
1650
  return new Blob([r], { type: je(n) });
1608
1651
  }
1609
1652
  function Ee(e, t) {
1610
1653
  return e == null ? "" : (t.type === "date" || t.type === "datetime") && e instanceof Date ? e.toISOString() : String(e);
1611
1654
  }
1612
- function H(e, t, n) {
1613
- return [t.map((e) => U(e.label, n)).join(n), ...e.map((e) => t.map((t) => U(Ee(e[t.key], t), n)).join(n))].join("\n");
1655
+ function V(e, t, n) {
1656
+ return [t.map((e) => H(e.label, n)).join(n), ...e.map((e) => t.map((t) => H(Ee(e[t.key], t), n)).join(n))].join("\n");
1614
1657
  }
1615
- function U(e, t) {
1658
+ function H(e, t) {
1616
1659
  return e.includes(t) || e.includes("\"") || e.includes("\n") || e.includes("\r") ? "\"" + e.replace(/"/g, "\"\"") + "\"" : e;
1617
1660
  }
1618
1661
  function De(e, t) {
@@ -1692,13 +1735,13 @@ async function Le(e) {
1692
1735
  return r;
1693
1736
  }
1694
1737
  var Re = new TextDecoder("utf-8");
1695
- function W(e) {
1738
+ function U(e) {
1696
1739
  let t = Re.decode(e);
1697
1740
  return new DOMParser().parseFromString(t, "application/xml");
1698
1741
  }
1699
1742
  function ze(e) {
1700
1743
  if (!e) return [];
1701
- let t = W(e);
1744
+ let t = U(e);
1702
1745
  return Array.from(t.querySelectorAll("si")).map((e) => Array.from(e.querySelectorAll("t")).map((e) => e.textContent ?? "").join(""));
1703
1746
  }
1704
1747
  var Be = /* @__PURE__ */ new Set([
@@ -1728,7 +1771,7 @@ function Ve(e) {
1728
1771
  function He(e) {
1729
1772
  let t = /* @__PURE__ */ new Set();
1730
1773
  if (!e) return t;
1731
- let n = W(e), r = /* @__PURE__ */ new Map();
1774
+ let n = U(e), r = /* @__PURE__ */ new Map();
1732
1775
  for (let e of Array.from(n.querySelectorAll("numFmts > numFmt"))) r.set(parseInt(e.getAttribute("numFmtId") ?? "", 10), e.getAttribute("formatCode") ?? "");
1733
1776
  return Array.from(n.querySelectorAll("cellXfs > xf")).forEach((e, n) => {
1734
1777
  let i = parseInt(e.getAttribute("numFmtId") ?? "0", 10), a = r.get(i);
@@ -1737,14 +1780,14 @@ function He(e) {
1737
1780
  }
1738
1781
  function Ue(e) {
1739
1782
  if (!e) return !1;
1740
- let t = W(e).querySelector("workbookPr")?.getAttribute("date1904");
1783
+ let t = U(e).querySelector("workbookPr")?.getAttribute("date1904");
1741
1784
  return t === "1" || t === "true";
1742
1785
  }
1743
1786
  function We(e, t) {
1744
1787
  return new Date((t ? Date.UTC(1904, 0, 1) : Date.UTC(1899, 11, 30)) + Math.floor(e) * 864e5).toISOString().slice(0, 10);
1745
1788
  }
1746
1789
  function Ge(e, t, n, r) {
1747
- let i = W(e).querySelectorAll("row");
1790
+ let i = U(e).querySelectorAll("row");
1748
1791
  if (i.length === 0) return [];
1749
1792
  let a = 0, o = /* @__PURE__ */ new Map();
1750
1793
  for (let e of i) {
@@ -1799,12 +1842,12 @@ async function qe(e) {
1799
1842
  }
1800
1843
  //#endregion
1801
1844
  //#region src/models/types.ts
1802
- function G(e) {
1845
+ function W(e) {
1803
1846
  return e.align ? e.align : e.type === "number" ? "end" : e.type === "boolean" ? "center" : "start";
1804
1847
  }
1805
1848
  //#endregion
1806
1849
  //#region \0@oxc-project+runtime@0.152.0/helpers/esm/decorate.js
1807
- function K(e, t, n, r) {
1850
+ function G(e, t, n, r) {
1808
1851
  var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
1809
1852
  if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
1810
1853
  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);
@@ -1812,21 +1855,21 @@ function K(e, t, n, r) {
1812
1855
  }
1813
1856
  //#endregion
1814
1857
  //#region src/flex-table.ts
1815
- var q = {
1858
+ var K = {
1816
1859
  eq: "=",
1817
1860
  neq: "≠",
1818
1861
  gt: ">",
1819
1862
  lt: "<",
1820
1863
  gte: "≥",
1821
1864
  lte: "≤"
1822
- }, J = 120, Y = 40, X = 20, Z = 32, Q = 5, Je = 200, $ = class extends n {
1865
+ }, q = 120, J = 40, Y = 20, X = 32, Z = 5, Je = 200, Q = class extends n {
1823
1866
  constructor(...e) {
1824
- super(...e), this.columns = [], this._data = [], this._inUndoRedo = !1, this.clearUndoOnDataChange = !1, this.clearSelectionOnDataChange = !1, 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 = "No data", this.noMatchingMessage = "No matching data", 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._editingCell = null, this._sortCriteria = [], this._selection = new re(), this._editing = new ie(), this._rowSelection = new j(), this._undo = new M(), this._filters = [], this._filteredIndices = [], this._sortedIndices = [], this._openFilterKey = null, this._rowSelectionVersion = 0, this._lastCheckboxRowIndex = 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._warnedUnconstrained = !1, this._onCommentPopupOutsideClick = () => {
1867
+ super(...e), this.columns = [], this._data = [], this._inUndoRedo = !1, this.clearUndoOnDataChange = !1, this.clearSelectionOnDataChange = !1, this._rowHeightFromCss = X, 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 = "No data", this.noMatchingMessage = "No matching data", 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._editingCell = null, this._sortCriteria = [], this._selection = new ne(), this._editing = new re(), this._rowSelection = new j(), this._undo = new M(), this._filters = [], this._filteredIndices = [], this._sortedIndices = [], this._openFilterKey = null, this._rowSelectionVersion = 0, this._lastCheckboxRowIndex = 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._warnedUnconstrained = !1, this._onCommentPopupOutsideClick = () => {
1825
1868
  this._commitCommentPopup();
1826
1869
  }, 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();
1827
1870
  }
1828
1871
  static {
1829
- this.styles = y;
1872
+ this.styles = v;
1830
1873
  }
1831
1874
  get data() {
1832
1875
  return this._data;
@@ -1836,7 +1879,7 @@ var q = {
1836
1879
  this._data = e, n && !this._inUndoRedo && (this.clearUndoOnDataChange && this._undo.clear(), this.clearSelectionOnDataChange && this._rowSelection.selectedCount > 0 && (this._rowSelection.deselectAll(), this._rowSelectionVersion++, this._dispatchRowSelectionEvent())), this.requestUpdate("data", t);
1837
1880
  }
1838
1881
  get rowHeight() {
1839
- let e = this._rowHeightExplicit ?? this._rowHeightFromCss ?? Z;
1882
+ let e = this._rowHeightExplicit ?? this._rowHeightFromCss ?? X;
1840
1883
  return Math.max(e, this._targetFloor);
1841
1884
  }
1842
1885
  set rowHeight(e) {
@@ -2186,7 +2229,7 @@ var q = {
2186
2229
  }
2187
2230
  exportToString(e, t) {
2188
2231
  let n = this._exportSlice(t);
2189
- return n ? V(n.rows, n.cols, e) : "";
2232
+ return n ? B(n.rows, n.cols, e) : "";
2190
2233
  }
2191
2234
  async exportToBlob(e, t) {
2192
2235
  let n = this._exportSlice(t) ?? {
@@ -2272,7 +2315,7 @@ var q = {
2272
2315
  let t = await qe(await e.arrayBuffer());
2273
2316
  this._applyImportedSheet(t);
2274
2317
  } else if (t.endsWith(".csv") || t.endsWith(".tsv")) {
2275
- let t = await e.text(), n = g(t);
2318
+ let t = await e.text(), n = h(t);
2276
2319
  this._applyImportedRows(n);
2277
2320
  } else console.warn(`flex-table importFromFile: unsupported file type "${e.name}"`);
2278
2321
  }
@@ -2361,8 +2404,8 @@ var q = {
2361
2404
  return this._columnWidths.get(e);
2362
2405
  }
2363
2406
  _getColWidth(e) {
2364
- let t = this._columnWidths.get(e.key) ?? e.width ?? J;
2365
- return Math.max(t, e.minWidth ?? Y);
2407
+ let t = this._columnWidths.get(e.key) ?? e.width ?? q;
2408
+ return Math.max(t, e.minWidth ?? J);
2366
2409
  }
2367
2410
  get headerHeight() {
2368
2411
  return this.rowHeight + 8;
@@ -2388,10 +2431,10 @@ var q = {
2388
2431
  return Math.max(0, this._visibleRowCount - this._frozenRowCount) * this.rowHeight;
2389
2432
  }
2390
2433
  get visibleRange() {
2391
- 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;
2434
+ 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;
2392
2435
  return {
2393
2436
  start: n,
2394
- end: Math.min(this._visibleRowCount, t + i + Q)
2437
+ end: Math.min(this._visibleRowCount, t + i + Z)
2395
2438
  };
2396
2439
  }
2397
2440
  connectedCallback() {
@@ -2434,13 +2477,13 @@ var q = {
2434
2477
  i = r;
2435
2478
  break;
2436
2479
  }
2437
- i = Math.max(0, i - Q);
2480
+ i = Math.max(0, i - Z);
2438
2481
  let a = e.length;
2439
2482
  for (let e = i; e < t.length; e++) if (t[e] > r) {
2440
2483
  a = e;
2441
2484
  break;
2442
2485
  }
2443
- return a = Math.min(e.length, a + Q), {
2486
+ return a = Math.min(e.length, a + Z), {
2444
2487
  start: i,
2445
2488
  end: a
2446
2489
  };
@@ -2461,7 +2504,7 @@ var q = {
2461
2504
  this._filteredIndices = Array.from({ length: this.data.length }, (e, t) => t), this._sortedIndices = this._filteredIndices;
2462
2505
  return;
2463
2506
  }
2464
- if (this._filteredIndices = ae(this.data, this._filters, (e, t, n) => {
2507
+ if (this._filteredIndices = ie(this.data, this._filters, (e, t, n) => {
2465
2508
  this.dispatchEvent(new CustomEvent("filter-error", {
2466
2509
  detail: {
2467
2510
  error: e,
@@ -2484,7 +2527,16 @@ var q = {
2484
2527
  _focusEditor() {
2485
2528
  if (!this._editingCell) return;
2486
2529
  let e = this.shadowRoot?.querySelector(".ft-editor");
2487
- e && document.activeElement !== e && (e.focus(), e.type === "text" && e.select());
2530
+ if (e && this.shadowRoot.activeElement !== e) {
2531
+ if (e.localName === "u-date-picker") {
2532
+ let t = e;
2533
+ t.updateComplete.then(() => {
2534
+ t.isConnected && this.shadowRoot.activeElement !== t && (t.focus(), t.shadowRoot?.querySelector("[part~=\"input\"]")?.select());
2535
+ });
2536
+ return;
2537
+ }
2538
+ e.focus(), e.type === "text" && e.select();
2539
+ }
2488
2540
  }
2489
2541
  _measureViewport() {
2490
2542
  let e = this.clientHeight, t = this.clientWidth;
@@ -2619,6 +2671,21 @@ var q = {
2619
2671
  } else this._cancelEdit();
2620
2672
  return;
2621
2673
  }
2674
+ if (e.type === "date" || e.type === "datetime") {
2675
+ let t = this.shadowRoot?.querySelector("u-date-picker.ft-editor");
2676
+ if (!t) {
2677
+ this._cancelEdit();
2678
+ return;
2679
+ }
2680
+ if (t.validity?.badInput) {
2681
+ let e = t.shadowRoot?.querySelector("[part~=\"input\"]")?.value ?? "";
2682
+ this._applyEdit(e);
2683
+ return;
2684
+ }
2685
+ let n = t.value || null;
2686
+ this._applyEdit(n && e.type === "datetime" ? n.slice(0, 16) : n);
2687
+ return;
2688
+ }
2622
2689
  let t = this.shadowRoot?.querySelector(".ft-editor");
2623
2690
  if (t) {
2624
2691
  let n = N(t.value, e);
@@ -2645,7 +2712,7 @@ var q = {
2645
2712
  }));
2646
2713
  return;
2647
2714
  }
2648
- if (a.type === "number" && typeof e == "string" || a.type === "date" && typeof e == "string" && p(e) === null || a.type === "datetime" && typeof e == "string" && m(e) === null) {
2715
+ if (a.type === "number" && typeof e == "string" || a.type === "date" && typeof e == "string" && f(e) === null || a.type === "datetime" && typeof e == "string" && p(e) === null) {
2649
2716
  let t = A(a.type === "number" ? "notANumber" : a.type === "date" ? "notADate" : "notADateTime");
2650
2717
  this._markCellInvalid(n, r, t), this.dispatchEvent(new CustomEvent("validation-error", {
2651
2718
  detail: {
@@ -2710,7 +2777,9 @@ var q = {
2710
2777
  }));
2711
2778
  }
2712
2779
  _onEditorKeyDown(e) {
2713
- if (!v(e)) {
2780
+ if (_(e)) return;
2781
+ let t = e.currentTarget;
2782
+ if (!(t?.localName === "u-date-picker" && (e.composedPath().some((e) => e instanceof Element && e.part?.contains("popover")) || e.key === "Escape" && $(t)))) {
2714
2783
  if (this._autocompleteState && this._autocompleteState.candidates.length > 0) {
2715
2784
  if (e.key === "ArrowDown") {
2716
2785
  e.preventDefault(), e.stopPropagation();
@@ -2766,7 +2835,7 @@ var q = {
2766
2835
  this._activeCell = this._selection.activeCell ? { ...this._selection.activeCell } : null, this._scrollToActiveCell(), this._dispatchSelectionEvent();
2767
2836
  }
2768
2837
  _onKeyDown(e) {
2769
- if (this._editing.current) return;
2838
+ if (this._editing.current || this._openFilterKey && e.composedPath().some((e) => e instanceof Element && e.classList.contains("ft-filter-dropdown"))) return;
2770
2839
  let t = this.visibleColumns;
2771
2840
  if ((e.ctrlKey || e.metaKey) && !e.altKey) {
2772
2841
  let t = e.key.toLowerCase();
@@ -2778,7 +2847,7 @@ var q = {
2778
2847
  ].includes(t) && this._handleCtrlKey(e)) return;
2779
2848
  }
2780
2849
  if (t.length !== 0 && this._visibleRowCount !== 0) {
2781
- if ((e.key === "Enter" || e.key === "F2") && this._activeCell && !v(e)) {
2850
+ if ((e.key === "Enter" || e.key === "F2") && this._activeCell && !_(e)) {
2782
2851
  e.preventDefault();
2783
2852
  let n = t[this._activeCell.col];
2784
2853
  n && this._isCellEditable(n) ? this._startEdit() : e.key === "Enter" && this._fireRowActivate(n);
@@ -2832,12 +2901,12 @@ var q = {
2832
2901
  if (!e.altKey || !this._activeCell || e.key !== "ArrowLeft" && e.key !== "ArrowRight") return !1;
2833
2902
  e.preventDefault();
2834
2903
  let n = t[this._activeCell.col];
2835
- return n && this._resizeColumnBy(n.key, e.key === "ArrowRight" ? X : -20), !0;
2904
+ return n && this._resizeColumnBy(n.key, e.key === "ArrowRight" ? Y : -20), !0;
2836
2905
  }
2837
2906
  _resizeColumnBy(e, t) {
2838
2907
  let n = this.visibleColumns.findIndex((t) => t.key === e), r = this.visibleColumns[n];
2839
2908
  if (!r) return;
2840
- let i = this._columnWidths.get(r.key) ?? r.width ?? J, a = r.minWidth ?? Y, o = Math.max(a, i + t);
2909
+ let i = this._columnWidths.get(r.key) ?? r.width ?? q, a = r.minWidth ?? J, o = Math.max(a, i + t);
2841
2910
  this._columnWidths.set(r.key, o), this.requestUpdate(), this.dispatchEvent(new CustomEvent("column-resize", {
2842
2911
  detail: {
2843
2912
  key: r.key,
@@ -2866,7 +2935,7 @@ var q = {
2866
2935
  async _handleCopy(e) {
2867
2936
  let t = this._selection.getEffectiveRange();
2868
2937
  if (!t) return;
2869
- let n = this.visibleColumns, r = se(this._sortedIndices.map((e) => this.data[e]), n, t);
2938
+ let n = this.visibleColumns, r = oe(this._sortedIndices.map((e) => this.data[e]), n, t);
2870
2939
  try {
2871
2940
  await navigator.clipboard.writeText(r);
2872
2941
  } catch (e) {
@@ -2892,10 +2961,10 @@ var q = {
2892
2961
  if (!this._activeCell) return;
2893
2962
  let e = await this._readClipboardText();
2894
2963
  if (e == null) return;
2895
- let t = g(e);
2964
+ let t = h(e);
2896
2965
  if (t.length === 0) return;
2897
2966
  let n = this._expandRowsForPaste(this._activeCell.row, t.length), r = this._applyPasteData(this._activeCell, t);
2898
- if (r.length > 0 || n.length > 0) {
2967
+ if (this._selectPastedRange(this._activeCell, t), r.length > 0 || n.length > 0) {
2899
2968
  let e = n.length;
2900
2969
  this._undo.push({
2901
2970
  label: "paste",
@@ -2933,6 +3002,13 @@ var q = {
2933
3002
  })), null;
2934
3003
  }
2935
3004
  }
3005
+ _selectPastedRange(e, t) {
3006
+ let n = Math.max(...t.map((e) => e.length)), r = Math.min(e.row + t.length, this._visibleRowCount) - 1, i = Math.min(e.col + n, this.visibleColumns.length) - 1;
3007
+ (r !== e.row || i !== e.col) && (this._selection.setDimensions(this._visibleRowCount, this.visibleColumns.length), this._selection.setActive(e.row, e.col), this._selection.setActiveWithRange(r, i), this._activeCell = {
3008
+ row: e.row,
3009
+ col: e.col
3010
+ });
3011
+ }
2936
3012
  _expandRowsForPaste(e, t) {
2937
3013
  let n = [], r = e + t, i = this.maxRows > 0 ? this.maxRows : Infinity;
2938
3014
  for (; this.data.length < r && this.data.length < i;) {
@@ -3152,7 +3228,7 @@ var q = {
3152
3228
  return Math.min(n, i);
3153
3229
  }
3154
3230
  _renderHeaderCell(e, t) {
3155
- let n = e.sortable !== !1, r = this._sortCriteria.find((t) => t.key === e.key), o = this._sortCriteria.length > 1 ? this._sortCriteria.findIndex((t) => t.key === e.key) : -1, s = this._filters.some((t) => t.key === e.key), c = e.pinned === "left", l = e.pinned === "right", u = c || l, d = e.headerAlign ?? G(e), f = [
3231
+ let n = e.sortable !== !1, r = this._sortCriteria.find((t) => t.key === e.key), o = this._sortCriteria.length > 1 ? this._sortCriteria.findIndex((t) => t.key === e.key) : -1, s = this._filters.some((t) => t.key === e.key), c = e.pinned === "left", l = e.pinned === "right", u = c || l, d = e.headerAlign ?? W(e), f = [
3156
3232
  "ft-header-cell",
3157
3233
  n ? "ft-sortable" : "",
3158
3234
  u ? "ft-pinned" : "",
@@ -3286,8 +3362,9 @@ var q = {
3286
3362
  _openFilterFromMenu(e) {
3287
3363
  this._headerMenu = null, this._openFilterKey = e, requestAnimationFrame(() => {
3288
3364
  document.addEventListener("click", this._onDocumentClick, { once: !0 });
3289
- }), this.updateComplete.then(() => {
3290
- this.shadowRoot?.querySelector(".ft-filter-dropdown input, .ft-filter-dropdown select")?.focus();
3365
+ }), this.updateComplete.then(async () => {
3366
+ let e = this.shadowRoot?.querySelector(".ft-filter-dropdown input, .ft-filter-dropdown select, .ft-filter-dropdown u-date-picker");
3367
+ await e?.updateComplete, e?.focus();
3291
3368
  });
3292
3369
  }
3293
3370
  _showHiddenBefore(e) {
@@ -3323,7 +3400,7 @@ var q = {
3323
3400
  ${r.map((e) => c("show", A("showColumn", { header: e.label }), () => this._setColumnHidden(e.key, !1)))}
3324
3401
  <div class="ft-header-menu-separator" role="separator"></div>
3325
3402
  ${c("autofit", A("autoFitWidth"), () => this._autoFitColumn(e))}
3326
- ${c("wider", A("wider"), () => this._resizeColumnBy(e, X), !0)}
3403
+ ${c("wider", A("wider"), () => this._resizeColumnBy(e, Y), !0)}
3327
3404
  ${c("narrower", A("narrower"), () => this._resizeColumnBy(e, -20), !0)}
3328
3405
  </div>
3329
3406
  `;
@@ -3612,17 +3689,17 @@ var q = {
3612
3689
  @keydown=${(e) => {
3613
3690
  e.key === "Escape" && (this._openFilterKey = null), e.stopPropagation();
3614
3691
  }}>
3615
- ${Object.keys(q).map((e) => i`<option value=${e}>${q[e]}</option>`)}
3692
+ ${Object.keys(K).map((e) => i`<option value=${e}>${K[e]}</option>`)}
3616
3693
  </select>
3617
3694
  <input class="ft-filter-input ft-num-cond-input" type="text" inputmode="decimal" placeholder=${A("valuePlaceholder")}
3618
- .value=${n.text ?? (n.value == null ? "" : P(n.value))}
3695
+ .value=${n.text ?? (n.value == null ? "" : se(n.value))}
3619
3696
  aria-invalid=${n.text && n.value == null ? "true" : "false"}
3620
3697
  @input=${(n) => {
3621
3698
  let r = n.target.value, i = this._numberFilterState.get(e) ?? this._defaultNumState();
3622
3699
  i[t] = {
3623
3700
  ...i[t],
3624
3701
  text: r,
3625
- value: r.trim() === "" ? null : h(r)
3702
+ value: r.trim() === "" ? null : m(r)
3626
3703
  }, this._numberFilterState.set(e, i), this._emptyFilterState.delete(e), this._applyFilterForKey(e);
3627
3704
  }}
3628
3705
  @keydown=${(e) => {
@@ -3674,21 +3751,21 @@ var q = {
3674
3751
  return n ? n.error : null;
3675
3752
  }
3676
3753
  _renderDateFilter(e) {
3677
- let t = e.type === "datetime" ? "datetime-local" : "date", n = this._dateFilterState.get(e.key) ?? {};
3754
+ let t = e.type === "datetime", n = this._dateFilterState.get(e.key) ?? {}, r = (e) => e?.slice(0, 10), o = (e) => {
3755
+ e.key === "Escape" && $(e.currentTarget) || (e.stopPropagation(), e.key === "Escape" && (this._openFilterKey = null));
3756
+ };
3678
3757
  return i`
3679
- <div class="ft-filter-range">
3680
- <input class="ft-filter-input" type=${t} placeholder=${A("fromPlaceholder")}
3681
- .value=${n.from ?? ""}
3682
- @input=${(t) => this._applyDateFilter(e.key, t, "from")}
3683
- @keydown=${(e) => {
3684
- e.key === "Escape" && (this._openFilterKey = null), e.stopPropagation();
3685
- }}>
3686
- <input class="ft-filter-input" type=${t} placeholder=${A("toPlaceholder")}
3687
- .value=${n.to ?? ""}
3688
- @input=${(t) => this._applyDateFilter(e.key, t, "to")}
3689
- @keydown=${(e) => {
3690
- e.key === "Escape" && (this._openFilterKey = null), e.stopPropagation();
3691
- }}>
3758
+ <div class="ft-filter-range ft-filter-range-dates">
3759
+ <u-date-picker class="ft-filter-date" size="sm" clearable
3760
+ mode=${t ? "datetime" : "date"} label=${A("fromPlaceholder")}
3761
+ .value=${n.from ?? ""} max=${r(n.to) ?? a}
3762
+ @change=${(t) => this._applyDateFilter(e.key, t, "from")}
3763
+ @keydown=${o}></u-date-picker>
3764
+ <u-date-picker class="ft-filter-date" size="sm" clearable
3765
+ mode=${t ? "datetime" : "date"} label=${A("toPlaceholder")}
3766
+ .value=${n.to ?? ""} min=${r(n.from) ?? a}
3767
+ @change=${(t) => this._applyDateFilter(e.key, t, "to")}
3768
+ @keydown=${o}></u-date-picker>
3692
3769
  </div>
3693
3770
  ${this._renderEmptyFilterRow(e.key, () => {
3694
3771
  this._dateFilterState.delete(e.key);
@@ -3696,7 +3773,7 @@ var q = {
3696
3773
  `;
3697
3774
  }
3698
3775
  _applyDateFilter(e, t, n) {
3699
- let r = t.target.value, i = this._dateFilterState.get(e) ?? {};
3776
+ let r = t.target.value ?? "", i = this._dateFilterState.get(e) ?? {};
3700
3777
  r === "" ? delete i[n] : i[n] = r, this._dateFilterState.set(e, i), this._emptyFilterState.delete(e), this._applyFilterForKey(e);
3701
3778
  }
3702
3779
  _renderBooleanFilter(e) {
@@ -3724,7 +3801,7 @@ var q = {
3724
3801
  if (!n) return;
3725
3802
  let r = this.shadowRoot?.querySelectorAll(`.ft-cell[data-col-index="${t}"]`), i = 0, a = this.shadowRoot?.querySelector(`.ft-header-cell[data-col-index="${t}"]`);
3726
3803
  if (a && (i = Math.max(i, a.scrollWidth)), r) for (let e of r) i = Math.max(i, e.scrollWidth);
3727
- let o = n.minWidth ?? Y, s = Math.max(o, i + 8);
3804
+ let o = n.minWidth ?? J, s = Math.max(o, i + 8);
3728
3805
  this._columnWidths.set(n.key, s), this.requestUpdate(), this.dispatchEvent(new CustomEvent("column-resize", {
3729
3806
  detail: {
3730
3807
  key: n.key,
@@ -3737,7 +3814,7 @@ var q = {
3737
3814
  }
3738
3815
  _onResizeStart(e, t) {
3739
3816
  e.preventDefault(), e.stopPropagation();
3740
- let n = this.visibleColumns[t], r = this._columnWidths.get(n.key) ?? n.width ?? J;
3817
+ let n = this.visibleColumns[t], r = this._columnWidths.get(n.key) ?? n.width ?? q;
3741
3818
  this._resizing = {
3742
3819
  colIndex: t,
3743
3820
  startX: e.clientX,
@@ -3745,13 +3822,13 @@ var q = {
3745
3822
  };
3746
3823
  let i = (e) => {
3747
3824
  if (!this._resizing) return;
3748
- let t = e.clientX - this._resizing.startX, r = n.minWidth ?? Y, i = Math.max(r, this._resizing.startWidth + t);
3825
+ let t = e.clientX - this._resizing.startX, r = n.minWidth ?? J, i = Math.max(r, this._resizing.startWidth + t);
3749
3826
  this._columnWidths.set(n.key, i), this.requestUpdate();
3750
3827
  }, a = () => {
3751
3828
  document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", o), this._resizeCleanup = null;
3752
3829
  }, o = () => {
3753
3830
  if (a(), this._resizing) {
3754
- let e = this._columnWidths.get(n.key) ?? J;
3831
+ let e = this._columnWidths.get(n.key) ?? q;
3755
3832
  this.dispatchEvent(new CustomEvent("column-resize", {
3756
3833
  detail: {
3757
3834
  key: n.key,
@@ -4128,7 +4205,7 @@ var q = {
4128
4205
  this._closeFindPanel();
4129
4206
  return;
4130
4207
  }
4131
- e.key === "Enter" && !v(e) && e.target instanceof HTMLInputElement && e.target.classList.contains("ft-find-input") && (e.shiftKey ? this._findPrev() : this._findNext());
4208
+ e.key === "Enter" && !_(e) && e.target instanceof HTMLInputElement && e.target.classList.contains("ft-find-input") && (e.shiftKey ? this._findPrev() : this._findNext());
4132
4209
  }}>
4133
4210
  <div class="ft-find-row">
4134
4211
  <input class="ft-find-input" type="text" placeholder=${A("findPlaceholder")}
@@ -4340,10 +4417,10 @@ var q = {
4340
4417
  ${this._renderEditor(e, t)}
4341
4418
  </div>
4342
4419
  `;
4343
- let v = s || l, y = this._isCellInvalid(n, r), b = (this._findState?.results ?? []).findIndex((e) => e.row === n && e.col === r), x = b >= 0, S = x && b === this._findState.currentIndex, C = [
4420
+ let v = s || l, y = this._isCellInvalid(n, r), b = (this._findState?.results ?? []).findIndex((e) => e.row === n && e.col === r), x = b >= 0, S = x && b === this._findState.currentIndex, w = [
4344
4421
  "ft-cell",
4345
4422
  `ft-type-${t.type ?? "text"}`,
4346
- `ft-align-${G(t)}`,
4423
+ `ft-align-${W(t)}`,
4347
4424
  s ? "ft-active" : "",
4348
4425
  l ? "ft-selected" : "",
4349
4426
  f ? "ft-pinned" : "",
@@ -4355,7 +4432,7 @@ var q = {
4355
4432
  t.reveal === "hover" ? "ft-reveal-hover" : ""
4356
4433
  ].filter(Boolean).join(" "), T = this._toDataIndex(n), E = this._comments.get(T)?.get(t.key) ?? null, D = E !== null, O = D ? i`<div class="ft-comment-indicator" title=${E}></div>` : a;
4357
4434
  return i`
4358
- <div class=${D ? C + " ft-has-comment" : C}
4435
+ <div class=${D ? w + " ft-has-comment" : w}
4359
4436
  role="gridcell"
4360
4437
  aria-colindex=${r + 1}
4361
4438
  data-col-index=${r}
@@ -4369,7 +4446,7 @@ var q = {
4369
4446
  @click=${(e) => this._onCellClickEvent(e, n, r)}
4370
4447
  @dblclick=${() => this._onCellDblClick(n, r)}>
4371
4448
  ${O}
4372
- ${w(e[t.key], e, t)}
4449
+ ${C(e[t.key], e, t)}
4373
4450
  </div>
4374
4451
  `;
4375
4452
  }
@@ -4378,22 +4455,21 @@ var q = {
4378
4455
  let n = e[t.key], r = n == null ? "" : String(n);
4379
4456
  if (t.type === "number") return i`
4380
4457
  <input class="ft-editor ft-editor-number" type="text" inputmode="decimal"
4381
- .value=${typeof n == "number" ? P(n) : r}
4458
+ .value=${typeof n == "number" ? se(n) : r}
4382
4459
  @keydown=${this._onEditorKeyDown}
4383
4460
  @blur=${() => this._commitEdit()}>
4384
4461
  `;
4385
- if (t.type === "date") return i`
4386
- <input class="ft-editor ft-editor-date" type="text" inputmode="numeric" placeholder=${u()}
4387
- .value=${ce(n)}
4388
- @keydown=${this._onEditorKeyDown}
4389
- @blur=${() => this._commitEdit()}>
4390
- `;
4391
- if (t.type === "datetime") return i`
4392
- <input class="ft-editor ft-editor-datetime" type="text" placeholder=${`${u()} HH:mm`}
4393
- .value=${le(n)}
4462
+ if (t.type === "date" || t.type === "datetime") {
4463
+ let e = t.type === "datetime";
4464
+ return i`
4465
+ <u-date-picker class="ft-editor ft-editor-${t.type}" size="sm"
4466
+ mode=${e ? "datetime" : "date"} ?confirm=${e}
4467
+ .value=${Ye(n, e)}
4394
4468
  @keydown=${this._onEditorKeyDown}
4395
- @blur=${() => this._commitEdit()}>
4469
+ @change=${() => this._commitEdit()}
4470
+ @blur=${() => this._commitEdit()}></u-date-picker>
4396
4471
  `;
4472
+ }
4397
4473
  if (t.type === "select" && t.options && t.options.length > 0) {
4398
4474
  let e = t.options, r = typeof e[0] == "string";
4399
4475
  return i`
@@ -4435,60 +4511,75 @@ var q = {
4435
4511
  `;
4436
4512
  }
4437
4513
  };
4438
- K([s({ type: Array })], $.prototype, "columns", void 0), K([s({
4514
+ G([s({ type: Array })], Q.prototype, "columns", void 0), G([s({
4439
4515
  type: Array,
4440
4516
  hasChanged: () => !0
4441
- })], $.prototype, "data", null), K([s({
4517
+ })], Q.prototype, "data", null), G([s({
4442
4518
  type: Boolean,
4443
4519
  attribute: "clear-undo-on-data-change"
4444
- })], $.prototype, "clearUndoOnDataChange", void 0), K([s({
4520
+ })], Q.prototype, "clearUndoOnDataChange", void 0), G([s({
4445
4521
  type: Boolean,
4446
4522
  attribute: "clear-selection-on-data-change"
4447
- })], $.prototype, "clearSelectionOnDataChange", void 0), K([s({
4523
+ })], Q.prototype, "clearSelectionOnDataChange", void 0), G([s({
4448
4524
  type: Number,
4449
4525
  attribute: "row-height"
4450
- })], $.prototype, "rowHeight", null), K([s({
4526
+ })], Q.prototype, "rowHeight", null), G([s({
4451
4527
  type: Boolean,
4452
4528
  attribute: "show-row-numbers"
4453
- })], $.prototype, "showRowNumbers", void 0), K([s({
4529
+ })], Q.prototype, "showRowNumbers", void 0), G([s({
4454
4530
  type: String,
4455
4531
  reflect: !0
4456
- })], $.prototype, "theme", void 0), K([s({
4532
+ })], Q.prototype, "theme", void 0), G([s({
4457
4533
  type: Number,
4458
4534
  attribute: "max-rows"
4459
- })], $.prototype, "maxRows", void 0), K([s({ type: Boolean })], $.prototype, "editable", void 0), K([s({
4535
+ })], Q.prototype, "maxRows", void 0), G([s({ type: Boolean })], Q.prototype, "editable", void 0), G([s({
4460
4536
  type: Boolean,
4461
4537
  attribute: "show-filters"
4462
- })], $.prototype, "showFilters", void 0), K([s({
4538
+ })], Q.prototype, "showFilters", void 0), G([s({
4463
4539
  type: Boolean,
4464
4540
  attribute: "show-context-menu"
4465
- })], $.prototype, "showContextMenu", void 0), K([s({
4541
+ })], Q.prototype, "showContextMenu", void 0), G([s({
4466
4542
  type: Number,
4467
4543
  attribute: "frozen-rows"
4468
- })], $.prototype, "frozenRows", void 0), K([s({
4544
+ })], Q.prototype, "frozenRows", void 0), G([s({
4469
4545
  type: String,
4470
4546
  attribute: "empty-message"
4471
- })], $.prototype, "emptyMessage", void 0), K([s({
4547
+ })], Q.prototype, "emptyMessage", void 0), G([s({
4472
4548
  type: String,
4473
4549
  attribute: "no-matching-message"
4474
- })], $.prototype, "noMatchingMessage", void 0), K([s({
4550
+ })], Q.prototype, "noMatchingMessage", void 0), G([s({
4475
4551
  type: Boolean,
4476
4552
  reflect: !0
4477
- })], $.prototype, "loading", void 0), K([s({
4553
+ })], Q.prototype, "loading", void 0), G([s({
4478
4554
  type: Boolean,
4479
4555
  attribute: "import-enabled"
4480
- })], $.prototype, "importEnabled", void 0), K([s({ type: Boolean })], $.prototype, "selectable", void 0), K([s({
4556
+ })], Q.prototype, "importEnabled", void 0), G([s({ type: Boolean })], Q.prototype, "selectable", void 0), G([s({
4481
4557
  type: String,
4482
4558
  attribute: "selection-mode"
4483
- })], $.prototype, "selectionMode", null), K([s({
4559
+ })], Q.prototype, "selectionMode", null), G([s({
4484
4560
  type: String,
4485
4561
  attribute: "data-mode"
4486
- })], $.prototype, "dataMode", void 0), K([s({
4562
+ })], Q.prototype, "dataMode", void 0), G([s({
4487
4563
  type: Object,
4488
4564
  attribute: "footer-data"
4489
- })], $.prototype, "footerData", void 0), K([s({ attribute: !1 })], $.prototype, "stylesheets", void 0), K([s({
4565
+ })], Q.prototype, "footerData", void 0), G([s({ attribute: !1 })], Q.prototype, "stylesheets", void 0), G([s({
4490
4566
  type: Number,
4491
4567
  attribute: "max-undo-size"
4492
- })], $.prototype, "maxUndoSize", null), K([c()], $.prototype, "_scrollTop", void 0), K([c()], $.prototype, "_scrollLeft", void 0), K([c()], $.prototype, "_viewportHeight", void 0), K([c()], $.prototype, "_viewportWidth", void 0), K([c()], $.prototype, "_activeCell", void 0), K([c()], $.prototype, "_editingCell", void 0), K([c()], $.prototype, "_sortCriteria", void 0), K([c()], $.prototype, "_openFilterKey", void 0), K([c()], $.prototype, "_rowSelectionVersion", void 0), K([c()], $.prototype, "_autocompleteState", void 0), K([c()], $.prototype, "_headerMenu", void 0), K([c()], $.prototype, "_bodyContextMenu", void 0), K([c()], $.prototype, "_commentPopup", void 0), K([c()], $.prototype, "_isDragOver", void 0), $ = K([o("flex-table")], $);
4568
+ })], Q.prototype, "maxUndoSize", null), G([c()], Q.prototype, "_scrollTop", void 0), G([c()], Q.prototype, "_scrollLeft", void 0), G([c()], Q.prototype, "_viewportHeight", void 0), G([c()], Q.prototype, "_viewportWidth", void 0), G([c()], Q.prototype, "_activeCell", void 0), G([c()], Q.prototype, "_editingCell", void 0), G([c()], Q.prototype, "_sortCriteria", void 0), G([c()], Q.prototype, "_openFilterKey", void 0), G([c()], Q.prototype, "_rowSelectionVersion", void 0), G([c()], Q.prototype, "_autocompleteState", void 0), G([c()], Q.prototype, "_headerMenu", void 0), G([c()], Q.prototype, "_bodyContextMenu", void 0), G([c()], Q.prototype, "_commentPopup", void 0), G([c()], Q.prototype, "_isDragOver", void 0), Q = G([o("flex-table")], Q);
4569
+ function Ye(e, t) {
4570
+ if (t) {
4571
+ let t = le(e);
4572
+ return /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(t) ? t.replace(" ", "T") : void 0;
4573
+ }
4574
+ let n = ce(e);
4575
+ return /^\d{4}-\d{2}-\d{2}$/.test(n) ? n : void 0;
4576
+ }
4577
+ function $(e) {
4578
+ try {
4579
+ return e.matches(":state(open)");
4580
+ } catch {
4581
+ return !1;
4582
+ }
4583
+ }
4493
4584
  //#endregion
4494
- export { j as a, M as i, G as n, k as o, V as r, w as s, $ as t };
4585
+ export { j as a, M as i, W as n, k as o, B as r, C as s, Q as t };