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