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