@bigcapitalhq/blueprintjs-react-table 0.1.0 → 0.3.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/README.md +245 -7
- package/dist/blueprintjs-react-table.cjs +6 -0
- package/dist/blueprintjs-react-table.cjs.map +1 -0
- package/dist/blueprintjs-react-table.js +2533 -0
- package/dist/blueprintjs-react-table.js.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/types/components/BP_Table.d.ts +119 -6
- package/dist/types/components/body/TableBody.d.ts +18 -1
- package/dist/types/components/body/TableBodyCell.d.ts +6 -3
- package/dist/types/components/body/TableGhostCells.d.ts +18 -4
- package/dist/types/components/body/TableRowHeaderCell.d.ts +9 -3
- package/dist/types/components/body/TableRowHeaders.d.ts +16 -1
- package/dist/types/components/body/TableRowSelectionCell.d.ts +18 -0
- package/dist/types/components/common/cell-selection.d.ts +57 -0
- package/dist/types/components/common/cellCoordinates.d.ts +25 -4
- package/dist/types/components/common/classes.d.ts +8 -0
- package/dist/types/components/common/dimensions.d.ts +5 -0
- package/dist/types/components/common/menu-context.d.ts +81 -0
- package/dist/types/components/common/pinning.d.ts +44 -0
- package/dist/types/components/common/region.d.ts +26 -0
- package/dist/types/components/common/table-selection-context.d.ts +3 -3
- package/dist/types/components/container/TableContainer.d.ts +8 -2
- package/dist/types/components/head/TableColumnHeaders.d.ts +4 -1
- package/dist/types/components/head/TableHead.d.ts +3 -1
- package/dist/types/components/head/TableRowSelectionHeaderCell.d.ts +13 -0
- package/dist/types/components/layers/TableRegionLayer.d.ts +10 -2
- package/dist/types/components/layers/TableReorderGuides.d.ts +10 -1
- package/dist/types/components/layers/TableResizeGuides.d.ts +18 -5
- package/dist/types/components/pagination/TablePaginationBar.d.ts +30 -0
- package/dist/types/components/pagination/constants.d.ts +4 -0
- package/dist/types/components/pagination/withPagination.d.ts +51 -0
- package/dist/types/components/quadrant/TableQuadrant.d.ts +41 -10
- package/dist/types/components/quadrant/TableQuadrantStack.d.ts +38 -0
- package/dist/types/components/quadrant/quadrant-type.d.ts +10 -0
- package/dist/types/hooks/use-bp-table-instance.d.ts +31 -0
- package/dist/types/hooks/use-cell-selection.d.ts +62 -0
- package/dist/types/hooks/use-column-header-height.d.ts +24 -0
- package/dist/types/hooks/use-column-reorder.d.ts +7 -3
- package/dist/types/hooks/use-freeze-pinning.d.ts +25 -0
- package/dist/types/hooks/use-row-virtualizer.d.ts +13 -2
- package/dist/types/hooks/use-uncontrolled.d.ts +19 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/types.d.ts +12 -1
- package/package.json +2 -2
- package/dist/types/components/body/TableStaticBody.d.ts +0 -10
- package/dist/types/components/body/VirtualBody.d.ts +0 -12
- package/dist/types/components/quadrant/TableBottomContainer.d.ts +0 -14
- package/dist/types/components/quadrant/TableTopContainer.d.ts +0 -11
- package/dist/types/hooks/use-cell-focus-selection.d.ts +0 -34
|
@@ -0,0 +1,2533 @@
|
|
|
1
|
+
var be = Object.defineProperty;
|
|
2
|
+
var Fe = (t, e, n) => e in t ? be(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var ut = (t, e, n) => Fe(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { jsx as d, jsxs as F, Fragment as vt } from "react/jsx-runtime";
|
|
5
|
+
import { useLayoutEffect as st, useState as tt, useRef as X, useCallback as b, useMemo as dt, useEffect as at, createContext as se, useContext as re, Fragment as kt } from "react";
|
|
6
|
+
import { tableFeatures as Pt, sortFns as Ge, rowSortingFeature as We, cellSelectionFeature as ke, rowSelectionFeature as Ve, rowPinningFeature as Ye, columnPinningFeature as Xe, columnVisibilityFeature as Qe, columnOrderingFeature as Ke, columnResizingFeature as Ze, columnSizingFeature as je, createSortedRowModel as qe, useTable as Je, functionalUpdate as ce, rowPaginationFeature as ie, createPaginatedRowModel as ue } from "@tanstack/react-table";
|
|
7
|
+
import { useVirtualizer as tn } from "@tanstack/react-virtual";
|
|
8
|
+
import { Classes as nt, ContextMenu as en, Checkbox as ae, PopoverNext as nn, Icon as on, Menu as ln, MenuItem as Dt, HTMLSelect as sn, ButtonGroup as rn, Button as Rt } from "@blueprintjs/core";
|
|
9
|
+
import { DragHandleVerticalIcon as cn } from "@blueprintjs/icons";
|
|
10
|
+
var Mt = /* @__PURE__ */ ((t) => (t.CELLS = "cells", t.COLUMN_HEADERS = "column-header", t.ROW_HEADERS = "row-header", t))(Mt || {});
|
|
11
|
+
function yt(t, e) {
|
|
12
|
+
return t.indexOf(e) !== -1;
|
|
13
|
+
}
|
|
14
|
+
const Ut = Pt({
|
|
15
|
+
columnSizingFeature: je,
|
|
16
|
+
columnResizingFeature: Ze,
|
|
17
|
+
columnOrderingFeature: Ke,
|
|
18
|
+
columnVisibilityFeature: Qe,
|
|
19
|
+
columnPinningFeature: Xe,
|
|
20
|
+
rowPinningFeature: Ye,
|
|
21
|
+
rowSelectionFeature: Ve,
|
|
22
|
+
cellSelectionFeature: ke,
|
|
23
|
+
rowSortingFeature: We,
|
|
24
|
+
sortedRowModel: qe(),
|
|
25
|
+
sortFns: Ge
|
|
26
|
+
}), un = (t) => Je({
|
|
27
|
+
...t,
|
|
28
|
+
initialState: t.initialState ?? {},
|
|
29
|
+
features: t.features ?? Ut,
|
|
30
|
+
columnResizeMode: t.columnResizeMode ?? "onEnd"
|
|
31
|
+
});
|
|
32
|
+
function an({
|
|
33
|
+
table: t,
|
|
34
|
+
numFrozenColumns: e,
|
|
35
|
+
numFrozenRows: n
|
|
36
|
+
}) {
|
|
37
|
+
const o = t.getVisibleLeafColumns(), s = t.getRowModel().rows;
|
|
38
|
+
st(() => {
|
|
39
|
+
var c;
|
|
40
|
+
if (t.setColumnPinning == null)
|
|
41
|
+
return;
|
|
42
|
+
const l = o.slice(0, Math.max(0, e)).map((i) => i.id), r = ((c = t.state.columnPinning) == null ? void 0 : c.start) ?? [];
|
|
43
|
+
Vt(r, l) || t.setColumnPinning((i) => ({ ...i, start: l }));
|
|
44
|
+
}, [e, t, o]), st(() => {
|
|
45
|
+
var c;
|
|
46
|
+
if (t.setRowPinning == null)
|
|
47
|
+
return;
|
|
48
|
+
const l = s.slice(0, Math.max(0, n)).map((i) => i.id), r = ((c = t.state.rowPinning) == null ? void 0 : c.top) ?? [];
|
|
49
|
+
Vt(r, l) || t.setRowPinning((i) => ({ ...i, top: l }));
|
|
50
|
+
}, [n, s, t]);
|
|
51
|
+
}
|
|
52
|
+
function Vt(t, e) {
|
|
53
|
+
return t.length === e.length && t.every((n, o) => n === e[o]);
|
|
54
|
+
}
|
|
55
|
+
const de = 5;
|
|
56
|
+
function dn({
|
|
57
|
+
table: t,
|
|
58
|
+
columnHeaderHeight: e,
|
|
59
|
+
frozenRowCount: n,
|
|
60
|
+
frozenRowsHeight: o,
|
|
61
|
+
getRowHeight: s,
|
|
62
|
+
scrollContainerRef: l,
|
|
63
|
+
enableRowVirtualization: r,
|
|
64
|
+
overscanRowCount: c
|
|
65
|
+
}) {
|
|
66
|
+
const i = Math.max(0, t.getRowModel().rows.length - n), u = tn({
|
|
67
|
+
count: i,
|
|
68
|
+
getScrollElement: () => l.current,
|
|
69
|
+
estimateSize: (f) => s(n + f),
|
|
70
|
+
overscan: c,
|
|
71
|
+
/**
|
|
72
|
+
* The scrollable body sits below the column-header area and the frozen
|
|
73
|
+
* rows inside the shared scroll container; this offset aligns virtual item
|
|
74
|
+
* offsets with the absolute positioning used by body cells.
|
|
75
|
+
*/
|
|
76
|
+
scrollMargin: e + o,
|
|
77
|
+
enabled: r
|
|
78
|
+
});
|
|
79
|
+
return st(() => {
|
|
80
|
+
u.measure();
|
|
81
|
+
}, [n, s, u]), r ? u : void 0;
|
|
82
|
+
}
|
|
83
|
+
function fn({
|
|
84
|
+
value: t,
|
|
85
|
+
initialValue: e,
|
|
86
|
+
finalValue: n,
|
|
87
|
+
onChange: o = () => {
|
|
88
|
+
}
|
|
89
|
+
}) {
|
|
90
|
+
const [s, l] = tt(
|
|
91
|
+
e !== void 0 ? e : n
|
|
92
|
+
), r = (c) => {
|
|
93
|
+
l(c), o == null || o(c);
|
|
94
|
+
};
|
|
95
|
+
return t !== void 0 ? [t, o, !0] : [s, r, !1];
|
|
96
|
+
}
|
|
97
|
+
const hn = 20, mn = 30, fe = 30, wn = 30, Yt = 150, En = 50, Ln = 200;
|
|
98
|
+
function gn(t) {
|
|
99
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
100
|
+
}
|
|
101
|
+
var he = { exports: {} };
|
|
102
|
+
/*!
|
|
103
|
+
Copyright (c) 2018 Jed Watson.
|
|
104
|
+
Licensed under the MIT License (MIT), see
|
|
105
|
+
http://jedwatson.github.io/classnames
|
|
106
|
+
*/
|
|
107
|
+
(function(t) {
|
|
108
|
+
(function() {
|
|
109
|
+
var e = {}.hasOwnProperty;
|
|
110
|
+
function n() {
|
|
111
|
+
for (var l = "", r = 0; r < arguments.length; r++) {
|
|
112
|
+
var c = arguments[r];
|
|
113
|
+
c && (l = s(l, o(c)));
|
|
114
|
+
}
|
|
115
|
+
return l;
|
|
116
|
+
}
|
|
117
|
+
function o(l) {
|
|
118
|
+
if (typeof l == "string" || typeof l == "number")
|
|
119
|
+
return l;
|
|
120
|
+
if (typeof l != "object")
|
|
121
|
+
return "";
|
|
122
|
+
if (Array.isArray(l))
|
|
123
|
+
return n.apply(null, l);
|
|
124
|
+
if (l.toString !== Object.prototype.toString && !l.toString.toString().includes("[native code]"))
|
|
125
|
+
return l.toString();
|
|
126
|
+
var r = "";
|
|
127
|
+
for (var c in l)
|
|
128
|
+
e.call(l, c) && l[c] && (r = s(r, c));
|
|
129
|
+
return r;
|
|
130
|
+
}
|
|
131
|
+
function s(l, r) {
|
|
132
|
+
return r ? l ? l + " " + r : l + r : l;
|
|
133
|
+
}
|
|
134
|
+
t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
|
|
135
|
+
})();
|
|
136
|
+
})(he);
|
|
137
|
+
var Tn = he.exports;
|
|
138
|
+
const P = /* @__PURE__ */ gn(Tn), h = nt.getClassNamespace(), Cn = `${h}-table-body-cells`, pn = `${h}-table-body-virtual-client`, Xt = `${h}-table-bottom-container`, me = `${h}-table-cell`, vn = `${h}-table-cell-client`, An = `${h}-table-cell-ghost`, we = `${h}-table-cell-ledger-even`, Ee = `${h}-table-cell-ledger-odd`, Nn = `${h}-table-column-header-tr`, _n = `${h}-table-column-headers`, Ht = `${h}-table-column-header-cell`, Le = `${h}-table-column-name`, ge = `${h}-table-column-name-text`, Sn = `${h}-table-container`, At = `${h}-table-dragging`, Te = `${h}-table-focus-region`, Rn = `${h}-table-has-reorder-handle`, ft = `${h}-table-header`, In = `${h}-table-header-active`, Ce = `${h}-table-header-content`, Mn = `${h}-table-horizontal-guide`, zt = `${h}-table-last-in-column`, pe = `${h}-table-last-in-row`, On = `${h}-table-menu`, Bn = `${h}-table-no-horizontal-scroll`, Dn = `${h}-table-no-vertical-scroll`, ve = `${h}-table-no-wrap-text`, Ot = `${h}-table-overlay`, bt = `${h}-table-overlay-layer`, yn = `${h}-table-pagination-bar`, Qt = `${h}-table-pagination-bar-controls`, $t = `${h}-table-pagination-bar-text`, $n = `${h}-table-pagination-layout`, xn = `${h}-table-quadrant`, Pn = `${h}-table-quadrant-body-container`, Un = `${h}-table-quadrant-left`, Hn = `${h}-table-quadrant-main`, zn = `${h}-table-quadrant-scroll-container`, bn = `${h}-table-quadrant-stack`, Fn = `${h}-table-quadrant-top`, Gn = `${h}-table-quadrant-top-left`, Wn = `${h}-table-region`, kn = `${h}-table-reorder-handle`, Vn = `${h}-table-reorder-handle-target`, Ae = `${h}-table-resize-guides`, Ne = `${h}-table-resize-handle`, _e = `${h}-table-resize-handle-target`, Yn = `${h}-table-resize-horizontal`, Xn = `${h}-table-resize-vertical`, Qn = `${h}-table-row-headers`, Kt = `${h}-table-row-headers-cells-container`, Se = `${h}-table-row-name`, Re = `${h}-table-row-name-text`, Ft = `${h}-table-row-selected`, Ie = `${h}-table-row-selection-cell`, Me = `${h}-table-row-selection-checkbox`, Kn = `${h}-table-row-selection-header-cell`, Zn = `${h}-table-selection-enabled`, Oe = `${h}-table-selection-region`, jn = `${h}-table-th-menu`, qn = `${h}-table-th-menu-container`, Jn = `${h}-table-th-menu-container-background`, to = `${h}-table-th-menu-open`, eo = `${h}-table-thead`, no = `${h}-table-top-container`, Be = `${h}-table-truncated-cell`, De = `${h}-table-truncated-text`, ye = `${h}-table-vertical-guide`;
|
|
139
|
+
function $e(t, e) {
|
|
140
|
+
return typeof e == "number" ? `${t}${e}` : e.indexOf(t) === 0 ? e : `${t}${e}`;
|
|
141
|
+
}
|
|
142
|
+
function Gt(t) {
|
|
143
|
+
return $e(`${h}-table-cell-col-`, t);
|
|
144
|
+
}
|
|
145
|
+
function Et(t) {
|
|
146
|
+
return $e(`${h}-table-cell-row-`, t);
|
|
147
|
+
}
|
|
148
|
+
var J = /* @__PURE__ */ ((t) => (t.CELLS = "cells", t.FULL_ROWS = "full-rows", t.FULL_COLUMNS = "full-columns", t.FULL_TABLE = "full-table", t))(J || {}), xe = /* @__PURE__ */ ((t) => (t.CELL = "cell", t))(xe || {}), oo = /* @__PURE__ */ ((t) => (t.UP = "up", t.DOWN = "down", t.LEFT = "left", t.RIGHT = "right", t))(oo || {});
|
|
149
|
+
class A {
|
|
150
|
+
static getRegionCardinality(e) {
|
|
151
|
+
return e.cols != null && e.rows != null ? "cells" : e.cols != null ? "full-columns" : e.rows != null ? "full-rows" : "full-table";
|
|
152
|
+
}
|
|
153
|
+
static cell(e, n, o, s) {
|
|
154
|
+
return {
|
|
155
|
+
cols: A.normalizeInterval(n, s),
|
|
156
|
+
rows: A.normalizeInterval(e, o)
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
static row(e, n) {
|
|
160
|
+
return { rows: A.normalizeInterval(e, n) };
|
|
161
|
+
}
|
|
162
|
+
static column(e, n) {
|
|
163
|
+
return { cols: A.normalizeInterval(e, n) };
|
|
164
|
+
}
|
|
165
|
+
static table() {
|
|
166
|
+
return {};
|
|
167
|
+
}
|
|
168
|
+
static copy(e) {
|
|
169
|
+
const n = A.getRegionCardinality(e);
|
|
170
|
+
return n === "cells" ? A.cell(e.rows[0], e.cols[0], e.rows[1], e.cols[1]) : n === "full-columns" ? A.column(e.cols[0], e.cols[1]) : n === "full-rows" ? A.row(e.rows[0], e.rows[1]) : A.table();
|
|
171
|
+
}
|
|
172
|
+
static update(e, n, o) {
|
|
173
|
+
const s = e.slice();
|
|
174
|
+
return o != null ? s.splice(o, 1, n) : (s.pop(), s.push(n)), s;
|
|
175
|
+
}
|
|
176
|
+
static clampRegion(e, n, o) {
|
|
177
|
+
const s = A.copy(e);
|
|
178
|
+
return e.rows != null && (s.rows[0] = A.clamp(e.rows[0], 0, n), s.rows[1] = A.clamp(e.rows[1], 0, n)), e.cols != null && (s.cols[0] = A.clamp(e.cols[0], 0, o), s.cols[1] = A.clamp(e.cols[1], 0, o)), s;
|
|
179
|
+
}
|
|
180
|
+
static expandRegion(e, n) {
|
|
181
|
+
const o = A.getRegionCardinality(e), s = A.getRegionCardinality(n);
|
|
182
|
+
if (s !== o)
|
|
183
|
+
return n;
|
|
184
|
+
switch (s) {
|
|
185
|
+
case "full-rows":
|
|
186
|
+
return A.row(
|
|
187
|
+
Math.min(e.rows[0], n.rows[0]),
|
|
188
|
+
Math.max(e.rows[1], n.rows[1])
|
|
189
|
+
);
|
|
190
|
+
case "full-columns":
|
|
191
|
+
return A.column(
|
|
192
|
+
Math.min(e.cols[0], n.cols[0]),
|
|
193
|
+
Math.max(e.cols[1], n.cols[1])
|
|
194
|
+
);
|
|
195
|
+
case "cells":
|
|
196
|
+
return A.cell(
|
|
197
|
+
Math.min(e.rows[0], n.rows[0]),
|
|
198
|
+
Math.min(e.cols[0], n.cols[0]),
|
|
199
|
+
Math.max(e.rows[1], n.rows[1]),
|
|
200
|
+
Math.max(e.cols[1], n.cols[1])
|
|
201
|
+
);
|
|
202
|
+
default:
|
|
203
|
+
return A.table();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
static getRegionFromFocusedRegion(e) {
|
|
207
|
+
return A.cell(e.row, e.col);
|
|
208
|
+
}
|
|
209
|
+
static getCellRegionFromRegion(e, n, o) {
|
|
210
|
+
switch (A.getRegionCardinality(e)) {
|
|
211
|
+
case "full-table":
|
|
212
|
+
return A.cell(0, 0, n - 1, o - 1);
|
|
213
|
+
case "full-columns":
|
|
214
|
+
return A.cell(0, e.cols[0], n - 1, e.cols[1]);
|
|
215
|
+
case "full-rows":
|
|
216
|
+
return A.cell(e.rows[0], 0, e.rows[1], o - 1);
|
|
217
|
+
default:
|
|
218
|
+
return A.cell(e.rows[0], e.cols[0], e.rows[1], e.cols[1]);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
static getFocusCellCoordinatesFromRegion(e) {
|
|
222
|
+
switch (A.getRegionCardinality(e)) {
|
|
223
|
+
case "full-table":
|
|
224
|
+
return { col: 0, row: 0 };
|
|
225
|
+
case "full-columns":
|
|
226
|
+
return { col: e.cols[0], row: 0 };
|
|
227
|
+
case "full-rows":
|
|
228
|
+
return { col: 0, row: e.rows[0] };
|
|
229
|
+
default:
|
|
230
|
+
return { col: e.cols[0], row: e.rows[0] };
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
static regionsEqual(e, n) {
|
|
234
|
+
return A.intervalsEqual(e.rows, n.rows) && A.intervalsEqual(e.cols, n.cols);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Returns the index of the region that wholly contains the supplied
|
|
238
|
+
* region. Returns -1 if no such region is found.
|
|
239
|
+
*/
|
|
240
|
+
static findContainingRegion(e, n) {
|
|
241
|
+
if (e == null)
|
|
242
|
+
return -1;
|
|
243
|
+
for (let o = 0; o < e.length; o++)
|
|
244
|
+
if (A.regionContains(e[o], n))
|
|
245
|
+
return o;
|
|
246
|
+
return -1;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Returns true if the regions fully contain the query region.
|
|
250
|
+
*/
|
|
251
|
+
static containsRegion(e, n) {
|
|
252
|
+
return A.overlapsRegion(e, n, !1);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Returns true if the regions at least partially overlap the query region.
|
|
256
|
+
* When `allowPartialOverlap` is false (the default), every interval of the
|
|
257
|
+
* query region must be fully contained in the corresponding interval of a
|
|
258
|
+
* region.
|
|
259
|
+
*/
|
|
260
|
+
static overlapsRegion(e, n, o = !1) {
|
|
261
|
+
const s = o ? A.intervalOverlaps : A.intervalContains;
|
|
262
|
+
if (e == null || n == null)
|
|
263
|
+
return !1;
|
|
264
|
+
for (const l of e)
|
|
265
|
+
switch (A.getRegionCardinality(l)) {
|
|
266
|
+
case "full-table":
|
|
267
|
+
return !0;
|
|
268
|
+
case "full-columns":
|
|
269
|
+
if (s(l.cols, n.cols))
|
|
270
|
+
return !0;
|
|
271
|
+
continue;
|
|
272
|
+
case "full-rows":
|
|
273
|
+
if (s(l.rows, n.rows))
|
|
274
|
+
return !0;
|
|
275
|
+
continue;
|
|
276
|
+
case "cells":
|
|
277
|
+
if (s(l.cols, n.cols) && s(l.rows, n.rows))
|
|
278
|
+
return !0;
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
return !1;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Using the supplied array of potentially non-contiguous `Region`s, returns
|
|
285
|
+
* an ordered array of every unique cell that exists in those regions. The
|
|
286
|
+
* cell coordinates are sorted by row and then column.
|
|
287
|
+
*/
|
|
288
|
+
static enumerateUniqueCells(e, n, o) {
|
|
289
|
+
if (e == null || e.length === 0)
|
|
290
|
+
return [];
|
|
291
|
+
const s = /* @__PURE__ */ new Set(), l = [];
|
|
292
|
+
for (const r of e)
|
|
293
|
+
A.eachCellInRegion(r, n, o, (c, i) => {
|
|
294
|
+
const u = `${c}-${i}`;
|
|
295
|
+
s.has(u) || (s.add(u), l.push({ col: i, row: c }));
|
|
296
|
+
});
|
|
297
|
+
return l.sort((r, c) => r.row - c.row || r.col - c.col), l;
|
|
298
|
+
}
|
|
299
|
+
static joinStyledRegionGroups(e, n) {
|
|
300
|
+
const o = [];
|
|
301
|
+
return e != null && e.length > 0 && o.push({ className: Oe, regions: e }), n != null && o.push({
|
|
302
|
+
className: Te,
|
|
303
|
+
regions: [A.getRegionFromFocusedRegion(n)]
|
|
304
|
+
}), o;
|
|
305
|
+
}
|
|
306
|
+
static regionContains(e, n) {
|
|
307
|
+
return A.overlapsRegion([e], n, !1);
|
|
308
|
+
}
|
|
309
|
+
static intervalContains(e, n) {
|
|
310
|
+
return e == null || n == null ? !1 : e[0] <= n[0] && n[1] <= e[1];
|
|
311
|
+
}
|
|
312
|
+
static intervalOverlaps(e, n) {
|
|
313
|
+
return e == null || n == null ? !1 : e[0] <= n[1] && n[0] <= e[1];
|
|
314
|
+
}
|
|
315
|
+
static eachCellInRegion(e, n, o, s) {
|
|
316
|
+
switch (A.getRegionCardinality(e)) {
|
|
317
|
+
case "full-table":
|
|
318
|
+
for (let l = 0; l < n; l++)
|
|
319
|
+
for (let r = 0; r < o; r++)
|
|
320
|
+
s(l, r);
|
|
321
|
+
break;
|
|
322
|
+
case "full-columns":
|
|
323
|
+
for (let l = 0; l < n; l++)
|
|
324
|
+
for (let r = e.cols[0]; r <= e.cols[1]; r++)
|
|
325
|
+
s(l, r);
|
|
326
|
+
break;
|
|
327
|
+
case "full-rows":
|
|
328
|
+
for (let l = e.rows[0]; l <= e.rows[1]; l++)
|
|
329
|
+
for (let r = 0; r < o; r++)
|
|
330
|
+
s(l, r);
|
|
331
|
+
break;
|
|
332
|
+
case "cells":
|
|
333
|
+
for (let l = e.rows[0]; l <= e.rows[1]; l++)
|
|
334
|
+
for (let r = e.cols[0]; r <= e.cols[1]; r++)
|
|
335
|
+
s(l, r);
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
static clamp(e, n, o) {
|
|
340
|
+
return Math.max(n, Math.min(o, e));
|
|
341
|
+
}
|
|
342
|
+
static intervalsEqual(e, n) {
|
|
343
|
+
return e == null ? n == null : n == null ? !1 : e[0] === n[0] && e[1] === n[1];
|
|
344
|
+
}
|
|
345
|
+
static normalizeInterval(e, n) {
|
|
346
|
+
return (n == null ? [e, e] : [e, n]).sort((s, l) => s - l);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function lo(t) {
|
|
350
|
+
switch (t) {
|
|
351
|
+
case "up":
|
|
352
|
+
return { rows: -1, cols: 0 };
|
|
353
|
+
case "down":
|
|
354
|
+
return { rows: 1, cols: 0 };
|
|
355
|
+
case "left":
|
|
356
|
+
return { rows: 0, cols: -1 };
|
|
357
|
+
case "right":
|
|
358
|
+
return { rows: 0, cols: 1 };
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function el(t, e) {
|
|
362
|
+
switch (e) {
|
|
363
|
+
case "up":
|
|
364
|
+
return { ...t, focusSelectionIndex: 0, row: t.row - 1 };
|
|
365
|
+
case "down":
|
|
366
|
+
return { ...t, focusSelectionIndex: 0, row: t.row + 1 };
|
|
367
|
+
case "left":
|
|
368
|
+
return { ...t, col: t.col - 1, focusSelectionIndex: 0 };
|
|
369
|
+
case "right":
|
|
370
|
+
return { ...t, col: t.col + 1, focusSelectionIndex: 0 };
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
function nl(t, e, n) {
|
|
374
|
+
if (A.getRegionCardinality(t) === "full-table")
|
|
375
|
+
return t;
|
|
376
|
+
const o = A.copy(t);
|
|
377
|
+
let s = 0, l = 0;
|
|
378
|
+
if (n != null) {
|
|
379
|
+
const c = o.rows != null && n.row === o.rows[0], i = o.rows != null && n.row === o.rows[1], u = o.cols != null && n.col === o.cols[0], f = o.cols != null && n.col === o.cols[1];
|
|
380
|
+
e === "up" ? s = c && !i ? 1 : 0 : e === "down" ? s = i && !c ? 0 : 1 : e === "left" ? l = u && !f ? 1 : 0 : l = f && !u ? 0 : 1;
|
|
381
|
+
} else
|
|
382
|
+
s = e === "down" ? 1 : 0, l = e === "right" ? 1 : 0;
|
|
383
|
+
const r = lo(e);
|
|
384
|
+
return o.rows != null && (o.rows[s] += r.rows), o.cols != null && (o.cols[l] += r.cols), o;
|
|
385
|
+
}
|
|
386
|
+
function Pe(t) {
|
|
387
|
+
return t.getStartVisibleLeafColumns().length;
|
|
388
|
+
}
|
|
389
|
+
function rt(t) {
|
|
390
|
+
return t.getTopRows().length;
|
|
391
|
+
}
|
|
392
|
+
function ht(t) {
|
|
393
|
+
return t.getStartTotalSize();
|
|
394
|
+
}
|
|
395
|
+
function Nt(t, e) {
|
|
396
|
+
return e === "start" ? t.getStartVisibleLeafColumns() : t.getCenterVisibleLeafColumns();
|
|
397
|
+
}
|
|
398
|
+
function Lt(t, e) {
|
|
399
|
+
return e === "start" ? t.getStartTotalSize() : t.getCenterTotalSize();
|
|
400
|
+
}
|
|
401
|
+
function so(t, e, n) {
|
|
402
|
+
return e.getIsPinned() === "start" ? e.getStart("start") : ht(t) + e.getStart("center") - n;
|
|
403
|
+
}
|
|
404
|
+
function Bt(t, e) {
|
|
405
|
+
return ro(0, rt(t), e);
|
|
406
|
+
}
|
|
407
|
+
function ro(t, e, n) {
|
|
408
|
+
let o = 0;
|
|
409
|
+
for (let s = t; s < e; s++)
|
|
410
|
+
o += n(s);
|
|
411
|
+
return o;
|
|
412
|
+
}
|
|
413
|
+
function Zt(t, e, n) {
|
|
414
|
+
if (n < 0)
|
|
415
|
+
return;
|
|
416
|
+
let o = 0;
|
|
417
|
+
const s = Nt(t, e);
|
|
418
|
+
let l = s.length - 1;
|
|
419
|
+
for (; o <= l; ) {
|
|
420
|
+
const r = o + l >> 1, c = s[r], i = c.getStart(e);
|
|
421
|
+
if (n < i) {
|
|
422
|
+
l = r - 1;
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
if (n >= i + c.getSize()) {
|
|
426
|
+
o = r + 1;
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
return c.getIndex();
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function jt(t, e, n, o, s) {
|
|
433
|
+
const l = rt(t), r = t.getRowModel().rows.length, c = e === "top" ? 0 : l, i = e === "top" ? l : r;
|
|
434
|
+
if (n < 0 || c >= i)
|
|
435
|
+
return;
|
|
436
|
+
const u = o(c);
|
|
437
|
+
let f = c, a = i - 1;
|
|
438
|
+
for (; f <= a; ) {
|
|
439
|
+
const m = f + a >> 1, g = o(m) - u;
|
|
440
|
+
if (n < g) {
|
|
441
|
+
a = m - 1;
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
if (n >= g + s(m)) {
|
|
445
|
+
f = m + 1;
|
|
446
|
+
continue;
|
|
447
|
+
}
|
|
448
|
+
return m;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
function co({
|
|
452
|
+
table: t,
|
|
453
|
+
scrollContainerRef: e,
|
|
454
|
+
rowHeaderWidth: n,
|
|
455
|
+
columnHeaderHeight: o,
|
|
456
|
+
getRowTop: s,
|
|
457
|
+
getRowHeight: l
|
|
458
|
+
}, r, c) {
|
|
459
|
+
const i = e.current;
|
|
460
|
+
if (i == null)
|
|
461
|
+
return;
|
|
462
|
+
const u = i.getBoundingClientRect(), f = r - u.left, a = c - u.top, m = ht(t), g = Bt(t, l), T = f - n, E = T - m + i.scrollLeft, v = a - o, L = v - g + i.scrollTop, R = T >= 0 && T < m ? Zt(t, "start", T) : Zt(t, "center", E), C = v >= 0 && v < g ? jt(t, "top", v, s, l) : jt(t, "center", L, s, l);
|
|
463
|
+
if (!(R == null || C == null))
|
|
464
|
+
return { col: R, row: C };
|
|
465
|
+
}
|
|
466
|
+
class io {
|
|
467
|
+
constructor({ table: e, target: n, selectedRegions: o, numRows: s, numCols: l }) {
|
|
468
|
+
ut(this, "target");
|
|
469
|
+
ut(this, "regions");
|
|
470
|
+
ut(this, "selectedRegions");
|
|
471
|
+
ut(this, "numRows");
|
|
472
|
+
ut(this, "numCols");
|
|
473
|
+
ut(this, "targetRow");
|
|
474
|
+
ut(this, "targetCell");
|
|
475
|
+
var r;
|
|
476
|
+
this.target = n, this.selectedRegions = o, this.numRows = s, this.numCols = l, this.regions = A.overlapsRegion(o, n) ? o : [n], this.targetRow = e.getRowModel().rows[n.rows[0]], this.targetCell = (r = this.targetRow) == null ? void 0 : r.getVisibleCells()[n.cols[0]];
|
|
477
|
+
}
|
|
478
|
+
getTarget() {
|
|
479
|
+
return this.target;
|
|
480
|
+
}
|
|
481
|
+
getRegions() {
|
|
482
|
+
return this.regions;
|
|
483
|
+
}
|
|
484
|
+
getSelectedRegions() {
|
|
485
|
+
return this.selectedRegions;
|
|
486
|
+
}
|
|
487
|
+
getUniqueCells() {
|
|
488
|
+
return A.enumerateUniqueCells(this.regions, this.numRows, this.numCols);
|
|
489
|
+
}
|
|
490
|
+
getTargetRow() {
|
|
491
|
+
return this.targetRow;
|
|
492
|
+
}
|
|
493
|
+
getTargetCell() {
|
|
494
|
+
return this.targetCell;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
function uo(t) {
|
|
498
|
+
var u, f;
|
|
499
|
+
const e = t.getVisibleLeafColumns(), n = t.state.columnPinning;
|
|
500
|
+
if (n == null || (((u = n.start) == null ? void 0 : u.length) ?? 0) + (((f = n.end) == null ? void 0 : f.length) ?? 0) === 0)
|
|
501
|
+
return e;
|
|
502
|
+
const o = new Map(e.map((a) => [a.id, a])), s = (n.start ?? []).map((a) => o.get(a)).filter((a) => a != null), l = (n.end ?? []).map((a) => o.get(a)).filter((a) => a != null), r = new Set(s.map((a) => a.id)), c = new Set(l.map((a) => a.id)), i = e.filter((a) => !r.has(a.id) && !c.has(a.id));
|
|
503
|
+
return [...s, ...i, ...l];
|
|
504
|
+
}
|
|
505
|
+
function ao(t, e, n) {
|
|
506
|
+
if (t.length === 0)
|
|
507
|
+
return null;
|
|
508
|
+
const o = Math.max(0, Math.min(e, t.length - 1)), s = Math.max(0, Math.min(n, t.length - 1));
|
|
509
|
+
let l = Number.POSITIVE_INFINITY, r = Number.NEGATIVE_INFINITY;
|
|
510
|
+
for (let c = o; c <= s; c++) {
|
|
511
|
+
const i = t[c];
|
|
512
|
+
i < l && (l = i), i > r && (r = i);
|
|
513
|
+
}
|
|
514
|
+
return [l, r];
|
|
515
|
+
}
|
|
516
|
+
function fo(t, e, n) {
|
|
517
|
+
if (t.length === 0)
|
|
518
|
+
return null;
|
|
519
|
+
let o = 0, s = t.length - 1, l = -1;
|
|
520
|
+
for (; o <= s; ) {
|
|
521
|
+
const c = o + s >> 1;
|
|
522
|
+
t[c].getDisplayIndex() >= e ? (l = c, s = c - 1) : o = c + 1;
|
|
523
|
+
}
|
|
524
|
+
if (l < 0 || t[l].getDisplayIndex() > n)
|
|
525
|
+
return null;
|
|
526
|
+
o = l, s = t.length - 1;
|
|
527
|
+
let r = l;
|
|
528
|
+
for (; o <= s; ) {
|
|
529
|
+
const c = o + s >> 1;
|
|
530
|
+
t[c].getDisplayIndex() <= n ? (r = c, o = c + 1) : s = c - 1;
|
|
531
|
+
}
|
|
532
|
+
return [l, r];
|
|
533
|
+
}
|
|
534
|
+
function ho(t, e, n, o) {
|
|
535
|
+
const s = t[0] === 0 && t[1] === n - 1, l = e[0] === 0 && e[1] === o - 1;
|
|
536
|
+
return s && l ? A.table() : l ? A.row(t[0], t[1]) : s ? A.column(e[0], e[1]) : A.cell(t[0], e[0], t[1], e[1]);
|
|
537
|
+
}
|
|
538
|
+
function qt(t) {
|
|
539
|
+
const e = t.getCellSelectionBounds();
|
|
540
|
+
if (e.length === 0)
|
|
541
|
+
return [];
|
|
542
|
+
const n = t.getRowModel().rows, s = uo(t).map((r) => r.getIndex()), l = [];
|
|
543
|
+
for (const r of e) {
|
|
544
|
+
const c = fo(n, r.minRowIndex, r.maxRowIndex), i = ao(
|
|
545
|
+
s,
|
|
546
|
+
r.minColumnIndex,
|
|
547
|
+
r.maxColumnIndex
|
|
548
|
+
);
|
|
549
|
+
c == null || i == null || l.push(
|
|
550
|
+
ho(
|
|
551
|
+
c,
|
|
552
|
+
i,
|
|
553
|
+
n.length,
|
|
554
|
+
s.length
|
|
555
|
+
)
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
return l;
|
|
559
|
+
}
|
|
560
|
+
function mo(t, e) {
|
|
561
|
+
if (e == null || e.length === 0)
|
|
562
|
+
return [];
|
|
563
|
+
const n = t.getRowModel().rows, o = t.getVisibleLeafColumns();
|
|
564
|
+
if (n.length === 0 || o.length === 0)
|
|
565
|
+
return [];
|
|
566
|
+
const s = [];
|
|
567
|
+
for (const l of e) {
|
|
568
|
+
let r, c;
|
|
569
|
+
switch (A.getRegionCardinality(l)) {
|
|
570
|
+
case J.FULL_TABLE:
|
|
571
|
+
r = [0, n.length - 1], c = [0, o.length - 1];
|
|
572
|
+
break;
|
|
573
|
+
case J.FULL_COLUMNS:
|
|
574
|
+
r = [0, n.length - 1], c = l.cols;
|
|
575
|
+
break;
|
|
576
|
+
case J.FULL_ROWS:
|
|
577
|
+
r = l.rows, c = [0, o.length - 1];
|
|
578
|
+
break;
|
|
579
|
+
default:
|
|
580
|
+
r = l.rows, c = l.cols;
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
583
|
+
r[0] < 0 || r[1] >= n.length || c[0] < 0 || c[1] >= o.length || s.push({
|
|
584
|
+
anchorRowId: n[r[0]].id,
|
|
585
|
+
anchorColumnId: o[c[0]].id,
|
|
586
|
+
focusRowId: n[r[1]].id,
|
|
587
|
+
focusColumnId: o[c[1]].id
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
return s;
|
|
591
|
+
}
|
|
592
|
+
function Jt(t) {
|
|
593
|
+
const e = t.getFocusedCell();
|
|
594
|
+
if (e == null)
|
|
595
|
+
return;
|
|
596
|
+
const n = t.getRowModel().rows.indexOf(e.row);
|
|
597
|
+
if (!(n < 0))
|
|
598
|
+
return { row: n, col: e.column.getIndex() };
|
|
599
|
+
}
|
|
600
|
+
function wo(t, e) {
|
|
601
|
+
const n = t.getRowModel().rows[e.row], o = t.getVisibleLeafColumns()[e.col];
|
|
602
|
+
if (!(n == null || o == null))
|
|
603
|
+
return n.getAllCellsByColumnId()[o.id];
|
|
604
|
+
}
|
|
605
|
+
function te(t) {
|
|
606
|
+
return JSON.stringify(
|
|
607
|
+
t.map((e) => ({
|
|
608
|
+
rows: e.rows ?? null,
|
|
609
|
+
cols: e.cols ?? null
|
|
610
|
+
}))
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
function Eo({
|
|
614
|
+
table: t,
|
|
615
|
+
getRowTop: e,
|
|
616
|
+
getRowHeight: n,
|
|
617
|
+
scrollContainerRef: o,
|
|
618
|
+
rowHeaderWidth: s,
|
|
619
|
+
columnHeaderHeight: l,
|
|
620
|
+
bodyContextMenuRenderer: r,
|
|
621
|
+
enableBodyContextMenu: c,
|
|
622
|
+
enableFocusedCell: i = !1,
|
|
623
|
+
onFocusedCell: u,
|
|
624
|
+
onFocusedRegion: f,
|
|
625
|
+
selectedRegions: a,
|
|
626
|
+
onSelection: m,
|
|
627
|
+
selectionModes: g
|
|
628
|
+
}) {
|
|
629
|
+
const T = a != null, E = c ?? r != null, v = X(!1), L = X(void 0), R = b(
|
|
630
|
+
(w) => g == null ? !0 : g.includes(w),
|
|
631
|
+
[g]
|
|
632
|
+
), C = t.state.cellSelection, y = t.state.columnPinning, D = t.getRowModel().rows, z = t.getVisibleLeafColumns(), M = dt(
|
|
633
|
+
() => qt(t),
|
|
634
|
+
// The translation helper reads reactive table state (selection, rows,
|
|
635
|
+
// columns, pinning) that the linter cannot see through the `table` prop.
|
|
636
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
637
|
+
[C, y, D, t, z]
|
|
638
|
+
), p = dt(
|
|
639
|
+
() => i ? Jt(t) : void 0,
|
|
640
|
+
// Same as above: the helper reads the selection and row model from the table.
|
|
641
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
642
|
+
[C, i, D, t]
|
|
643
|
+
), U = dt(() => {
|
|
644
|
+
const w = [];
|
|
645
|
+
return M.length > 0 && w.push({ className: Oe, regions: M }), p != null && w.push({
|
|
646
|
+
className: Te,
|
|
647
|
+
regions: [A.cell(p.row, p.col)]
|
|
648
|
+
}), w;
|
|
649
|
+
}, [p, M]);
|
|
650
|
+
at(() => {
|
|
651
|
+
if (!T)
|
|
652
|
+
return;
|
|
653
|
+
const w = te(a ?? []);
|
|
654
|
+
L.current !== w && (L.current = w, t.setCellSelection(mo(t, a)));
|
|
655
|
+
}, [a, T, t]);
|
|
656
|
+
const H = X(null), N = X(!1);
|
|
657
|
+
at(() => {
|
|
658
|
+
const w = te(M);
|
|
659
|
+
if (H.current !== w) {
|
|
660
|
+
if (H.current = w, !N.current) {
|
|
661
|
+
N.current = !0;
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
T && L.current === w || m == null || m(M);
|
|
665
|
+
}
|
|
666
|
+
}, [T, m, M]);
|
|
667
|
+
const I = X(null);
|
|
668
|
+
at(() => {
|
|
669
|
+
if (!i)
|
|
670
|
+
return;
|
|
671
|
+
const w = p != null ? `${p.row}-${p.col}` : null;
|
|
672
|
+
I.current !== w && (I.current = w, p != null && (u == null || u(p), f == null || f({
|
|
673
|
+
type: xe.CELL,
|
|
674
|
+
row: p.row,
|
|
675
|
+
col: p.col,
|
|
676
|
+
focusSelectionIndex: 0
|
|
677
|
+
})));
|
|
678
|
+
}, [i, p, u, f]);
|
|
679
|
+
const O = b(() => {
|
|
680
|
+
var w;
|
|
681
|
+
i && ((w = o.current) == null || w.focus());
|
|
682
|
+
}, [i, o]), S = b(() => {
|
|
683
|
+
const w = Jt(t);
|
|
684
|
+
if (w == null)
|
|
685
|
+
return;
|
|
686
|
+
const B = o.current;
|
|
687
|
+
if (B == null)
|
|
688
|
+
return;
|
|
689
|
+
const x = t.getVisibleLeafColumns()[w.col];
|
|
690
|
+
if (x == null)
|
|
691
|
+
return;
|
|
692
|
+
const j = Pe(t), q = ht(t), ot = rt(t), W = Bt(t, n), k = x.getStart(), lt = k + x.getSize(), it = e(w.row), St = it + n(w.row), Tt = B.clientWidth - s - q, Wt = B.clientHeight - l - W;
|
|
693
|
+
let mt = B.scrollLeft, wt = B.scrollTop;
|
|
694
|
+
if (w.col >= j) {
|
|
695
|
+
const Ct = k - q, pt = lt - q;
|
|
696
|
+
Ct < mt ? mt = Math.max(0, Ct) : pt > mt + Tt && (mt = pt - Tt);
|
|
697
|
+
}
|
|
698
|
+
if (w.row >= ot) {
|
|
699
|
+
const Ct = it - W, pt = St - W;
|
|
700
|
+
Ct < wt ? wt = Math.max(0, Ct) : pt > wt + Wt && (wt = pt - Wt);
|
|
701
|
+
}
|
|
702
|
+
mt !== B.scrollLeft && (B.scrollLeft = mt), wt !== B.scrollTop && (B.scrollTop = wt);
|
|
703
|
+
}, [
|
|
704
|
+
l,
|
|
705
|
+
n,
|
|
706
|
+
e,
|
|
707
|
+
s,
|
|
708
|
+
o,
|
|
709
|
+
t
|
|
710
|
+
]);
|
|
711
|
+
at(() => {
|
|
712
|
+
v.current && (v.current = !1, S());
|
|
713
|
+
}, [C, S, t]);
|
|
714
|
+
const _ = b(
|
|
715
|
+
(w) => {
|
|
716
|
+
const B = w.metaKey || w.ctrlKey, $ = w.key;
|
|
717
|
+
let x;
|
|
718
|
+
if ($ === "ArrowUp" ? x = "up" : $ === "ArrowDown" ? x = "down" : $ === "ArrowLeft" ? x = "left" : $ === "ArrowRight" && (x = "right"), x != null) {
|
|
719
|
+
w.preventDefault(), w.stopPropagation(), w.shiftKey ? t.extendCellSelection(x) : i && (v.current = !0, t.moveCellSelection(x));
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
if ($ === "Tab" && i) {
|
|
723
|
+
w.preventDefault(), w.stopPropagation(), v.current = !0, t.moveCellSelection(w.shiftKey ? "left" : "right");
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
if ($ === "Escape") {
|
|
727
|
+
w.preventDefault(), w.stopPropagation(), t.resetCellSelection(!0);
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
B && $.toLowerCase() === "a" && (w.preventDefault(), w.stopPropagation(), t.selectAllCells());
|
|
731
|
+
},
|
|
732
|
+
[i, t]
|
|
733
|
+
), G = b(
|
|
734
|
+
(w, B) => co(
|
|
735
|
+
{ table: t, scrollContainerRef: o, rowHeaderWidth: s, columnHeaderHeight: l, getRowTop: e, getRowHeight: n },
|
|
736
|
+
w,
|
|
737
|
+
B
|
|
738
|
+
),
|
|
739
|
+
[l, n, e, s, o, t]
|
|
740
|
+
), Y = b(
|
|
741
|
+
(w) => {
|
|
742
|
+
w.button === 0 && O();
|
|
743
|
+
},
|
|
744
|
+
[O]
|
|
745
|
+
), Q = b(
|
|
746
|
+
(w) => {
|
|
747
|
+
if (!E)
|
|
748
|
+
return;
|
|
749
|
+
const B = G(w.clientX, w.clientY);
|
|
750
|
+
if (B == null)
|
|
751
|
+
return;
|
|
752
|
+
const $ = wo(t, B);
|
|
753
|
+
$ != null && ($.getIsSelected() || R(J.CELLS) && t.setCellSelection([
|
|
754
|
+
{
|
|
755
|
+
anchorRowId: $.row.id,
|
|
756
|
+
anchorColumnId: $.column.id,
|
|
757
|
+
focusRowId: $.row.id,
|
|
758
|
+
focusColumnId: $.column.id
|
|
759
|
+
}
|
|
760
|
+
]));
|
|
761
|
+
},
|
|
762
|
+
[G, E, R, t]
|
|
763
|
+
), K = b(
|
|
764
|
+
(w) => {
|
|
765
|
+
if (!E || r == null)
|
|
766
|
+
return;
|
|
767
|
+
const B = G(w.clientX, w.clientY);
|
|
768
|
+
if (B == null)
|
|
769
|
+
return;
|
|
770
|
+
const $ = new io({
|
|
771
|
+
table: t,
|
|
772
|
+
target: A.cell(B.row, B.col),
|
|
773
|
+
// Read the selection freshly: the right-click may have just moved it.
|
|
774
|
+
selectedRegions: qt(t),
|
|
775
|
+
numRows: t.getRowModel().rows.length,
|
|
776
|
+
numCols: t.getVisibleLeafColumns().length
|
|
777
|
+
});
|
|
778
|
+
return r($) ?? void 0;
|
|
779
|
+
},
|
|
780
|
+
[r, G, E, t]
|
|
781
|
+
), Z = b(
|
|
782
|
+
(w, B) => {
|
|
783
|
+
if (!R(J.FULL_COLUMNS)) {
|
|
784
|
+
t.resetCellSelection(!0), O();
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
B.preventDefault(), B.stopPropagation();
|
|
788
|
+
const $ = t.getRowModel().rows, x = t.getVisibleLeafColumns()[w];
|
|
789
|
+
x == null || $.length === 0 || (B.shiftKey ? t.setCellSelection((j) => {
|
|
790
|
+
const q = j[j.length - 1];
|
|
791
|
+
return q == null ? [
|
|
792
|
+
{
|
|
793
|
+
anchorRowId: $[0].id,
|
|
794
|
+
anchorColumnId: x.id,
|
|
795
|
+
focusRowId: $[$.length - 1].id,
|
|
796
|
+
focusColumnId: x.id
|
|
797
|
+
}
|
|
798
|
+
] : [...j.slice(0, -1), { ...q, focusColumnId: x.id }];
|
|
799
|
+
}) : t.setCellSelection([
|
|
800
|
+
{
|
|
801
|
+
anchorRowId: $[0].id,
|
|
802
|
+
anchorColumnId: x.id,
|
|
803
|
+
focusRowId: $[$.length - 1].id,
|
|
804
|
+
focusColumnId: x.id
|
|
805
|
+
}
|
|
806
|
+
]), O());
|
|
807
|
+
},
|
|
808
|
+
[O, R, t]
|
|
809
|
+
), et = b(
|
|
810
|
+
(w, B) => {
|
|
811
|
+
if (!R(J.FULL_ROWS)) {
|
|
812
|
+
t.resetCellSelection(!0), O();
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
B.preventDefault(), B.stopPropagation();
|
|
816
|
+
const $ = t.getRowModel().rows, x = t.getVisibleLeafColumns(), j = $[w];
|
|
817
|
+
j == null || x.length === 0 || (B.shiftKey ? t.setCellSelection((q) => {
|
|
818
|
+
const ot = q[q.length - 1];
|
|
819
|
+
return ot == null ? [
|
|
820
|
+
{
|
|
821
|
+
anchorRowId: j.id,
|
|
822
|
+
anchorColumnId: x[0].id,
|
|
823
|
+
focusRowId: j.id,
|
|
824
|
+
focusColumnId: x[x.length - 1].id
|
|
825
|
+
}
|
|
826
|
+
] : [...q.slice(0, -1), { ...ot, focusRowId: j.id }];
|
|
827
|
+
}) : t.setCellSelection([
|
|
828
|
+
{
|
|
829
|
+
anchorRowId: j.id,
|
|
830
|
+
anchorColumnId: x[0].id,
|
|
831
|
+
focusRowId: j.id,
|
|
832
|
+
focusColumnId: x[x.length - 1].id
|
|
833
|
+
}
|
|
834
|
+
]), O());
|
|
835
|
+
},
|
|
836
|
+
[O, R, t]
|
|
837
|
+
), ct = b(
|
|
838
|
+
(w) => {
|
|
839
|
+
if (!R(J.FULL_TABLE)) {
|
|
840
|
+
t.resetCellSelection(!0), O();
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
w.preventDefault(), w.stopPropagation(), t.selectAllCells(), O();
|
|
844
|
+
},
|
|
845
|
+
[O, R, t]
|
|
846
|
+
);
|
|
847
|
+
return {
|
|
848
|
+
regionGroups: U,
|
|
849
|
+
handleBodyContextMenu: Q,
|
|
850
|
+
handleBodyPointerDown: Y,
|
|
851
|
+
handleColumnHeaderMouseDown: Z,
|
|
852
|
+
handleKeyDown: _,
|
|
853
|
+
handleMenuMouseDown: ct,
|
|
854
|
+
handleRowHeaderMouseDown: et,
|
|
855
|
+
isBodyContextMenuEnabled: E,
|
|
856
|
+
isSelectionModeEnabled: R,
|
|
857
|
+
renderBodyContextMenu: K
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
function Lo({
|
|
861
|
+
minHeight: t,
|
|
862
|
+
headerRowCount: e
|
|
863
|
+
}) {
|
|
864
|
+
const n = X(null), [o, s] = tt(null);
|
|
865
|
+
st(() => {
|
|
866
|
+
const r = n.current;
|
|
867
|
+
if (r == null)
|
|
868
|
+
return;
|
|
869
|
+
const c = () => {
|
|
870
|
+
const u = r.getBoundingClientRect().height;
|
|
871
|
+
u > 0 && s((f) => f === u ? f : u);
|
|
872
|
+
};
|
|
873
|
+
c();
|
|
874
|
+
const i = new ResizeObserver(c);
|
|
875
|
+
return i.observe(r), () => i.disconnect();
|
|
876
|
+
}, []);
|
|
877
|
+
const l = Math.max(0, e) * fe;
|
|
878
|
+
return {
|
|
879
|
+
ref: n,
|
|
880
|
+
height: Math.max(t, l, o ?? 0)
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
function go({
|
|
884
|
+
enableGhostCells: t,
|
|
885
|
+
rowHeight: e,
|
|
886
|
+
rowHeaderWidth: n,
|
|
887
|
+
columnHeaderHeight: o,
|
|
888
|
+
totalWidth: s,
|
|
889
|
+
totalHeight: l,
|
|
890
|
+
scrollContainerRef: r
|
|
891
|
+
}) {
|
|
892
|
+
const [c, i] = tt(null);
|
|
893
|
+
if (st(() => {
|
|
894
|
+
const g = r.current;
|
|
895
|
+
if (g == null)
|
|
896
|
+
return;
|
|
897
|
+
const T = () => {
|
|
898
|
+
i({ width: g.clientWidth, height: g.clientHeight });
|
|
899
|
+
};
|
|
900
|
+
T();
|
|
901
|
+
const E = new ResizeObserver(T);
|
|
902
|
+
return E.observe(g), () => E.disconnect();
|
|
903
|
+
}, [r]), !t || c == null)
|
|
904
|
+
return;
|
|
905
|
+
const u = c.width - n - s, f = c.height - o - l, a = u > 0 ? Math.min(Math.ceil(u / Yt), En) : 0, m = f > 0 ? Math.min(Math.ceil(f / e), Ln) : 0;
|
|
906
|
+
if (!(a === 0 && m === 0))
|
|
907
|
+
return {
|
|
908
|
+
columnCount: a,
|
|
909
|
+
rowCount: m,
|
|
910
|
+
columnWidth: Yt,
|
|
911
|
+
rowHeight: e
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
function Ue(t, e) {
|
|
915
|
+
return e == null ? t : t + e.columnCount * e.columnWidth;
|
|
916
|
+
}
|
|
917
|
+
const To = 6, Co = 100;
|
|
918
|
+
function po({
|
|
919
|
+
rowHeight: t,
|
|
920
|
+
rowCount: e,
|
|
921
|
+
rowHeights: n,
|
|
922
|
+
defaultRowHeights: o,
|
|
923
|
+
enableRowResizing: s = !1,
|
|
924
|
+
minRowHeight: l = To,
|
|
925
|
+
maxRowHeight: r = Co,
|
|
926
|
+
onRowHeightChanged: c
|
|
927
|
+
}) {
|
|
928
|
+
const i = n != null, [u, f] = tt(
|
|
929
|
+
o ?? []
|
|
930
|
+
), [a, m] = tt(null), [g, T] = tt(null), E = X(null), v = b(
|
|
931
|
+
(S) => i ? n[S] ?? t : u[S] ?? (o == null ? void 0 : o[S]) ?? t,
|
|
932
|
+
[o, u, i, t, n]
|
|
933
|
+
), { rowTops: L, totalHeight: R } = dt(() => {
|
|
934
|
+
const S = new Array(e);
|
|
935
|
+
let _ = 0;
|
|
936
|
+
for (let G = 0; G < e; G++)
|
|
937
|
+
S[G] = _, _ += v(G);
|
|
938
|
+
return { rowTops: S, totalHeight: _ };
|
|
939
|
+
}, [v, e]), C = b((S) => L[S] ?? 0, [L]), y = X(v);
|
|
940
|
+
y.current = v;
|
|
941
|
+
const D = X(L);
|
|
942
|
+
D.current = L;
|
|
943
|
+
const z = X(s);
|
|
944
|
+
z.current = s;
|
|
945
|
+
const M = X(i);
|
|
946
|
+
M.current = i;
|
|
947
|
+
const p = X(l);
|
|
948
|
+
p.current = l;
|
|
949
|
+
const U = X(r);
|
|
950
|
+
U.current = r;
|
|
951
|
+
const H = X(c);
|
|
952
|
+
H.current = c;
|
|
953
|
+
const N = b((S) => {
|
|
954
|
+
var Q, K;
|
|
955
|
+
const _ = E.current;
|
|
956
|
+
if (_ == null)
|
|
957
|
+
return;
|
|
958
|
+
const G = "touches" in S ? (Q = S.touches[0]) == null ? void 0 : Q.clientY : S.clientY;
|
|
959
|
+
if (G == null)
|
|
960
|
+
return;
|
|
961
|
+
const Y = Math.min(
|
|
962
|
+
_.max,
|
|
963
|
+
Math.max(_.min, _.startHeight + (G - _.startY))
|
|
964
|
+
);
|
|
965
|
+
M.current || f((Z) => {
|
|
966
|
+
const et = Z.slice();
|
|
967
|
+
return et[_.index] = Y, et;
|
|
968
|
+
}), (K = H.current) == null || K.call(H, _.index, Y), T(_.rowTop + Y);
|
|
969
|
+
}, []), I = b(() => {
|
|
970
|
+
E.current = null, m(null), T(null), window.removeEventListener("mousemove", N), window.removeEventListener("mouseup", I), window.removeEventListener("touchmove", N), window.removeEventListener("touchend", I), window.removeEventListener("touchcancel", I);
|
|
971
|
+
}, [N]), O = b((S, _) => {
|
|
972
|
+
var K;
|
|
973
|
+
if (!z.current)
|
|
974
|
+
return;
|
|
975
|
+
_.preventDefault(), _.stopPropagation();
|
|
976
|
+
const G = "touches" in _ ? (K = _.touches[0]) == null ? void 0 : K.clientY : _.clientY;
|
|
977
|
+
if (G == null)
|
|
978
|
+
return;
|
|
979
|
+
const Y = D.current[S] ?? 0, Q = y.current(S);
|
|
980
|
+
E.current = {
|
|
981
|
+
index: S,
|
|
982
|
+
startY: G,
|
|
983
|
+
startHeight: Q,
|
|
984
|
+
rowTop: Y,
|
|
985
|
+
min: p.current,
|
|
986
|
+
max: U.current
|
|
987
|
+
}, m(S), T(Y + Q), window.addEventListener("mousemove", N), window.addEventListener("mouseup", I), window.addEventListener("touchmove", N), window.addEventListener("touchend", I), window.addEventListener("touchcancel", I);
|
|
988
|
+
}, [N, I]);
|
|
989
|
+
return at(() => () => {
|
|
990
|
+
window.removeEventListener("mousemove", N), window.removeEventListener("mouseup", I), window.removeEventListener("touchmove", N), window.removeEventListener("touchend", I), window.removeEventListener("touchcancel", I);
|
|
991
|
+
}, [N, I]), {
|
|
992
|
+
enabled: s,
|
|
993
|
+
getRowHeight: v,
|
|
994
|
+
getRowTop: C,
|
|
995
|
+
totalHeight: R,
|
|
996
|
+
resizingRowIndex: a,
|
|
997
|
+
resizingGuideTop: g,
|
|
998
|
+
startRowResize: O
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
const He = se(null);
|
|
1002
|
+
function _t() {
|
|
1003
|
+
return re(He);
|
|
1004
|
+
}
|
|
1005
|
+
const ze = se(null);
|
|
1006
|
+
function vo() {
|
|
1007
|
+
return re(ze);
|
|
1008
|
+
}
|
|
1009
|
+
function Ao(t, e) {
|
|
1010
|
+
return e < t ? e : t <= e && e < t + 1 ? t : Math.max(0, e - 1);
|
|
1011
|
+
}
|
|
1012
|
+
function No(t, e, n, o, s) {
|
|
1013
|
+
const [l, r] = tt(null), [c, i] = tt(null), u = X(null), f = b(
|
|
1014
|
+
(v) => {
|
|
1015
|
+
var z, M;
|
|
1016
|
+
const L = ((z = n.current) == null ? void 0 : z.getBoundingClientRect().left) ?? 0, R = ((M = o.current) == null ? void 0 : M.scrollLeft) ?? 0, C = ht(t), y = v - L - s;
|
|
1017
|
+
if (y < C) {
|
|
1018
|
+
let p = 0;
|
|
1019
|
+
for (const U of Nt(t, "start"))
|
|
1020
|
+
if (U.getStart("start") + U.getSize() / 2 < y)
|
|
1021
|
+
p++;
|
|
1022
|
+
else
|
|
1023
|
+
break;
|
|
1024
|
+
return p;
|
|
1025
|
+
}
|
|
1026
|
+
let D = Pe(t);
|
|
1027
|
+
for (const p of Nt(t, "center"))
|
|
1028
|
+
if (C + p.getStart("center") - R + p.getSize() / 2 < y)
|
|
1029
|
+
D++;
|
|
1030
|
+
else
|
|
1031
|
+
break;
|
|
1032
|
+
return D;
|
|
1033
|
+
},
|
|
1034
|
+
[n, s, o, t]
|
|
1035
|
+
), a = b(
|
|
1036
|
+
(v) => {
|
|
1037
|
+
var z;
|
|
1038
|
+
const L = u.current;
|
|
1039
|
+
if (u.current = null, r(null), i(null), L == null)
|
|
1040
|
+
return;
|
|
1041
|
+
const R = t.getVisibleLeafColumns(), C = (z = R[L.oldIndex]) == null ? void 0 : z.id;
|
|
1042
|
+
if (C == null)
|
|
1043
|
+
return;
|
|
1044
|
+
const y = Ao(L.oldIndex, f(v)), D = R.map((M) => M.id).filter((M) => M !== C);
|
|
1045
|
+
D.splice(y, 0, C), t.setColumnOrder(D);
|
|
1046
|
+
},
|
|
1047
|
+
[f, t]
|
|
1048
|
+
), m = b(
|
|
1049
|
+
(v) => {
|
|
1050
|
+
u.current != null && i(f(v.clientX));
|
|
1051
|
+
},
|
|
1052
|
+
[f]
|
|
1053
|
+
), g = b(
|
|
1054
|
+
(v) => {
|
|
1055
|
+
a(v.clientX);
|
|
1056
|
+
},
|
|
1057
|
+
[a]
|
|
1058
|
+
), T = b(
|
|
1059
|
+
(v, L) => {
|
|
1060
|
+
e && (L.preventDefault(), u.current = { oldIndex: v.getIndex() }, r(v.id), i(f(L.clientX)), window.addEventListener("pointermove", m), window.addEventListener("pointerup", g), window.addEventListener("pointercancel", g));
|
|
1061
|
+
},
|
|
1062
|
+
[e, f, m, g]
|
|
1063
|
+
);
|
|
1064
|
+
return at(() => () => {
|
|
1065
|
+
window.removeEventListener("pointermove", m), window.removeEventListener("pointerup", g), window.removeEventListener("pointercancel", g);
|
|
1066
|
+
}, [m, g]), { contextValue: dt(
|
|
1067
|
+
() => ({ enableColumnReordering: e, reorderingColumnId: l, startReorder: T }),
|
|
1068
|
+
[e, l, T]
|
|
1069
|
+
), guideIndex: c, reorderingColumnId: l };
|
|
1070
|
+
}
|
|
1071
|
+
function _o({
|
|
1072
|
+
table: t,
|
|
1073
|
+
reorderingColumnId: e,
|
|
1074
|
+
guideIndex: n,
|
|
1075
|
+
rowHeaderWidth: o,
|
|
1076
|
+
scrollLeft: s
|
|
1077
|
+
}) {
|
|
1078
|
+
if (e == null || n == null)
|
|
1079
|
+
return null;
|
|
1080
|
+
const l = t.getVisibleLeafColumns(), r = t.getStartVisibleLeafColumns().length, c = l[n], i = ht(t);
|
|
1081
|
+
let u;
|
|
1082
|
+
return n <= r ? u = n < r && c != null ? c.getStart("start") : i : c != null ? u = i + c.getStart("center") - s : u = i + Lt(t, "center") - s, /* @__PURE__ */ d("div", { className: P(Ae, bt), children: /* @__PURE__ */ d(
|
|
1083
|
+
"div",
|
|
1084
|
+
{
|
|
1085
|
+
className: P(Ot, ye),
|
|
1086
|
+
style: { left: o + u }
|
|
1087
|
+
}
|
|
1088
|
+
) });
|
|
1089
|
+
}
|
|
1090
|
+
function So({
|
|
1091
|
+
table: t,
|
|
1092
|
+
rowHeaderWidth: e,
|
|
1093
|
+
columnHeaderHeight: n,
|
|
1094
|
+
scrollLeft: o,
|
|
1095
|
+
scrollTop: s,
|
|
1096
|
+
frozenRowCount: l,
|
|
1097
|
+
resizingGuideTop: r = null,
|
|
1098
|
+
resizingRowIndex: c = null
|
|
1099
|
+
}) {
|
|
1100
|
+
const i = t.state.columnResizing, u = i == null ? void 0 : i.isResizingColumn, f = u != null && u !== !1 ? t.getColumn(u) : void 0, a = f != null ? e + so(t, f, o) + f.getSize() + ((i == null ? void 0 : i.deltaOffset) ?? 0) : null, m = r != null && c != null ? n + r - (c < l ? 0 : s) : null;
|
|
1101
|
+
return a == null && m == null ? null : /* @__PURE__ */ F("div", { className: P(Ae, bt), children: [
|
|
1102
|
+
a != null && /* @__PURE__ */ d(
|
|
1103
|
+
"div",
|
|
1104
|
+
{
|
|
1105
|
+
className: P(Ot, ye),
|
|
1106
|
+
style: { left: a }
|
|
1107
|
+
}
|
|
1108
|
+
),
|
|
1109
|
+
m != null && /* @__PURE__ */ d(
|
|
1110
|
+
"div",
|
|
1111
|
+
{
|
|
1112
|
+
className: P(Ot, Mn),
|
|
1113
|
+
style: { top: m }
|
|
1114
|
+
}
|
|
1115
|
+
)
|
|
1116
|
+
] });
|
|
1117
|
+
}
|
|
1118
|
+
function gt({
|
|
1119
|
+
loading: t,
|
|
1120
|
+
variableLength: e = !1,
|
|
1121
|
+
children: n
|
|
1122
|
+
}) {
|
|
1123
|
+
if (t) {
|
|
1124
|
+
const o = e ? 75 - Math.floor(Math.random() * 11) * 5 : 100;
|
|
1125
|
+
return /* @__PURE__ */ d("div", { className: nt.SKELETON, style: { width: `${o}%` } });
|
|
1126
|
+
}
|
|
1127
|
+
return /* @__PURE__ */ d(vt, { children: n });
|
|
1128
|
+
}
|
|
1129
|
+
function Ro({
|
|
1130
|
+
table: t,
|
|
1131
|
+
cell: e,
|
|
1132
|
+
rowIndex: n,
|
|
1133
|
+
rowTop: o,
|
|
1134
|
+
columnRegion: s,
|
|
1135
|
+
rowHeight: l,
|
|
1136
|
+
loading: r,
|
|
1137
|
+
isLastInRow: c,
|
|
1138
|
+
isLastInColumn: i
|
|
1139
|
+
}) {
|
|
1140
|
+
var m;
|
|
1141
|
+
const u = e.column.getSize(), f = e.column.getStart(s), a = (m = e.column.columnDef.meta) == null ? void 0 : m.bodyCellClassName;
|
|
1142
|
+
return /* @__PURE__ */ d(
|
|
1143
|
+
"div",
|
|
1144
|
+
{
|
|
1145
|
+
className: P(
|
|
1146
|
+
me,
|
|
1147
|
+
Be,
|
|
1148
|
+
Et(n),
|
|
1149
|
+
Gt(e.column.getIndex()),
|
|
1150
|
+
n % 2 === 0 ? we : Ee,
|
|
1151
|
+
{
|
|
1152
|
+
[pe]: c,
|
|
1153
|
+
[zt]: i,
|
|
1154
|
+
[nt.LOADING]: r,
|
|
1155
|
+
[Ft]: e.row.getIsSelected()
|
|
1156
|
+
},
|
|
1157
|
+
a
|
|
1158
|
+
),
|
|
1159
|
+
style: {
|
|
1160
|
+
height: l,
|
|
1161
|
+
left: f,
|
|
1162
|
+
position: "absolute",
|
|
1163
|
+
top: o,
|
|
1164
|
+
width: u
|
|
1165
|
+
},
|
|
1166
|
+
onMouseDown: (g) => {
|
|
1167
|
+
g.button === 0 && e.getSelectionStartHandler()(g);
|
|
1168
|
+
},
|
|
1169
|
+
onMouseEnter: e.getSelectionExtendHandler(),
|
|
1170
|
+
children: /* @__PURE__ */ d("div", { className: P(De, ve), children: /* @__PURE__ */ d(gt, { loading: r, variableLength: !0, children: /* @__PURE__ */ d(t.FlexRender, { cell: e }) }) })
|
|
1171
|
+
}
|
|
1172
|
+
);
|
|
1173
|
+
}
|
|
1174
|
+
function xt({
|
|
1175
|
+
columnIndex: t,
|
|
1176
|
+
rowIndex: e,
|
|
1177
|
+
left: n,
|
|
1178
|
+
top: o,
|
|
1179
|
+
width: s,
|
|
1180
|
+
height: l,
|
|
1181
|
+
loading: r
|
|
1182
|
+
}) {
|
|
1183
|
+
return /* @__PURE__ */ d(
|
|
1184
|
+
"div",
|
|
1185
|
+
{
|
|
1186
|
+
className: P(
|
|
1187
|
+
me,
|
|
1188
|
+
An,
|
|
1189
|
+
Be,
|
|
1190
|
+
Et(e),
|
|
1191
|
+
Gt(t),
|
|
1192
|
+
e % 2 === 0 ? we : Ee,
|
|
1193
|
+
{ [nt.LOADING]: r }
|
|
1194
|
+
),
|
|
1195
|
+
style: { height: l, left: n, position: "absolute", top: o, width: s },
|
|
1196
|
+
children: /* @__PURE__ */ d("div", { className: P(De, ve), children: /* @__PURE__ */ d(gt, { loading: r, variableLength: !0 }) })
|
|
1197
|
+
}
|
|
1198
|
+
);
|
|
1199
|
+
}
|
|
1200
|
+
function Io({
|
|
1201
|
+
table: t,
|
|
1202
|
+
ghosts: e,
|
|
1203
|
+
loading: n,
|
|
1204
|
+
columnRegion: o,
|
|
1205
|
+
rowRegion: s,
|
|
1206
|
+
rowIndices: l,
|
|
1207
|
+
regionTop: r,
|
|
1208
|
+
regionHeight: c,
|
|
1209
|
+
getRowTop: i,
|
|
1210
|
+
getRowHeight: u
|
|
1211
|
+
}) {
|
|
1212
|
+
const f = t.getRowModel().rows, a = t.getVisibleLeafColumns().length, m = Lt(t, o), g = Nt(t, o), T = o === "center", E = s === "center";
|
|
1213
|
+
return /* @__PURE__ */ F(vt, { children: [
|
|
1214
|
+
T && l.map((v) => {
|
|
1215
|
+
var L;
|
|
1216
|
+
return /* @__PURE__ */ d(kt, { children: Array.from({ length: e.columnCount }).map((R, C) => /* @__PURE__ */ d(
|
|
1217
|
+
xt,
|
|
1218
|
+
{
|
|
1219
|
+
columnIndex: a + C,
|
|
1220
|
+
rowIndex: v,
|
|
1221
|
+
left: m + C * e.columnWidth,
|
|
1222
|
+
top: i(v) - r,
|
|
1223
|
+
width: e.columnWidth,
|
|
1224
|
+
height: u(v),
|
|
1225
|
+
loading: n
|
|
1226
|
+
},
|
|
1227
|
+
`ghost-column-cell-${v}-${C}`
|
|
1228
|
+
)) }, `ghost-column-cells-${((L = f[v]) == null ? void 0 : L.id) ?? v}`);
|
|
1229
|
+
}),
|
|
1230
|
+
E && Array.from({ length: e.rowCount }).map((v, L) => {
|
|
1231
|
+
const R = f.length + L, C = c + L * e.rowHeight;
|
|
1232
|
+
return /* @__PURE__ */ F(kt, { children: [
|
|
1233
|
+
g.map((y) => /* @__PURE__ */ d(
|
|
1234
|
+
xt,
|
|
1235
|
+
{
|
|
1236
|
+
columnIndex: y.getIndex(),
|
|
1237
|
+
rowIndex: R,
|
|
1238
|
+
left: y.getStart(o),
|
|
1239
|
+
top: C,
|
|
1240
|
+
width: y.getSize(),
|
|
1241
|
+
height: e.rowHeight,
|
|
1242
|
+
loading: n
|
|
1243
|
+
},
|
|
1244
|
+
`ghost-row-cell-${L}-${y.id}`
|
|
1245
|
+
)),
|
|
1246
|
+
T && Array.from({ length: e.columnCount }).map((y, D) => /* @__PURE__ */ d(
|
|
1247
|
+
xt,
|
|
1248
|
+
{
|
|
1249
|
+
columnIndex: a + D,
|
|
1250
|
+
rowIndex: R,
|
|
1251
|
+
left: m + D * e.columnWidth,
|
|
1252
|
+
top: C,
|
|
1253
|
+
width: e.columnWidth,
|
|
1254
|
+
height: e.rowHeight,
|
|
1255
|
+
loading: n
|
|
1256
|
+
},
|
|
1257
|
+
`ghost-corner-cell-${L}-${D}`
|
|
1258
|
+
))
|
|
1259
|
+
] }, `ghost-row-cells-${L}`);
|
|
1260
|
+
})
|
|
1261
|
+
] });
|
|
1262
|
+
}
|
|
1263
|
+
function ee(t, e, n) {
|
|
1264
|
+
let o = null, s = 0;
|
|
1265
|
+
for (const l of Nt(t, e)) {
|
|
1266
|
+
const r = l.getIndex();
|
|
1267
|
+
r < n[0] || r > n[1] || (o == null && (o = l.getStart(e)), s += l.getSize());
|
|
1268
|
+
}
|
|
1269
|
+
return o == null ? null : { offset: o, size: s };
|
|
1270
|
+
}
|
|
1271
|
+
function ne(t, e, n, o, s) {
|
|
1272
|
+
const l = rt(t), r = t.getRowModel().rows.length, c = Math.max(n[0], e === "top" ? 0 : l), i = Math.min(n[1], e === "top" ? l - 1 : r - 1);
|
|
1273
|
+
if (c > i)
|
|
1274
|
+
return null;
|
|
1275
|
+
const u = e === "center" ? Mo(t, e, o) : 0;
|
|
1276
|
+
return {
|
|
1277
|
+
offset: o(c) - u,
|
|
1278
|
+
size: o(i) + s(i) - o(c)
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
function Mo(t, e, n) {
|
|
1282
|
+
return e === "center" ? n(rt(t)) : 0;
|
|
1283
|
+
}
|
|
1284
|
+
function Oo(t, e, n, o, s, l) {
|
|
1285
|
+
const r = A.getRegionCardinality(e), c = { offset: 0, size: Lt(t, n) }, i = rt(t), u = t.getRowModel().rows.length, f = {
|
|
1286
|
+
offset: 0,
|
|
1287
|
+
size: (o === "top" ? i : u - i) === 0 ? 0 : s(o === "top" ? i - 1 : u - 1) + l(o === "top" ? i - 1 : u - 1) - s(o === "top" ? 0 : i)
|
|
1288
|
+
};
|
|
1289
|
+
let a, m;
|
|
1290
|
+
switch (r) {
|
|
1291
|
+
case J.CELLS:
|
|
1292
|
+
a = ee(t, n, e.cols), m = ne(t, o, e.rows, s, l);
|
|
1293
|
+
break;
|
|
1294
|
+
case J.FULL_COLUMNS:
|
|
1295
|
+
a = ee(t, n, e.cols), m = f;
|
|
1296
|
+
break;
|
|
1297
|
+
case J.FULL_ROWS:
|
|
1298
|
+
a = c, m = ne(t, o, e.rows, s, l);
|
|
1299
|
+
break;
|
|
1300
|
+
default:
|
|
1301
|
+
a = c, m = f;
|
|
1302
|
+
break;
|
|
1303
|
+
}
|
|
1304
|
+
return a == null || m == null || a.size <= 0 || m.size <= 0 ? null : {
|
|
1305
|
+
height: m.size,
|
|
1306
|
+
left: a.offset,
|
|
1307
|
+
top: m.offset,
|
|
1308
|
+
width: a.size
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
function Bo({
|
|
1312
|
+
table: t,
|
|
1313
|
+
regionGroups: e,
|
|
1314
|
+
columnRegion: n,
|
|
1315
|
+
rowRegion: o,
|
|
1316
|
+
getRowTop: s,
|
|
1317
|
+
getRowHeight: l
|
|
1318
|
+
}) {
|
|
1319
|
+
return /* @__PURE__ */ d("div", { className: bt, "aria-hidden": !0, children: e.map(
|
|
1320
|
+
(r, c) => r.regions.map((i, u) => {
|
|
1321
|
+
const f = Oo(
|
|
1322
|
+
t,
|
|
1323
|
+
i,
|
|
1324
|
+
n,
|
|
1325
|
+
o,
|
|
1326
|
+
s,
|
|
1327
|
+
l
|
|
1328
|
+
);
|
|
1329
|
+
return f == null ? null : /* @__PURE__ */ d(
|
|
1330
|
+
"div",
|
|
1331
|
+
{
|
|
1332
|
+
className: P(Ot, Wn, r.className),
|
|
1333
|
+
style: f
|
|
1334
|
+
},
|
|
1335
|
+
`${c}-${u}`
|
|
1336
|
+
);
|
|
1337
|
+
})
|
|
1338
|
+
) });
|
|
1339
|
+
}
|
|
1340
|
+
function Do({
|
|
1341
|
+
table: t,
|
|
1342
|
+
columnRegion: e,
|
|
1343
|
+
rowRegion: n,
|
|
1344
|
+
offsetTop: o = 0,
|
|
1345
|
+
offsetLeft: s = 0,
|
|
1346
|
+
areCellsLoading: l,
|
|
1347
|
+
rowVirtualizer: r,
|
|
1348
|
+
rowResizing: c,
|
|
1349
|
+
ghosts: i,
|
|
1350
|
+
className: u,
|
|
1351
|
+
...f
|
|
1352
|
+
}) {
|
|
1353
|
+
const a = _t(), m = a != null && a.isBodyContextMenuEnabled, g = t.getRowModel().rows, T = rt(t), E = n === "top", v = E ? T : g.length - T, L = E ? 0 : c.getRowTop(T), R = E ? c.getRowTop(T) : c.totalHeight - c.getRowTop(T), C = Lt(t, e), D = !E && r != null ? r.getVirtualItems() : void 0, z = D != null ? D.map((p) => T + p.index) : Array.from(
|
|
1354
|
+
{ length: v },
|
|
1355
|
+
(p, U) => E ? U : T + U
|
|
1356
|
+
), M = E ? T - 1 : g.length - 1;
|
|
1357
|
+
return /* @__PURE__ */ d(
|
|
1358
|
+
"div",
|
|
1359
|
+
{
|
|
1360
|
+
...f,
|
|
1361
|
+
className: P(Pn, u),
|
|
1362
|
+
style: { paddingLeft: s, paddingTop: o },
|
|
1363
|
+
children: /* @__PURE__ */ d("div", { children: /* @__PURE__ */ F(
|
|
1364
|
+
en,
|
|
1365
|
+
{
|
|
1366
|
+
className: P(pn, vn),
|
|
1367
|
+
style: { height: R, width: C },
|
|
1368
|
+
onPointerDown: a == null ? void 0 : a.handleBodyPointerDown,
|
|
1369
|
+
disabled: !m,
|
|
1370
|
+
onContextMenu: m ? a == null ? void 0 : a.handleBodyContextMenu : void 0,
|
|
1371
|
+
content: ({ mouseEvent: p }) => p == null || a == null ? void 0 : a.renderBodyContextMenu(p),
|
|
1372
|
+
children: [
|
|
1373
|
+
/* @__PURE__ */ F("div", { className: Cn, children: [
|
|
1374
|
+
z.map((p) => {
|
|
1375
|
+
const U = g[p];
|
|
1376
|
+
if (U == null)
|
|
1377
|
+
return null;
|
|
1378
|
+
const H = e === "start" ? U.getStartVisibleCells() : U.getCenterVisibleCells(), N = c.getRowTop(p) - L, I = c.getRowHeight(p);
|
|
1379
|
+
return H.map((O, S) => /* @__PURE__ */ d(
|
|
1380
|
+
Ro,
|
|
1381
|
+
{
|
|
1382
|
+
table: t,
|
|
1383
|
+
cell: O,
|
|
1384
|
+
rowIndex: p,
|
|
1385
|
+
rowTop: N,
|
|
1386
|
+
columnRegion: e,
|
|
1387
|
+
rowHeight: I,
|
|
1388
|
+
loading: l,
|
|
1389
|
+
isLastInRow: S === H.length - 1,
|
|
1390
|
+
isLastInColumn: p === M
|
|
1391
|
+
},
|
|
1392
|
+
O.id
|
|
1393
|
+
));
|
|
1394
|
+
}),
|
|
1395
|
+
i != null && /* @__PURE__ */ d(
|
|
1396
|
+
Io,
|
|
1397
|
+
{
|
|
1398
|
+
table: t,
|
|
1399
|
+
ghosts: i,
|
|
1400
|
+
loading: l,
|
|
1401
|
+
columnRegion: e,
|
|
1402
|
+
rowRegion: n,
|
|
1403
|
+
rowIndices: z,
|
|
1404
|
+
regionTop: L,
|
|
1405
|
+
regionHeight: R,
|
|
1406
|
+
getRowTop: c.getRowTop,
|
|
1407
|
+
getRowHeight: c.getRowHeight
|
|
1408
|
+
}
|
|
1409
|
+
)
|
|
1410
|
+
] }),
|
|
1411
|
+
a != null && a.regionGroups.length > 0 && /* @__PURE__ */ d(
|
|
1412
|
+
Bo,
|
|
1413
|
+
{
|
|
1414
|
+
table: t,
|
|
1415
|
+
regionGroups: a.regionGroups,
|
|
1416
|
+
columnRegion: e,
|
|
1417
|
+
rowRegion: n,
|
|
1418
|
+
getRowTop: c.getRowTop,
|
|
1419
|
+
getRowHeight: c.getRowHeight
|
|
1420
|
+
}
|
|
1421
|
+
)
|
|
1422
|
+
]
|
|
1423
|
+
}
|
|
1424
|
+
) })
|
|
1425
|
+
}
|
|
1426
|
+
);
|
|
1427
|
+
}
|
|
1428
|
+
function yo({
|
|
1429
|
+
row: t,
|
|
1430
|
+
rowIndex: e,
|
|
1431
|
+
rowHeight: n,
|
|
1432
|
+
loading: o,
|
|
1433
|
+
isLastInColumn: s,
|
|
1434
|
+
isResizing: l = !1,
|
|
1435
|
+
onResizeStart: r,
|
|
1436
|
+
className: c,
|
|
1437
|
+
...i
|
|
1438
|
+
}) {
|
|
1439
|
+
const u = _t();
|
|
1440
|
+
return /* @__PURE__ */ F(
|
|
1441
|
+
"div",
|
|
1442
|
+
{
|
|
1443
|
+
...i,
|
|
1444
|
+
className: P(ft, Et(e), {
|
|
1445
|
+
[zt]: s,
|
|
1446
|
+
[nt.LOADING]: o,
|
|
1447
|
+
[Ft]: (t == null ? void 0 : t.getIsSelected()) ?? !1
|
|
1448
|
+
}, c),
|
|
1449
|
+
style: { flexBasis: n, height: n, minHeight: 0 },
|
|
1450
|
+
onMouseDown: (f) => u == null ? void 0 : u.handleRowHeaderMouseDown(e, f),
|
|
1451
|
+
children: [
|
|
1452
|
+
/* @__PURE__ */ d("div", { className: Se, children: /* @__PURE__ */ d("div", { className: Re, children: /* @__PURE__ */ d(gt, { loading: o, children: /* @__PURE__ */ d("span", { children: e + 1 }) }) }) }),
|
|
1453
|
+
!o && r != null && /* @__PURE__ */ d(
|
|
1454
|
+
"div",
|
|
1455
|
+
{
|
|
1456
|
+
className: P(_e, Yn, {
|
|
1457
|
+
[At]: l
|
|
1458
|
+
}),
|
|
1459
|
+
onMouseDown: r,
|
|
1460
|
+
onTouchStart: r,
|
|
1461
|
+
children: /* @__PURE__ */ d("div", { className: P(Ne, { [At]: l }) })
|
|
1462
|
+
}
|
|
1463
|
+
)
|
|
1464
|
+
]
|
|
1465
|
+
}
|
|
1466
|
+
);
|
|
1467
|
+
}
|
|
1468
|
+
function $o({
|
|
1469
|
+
row: t,
|
|
1470
|
+
rowIndex: e,
|
|
1471
|
+
rowHeight: n,
|
|
1472
|
+
loading: o,
|
|
1473
|
+
isLastInColumn: s
|
|
1474
|
+
}) {
|
|
1475
|
+
const l = (t == null ? void 0 : t.getIsSelected()) ?? !1;
|
|
1476
|
+
return /* @__PURE__ */ d(
|
|
1477
|
+
"div",
|
|
1478
|
+
{
|
|
1479
|
+
className: P(ft, Ie, Et(e), {
|
|
1480
|
+
[zt]: s,
|
|
1481
|
+
[nt.LOADING]: o,
|
|
1482
|
+
[Ft]: l
|
|
1483
|
+
}),
|
|
1484
|
+
style: { height: n },
|
|
1485
|
+
children: !o && t != null && /* @__PURE__ */ d("div", { className: Me, children: /* @__PURE__ */ d(
|
|
1486
|
+
ae,
|
|
1487
|
+
{
|
|
1488
|
+
"aria-label": `Select row ${e + 1}`,
|
|
1489
|
+
checked: l,
|
|
1490
|
+
disabled: !t.getCanSelect(),
|
|
1491
|
+
onChange: (r) => t.getToggleSelectedHandler()(r)
|
|
1492
|
+
}
|
|
1493
|
+
) })
|
|
1494
|
+
}
|
|
1495
|
+
);
|
|
1496
|
+
}
|
|
1497
|
+
function oe({
|
|
1498
|
+
table: t,
|
|
1499
|
+
rowRegion: e,
|
|
1500
|
+
rowHeaderWidth: n,
|
|
1501
|
+
enableRowHeader: o = !0,
|
|
1502
|
+
selectionColumnWidth: s = 0,
|
|
1503
|
+
areRowHeadersLoading: l,
|
|
1504
|
+
rowVirtualizer: r,
|
|
1505
|
+
rowResizing: c,
|
|
1506
|
+
ghosts: i,
|
|
1507
|
+
className: u,
|
|
1508
|
+
...f
|
|
1509
|
+
}) {
|
|
1510
|
+
if (!o && s === 0)
|
|
1511
|
+
return null;
|
|
1512
|
+
const a = t.getRowModel().rows, m = o ? n : 0, g = rt(t), T = e === "top", E = T ? 0 : g, v = T ? g : a.length - g, L = T ? c.getRowTop(g) : c.totalHeight - c.getRowTop(g), C = !T && r != null ? r.getVirtualItems() : void 0, y = (r == null ? void 0 : r.options.scrollMargin) ?? 0, D = C != null && C.length > 0 ? C[0].start - y : 0, z = C != null && C.length > 0 ? L - (C[C.length - 1].end - y) : 0, M = C != null ? C.map((N) => g + N.index) : Array.from({ length: v }, (N, I) => E + I), p = T ? g - 1 : a.length - 1, U = {
|
|
1513
|
+
height: L,
|
|
1514
|
+
transform: "translateY(0px)",
|
|
1515
|
+
paddingTop: D,
|
|
1516
|
+
paddingBottom: z
|
|
1517
|
+
}, H = i != null && !T ? Array.from({ length: i.rowCount }, (N, I) => a.length + I) : [];
|
|
1518
|
+
return /* @__PURE__ */ d(
|
|
1519
|
+
"div",
|
|
1520
|
+
{
|
|
1521
|
+
...f,
|
|
1522
|
+
className: P(Qn, u),
|
|
1523
|
+
style: { width: m + s },
|
|
1524
|
+
children: /* @__PURE__ */ F("div", { style: { display: "flex", height: L }, children: [
|
|
1525
|
+
o && /* @__PURE__ */ d("div", { style: { flex: "0 0 auto", width: n }, children: /* @__PURE__ */ F("div", { className: Kt, style: U, children: [
|
|
1526
|
+
M.map((N) => {
|
|
1527
|
+
var I;
|
|
1528
|
+
return /* @__PURE__ */ d(
|
|
1529
|
+
yo,
|
|
1530
|
+
{
|
|
1531
|
+
row: a[N],
|
|
1532
|
+
rowIndex: N,
|
|
1533
|
+
rowHeight: c.getRowHeight(N),
|
|
1534
|
+
loading: l,
|
|
1535
|
+
isLastInColumn: N === p,
|
|
1536
|
+
isResizing: c.resizingRowIndex === N,
|
|
1537
|
+
onResizeStart: c.enabled ? (O) => c.startRowResize(N, O) : void 0
|
|
1538
|
+
},
|
|
1539
|
+
((I = a[N]) == null ? void 0 : I.id) ?? N
|
|
1540
|
+
);
|
|
1541
|
+
}),
|
|
1542
|
+
H.map((N, I) => /* @__PURE__ */ d(
|
|
1543
|
+
"div",
|
|
1544
|
+
{
|
|
1545
|
+
className: P(ft, Et(N), {
|
|
1546
|
+
[nt.LOADING]: l
|
|
1547
|
+
}),
|
|
1548
|
+
style: { flexBasis: i == null ? void 0 : i.rowHeight, height: i == null ? void 0 : i.rowHeight, minHeight: 0 },
|
|
1549
|
+
children: /* @__PURE__ */ d("div", { className: Se, children: /* @__PURE__ */ d("div", { className: Re, children: /* @__PURE__ */ d(gt, { loading: l }) }) })
|
|
1550
|
+
},
|
|
1551
|
+
`ghost-row-header-${I}`
|
|
1552
|
+
))
|
|
1553
|
+
] }) }),
|
|
1554
|
+
s > 0 && /* @__PURE__ */ d("div", { style: { flex: "0 0 auto", width: s }, children: /* @__PURE__ */ F("div", { className: Kt, style: U, children: [
|
|
1555
|
+
M.map((N) => {
|
|
1556
|
+
var I;
|
|
1557
|
+
return /* @__PURE__ */ d(
|
|
1558
|
+
$o,
|
|
1559
|
+
{
|
|
1560
|
+
row: a[N],
|
|
1561
|
+
rowIndex: N,
|
|
1562
|
+
rowHeight: c.getRowHeight(N),
|
|
1563
|
+
loading: l,
|
|
1564
|
+
isLastInColumn: N === p
|
|
1565
|
+
},
|
|
1566
|
+
((I = a[N]) == null ? void 0 : I.id) ?? N
|
|
1567
|
+
);
|
|
1568
|
+
}),
|
|
1569
|
+
H.map((N, I) => /* @__PURE__ */ d(
|
|
1570
|
+
"div",
|
|
1571
|
+
{
|
|
1572
|
+
className: P(ft, Ie, Et(N), {
|
|
1573
|
+
[nt.LOADING]: l
|
|
1574
|
+
}),
|
|
1575
|
+
style: { height: i == null ? void 0 : i.rowHeight }
|
|
1576
|
+
},
|
|
1577
|
+
`ghost-row-selection-${I}`
|
|
1578
|
+
))
|
|
1579
|
+
] }) })
|
|
1580
|
+
] })
|
|
1581
|
+
}
|
|
1582
|
+
);
|
|
1583
|
+
}
|
|
1584
|
+
function xo({
|
|
1585
|
+
header: t,
|
|
1586
|
+
isOpen: e,
|
|
1587
|
+
onOpenChange: n
|
|
1588
|
+
}) {
|
|
1589
|
+
const o = t.column.getIsSorted(), s = (r) => {
|
|
1590
|
+
t.column.toggleSorting(r), n(!1);
|
|
1591
|
+
}, l = () => {
|
|
1592
|
+
t.column.clearSorting(), n(!1);
|
|
1593
|
+
};
|
|
1594
|
+
return /* @__PURE__ */ F("div", { className: P(qn, { [to]: e }), children: [
|
|
1595
|
+
/* @__PURE__ */ d("div", { className: Jn }),
|
|
1596
|
+
/* @__PURE__ */ d(
|
|
1597
|
+
nn,
|
|
1598
|
+
{
|
|
1599
|
+
className: jn,
|
|
1600
|
+
content: /* @__PURE__ */ F(ln, { children: [
|
|
1601
|
+
/* @__PURE__ */ d(Dt, { icon: "sort-asc", text: "Sort Asc", onClick: () => s(!1) }),
|
|
1602
|
+
/* @__PURE__ */ d(Dt, { icon: "sort-desc", text: "Sort Desc", onClick: () => s(!0) }),
|
|
1603
|
+
o && /* @__PURE__ */ d(Dt, { icon: "sort", text: "Clear Sort", onClick: l })
|
|
1604
|
+
] }),
|
|
1605
|
+
isOpen: e,
|
|
1606
|
+
onInteraction: n,
|
|
1607
|
+
placement: "bottom",
|
|
1608
|
+
rootBoundary: "viewport",
|
|
1609
|
+
children: /* @__PURE__ */ d(on, { icon: "chevron-down" })
|
|
1610
|
+
}
|
|
1611
|
+
)
|
|
1612
|
+
] });
|
|
1613
|
+
}
|
|
1614
|
+
function Po({
|
|
1615
|
+
table: t,
|
|
1616
|
+
header: e,
|
|
1617
|
+
isLastInRow: n,
|
|
1618
|
+
enableSorting: o = !1,
|
|
1619
|
+
loading: s
|
|
1620
|
+
}) {
|
|
1621
|
+
var R;
|
|
1622
|
+
const l = e.getSize(), r = e.column.getIsResizing(), c = e.getResizeHandler(), i = typeof e.column.columnDef.header == "string" ? e.column.columnDef.header : void 0, u = vo(), f = _t(), a = (u == null ? void 0 : u.enableColumnReordering) ?? !1, m = (u == null ? void 0 : u.reorderingColumnId) === e.column.id, g = o && e.column.getCanSort(), T = (R = e.column.columnDef.meta) == null ? void 0 : R.headCellClassName, [E, v] = tt(!1), L = e.column.getIndex();
|
|
1623
|
+
return /* @__PURE__ */ F(
|
|
1624
|
+
"div",
|
|
1625
|
+
{
|
|
1626
|
+
className: P(
|
|
1627
|
+
ft,
|
|
1628
|
+
Gt(L),
|
|
1629
|
+
Ht,
|
|
1630
|
+
{ [pe]: n },
|
|
1631
|
+
{ [Rn]: a },
|
|
1632
|
+
{ [In]: E },
|
|
1633
|
+
{ [nt.LOADING]: s },
|
|
1634
|
+
T
|
|
1635
|
+
),
|
|
1636
|
+
style: { flexBasis: l, minWidth: 0, width: l },
|
|
1637
|
+
onMouseDown: (C) => f == null ? void 0 : f.handleColumnHeaderMouseDown(L, C),
|
|
1638
|
+
children: [
|
|
1639
|
+
/* @__PURE__ */ F("div", { className: Le, title: i, children: [
|
|
1640
|
+
a && /* @__PURE__ */ d(
|
|
1641
|
+
"div",
|
|
1642
|
+
{
|
|
1643
|
+
className: P(Vn, { [At]: m }),
|
|
1644
|
+
onPointerDown: (C) => u == null ? void 0 : u.startReorder(e.column, C),
|
|
1645
|
+
children: /* @__PURE__ */ d("div", { className: kn, children: /* @__PURE__ */ d(cn, { title: "Press down to drag" }) })
|
|
1646
|
+
}
|
|
1647
|
+
),
|
|
1648
|
+
g && !s && /* @__PURE__ */ d(
|
|
1649
|
+
xo,
|
|
1650
|
+
{
|
|
1651
|
+
table: t,
|
|
1652
|
+
header: e,
|
|
1653
|
+
isOpen: E,
|
|
1654
|
+
onOpenChange: v
|
|
1655
|
+
}
|
|
1656
|
+
),
|
|
1657
|
+
/* @__PURE__ */ d("div", { className: ge, children: /* @__PURE__ */ d(gt, { loading: s, variableLength: !0, children: /* @__PURE__ */ d(t.FlexRender, { header: e }) }) })
|
|
1658
|
+
] }),
|
|
1659
|
+
/* @__PURE__ */ d("div", { className: Ce }),
|
|
1660
|
+
!s && /* @__PURE__ */ d(
|
|
1661
|
+
"div",
|
|
1662
|
+
{
|
|
1663
|
+
className: P(_e, Xn, {
|
|
1664
|
+
[At]: r
|
|
1665
|
+
}),
|
|
1666
|
+
onMouseDown: c,
|
|
1667
|
+
onTouchStart: c,
|
|
1668
|
+
children: /* @__PURE__ */ d("div", { className: P(Ne, { [At]: r }) })
|
|
1669
|
+
}
|
|
1670
|
+
)
|
|
1671
|
+
]
|
|
1672
|
+
}
|
|
1673
|
+
);
|
|
1674
|
+
}
|
|
1675
|
+
function Uo({
|
|
1676
|
+
table: t,
|
|
1677
|
+
headerGroup: e,
|
|
1678
|
+
columnRegion: n,
|
|
1679
|
+
enableSorting: o = !1,
|
|
1680
|
+
areColumnHeadersLoading: s,
|
|
1681
|
+
ghosts: l
|
|
1682
|
+
}) {
|
|
1683
|
+
var i;
|
|
1684
|
+
const r = (i = e.headers[e.headers.length - 1]) == null ? void 0 : i.id, c = Ue(Lt(t, n), l);
|
|
1685
|
+
return /* @__PURE__ */ F(
|
|
1686
|
+
"div",
|
|
1687
|
+
{
|
|
1688
|
+
className: P(eo, Nn),
|
|
1689
|
+
style: { transform: "translateX(0px)", width: c },
|
|
1690
|
+
children: [
|
|
1691
|
+
e.headers.map((u) => /* @__PURE__ */ d(
|
|
1692
|
+
Po,
|
|
1693
|
+
{
|
|
1694
|
+
table: t,
|
|
1695
|
+
header: u,
|
|
1696
|
+
isLastInRow: u.id === r,
|
|
1697
|
+
enableSorting: o,
|
|
1698
|
+
loading: s
|
|
1699
|
+
},
|
|
1700
|
+
u.id
|
|
1701
|
+
)),
|
|
1702
|
+
l != null && Array.from({ length: l.columnCount }).map((u, f) => /* @__PURE__ */ F(
|
|
1703
|
+
"div",
|
|
1704
|
+
{
|
|
1705
|
+
className: P(ft, Ht, {
|
|
1706
|
+
[nt.LOADING]: s
|
|
1707
|
+
}),
|
|
1708
|
+
style: { flexBasis: l.columnWidth, minWidth: 0, width: l.columnWidth },
|
|
1709
|
+
children: [
|
|
1710
|
+
/* @__PURE__ */ d("div", { className: Le, children: /* @__PURE__ */ d("div", { className: ge, children: /* @__PURE__ */ d(gt, { loading: s, variableLength: !0 }) }) }),
|
|
1711
|
+
/* @__PURE__ */ d("div", { className: Ce })
|
|
1712
|
+
]
|
|
1713
|
+
},
|
|
1714
|
+
`ghost-column-header-${f}`
|
|
1715
|
+
))
|
|
1716
|
+
]
|
|
1717
|
+
}
|
|
1718
|
+
);
|
|
1719
|
+
}
|
|
1720
|
+
function Ho({
|
|
1721
|
+
table: t,
|
|
1722
|
+
columnRegion: e,
|
|
1723
|
+
enableSorting: n = !1,
|
|
1724
|
+
areColumnHeadersLoading: o,
|
|
1725
|
+
ghosts: s,
|
|
1726
|
+
className: l,
|
|
1727
|
+
...r
|
|
1728
|
+
}) {
|
|
1729
|
+
const c = e === "start" ? t.getStartHeaderGroups() : t.getCenterHeaderGroups(), i = e === "center" ? s : void 0, u = Ue(Lt(t, e), i);
|
|
1730
|
+
return /* @__PURE__ */ d("div", { ...r, className: P(_n, l), children: /* @__PURE__ */ d("div", { style: { width: u }, children: c.map((f) => /* @__PURE__ */ d(
|
|
1731
|
+
Uo,
|
|
1732
|
+
{
|
|
1733
|
+
table: t,
|
|
1734
|
+
headerGroup: f,
|
|
1735
|
+
columnRegion: e,
|
|
1736
|
+
enableSorting: n,
|
|
1737
|
+
areColumnHeadersLoading: o,
|
|
1738
|
+
ghosts: i
|
|
1739
|
+
},
|
|
1740
|
+
f.id
|
|
1741
|
+
)) }) });
|
|
1742
|
+
}
|
|
1743
|
+
function zo({
|
|
1744
|
+
width: t,
|
|
1745
|
+
height: e,
|
|
1746
|
+
className: n,
|
|
1747
|
+
...o
|
|
1748
|
+
}) {
|
|
1749
|
+
const s = _t();
|
|
1750
|
+
return /* @__PURE__ */ d(
|
|
1751
|
+
"div",
|
|
1752
|
+
{
|
|
1753
|
+
...o,
|
|
1754
|
+
className: P(On, n),
|
|
1755
|
+
style: { width: t, height: e },
|
|
1756
|
+
onMouseDown: s == null ? void 0 : s.handleMenuMouseDown
|
|
1757
|
+
}
|
|
1758
|
+
);
|
|
1759
|
+
}
|
|
1760
|
+
function bo({
|
|
1761
|
+
table: t,
|
|
1762
|
+
width: e,
|
|
1763
|
+
height: n,
|
|
1764
|
+
loading: o = !1
|
|
1765
|
+
}) {
|
|
1766
|
+
const s = t.getIsAllRowsSelected(), l = t.getIsSomeRowsSelected();
|
|
1767
|
+
return /* @__PURE__ */ d(
|
|
1768
|
+
"div",
|
|
1769
|
+
{
|
|
1770
|
+
className: P(
|
|
1771
|
+
ft,
|
|
1772
|
+
Ht,
|
|
1773
|
+
Kn
|
|
1774
|
+
),
|
|
1775
|
+
style: { flex: "0 0 auto", height: n, width: e },
|
|
1776
|
+
children: !o && /* @__PURE__ */ d("div", { className: Me, children: /* @__PURE__ */ d(
|
|
1777
|
+
ae,
|
|
1778
|
+
{
|
|
1779
|
+
"aria-label": "Select all rows",
|
|
1780
|
+
checked: s,
|
|
1781
|
+
indeterminate: !s && l,
|
|
1782
|
+
onChange: (r) => t.getToggleAllRowsSelectedHandler()(r)
|
|
1783
|
+
}
|
|
1784
|
+
) })
|
|
1785
|
+
}
|
|
1786
|
+
);
|
|
1787
|
+
}
|
|
1788
|
+
var V = /* @__PURE__ */ ((t) => (t.MAIN = "main", t.TOP = "top", t.LEFT = "left", t.TOP_LEFT = "top-left", t))(V || {});
|
|
1789
|
+
function Fo(t) {
|
|
1790
|
+
switch (t) {
|
|
1791
|
+
case V.MAIN:
|
|
1792
|
+
return Hn;
|
|
1793
|
+
case V.TOP:
|
|
1794
|
+
return Fn;
|
|
1795
|
+
case V.LEFT:
|
|
1796
|
+
return Un;
|
|
1797
|
+
case V.TOP_LEFT:
|
|
1798
|
+
return Gn;
|
|
1799
|
+
default:
|
|
1800
|
+
return;
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
function It({
|
|
1804
|
+
quadrantType: t,
|
|
1805
|
+
table: e,
|
|
1806
|
+
rowHeaderWidth: n,
|
|
1807
|
+
enableRowHeader: o = !0,
|
|
1808
|
+
columnHeaderHeight: s,
|
|
1809
|
+
columnHeaderMeasureRef: l,
|
|
1810
|
+
enableSorting: r = !1,
|
|
1811
|
+
areCellsLoading: c,
|
|
1812
|
+
areColumnHeadersLoading: i,
|
|
1813
|
+
areRowHeadersLoading: u,
|
|
1814
|
+
rowResizing: f,
|
|
1815
|
+
rowVirtualizer: a,
|
|
1816
|
+
ghosts: m,
|
|
1817
|
+
scrollContainerRef: g,
|
|
1818
|
+
onScroll: T,
|
|
1819
|
+
onWheel: E,
|
|
1820
|
+
style: v,
|
|
1821
|
+
selectionColumnWidth: L = 0
|
|
1822
|
+
}) {
|
|
1823
|
+
const R = t === V.MAIN, C = t === V.TOP || t === V.TOP_LEFT, D = t === V.LEFT || t === V.TOP_LEFT ? "start" : "center", z = C ? "top" : "center", M = t === V.TOP || t === V.TOP_LEFT, p = t === V.TOP_LEFT, U = _t(), H = ht(e), N = Bt(e, f.getRowHeight), I = o ? n : 0, O = (G, Y) => /* @__PURE__ */ d(
|
|
1824
|
+
Do,
|
|
1825
|
+
{
|
|
1826
|
+
table: e,
|
|
1827
|
+
columnRegion: D,
|
|
1828
|
+
rowRegion: z,
|
|
1829
|
+
offsetTop: G,
|
|
1830
|
+
offsetLeft: Y,
|
|
1831
|
+
areCellsLoading: c,
|
|
1832
|
+
rowVirtualizer: a,
|
|
1833
|
+
rowResizing: f,
|
|
1834
|
+
ghosts: m
|
|
1835
|
+
}
|
|
1836
|
+
), S = M ? /* @__PURE__ */ F(
|
|
1837
|
+
"div",
|
|
1838
|
+
{
|
|
1839
|
+
ref: t === V.TOP ? l : void 0,
|
|
1840
|
+
className: no,
|
|
1841
|
+
style: D === "center" ? { paddingLeft: H } : void 0,
|
|
1842
|
+
children: [
|
|
1843
|
+
p && /* @__PURE__ */ F(vt, { children: [
|
|
1844
|
+
o && /* @__PURE__ */ d(zo, { width: n, height: s }),
|
|
1845
|
+
L > 0 && /* @__PURE__ */ d(
|
|
1846
|
+
bo,
|
|
1847
|
+
{
|
|
1848
|
+
table: e,
|
|
1849
|
+
width: L,
|
|
1850
|
+
height: s,
|
|
1851
|
+
loading: u
|
|
1852
|
+
}
|
|
1853
|
+
)
|
|
1854
|
+
] }),
|
|
1855
|
+
/* @__PURE__ */ d(
|
|
1856
|
+
Ho,
|
|
1857
|
+
{
|
|
1858
|
+
table: e,
|
|
1859
|
+
columnRegion: D,
|
|
1860
|
+
enableSorting: r,
|
|
1861
|
+
areColumnHeadersLoading: i,
|
|
1862
|
+
ghosts: m
|
|
1863
|
+
}
|
|
1864
|
+
)
|
|
1865
|
+
]
|
|
1866
|
+
}
|
|
1867
|
+
) : void 0;
|
|
1868
|
+
let _;
|
|
1869
|
+
switch (t) {
|
|
1870
|
+
case V.MAIN:
|
|
1871
|
+
_ = O(
|
|
1872
|
+
s + N,
|
|
1873
|
+
I + L + H
|
|
1874
|
+
);
|
|
1875
|
+
break;
|
|
1876
|
+
case V.TOP:
|
|
1877
|
+
_ = /* @__PURE__ */ F(vt, { children: [
|
|
1878
|
+
S,
|
|
1879
|
+
O(0, H)
|
|
1880
|
+
] });
|
|
1881
|
+
break;
|
|
1882
|
+
case V.LEFT:
|
|
1883
|
+
_ = // The frozen rows' band at the top is covered by the TOP_LEFT quadrant.
|
|
1884
|
+
/* @__PURE__ */ d("div", { style: { paddingTop: N }, children: /* @__PURE__ */ F(
|
|
1885
|
+
"div",
|
|
1886
|
+
{
|
|
1887
|
+
className: Xt,
|
|
1888
|
+
style: { width: I + L + H },
|
|
1889
|
+
children: [
|
|
1890
|
+
/* @__PURE__ */ d(
|
|
1891
|
+
oe,
|
|
1892
|
+
{
|
|
1893
|
+
table: e,
|
|
1894
|
+
rowRegion: "center",
|
|
1895
|
+
rowHeaderWidth: n,
|
|
1896
|
+
enableRowHeader: o,
|
|
1897
|
+
selectionColumnWidth: L,
|
|
1898
|
+
areRowHeadersLoading: u,
|
|
1899
|
+
rowVirtualizer: a,
|
|
1900
|
+
rowResizing: f,
|
|
1901
|
+
ghosts: m
|
|
1902
|
+
}
|
|
1903
|
+
),
|
|
1904
|
+
O(0, 0)
|
|
1905
|
+
]
|
|
1906
|
+
}
|
|
1907
|
+
) });
|
|
1908
|
+
break;
|
|
1909
|
+
case V.TOP_LEFT:
|
|
1910
|
+
_ = /* @__PURE__ */ F(vt, { children: [
|
|
1911
|
+
S,
|
|
1912
|
+
/* @__PURE__ */ F(
|
|
1913
|
+
"div",
|
|
1914
|
+
{
|
|
1915
|
+
className: Xt,
|
|
1916
|
+
style: { width: I + L + H },
|
|
1917
|
+
children: [
|
|
1918
|
+
/* @__PURE__ */ d(
|
|
1919
|
+
oe,
|
|
1920
|
+
{
|
|
1921
|
+
table: e,
|
|
1922
|
+
rowRegion: "top",
|
|
1923
|
+
rowHeaderWidth: n,
|
|
1924
|
+
enableRowHeader: o,
|
|
1925
|
+
selectionColumnWidth: L,
|
|
1926
|
+
areRowHeadersLoading: u,
|
|
1927
|
+
rowVirtualizer: a,
|
|
1928
|
+
rowResizing: f,
|
|
1929
|
+
ghosts: m
|
|
1930
|
+
}
|
|
1931
|
+
),
|
|
1932
|
+
O(0, 0)
|
|
1933
|
+
]
|
|
1934
|
+
}
|
|
1935
|
+
)
|
|
1936
|
+
] });
|
|
1937
|
+
break;
|
|
1938
|
+
default:
|
|
1939
|
+
_ = void 0;
|
|
1940
|
+
}
|
|
1941
|
+
return /* @__PURE__ */ d("div", { className: P(xn, Fo(t)), style: v, children: /* @__PURE__ */ d(
|
|
1942
|
+
"div",
|
|
1943
|
+
{
|
|
1944
|
+
ref: g,
|
|
1945
|
+
className: zn,
|
|
1946
|
+
tabIndex: R && U != null ? 0 : void 0,
|
|
1947
|
+
onKeyDown: R ? U == null ? void 0 : U.handleKeyDown : void 0,
|
|
1948
|
+
onScroll: T,
|
|
1949
|
+
onWheel: E,
|
|
1950
|
+
children: _
|
|
1951
|
+
}
|
|
1952
|
+
) });
|
|
1953
|
+
}
|
|
1954
|
+
function Go({
|
|
1955
|
+
table: t,
|
|
1956
|
+
rowHeaderWidth: e,
|
|
1957
|
+
enableRowHeader: n = !0,
|
|
1958
|
+
columnHeaderHeight: o,
|
|
1959
|
+
columnHeaderMeasureRef: s,
|
|
1960
|
+
enableColumnReordering: l = !1,
|
|
1961
|
+
enableSorting: r = !1,
|
|
1962
|
+
areCellsLoading: c,
|
|
1963
|
+
areColumnHeadersLoading: i,
|
|
1964
|
+
areRowHeadersLoading: u,
|
|
1965
|
+
selection: f,
|
|
1966
|
+
rowResizing: a,
|
|
1967
|
+
ghosts: m,
|
|
1968
|
+
enableRowVirtualization: g,
|
|
1969
|
+
overscanRowCount: T,
|
|
1970
|
+
scrollContainerRef: E,
|
|
1971
|
+
selectionColumnWidth: v = 0
|
|
1972
|
+
}) {
|
|
1973
|
+
const L = X(null), R = X(null), C = X(null), y = X(null), D = ht(t), z = rt(t), M = Bt(t, a.getRowHeight), p = (n ? e : 0) + v, U = dn({
|
|
1974
|
+
table: t,
|
|
1975
|
+
columnHeaderHeight: o,
|
|
1976
|
+
frozenRowCount: z,
|
|
1977
|
+
frozenRowsHeight: M,
|
|
1978
|
+
getRowHeight: a.getRowHeight,
|
|
1979
|
+
scrollContainerRef: E,
|
|
1980
|
+
enableRowVirtualization: g ?? !1,
|
|
1981
|
+
overscanRowCount: T ?? de
|
|
1982
|
+
}), { contextValue: H, guideIndex: N, reorderingColumnId: I } = No(
|
|
1983
|
+
t,
|
|
1984
|
+
l,
|
|
1985
|
+
L,
|
|
1986
|
+
E,
|
|
1987
|
+
p
|
|
1988
|
+
), [O, S] = tt({ left: 0, top: 0 }), _ = t.state.columnResizing, G = (_ == null ? void 0 : _.isResizingColumn) != null && _.isResizingColumn !== !1, Y = a.resizingGuideTop != null, Q = I != null, K = X(!1);
|
|
1989
|
+
K.current = G || Y || Q;
|
|
1990
|
+
const [Z, et] = tt({ vertical: 0, horizontal: 0 }), ct = b(() => {
|
|
1991
|
+
const W = E.current;
|
|
1992
|
+
W != null && (R.current != null && (R.current.scrollLeft = W.scrollLeft), C.current != null && (C.current.scrollTop = W.scrollTop), y.current != null && (y.current.scrollLeft = 0, y.current.scrollTop = 0));
|
|
1993
|
+
}, [E]), w = b(() => {
|
|
1994
|
+
if (ct(), K.current) {
|
|
1995
|
+
const W = E.current;
|
|
1996
|
+
W != null && S({ left: W.scrollLeft, top: W.scrollTop });
|
|
1997
|
+
}
|
|
1998
|
+
}, [E, ct]), B = b(() => {
|
|
1999
|
+
const W = E.current;
|
|
2000
|
+
if (W == null)
|
|
2001
|
+
return;
|
|
2002
|
+
const k = Math.max(0, W.offsetWidth - W.clientWidth), lt = Math.max(0, W.offsetHeight - W.clientHeight);
|
|
2003
|
+
et(
|
|
2004
|
+
(it) => it.vertical === k && it.horizontal === lt ? it : { vertical: k, horizontal: lt }
|
|
2005
|
+
);
|
|
2006
|
+
}, [E]), $ = t.getTotalSize();
|
|
2007
|
+
st(() => {
|
|
2008
|
+
const W = E.current;
|
|
2009
|
+
if (W == null)
|
|
2010
|
+
return;
|
|
2011
|
+
B();
|
|
2012
|
+
const k = new ResizeObserver(B);
|
|
2013
|
+
return k.observe(W), () => k.disconnect();
|
|
2014
|
+
}, [B, E]), st(() => {
|
|
2015
|
+
B();
|
|
2016
|
+
}, [
|
|
2017
|
+
o,
|
|
2018
|
+
D,
|
|
2019
|
+
M,
|
|
2020
|
+
B,
|
|
2021
|
+
a.totalHeight,
|
|
2022
|
+
$
|
|
2023
|
+
]), st(() => {
|
|
2024
|
+
ct();
|
|
2025
|
+
}, [o, D, M, ct]), st(() => {
|
|
2026
|
+
if (!K.current)
|
|
2027
|
+
return;
|
|
2028
|
+
const W = E.current;
|
|
2029
|
+
if (W == null)
|
|
2030
|
+
return;
|
|
2031
|
+
const k = W.scrollLeft, lt = W.scrollTop;
|
|
2032
|
+
(k !== O.left || lt !== O.top) && S({ left: k, top: lt });
|
|
2033
|
+
}, [
|
|
2034
|
+
G,
|
|
2035
|
+
Q,
|
|
2036
|
+
Y,
|
|
2037
|
+
E,
|
|
2038
|
+
O.left,
|
|
2039
|
+
O.top
|
|
2040
|
+
]);
|
|
2041
|
+
const x = b(
|
|
2042
|
+
(W) => {
|
|
2043
|
+
const k = E.current;
|
|
2044
|
+
if (k == null)
|
|
2045
|
+
return;
|
|
2046
|
+
const lt = Math.max(0, k.scrollWidth - k.clientWidth), it = Math.max(0, k.scrollHeight - k.clientHeight), St = le(k.scrollLeft + W.deltaX, 0, lt), Tt = le(k.scrollTop + W.deltaY, 0, it);
|
|
2047
|
+
St !== k.scrollLeft && (k.scrollLeft = St), Tt !== k.scrollTop && (k.scrollTop = Tt);
|
|
2048
|
+
},
|
|
2049
|
+
[E]
|
|
2050
|
+
), j = o + M, q = p + D, ot = {
|
|
2051
|
+
table: t,
|
|
2052
|
+
rowHeaderWidth: e,
|
|
2053
|
+
enableRowHeader: n,
|
|
2054
|
+
selectionColumnWidth: v,
|
|
2055
|
+
columnHeaderHeight: o,
|
|
2056
|
+
enableSorting: r,
|
|
2057
|
+
areCellsLoading: c,
|
|
2058
|
+
areColumnHeadersLoading: i,
|
|
2059
|
+
areRowHeadersLoading: u,
|
|
2060
|
+
rowResizing: a,
|
|
2061
|
+
rowVirtualizer: U,
|
|
2062
|
+
ghosts: m
|
|
2063
|
+
};
|
|
2064
|
+
return /* @__PURE__ */ d("div", { ref: L, className: bn, children: /* @__PURE__ */ d(ze.Provider, { value: H, children: /* @__PURE__ */ F(He.Provider, { value: f, children: [
|
|
2065
|
+
/* @__PURE__ */ d(
|
|
2066
|
+
It,
|
|
2067
|
+
{
|
|
2068
|
+
...ot,
|
|
2069
|
+
quadrantType: V.MAIN,
|
|
2070
|
+
scrollContainerRef: E,
|
|
2071
|
+
onScroll: w
|
|
2072
|
+
}
|
|
2073
|
+
),
|
|
2074
|
+
/* @__PURE__ */ d(
|
|
2075
|
+
It,
|
|
2076
|
+
{
|
|
2077
|
+
...ot,
|
|
2078
|
+
quadrantType: V.TOP,
|
|
2079
|
+
columnHeaderMeasureRef: s,
|
|
2080
|
+
scrollContainerRef: R,
|
|
2081
|
+
onWheel: x,
|
|
2082
|
+
style: {
|
|
2083
|
+
height: j,
|
|
2084
|
+
left: p,
|
|
2085
|
+
right: Z.vertical
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
),
|
|
2089
|
+
/* @__PURE__ */ d(
|
|
2090
|
+
It,
|
|
2091
|
+
{
|
|
2092
|
+
...ot,
|
|
2093
|
+
quadrantType: V.LEFT,
|
|
2094
|
+
scrollContainerRef: C,
|
|
2095
|
+
onWheel: x,
|
|
2096
|
+
style: {
|
|
2097
|
+
bottom: Z.horizontal,
|
|
2098
|
+
top: o,
|
|
2099
|
+
width: q
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
),
|
|
2103
|
+
/* @__PURE__ */ d(
|
|
2104
|
+
It,
|
|
2105
|
+
{
|
|
2106
|
+
...ot,
|
|
2107
|
+
quadrantType: V.TOP_LEFT,
|
|
2108
|
+
scrollContainerRef: y,
|
|
2109
|
+
onWheel: x,
|
|
2110
|
+
style: { height: j, width: q }
|
|
2111
|
+
}
|
|
2112
|
+
),
|
|
2113
|
+
/* @__PURE__ */ d(
|
|
2114
|
+
So,
|
|
2115
|
+
{
|
|
2116
|
+
table: t,
|
|
2117
|
+
rowHeaderWidth: p,
|
|
2118
|
+
columnHeaderHeight: o,
|
|
2119
|
+
scrollLeft: O.left,
|
|
2120
|
+
scrollTop: O.top,
|
|
2121
|
+
frozenRowCount: z,
|
|
2122
|
+
resizingGuideTop: a.resizingGuideTop,
|
|
2123
|
+
resizingRowIndex: a.resizingRowIndex
|
|
2124
|
+
}
|
|
2125
|
+
),
|
|
2126
|
+
/* @__PURE__ */ d(
|
|
2127
|
+
_o,
|
|
2128
|
+
{
|
|
2129
|
+
table: t,
|
|
2130
|
+
reorderingColumnId: I,
|
|
2131
|
+
guideIndex: N,
|
|
2132
|
+
rowHeaderWidth: p,
|
|
2133
|
+
scrollLeft: O.left
|
|
2134
|
+
}
|
|
2135
|
+
)
|
|
2136
|
+
] }) }) });
|
|
2137
|
+
}
|
|
2138
|
+
function le(t, e, n) {
|
|
2139
|
+
return Math.max(e, Math.min(n, t));
|
|
2140
|
+
}
|
|
2141
|
+
function Wo({
|
|
2142
|
+
table: t,
|
|
2143
|
+
rowHeight: e,
|
|
2144
|
+
rowHeaderWidth: n,
|
|
2145
|
+
enableRowHeader: o = !0,
|
|
2146
|
+
columnHeaderHeight: s,
|
|
2147
|
+
enableColumnReordering: l = !1,
|
|
2148
|
+
enableSorting: r = !1,
|
|
2149
|
+
areCellsLoading: c,
|
|
2150
|
+
areColumnHeadersLoading: i,
|
|
2151
|
+
areRowHeadersLoading: u,
|
|
2152
|
+
enableFocusedCell: f = !1,
|
|
2153
|
+
enableGhostCells: a = !1,
|
|
2154
|
+
bodyContextMenuRenderer: m,
|
|
2155
|
+
enableBodyContextMenu: g,
|
|
2156
|
+
onFocusedCell: T,
|
|
2157
|
+
onFocusedRegion: E,
|
|
2158
|
+
selectedRegions: v,
|
|
2159
|
+
onSelection: L,
|
|
2160
|
+
selectionModes: R,
|
|
2161
|
+
enableRowVirtualization: C,
|
|
2162
|
+
overscanRowCount: y,
|
|
2163
|
+
enableRowResizing: D = !1,
|
|
2164
|
+
rowHeights: z,
|
|
2165
|
+
defaultRowHeights: M,
|
|
2166
|
+
onRowHeightChanged: p,
|
|
2167
|
+
minRowHeight: U,
|
|
2168
|
+
maxRowHeight: H,
|
|
2169
|
+
selectionColumnWidth: N = 0,
|
|
2170
|
+
className: I,
|
|
2171
|
+
...O
|
|
2172
|
+
}) {
|
|
2173
|
+
const S = X(null), _ = (o ? n : 0) + N, { ref: G, height: Y } = Lo({
|
|
2174
|
+
minHeight: s,
|
|
2175
|
+
headerRowCount: t.getHeaderGroups().length
|
|
2176
|
+
}), Q = po({
|
|
2177
|
+
rowHeight: e,
|
|
2178
|
+
rowCount: t.getRowModel().rows.length,
|
|
2179
|
+
rowHeights: z,
|
|
2180
|
+
defaultRowHeights: M,
|
|
2181
|
+
enableRowResizing: D,
|
|
2182
|
+
minRowHeight: U,
|
|
2183
|
+
maxRowHeight: H,
|
|
2184
|
+
onRowHeightChanged: p
|
|
2185
|
+
}), K = Eo({
|
|
2186
|
+
table: t,
|
|
2187
|
+
getRowTop: Q.getRowTop,
|
|
2188
|
+
getRowHeight: Q.getRowHeight,
|
|
2189
|
+
scrollContainerRef: S,
|
|
2190
|
+
rowHeaderWidth: _,
|
|
2191
|
+
columnHeaderHeight: Y,
|
|
2192
|
+
bodyContextMenuRenderer: m,
|
|
2193
|
+
enableBodyContextMenu: g,
|
|
2194
|
+
enableFocusedCell: f,
|
|
2195
|
+
onFocusedCell: T,
|
|
2196
|
+
onFocusedRegion: E,
|
|
2197
|
+
selectedRegions: v,
|
|
2198
|
+
onSelection: L,
|
|
2199
|
+
selectionModes: R
|
|
2200
|
+
}), Z = go({
|
|
2201
|
+
enableGhostCells: a,
|
|
2202
|
+
rowHeight: e,
|
|
2203
|
+
rowHeaderWidth: _,
|
|
2204
|
+
columnHeaderHeight: Y,
|
|
2205
|
+
totalWidth: t.getTotalSize(),
|
|
2206
|
+
totalHeight: Q.totalHeight,
|
|
2207
|
+
scrollContainerRef: S
|
|
2208
|
+
}), et = K.isSelectionModeEnabled(J.CELLS) ? Zn : void 0;
|
|
2209
|
+
return /* @__PURE__ */ d(
|
|
2210
|
+
"div",
|
|
2211
|
+
{
|
|
2212
|
+
...O,
|
|
2213
|
+
className: P(Sn, et, {
|
|
2214
|
+
[Bn]: Z != null && Z.columnCount > 0,
|
|
2215
|
+
[Dn]: Z != null && Z.rowCount > 0
|
|
2216
|
+
}, I),
|
|
2217
|
+
children: /* @__PURE__ */ d(
|
|
2218
|
+
Go,
|
|
2219
|
+
{
|
|
2220
|
+
table: t,
|
|
2221
|
+
rowHeaderWidth: n,
|
|
2222
|
+
enableRowHeader: o,
|
|
2223
|
+
columnHeaderHeight: Y,
|
|
2224
|
+
columnHeaderMeasureRef: G,
|
|
2225
|
+
enableColumnReordering: l,
|
|
2226
|
+
enableSorting: r,
|
|
2227
|
+
areCellsLoading: c,
|
|
2228
|
+
areColumnHeadersLoading: i,
|
|
2229
|
+
areRowHeadersLoading: u,
|
|
2230
|
+
selection: K,
|
|
2231
|
+
rowResizing: Q,
|
|
2232
|
+
ghosts: Z,
|
|
2233
|
+
enableRowVirtualization: C,
|
|
2234
|
+
overscanRowCount: y,
|
|
2235
|
+
scrollContainerRef: S,
|
|
2236
|
+
selectionColumnWidth: N
|
|
2237
|
+
}
|
|
2238
|
+
)
|
|
2239
|
+
}
|
|
2240
|
+
);
|
|
2241
|
+
}
|
|
2242
|
+
function ol({
|
|
2243
|
+
htmlProps: t,
|
|
2244
|
+
rowHeight: e = hn,
|
|
2245
|
+
showRowSelectionCheckboxes: n = !1,
|
|
2246
|
+
rowSelectionColumnWidth: o = wn,
|
|
2247
|
+
rowHeaderWidth: s = mn,
|
|
2248
|
+
enableRowHeader: l = !0,
|
|
2249
|
+
columnHeaderHeight: r = fe,
|
|
2250
|
+
enableColumnReordering: c = !1,
|
|
2251
|
+
enableSorting: i = !1,
|
|
2252
|
+
loadingOptions: u = [],
|
|
2253
|
+
enableFocusedCell: f = !1,
|
|
2254
|
+
enableGhostCells: a = !1,
|
|
2255
|
+
bodyContextMenuRenderer: m,
|
|
2256
|
+
enableBodyContextMenu: g,
|
|
2257
|
+
onFocusedCell: T,
|
|
2258
|
+
onFocusedRegion: E,
|
|
2259
|
+
selectedRegions: v,
|
|
2260
|
+
onSelection: L,
|
|
2261
|
+
selectionModes: R,
|
|
2262
|
+
enableRowVirtualization: C = !1,
|
|
2263
|
+
numFrozenColumns: y = 0,
|
|
2264
|
+
numFrozenRows: D = 0,
|
|
2265
|
+
overscanRowCount: z = de,
|
|
2266
|
+
columnVisibility: M,
|
|
2267
|
+
enableRowResizing: p = !1,
|
|
2268
|
+
rowHeights: U,
|
|
2269
|
+
defaultRowHeights: H,
|
|
2270
|
+
onRowHeightChanged: N,
|
|
2271
|
+
minRowHeight: I,
|
|
2272
|
+
maxRowHeight: O,
|
|
2273
|
+
rowSelection: S,
|
|
2274
|
+
defaultRowSelection: _,
|
|
2275
|
+
...G
|
|
2276
|
+
}) {
|
|
2277
|
+
var B, $;
|
|
2278
|
+
const [Y, Q] = fn({
|
|
2279
|
+
value: S ?? ((B = G.state) == null ? void 0 : B.rowSelection),
|
|
2280
|
+
initialValue: _ ?? (($ = G.initialState) == null ? void 0 : $.rowSelection),
|
|
2281
|
+
finalValue: {},
|
|
2282
|
+
onChange: G.onRowSelectionChange
|
|
2283
|
+
}), K = b(
|
|
2284
|
+
(x) => {
|
|
2285
|
+
Q(ce(x, Y));
|
|
2286
|
+
},
|
|
2287
|
+
[Y, Q]
|
|
2288
|
+
), Z = un({
|
|
2289
|
+
...G,
|
|
2290
|
+
enableSorting: i,
|
|
2291
|
+
state: {
|
|
2292
|
+
...G.state,
|
|
2293
|
+
...M !== void 0 ? { columnVisibility: M } : {},
|
|
2294
|
+
rowSelection: Y
|
|
2295
|
+
},
|
|
2296
|
+
onRowSelectionChange: K
|
|
2297
|
+
});
|
|
2298
|
+
an({ table: Z, numFrozenColumns: y, numFrozenRows: D });
|
|
2299
|
+
const et = yt(u, Mt.CELLS), ct = yt(
|
|
2300
|
+
u,
|
|
2301
|
+
Mt.COLUMN_HEADERS
|
|
2302
|
+
), w = yt(u, Mt.ROW_HEADERS);
|
|
2303
|
+
return /* @__PURE__ */ d(
|
|
2304
|
+
Wo,
|
|
2305
|
+
{
|
|
2306
|
+
table: Z,
|
|
2307
|
+
rowHeight: e,
|
|
2308
|
+
rowHeaderWidth: s,
|
|
2309
|
+
enableRowHeader: l,
|
|
2310
|
+
columnHeaderHeight: r,
|
|
2311
|
+
enableColumnReordering: c,
|
|
2312
|
+
enableSorting: i,
|
|
2313
|
+
areCellsLoading: et,
|
|
2314
|
+
areColumnHeadersLoading: ct,
|
|
2315
|
+
areRowHeadersLoading: w,
|
|
2316
|
+
enableFocusedCell: f,
|
|
2317
|
+
enableGhostCells: a,
|
|
2318
|
+
bodyContextMenuRenderer: m,
|
|
2319
|
+
enableBodyContextMenu: g,
|
|
2320
|
+
onFocusedCell: T,
|
|
2321
|
+
onFocusedRegion: E,
|
|
2322
|
+
selectedRegions: v,
|
|
2323
|
+
onSelection: L,
|
|
2324
|
+
selectionModes: R,
|
|
2325
|
+
enableRowVirtualization: C,
|
|
2326
|
+
overscanRowCount: z,
|
|
2327
|
+
enableRowResizing: p,
|
|
2328
|
+
rowHeights: U,
|
|
2329
|
+
defaultRowHeights: H,
|
|
2330
|
+
onRowHeightChanged: N,
|
|
2331
|
+
minRowHeight: I,
|
|
2332
|
+
maxRowHeight: O,
|
|
2333
|
+
selectionColumnWidth: n ? o : 0,
|
|
2334
|
+
...t
|
|
2335
|
+
}
|
|
2336
|
+
);
|
|
2337
|
+
}
|
|
2338
|
+
const ko = 10, Vo = [10, 20, 50, 100];
|
|
2339
|
+
function Yo({
|
|
2340
|
+
pageIndex: t,
|
|
2341
|
+
pageSize: e,
|
|
2342
|
+
pageCount: n,
|
|
2343
|
+
rowCount: o,
|
|
2344
|
+
pageSizeOptions: s = Vo,
|
|
2345
|
+
onPageIndexChange: l,
|
|
2346
|
+
onPageSizeChange: r,
|
|
2347
|
+
className: c
|
|
2348
|
+
}) {
|
|
2349
|
+
const i = n != null && n >= 0 ? n : void 0, u = t > 0, f = i === void 0 ? !0 : t < i - 1, a = o === void 0 || o === 0 ? 0 : t * e + 1, m = o === void 0 ? void 0 : Math.min((t + 1) * e, o), g = s.includes(e) ? s : [...s, e].sort((T, E) => T - E);
|
|
2350
|
+
return /* @__PURE__ */ F("div", { className: P(yn, c), children: [
|
|
2351
|
+
/* @__PURE__ */ F("div", { className: Qt, children: [
|
|
2352
|
+
/* @__PURE__ */ d("span", { className: $t, children: "Rows per page:" }),
|
|
2353
|
+
/* @__PURE__ */ d(
|
|
2354
|
+
sn,
|
|
2355
|
+
{
|
|
2356
|
+
"aria-label": "Rows per page",
|
|
2357
|
+
onChange: (T) => r(Number(T.currentTarget.value)),
|
|
2358
|
+
options: g,
|
|
2359
|
+
value: e
|
|
2360
|
+
}
|
|
2361
|
+
),
|
|
2362
|
+
o !== void 0 && /* @__PURE__ */ F("span", { className: $t, children: [
|
|
2363
|
+
a === 0 ? 0 : `${a}–${m}`,
|
|
2364
|
+
" of ",
|
|
2365
|
+
o
|
|
2366
|
+
] })
|
|
2367
|
+
] }),
|
|
2368
|
+
/* @__PURE__ */ F("div", { className: Qt, children: [
|
|
2369
|
+
/* @__PURE__ */ F("span", { className: $t, children: [
|
|
2370
|
+
"Page ",
|
|
2371
|
+
t + 1,
|
|
2372
|
+
i !== void 0 ? ` of ${i}` : ""
|
|
2373
|
+
] }),
|
|
2374
|
+
/* @__PURE__ */ F(rn, { children: [
|
|
2375
|
+
/* @__PURE__ */ d(
|
|
2376
|
+
Rt,
|
|
2377
|
+
{
|
|
2378
|
+
"aria-label": "First page",
|
|
2379
|
+
disabled: !u,
|
|
2380
|
+
icon: "double-chevron-left",
|
|
2381
|
+
onClick: () => l(0)
|
|
2382
|
+
}
|
|
2383
|
+
),
|
|
2384
|
+
/* @__PURE__ */ d(
|
|
2385
|
+
Rt,
|
|
2386
|
+
{
|
|
2387
|
+
"aria-label": "Previous page",
|
|
2388
|
+
disabled: !u,
|
|
2389
|
+
icon: "chevron-left",
|
|
2390
|
+
onClick: () => l(t - 1)
|
|
2391
|
+
}
|
|
2392
|
+
),
|
|
2393
|
+
/* @__PURE__ */ d(
|
|
2394
|
+
Rt,
|
|
2395
|
+
{
|
|
2396
|
+
"aria-label": "Next page",
|
|
2397
|
+
disabled: !f,
|
|
2398
|
+
icon: "chevron-right",
|
|
2399
|
+
onClick: () => l(t + 1)
|
|
2400
|
+
}
|
|
2401
|
+
),
|
|
2402
|
+
/* @__PURE__ */ d(
|
|
2403
|
+
Rt,
|
|
2404
|
+
{
|
|
2405
|
+
"aria-label": "Last page",
|
|
2406
|
+
disabled: i === void 0 || !f,
|
|
2407
|
+
icon: "double-chevron-right",
|
|
2408
|
+
onClick: () => {
|
|
2409
|
+
i !== void 0 && l(i - 1);
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
)
|
|
2413
|
+
] })
|
|
2414
|
+
] })
|
|
2415
|
+
] });
|
|
2416
|
+
}
|
|
2417
|
+
const Xo = Pt({
|
|
2418
|
+
...Ut,
|
|
2419
|
+
rowPaginationFeature: ie,
|
|
2420
|
+
paginatedRowModel: ue()
|
|
2421
|
+
});
|
|
2422
|
+
function ll(t) {
|
|
2423
|
+
function e({
|
|
2424
|
+
data: o,
|
|
2425
|
+
initialState: s,
|
|
2426
|
+
state: l,
|
|
2427
|
+
features: r,
|
|
2428
|
+
onPaginationChange: c,
|
|
2429
|
+
manualPagination: i,
|
|
2430
|
+
pageCount: u,
|
|
2431
|
+
rowCount: f,
|
|
2432
|
+
initialPageIndex: a = 0,
|
|
2433
|
+
initialPageSize: m = ko,
|
|
2434
|
+
pageSizeOptions: g,
|
|
2435
|
+
showPaginationBar: T = !0,
|
|
2436
|
+
paginationBarClassName: E,
|
|
2437
|
+
...v
|
|
2438
|
+
}) {
|
|
2439
|
+
const [L, R] = tt(() => {
|
|
2440
|
+
var S, _;
|
|
2441
|
+
return {
|
|
2442
|
+
pageIndex: ((S = s == null ? void 0 : s.pagination) == null ? void 0 : S.pageIndex) ?? a,
|
|
2443
|
+
pageSize: ((_ = s == null ? void 0 : s.pagination) == null ? void 0 : _.pageSize) ?? m
|
|
2444
|
+
};
|
|
2445
|
+
}), C = l == null ? void 0 : l.pagination, y = C ?? L, { pageIndex: D, pageSize: z } = y, M = b(
|
|
2446
|
+
(S) => {
|
|
2447
|
+
c == null || c(S), C === void 0 && R((_) => ce(S, _));
|
|
2448
|
+
},
|
|
2449
|
+
[C, c]
|
|
2450
|
+
), p = i === !0, U = p ? f : o.length, H = dt(() => p ? u != null && u >= 0 ? u : f != null ? Math.ceil(f / z) : void 0 : Math.max(1, Math.ceil(o.length / z)), [o.length, p, u, z, f]);
|
|
2451
|
+
at(() => {
|
|
2452
|
+
if (H === void 0)
|
|
2453
|
+
return;
|
|
2454
|
+
const S = Math.max(0, H - 1);
|
|
2455
|
+
D > S && M((_) => ({ ..._, pageIndex: S }));
|
|
2456
|
+
}, [M, H, D]);
|
|
2457
|
+
const N = dt(
|
|
2458
|
+
() => r == null ? Xo : Pt({
|
|
2459
|
+
...Ut,
|
|
2460
|
+
...r,
|
|
2461
|
+
rowPaginationFeature: ie,
|
|
2462
|
+
paginatedRowModel: ue()
|
|
2463
|
+
}),
|
|
2464
|
+
[r]
|
|
2465
|
+
), I = b(
|
|
2466
|
+
(S) => {
|
|
2467
|
+
M((_) => ({
|
|
2468
|
+
..._,
|
|
2469
|
+
pageIndex: Math.max(0, S)
|
|
2470
|
+
}));
|
|
2471
|
+
},
|
|
2472
|
+
[M]
|
|
2473
|
+
), O = b(
|
|
2474
|
+
(S) => {
|
|
2475
|
+
M((_) => ({
|
|
2476
|
+
..._,
|
|
2477
|
+
pageIndex: 0,
|
|
2478
|
+
pageSize: S
|
|
2479
|
+
}));
|
|
2480
|
+
},
|
|
2481
|
+
[M]
|
|
2482
|
+
);
|
|
2483
|
+
return /* @__PURE__ */ F("div", { className: $n, children: [
|
|
2484
|
+
/* @__PURE__ */ d(
|
|
2485
|
+
t,
|
|
2486
|
+
{
|
|
2487
|
+
...v,
|
|
2488
|
+
data: o,
|
|
2489
|
+
initialState: s,
|
|
2490
|
+
state: { ...l, pagination: y },
|
|
2491
|
+
features: N,
|
|
2492
|
+
onPaginationChange: M,
|
|
2493
|
+
manualPagination: i,
|
|
2494
|
+
pageCount: u,
|
|
2495
|
+
rowCount: f
|
|
2496
|
+
}
|
|
2497
|
+
),
|
|
2498
|
+
T && /* @__PURE__ */ d(
|
|
2499
|
+
Yo,
|
|
2500
|
+
{
|
|
2501
|
+
className: E,
|
|
2502
|
+
onPageIndexChange: I,
|
|
2503
|
+
onPageSizeChange: O,
|
|
2504
|
+
pageCount: H,
|
|
2505
|
+
pageIndex: D,
|
|
2506
|
+
pageSize: z,
|
|
2507
|
+
pageSizeOptions: g,
|
|
2508
|
+
rowCount: U
|
|
2509
|
+
}
|
|
2510
|
+
)
|
|
2511
|
+
] });
|
|
2512
|
+
}
|
|
2513
|
+
const n = t.displayName ?? t.name ?? "Table";
|
|
2514
|
+
return e.displayName = `withPagination(${n})`, e;
|
|
2515
|
+
}
|
|
2516
|
+
export {
|
|
2517
|
+
ol as BP_Table,
|
|
2518
|
+
Ut as DEFAULT_BP_TABLE_FEATURES,
|
|
2519
|
+
ko as DEFAULT_PAGE_SIZE,
|
|
2520
|
+
Vo as DEFAULT_PAGE_SIZE_OPTIONS,
|
|
2521
|
+
oo as Direction,
|
|
2522
|
+
xe as FocusMode,
|
|
2523
|
+
J as RegionCardinality,
|
|
2524
|
+
A as Regions,
|
|
2525
|
+
Mt as TableLoadingOption,
|
|
2526
|
+
Yo as TablePaginationBar,
|
|
2527
|
+
lo as directionToDelta,
|
|
2528
|
+
yt as hasLoadingOption,
|
|
2529
|
+
el as moveFocusedCell,
|
|
2530
|
+
nl as resizeRegion,
|
|
2531
|
+
ll as withPagination
|
|
2532
|
+
};
|
|
2533
|
+
//# sourceMappingURL=blueprintjs-react-table.js.map
|