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/dist/index.es.js CHANGED
@@ -1,17 +1,17 @@
1
- import { ArrowDown as e, ArrowUp as t, ArrowUpDown as n, ChevronDown as r, ChevronRight as i, Filter as a, Pin as o, PinOff as s, X as ee } from "lucide-react";
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 te } from "react-dom";
4
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
5
- //#region src/DataTable.tsx
6
- var h = (e) => {
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(...h(e.children)) : t.push(e);
9
+ e.children && e.children.length > 0 ? t.push(...m(e.children)) : t.push(e);
10
10
  }), t;
11
- }, g = (...e) => e.filter(Boolean).join(" "), ne = (e) => {
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
- }, re = (e, t, n) => {
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
- }, ie = 48, ae = 150, oe = 60;
30
- function _({ columns: _, data: v, rowKey: y, actions: b, isLoading: se, groupBy: x = !1, defaultGroupBy: ce = [], onPinChange: le, onGroupChange: S, containerStyle: ue, tableStyle: de, bordered: fe = !1, pinnedBottomRowData: C = [], pinnedRowClassName: pe, rowHeight: w = ie, overscan: me = 8, onColumnResize: he, onColumnReorder: ge, rowClassRules: _e, onRowClick: T }) {
31
- let [E, ve] = d(null), [D, ye] = d({}), [O, k] = d(""), [A, be] = d(null), j = u(/* @__PURE__ */ new Map()), [M, xe] = d(ce), [N, Se] = d({}), [Ce, P] = d(!1), [F, we] = d({
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
- }), [I, Te] = d({}), [L, Ee] = d({}), R = u(null), z = u(!1), B = u(null), V = l(() => h(_), [_]), [H, De] = d(() => {
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 V.forEach((t) => {
37
- let n = ne(t.pinned);
41
+ return z.forEach((t) => {
42
+ let n = ce(t.pinned);
38
43
  n && (e[t.key] = n);
39
44
  }), e;
40
- }), U = l(() => re(_, H, L), [
41
- _,
42
- H,
43
- L
44
- ]), W = l(() => {
45
- let e = h(U), t = x ? M : [];
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
- U,
49
- M,
50
- x
51
- ]), G = u(null), K = u(null);
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 = E ? j.current.get(E) : null;
55
- K.current && !K.current.contains(t) && !(n && n.contains(t)) && (ve(null), k(""));
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
- }, [E]), c(() => {
59
- if (!E) return;
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 = j.current.get(E), t = G.current;
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
- be({
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
- }, [E]);
73
- let Oe = (e) => typeof y == "function" ? y(e) : String(e[y]), ke = (e, t) => {
74
- if (!_e) return;
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 _e) _e[r](e, t) && (n = n ? `${n} ${r}` : r);
103
+ for (let r in we) we[r](e, t) && (n = n ? `${n} ${r}` : r);
77
104
  return n;
78
- }, Ae = (e) => {
79
- De((t) => {
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], le && le(e, !!r, r), i;
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
- }, je = (e) => {
115
+ }, lt = () => {
116
+ Xe(De), Ze(Oe), w && w(Oe);
117
+ }, ut = (e) => {
84
118
  let t = "asc";
85
- F.key === e && (t = F.direction === "asc" ? "desc" : F.direction === "desc" ? null : "asc"), we({
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
- }, Me = (e, t, n) => {
90
- if (z.current) {
123
+ }, dt = (e, t, n) => {
124
+ if (nt.current) {
91
125
  e.preventDefault();
92
126
  return;
93
127
  }
94
- R.current = t, n && e.dataTransfer.setData("text/plain", t), e.dataTransfer.effectAllowed = "move";
95
- }, Ne = (e, t, n) => {
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 = Ne(r.children, t, n);
133
+ let e = ft(r.children, t, n);
100
134
  if (e) return e;
101
135
  }
102
136
  return null;
103
- }, Pe = (e, t) => {
137
+ }, pt = (e, t) => {
104
138
  e.preventDefault(), e.stopPropagation();
105
- let n = R.current;
106
- if (R.current = null, !n || n === t) return;
107
- let r = Ne(U, n, t);
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 = { ...L };
145
+ let s = { ...qe };
112
146
  i.forEach((e, t) => {
113
147
  s[e] = t;
114
- }), Ee(s), ge && ge(h(re(_, H, s)).map((e) => e.key));
115
- }, Fe = (e, t) => {
116
- e.preventDefault(), e.stopPropagation(), z.current = !0, B.current = {
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: J(t)
153
+ startWidth: W(t)
120
154
  };
121
- let n = t.minWidth ?? oe, r = t.maxWidth, i = (e) => {
122
- let t = B.current;
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)), Te((e) => e[t.key] === i ? e : {
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 = B.current;
131
- B.current = null, window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", a), requestAnimationFrame(() => {
132
- z.current = !1;
133
- }), e && he && Te((t) => (t[e.key] !== void 0 && he(e.key, t[e.key]), t));
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
- }, Ie = (e) => {
137
- e.preventDefault(), P(!1);
170
+ }, ht = (e) => {
171
+ e.preventDefault(), Ue(!1);
138
172
  let t = e.dataTransfer.getData("text/plain");
139
- if (t && !M.includes(t)) {
140
- let e = [...M, t];
141
- xe(e), S && S(e);
173
+ if (t && !A.includes(t)) {
174
+ let e = [...A, t];
175
+ ze(e), b && b(e);
142
176
  }
143
- }, Le = (e) => {
144
- let t = M.filter((t) => t !== e);
145
- xe(t), Se({}), S && S(t);
146
- }, q = l(() => {
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(U), n = Array.from({ length: t }, () => []), r = (e) => !e.children || e.children.length === 0 ? M.includes(e.key) && x ? 0 : 1 : e.children.reduce((e, t) => e + r(t), 0), i = x ? M : [], a = (e, o) => {
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(U, 0), n.filter((e) => e.length > 0);
201
+ return a(V, 0), n.filter((e) => e.length > 0);
168
202
  }, [
169
- U,
170
- M,
171
- x
172
- ]), J = (e) => {
173
- if (I[e.key] !== void 0) return I[e.key];
174
- let t = e.style?.width || e.headerStyle?.width || `${ae}px`;
175
- return typeof t == "number" ? t : parseInt(String(t), 10) || ae;
176
- }, Re = l(() => {
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
- x && M.length > 0 && (t += 48), W.forEach((n) => {
179
- H[n.key] === "left" && (e[n.key] = {
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 += J(n));
217
+ }, t += W(n));
183
218
  });
184
- let n = b ? 100 : 0;
185
- for (let t = W.length - 1; t >= 0; t--) {
186
- let r = W[t];
187
- H[r.key] === "right" && (e[r.key] = {
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 += J(r));
225
+ }, n += W(r));
191
226
  }
192
227
  return e;
193
228
  }, [
194
- W,
195
229
  H,
196
- M,
197
- x,
198
- b,
199
- I
200
- ]), ze = (e, t) => {
201
- ye((n) => {
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
- }, Be = (e) => {
209
- ye((t) => {
243
+ }, bt = (e) => {
244
+ Me((t) => {
210
245
  let n = { ...t };
211
246
  return delete n[e], n;
212
247
  });
213
- }, Y = l(() => {
248
+ }, G = l(() => {
214
249
  let e = /* @__PURE__ */ new Map();
215
- return V.forEach((t) => e.set(t.key, t)), e;
216
- }, [V]), Ve = l(() => {
217
- if (!E) return [];
218
- let e = Y.get(E), t = v.map((t) => e?.getValue ? e.getValue(t) : t[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
- v,
222
- E,
223
- Y
224
- ]), He = l(() => {
225
- if (!O.trim()) return Ve;
226
- let e = O.toLowerCase();
227
- return Ve.filter((t) => String(t).toLowerCase().includes(e));
228
- }, [Ve, O]), Ue = l(() => {
229
- let e = Object.entries(D).filter(([, e]) => e && e.length > 0), t = e.length === 0 ? v : v.filter((t) => e.every(([e, n]) => {
230
- let r = Y.get(e), i = r?.getValue ? r.getValue(t) : t[e];
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 (F.key && F.direction) {
234
- let { key: e, direction: n } = F, r = Y.get(e);
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
- v,
250
- D,
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
- Y
253
- ]), We = l(() => {
254
- if (!x || M.length === 0) return Ue;
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 >= M.length) return t;
257
- let i = M[n], a = Y.get(i), o = {};
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).map(([t, a]) => {
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(Ue, 0);
337
+ return e(Ct, 0);
275
338
  }, [
276
- Ue,
277
- M,
278
- x,
279
- Y
280
- ]), Ge = (e) => {
281
- Se((t) => {
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 (!x || M.length === 0) return We;
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), N[n.path] !== !1 && t(n.children)) : 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(We), e;
358
+ return t(Tt), e;
296
359
  }, [
297
- We,
298
- N,
299
- M,
300
- x
301
- ]), Ke = u(null), [qe, Je] = d(0), [Ye, Xe] = d(0);
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 = Ke.current;
366
+ let e = Dt.current;
304
367
  if (!e) return;
305
- let t = () => Je(e.scrollTop);
306
- Xe(e.clientHeight), Je(e.scrollTop), e.addEventListener("scroll", t, { passive: !0 });
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(() => Xe(e.clientHeight)), n.observe(e)), () => {
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: Ze, endIndex: Qe, topSpacerHeight: Q, bottomSpacerHeight: $e } = l(() => {
313
- if (Ye === 0) return {
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(qe / w), t = Math.ceil(Ye / w), n = Math.max(0, e - me), r = Math.min(Z, e + t + me);
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: n,
322
- endIndex: r,
323
- topSpacerHeight: n * w,
324
- bottomSpacerHeight: (Z - r) * w
384
+ startIndex: r,
385
+ endIndex: i,
386
+ topSpacerHeight: r * S,
387
+ bottomSpacerHeight: (Z - i) * S
325
388
  };
326
389
  }, [
327
- qe,
328
- Ye,
390
+ Ot,
391
+ At,
329
392
  Z,
330
- w,
331
- me
332
- ]), et = l(() => X.slice(Ze, Qe), [
393
+ S,
394
+ xe
395
+ ]), Ft = l(() => X.slice(Q, Mt), [
333
396
  X,
334
- Ze,
335
- Qe
336
- ]), tt = (e, t = !1, n) => {
337
- let r = Re[e];
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
- }, nt = l(() => C.map((e, t) => (C.length - 1 - t) * 48), [C]), $ = W.length + +!!b + (x && M.length > 0 ? 1 : 0);
350
- return /* @__PURE__ */ m("div", {
351
- ref: G,
352
- className: "flexi-root",
353
- children: [x && /* @__PURE__ */ p("div", {
354
- onDragOver: (e) => {
355
- e.preventDefault(), P(!0);
356
- },
357
- onDragLeave: () => P(!1),
358
- onDrop: Ie,
359
- className: g("flexi-groupzone", Ce && "flexi-groupzone--dragover"),
360
- children: M.length === 0 ? /* @__PURE__ */ p("span", {
361
- className: "flexi-groupzone-hint",
362
- children: "Drag a column header here to group your records by that field"
363
- }) : /* @__PURE__ */ m("div", {
364
- className: "flexi-groupzone-chips",
365
- children: [/* @__PURE__ */ p("span", {
366
- className: "flexi-groupzone-label",
367
- children: "Grouped By:"
368
- }), M.map((e) => /* @__PURE__ */ m("div", {
369
- className: "flexi-chip",
370
- children: [/* @__PURE__ */ p("span", { children: V.find((t) => t.key === e)?.header || e }), /* @__PURE__ */ p("button", {
371
- type: "button",
372
- onClick: () => Le(e),
373
- className: "flexi-icon-btn flexi-chip-remove",
374
- children: /* @__PURE__ */ p(ee, { className: "flexi-icon-xs" })
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
- }), /* @__PURE__ */ p("div", {
379
- ref: Ke,
380
- className: "flexi-table-wrap",
381
- style: ue,
382
- children: /* @__PURE__ */ m("table", {
383
- className: g("flexi-table", fe && "flexi-table--bordered"),
384
- style: de,
385
- children: [
386
- /* @__PURE__ */ m("colgroup", { children: [
387
- x && M.length > 0 && /* @__PURE__ */ p("col", { style: { width: "48px" } }),
388
- W.map((e) => /* @__PURE__ */ p("col", { style: {
389
- ...e.style,
390
- width: J(e)
391
- } }, e.key)),
392
- b && /* @__PURE__ */ p("col", { style: { width: "100px" } })
393
- ] }),
394
- /* @__PURE__ */ p("thead", {
395
- className: "flexi-thead",
396
- children: q.map((r, i) => /* @__PURE__ */ m("tr", {
397
- className: "flexi-header-row",
398
- children: [
399
- i === 0 && x && M.length > 0 && /* @__PURE__ */ p("th", {
400
- rowSpan: q.length,
401
- className: "flexi-group-spacer-th",
402
- style: {
403
- position: "sticky",
404
- top: 0,
405
- left: 0,
406
- zIndex: 35,
407
- backgroundColor: "rgb(248, 250, 252)"
408
- }
409
- }),
410
- r.map(({ col: r, rowSpan: i, colSpan: ee }) => {
411
- let c = (D[r.key]?.length || 0) > 0, l = !!H[r.key], u = tt(r.key, !0, r.headerStyle), d = !r.children || r.children.length === 0, f = F.key === r.key, h = !!(x && d), ne = d && r.resizable !== !1;
412
- return /* @__PURE__ */ m("th", {
413
- rowSpan: i,
414
- colSpan: ee,
415
- draggable: !0,
416
- onDragStart: (e) => Me(e, r.key, d),
417
- onDragOver: (e) => e.preventDefault(),
418
- onDrop: (e) => Pe(e, r.key),
419
- className: g("flexi-th", "flexi-th--draggable", h && "flexi-th--group-draggable", l && "flexi-th--pinned", r.className, r.headerClassName),
420
- style: u,
421
- children: [/* @__PURE__ */ m("div", {
422
- className: "flexi-th-inner",
423
- children: [
424
- /* @__PURE__ */ m("div", {
425
- className: g("flexi-th-label", r.sortable && d && "flexi-th-label--sortable"),
426
- onClick: () => r.sortable && d && je(r.key),
427
- children: [/* @__PURE__ */ p("span", {
428
- className: "flexi-th-text",
429
- children: r.header
430
- }), d && r.sortable && /* @__PURE__ */ p("span", {
431
- className: g("flexi-sort-icon", f && "flexi-sort-icon--active"),
432
- children: f && F.direction === "asc" ? /* @__PURE__ */ p(t, { className: "flexi-icon-sm" }) : f && F.direction === "desc" ? /* @__PURE__ */ p(e, { className: "flexi-icon-sm" }) : /* @__PURE__ */ p(n, { className: "flexi-icon-sm" })
433
- })]
434
- }),
435
- /* @__PURE__ */ m("div", {
436
- className: "flexi-th-actions",
437
- children: [d && r.filterable && /* @__PURE__ */ p("button", {
438
- type: "button",
439
- ref: (e) => {
440
- e ? j.current.set(r.key, e) : j.current.delete(r.key);
441
- },
442
- onClick: (e) => {
443
- e.stopPropagation(), k(""), ve(E === r.key ? null : r.key);
444
- },
445
- className: g("flexi-icon-btn", "flexi-filter-btn", c && "flexi-filter-btn--active"),
446
- children: /* @__PURE__ */ p(a, { className: "flexi-icon-sm" })
447
- }), d && /* @__PURE__ */ p("button", {
448
- type: "button",
449
- onClick: (e) => {
450
- e.stopPropagation(), Ae(r.key);
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
- className: g("flexi-icon-btn", "flexi-pin-btn", l && "flexi-pin-btn--pinned"),
453
- title: H[r.key] === "left" ? "Pinned left (click to pin right)" : H[r.key] === "right" ? "Pinned right (click to unpin)" : "Pin column left",
454
- children: p(l ? s : o, { className: "flexi-icon-sm" })
455
- })]
456
- }),
457
- E === r.key && d && A && G.current && te(/* @__PURE__ */ m("div", {
458
- ref: K,
459
- className: "flexi-filter-dropdown",
460
- style: {
461
- top: A.top,
462
- left: A.left,
463
- zIndex: 9999
464
- },
465
- children: [
466
- /* @__PURE__ */ p("div", {
467
- className: "flexi-filter-search",
468
- children: /* @__PURE__ */ p("input", {
469
- type: "text",
470
- placeholder: "Search values...",
471
- value: O,
472
- onChange: (e) => k(e.target.value),
473
- className: "flexi-input",
474
- onClick: (e) => e.stopPropagation()
475
- })
476
- }),
477
- /* @__PURE__ */ p("div", {
478
- className: "flexi-filter-list",
479
- children: He.length === 0 ? /* @__PURE__ */ p("div", {
480
- className: "flexi-filter-empty",
481
- children: "No results found"
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", {
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
- }), G.current)
506
- ]
507
- }), ne && /* @__PURE__ */ p("div", {
508
- className: "flexi-th-resizer",
509
- onMouseDown: (e) => Fe(e, r),
510
- onClick: (e) => e.stopPropagation(),
511
- onDragStart: (e) => e.preventDefault()
512
- })]
513
- }, r.key);
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
- i === 0 && b && /* @__PURE__ */ p("th", {
516
- rowSpan: q.length,
517
- className: "flexi-actions-th",
518
- style: {
519
- position: "sticky",
520
- top: 0,
521
- right: 0,
522
- zIndex: 35,
523
- backgroundColor: "rgb(248, 250, 252)"
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
- }, `header-row-${i}`))
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__ */ p("tbody", {
530
- className: "flexi-tbody",
531
- children: se ? /* @__PURE__ */ p("tr", { children: /* @__PURE__ */ p("td", {
532
- colSpan: $,
533
- className: "flexi-empty-cell",
534
- children: "Loading records..."
535
- }) }) : X.length === 0 ? /* @__PURE__ */ p("tr", { children: /* @__PURE__ */ p("td", {
536
- colSpan: $,
537
- className: "flexi-empty-cell",
538
- children: "No records found matching criteria."
539
- }) }) : /* @__PURE__ */ m(f, { children: [
540
- Q > 0 && /* @__PURE__ */ p("tr", {
541
- "aria-hidden": "true",
542
- style: { height: Q },
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
- et.map((e, t) => rt(e, Ze + t)),
553
- $e > 0 && /* @__PURE__ */ p("tr", {
554
- "aria-hidden": "true",
555
- style: { height: $e },
556
- children: /* @__PURE__ */ p("td", {
557
- colSpan: $,
558
- style: {
559
- padding: 0,
560
- border: "none",
561
- height: $e
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 rt(e, t) {
822
+ function Vt(e, t) {
576
823
  if (e.isGroupRow) {
577
- let n = N[e.path] !== !1;
578
- return /* @__PURE__ */ m("tr", {
824
+ let n = Be[e.path] !== !1;
825
+ return /* @__PURE__ */ p("tr", {
579
826
  className: "flexi-group-row",
580
- children: [/* @__PURE__ */ p("td", {
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__ */ m("button", {
837
+ children: /* @__PURE__ */ p("button", {
590
838
  type: "button",
591
- onClick: () => Ge(e.path),
839
+ onClick: () => Et(e.path),
592
840
  className: "flexi-group-toggle",
593
841
  children: [
594
- p(n ? r : i, { className: "flexi-icon-md flexi-icon-muted" }),
595
- /* @__PURE__ */ p("span", {
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__ */ p("span", {
847
+ /* @__PURE__ */ f("span", {
600
848
  className: "flexi-group-count",
601
849
  children: e.totalItemsCount
602
850
  })
603
851
  ]
604
852
  })
605
- }), /* @__PURE__ */ p("td", {
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 = Oe(e);
612
- return /* @__PURE__ */ m("tr", {
613
- className: g("flexi-row", T && "flexi-row--clickable", ke(e, t)),
614
- onClick: T ? (n) => T(e, t, n) : void 0,
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
- x && M?.length > 0 && /* @__PURE__ */ p("td", {
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
- W?.map((t) => {
625
- let n = e[t.key], r = tt(t.key, !1, t.style);
626
- return /* @__PURE__ */ p("td", {
627
- className: g("flexi-cell", !!H[t.key] && "flexi-cell--pinned", t.className),
628
- style: r,
629
- children: t.render ? t.render(n, e) : /* @__PURE__ */ p("span", {
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: n
883
+ children: i
632
884
  })
633
- }, t.key);
885
+ }, n.key);
634
886
  }),
635
- b && /* @__PURE__ */ p("td", {
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__ */ p("div", {
893
+ children: /* @__PURE__ */ f("div", {
642
894
  className: "flexi-actions-inner",
643
- children: b(e)
895
+ children: v(e)
644
896
  })
645
897
  })
646
898
  ]
647
899
  }, n ?? `row-${t}`);
648
900
  }
649
- function it(e, t) {
650
- let n = typeof pe == "function" ? pe(e, t) : pe, r = {
901
+ function Ht(e, t) {
902
+ let n = typeof be == "function" ? be(e, t) : be, r = {
651
903
  position: "sticky",
652
- bottom: `${nt[t]}px`,
904
+ bottom: `${Rt[t]}px`,
653
905
  background: "#",
654
906
  zIndex: 45
655
907
  };
656
- return /* @__PURE__ */ m("tr", {
657
- className: g("flexi-row", "flexi-row--pinned-bottom", n),
908
+ return /* @__PURE__ */ p("tr", {
909
+ className: h("flexi-row", "flexi-row--pinned-bottom", n),
658
910
  style: r,
659
911
  children: [
660
- x && M?.length > 0 && /* @__PURE__ */ p("td", {
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
- W?.map((t) => {
669
- let n = e[t.key], r = tt(t.key, !1, t.style), i = !!H[t.key], a = t.pinnedRender ?? t.render;
670
- return /* @__PURE__ */ p("td", {
671
- className: g("flexi-cell", i && "flexi-cell--pinned", t.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__ */ p("span", {
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
- b && /* @__PURE__ */ p("td", {
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__ */ p("div", {
937
+ children: /* @__PURE__ */ f("div", {
686
938
  className: "flexi-actions-inner",
687
- children: b(e)
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 { _ as DataTable };
947
+ export { g as DataTable };