@iyulab/flex-table 0.38.1 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +18 -1
- package/dist/array/index.js +1 -1
- package/dist/{flex-table-DbbqD5Jn.js → flex-table-JGaGcJTl.js} +187 -179
- package/dist/flex-table.js +1 -1
- package/dist/odata/index.js +1 -1
- package/dist/odata/types.d.ts +10 -0
- package/dist/react.js +1 -1
- package/dist/use-odata-source-BiZrIEVV.js +118 -0
- package/package.json +1 -1
- package/dist/use-odata-source-6fVz-CLu.js +0 -102
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.39.0] - 2026-09-27
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **`enabled` option on `useODataSource`** (default `true`). While `false` the hook makes no
|
|
8
|
+
request and reports `loading: true`; the first request goes out when it turns `true`, with that
|
|
9
|
+
render's conditions. For lists whose query depends on a value that arrives asynchronously (a
|
|
10
|
+
server-decided default filter, the current user, a selected parent): without it the first render
|
|
11
|
+
sent a wasted request with the wrong conditions — often the heaviest one, unfiltered — before the
|
|
12
|
+
real one. Turning it `false` mid-request cancels the request; `refresh()` does nothing while
|
|
13
|
+
disabled.
|
|
14
|
+
|
|
15
|
+
## [0.38.2] - 2026-09-24
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- 🔴 **`useODataSource` no longer drops `@odata.nextLink`.** With server-driven paging, a server
|
|
20
|
+
returns fewer rows than the requested `$top` and a link to the rest. The hook kept only the
|
|
21
|
+
first response, so a table whose `pageSize` exceeded the server's page size showed a short page
|
|
22
|
+
while `totalCount` and the pager still looked right. It now follows the link until the page is
|
|
23
|
+
filled. A link outside the request's origin, or one that returns to a page already read, is
|
|
24
|
+
reported through `error` rather than followed or silently dropped.
|
|
25
|
+
|
|
3
26
|
## [0.38.1] - 2026-09-23
|
|
4
27
|
|
|
5
28
|
### Fixed
|
package/README.md
CHANGED
|
@@ -688,6 +688,7 @@ const source = useODataSource('/api/orders', {
|
|
|
688
688
|
| `baseUrl` | `window.location.origin` | Override the request origin (proxy/BFF setups) |
|
|
689
689
|
| `fetcher` | global `fetch` | Custom transport — pass a wrapper that injects auth headers |
|
|
690
690
|
| `onUnauthorized` | — | Called on `401`/`403` responses, before the generic error is set |
|
|
691
|
+
| `enabled` | `true` | While `false`, no request is made and `loading` stays `true` — see below |
|
|
691
692
|
|
|
692
693
|
`fetcher`/`onUnauthorized` should be stable references (e.g. wrap in `useCallback`) — they are intentionally excluded from the hook's internal effect dependencies to avoid refetch loops on every render.
|
|
693
694
|
|
|
@@ -704,6 +705,22 @@ rows, a `refresh` landing after a change), and holding the old `$skip` would lea
|
|
|
704
705
|
table next to a non-zero total. Reaching that state costs one extra request, only in that
|
|
705
706
|
case; the page only ever moves down, so it cannot loop.
|
|
706
707
|
|
|
708
|
+
Set `enabled: false` while the query depends on a value that has not arrived yet — a default
|
|
709
|
+
filter the server decides, the current user, a selected parent record. Without it, the first
|
|
710
|
+
render requests with the wrong conditions (often the heaviest query: no filter) and then again
|
|
711
|
+
once the value arrives. The first request goes out the moment `enabled` turns `true`, with the
|
|
712
|
+
conditions of that render; until then `loading` is `true`, so the table shows loading rather
|
|
713
|
+
than "no data". Turning it `false` mid-request cancels that request, and `refresh()` does nothing
|
|
714
|
+
while disabled.
|
|
715
|
+
|
|
716
|
+
```tsx
|
|
717
|
+
const season = useDefaultSeason(); // resolves asynchronously
|
|
718
|
+
const source = useODataSource('/api/orders', {
|
|
719
|
+
fixedFilter: season ? { Season: season } : undefined,
|
|
720
|
+
enabled: season !== undefined,
|
|
721
|
+
});
|
|
722
|
+
```
|
|
723
|
+
|
|
707
724
|
The three `initial*` options are read **on the first render only** (the same contract
|
|
708
725
|
`defaultOrderBy` has always had); use `setPage`/`setSearch` to move afterwards. Reach for
|
|
709
726
|
them when a list has to come back the way the user left it — going to a detail screen and
|
|
@@ -729,7 +746,7 @@ The hook returns:
|
|
|
729
746
|
|
|
730
747
|
| Field | Description |
|
|
731
748
|
|---|---|
|
|
732
|
-
| `data` / `totalCount` | Current page rows and the server's total (`@odata.count`) |
|
|
749
|
+
| `data` / `totalCount` | Current page rows and the server's total (`@odata.count`). When the server pages its response (`@odata.nextLink`, e.g. a page size smaller than `pageSize`), the hook follows the link until the page is filled; a link outside the request's origin, or one that returns to a page already read, is reported through `error` instead of showing a short page |
|
|
733
750
|
| `loading` | A request is in flight |
|
|
734
751
|
| `error` | Message of the last failed request, or `null`. **Render this** — a failed request otherwise leaves the grid silently empty |
|
|
735
752
|
| `page` / `setPage` | Zero-based page index |
|
package/dist/array/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "../sorting-CjfjRxwL.js";
|
|
2
|
-
import { r as t } from "../use-odata-source-
|
|
2
|
+
import { r as t } from "../use-odata-source-BiZrIEVV.js";
|
|
3
3
|
import { useCallback as n, useMemo as r, useState as i } from "react";
|
|
4
4
|
//#region src/array/use-array-source.ts
|
|
5
5
|
function a(t, { search: n, sortCriteria: r, page: i, pageSize: a, columns: o, searchFields: s }) {
|
|
@@ -1513,26 +1513,32 @@ var l = r`
|
|
|
1513
1513
|
function f() {
|
|
1514
1514
|
return typeof document < "u" && document.documentElement?.lang ? document.documentElement.lang : typeof window < "u" && typeof navigator < "u" && navigator.language ? navigator.language : "en";
|
|
1515
1515
|
}
|
|
1516
|
-
var p = f()
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1516
|
+
var p = f(), m = {
|
|
1517
|
+
"zh-hant": "zh-tw",
|
|
1518
|
+
"zh-hk": "zh-tw",
|
|
1519
|
+
"zh-mo": "zh-tw",
|
|
1520
|
+
zh: "zh-cn",
|
|
1521
|
+
pt: "pt-br"
|
|
1522
|
+
};
|
|
1523
|
+
function h(e) {
|
|
1524
|
+
let t = e.toLowerCase().split("-"), n = t.map((e, n) => t.slice(0, t.length - n).join("-")), r = n.find((e) => e in m), i = r ? [
|
|
1525
|
+
...n,
|
|
1526
|
+
m[r],
|
|
1522
1527
|
"en"
|
|
1523
|
-
];
|
|
1528
|
+
] : [...n, "en"];
|
|
1529
|
+
return [...new Set(i)];
|
|
1524
1530
|
}
|
|
1525
|
-
function
|
|
1531
|
+
function g(e, t) {
|
|
1526
1532
|
return t ? e.replace(/\{(\w+)\}/g, (e, n) => t[n] == null ? `{${n}}` : String(t[n])) : e;
|
|
1527
1533
|
}
|
|
1528
|
-
function
|
|
1529
|
-
for (let n of
|
|
1534
|
+
function _(e, t) {
|
|
1535
|
+
for (let n of h(e)) {
|
|
1530
1536
|
let e = d.get(n)?.[t] ?? u.get(n)?.[t];
|
|
1531
1537
|
if (e) return e;
|
|
1532
1538
|
}
|
|
1533
1539
|
return u.get("en")[t];
|
|
1534
1540
|
}
|
|
1535
|
-
var
|
|
1541
|
+
var v = /* @__PURE__ */ new Map(), y = class {
|
|
1536
1542
|
constructor() {}
|
|
1537
1543
|
static set(e) {
|
|
1538
1544
|
p = e;
|
|
@@ -1548,38 +1554,40 @@ var _ = /* @__PURE__ */ new Map(), v = class {
|
|
|
1548
1554
|
});
|
|
1549
1555
|
}
|
|
1550
1556
|
static getValue(e, t) {
|
|
1551
|
-
return
|
|
1557
|
+
return g(_(p, e), t);
|
|
1552
1558
|
}
|
|
1553
1559
|
static namespace(e) {
|
|
1560
|
+
let t = (t, n, r) => {
|
|
1561
|
+
let i = v.get(e);
|
|
1562
|
+
for (let e of h(t || p)) {
|
|
1563
|
+
let t = i?.get(e)?.[n];
|
|
1564
|
+
if (t) return g(t, r);
|
|
1565
|
+
}
|
|
1566
|
+
return n;
|
|
1567
|
+
};
|
|
1554
1568
|
return {
|
|
1555
1569
|
name: e,
|
|
1556
1570
|
register(t, n) {
|
|
1557
|
-
let r =
|
|
1571
|
+
let r = v.get(e) ?? /* @__PURE__ */ new Map(), i = t.toLowerCase();
|
|
1558
1572
|
r.set(i, {
|
|
1559
1573
|
...r.get(i),
|
|
1560
1574
|
...n
|
|
1561
|
-
}),
|
|
1575
|
+
}), v.set(e, r);
|
|
1562
1576
|
},
|
|
1563
|
-
text(t, n)
|
|
1564
|
-
|
|
1565
|
-
for (let e of m(p)) {
|
|
1566
|
-
let i = r?.get(e)?.[t];
|
|
1567
|
-
if (i) return h(i, n);
|
|
1568
|
-
}
|
|
1569
|
-
return t;
|
|
1570
|
-
}
|
|
1577
|
+
text: (e, n) => t(void 0, e, n),
|
|
1578
|
+
textIn: t
|
|
1571
1579
|
};
|
|
1572
1580
|
}
|
|
1573
1581
|
};
|
|
1574
1582
|
//#endregion
|
|
1575
1583
|
//#region src/renderers/format.ts
|
|
1576
|
-
function
|
|
1577
|
-
return e == null ? "" : typeof t == "function" ? t(e) :
|
|
1584
|
+
function b(e, t) {
|
|
1585
|
+
return e == null ? "" : typeof t == "function" ? t(e) : x(t) ? C(e, t) : S(e, t);
|
|
1578
1586
|
}
|
|
1579
|
-
function
|
|
1587
|
+
function x(e) {
|
|
1580
1588
|
return /[yMdHhms]/.test(e);
|
|
1581
1589
|
}
|
|
1582
|
-
function
|
|
1590
|
+
function S(e, t) {
|
|
1583
1591
|
let n = typeof e == "number" ? e : Number(e);
|
|
1584
1592
|
if (isNaN(n)) return String(e);
|
|
1585
1593
|
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 = {
|
|
@@ -1587,12 +1595,12 @@ function x(e, t) {
|
|
|
1587
1595
|
maximumFractionDigits: c,
|
|
1588
1596
|
useGrouping: o.includes(",")
|
|
1589
1597
|
}, u;
|
|
1590
|
-
return r ? u = new Intl.NumberFormat(
|
|
1598
|
+
return r ? u = new Intl.NumberFormat(y.get(), {
|
|
1591
1599
|
...l,
|
|
1592
1600
|
style: "percent"
|
|
1593
|
-
}).format(n) : (u = new Intl.NumberFormat(
|
|
1601
|
+
}).format(n) : (u = new Intl.NumberFormat(y.get(), l).format(n), a && (u = a + u)), u + "";
|
|
1594
1602
|
}
|
|
1595
|
-
function
|
|
1603
|
+
function C(e, t) {
|
|
1596
1604
|
let n;
|
|
1597
1605
|
if (e instanceof Date) n = e;
|
|
1598
1606
|
else if (typeof e == "string" || typeof e == "number") n = new Date(e);
|
|
@@ -1603,24 +1611,24 @@ function S(e, t) {
|
|
|
1603
1611
|
}
|
|
1604
1612
|
//#endregion
|
|
1605
1613
|
//#region node_modules/@iyulab/components/dist/utilities/format.js
|
|
1606
|
-
function
|
|
1614
|
+
function w(e) {
|
|
1607
1615
|
let [t, n, r] = e.split("-").map(Number);
|
|
1608
1616
|
return Number.isNaN(t) || Number.isNaN(n) || Number.isNaN(r) ? new Date(e) : new Date(t, n - 1, r);
|
|
1609
1617
|
}
|
|
1610
|
-
function
|
|
1611
|
-
return typeof e == "string" ?
|
|
1612
|
-
}
|
|
1613
|
-
function T(e, t, n) {
|
|
1614
|
-
return new Intl.NumberFormat(n ?? v.get(), t).format(e);
|
|
1618
|
+
function T(e) {
|
|
1619
|
+
return typeof e == "string" ? w(e) : e;
|
|
1615
1620
|
}
|
|
1616
1621
|
function E(e, t, n) {
|
|
1617
|
-
|
|
1618
|
-
|
|
1622
|
+
return new Intl.NumberFormat(n ?? y.get(), t).format(e);
|
|
1623
|
+
}
|
|
1624
|
+
function D(e, t, n) {
|
|
1625
|
+
let r = T(e);
|
|
1626
|
+
return Number.isNaN(r.getTime()) ? String(e) : new Intl.DateTimeFormat(n ?? y.get(), t).format(r);
|
|
1619
1627
|
}
|
|
1620
1628
|
//#endregion
|
|
1621
1629
|
//#region src/renderers/cell-renderer.ts
|
|
1622
|
-
function
|
|
1623
|
-
return n.renderer ? n.renderer(e, t, n) : n.format ? typeof n.format == "function" ? n.format(e, t, n) :
|
|
1630
|
+
function O(e, t, n) {
|
|
1631
|
+
return n.renderer ? n.renderer(e, t, n) : n.format ? typeof n.format == "function" ? n.format(e, t, n) : b(e, n.format) : ee(e, n);
|
|
1624
1632
|
}
|
|
1625
1633
|
function ee(e, t) {
|
|
1626
1634
|
if (e == null) return "";
|
|
@@ -1647,18 +1655,18 @@ var ne = {
|
|
|
1647
1655
|
second: "numeric"
|
|
1648
1656
|
};
|
|
1649
1657
|
function re(e) {
|
|
1650
|
-
return typeof e == "number" ? Number.isInteger(e) ?
|
|
1658
|
+
return typeof e == "number" ? Number.isInteger(e) ? E(e) : E(e, { minimumFractionDigits: 1 }) : String(e);
|
|
1651
1659
|
}
|
|
1652
1660
|
function ie(e) {
|
|
1653
|
-
return e instanceof Date || typeof e == "string" ?
|
|
1661
|
+
return e instanceof Date || typeof e == "string" ? D(e) : String(e);
|
|
1654
1662
|
}
|
|
1655
1663
|
function ae(e) {
|
|
1656
|
-
return e instanceof Date || typeof e == "string" ?
|
|
1664
|
+
return e instanceof Date || typeof e == "string" ? D(e, ne) : String(e);
|
|
1657
1665
|
}
|
|
1658
1666
|
//#endregion
|
|
1659
1667
|
//#region src/locale.ts
|
|
1660
|
-
var
|
|
1661
|
-
|
|
1668
|
+
var k = y.namespace("flex-table");
|
|
1669
|
+
k.register("en", {
|
|
1662
1670
|
showHiddenColumns: "Show hidden column(s)",
|
|
1663
1671
|
columnMenu: "Column menu",
|
|
1664
1672
|
cellActions: "Cell actions",
|
|
@@ -1711,7 +1719,7 @@ O.register("en", {
|
|
|
1711
1719
|
booleanTrue: "True",
|
|
1712
1720
|
booleanFalse: "False",
|
|
1713
1721
|
dropFileToImport: "Drop file to import (.xlsx / .csv)"
|
|
1714
|
-
}),
|
|
1722
|
+
}), k.register("ko", {
|
|
1715
1723
|
showHiddenColumns: "숨긴 열 보기",
|
|
1716
1724
|
columnMenu: "열 메뉴",
|
|
1717
1725
|
cellActions: "셀 작업",
|
|
@@ -1765,7 +1773,7 @@ O.register("en", {
|
|
|
1765
1773
|
booleanFalse: "거짓",
|
|
1766
1774
|
dropFileToImport: "가져올 파일을 놓으세요 (.xlsx / .csv)"
|
|
1767
1775
|
});
|
|
1768
|
-
var
|
|
1776
|
+
var A = (e, t) => k.text(e, t);
|
|
1769
1777
|
//#endregion
|
|
1770
1778
|
//#region src/core/selection.ts
|
|
1771
1779
|
function oe(e) {
|
|
@@ -1776,7 +1784,7 @@ function oe(e) {
|
|
|
1776
1784
|
endCol: Math.max(e.startCol, e.endCol)
|
|
1777
1785
|
};
|
|
1778
1786
|
}
|
|
1779
|
-
var
|
|
1787
|
+
var j = class {
|
|
1780
1788
|
constructor() {
|
|
1781
1789
|
this.activeCell = null, this.rangeAnchor = null, this.range = null, this.extraRanges = [], this._rowCount = 0, this._colCount = 0;
|
|
1782
1790
|
}
|
|
@@ -1874,7 +1882,7 @@ var se = class {
|
|
|
1874
1882
|
shiftMoveRight() {
|
|
1875
1883
|
return this.activeCell ? this.setActiveWithRange(this.activeCell.row, this.activeCell.col + 1) : null;
|
|
1876
1884
|
}
|
|
1877
|
-
},
|
|
1885
|
+
}, se = class {
|
|
1878
1886
|
constructor() {
|
|
1879
1887
|
this.current = null;
|
|
1880
1888
|
}
|
|
@@ -1895,7 +1903,7 @@ var se = class {
|
|
|
1895
1903
|
let e = this.current;
|
|
1896
1904
|
return this.current = null, e;
|
|
1897
1905
|
}
|
|
1898
|
-
},
|
|
1906
|
+
}, M = class {
|
|
1899
1907
|
constructor() {
|
|
1900
1908
|
this._selected = /* @__PURE__ */ new Set(), this._mode = "multi", this._rowCount = 0;
|
|
1901
1909
|
}
|
|
@@ -1975,7 +1983,7 @@ function ce(e, t, n) {
|
|
|
1975
1983
|
}
|
|
1976
1984
|
//#endregion
|
|
1977
1985
|
//#region src/core/undo.ts
|
|
1978
|
-
var le = 100,
|
|
1986
|
+
var le = 100, N = class {
|
|
1979
1987
|
constructor() {
|
|
1980
1988
|
this._undoStack = [], this._redoStack = [], this._maxSize = le;
|
|
1981
1989
|
}
|
|
@@ -2026,7 +2034,7 @@ function ue(e, t, n) {
|
|
|
2026
2034
|
}
|
|
2027
2035
|
return r.join("\n");
|
|
2028
2036
|
}
|
|
2029
|
-
function
|
|
2037
|
+
function P(e) {
|
|
2030
2038
|
let t = e.replace(/\r\n/g, "\n").replace(/\r/g, "\n"), n = [], r = [], i = 0, a = t.length;
|
|
2031
2039
|
for (; i <= a;) {
|
|
2032
2040
|
if (i === a) {
|
|
@@ -2056,7 +2064,7 @@ function N(e) {
|
|
|
2056
2064
|
}
|
|
2057
2065
|
return n;
|
|
2058
2066
|
}
|
|
2059
|
-
function
|
|
2067
|
+
function F(e, t) {
|
|
2060
2068
|
if (e === "") return null;
|
|
2061
2069
|
switch (t.type) {
|
|
2062
2070
|
case "number": {
|
|
@@ -2083,51 +2091,51 @@ function fe(e) {
|
|
|
2083
2091
|
for (let n = 0; n < e.length; n++) t = de[(t ^ e[n]) & 255] ^ t >>> 8;
|
|
2084
2092
|
return (t ^ 4294967295) >>> 0;
|
|
2085
2093
|
}
|
|
2086
|
-
var
|
|
2094
|
+
var I = new TextEncoder();
|
|
2087
2095
|
function pe(e) {
|
|
2088
2096
|
let t = [], n = [], r = 0;
|
|
2089
2097
|
for (let i of e) {
|
|
2090
|
-
let e =
|
|
2098
|
+
let e = I.encode(i.name), a = fe(i.data), o = i.data.length, s = new ArrayBuffer(30 + e.length), c = new DataView(s);
|
|
2091
2099
|
c.setUint32(0, 67324752, !0), c.setUint16(4, 20, !0), c.setUint16(6, 0, !0), c.setUint16(8, 0, !0), c.setUint16(10, 0, !0), c.setUint16(12, 33, !0), c.setUint32(14, a, !0), c.setUint32(18, o, !0), c.setUint32(22, o, !0), c.setUint16(26, e.length, !0), c.setUint16(28, 0, !0), new Uint8Array(s, 30).set(e), t.push(new Uint8Array(s)), t.push(i.data);
|
|
2092
2100
|
let l = new ArrayBuffer(46 + e.length), u = new DataView(l);
|
|
2093
2101
|
u.setUint32(0, 33639248, !0), u.setUint16(4, 20, !0), u.setUint16(6, 20, !0), u.setUint16(8, 0, !0), u.setUint16(10, 0, !0), u.setUint16(12, 0, !0), u.setUint16(14, 33, !0), u.setUint32(16, a, !0), u.setUint32(20, o, !0), u.setUint32(24, o, !0), u.setUint16(28, e.length, !0), u.setUint16(30, 0, !0), u.setUint16(32, 0, !0), u.setUint16(34, 0, !0), u.setUint16(36, 0, !0), u.setUint32(38, 0, !0), u.setUint32(42, r, !0), new Uint8Array(l, 46).set(e), n.push(new Uint8Array(l)), r += 30 + e.length + o;
|
|
2094
2102
|
}
|
|
2095
|
-
let i =
|
|
2096
|
-
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),
|
|
2103
|
+
let i = L(n), a = /* @__PURE__ */ new ArrayBuffer(22), o = new DataView(a);
|
|
2104
|
+
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([
|
|
2097
2105
|
...t,
|
|
2098
2106
|
i,
|
|
2099
2107
|
new Uint8Array(a)
|
|
2100
2108
|
]);
|
|
2101
2109
|
}
|
|
2102
|
-
function
|
|
2110
|
+
function L(e) {
|
|
2103
2111
|
let t = e.reduce((e, t) => e + t.length, 0), n = new Uint8Array(t), r = 0;
|
|
2104
2112
|
for (let t of e) n.set(t, r), r += t.length;
|
|
2105
2113
|
return n;
|
|
2106
2114
|
}
|
|
2107
|
-
function
|
|
2115
|
+
function R(e) {
|
|
2108
2116
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
2109
2117
|
}
|
|
2110
|
-
function
|
|
2118
|
+
function z(e) {
|
|
2111
2119
|
let t = "";
|
|
2112
2120
|
for (e++; e > 0;) t = String.fromCharCode(64 + (e % 26 || 26)) + t, e = Math.floor((e - 1) / 26);
|
|
2113
2121
|
return t;
|
|
2114
2122
|
}
|
|
2115
|
-
function
|
|
2116
|
-
return
|
|
2123
|
+
function B(e, t) {
|
|
2124
|
+
return z(t) + (e + 1);
|
|
2117
2125
|
}
|
|
2118
|
-
function
|
|
2126
|
+
function me(e) {
|
|
2119
2127
|
let t = Date.UTC(1899, 11, 30);
|
|
2120
2128
|
return (e.getTime() - t) / 864e5;
|
|
2121
2129
|
}
|
|
2122
|
-
var
|
|
2123
|
-
function
|
|
2124
|
-
let n = [], r = t.map((e, t) => `<c r="${
|
|
2130
|
+
var he = "<?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>", ge = "<?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>", _e = "<?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>", 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/worksheet\" Target=\"worksheets/sheet1.xml\"/>\n <Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/>\n</Relationships>", ye = "<?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>";
|
|
2131
|
+
function be(e, t) {
|
|
2132
|
+
let n = [], r = t.map((e, t) => `<c r="${B(0, t)}" t="str" s="2"><v>${R(e.header)}</v></c>`);
|
|
2125
2133
|
return n.push(`<row r="1">${r.join("")}</row>`), e.forEach((e, r) => {
|
|
2126
2134
|
let i = t.map((t, n) => {
|
|
2127
|
-
let i =
|
|
2135
|
+
let i = B(r + 1, n), a = e[t.key];
|
|
2128
2136
|
if (a == null) return `<c r="${i}" t="str"><v></v></c>`;
|
|
2129
2137
|
let o = t.type ?? "text";
|
|
2130
|
-
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>${
|
|
2138
|
+
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>${me(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>`;
|
|
2131
2139
|
});
|
|
2132
2140
|
n.push(`<row r="${r + 2}">${i.join("")}</row>`);
|
|
2133
2141
|
}), `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -2135,32 +2143,32 @@ function ye(e, t) {
|
|
|
2135
2143
|
<sheetData>${n.join("")}</sheetData>
|
|
2136
2144
|
</worksheet>`;
|
|
2137
2145
|
}
|
|
2138
|
-
function
|
|
2139
|
-
let n =
|
|
2146
|
+
function xe(e, t) {
|
|
2147
|
+
let n = be(e, t);
|
|
2140
2148
|
return pe([
|
|
2141
2149
|
{
|
|
2142
2150
|
name: "[Content_Types].xml",
|
|
2143
|
-
data:
|
|
2151
|
+
data: I.encode(he)
|
|
2144
2152
|
},
|
|
2145
2153
|
{
|
|
2146
2154
|
name: "_rels/.rels",
|
|
2147
|
-
data:
|
|
2155
|
+
data: I.encode(ge)
|
|
2148
2156
|
},
|
|
2149
2157
|
{
|
|
2150
2158
|
name: "xl/workbook.xml",
|
|
2151
|
-
data:
|
|
2159
|
+
data: I.encode(_e)
|
|
2152
2160
|
},
|
|
2153
2161
|
{
|
|
2154
2162
|
name: "xl/_rels/workbook.xml.rels",
|
|
2155
|
-
data:
|
|
2163
|
+
data: I.encode(ve)
|
|
2156
2164
|
},
|
|
2157
2165
|
{
|
|
2158
2166
|
name: "xl/worksheets/sheet1.xml",
|
|
2159
|
-
data:
|
|
2167
|
+
data: I.encode(n)
|
|
2160
2168
|
},
|
|
2161
2169
|
{
|
|
2162
2170
|
name: "xl/styles.xml",
|
|
2163
|
-
data:
|
|
2171
|
+
data: I.encode(ye)
|
|
2164
2172
|
}
|
|
2165
2173
|
]);
|
|
2166
2174
|
}
|
|
@@ -2170,20 +2178,20 @@ function V(e, t, n) {
|
|
|
2170
2178
|
switch (n) {
|
|
2171
2179
|
case "csv": return H(e, t, ",");
|
|
2172
2180
|
case "tsv": return H(e, t, " ");
|
|
2173
|
-
case "json": return
|
|
2174
|
-
case "xlsx": return
|
|
2181
|
+
case "json": return Ce(e, t);
|
|
2182
|
+
case "xlsx": return xe(e, t);
|
|
2175
2183
|
}
|
|
2176
2184
|
}
|
|
2177
|
-
function
|
|
2185
|
+
function Se(e, t) {
|
|
2178
2186
|
return e == null ? "" : (t.type === "date" || t.type === "datetime") && e instanceof Date ? e.toISOString() : String(e);
|
|
2179
2187
|
}
|
|
2180
2188
|
function H(e, t, n) {
|
|
2181
|
-
return [t.map((e) => U(e.header, n)).join(n), ...e.map((e) => t.map((t) => U(
|
|
2189
|
+
return [t.map((e) => U(e.header, n)).join(n), ...e.map((e) => t.map((t) => U(Se(e[t.key], t), n)).join(n))].join("\n");
|
|
2182
2190
|
}
|
|
2183
2191
|
function U(e, t) {
|
|
2184
2192
|
return e.includes(t) || e.includes("\"") || e.includes("\n") || e.includes("\r") ? "\"" + e.replace(/"/g, "\"\"") + "\"" : e;
|
|
2185
2193
|
}
|
|
2186
|
-
function
|
|
2194
|
+
function Ce(e, t) {
|
|
2187
2195
|
let n = e.map((e) => {
|
|
2188
2196
|
let n = {};
|
|
2189
2197
|
for (let r of t) {
|
|
@@ -2194,35 +2202,35 @@ function Se(e, t) {
|
|
|
2194
2202
|
});
|
|
2195
2203
|
return JSON.stringify(n, null, 2);
|
|
2196
2204
|
}
|
|
2197
|
-
function
|
|
2205
|
+
function we(e, t, n) {
|
|
2198
2206
|
let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
2199
2207
|
a.href = i, a.download = t, a.style.display = "none", document.body.appendChild(a), a.click(), document.body.removeChild(a), setTimeout(() => URL.revokeObjectURL(i), 100);
|
|
2200
2208
|
}
|
|
2201
|
-
var
|
|
2209
|
+
var Te = {
|
|
2202
2210
|
csv: "text/csv;charset=utf-8",
|
|
2203
2211
|
tsv: "text/tab-separated-values;charset=utf-8",
|
|
2204
2212
|
json: "application/json;charset=utf-8",
|
|
2205
2213
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
2206
|
-
},
|
|
2214
|
+
}, Ee = {
|
|
2207
2215
|
csv: ".csv",
|
|
2208
2216
|
tsv: ".tsv",
|
|
2209
2217
|
json: ".json",
|
|
2210
2218
|
xlsx: ".xlsx"
|
|
2211
2219
|
};
|
|
2212
|
-
function Ee(e) {
|
|
2213
|
-
return we[e];
|
|
2214
|
-
}
|
|
2215
2220
|
function De(e) {
|
|
2216
2221
|
return Te[e];
|
|
2217
2222
|
}
|
|
2223
|
+
function Oe(e) {
|
|
2224
|
+
return Ee[e];
|
|
2225
|
+
}
|
|
2218
2226
|
//#endregion
|
|
2219
2227
|
//#region src/export/xlsx-reader.ts
|
|
2220
|
-
function
|
|
2228
|
+
function ke(e) {
|
|
2221
2229
|
for (let t = e.byteLength - 22; t >= 0; t--) if (e.getUint32(t, !0) === 101010256) return t;
|
|
2222
2230
|
throw Error("XLSX: End of central directory not found — not a valid ZIP file");
|
|
2223
2231
|
}
|
|
2224
|
-
function
|
|
2225
|
-
let t =
|
|
2232
|
+
function Ae(e) {
|
|
2233
|
+
let t = ke(e), n = e.getUint32(t + 16, !0), r = e.getUint32(t + 12, !0), i = new TextDecoder("utf-8"), a = [], o = n, s = n + r;
|
|
2226
2234
|
for (; o < s && e.getUint32(o, !0) === 33639248;) {
|
|
2227
2235
|
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));
|
|
2228
2236
|
a.push({
|
|
@@ -2235,7 +2243,7 @@ function ke(e) {
|
|
|
2235
2243
|
}
|
|
2236
2244
|
return a;
|
|
2237
2245
|
}
|
|
2238
|
-
async function
|
|
2246
|
+
async function je(e) {
|
|
2239
2247
|
let t = new DecompressionStream("deflate-raw"), n = t.writable.getWriter(), r = t.readable.getReader();
|
|
2240
2248
|
n.write(e), n.close();
|
|
2241
2249
|
let i = [];
|
|
@@ -2248,28 +2256,28 @@ async function Ae(e) {
|
|
|
2248
2256
|
for (let e of i) o.set(e, s), s += e.length;
|
|
2249
2257
|
return o;
|
|
2250
2258
|
}
|
|
2251
|
-
async function
|
|
2259
|
+
async function Me(e, t) {
|
|
2252
2260
|
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);
|
|
2253
2261
|
if (t.compressionMethod === 0) return o.slice();
|
|
2254
|
-
if (t.compressionMethod === 8) return
|
|
2262
|
+
if (t.compressionMethod === 8) return je(o);
|
|
2255
2263
|
throw Error(`XLSX: Unsupported compression method ${t.compressionMethod}`);
|
|
2256
2264
|
}
|
|
2257
|
-
async function
|
|
2258
|
-
let t = new DataView(e), n =
|
|
2259
|
-
for (let e of n) e.compressedSize === 0 && e.name.endsWith("/") || r.set(e.name, await
|
|
2265
|
+
async function Ne(e) {
|
|
2266
|
+
let t = new DataView(e), n = Ae(t), r = /* @__PURE__ */ new Map();
|
|
2267
|
+
for (let e of n) e.compressedSize === 0 && e.name.endsWith("/") || r.set(e.name, await Me(t, e));
|
|
2260
2268
|
return r;
|
|
2261
2269
|
}
|
|
2262
|
-
var
|
|
2270
|
+
var Pe = new TextDecoder("utf-8");
|
|
2263
2271
|
function W(e) {
|
|
2264
|
-
let t =
|
|
2272
|
+
let t = Pe.decode(e);
|
|
2265
2273
|
return new DOMParser().parseFromString(t, "application/xml");
|
|
2266
2274
|
}
|
|
2267
|
-
function
|
|
2275
|
+
function Fe(e) {
|
|
2268
2276
|
if (!e) return [];
|
|
2269
2277
|
let t = W(e);
|
|
2270
2278
|
return Array.from(t.querySelectorAll("si")).map((e) => Array.from(e.querySelectorAll("t")).map((e) => e.textContent ?? "").join(""));
|
|
2271
2279
|
}
|
|
2272
|
-
var
|
|
2280
|
+
var Ie = /* @__PURE__ */ new Set([
|
|
2273
2281
|
14,
|
|
2274
2282
|
15,
|
|
2275
2283
|
16,
|
|
@@ -2289,29 +2297,29 @@ var Fe = /* @__PURE__ */ new Set([
|
|
|
2289
2297
|
57,
|
|
2290
2298
|
58
|
|
2291
2299
|
]);
|
|
2292
|
-
function
|
|
2300
|
+
function Le(e) {
|
|
2293
2301
|
let t = e.replace(/"[^"]*"/g, "").replace(/\\./g, "").replace(/\[[^\]]*\]/g, "").split(";")[0];
|
|
2294
2302
|
return /[dy]/i.test(t);
|
|
2295
2303
|
}
|
|
2296
|
-
function
|
|
2304
|
+
function Re(e) {
|
|
2297
2305
|
let t = /* @__PURE__ */ new Set();
|
|
2298
2306
|
if (!e) return t;
|
|
2299
2307
|
let n = W(e), r = /* @__PURE__ */ new Map();
|
|
2300
2308
|
for (let e of Array.from(n.querySelectorAll("numFmts > numFmt"))) r.set(parseInt(e.getAttribute("numFmtId") ?? "", 10), e.getAttribute("formatCode") ?? "");
|
|
2301
2309
|
return Array.from(n.querySelectorAll("cellXfs > xf")).forEach((e, n) => {
|
|
2302
2310
|
let i = parseInt(e.getAttribute("numFmtId") ?? "0", 10), a = r.get(i);
|
|
2303
|
-
(a === void 0 ?
|
|
2311
|
+
(a === void 0 ? Ie.has(i) : Le(a)) && t.add(n);
|
|
2304
2312
|
}), t;
|
|
2305
2313
|
}
|
|
2306
|
-
function
|
|
2314
|
+
function ze(e) {
|
|
2307
2315
|
if (!e) return !1;
|
|
2308
2316
|
let t = W(e).querySelector("workbookPr")?.getAttribute("date1904");
|
|
2309
2317
|
return t === "1" || t === "true";
|
|
2310
2318
|
}
|
|
2311
|
-
function
|
|
2319
|
+
function Be(e, t) {
|
|
2312
2320
|
return new Date((t ? Date.UTC(1904, 0, 1) : Date.UTC(1899, 11, 30)) + Math.floor(e) * 864e5).toISOString().slice(0, 10);
|
|
2313
2321
|
}
|
|
2314
|
-
function
|
|
2322
|
+
function Ve(e, t, n, r) {
|
|
2315
2323
|
let i = W(e).querySelectorAll("row");
|
|
2316
2324
|
if (i.length === 0) return [];
|
|
2317
2325
|
let a = 0, o = /* @__PURE__ */ new Map();
|
|
@@ -2319,7 +2327,7 @@ function Be(e, t, n, r) {
|
|
|
2319
2327
|
let i = parseInt(e.getAttribute("r") ?? "1", 10) - 1, s = /* @__PURE__ */ new Map();
|
|
2320
2328
|
o.set(i, s);
|
|
2321
2329
|
for (let i of e.querySelectorAll("c")) {
|
|
2322
|
-
let e =
|
|
2330
|
+
let e = He(i.getAttribute("r") ?? "");
|
|
2323
2331
|
e > a && (a = e);
|
|
2324
2332
|
let o = i.getAttribute("t") ?? "", c = i.getAttribute("s") ?? "", l = i.querySelector("v")?.textContent ?? "", u = i.querySelector("is > t")?.textContent ?? null, d;
|
|
2325
2333
|
if (o === "s") d = t[parseInt(l, 10)] ?? "";
|
|
@@ -2328,7 +2336,7 @@ function Be(e, t, n, r) {
|
|
|
2328
2336
|
else if (l === "") d = "";
|
|
2329
2337
|
else {
|
|
2330
2338
|
let e = parseFloat(l);
|
|
2331
|
-
d = c !== "" && n.has(parseInt(c, 10)) && !isNaN(e) && e >= 0 ?
|
|
2339
|
+
d = c !== "" && n.has(parseInt(c, 10)) && !isNaN(e) && e >= 0 ? Be(e, r) : l;
|
|
2332
2340
|
}
|
|
2333
2341
|
s.set(e, d);
|
|
2334
2342
|
}
|
|
@@ -2342,13 +2350,13 @@ function Be(e, t, n, r) {
|
|
|
2342
2350
|
}
|
|
2343
2351
|
return c;
|
|
2344
2352
|
}
|
|
2345
|
-
function
|
|
2353
|
+
function He(e) {
|
|
2346
2354
|
let t = 0, n = 0;
|
|
2347
2355
|
for (; n < e.length && e[n] >= "A" && e[n] <= "Z";) t = t * 26 + (e.charCodeAt(n) - 64), n++;
|
|
2348
2356
|
return t - 1;
|
|
2349
2357
|
}
|
|
2350
2358
|
async function G(e) {
|
|
2351
|
-
let t = await
|
|
2359
|
+
let t = await Ne(e), n = Fe(t.get("xl/sharedStrings.xml")), r = t.get("xl/worksheets/sheet1.xml");
|
|
2352
2360
|
if (!r) {
|
|
2353
2361
|
for (let [e, n] of t) if (e.toLowerCase().includes("worksheets/sheet")) {
|
|
2354
2362
|
r = n;
|
|
@@ -2356,7 +2364,7 @@ async function G(e) {
|
|
|
2356
2364
|
}
|
|
2357
2365
|
}
|
|
2358
2366
|
if (!r) throw Error("XLSX: No worksheet found");
|
|
2359
|
-
let i =
|
|
2367
|
+
let i = Re(t.get("xl/styles.xml")), a = ze(t.get("xl/workbook.xml")), o = Ve(r, n, i, a);
|
|
2360
2368
|
return o.length === 0 ? {
|
|
2361
2369
|
headers: [],
|
|
2362
2370
|
rows: []
|
|
@@ -2366,7 +2374,7 @@ async function G(e) {
|
|
|
2366
2374
|
};
|
|
2367
2375
|
}
|
|
2368
2376
|
//#endregion
|
|
2369
|
-
//#region \0@oxc-project+runtime@0.
|
|
2377
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorate.js
|
|
2370
2378
|
function K(e, t, n, r) {
|
|
2371
2379
|
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
2372
2380
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
@@ -2382,9 +2390,9 @@ var q = {
|
|
|
2382
2390
|
lt: "<",
|
|
2383
2391
|
gte: "≥",
|
|
2384
2392
|
lte: "≤"
|
|
2385
|
-
}, J = 120, Y = 40, X = 20, Z = 32, Q = 5,
|
|
2393
|
+
}, J = 120, Y = 40, X = 20, Z = 32, Q = 5, Ue = 200, $ = class extends n {
|
|
2386
2394
|
constructor(...e) {
|
|
2387
|
-
super(...e), this.columns = [], this._data = [], this._inUndoRedo = !1, this.clearUndoOnDataChange = !1, this.clearSelectionOnDataChange = !1, this._rowHeightFromCss = Z, 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
|
|
2395
|
+
super(...e), this.columns = [], this._data = [], this._inUndoRedo = !1, this.clearUndoOnDataChange = !1, this.clearSelectionOnDataChange = !1, this._rowHeightFromCss = Z, 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 j(), this._editing = new se(), this._rowSelection = new M(), this._undo = new N(), 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 = () => {
|
|
2388
2396
|
this._commitCommentPopup();
|
|
2389
2397
|
}, 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();
|
|
2390
2398
|
}
|
|
@@ -2754,7 +2762,7 @@ var q = {
|
|
|
2754
2762
|
return V(this._sortedIndices.map((e) => this.data[e]), this.visibleColumns, e);
|
|
2755
2763
|
}
|
|
2756
2764
|
exportToFile(e, t) {
|
|
2757
|
-
|
|
2765
|
+
we(this.exportToString(e), t ?? `export${Oe(e)}`, De(e));
|
|
2758
2766
|
}
|
|
2759
2767
|
setComment(e, t, n) {
|
|
2760
2768
|
let r = this.getComment(e, t);
|
|
@@ -2814,7 +2822,7 @@ var q = {
|
|
|
2814
2822
|
let t = await G(await e.arrayBuffer());
|
|
2815
2823
|
this._applyImportedSheet(t);
|
|
2816
2824
|
} else if (t.endsWith(".csv") || t.endsWith(".tsv")) {
|
|
2817
|
-
let t =
|
|
2825
|
+
let t = P(await e.text());
|
|
2818
2826
|
this._applyImportedRows(t);
|
|
2819
2827
|
} else console.warn(`flex-table importFromFile: unsupported file type "${e.name}"`);
|
|
2820
2828
|
}
|
|
@@ -2825,7 +2833,7 @@ var q = {
|
|
|
2825
2833
|
let a = t.get(e);
|
|
2826
2834
|
if (!a) return;
|
|
2827
2835
|
let o = this.columns.find((e) => e.key === a);
|
|
2828
|
-
r[a] = o ?
|
|
2836
|
+
r[a] = o ? F(n[i] ?? "", o) : n[i] ?? null;
|
|
2829
2837
|
}), r;
|
|
2830
2838
|
}), r = [...this.data];
|
|
2831
2839
|
this.data = n, this._undo.push({
|
|
@@ -2850,7 +2858,7 @@ var q = {
|
|
|
2850
2858
|
let a = n.get(t);
|
|
2851
2859
|
if (!a) return;
|
|
2852
2860
|
let o = this.columns.find((e) => e.key === a);
|
|
2853
|
-
r[a] = o ?
|
|
2861
|
+
r[a] = o ? F(e[i] ?? "", o) : e[i] ?? null;
|
|
2854
2862
|
}), r;
|
|
2855
2863
|
}), i = [...this.data];
|
|
2856
2864
|
this.data = r, this._undo.push({
|
|
@@ -3034,7 +3042,7 @@ var q = {
|
|
|
3034
3042
|
e !== this._viewportHeight && (this._viewportHeight = e), t !== this._viewportWidth && (this._viewportWidth = t), this._warnIfUnconstrained();
|
|
3035
3043
|
}
|
|
3036
3044
|
_warnIfUnconstrained() {
|
|
3037
|
-
this._warnedUnconstrained || process.env.NODE_ENV === "production" || this._visibleRowCount <
|
|
3045
|
+
this._warnedUnconstrained || process.env.NODE_ENV === "production" || this._visibleRowCount < Ue || 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.`));
|
|
3038
3046
|
}
|
|
3039
3047
|
_onScroll() {
|
|
3040
3048
|
this._scrollTop = this.scrollTop, this._scrollLeft = this.scrollLeft;
|
|
@@ -3164,7 +3172,7 @@ var q = {
|
|
|
3164
3172
|
}
|
|
3165
3173
|
let t = this.shadowRoot?.querySelector(".ft-editor");
|
|
3166
3174
|
if (t) {
|
|
3167
|
-
let n =
|
|
3175
|
+
let n = F(t.value, e);
|
|
3168
3176
|
this._applyEdit(n);
|
|
3169
3177
|
} else this._cancelEdit();
|
|
3170
3178
|
}
|
|
@@ -3418,7 +3426,7 @@ var q = {
|
|
|
3418
3426
|
if (!this._activeCell) return;
|
|
3419
3427
|
let e = await this._readClipboardText();
|
|
3420
3428
|
if (e == null) return;
|
|
3421
|
-
let t =
|
|
3429
|
+
let t = P(e);
|
|
3422
3430
|
if (t.length === 0) return;
|
|
3423
3431
|
let n = this._expandRowsForPaste(this._activeCell.row, t.length), r = this._applyPasteData(this._activeCell, t);
|
|
3424
3432
|
if (r.length > 0 || n.length > 0) {
|
|
@@ -3476,7 +3484,7 @@ var q = {
|
|
|
3476
3484
|
for (let a = 0; a < t[i].length; a++) {
|
|
3477
3485
|
let s = e.col + a;
|
|
3478
3486
|
if (s >= n.length) break;
|
|
3479
|
-
let c = n[s], l = this.data[o][c.key], u =
|
|
3487
|
+
let c = n[s], l = this.data[o][c.key], u = F(t[i][a], c);
|
|
3480
3488
|
this.data[o][c.key] = u, r.push({
|
|
3481
3489
|
row: o,
|
|
3482
3490
|
col: s,
|
|
@@ -3541,7 +3549,7 @@ var q = {
|
|
|
3541
3549
|
for (let r = e.startCol + 1; r <= e.endCol; r++) {
|
|
3542
3550
|
let e = t[r];
|
|
3543
3551
|
if (!e || !this._isCellEditable(e)) continue;
|
|
3544
|
-
let a =
|
|
3552
|
+
let a = F(o == null ? "" : String(o), e);
|
|
3545
3553
|
n.push({
|
|
3546
3554
|
row: i,
|
|
3547
3555
|
key: e.key,
|
|
@@ -3700,7 +3708,7 @@ var q = {
|
|
|
3700
3708
|
@click=${n ? (t) => this._onHeaderClick(t, e) : void 0}>
|
|
3701
3709
|
${x ? i`
|
|
3702
3710
|
<button class="ft-hidden-col-indicator"
|
|
3703
|
-
title=${
|
|
3711
|
+
title=${A("showHiddenColumns")}
|
|
3704
3712
|
@click=${(t) => {
|
|
3705
3713
|
t.stopPropagation(), this._showHiddenBefore(e);
|
|
3706
3714
|
}}>❯</button>
|
|
@@ -3710,8 +3718,8 @@ var q = {
|
|
|
3710
3718
|
${o >= 0 ? i`<span class="ft-sort-order">${o + 1}</span>` : ""}
|
|
3711
3719
|
<button class="ft-column-menu-btn ${s ? "ft-filter-active" : ""}"
|
|
3712
3720
|
type="button"
|
|
3713
|
-
title=${
|
|
3714
|
-
aria-label=${
|
|
3721
|
+
title=${A("columnMenu")}
|
|
3722
|
+
aria-label=${A("columnMenuFor", { header: e.header })}
|
|
3715
3723
|
aria-haspopup="menu"
|
|
3716
3724
|
aria-expanded=${this._headerMenu?.key === e.key ? "true" : "false"}
|
|
3717
3725
|
@mousedown=${(e) => e.stopPropagation()}
|
|
@@ -3830,26 +3838,26 @@ var q = {
|
|
|
3830
3838
|
}}>${t}</button>
|
|
3831
3839
|
`;
|
|
3832
3840
|
return i`
|
|
3833
|
-
<div class="ft-header-menu" role="menu" aria-label=${
|
|
3841
|
+
<div class="ft-header-menu" role="menu" aria-label=${A("columnMenuRegion", { header: o.header })}
|
|
3834
3842
|
style="position: fixed; left: ${t}px; top: ${n}px; z-index: 200;"
|
|
3835
3843
|
@mousedown=${(e) => e.stopPropagation()}
|
|
3836
3844
|
@keydown=${(e) => this._onHeaderMenuKeydown(e)}>
|
|
3837
3845
|
${o.sortable === !1 ? a : i`
|
|
3838
|
-
${c("sort-asc",
|
|
3839
|
-
${c("sort-desc",
|
|
3846
|
+
${c("sort-asc", A("sortAscending"), () => this._applySortFromMenu(e, "asc"))}
|
|
3847
|
+
${c("sort-desc", A("sortDescending"), () => this._applySortFromMenu(e, "desc"))}
|
|
3840
3848
|
<div class="ft-header-menu-separator" role="separator"></div>
|
|
3841
3849
|
`}
|
|
3842
3850
|
${this.showFilters ? i`
|
|
3843
|
-
${c("filter",
|
|
3844
|
-
${s ? c("clear-filter",
|
|
3851
|
+
${c("filter", A("filter"), () => this._openFilterFromMenu(e))}
|
|
3852
|
+
${s ? c("clear-filter", A("clearFilter"), () => this._clearColumnFilter(e)) : a}
|
|
3845
3853
|
<div class="ft-header-menu-separator" role="separator"></div>
|
|
3846
3854
|
` : a}
|
|
3847
|
-
${c("hide",
|
|
3848
|
-
${r.map((e) => c("show",
|
|
3855
|
+
${c("hide", A("hideColumn"), () => this._setColumnHidden(e, !0))}
|
|
3856
|
+
${r.map((e) => c("show", A("showColumn", { header: e.header }), () => this._setColumnHidden(e.key, !1)))}
|
|
3849
3857
|
<div class="ft-header-menu-separator" role="separator"></div>
|
|
3850
|
-
${c("autofit",
|
|
3851
|
-
${c("wider",
|
|
3852
|
-
${c("narrower",
|
|
3858
|
+
${c("autofit", A("autoFitWidth"), () => this._autoFitColumn(e))}
|
|
3859
|
+
${c("wider", A("wider"), () => this._resizeColumnBy(e, X), !0)}
|
|
3860
|
+
${c("narrower", A("narrower"), () => this._resizeColumnBy(e, -20), !0)}
|
|
3853
3861
|
</div>
|
|
3854
3862
|
`;
|
|
3855
3863
|
}
|
|
@@ -3867,26 +3875,26 @@ var q = {
|
|
|
3867
3875
|
}}>${e}</button>
|
|
3868
3876
|
`, f = i`<div class="ft-context-menu-separator" role="separator"></div>`;
|
|
3869
3877
|
return i`
|
|
3870
|
-
<div class="ft-body-context-menu" role="menu" aria-label=${
|
|
3878
|
+
<div class="ft-body-context-menu" role="menu" aria-label=${A("cellActions")}
|
|
3871
3879
|
style="position: fixed; left: ${n}px; top: ${r}px; z-index: 200;"
|
|
3872
3880
|
@mousedown=${(e) => e.stopPropagation()}
|
|
3873
3881
|
@keydown=${(e) => this._onMenuKeydown(e, ".ft-body-context-menu", l)}>
|
|
3874
|
-
${d(
|
|
3882
|
+
${d(A("copy"), () => this._handleCopy(!1))}
|
|
3875
3883
|
${f}
|
|
3876
|
-
${d(
|
|
3877
|
-
${d(
|
|
3878
|
-
${d(
|
|
3884
|
+
${d(A("insertRowAbove"), () => this.addRow(void 0, t))}
|
|
3885
|
+
${d(A("insertRowBelow"), () => this.addRow(void 0, t + 1))}
|
|
3886
|
+
${d(A("deleteRow"), () => this.deleteRows([t]), !0)}
|
|
3879
3887
|
${f}
|
|
3880
|
-
${d(
|
|
3888
|
+
${d(A("hideColumn"), () => this._setColumnHidden(o.key, !0))}
|
|
3881
3889
|
${f}
|
|
3882
|
-
${d(`${
|
|
3883
|
-
${d(`${
|
|
3890
|
+
${d(`${A("sortAscending")} ↑`, () => this._applySortFromMenu(o.key, "asc"))}
|
|
3891
|
+
${d(`${A("sortDescending")} ↓`, () => this._applySortFromMenu(o.key, "desc"))}
|
|
3884
3892
|
${f}
|
|
3885
|
-
${d(
|
|
3886
|
-
${c ? d(
|
|
3893
|
+
${d(A("filterByThisValue"), () => this.setFilter(o.key, (e) => e === s))}
|
|
3894
|
+
${c ? d(A("clearFilter"), () => this.removeFilter(o.key)) : a}
|
|
3887
3895
|
${f}
|
|
3888
|
-
${d(
|
|
3889
|
-
${u ? d(
|
|
3896
|
+
${d(A(u ? "editComment" : "addComment"), () => this._openCommentPopup(t, o.key, n, r))}
|
|
3897
|
+
${u ? d(A("deleteComment"), () => this.setComment(t, o.key, null), !0) : a}
|
|
3890
3898
|
</div>
|
|
3891
3899
|
`;
|
|
3892
3900
|
}
|
|
@@ -3918,13 +3926,13 @@ var q = {
|
|
|
3918
3926
|
@mousedown=${(e) => e.stopPropagation()}>
|
|
3919
3927
|
<textarea class="ft-comment-popup-textarea"
|
|
3920
3928
|
rows="4"
|
|
3921
|
-
placeholder=${
|
|
3929
|
+
placeholder=${A("addCommentPlaceholder")}
|
|
3922
3930
|
@keydown=${(e) => {
|
|
3923
3931
|
e.key === "Escape" && (e.preventDefault(), this._cancelCommentPopup()), e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), this._commitCommentPopup());
|
|
3924
3932
|
}}></textarea>
|
|
3925
3933
|
<div class="ft-comment-popup-buttons">
|
|
3926
|
-
<button class="ft-comment-popup-cancel" @click=${() => this._cancelCommentPopup()}>${
|
|
3927
|
-
<button class="ft-comment-popup-save" @click=${() => this._commitCommentPopup()}>${
|
|
3934
|
+
<button class="ft-comment-popup-cancel" @click=${() => this._cancelCommentPopup()}>${A("cancel")}</button>
|
|
3935
|
+
<button class="ft-comment-popup-save" @click=${() => this._commitCommentPopup()}>${A("save")}</button>
|
|
3928
3936
|
</div>
|
|
3929
3937
|
</div>
|
|
3930
3938
|
`;
|
|
@@ -3960,7 +3968,7 @@ var q = {
|
|
|
3960
3968
|
<div class="ft-filter-dropdown" @click=${(e) => e.stopPropagation()}>
|
|
3961
3969
|
${t === "boolean" ? this._renderBooleanFilter(e) : t === "number" ? this._renderNumberFilter(e) : t === "date" || t === "datetime" ? this._renderDateFilter(e) : this._renderTextFilter(e)}
|
|
3962
3970
|
<div class="ft-filter-actions">
|
|
3963
|
-
<button class="ft-filter-clear" @click=${() => this._clearColumnFilter(e.key)}>${
|
|
3971
|
+
<button class="ft-filter-clear" @click=${() => this._clearColumnFilter(e.key)}>${A("clear")}</button>
|
|
3964
3972
|
</div>
|
|
3965
3973
|
</div>
|
|
3966
3974
|
`;
|
|
@@ -3993,7 +4001,7 @@ var q = {
|
|
|
3993
4001
|
let n = this._emptyFilterState.get(e) ?? "";
|
|
3994
4002
|
return i`
|
|
3995
4003
|
<div class="ft-filter-empty-row">
|
|
3996
|
-
<label>${
|
|
4004
|
+
<label>${A("blankCells")}</label>
|
|
3997
4005
|
<select class="ft-filter-mode-select"
|
|
3998
4006
|
.value=${n}
|
|
3999
4007
|
@change=${(n) => {
|
|
@@ -4003,9 +4011,9 @@ var q = {
|
|
|
4003
4011
|
@keydown=${(e) => {
|
|
4004
4012
|
e.key === "Escape" && (this._openFilterKey = null), e.stopPropagation();
|
|
4005
4013
|
}}>
|
|
4006
|
-
<option value="">${
|
|
4007
|
-
<option value="empty">${
|
|
4008
|
-
<option value="non-empty">${
|
|
4014
|
+
<option value="">${A("blankAll")}</option>
|
|
4015
|
+
<option value="empty">${A("emptyOnly")}</option>
|
|
4016
|
+
<option value="non-empty">${A("nonEmptyOnly")}</option>
|
|
4009
4017
|
</select>
|
|
4010
4018
|
</div>
|
|
4011
4019
|
`;
|
|
@@ -4081,13 +4089,13 @@ var q = {
|
|
|
4081
4089
|
@keydown=${(e) => {
|
|
4082
4090
|
e.key === "Escape" && (this._openFilterKey = null), e.stopPropagation();
|
|
4083
4091
|
}}>
|
|
4084
|
-
<option value="contains">${
|
|
4085
|
-
<option value="starts">${
|
|
4086
|
-
<option value="ends">${
|
|
4087
|
-
<option value="wildcard">${
|
|
4092
|
+
<option value="contains">${A("contains")}</option>
|
|
4093
|
+
<option value="starts">${A("startsWith")}</option>
|
|
4094
|
+
<option value="ends">${A("endsWith")}</option>
|
|
4095
|
+
<option value="wildcard">${A("wildcard")}</option>
|
|
4088
4096
|
</select>
|
|
4089
4097
|
</div>
|
|
4090
|
-
<input class="ft-filter-input" type="text" placeholder=${
|
|
4098
|
+
<input class="ft-filter-input" type="text" placeholder=${A("searchPlaceholder")}
|
|
4091
4099
|
.value=${t.value}
|
|
4092
4100
|
@input=${(t) => {
|
|
4093
4101
|
let n = t.target.value, r = this._textFilterState.get(e.key) ?? {
|
|
@@ -4138,7 +4146,7 @@ var q = {
|
|
|
4138
4146
|
}}>
|
|
4139
4147
|
${Object.keys(q).map((e) => i`<option value=${e}>${q[e]}</option>`)}
|
|
4140
4148
|
</select>
|
|
4141
|
-
<input class="ft-filter-input ft-num-cond-input" type="number" placeholder=${
|
|
4149
|
+
<input class="ft-filter-input ft-num-cond-input" type="number" placeholder=${A("valuePlaceholder")}
|
|
4142
4150
|
.value=${n.value == null ? "" : String(n.value)}
|
|
4143
4151
|
@input=${(n) => {
|
|
4144
4152
|
let r = n.target.value, i = this._numberFilterState.get(e) ?? this._defaultNumState();
|
|
@@ -4199,13 +4207,13 @@ var q = {
|
|
|
4199
4207
|
let t = e.type === "datetime" ? "datetime-local" : "date", n = this._dateFilterState.get(e.key) ?? {};
|
|
4200
4208
|
return i`
|
|
4201
4209
|
<div class="ft-filter-range">
|
|
4202
|
-
<input class="ft-filter-input" type=${t} placeholder=${
|
|
4210
|
+
<input class="ft-filter-input" type=${t} placeholder=${A("fromPlaceholder")}
|
|
4203
4211
|
.value=${n.from ?? ""}
|
|
4204
4212
|
@input=${(t) => this._applyDateFilter(e.key, t, "from")}
|
|
4205
4213
|
@keydown=${(e) => {
|
|
4206
4214
|
e.key === "Escape" && (this._openFilterKey = null), e.stopPropagation();
|
|
4207
4215
|
}}>
|
|
4208
|
-
<input class="ft-filter-input" type=${t} placeholder=${
|
|
4216
|
+
<input class="ft-filter-input" type=${t} placeholder=${A("toPlaceholder")}
|
|
4209
4217
|
.value=${n.to ?? ""}
|
|
4210
4218
|
@input=${(t) => this._applyDateFilter(e.key, t, "to")}
|
|
4211
4219
|
@keydown=${(e) => {
|
|
@@ -4231,9 +4239,9 @@ var q = {
|
|
|
4231
4239
|
@keydown=${(e) => {
|
|
4232
4240
|
e.key === "Escape" && (this._openFilterKey = null), e.stopPropagation();
|
|
4233
4241
|
}}>
|
|
4234
|
-
<option value="all">${
|
|
4235
|
-
<option value="true">\u2714 ${
|
|
4236
|
-
<option value="false">\u2718 ${
|
|
4242
|
+
<option value="all">${A("all")}</option>
|
|
4243
|
+
<option value="true">\u2714 ${A("booleanTrue")}</option>
|
|
4244
|
+
<option value="false">\u2718 ${A("booleanFalse")}</option>
|
|
4237
4245
|
</select>
|
|
4238
4246
|
${this._renderEmptyFilterRow(e.key)}
|
|
4239
4247
|
`;
|
|
@@ -4653,39 +4661,39 @@ var q = {
|
|
|
4653
4661
|
e.key === "Enter" && e.target instanceof HTMLInputElement && e.target.classList.contains("ft-find-input") && (e.shiftKey ? this._findPrev() : this._findNext());
|
|
4654
4662
|
}}>
|
|
4655
4663
|
<div class="ft-find-row">
|
|
4656
|
-
<input class="ft-find-input" type="text" placeholder=${
|
|
4664
|
+
<input class="ft-find-input" type="text" placeholder=${A("findPlaceholder")}
|
|
4657
4665
|
.value=${t}
|
|
4658
4666
|
@input=${(e) => {
|
|
4659
4667
|
this._findState.query = e.target.value, this._findSearch();
|
|
4660
4668
|
}}>
|
|
4661
4669
|
<span class="ft-find-count">${c > 0 ? `${l}/${c}` : t ? "0 results" : ""}</span>
|
|
4662
|
-
<button @click=${() => this._findPrev()} title=${
|
|
4663
|
-
<button @click=${() => this._findNext()} title=${
|
|
4664
|
-
<label title=${
|
|
4670
|
+
<button @click=${() => this._findPrev()} title=${A("findPrevious")}>◀</button>
|
|
4671
|
+
<button @click=${() => this._findNext()} title=${A("findNext")}>▶</button>
|
|
4672
|
+
<label title=${A("matchCase")}><input type="checkbox" ?checked=${r} @change=${(e) => {
|
|
4665
4673
|
this._findState.matchCase = e.target.checked, this._findSearch();
|
|
4666
4674
|
}}> Aa</label>
|
|
4667
|
-
<label title=${
|
|
4675
|
+
<label title=${A("wholeCell")}><input type="checkbox" ?checked=${a} @change=${(e) => {
|
|
4668
4676
|
this._findState.wholeCell = e.target.checked, this._findSearch();
|
|
4669
4677
|
}}> [ ]</label>
|
|
4670
|
-
<button @click=${() => this._closeFindPanel()} title=${
|
|
4678
|
+
<button @click=${() => this._closeFindPanel()} title=${A("closeFind")}>✕</button>
|
|
4671
4679
|
</div>
|
|
4672
4680
|
${e === "replace" ? i`
|
|
4673
4681
|
<div class="ft-find-row">
|
|
4674
|
-
<input class="ft-find-replace-input" type="text" placeholder=${
|
|
4682
|
+
<input class="ft-find-replace-input" type="text" placeholder=${A("replaceWithPlaceholder")}
|
|
4675
4683
|
.value=${n}
|
|
4676
4684
|
@input=${(e) => {
|
|
4677
4685
|
this._findState.replaceWith = e.target.value;
|
|
4678
4686
|
}}>
|
|
4679
|
-
<button @click=${() => this._replaceOne()} ?disabled=${c === 0}>${
|
|
4680
|
-
<button @click=${() => this._replaceAll()} ?disabled=${c === 0}>${
|
|
4687
|
+
<button @click=${() => this._replaceOne()} ?disabled=${c === 0}>${A("replace")}</button>
|
|
4688
|
+
<button @click=${() => this._replaceAll()} ?disabled=${c === 0}>${A("replaceAll")}</button>
|
|
4681
4689
|
</div>
|
|
4682
4690
|
` : ""}
|
|
4683
4691
|
</div>
|
|
4684
4692
|
`;
|
|
4685
4693
|
}
|
|
4686
4694
|
render() {
|
|
4687
|
-
let e = this.visibleColumns, t = this.importEnabled && this._isDragOver ? i`<div class="ft-import-overlay">${
|
|
4688
|
-
if (e.length === 0) return i`${t}${n}<div class="ft-empty">${
|
|
4695
|
+
let e = this.visibleColumns, t = this.importEnabled && this._isDragOver ? i`<div class="ft-import-overlay">${A("dropFileToImport")}</div>` : a, n = this.loading ? i`<div class="ft-loading-overlay"></div>` : a;
|
|
4696
|
+
if (e.length === 0) return i`${t}${n}<div class="ft-empty">${A("noColumnsDefined")}</div>`;
|
|
4689
4697
|
let r = this.headerHeight, o = this._totalRowWidth, { start: s, end: c } = this.visibleColRange, l = [];
|
|
4690
4698
|
for (let t = 0; t < e.length; t++) (e[t].pinned === "left" || e[t].pinned === "right") && (t < s || t >= c) && l.push(t);
|
|
4691
4699
|
let u = 0, d = this._scrollLeft, f = this.selectable ? i`<div class="ft-checkbox-header"
|
|
@@ -4856,7 +4864,7 @@ var q = {
|
|
|
4856
4864
|
@click=${(e) => this._onCellClickEvent(e, n, r)}
|
|
4857
4865
|
@dblclick=${() => this._onCellDblClick(n, r)}>
|
|
4858
4866
|
${E}
|
|
4859
|
-
${
|
|
4867
|
+
${O(e[t.key], e, t)}
|
|
4860
4868
|
</div>
|
|
4861
4869
|
`;
|
|
4862
4870
|
}
|
|
@@ -4994,4 +5002,4 @@ K([s({ type: Array })], $.prototype, "columns", void 0), K([s({
|
|
|
4994
5002
|
attribute: "max-undo-size"
|
|
4995
5003
|
})], $.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")], $);
|
|
4996
5004
|
//#endregion
|
|
4997
|
-
export {
|
|
5005
|
+
export { k as a, M as i, V as n, O as o, N as r, $ as t };
|
package/dist/flex-table.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, t as a } from "./flex-table-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "./flex-table-JGaGcJTl.js";
|
|
2
2
|
export { a as FlexTable, t as RowSelectionState, i as UndoStack, n as exportData, e as flexTableLocale, r as renderCell };
|
package/dist/odata/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as e, n as t, t as n } from "../use-odata-source-
|
|
1
|
+
import { i as e, n as t, t as n } from "../use-odata-source-BiZrIEVV.js";
|
|
2
2
|
export { n as buildSearchExpression, t as parseOrderBy, e as useODataSource };
|
package/dist/odata/types.d.ts
CHANGED
|
@@ -25,6 +25,16 @@ export interface UseODataSourceOptions {
|
|
|
25
25
|
fetcher?: (input: string, init: RequestInit) => Promise<Response>;
|
|
26
26
|
/** 응답이 401/403일 때 호출(세션 만료 리다이렉트 등). 호출 후에도 기존 에러 처리는 계속 진행된다. */
|
|
27
27
|
onUnauthorized?: (response: Response) => void;
|
|
28
|
+
/**
|
|
29
|
+
* `false` 인 동안 요청하지 않는다. 기본값 `true`.
|
|
30
|
+
*
|
|
31
|
+
* 조회 조건이 다른 비동기 값(현재 사용자·기본 필터·선택된 부모 레코드)에 달린 목록에서
|
|
32
|
+
* 그 값이 오기 전에 «틀린 조건의 첫 조회» 가 나가지 않게 한다. `false → true` 가 되는 순간
|
|
33
|
+
* 첫 조회가 나가고, 그 사이 `loading` 은 `true` 다(표가 «데이터 없음» 이 아니라 «불러오는 중»
|
|
34
|
+
* 을 보인다). 조회 중에 `false` 가 되면 진행 중 요청을 취소한다. `false` 인 동안의 `refresh()` 는
|
|
35
|
+
* 아무 일도 하지 않는다 — 켜지는 순간의 조회가 이미 최신 조건이다.
|
|
36
|
+
*/
|
|
37
|
+
enabled?: boolean;
|
|
28
38
|
}
|
|
29
39
|
export interface UseODataSourceResult<T> {
|
|
30
40
|
data: T[];
|
package/dist/react.js
CHANGED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
import i from "odata-query";
|
|
3
|
+
//#region src/odata/use-odata-source.ts
|
|
4
|
+
function a(e) {
|
|
5
|
+
let t = e.split(/\s+/).map((e) => e.replace(/"/g, "")).filter((e) => e.length > 0);
|
|
6
|
+
if (t.length !== 0) return t.map((e) => `"${e}"`).join(" AND ");
|
|
7
|
+
}
|
|
8
|
+
function o(e) {
|
|
9
|
+
let { defaultOrderBy: t, initialPage: n = 0, initialSearch: r = "", initialSort: i } = e;
|
|
10
|
+
return {
|
|
11
|
+
page: n,
|
|
12
|
+
search: r,
|
|
13
|
+
sortCriteria: i ?? (t ? c(t) : [])
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function s(s, c = {}) {
|
|
17
|
+
let { pageSize: l = 20, defaultOrderBy: u, initialPage: d = 0, initialSearch: f = "", initialSort: p, fixedFilter: m, baseUrl: h, fetcher: g = fetch, onUnauthorized: _, enabled: v = !0 } = c, y = m ? JSON.stringify(m) : "", [b, x] = r([]), [S, C] = r(0), [w, T] = r(!1), [E, D] = r(null), O = o({
|
|
18
|
+
defaultOrderBy: u,
|
|
19
|
+
initialPage: d,
|
|
20
|
+
initialSearch: f,
|
|
21
|
+
initialSort: p
|
|
22
|
+
}), [k, A] = r(O.page), [j, M] = r(O.sortCriteria), [N, P] = r(O.search), [F, I] = r(0), [L, R] = r(y);
|
|
23
|
+
y !== L && (R(y), A(0));
|
|
24
|
+
let z = n(null), B = e(() => {
|
|
25
|
+
I((e) => e + 1);
|
|
26
|
+
}, []), V = e((e) => {
|
|
27
|
+
P(e), A(0);
|
|
28
|
+
}, []), H = e((e) => {
|
|
29
|
+
let t = e.detail?.criteria;
|
|
30
|
+
t && (M(t), A(0));
|
|
31
|
+
}, []);
|
|
32
|
+
return t(() => {
|
|
33
|
+
if (z.current?.abort(), !v) return;
|
|
34
|
+
let e = new AbortController();
|
|
35
|
+
z.current = e, T(!0), D(null);
|
|
36
|
+
let t = j.length > 0 ? j.map((e) => `${e.key} ${e.direction}`).join(", ") : u, n = {
|
|
37
|
+
top: l,
|
|
38
|
+
skip: k * l,
|
|
39
|
+
count: !0
|
|
40
|
+
};
|
|
41
|
+
if (t && (n.orderBy = t), m && (n.filter = m), N) {
|
|
42
|
+
let e = a(N);
|
|
43
|
+
e && (n.search = e);
|
|
44
|
+
}
|
|
45
|
+
let r = i(n), o = `${h ?? window.location.origin}${s}${r}`, c = async (t) => {
|
|
46
|
+
let n = await g(t, { signal: e.signal });
|
|
47
|
+
if (!n.ok) {
|
|
48
|
+
(n.status === 401 || n.status === 403) && _ && _(n);
|
|
49
|
+
let e = await n.text().catch(() => ""), t = `Request failed (${n.status})`;
|
|
50
|
+
try {
|
|
51
|
+
let n = JSON.parse(e);
|
|
52
|
+
t = n?.error?.message ?? n?.message ?? t;
|
|
53
|
+
} catch {}
|
|
54
|
+
throw Error(t);
|
|
55
|
+
}
|
|
56
|
+
return n.json();
|
|
57
|
+
};
|
|
58
|
+
return (async () => {
|
|
59
|
+
let e = await c(o), t = [...e.value ?? e], n = new URL(o).origin, r = /* @__PURE__ */ new Set([o]), i = o, a = e["@odata.nextLink"];
|
|
60
|
+
for (; typeof a == "string" && a && t.length < l;) {
|
|
61
|
+
let e = new URL(a, i);
|
|
62
|
+
if (e.origin !== n) throw Error(`OData nextLink points outside the source origin (${e.origin})`);
|
|
63
|
+
if (i = e.toString(), r.has(i)) throw Error(`OData nextLink repeats an already-read page (${i})`);
|
|
64
|
+
r.add(i);
|
|
65
|
+
let o = await c(i);
|
|
66
|
+
t.push(...o.value ?? []), a = o["@odata.nextLink"];
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
count: e["@odata.count"],
|
|
70
|
+
rows: t
|
|
71
|
+
};
|
|
72
|
+
})().then(({ count: t, rows: n }) => {
|
|
73
|
+
if (e.signal.aborted) return;
|
|
74
|
+
let r = t ?? 0;
|
|
75
|
+
x(n), C(r), D(null);
|
|
76
|
+
let i = r === 0 ? 0 : Math.ceil(r / l) - 1;
|
|
77
|
+
k > i && A(i);
|
|
78
|
+
}).catch((t) => {
|
|
79
|
+
e.signal.aborted || t.name !== "AbortError" && (D(t.message), x([]), C(0));
|
|
80
|
+
}).finally(() => {
|
|
81
|
+
e.signal.aborted || T(!1);
|
|
82
|
+
}), () => e.abort();
|
|
83
|
+
}, [
|
|
84
|
+
v,
|
|
85
|
+
s,
|
|
86
|
+
k,
|
|
87
|
+
l,
|
|
88
|
+
j,
|
|
89
|
+
N,
|
|
90
|
+
y,
|
|
91
|
+
u,
|
|
92
|
+
F,
|
|
93
|
+
h
|
|
94
|
+
]), {
|
|
95
|
+
data: b,
|
|
96
|
+
totalCount: S,
|
|
97
|
+
loading: w || !v,
|
|
98
|
+
error: E,
|
|
99
|
+
page: k,
|
|
100
|
+
setPage: A,
|
|
101
|
+
sortCriteria: j,
|
|
102
|
+
onSortChange: H,
|
|
103
|
+
search: N,
|
|
104
|
+
setSearch: V,
|
|
105
|
+
refresh: B
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function c(e) {
|
|
109
|
+
return e.split(",").map((e) => {
|
|
110
|
+
let t = e.trim().split(/\s+/);
|
|
111
|
+
return {
|
|
112
|
+
key: t[0],
|
|
113
|
+
direction: t[1]?.toLowerCase() === "desc" ? "desc" : "asc"
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
export { s as i, c as n, o as r, a as t };
|
package/package.json
CHANGED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
-
import i from "odata-query";
|
|
3
|
-
//#region src/odata/use-odata-source.ts
|
|
4
|
-
function a(e) {
|
|
5
|
-
let t = e.split(/\s+/).map((e) => e.replace(/"/g, "")).filter((e) => e.length > 0);
|
|
6
|
-
if (t.length !== 0) return t.map((e) => `"${e}"`).join(" AND ");
|
|
7
|
-
}
|
|
8
|
-
function o(e) {
|
|
9
|
-
let { defaultOrderBy: t, initialPage: n = 0, initialSearch: r = "", initialSort: i } = e;
|
|
10
|
-
return {
|
|
11
|
-
page: n,
|
|
12
|
-
search: r,
|
|
13
|
-
sortCriteria: i ?? (t ? c(t) : [])
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function s(s, c = {}) {
|
|
17
|
-
let { pageSize: l = 20, defaultOrderBy: u, initialPage: d = 0, initialSearch: f = "", initialSort: p, fixedFilter: m, baseUrl: h, fetcher: g = fetch, onUnauthorized: _ } = c, v = m ? JSON.stringify(m) : "", [y, b] = r([]), [x, S] = r(0), [C, w] = r(!1), [T, E] = r(null), D = o({
|
|
18
|
-
defaultOrderBy: u,
|
|
19
|
-
initialPage: d,
|
|
20
|
-
initialSearch: f,
|
|
21
|
-
initialSort: p
|
|
22
|
-
}), [O, k] = r(D.page), [A, j] = r(D.sortCriteria), [M, N] = r(D.search), [P, F] = r(0), [I, L] = r(v);
|
|
23
|
-
v !== I && (L(v), k(0));
|
|
24
|
-
let R = n(null), z = e(() => {
|
|
25
|
-
F((e) => e + 1);
|
|
26
|
-
}, []), B = e((e) => {
|
|
27
|
-
N(e), k(0);
|
|
28
|
-
}, []), V = e((e) => {
|
|
29
|
-
let t = e.detail?.criteria;
|
|
30
|
-
t && (j(t), k(0));
|
|
31
|
-
}, []);
|
|
32
|
-
return t(() => {
|
|
33
|
-
R.current?.abort();
|
|
34
|
-
let e = new AbortController();
|
|
35
|
-
R.current = e, w(!0), E(null);
|
|
36
|
-
let t = A.length > 0 ? A.map((e) => `${e.key} ${e.direction}`).join(", ") : u, n = {
|
|
37
|
-
top: l,
|
|
38
|
-
skip: O * l,
|
|
39
|
-
count: !0
|
|
40
|
-
};
|
|
41
|
-
if (t && (n.orderBy = t), m && (n.filter = m), M) {
|
|
42
|
-
let e = a(M);
|
|
43
|
-
e && (n.search = e);
|
|
44
|
-
}
|
|
45
|
-
let r = i(n), o = `${h ?? window.location.origin}${s}${r}`;
|
|
46
|
-
return g(o, { signal: e.signal }).then(async (e) => {
|
|
47
|
-
if (!e.ok) {
|
|
48
|
-
(e.status === 401 || e.status === 403) && _ && _(e);
|
|
49
|
-
let t = await e.text().catch(() => ""), n = `Request failed (${e.status})`;
|
|
50
|
-
try {
|
|
51
|
-
let e = JSON.parse(t);
|
|
52
|
-
n = e?.error?.message ?? e?.message ?? n;
|
|
53
|
-
} catch {}
|
|
54
|
-
throw Error(n);
|
|
55
|
-
}
|
|
56
|
-
return e.json();
|
|
57
|
-
}).then((t) => {
|
|
58
|
-
if (e.signal.aborted) return;
|
|
59
|
-
let n = t["@odata.count"] ?? 0;
|
|
60
|
-
b(t.value ?? t), S(n), E(null);
|
|
61
|
-
let r = n === 0 ? 0 : Math.ceil(n / l) - 1;
|
|
62
|
-
O > r && k(r);
|
|
63
|
-
}).catch((t) => {
|
|
64
|
-
e.signal.aborted || t.name !== "AbortError" && (E(t.message), b([]), S(0));
|
|
65
|
-
}).finally(() => {
|
|
66
|
-
e.signal.aborted || w(!1);
|
|
67
|
-
}), () => e.abort();
|
|
68
|
-
}, [
|
|
69
|
-
s,
|
|
70
|
-
O,
|
|
71
|
-
l,
|
|
72
|
-
A,
|
|
73
|
-
M,
|
|
74
|
-
v,
|
|
75
|
-
u,
|
|
76
|
-
P,
|
|
77
|
-
h
|
|
78
|
-
]), {
|
|
79
|
-
data: y,
|
|
80
|
-
totalCount: x,
|
|
81
|
-
loading: C,
|
|
82
|
-
error: T,
|
|
83
|
-
page: O,
|
|
84
|
-
setPage: k,
|
|
85
|
-
sortCriteria: A,
|
|
86
|
-
onSortChange: V,
|
|
87
|
-
search: M,
|
|
88
|
-
setSearch: B,
|
|
89
|
-
refresh: z
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function c(e) {
|
|
93
|
-
return e.split(",").map((e) => {
|
|
94
|
-
let t = e.trim().split(/\s+/);
|
|
95
|
-
return {
|
|
96
|
-
key: t[0],
|
|
97
|
-
direction: t[1]?.toLowerCase() === "desc" ? "desc" : "asc"
|
|
98
|
-
};
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
//#endregion
|
|
102
|
-
export { s as i, c as n, o as r, a as t };
|