flexi-datagrid 1.2.7 → 1.2.8
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/dist/flexi-datagrid.css +1 -1
- package/dist/index.es.js +390 -393
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ArrowDown as e, ArrowUp as t, ArrowUpDown as n, ChevronDown as r, ChevronLeft as i, ChevronRight as a, ChevronsLeft as o, ChevronsRight as s, Filter as ee, Pin as te, PinOff as ne, RotateCcw as re, Settings as ie, X as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { Fragment as
|
|
1
|
+
import { ArrowDown as e, ArrowUp as t, ArrowUpDown as n, ChevronDown as r, ChevronLeft as i, ChevronRight as a, ChevronsLeft as o, ChevronsRight as s, Filter as ee, Pin as te, PinOff as ne, RotateCcw as re, Settings as ie, X as ae } from "lucide-react";
|
|
2
|
+
import { useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
3
|
+
import { createPortal as oe } from "react-dom";
|
|
4
|
+
import { Fragment as se, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
5
5
|
//#region src/Datatable.tsx
|
|
6
|
-
var
|
|
6
|
+
var m = (e) => {
|
|
7
7
|
let t = [];
|
|
8
8
|
return e.forEach((e) => {
|
|
9
|
-
e.children && e.children.length > 0 ? t.push(...
|
|
9
|
+
e.children && e.children.length > 0 ? t.push(...m(e.children)) : t.push(e);
|
|
10
10
|
}), t;
|
|
11
|
-
},
|
|
11
|
+
}, h = (...e) => e.filter(Boolean).join(" "), ce = (e) => {
|
|
12
12
|
if (e === !0) return "left";
|
|
13
13
|
if (e === "left" || e === "right") return e;
|
|
14
|
-
},
|
|
14
|
+
}, le = (e, t, n) => {
|
|
15
15
|
let r = (e) => {
|
|
16
16
|
let n = t[e];
|
|
17
17
|
return n === "left" ? 0 : n === "right" ? 2 : 1;
|
|
@@ -26,55 +26,55 @@ var h = (e) => {
|
|
|
26
26
|
children: i(e.children)
|
|
27
27
|
} : e);
|
|
28
28
|
return i(e);
|
|
29
|
-
},
|
|
30
|
-
function
|
|
29
|
+
}, ue = 48, de = 150, fe = 60;
|
|
30
|
+
function g({ columns: g, data: _, rowKey: pe, actions: v, isLoading: me, groupBy: y = !1, defaultGroupBy: he = [], onPinChange: ge, onGroupChange: b, containerStyle: _e, tableStyle: ve, bordered: ye = !1, pinnedBottomRowData: x = [], pinnedRowClassName: be, rowHeight: S = ue, overscan: xe = 8, onColumnResize: Se, onColumnReorder: Ce, rowClassRules: we, onRowClick: Te, rowSpanColumns: C, controlPanel: Ee = !1, defaultDisplayPinnedIcon: De = !0, defaultHiddenColumns: Oe = [], onColumnVisibilityChange: w, pagination: T = !1, defaultPageSize: ke = 10, pageSizeOptions: Ae = [
|
|
31
31
|
10,
|
|
32
32
|
25,
|
|
33
33
|
50,
|
|
34
34
|
100
|
|
35
|
-
], onPageChange:
|
|
36
|
-
let [
|
|
35
|
+
], onPageChange: E }) {
|
|
36
|
+
let [D, je] = d(null), [O, Me] = d({}), [k, Ne] = d(""), [Pe, Fe] = d(null), [Ie, Le] = d(null), Re = u(/* @__PURE__ */ new Map()), [A, ze] = d(he), [Be, Ve] = d({}), [He, Ue] = d(!1), [j, We] = d({
|
|
37
37
|
key: null,
|
|
38
38
|
direction: null
|
|
39
|
-
}), [
|
|
39
|
+
}), [Ge, Ke] = d({}), [qe, Je] = d({}), [Ye, Xe] = d(De), [M, Ze] = d(Oe), [N, Qe] = d(!1), $e = u(null), P = u(null), [F, I] = d(1), [L, et] = d(ke), tt = u(null), nt = u(!1), R = u(null), z = l(() => m(g), [g]), [B, rt] = d(() => {
|
|
40
40
|
let e = {};
|
|
41
|
-
return
|
|
42
|
-
let n =
|
|
41
|
+
return z.forEach((t) => {
|
|
42
|
+
let n = ce(t.pinned);
|
|
43
43
|
n && (e[t.key] = n);
|
|
44
44
|
}), e;
|
|
45
|
-
}),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
]),
|
|
50
|
-
let e =
|
|
51
|
-
return e.filter((e) => !t.includes(e.key) && !
|
|
45
|
+
}), V = l(() => le(g, B, qe), [
|
|
46
|
+
g,
|
|
47
|
+
B,
|
|
48
|
+
qe
|
|
49
|
+
]), H = l(() => {
|
|
50
|
+
let e = m(V), t = y ? A : [];
|
|
51
|
+
return e.filter((e) => !t.includes(e.key) && !M.includes(e.key));
|
|
52
52
|
}, [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
]),
|
|
58
|
-
|
|
53
|
+
V,
|
|
54
|
+
A,
|
|
55
|
+
y,
|
|
56
|
+
M
|
|
57
|
+
]), U = u(null), it = u(null);
|
|
58
|
+
c(() => {
|
|
59
59
|
function e(e) {
|
|
60
|
-
let t = e.target, n =
|
|
61
|
-
|
|
60
|
+
let t = e.target, n = D ? Re.current.get(D) : null;
|
|
61
|
+
it.current && !it.current.contains(t) && !(n && n.contains(t)) && (je(null), Ne(""));
|
|
62
62
|
}
|
|
63
63
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
64
|
-
}, [
|
|
65
|
-
if (!
|
|
64
|
+
}, [D]), c(() => {
|
|
65
|
+
if (!N) return;
|
|
66
66
|
function e(e) {
|
|
67
67
|
let t = e.target;
|
|
68
|
-
|
|
68
|
+
$e.current && !$e.current.contains(t) && !(P.current && P.current.contains(t)) && Qe(!1);
|
|
69
69
|
}
|
|
70
70
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
71
|
-
}, [
|
|
72
|
-
if (!
|
|
71
|
+
}, [N]), c(() => {
|
|
72
|
+
if (!N) return;
|
|
73
73
|
let e = () => {
|
|
74
|
-
let e =
|
|
74
|
+
let e = P.current, t = U.current;
|
|
75
75
|
if (!e || !t) return;
|
|
76
76
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
77
|
-
|
|
77
|
+
Le({
|
|
78
78
|
top: n.bottom - r.top + 4,
|
|
79
79
|
right: r.right - n.right
|
|
80
80
|
});
|
|
@@ -82,13 +82,13 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
82
82
|
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
83
83
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
84
84
|
};
|
|
85
|
-
}, [
|
|
86
|
-
if (!
|
|
85
|
+
}, [N]), c(() => {
|
|
86
|
+
if (!D) return;
|
|
87
87
|
let e = () => {
|
|
88
|
-
let e =
|
|
88
|
+
let e = Re.current.get(D), t = U.current;
|
|
89
89
|
if (!e || !t) return;
|
|
90
90
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
91
|
-
|
|
91
|
+
Fe({
|
|
92
92
|
top: n.bottom - r.top + 4,
|
|
93
93
|
left: n.left - r.left
|
|
94
94
|
});
|
|
@@ -96,94 +96,94 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
96
96
|
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
97
97
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
98
98
|
};
|
|
99
|
-
}, [
|
|
100
|
-
let
|
|
101
|
-
if (!
|
|
99
|
+
}, [D]);
|
|
100
|
+
let at = (e) => typeof pe == "function" ? pe(e) : String(e[pe]), ot = (e, t) => {
|
|
101
|
+
if (!we) return;
|
|
102
102
|
let n;
|
|
103
|
-
for (let r in
|
|
103
|
+
for (let r in we) we[r](e, t) && (n = n ? `${n} ${r}` : r);
|
|
104
104
|
return n;
|
|
105
|
-
},
|
|
106
|
-
|
|
105
|
+
}, st = (e) => {
|
|
106
|
+
rt((t) => {
|
|
107
107
|
let n = t[e], r = n ? n === "left" ? "right" : void 0 : "left", i = { ...t };
|
|
108
|
-
return r ? i[e] = r : delete i[e],
|
|
108
|
+
return r ? i[e] = r : delete i[e], ge && ge(e, !!r, r), i;
|
|
109
109
|
});
|
|
110
|
-
},
|
|
111
|
-
|
|
110
|
+
}, ct = (e) => {
|
|
111
|
+
Ze((t) => {
|
|
112
112
|
let n = t.includes(e) ? t.filter((t) => t !== e) : [...t, e];
|
|
113
|
-
return
|
|
113
|
+
return w && w(n), n;
|
|
114
114
|
});
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
},
|
|
115
|
+
}, lt = () => {
|
|
116
|
+
Xe(De), Ze(Oe), w && w(Oe);
|
|
117
|
+
}, ut = (e) => {
|
|
118
118
|
let t = "asc";
|
|
119
|
-
|
|
119
|
+
j.key === e && (t = j.direction === "asc" ? "desc" : j.direction === "desc" ? null : "asc"), We({
|
|
120
120
|
key: t ? e : null,
|
|
121
121
|
direction: t
|
|
122
122
|
});
|
|
123
|
-
},
|
|
124
|
-
if (
|
|
123
|
+
}, dt = (e, t, n) => {
|
|
124
|
+
if (nt.current) {
|
|
125
125
|
e.preventDefault();
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
},
|
|
128
|
+
tt.current = t, n && e.dataTransfer.setData("text/plain", t), e.dataTransfer.effectAllowed = "move";
|
|
129
|
+
}, ft = (e, t, n) => {
|
|
130
130
|
let r = e.map((e) => e.key);
|
|
131
131
|
if (r.includes(t) && r.includes(n)) return e;
|
|
132
132
|
for (let r of e) if (r.children && r.children.length > 0) {
|
|
133
|
-
let e =
|
|
133
|
+
let e = ft(r.children, t, n);
|
|
134
134
|
if (e) return e;
|
|
135
135
|
}
|
|
136
136
|
return null;
|
|
137
|
-
},
|
|
137
|
+
}, pt = (e, t) => {
|
|
138
138
|
e.preventDefault(), e.stopPropagation();
|
|
139
|
-
let n =
|
|
140
|
-
if (
|
|
141
|
-
let r =
|
|
139
|
+
let n = tt.current;
|
|
140
|
+
if (tt.current = null, !n || n === t) return;
|
|
141
|
+
let r = ft(V, n, t);
|
|
142
142
|
if (!r) return;
|
|
143
143
|
let i = r.map((e) => e.key), a = i.indexOf(n), o = i.indexOf(t);
|
|
144
144
|
i.splice(o, 0, i.splice(a, 1)[0]);
|
|
145
|
-
let s = { ...
|
|
145
|
+
let s = { ...qe };
|
|
146
146
|
i.forEach((e, t) => {
|
|
147
147
|
s[e] = t;
|
|
148
|
-
}),
|
|
149
|
-
},
|
|
150
|
-
e.preventDefault(), e.stopPropagation(),
|
|
148
|
+
}), Je(s), Ce && Ce(m(le(g, B, s)).map((e) => e.key));
|
|
149
|
+
}, mt = (e, t) => {
|
|
150
|
+
e.preventDefault(), e.stopPropagation(), nt.current = !0, R.current = {
|
|
151
151
|
key: t.key,
|
|
152
152
|
startX: e.clientX,
|
|
153
|
-
startWidth:
|
|
153
|
+
startWidth: W(t)
|
|
154
154
|
};
|
|
155
|
-
let n = t.minWidth ??
|
|
156
|
-
let t =
|
|
155
|
+
let n = t.minWidth ?? fe, r = t.maxWidth, i = (e) => {
|
|
156
|
+
let t = R.current;
|
|
157
157
|
if (!t) return;
|
|
158
158
|
let i = t.startWidth + (e.clientX - t.startX);
|
|
159
|
-
i = Math.max(n, i), r && (i = Math.min(r, i)),
|
|
159
|
+
i = Math.max(n, i), r && (i = Math.min(r, i)), Ke((e) => e[t.key] === i ? e : {
|
|
160
160
|
...e,
|
|
161
161
|
[t.key]: i
|
|
162
162
|
});
|
|
163
163
|
}, a = () => {
|
|
164
|
-
let e =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}), e &&
|
|
164
|
+
let e = R.current;
|
|
165
|
+
R.current = null, window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", a), requestAnimationFrame(() => {
|
|
166
|
+
nt.current = !1;
|
|
167
|
+
}), e && Se && Ke((t) => (t[e.key] !== void 0 && Se(e.key, t[e.key]), t));
|
|
168
168
|
};
|
|
169
169
|
window.addEventListener("mousemove", i), window.addEventListener("mouseup", a);
|
|
170
|
-
},
|
|
171
|
-
e.preventDefault(),
|
|
170
|
+
}, ht = (e) => {
|
|
171
|
+
e.preventDefault(), Ue(!1);
|
|
172
172
|
let t = e.dataTransfer.getData("text/plain");
|
|
173
|
-
if (t && !
|
|
174
|
-
let e = [...
|
|
175
|
-
|
|
173
|
+
if (t && !A.includes(t)) {
|
|
174
|
+
let e = [...A, t];
|
|
175
|
+
ze(e), b && b(e);
|
|
176
176
|
}
|
|
177
|
-
},
|
|
178
|
-
let t =
|
|
179
|
-
|
|
180
|
-
},
|
|
177
|
+
}, gt = (e) => {
|
|
178
|
+
let t = A.filter((t) => t !== e);
|
|
179
|
+
ze(t), Ve({}), b && b(t);
|
|
180
|
+
}, _t = l(() => {
|
|
181
181
|
let e = (t) => {
|
|
182
182
|
let n = 0;
|
|
183
183
|
return t.forEach((t) => {
|
|
184
184
|
n = t.children && t.children.length > 0 ? Math.max(n, 1 + e(t.children)) : Math.max(n, 1);
|
|
185
185
|
}), n;
|
|
186
|
-
}, t = e(
|
|
186
|
+
}, t = e(V), n = Array.from({ length: t }, () => []), r = (e) => !e.children || e.children.length === 0 ? y && A.includes(e.key) || M.includes(e.key) ? 0 : 1 : e.children.reduce((e, t) => e + r(t), 0), i = y ? A : [], a = (e, o) => {
|
|
187
187
|
e.forEach((e) => {
|
|
188
188
|
if (i.includes(e.key)) return;
|
|
189
189
|
let s = r(e);
|
|
@@ -198,75 +198,75 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
198
198
|
}));
|
|
199
199
|
});
|
|
200
200
|
};
|
|
201
|
-
return a(
|
|
201
|
+
return a(V, 0), n.filter((e) => e.length > 0);
|
|
202
202
|
}, [
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
]),
|
|
208
|
-
if (
|
|
209
|
-
let t = e.style?.width || e.headerStyle?.width || `${
|
|
210
|
-
return typeof t == "number" ? t : parseInt(String(t), 10) ||
|
|
211
|
-
},
|
|
203
|
+
V,
|
|
204
|
+
A,
|
|
205
|
+
y,
|
|
206
|
+
M
|
|
207
|
+
]), W = (e) => {
|
|
208
|
+
if (Ge[e.key] !== void 0) return Ge[e.key];
|
|
209
|
+
let t = e.style?.width || e.headerStyle?.width || `${de}px`;
|
|
210
|
+
return typeof t == "number" ? t : parseInt(String(t), 10) || de;
|
|
211
|
+
}, vt = l(() => {
|
|
212
212
|
let e = {}, t = 0;
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
y && A.length > 0 && (t += 48), H.forEach((n) => {
|
|
214
|
+
B[n.key] === "left" && (e[n.key] = {
|
|
215
215
|
side: "left",
|
|
216
216
|
offset: t
|
|
217
|
-
}, t +=
|
|
217
|
+
}, t += W(n));
|
|
218
218
|
});
|
|
219
|
-
let n =
|
|
220
|
-
for (let t =
|
|
221
|
-
let r =
|
|
222
|
-
|
|
219
|
+
let n = v ? 100 : 0;
|
|
220
|
+
for (let t = H.length - 1; t >= 0; t--) {
|
|
221
|
+
let r = H[t];
|
|
222
|
+
B[r.key] === "right" && (e[r.key] = {
|
|
223
223
|
side: "right",
|
|
224
224
|
offset: n
|
|
225
|
-
}, n +=
|
|
225
|
+
}, n += W(r));
|
|
226
226
|
}
|
|
227
227
|
return e;
|
|
228
228
|
}, [
|
|
229
|
-
W,
|
|
230
229
|
H,
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
B,
|
|
231
|
+
A,
|
|
233
232
|
y,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
233
|
+
v,
|
|
234
|
+
Ge
|
|
235
|
+
]), yt = (e, t) => {
|
|
236
|
+
Me((n) => {
|
|
237
237
|
let r = n[e] || [], i = r.includes(t) ? r.filter((e) => e !== t) : [...r, t], a = {
|
|
238
238
|
...n,
|
|
239
239
|
[e]: i
|
|
240
240
|
};
|
|
241
241
|
return a[e].length === 0 && delete a[e], a;
|
|
242
242
|
});
|
|
243
|
-
},
|
|
244
|
-
|
|
243
|
+
}, bt = (e) => {
|
|
244
|
+
Me((t) => {
|
|
245
245
|
let n = { ...t };
|
|
246
246
|
return delete n[e], n;
|
|
247
247
|
});
|
|
248
|
-
},
|
|
248
|
+
}, G = l(() => {
|
|
249
249
|
let e = /* @__PURE__ */ new Map();
|
|
250
|
-
return
|
|
251
|
-
}, [
|
|
252
|
-
if (!
|
|
253
|
-
let e =
|
|
250
|
+
return z.forEach((t) => e.set(t.key, t)), e;
|
|
251
|
+
}, [z]), xt = l(() => {
|
|
252
|
+
if (!D) return [];
|
|
253
|
+
let e = G.get(D), t = _.map((t) => e?.getValue ? e.getValue(t) : t[D]);
|
|
254
254
|
return Array.from(new Set(t)).filter((e) => e != null);
|
|
255
255
|
}, [
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
]),
|
|
260
|
-
if (!
|
|
261
|
-
let e =
|
|
262
|
-
return
|
|
263
|
-
}, [
|
|
264
|
-
let e = Object.entries(
|
|
265
|
-
let r =
|
|
256
|
+
_,
|
|
257
|
+
D,
|
|
258
|
+
G
|
|
259
|
+
]), St = l(() => {
|
|
260
|
+
if (!k.trim()) return xt;
|
|
261
|
+
let e = k.toLowerCase();
|
|
262
|
+
return xt.filter((t) => String(t).toLowerCase().includes(e));
|
|
263
|
+
}, [xt, k]), K = l(() => {
|
|
264
|
+
let e = Object.entries(O).filter(([, e]) => e && e.length > 0), t = e.length === 0 ? _ : _.filter((t) => e.every(([e, n]) => {
|
|
265
|
+
let r = G.get(e), i = r?.getValue ? r.getValue(t) : t[e];
|
|
266
266
|
return n.includes(i);
|
|
267
267
|
}));
|
|
268
|
-
if (
|
|
269
|
-
let { key: e, direction: n } =
|
|
268
|
+
if (j.key && j.direction) {
|
|
269
|
+
let { key: e, direction: n } = j, r = G.get(e);
|
|
270
270
|
t = [...t].sort((t, i) => {
|
|
271
271
|
let a = r?.getValue ? r.getValue(t) : t[e], o = r?.getValue ? r.getValue(i) : i[e];
|
|
272
272
|
if (a === o) return 0;
|
|
@@ -281,40 +281,40 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
281
281
|
}
|
|
282
282
|
return t;
|
|
283
283
|
}, [
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
]),
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}, [
|
|
292
|
-
k,
|
|
293
|
-
N,
|
|
294
|
-
z,
|
|
295
|
-
E
|
|
296
|
-
]), l(() => {
|
|
297
|
-
L > X && R(X);
|
|
298
|
-
}, [L, X]);
|
|
299
|
-
let xt = u(() => {
|
|
300
|
-
if (!E) return J;
|
|
301
|
-
let e = (L - 1) * z;
|
|
302
|
-
return J.slice(e, e + z);
|
|
284
|
+
_,
|
|
285
|
+
O,
|
|
286
|
+
j,
|
|
287
|
+
G
|
|
288
|
+
]), q = K.length, J = T ? Math.max(1, Math.ceil(q / L)) : 1;
|
|
289
|
+
c(() => {
|
|
290
|
+
I(1);
|
|
303
291
|
}, [
|
|
304
|
-
|
|
305
|
-
|
|
292
|
+
O,
|
|
293
|
+
j,
|
|
306
294
|
L,
|
|
307
|
-
|
|
308
|
-
]),
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
295
|
+
T
|
|
296
|
+
]), c(() => {
|
|
297
|
+
F > J && I(J);
|
|
298
|
+
}, [F, J]);
|
|
299
|
+
let Ct = l(() => {
|
|
300
|
+
if (!T) return K;
|
|
301
|
+
let e = (F - 1) * L;
|
|
302
|
+
return K.slice(e, e + L);
|
|
303
|
+
}, [
|
|
304
|
+
K,
|
|
305
|
+
T,
|
|
306
|
+
F,
|
|
307
|
+
L
|
|
308
|
+
]), Y = (e) => {
|
|
309
|
+
let t = Math.min(Math.max(1, e), J);
|
|
310
|
+
I(t), E && E(t, L);
|
|
311
|
+
}, wt = (e) => {
|
|
312
|
+
et(e), I(1), E && E(1, e);
|
|
313
|
+
}, Tt = l(() => {
|
|
314
|
+
if (!y || A.length === 0) return Ct;
|
|
315
315
|
let e = (t, n, r = "") => {
|
|
316
|
-
if (n >=
|
|
317
|
-
let i =
|
|
316
|
+
if (n >= A.length) return t;
|
|
317
|
+
let i = A[n], a = G.get(i), o = {};
|
|
318
318
|
return t.forEach((e) => {
|
|
319
319
|
let t = a?.getValue ? a.getValue(e) : e[i], n = String(t ?? "N/A");
|
|
320
320
|
o[n] || (o[n] = []), o[n].push(e);
|
|
@@ -334,35 +334,35 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
334
334
|
};
|
|
335
335
|
});
|
|
336
336
|
};
|
|
337
|
-
return e(
|
|
337
|
+
return e(Ct, 0);
|
|
338
338
|
}, [
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
]),
|
|
344
|
-
|
|
339
|
+
Ct,
|
|
340
|
+
A,
|
|
341
|
+
y,
|
|
342
|
+
G
|
|
343
|
+
]), Et = (e) => {
|
|
344
|
+
Ve((t) => {
|
|
345
345
|
let n = t[e] !== !1;
|
|
346
346
|
return {
|
|
347
347
|
...t,
|
|
348
348
|
[e]: !n
|
|
349
349
|
};
|
|
350
350
|
});
|
|
351
|
-
},
|
|
352
|
-
if (!
|
|
351
|
+
}, X = l(() => {
|
|
352
|
+
if (!y || A.length === 0) return Tt;
|
|
353
353
|
let e = [], t = (n) => {
|
|
354
354
|
n.forEach((n) => {
|
|
355
|
-
n.isGroupRow ? (e.push(n),
|
|
355
|
+
n.isGroupRow ? (e.push(n), Be[n.path] !== !1 && t(n.children)) : e.push(n);
|
|
356
356
|
});
|
|
357
357
|
};
|
|
358
|
-
return t(
|
|
358
|
+
return t(Tt), e;
|
|
359
359
|
}, [
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
]), Dt =
|
|
365
|
-
|
|
360
|
+
Tt,
|
|
361
|
+
Be,
|
|
362
|
+
A,
|
|
363
|
+
y
|
|
364
|
+
]), Dt = u(null), [Ot, kt] = d(0), [At, jt] = d(0);
|
|
365
|
+
c(() => {
|
|
366
366
|
let e = Dt.current;
|
|
367
367
|
if (!e) return;
|
|
368
368
|
let t = () => kt(e.scrollTop);
|
|
@@ -372,37 +372,37 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
372
372
|
e.removeEventListener("scroll", t), n?.disconnect();
|
|
373
373
|
};
|
|
374
374
|
}, []);
|
|
375
|
-
let Z =
|
|
375
|
+
let Z = X.length, { startIndex: Q, endIndex: Mt, topSpacerHeight: Nt, bottomSpacerHeight: Pt } = l(() => {
|
|
376
376
|
if (At === 0) return {
|
|
377
377
|
startIndex: 0,
|
|
378
378
|
endIndex: Z,
|
|
379
379
|
topSpacerHeight: 0,
|
|
380
380
|
bottomSpacerHeight: 0
|
|
381
381
|
};
|
|
382
|
-
let e = Math.max(0, Z - 1), t = Math.min(e, Math.floor(Ot /
|
|
382
|
+
let e = Math.max(0, Z - 1), t = Math.min(e, Math.floor(Ot / S)), n = Math.ceil(At / S) + 1, r = Math.max(0, t - xe), i = Math.min(Z, t + n + xe);
|
|
383
383
|
return {
|
|
384
384
|
startIndex: r,
|
|
385
385
|
endIndex: i,
|
|
386
|
-
topSpacerHeight: r *
|
|
387
|
-
bottomSpacerHeight: (Z - i) *
|
|
386
|
+
topSpacerHeight: r * S,
|
|
387
|
+
bottomSpacerHeight: (Z - i) * S
|
|
388
388
|
};
|
|
389
389
|
}, [
|
|
390
390
|
Ot,
|
|
391
391
|
At,
|
|
392
392
|
Z,
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
]), Ft =
|
|
396
|
-
|
|
393
|
+
S,
|
|
394
|
+
xe
|
|
395
|
+
]), Ft = l(() => X.slice(Q, Mt), [
|
|
396
|
+
X,
|
|
397
397
|
Q,
|
|
398
398
|
Mt
|
|
399
|
-
]), It =
|
|
399
|
+
]), It = l(() => {
|
|
400
400
|
let e = /* @__PURE__ */ new Map();
|
|
401
|
-
if (!
|
|
401
|
+
if (!C || C.length === 0) return e;
|
|
402
402
|
let t = (e, t) => {
|
|
403
|
-
let n =
|
|
403
|
+
let n = G.get(t);
|
|
404
404
|
return n?.getValue ? n.getValue(e) : e[t];
|
|
405
|
-
}, n = Ft, r = n.map(() =>
|
|
405
|
+
}, n = Ft, r = n.map(() => C.map(() => !0)), i = null;
|
|
406
406
|
for (let e = 0; e < n.length; e++) {
|
|
407
407
|
let a = n[e];
|
|
408
408
|
if (a.isGroupRow) {
|
|
@@ -411,14 +411,14 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
411
411
|
}
|
|
412
412
|
if (i !== null) {
|
|
413
413
|
let o = n[i], s = !0;
|
|
414
|
-
for (let n = 0; n <
|
|
415
|
-
let i =
|
|
414
|
+
for (let n = 0; n < C.length; n++) {
|
|
415
|
+
let i = C[n];
|
|
416
416
|
s && t(a, i) === t(o, i) ? r[e][n] = !1 : (s = !1, r[e][n] = !0);
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
i = e;
|
|
420
420
|
}
|
|
421
|
-
return
|
|
421
|
+
return C.forEach((t, i) => {
|
|
422
422
|
let a = 0;
|
|
423
423
|
for (; a < n.length;) {
|
|
424
424
|
if (n[a].isGroupRow || !r[a][i]) {
|
|
@@ -440,11 +440,11 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
440
440
|
}), e;
|
|
441
441
|
}, [
|
|
442
442
|
Ft,
|
|
443
|
-
|
|
444
|
-
|
|
443
|
+
C,
|
|
444
|
+
G,
|
|
445
445
|
Q
|
|
446
446
|
]), Lt = (e, t = !1, n) => {
|
|
447
|
-
let r =
|
|
447
|
+
let r = vt[e];
|
|
448
448
|
if (!r) return n || {};
|
|
449
449
|
let i = r.side === "right";
|
|
450
450
|
return {
|
|
@@ -456,124 +456,124 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
456
456
|
boxShadow: i ? "-2px 0 5px -2px rgba(0,0,0,0.1)" : "2px 0 5px -2px rgba(0,0,0,0.1)",
|
|
457
457
|
...n
|
|
458
458
|
};
|
|
459
|
-
}, Rt =
|
|
459
|
+
}, Rt = l(() => x.map((e, t) => (x.length - 1 - t) * 48), [x]), $ = H.length + +!!v + (y && A.length > 0 ? 1 : 0), zt = /* @__PURE__ */ f("button", {
|
|
460
460
|
type: "button",
|
|
461
|
-
ref:
|
|
461
|
+
ref: P,
|
|
462
462
|
onClick: (e) => {
|
|
463
|
-
e.stopPropagation(),
|
|
463
|
+
e.stopPropagation(), Qe((e) => !e);
|
|
464
464
|
},
|
|
465
|
-
className:
|
|
465
|
+
className: h("flexi-icon-btn", N && "flexi-settings-btn--active"),
|
|
466
466
|
title: "Grid display settings",
|
|
467
|
-
children: /* @__PURE__ */
|
|
468
|
-
}), Bt =
|
|
469
|
-
ref:
|
|
467
|
+
children: /* @__PURE__ */ f(ie, { className: "flexi-icon-sm" })
|
|
468
|
+
}), Bt = N && Ie && U.current && oe(/* @__PURE__ */ p("div", {
|
|
469
|
+
ref: $e,
|
|
470
470
|
className: "flexi-settings-menu",
|
|
471
471
|
style: {
|
|
472
|
-
top:
|
|
473
|
-
right:
|
|
472
|
+
top: Ie.top,
|
|
473
|
+
right: Ie.right,
|
|
474
474
|
zIndex: 9999
|
|
475
475
|
},
|
|
476
476
|
children: [
|
|
477
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ p("div", {
|
|
478
478
|
className: "flexi-settings-section",
|
|
479
|
-
children: [/* @__PURE__ */
|
|
479
|
+
children: [/* @__PURE__ */ f("span", {
|
|
480
480
|
className: "flexi-settings-heading",
|
|
481
481
|
children: "Action Icons"
|
|
482
|
-
}), /* @__PURE__ */
|
|
482
|
+
}), /* @__PURE__ */ p("label", {
|
|
483
483
|
className: "flexi-filter-option",
|
|
484
|
-
children: [/* @__PURE__ */
|
|
484
|
+
children: [/* @__PURE__ */ f("input", {
|
|
485
485
|
type: "checkbox",
|
|
486
486
|
className: "flexi-checkbox",
|
|
487
|
-
checked:
|
|
488
|
-
onChange: () =>
|
|
489
|
-
}), /* @__PURE__ */
|
|
487
|
+
checked: Ye,
|
|
488
|
+
onChange: () => Xe((e) => !e)
|
|
489
|
+
}), /* @__PURE__ */ f("span", {
|
|
490
490
|
className: "flexi-filter-option-text",
|
|
491
491
|
children: "Show pin icon on hover"
|
|
492
492
|
})]
|
|
493
493
|
})]
|
|
494
494
|
}),
|
|
495
|
-
/* @__PURE__ */
|
|
496
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ f("div", { className: "flexi-settings-divider" }),
|
|
496
|
+
/* @__PURE__ */ p("div", {
|
|
497
497
|
className: "flexi-settings-section",
|
|
498
|
-
children: [/* @__PURE__ */
|
|
498
|
+
children: [/* @__PURE__ */ f("span", {
|
|
499
499
|
className: "flexi-settings-heading",
|
|
500
500
|
children: "Columns"
|
|
501
|
-
}),
|
|
501
|
+
}), z.map((e) => /* @__PURE__ */ p("label", {
|
|
502
502
|
className: "flexi-filter-option",
|
|
503
|
-
children: [/* @__PURE__ */
|
|
503
|
+
children: [/* @__PURE__ */ f("input", {
|
|
504
504
|
type: "checkbox",
|
|
505
505
|
className: "flexi-checkbox",
|
|
506
|
-
checked: !
|
|
507
|
-
onChange: () =>
|
|
508
|
-
}), /* @__PURE__ */
|
|
506
|
+
checked: !M.includes(e.key),
|
|
507
|
+
onChange: () => ct(e.key)
|
|
508
|
+
}), /* @__PURE__ */ f("span", {
|
|
509
509
|
className: "flexi-filter-option-text",
|
|
510
510
|
children: e.header
|
|
511
511
|
})]
|
|
512
512
|
}, e.key))]
|
|
513
513
|
}),
|
|
514
|
-
/* @__PURE__ */
|
|
515
|
-
/* @__PURE__ */
|
|
514
|
+
/* @__PURE__ */ f("div", { className: "flexi-settings-divider" }),
|
|
515
|
+
/* @__PURE__ */ p("button", {
|
|
516
516
|
type: "button",
|
|
517
|
-
onClick:
|
|
517
|
+
onClick: lt,
|
|
518
518
|
className: "flexi-settings-reset",
|
|
519
519
|
title: "Reset pin icon visibility and hidden columns to their defaults",
|
|
520
|
-
children: [/* @__PURE__ */
|
|
520
|
+
children: [/* @__PURE__ */ f(re, { className: "flexi-icon-sm" }), /* @__PURE__ */ f("span", { children: "Reset to defaults" })]
|
|
521
521
|
})
|
|
522
522
|
]
|
|
523
|
-
}),
|
|
524
|
-
return /* @__PURE__ */
|
|
525
|
-
ref:
|
|
523
|
+
}), U.current);
|
|
524
|
+
return /* @__PURE__ */ p("div", {
|
|
525
|
+
ref: U,
|
|
526
526
|
className: "flexi-root",
|
|
527
527
|
children: [
|
|
528
|
-
|
|
528
|
+
y && /* @__PURE__ */ f("div", {
|
|
529
529
|
onDragOver: (e) => {
|
|
530
|
-
e.preventDefault(),
|
|
530
|
+
e.preventDefault(), Ue(!0);
|
|
531
531
|
},
|
|
532
|
-
onDragLeave: () =>
|
|
533
|
-
onDrop:
|
|
534
|
-
className:
|
|
535
|
-
children:
|
|
532
|
+
onDragLeave: () => Ue(!1),
|
|
533
|
+
onDrop: ht,
|
|
534
|
+
className: h("flexi-groupzone", He && "flexi-groupzone--dragover"),
|
|
535
|
+
children: A.length === 0 ? /* @__PURE__ */ f("span", {
|
|
536
536
|
className: "flexi-groupzone-hint",
|
|
537
537
|
children: "Drag a column header here to group your records by that field"
|
|
538
|
-
}) : /* @__PURE__ */
|
|
538
|
+
}) : /* @__PURE__ */ p("div", {
|
|
539
539
|
className: "flexi-groupzone-chips",
|
|
540
|
-
children: [/* @__PURE__ */
|
|
540
|
+
children: [/* @__PURE__ */ f("span", {
|
|
541
541
|
className: "flexi-groupzone-label",
|
|
542
542
|
children: "Grouped By:"
|
|
543
|
-
}),
|
|
543
|
+
}), A.map((e) => /* @__PURE__ */ p("div", {
|
|
544
544
|
className: "flexi-chip",
|
|
545
|
-
children: [/* @__PURE__ */
|
|
545
|
+
children: [/* @__PURE__ */ f("span", { children: z.find((t) => t.key === e)?.header || e }), /* @__PURE__ */ f("button", {
|
|
546
546
|
type: "button",
|
|
547
|
-
onClick: () =>
|
|
547
|
+
onClick: () => gt(e),
|
|
548
548
|
className: "flexi-icon-btn flexi-chip-remove",
|
|
549
|
-
children: /* @__PURE__ */
|
|
549
|
+
children: /* @__PURE__ */ f(ae, { className: "flexi-icon-xs" })
|
|
550
550
|
})]
|
|
551
551
|
}, e))]
|
|
552
552
|
})
|
|
553
553
|
}),
|
|
554
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ f("div", {
|
|
555
555
|
ref: Dt,
|
|
556
556
|
className: "flexi-table-wrap",
|
|
557
|
-
style:
|
|
558
|
-
children: /* @__PURE__ */
|
|
559
|
-
className:
|
|
560
|
-
style:
|
|
557
|
+
style: _e,
|
|
558
|
+
children: /* @__PURE__ */ p("table", {
|
|
559
|
+
className: h("flexi-table", ye && "flexi-table--bordered"),
|
|
560
|
+
style: ve,
|
|
561
561
|
children: [
|
|
562
|
-
/* @__PURE__ */
|
|
563
|
-
|
|
564
|
-
|
|
562
|
+
/* @__PURE__ */ p("colgroup", { children: [
|
|
563
|
+
y && A.length > 0 && /* @__PURE__ */ f("col", { style: { width: "48px" } }),
|
|
564
|
+
H.map((e) => /* @__PURE__ */ f("col", { style: {
|
|
565
565
|
...e.style,
|
|
566
|
-
width:
|
|
566
|
+
width: W(e)
|
|
567
567
|
} }, e.key)),
|
|
568
|
-
|
|
568
|
+
v && /* @__PURE__ */ f("col", { style: { width: "100px" } })
|
|
569
569
|
] }),
|
|
570
|
-
/* @__PURE__ */
|
|
570
|
+
/* @__PURE__ */ f("thead", {
|
|
571
571
|
className: "flexi-thead",
|
|
572
|
-
children:
|
|
572
|
+
children: _t.map((r, i) => /* @__PURE__ */ p("tr", {
|
|
573
573
|
className: "flexi-header-row",
|
|
574
574
|
children: [
|
|
575
|
-
i === 0 &&
|
|
576
|
-
rowSpan:
|
|
575
|
+
i === 0 && y && A.length > 0 && /* @__PURE__ */ f("th", {
|
|
576
|
+
rowSpan: _t.length,
|
|
577
577
|
className: "flexi-group-spacer-th",
|
|
578
578
|
style: {
|
|
579
579
|
position: "sticky",
|
|
@@ -584,144 +584,141 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
584
584
|
}
|
|
585
585
|
}),
|
|
586
586
|
r.map(({ col: a, rowSpan: o, colSpan: s }, re) => {
|
|
587
|
-
let ie = (
|
|
588
|
-
return /* @__PURE__ */
|
|
587
|
+
let ie = (O[a.key]?.length || 0) > 0, ae = !!B[a.key], c = Lt(a.key, !0, a.headerStyle), l = !a.children || a.children.length === 0, u = j.key === a.key, d = !!(y && l), se = l && a.resizable !== !1;
|
|
588
|
+
return i === 0 && r.length - 1, /* @__PURE__ */ p("th", {
|
|
589
589
|
rowSpan: o,
|
|
590
590
|
colSpan: s,
|
|
591
591
|
draggable: !0,
|
|
592
|
-
onDragStart: (e) =>
|
|
592
|
+
onDragStart: (e) => dt(e, a.key, l),
|
|
593
593
|
onDragOver: (e) => e.preventDefault(),
|
|
594
|
-
onDrop: (e) =>
|
|
595
|
-
className:
|
|
596
|
-
style:
|
|
597
|
-
children: [/* @__PURE__ */
|
|
594
|
+
onDrop: (e) => pt(e, a.key),
|
|
595
|
+
className: h("flexi-th", "flexi-th--draggable", d && "flexi-th--group-draggable", ae && "flexi-th--pinned", a.className, a.headerClassName),
|
|
596
|
+
style: c,
|
|
597
|
+
children: [/* @__PURE__ */ p("div", {
|
|
598
598
|
className: "flexi-th-inner",
|
|
599
599
|
children: [
|
|
600
|
-
/* @__PURE__ */
|
|
601
|
-
className:
|
|
602
|
-
onClick: () => a.sortable &&
|
|
603
|
-
children: [/* @__PURE__ */
|
|
600
|
+
/* @__PURE__ */ p("div", {
|
|
601
|
+
className: h("flexi-th-label", a.sortable && l && "flexi-th-label--sortable"),
|
|
602
|
+
onClick: () => a.sortable && l && ut(a.key),
|
|
603
|
+
children: [/* @__PURE__ */ f("span", {
|
|
604
604
|
className: "flexi-th-text",
|
|
605
605
|
children: a.header
|
|
606
|
-
}),
|
|
607
|
-
className:
|
|
608
|
-
children:
|
|
606
|
+
}), l && a.sortable && /* @__PURE__ */ f("span", {
|
|
607
|
+
className: h("flexi-sort-icon", u && "flexi-sort-icon--active"),
|
|
608
|
+
children: u && j.direction === "asc" ? /* @__PURE__ */ f(t, { className: "flexi-icon-sm" }) : u && j.direction === "desc" ? /* @__PURE__ */ f(e, { className: "flexi-icon-sm" }) : /* @__PURE__ */ f(n, { className: "flexi-icon-sm" })
|
|
609
609
|
})]
|
|
610
610
|
}),
|
|
611
|
-
/* @__PURE__ */
|
|
611
|
+
/* @__PURE__ */ p("div", {
|
|
612
612
|
className: "flexi-th-actions",
|
|
613
|
-
children: [
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
children: p(c ? ne : te, { className: "flexi-icon-sm" })
|
|
633
|
-
}),
|
|
634
|
-
Te && h && zt
|
|
635
|
-
]
|
|
613
|
+
children: [l && a.filterable && /* @__PURE__ */ f("button", {
|
|
614
|
+
type: "button",
|
|
615
|
+
ref: (e) => {
|
|
616
|
+
e ? Re.current.set(a.key, e) : Re.current.delete(a.key);
|
|
617
|
+
},
|
|
618
|
+
onClick: (e) => {
|
|
619
|
+
e.stopPropagation(), Ne(""), je(D === a.key ? null : a.key);
|
|
620
|
+
},
|
|
621
|
+
className: h("flexi-icon-btn", "flexi-filter-btn", ie && "flexi-filter-btn--active"),
|
|
622
|
+
children: /* @__PURE__ */ f(ee, { className: "flexi-icon-sm" })
|
|
623
|
+
}), l && Ye && /* @__PURE__ */ f("button", {
|
|
624
|
+
type: "button",
|
|
625
|
+
onClick: (e) => {
|
|
626
|
+
e.stopPropagation(), st(a.key);
|
|
627
|
+
},
|
|
628
|
+
className: h("flexi-icon-btn", "flexi-pin-btn", ae && "flexi-pin-btn--pinned"),
|
|
629
|
+
title: B[a.key] === "left" ? "Pinned left (click to pin right)" : B[a.key] === "right" ? "Pinned right (click to unpin)" : "Pin column left",
|
|
630
|
+
children: f(ae ? ne : te, { className: "flexi-icon-sm" })
|
|
631
|
+
})]
|
|
636
632
|
}),
|
|
637
|
-
|
|
638
|
-
ref:
|
|
633
|
+
D === a.key && l && Pe && U.current && oe(/* @__PURE__ */ p("div", {
|
|
634
|
+
ref: it,
|
|
639
635
|
className: "flexi-filter-dropdown",
|
|
640
636
|
style: {
|
|
641
|
-
top:
|
|
642
|
-
left:
|
|
637
|
+
top: Pe.top,
|
|
638
|
+
left: Pe.left,
|
|
643
639
|
zIndex: 9999
|
|
644
640
|
},
|
|
645
641
|
children: [
|
|
646
|
-
/* @__PURE__ */
|
|
642
|
+
/* @__PURE__ */ f("div", {
|
|
647
643
|
className: "flexi-filter-search",
|
|
648
|
-
children: /* @__PURE__ */
|
|
644
|
+
children: /* @__PURE__ */ f("input", {
|
|
649
645
|
type: "text",
|
|
650
646
|
placeholder: "Search values...",
|
|
651
|
-
value:
|
|
652
|
-
onChange: (e) =>
|
|
647
|
+
value: k,
|
|
648
|
+
onChange: (e) => Ne(e.target.value),
|
|
653
649
|
className: "flexi-input",
|
|
654
650
|
onClick: (e) => e.stopPropagation()
|
|
655
651
|
})
|
|
656
652
|
}),
|
|
657
|
-
/* @__PURE__ */
|
|
653
|
+
/* @__PURE__ */ f("div", {
|
|
658
654
|
className: "flexi-filter-list",
|
|
659
|
-
children:
|
|
655
|
+
children: St.length === 0 ? /* @__PURE__ */ f("div", {
|
|
660
656
|
className: "flexi-filter-empty",
|
|
661
657
|
children: "No results found"
|
|
662
|
-
}) :
|
|
658
|
+
}) : St.map((e, t) => /* @__PURE__ */ p("label", {
|
|
663
659
|
className: "flexi-filter-option",
|
|
664
|
-
children: [/* @__PURE__ */
|
|
660
|
+
children: [/* @__PURE__ */ f("input", {
|
|
665
661
|
type: "checkbox",
|
|
666
662
|
className: "flexi-checkbox",
|
|
667
|
-
checked:
|
|
668
|
-
onChange: () =>
|
|
669
|
-
}), /* @__PURE__ */
|
|
663
|
+
checked: O[a.key]?.includes(e) || !1,
|
|
664
|
+
onChange: () => yt(a.key, e)
|
|
665
|
+
}), /* @__PURE__ */ f("span", {
|
|
670
666
|
className: "flexi-filter-option-text",
|
|
671
667
|
children: String(e)
|
|
672
668
|
})]
|
|
673
669
|
}, t))
|
|
674
670
|
}),
|
|
675
|
-
ie && /* @__PURE__ */
|
|
671
|
+
ie && /* @__PURE__ */ f("div", {
|
|
676
672
|
className: "flexi-filter-footer",
|
|
677
|
-
children: /* @__PURE__ */
|
|
673
|
+
children: /* @__PURE__ */ f("button", {
|
|
678
674
|
type: "button",
|
|
679
|
-
onClick: () =>
|
|
675
|
+
onClick: () => bt(a.key),
|
|
680
676
|
className: "flexi-filter-clear",
|
|
681
677
|
children: "Clear Filter"
|
|
682
678
|
})
|
|
683
679
|
})
|
|
684
680
|
]
|
|
685
|
-
}),
|
|
681
|
+
}), U.current)
|
|
686
682
|
]
|
|
687
|
-
}),
|
|
683
|
+
}), se && /* @__PURE__ */ f("div", {
|
|
688
684
|
className: "flexi-th-resizer",
|
|
689
|
-
onMouseDown: (e) =>
|
|
685
|
+
onMouseDown: (e) => mt(e, a),
|
|
690
686
|
onClick: (e) => e.stopPropagation(),
|
|
691
687
|
onDragStart: (e) => e.preventDefault()
|
|
692
688
|
})]
|
|
693
689
|
}, a.key);
|
|
694
690
|
}),
|
|
695
|
-
i === 0 &&
|
|
696
|
-
|
|
697
|
-
className: "flexi-actions-th",
|
|
691
|
+
Ee && i === 0 && /* @__PURE__ */ f("div", {
|
|
692
|
+
className: "flexi-actions-th flexi-th",
|
|
698
693
|
style: {
|
|
699
694
|
position: "sticky",
|
|
700
695
|
top: 0,
|
|
701
696
|
right: 0,
|
|
702
|
-
zIndex:
|
|
703
|
-
|
|
697
|
+
zIndex: 55,
|
|
698
|
+
display: "flex",
|
|
699
|
+
justifyContent: "center",
|
|
700
|
+
alignItems: "center"
|
|
704
701
|
},
|
|
705
|
-
children:
|
|
702
|
+
children: Ee && zt
|
|
706
703
|
})
|
|
707
704
|
]
|
|
708
705
|
}, `header-row-${i}`))
|
|
709
706
|
}),
|
|
710
|
-
/* @__PURE__ */
|
|
707
|
+
/* @__PURE__ */ f("tbody", {
|
|
711
708
|
className: "flexi-tbody",
|
|
712
|
-
children:
|
|
709
|
+
children: me ? /* @__PURE__ */ f("tr", { children: /* @__PURE__ */ f("td", {
|
|
713
710
|
colSpan: $,
|
|
714
711
|
className: "flexi-empty-cell",
|
|
715
712
|
children: "Loading records..."
|
|
716
|
-
}) }) :
|
|
713
|
+
}) }) : X.length === 0 ? /* @__PURE__ */ f("tr", { children: /* @__PURE__ */ f("td", {
|
|
717
714
|
colSpan: $,
|
|
718
715
|
className: "flexi-empty-cell",
|
|
719
716
|
children: "No records found matching criteria."
|
|
720
|
-
}) }) : /* @__PURE__ */
|
|
721
|
-
Nt > 0 && /* @__PURE__ */
|
|
717
|
+
}) }) : /* @__PURE__ */ p(se, { children: [
|
|
718
|
+
Nt > 0 && /* @__PURE__ */ f("tr", {
|
|
722
719
|
"aria-hidden": "true",
|
|
723
720
|
style: { height: Nt },
|
|
724
|
-
children: /* @__PURE__ */
|
|
721
|
+
children: /* @__PURE__ */ f("td", {
|
|
725
722
|
colSpan: $,
|
|
726
723
|
style: {
|
|
727
724
|
padding: 0,
|
|
@@ -731,10 +728,10 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
731
728
|
})
|
|
732
729
|
}),
|
|
733
730
|
Ft.map((e, t) => Vt(e, Q + t)),
|
|
734
|
-
Pt > 0 && /* @__PURE__ */
|
|
731
|
+
Pt > 0 && /* @__PURE__ */ f("tr", {
|
|
735
732
|
"aria-hidden": "true",
|
|
736
733
|
style: { height: Pt },
|
|
737
|
-
children: /* @__PURE__ */
|
|
734
|
+
children: /* @__PURE__ */ f("td", {
|
|
738
735
|
colSpan: $,
|
|
739
736
|
style: {
|
|
740
737
|
padding: 0,
|
|
@@ -745,76 +742,76 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
745
742
|
})
|
|
746
743
|
] })
|
|
747
744
|
}),
|
|
748
|
-
|
|
745
|
+
x.length > 0 && /* @__PURE__ */ f("tbody", {
|
|
749
746
|
className: "flexi-tbody flexi-tbody--pinned-bottom",
|
|
750
|
-
children:
|
|
747
|
+
children: x.map((e, t) => Ht(e, t))
|
|
751
748
|
})
|
|
752
749
|
]
|
|
753
750
|
})
|
|
754
751
|
}),
|
|
755
752
|
Bt,
|
|
756
|
-
|
|
753
|
+
T && /* @__PURE__ */ p("div", {
|
|
757
754
|
className: "flexi-pagination",
|
|
758
755
|
children: [
|
|
759
|
-
/* @__PURE__ */
|
|
756
|
+
/* @__PURE__ */ p("div", {
|
|
760
757
|
className: "flexi-pagination-size",
|
|
761
|
-
children: [/* @__PURE__ */
|
|
762
|
-
value:
|
|
763
|
-
onChange: (e) =>
|
|
758
|
+
children: [/* @__PURE__ */ f("span", { children: "Rows per page" }), /* @__PURE__ */ f("select", {
|
|
759
|
+
value: L,
|
|
760
|
+
onChange: (e) => wt(Number(e.target.value)),
|
|
764
761
|
className: "flexi-pagination-select",
|
|
765
|
-
children:
|
|
762
|
+
children: Ae.map((e) => /* @__PURE__ */ f("option", {
|
|
766
763
|
value: e,
|
|
767
764
|
children: e
|
|
768
765
|
}, e))
|
|
769
766
|
})]
|
|
770
767
|
}),
|
|
771
|
-
/* @__PURE__ */
|
|
768
|
+
/* @__PURE__ */ f("div", {
|
|
772
769
|
className: "flexi-pagination-info",
|
|
773
|
-
children:
|
|
770
|
+
children: q === 0 ? "0 of 0" : `${(F - 1) * L + 1}–${Math.min(F * L, q)} of ${q}`
|
|
774
771
|
}),
|
|
775
|
-
/* @__PURE__ */
|
|
772
|
+
/* @__PURE__ */ p("div", {
|
|
776
773
|
className: "flexi-pagination-controls",
|
|
777
774
|
children: [
|
|
778
|
-
/* @__PURE__ */
|
|
775
|
+
/* @__PURE__ */ f("button", {
|
|
779
776
|
type: "button",
|
|
780
|
-
onClick: () =>
|
|
781
|
-
disabled:
|
|
777
|
+
onClick: () => Y(1),
|
|
778
|
+
disabled: F === 1,
|
|
782
779
|
className: "flexi-icon-btn",
|
|
783
780
|
title: "First page",
|
|
784
|
-
children: /* @__PURE__ */
|
|
781
|
+
children: /* @__PURE__ */ f(o, { className: "flexi-icon-sm" })
|
|
785
782
|
}),
|
|
786
|
-
/* @__PURE__ */
|
|
783
|
+
/* @__PURE__ */ f("button", {
|
|
787
784
|
type: "button",
|
|
788
|
-
onClick: () =>
|
|
789
|
-
disabled:
|
|
785
|
+
onClick: () => Y(F - 1),
|
|
786
|
+
disabled: F === 1,
|
|
790
787
|
className: "flexi-icon-btn",
|
|
791
788
|
title: "Previous page",
|
|
792
|
-
children: /* @__PURE__ */
|
|
789
|
+
children: /* @__PURE__ */ f(i, { className: "flexi-icon-sm" })
|
|
793
790
|
}),
|
|
794
|
-
/* @__PURE__ */
|
|
791
|
+
/* @__PURE__ */ p("span", {
|
|
795
792
|
className: "flexi-pagination-page",
|
|
796
793
|
children: [
|
|
797
794
|
"Page ",
|
|
798
|
-
|
|
795
|
+
F,
|
|
799
796
|
" of ",
|
|
800
|
-
|
|
797
|
+
J
|
|
801
798
|
]
|
|
802
799
|
}),
|
|
803
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ f("button", {
|
|
804
801
|
type: "button",
|
|
805
|
-
onClick: () =>
|
|
806
|
-
disabled:
|
|
802
|
+
onClick: () => Y(F + 1),
|
|
803
|
+
disabled: F === J,
|
|
807
804
|
className: "flexi-icon-btn",
|
|
808
805
|
title: "Next page",
|
|
809
|
-
children: /* @__PURE__ */
|
|
806
|
+
children: /* @__PURE__ */ f(a, { className: "flexi-icon-sm" })
|
|
810
807
|
}),
|
|
811
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ f("button", {
|
|
812
809
|
type: "button",
|
|
813
|
-
onClick: () =>
|
|
814
|
-
disabled:
|
|
810
|
+
onClick: () => Y(J),
|
|
811
|
+
disabled: F === J,
|
|
815
812
|
className: "flexi-icon-btn",
|
|
816
813
|
title: "Last page",
|
|
817
|
-
children: /* @__PURE__ */
|
|
814
|
+
children: /* @__PURE__ */ f(s, { className: "flexi-icon-sm" })
|
|
818
815
|
})
|
|
819
816
|
]
|
|
820
817
|
})
|
|
@@ -824,11 +821,11 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
824
821
|
});
|
|
825
822
|
function Vt(e, t) {
|
|
826
823
|
if (e.isGroupRow) {
|
|
827
|
-
let n =
|
|
828
|
-
return /* @__PURE__ */
|
|
824
|
+
let n = Be[e.path] !== !1;
|
|
825
|
+
return /* @__PURE__ */ p("tr", {
|
|
829
826
|
className: "flexi-group-row",
|
|
830
|
-
style: { height:
|
|
831
|
-
children: [/* @__PURE__ */
|
|
827
|
+
style: { height: S },
|
|
828
|
+
children: [/* @__PURE__ */ f("td", {
|
|
832
829
|
className: "flexi-group-cell",
|
|
833
830
|
style: {
|
|
834
831
|
position: "sticky",
|
|
@@ -837,35 +834,35 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
837
834
|
backgroundColor: "rgba(248, 250, 252, 0.9)",
|
|
838
835
|
paddingLeft: `${e.depth * 12 + 16}px`
|
|
839
836
|
},
|
|
840
|
-
children: /* @__PURE__ */
|
|
837
|
+
children: /* @__PURE__ */ p("button", {
|
|
841
838
|
type: "button",
|
|
842
|
-
onClick: () =>
|
|
839
|
+
onClick: () => Et(e.path),
|
|
843
840
|
className: "flexi-group-toggle",
|
|
844
841
|
children: [
|
|
845
|
-
|
|
846
|
-
/* @__PURE__ */
|
|
842
|
+
f(n ? r : a, { className: "flexi-icon-md flexi-icon-muted" }),
|
|
843
|
+
/* @__PURE__ */ f("span", {
|
|
847
844
|
className: "flexi-group-value",
|
|
848
845
|
children: e.groupValue
|
|
849
846
|
}),
|
|
850
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ f("span", {
|
|
851
848
|
className: "flexi-group-count",
|
|
852
849
|
children: e.totalItemsCount
|
|
853
850
|
})
|
|
854
851
|
]
|
|
855
852
|
})
|
|
856
|
-
}), /* @__PURE__ */
|
|
853
|
+
}), /* @__PURE__ */ f("td", {
|
|
857
854
|
colSpan: $ - 1,
|
|
858
855
|
className: "flexi-group-filler"
|
|
859
856
|
})]
|
|
860
857
|
}, `group-header-${e.path}-${t}`);
|
|
861
858
|
}
|
|
862
|
-
let n =
|
|
863
|
-
return /* @__PURE__ */
|
|
864
|
-
className:
|
|
865
|
-
style: { height:
|
|
866
|
-
onClick:
|
|
859
|
+
let n = at(e);
|
|
860
|
+
return /* @__PURE__ */ p("tr", {
|
|
861
|
+
className: h("flexi-row", Te && "flexi-row--clickable", ot(e, t)),
|
|
862
|
+
style: { height: S },
|
|
863
|
+
onClick: Te ? (n) => Te(e, t, n) : void 0,
|
|
867
864
|
children: [
|
|
868
|
-
|
|
865
|
+
y && A?.length > 0 && /* @__PURE__ */ f("td", {
|
|
869
866
|
className: "flexi-row-indent-cell",
|
|
870
867
|
style: {
|
|
871
868
|
position: "sticky",
|
|
@@ -873,46 +870,46 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
873
870
|
zIndex: 10
|
|
874
871
|
}
|
|
875
872
|
}),
|
|
876
|
-
|
|
877
|
-
let r =
|
|
873
|
+
H?.map((n) => {
|
|
874
|
+
let r = C?.includes(n.key) ? It.get(t)?.[n.key] : void 0;
|
|
878
875
|
if (r === "skip") return null;
|
|
879
|
-
let i = e[n.key], a = Lt(n.key, !1, n.style), o = !!
|
|
880
|
-
return /* @__PURE__ */
|
|
876
|
+
let i = e[n.key], a = Lt(n.key, !1, n.style), o = !!B[n.key];
|
|
877
|
+
return /* @__PURE__ */ f("td", {
|
|
881
878
|
rowSpan: typeof r == "number" ? r : void 0,
|
|
882
|
-
className:
|
|
879
|
+
className: h("flexi-cell", o && "flexi-cell--pinned", n.className),
|
|
883
880
|
style: a,
|
|
884
|
-
children: n.render ? n.render(i, e) : /* @__PURE__ */
|
|
881
|
+
children: n.render ? n.render(i, e) : /* @__PURE__ */ f("span", {
|
|
885
882
|
className: "flexi-cell-text",
|
|
886
883
|
children: i
|
|
887
884
|
})
|
|
888
885
|
}, n.key);
|
|
889
886
|
}),
|
|
890
|
-
|
|
887
|
+
v && /* @__PURE__ */ f("td", {
|
|
891
888
|
className: "flexi-actions-cell",
|
|
892
889
|
style: {
|
|
893
890
|
position: "sticky",
|
|
894
891
|
right: 0
|
|
895
892
|
},
|
|
896
|
-
children: /* @__PURE__ */
|
|
893
|
+
children: /* @__PURE__ */ f("div", {
|
|
897
894
|
className: "flexi-actions-inner",
|
|
898
|
-
children:
|
|
895
|
+
children: v(e)
|
|
899
896
|
})
|
|
900
897
|
})
|
|
901
898
|
]
|
|
902
899
|
}, n ?? `row-${t}`);
|
|
903
900
|
}
|
|
904
901
|
function Ht(e, t) {
|
|
905
|
-
let n = typeof
|
|
902
|
+
let n = typeof be == "function" ? be(e, t) : be, r = {
|
|
906
903
|
position: "sticky",
|
|
907
904
|
bottom: `${Rt[t]}px`,
|
|
908
905
|
background: "#",
|
|
909
906
|
zIndex: 45
|
|
910
907
|
};
|
|
911
|
-
return /* @__PURE__ */
|
|
912
|
-
className:
|
|
908
|
+
return /* @__PURE__ */ p("tr", {
|
|
909
|
+
className: h("flexi-row", "flexi-row--pinned-bottom", n),
|
|
913
910
|
style: r,
|
|
914
911
|
children: [
|
|
915
|
-
|
|
912
|
+
y && A?.length > 0 && /* @__PURE__ */ f("td", {
|
|
916
913
|
className: "flexi-row-indent-cell",
|
|
917
914
|
style: {
|
|
918
915
|
position: "sticky",
|
|
@@ -920,26 +917,26 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
920
917
|
zIndex: 10
|
|
921
918
|
}
|
|
922
919
|
}),
|
|
923
|
-
|
|
924
|
-
let n = e[t.key], r = Lt(t.key, !1, t.style), i = !!
|
|
925
|
-
return /* @__PURE__ */
|
|
926
|
-
className:
|
|
920
|
+
H?.map((t) => {
|
|
921
|
+
let n = e[t.key], r = Lt(t.key, !1, t.style), i = !!B[t.key], a = t.pinnedRender ?? t.render;
|
|
922
|
+
return /* @__PURE__ */ f("td", {
|
|
923
|
+
className: h("flexi-cell", i && "flexi-cell--pinned", t.className),
|
|
927
924
|
style: r,
|
|
928
|
-
children: a ? a(n, e) : /* @__PURE__ */
|
|
925
|
+
children: a ? a(n, e) : /* @__PURE__ */ f("span", {
|
|
929
926
|
className: "flexi-cell-text",
|
|
930
927
|
children: n
|
|
931
928
|
})
|
|
932
929
|
}, t.key);
|
|
933
930
|
}),
|
|
934
|
-
|
|
931
|
+
v && /* @__PURE__ */ f("td", {
|
|
935
932
|
className: "flexi-actions-cell",
|
|
936
933
|
style: {
|
|
937
934
|
position: "sticky",
|
|
938
935
|
right: 0
|
|
939
936
|
},
|
|
940
|
-
children: /* @__PURE__ */
|
|
937
|
+
children: /* @__PURE__ */ f("div", {
|
|
941
938
|
className: "flexi-actions-inner",
|
|
942
|
-
children:
|
|
939
|
+
children: v(e)
|
|
943
940
|
})
|
|
944
941
|
})
|
|
945
942
|
]
|
|
@@ -947,4 +944,4 @@ function _({ columns: _, data: v, rowKey: fe, actions: y, isLoading: pe, groupBy
|
|
|
947
944
|
}
|
|
948
945
|
}
|
|
949
946
|
//#endregion
|
|
950
|
-
export {
|
|
947
|
+
export { g as DataTable };
|