flexi-datagrid 1.2.5 → 1.2.7

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