react-gridix 0.2.1 → 0.2.3

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.
@@ -1,9 +1,9 @@
1
- import { jsxs as D, jsx as d, Fragment as je } from "react/jsx-runtime";
2
- import { useState as R, useRef as $, useEffect as U, useMemo as ae, useCallback as _e, useLayoutEffect as On, createElement as Te } from "react";
3
- import { createPortal as Kn } from "react-dom";
4
- const Be = (...r) => r.filter(Boolean).join(" ");
5
- function Rn() {
6
- return /* @__PURE__ */ d("svg", { viewBox: "0 0 16 16", width: "100%", height: "100%", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ d(
1
+ import { jsxs as M, jsx as u, Fragment as qe } from "react/jsx-runtime";
2
+ import { useState as R, useRef as A, useEffect as V, useMemo as se, useCallback as be, useLayoutEffect as Rn, createElement as Fe } from "react";
3
+ import { createPortal as Bn } from "react-dom";
4
+ const Ye = (...r) => r.filter(Boolean).join(" ");
5
+ function Yn() {
6
+ return /* @__PURE__ */ u("svg", { viewBox: "0 0 16 16", width: "100%", height: "100%", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ u(
7
7
  "path",
8
8
  {
9
9
  d: "M3.5 8.5l3 3 6-7",
@@ -15,322 +15,322 @@ function Rn() {
15
15
  }
16
16
  ) });
17
17
  }
18
- function Bn() {
19
- return /* @__PURE__ */ d("svg", { viewBox: "0 0 16 16", width: "100%", height: "100%", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ d("path", { d: "M4 8h8", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round" }) });
18
+ function Wn() {
19
+ return /* @__PURE__ */ u("svg", { viewBox: "0 0 16 16", width: "100%", height: "100%", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ u("path", { d: "M4 8h8", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round" }) });
20
20
  }
21
- function Fe({
21
+ function Se({
22
22
  checked: r,
23
23
  onChange: n,
24
24
  indeterminate: c = !1,
25
25
  variant: a = "native",
26
26
  disabled: g = !1,
27
27
  label: f,
28
- "aria-label": u,
28
+ "aria-label": d,
29
29
  id: k,
30
30
  name: y,
31
- indicator: E,
32
- className: T,
33
- style: w,
34
- classNames: v = {},
31
+ indicator: F,
32
+ className: S,
33
+ style: D,
34
+ classNames: x = {},
35
35
  styles: _ = {}
36
36
  }) {
37
- const C = c ? "indeterminate" : r ? "checked" : "unchecked";
38
- return /* @__PURE__ */ D(
37
+ const $ = c ? "indeterminate" : r ? "checked" : "unchecked";
38
+ return /* @__PURE__ */ M(
39
39
  "label",
40
40
  {
41
- className: Be(
41
+ className: Ye(
42
42
  "rg-checkbox",
43
43
  `rg-checkbox--${a}`,
44
- C === "checked" && "rg-checkbox--checked",
44
+ $ === "checked" && "rg-checkbox--checked",
45
45
  c && "rg-checkbox--indeterminate",
46
46
  g && "rg-checkbox--disabled",
47
- v.root,
48
- T
47
+ x.root,
48
+ S
49
49
  ),
50
- style: { ..._.root, ...w },
51
- "data-state": C,
50
+ style: { ..._.root, ...D },
51
+ "data-state": $,
52
52
  children: [
53
- a === "native" ? /* @__PURE__ */ d(
53
+ a === "native" ? /* @__PURE__ */ u(
54
54
  "input",
55
55
  {
56
56
  type: "checkbox",
57
57
  id: k,
58
58
  name: y,
59
- ref: (P) => {
60
- P && (P.indeterminate = c);
59
+ ref: (v) => {
60
+ v && (v.indeterminate = c);
61
61
  },
62
- className: Be("rg-checkbox__control", v.control),
62
+ className: Ye("rg-checkbox__control", x.control),
63
63
  style: _.control,
64
64
  checked: r,
65
65
  disabled: g,
66
- "aria-label": u,
67
- "data-state": C,
68
- onChange: (P) => n(P.target.checked)
66
+ "aria-label": d,
67
+ "data-state": $,
68
+ onChange: (v) => n(v.target.checked)
69
69
  }
70
- ) : /* @__PURE__ */ d(
70
+ ) : /* @__PURE__ */ u(
71
71
  "button",
72
72
  {
73
73
  type: "button",
74
74
  role: "checkbox",
75
75
  id: k,
76
- className: Be("rg-checkbox__control", v.control),
76
+ className: Ye("rg-checkbox__control", x.control),
77
77
  style: _.control,
78
78
  "aria-checked": c ? "mixed" : r,
79
- "aria-label": u,
79
+ "aria-label": d,
80
80
  disabled: g,
81
- "data-state": C,
81
+ "data-state": $,
82
82
  onClick: () => n(!r),
83
- children: /* @__PURE__ */ d(
83
+ children: /* @__PURE__ */ u(
84
84
  "span",
85
85
  {
86
- className: Be(
86
+ className: Ye(
87
87
  "rg-checkbox__indicator",
88
- E !== void 0 && !c && "rg-checkbox__indicator--custom",
89
- v.indicator
88
+ F !== void 0 && !c && "rg-checkbox__indicator--custom",
89
+ x.indicator
90
90
  ),
91
91
  style: _.indicator,
92
- "data-state": C,
92
+ "data-state": $,
93
93
  "aria-hidden": "true",
94
- children: c ? a === "tick" ? /* @__PURE__ */ d(Bn, {}) : null : E !== void 0 ? E : a === "tick" ? /* @__PURE__ */ d(Rn, {}) : null
94
+ children: c ? a === "tick" ? /* @__PURE__ */ u(Wn, {}) : null : F !== void 0 ? F : a === "tick" ? /* @__PURE__ */ u(Yn, {}) : null
95
95
  }
96
96
  )
97
97
  }
98
98
  ),
99
- f != null && f !== !1 && f !== "" && /* @__PURE__ */ d("span", { className: Be("rg-checkbox__label", v.label), style: _.label, children: f })
99
+ f != null && f !== !1 && f !== "" && /* @__PURE__ */ u("span", { className: Ye("rg-checkbox__label", x.label), style: _.label, children: f })
100
100
  ]
101
101
  }
102
102
  );
103
103
  }
104
- const Yn = /^(\d{4})-(\d{2})-(\d{2})$/, Fr = (r) => String(r).padStart(2, "0");
105
- function J(r) {
106
- const n = Yn.exec(r);
104
+ const jn = /^(\d{4})-(\d{2})-(\d{2})$/, Sr = (r) => String(r).padStart(2, "0");
105
+ function z(r) {
106
+ const n = jn.exec(r);
107
107
  if (!n) return null;
108
108
  const [c, a, g] = [Number(n[1]), Number(n[2]), Number(n[3])], f = new Date(c, a - 1, g);
109
109
  return f.getFullYear() === c && f.getMonth() === a - 1 && f.getDate() === g ? f : null;
110
110
  }
111
- function Z(r) {
111
+ function X(r) {
112
112
  var n;
113
113
  if (r instanceof Date)
114
- return Number.isNaN(r.getTime()) ? null : `${r.getFullYear()}-${Fr(r.getMonth() + 1)}-${Fr(r.getDate())}`;
115
- if (typeof r == "number") return Number.isFinite(r) ? Z(new Date(r)) : null;
114
+ return Number.isNaN(r.getTime()) ? null : `${r.getFullYear()}-${Sr(r.getMonth() + 1)}-${Sr(r.getDate())}`;
115
+ if (typeof r == "number") return Number.isFinite(r) ? X(new Date(r)) : null;
116
116
  if (typeof r == "string") {
117
117
  const c = r.trim();
118
118
  if (c === "") return null;
119
119
  const a = (n = /^\d{4}-\d{2}-\d{2}/.exec(c)) == null ? void 0 : n[0];
120
- if (a) return J(a) ? a : null;
120
+ if (a) return z(a) ? a : null;
121
121
  const g = Date.parse(c);
122
- return Number.isNaN(g) ? null : Z(new Date(g));
122
+ return Number.isNaN(g) ? null : X(new Date(g));
123
123
  }
124
124
  return null;
125
125
  }
126
- function Wn(r, n, c) {
127
- const a = Z(r);
128
- return a ? J(a).toLocaleDateString(n, c ?? { year: "numeric", month: "short", day: "numeric" }) : r == null ? "" : String(r);
126
+ function qn(r, n, c) {
127
+ const a = X(r);
128
+ return a ? z(a).toLocaleDateString(n, c ?? { year: "numeric", month: "short", day: "numeric" }) : r == null ? "" : String(r);
129
129
  }
130
- function jn(r, n) {
130
+ function Un(r, n) {
131
131
  var c;
132
- return r === "" ? null : n instanceof Date ? J(r) : typeof n == "number" ? ((c = J(r)) == null ? void 0 : c.getTime()) ?? null : r;
132
+ return r === "" ? null : n instanceof Date ? z(r) : typeof n == "number" ? ((c = z(r)) == null ? void 0 : c.getTime()) ?? null : r;
133
133
  }
134
- const O = (...r) => r.filter(Boolean).join(" "), _t = (r) => r.headerName ?? (r.type === "boolean" ? "" : r.type === "sequence" ? "#" : r.field), ke = (r) => _t(r) || r.field, Sr = (r) => String(r).padStart(2, "0"), qt = (r, n, c) => `${r}-${Sr(n + 1)}-${Sr(c)}`;
135
- function Ir(r, n, c, a) {
136
- const g = [r, n == null ? void 0 : n.from, n == null ? void 0 : n.to].map((y) => y ? J(y) : null).find(Boolean);
134
+ const O = (...r) => r.filter(Boolean).join(" "), yt = (r) => r.headerName ?? (r.type === "boolean" ? "" : r.type === "sequence" ? "#" : r.field), we = (r) => yt(r) || r.field, Ir = (r) => String(r).padStart(2, "0"), qt = (r, n, c) => `${r}-${Ir(n + 1)}-${Ir(c)}`;
135
+ function Lr(r, n, c, a) {
136
+ const g = [r, n == null ? void 0 : n.from, n == null ? void 0 : n.to].map((y) => y ? z(y) : null).find(Boolean);
137
137
  if (g) return new Date(g.getFullYear(), g.getMonth(), 1);
138
138
  const f = /* @__PURE__ */ new Date();
139
- let u = Z(f);
140
- c && u < c && (u = c), a && u > a && (u = a);
141
- const k = J(u) ?? f;
139
+ let d = X(f);
140
+ c && d < c && (d = c), a && d > a && (d = a);
141
+ const k = z(d) ?? f;
142
142
  return new Date(k.getFullYear(), k.getMonth(), 1);
143
143
  }
144
- function Kr({ value: r, range: n, min: c, max: a, onPick: g, locale: f, weekStart: u = 0, hideFooter: k, keepFocus: y, className: E }) {
145
- var Ve;
146
- const [T, w] = R(() => Ir(r, n, c, a)), [v, _] = R(null), C = $(null), P = $({ value: r, from: n == null ? void 0 : n.from, to: n == null ? void 0 : n.to });
147
- U(() => {
148
- const b = P.current;
149
- P.current = { value: r, from: n == null ? void 0 : n.from, to: n == null ? void 0 : n.to };
150
- const j = r !== b.value ? r : (n == null ? void 0 : n.from) !== b.from ? n == null ? void 0 : n.from : (n == null ? void 0 : n.to) !== b.to ? n == null ? void 0 : n.to : void 0, I = j ? J(j) : null;
151
- I && w((K) => K.getFullYear() === I.getFullYear() && K.getMonth() === I.getMonth() ? K : new Date(I.getFullYear(), I.getMonth(), 1));
144
+ function Rr({ value: r, range: n, min: c, max: a, onPick: g, locale: f, weekStart: d = 0, hideFooter: k, keepFocus: y, className: F }) {
145
+ var ke;
146
+ const [S, D] = R(() => Lr(r, n, c, a)), [x, _] = R(null), $ = A(null), v = A({ value: r, from: n == null ? void 0 : n.from, to: n == null ? void 0 : n.to });
147
+ V(() => {
148
+ const m = v.current;
149
+ v.current = { value: r, from: n == null ? void 0 : n.from, to: n == null ? void 0 : n.to };
150
+ const q = r !== m.value ? r : (n == null ? void 0 : n.from) !== m.from ? n == null ? void 0 : n.from : (n == null ? void 0 : n.to) !== m.to ? n == null ? void 0 : n.to : void 0, I = q ? z(q) : null;
151
+ I && D((P) => P.getFullYear() === I.getFullYear() && P.getMonth() === I.getMonth() ? P : new Date(I.getFullYear(), I.getMonth(), 1));
152
152
  }, [r, n == null ? void 0 : n.from, n == null ? void 0 : n.to]);
153
- const F = Z(/* @__PURE__ */ new Date()), N = T.getFullYear(), S = T.getMonth(), re = ae(() => {
154
- const b = new Intl.DateTimeFormat(f, { weekday: "short" });
155
- return Array.from({ length: 7 }, (j, I) => b.format(new Date(2023, 0, 1 + (I + u) % 7)));
156
- }, [f, u]), ue = new Intl.DateTimeFormat(f, { month: "long", year: "numeric" }).format(T), X = ae(() => {
157
- const b = (new Date(N, S, 1).getDay() - u + 7) % 7;
158
- return Array.from({ length: 42 }, (j, I) => {
159
- const K = new Date(N, S, 1 - b + I);
160
- return { iso: qt(K.getFullYear(), K.getMonth(), K.getDate()), day: K.getDate(), outside: K.getMonth() !== S };
153
+ const T = X(/* @__PURE__ */ new Date()), N = S.getFullYear(), C = S.getMonth(), G = se(() => {
154
+ const m = new Intl.DateTimeFormat(f, { weekday: "short" });
155
+ return Array.from({ length: 7 }, (q, I) => m.format(new Date(2023, 0, 1 + (I + d) % 7)));
156
+ }, [f, d]), oe = new Intl.DateTimeFormat(f, { month: "long", year: "numeric" }).format(S), W = se(() => {
157
+ const m = (new Date(N, C, 1).getDay() - d + 7) % 7;
158
+ return Array.from({ length: 42 }, (q, I) => {
159
+ const P = new Date(N, C, 1 - m + I);
160
+ return { iso: qt(P.getFullYear(), P.getMonth(), P.getDate()), day: P.getDate(), outside: P.getMonth() !== C };
161
161
  });
162
- }, [N, S, u]), V = (b) => !!c && b < c || !!a && b > a, ce = (b) => w(new Date(N, S + b, 1)), qe = (b) => {
163
- const j = J(b);
164
- j && ((j.getFullYear() !== N || j.getMonth() !== S) && w(new Date(j.getFullYear(), j.getMonth(), 1)), _(b), requestAnimationFrame(() => {
165
- var I, K;
166
- return (K = (I = C.current) == null ? void 0 : I.querySelector(`[data-iso="${b}"]`)) == null ? void 0 : K.focus();
162
+ }, [N, C, d]), U = (m) => !!c && m < c || !!a && m > a, ae = (m) => D(new Date(N, C + m, 1)), Ue = (m) => {
163
+ const q = z(m);
164
+ q && ((q.getFullYear() !== N || q.getMonth() !== C) && D(new Date(q.getFullYear(), q.getMonth(), 1)), _(m), requestAnimationFrame(() => {
165
+ var I, P;
166
+ return (P = (I = $.current) == null ? void 0 : I.querySelector(`[data-iso="${m}"]`)) == null ? void 0 : P.focus();
167
167
  }));
168
- }, Se = (b, j) => {
169
- const I = J(j), K = (le) => {
170
- b.preventDefault(), qe(qt(I.getFullYear(), I.getMonth(), I.getDate() + le));
168
+ }, Ve = (m, q) => {
169
+ const I = z(q), P = (ie) => {
170
+ m.preventDefault(), Ue(qt(I.getFullYear(), I.getMonth(), I.getDate() + ie));
171
171
  };
172
- switch (b.key) {
172
+ switch (m.key) {
173
173
  case "ArrowLeft":
174
- return K(-1);
174
+ return P(-1);
175
175
  case "ArrowRight":
176
- return K(1);
176
+ return P(1);
177
177
  case "ArrowUp":
178
- return K(-7);
178
+ return P(-7);
179
179
  case "ArrowDown":
180
- return K(7);
180
+ return P(7);
181
181
  case "Home":
182
- return K(-((I.getDay() - u + 7) % 7));
182
+ return P(-((I.getDay() - d + 7) % 7));
183
183
  case "End":
184
- return K(6 - (I.getDay() - u + 7) % 7);
184
+ return P(6 - (I.getDay() - d + 7) % 7);
185
185
  case "PageUp":
186
186
  case "PageDown": {
187
- b.preventDefault();
188
- const le = b.key === "PageUp" ? -1 : 1, fe = new Date(I.getFullYear(), I.getMonth() + le + 1, 0).getDate();
189
- qe(qt(I.getFullYear(), I.getMonth() + le, Math.min(I.getDate(), fe)));
187
+ m.preventDefault();
188
+ const ie = m.key === "PageUp" ? -1 : 1, _e = new Date(I.getFullYear(), I.getMonth() + ie + 1, 0).getDate();
189
+ Ue(qt(I.getFullYear(), I.getMonth() + ie, Math.min(I.getDate(), _e)));
190
190
  return;
191
191
  }
192
192
  }
193
- }, yt = (b) => !!b && X.some((j) => j.iso === b && !j.outside), vt = [v, r, F].find((b) => yt(b) && !V(b)) ?? ((Ve = X.find((b) => !b.outside && !V(b.iso))) == null ? void 0 : Ve.iso), ne = n == null ? void 0 : n.from, W = n == null ? void 0 : n.to;
194
- return /* @__PURE__ */ D(
193
+ }, vt = (m) => !!m && W.some((q) => q.iso === m && !q.outside), Ie = [x, r, T].find((m) => vt(m) && !U(m)) ?? ((ke = W.find((m) => !m.outside && !U(m.iso))) == null ? void 0 : ke.iso), ce = n == null ? void 0 : n.from, de = n == null ? void 0 : n.to;
194
+ return /* @__PURE__ */ M(
195
195
  "div",
196
196
  {
197
- className: O("rg-cal", E),
198
- onMouseDown: y ? (b) => b.preventDefault() : void 0,
197
+ className: O("rg-cal", F),
198
+ onMouseDown: y ? (m) => m.preventDefault() : void 0,
199
199
  role: "group",
200
- "aria-label": `Calendar, ${ue}`,
200
+ "aria-label": `Calendar, ${oe}`,
201
201
  children: [
202
- /* @__PURE__ */ D("div", { className: "rg-cal__head", children: [
203
- /* @__PURE__ */ d("button", { type: "button", className: "rg-cal__nav", "aria-label": "Previous year", onClick: () => ce(-12), children: "«" }),
204
- /* @__PURE__ */ d("button", { type: "button", className: "rg-cal__nav", "aria-label": "Previous month", onClick: () => ce(-1), children: "‹" }),
205
- /* @__PURE__ */ d("span", { className: "rg-cal__title", "aria-live": "polite", children: ue }),
206
- /* @__PURE__ */ d("button", { type: "button", className: "rg-cal__nav", "aria-label": "Next month", onClick: () => ce(1), children: "›" }),
207
- /* @__PURE__ */ d("button", { type: "button", className: "rg-cal__nav", "aria-label": "Next year", onClick: () => ce(12), children: "»" })
202
+ /* @__PURE__ */ M("div", { className: "rg-cal__head", children: [
203
+ /* @__PURE__ */ u("button", { type: "button", className: "rg-cal__nav", "aria-label": "Previous year", onClick: () => ae(-12), children: "«" }),
204
+ /* @__PURE__ */ u("button", { type: "button", className: "rg-cal__nav", "aria-label": "Previous month", onClick: () => ae(-1), children: "‹" }),
205
+ /* @__PURE__ */ u("span", { className: "rg-cal__title", "aria-live": "polite", children: oe }),
206
+ /* @__PURE__ */ u("button", { type: "button", className: "rg-cal__nav", "aria-label": "Next month", onClick: () => ae(1), children: "›" }),
207
+ /* @__PURE__ */ u("button", { type: "button", className: "rg-cal__nav", "aria-label": "Next year", onClick: () => ae(12), children: "»" })
208
208
  ] }),
209
- /* @__PURE__ */ D("div", { className: "rg-cal__grid", ref: C, children: [
210
- re.map((b) => /* @__PURE__ */ d("span", { className: "rg-cal__dow", "aria-hidden": "true", children: b.slice(0, 2) }, b)),
211
- X.map(({ iso: b, day: j, outside: I }) => {
212
- const K = b === r, le = b === ne, fe = b === W, xt = !!ne && !!W && b > ne && b < W;
213
- return /* @__PURE__ */ d(
209
+ /* @__PURE__ */ M("div", { className: "rg-cal__grid", ref: $, children: [
210
+ G.map((m) => /* @__PURE__ */ u("span", { className: "rg-cal__dow", "aria-hidden": "true", children: m.slice(0, 2) }, m)),
211
+ W.map(({ iso: m, day: q, outside: I }) => {
212
+ const P = m === r, ie = m === ce, _e = m === de, xt = !!ce && !!de && m > ce && m < de;
213
+ return /* @__PURE__ */ u(
214
214
  "button",
215
215
  {
216
216
  type: "button",
217
- "data-iso": b,
218
- tabIndex: b === vt ? 0 : -1,
219
- disabled: V(b),
220
- "aria-pressed": K || le || fe,
221
- "aria-label": new Intl.DateTimeFormat(f, { dateStyle: "full" }).format(J(b)),
217
+ "data-iso": m,
218
+ tabIndex: m === Ie ? 0 : -1,
219
+ disabled: U(m),
220
+ "aria-pressed": P || ie || _e,
221
+ "aria-label": new Intl.DateTimeFormat(f, { dateStyle: "full" }).format(z(m)),
222
222
  className: O(
223
223
  "rg-cal__day",
224
224
  I && "rg-cal__day--outside",
225
- b === F && "rg-cal__day--today",
226
- (K || le || fe) && "rg-cal__day--selected",
225
+ m === T && "rg-cal__day--today",
226
+ (P || ie || _e) && "rg-cal__day--selected",
227
227
  xt && "rg-cal__day--in-range",
228
- ne && W && le && ne !== W && "rg-cal__day--range-start",
229
- ne && W && fe && ne !== W && "rg-cal__day--range-end"
228
+ ce && de && ie && ce !== de && "rg-cal__day--range-start",
229
+ ce && de && _e && ce !== de && "rg-cal__day--range-end"
230
230
  ),
231
- onClick: () => g(b),
232
- onKeyDown: (Ue) => Se(Ue, b),
233
- onFocus: () => _(b),
234
- children: j
231
+ onClick: () => g(m),
232
+ onKeyDown: (ze) => Ve(ze, m),
233
+ onFocus: () => _(m),
234
+ children: q
235
235
  },
236
- b
236
+ m
237
237
  );
238
238
  })
239
239
  ] }),
240
- !k && /* @__PURE__ */ D("div", { className: "rg-cal__foot", children: [
241
- /* @__PURE__ */ d(
240
+ !k && /* @__PURE__ */ M("div", { className: "rg-cal__foot", children: [
241
+ /* @__PURE__ */ u(
242
242
  "button",
243
243
  {
244
244
  type: "button",
245
245
  className: "rg-cal__link",
246
- disabled: V(F),
246
+ disabled: U(T),
247
247
  onClick: () => {
248
- w(Ir(F)), g(F);
248
+ D(Lr(T)), g(T);
249
249
  },
250
250
  children: "Today"
251
251
  }
252
252
  ),
253
- /* @__PURE__ */ d("button", { type: "button", className: "rg-cal__link", onClick: () => g(""), children: "Clear" })
253
+ /* @__PURE__ */ u("button", { type: "button", className: "rg-cal__link", onClick: () => g(""), children: "Clear" })
254
254
  ] })
255
255
  ]
256
256
  }
257
257
  );
258
258
  }
259
- const Ut = typeof window < "u" ? On : U;
260
- function Ye(r, n, c) {
261
- const [a, g] = R(n), f = r !== void 0, u = f ? r : a, k = _e(
259
+ const Vt = typeof window < "u" ? Rn : V;
260
+ function We(r, n, c) {
261
+ const [a, g] = R(n), f = r !== void 0, d = f ? r : a, k = be(
262
262
  (y) => {
263
263
  f || g(y), c == null || c(y);
264
264
  },
265
265
  [f, c]
266
266
  );
267
- return [u, k];
267
+ return [d, k];
268
268
  }
269
- function Rr(r, n) {
270
- const c = $(r);
269
+ function Br(r, n) {
270
+ const c = A(r);
271
271
  c.current = r;
272
- const a = $(void 0), g = $(null), f = _e(() => {
272
+ const a = A(void 0), g = A(null), f = be(() => {
273
273
  a.current !== void 0 && clearTimeout(a.current), a.current = void 0, g.current = null;
274
- }, []), u = _e(() => {
274
+ }, []), d = be(() => {
275
275
  a.current !== void 0 && clearTimeout(a.current), a.current = void 0;
276
276
  const y = g.current;
277
277
  g.current = null, y && c.current(...y);
278
- }, []), k = _e(
278
+ }, []), k = be(
279
279
  (...y) => {
280
280
  if (n <= 0) {
281
281
  f(), c.current(...y);
282
282
  return;
283
283
  }
284
- g.current = y, a.current !== void 0 && clearTimeout(a.current), a.current = setTimeout(u, n);
284
+ g.current = y, a.current !== void 0 && clearTimeout(a.current), a.current = setTimeout(d, n);
285
285
  },
286
- [n, f, u]
286
+ [n, f, d]
287
287
  );
288
- return U(() => u, [u]), { call: k, flush: u, cancel: f };
288
+ return V(() => d, [d]), { call: k, flush: d, cancel: f };
289
289
  }
290
- function Jt({ anchorRef: r, open: n, onClose: c, label: a, theme: g, className: f, style: u, keepFocus: k, children: y }) {
291
- const E = $(null), [T, w] = R({ top: 0, left: 0 }), v = _e(() => {
290
+ function Jt({ anchorRef: r, open: n, onClose: c, label: a, theme: g, className: f, style: d, keepFocus: k, children: y }) {
291
+ const F = A(null), [S, D] = R({ top: 0, left: 0 }), x = be(() => {
292
292
  var N;
293
293
  const _ = r.current;
294
294
  if (!_) return;
295
- const C = _.getBoundingClientRect(), P = ((N = E.current) == null ? void 0 : N.offsetWidth) ?? 260, F = Math.max(8, Math.min(C.left, window.innerWidth - P - 8));
296
- w({ top: C.bottom + 6, left: F });
295
+ const $ = _.getBoundingClientRect(), v = ((N = F.current) == null ? void 0 : N.offsetWidth) ?? 260, T = Math.max(8, Math.min($.left, window.innerWidth - v - 8));
296
+ D({ top: $.bottom + 6, left: T });
297
297
  }, [r]);
298
- return Ut(() => {
299
- n && v();
300
- }, [n, v]), U(() => {
298
+ return Vt(() => {
299
+ n && x();
300
+ }, [n, x]), V(() => {
301
301
  if (!n) return;
302
- const _ = (P) => {
303
- var N, S;
304
- const F = P.target;
305
- (N = E.current) != null && N.contains(F) || (S = r.current) != null && S.contains(F) || c();
306
- }, C = (P) => {
307
- var F;
308
- P.key === "Escape" && (c(), (F = r.current) == null || F.focus());
302
+ const _ = (v) => {
303
+ var N, C;
304
+ const T = v.target;
305
+ (N = F.current) != null && N.contains(T) || (C = r.current) != null && C.contains(T) || c();
306
+ }, $ = (v) => {
307
+ var T;
308
+ v.key === "Escape" && (c(), (T = r.current) == null || T.focus());
309
309
  };
310
- return document.addEventListener("mousedown", _), document.addEventListener("keydown", C), window.addEventListener("resize", v), window.addEventListener("scroll", v, !0), () => {
311
- document.removeEventListener("mousedown", _), document.removeEventListener("keydown", C), window.removeEventListener("resize", v), window.removeEventListener("scroll", v, !0);
310
+ return document.addEventListener("mousedown", _), document.addEventListener("keydown", $), window.addEventListener("resize", x), window.addEventListener("scroll", x, !0), () => {
311
+ document.removeEventListener("mousedown", _), document.removeEventListener("keydown", $), window.removeEventListener("resize", x), window.removeEventListener("scroll", x, !0);
312
312
  };
313
- }, [n, c, v, r]), !n || typeof document > "u" ? null : Kn(
314
- /* @__PURE__ */ d(
313
+ }, [n, c, x, r]), !n || typeof document > "u" ? null : Bn(
314
+ /* @__PURE__ */ u(
315
315
  "div",
316
316
  {
317
- ref: E,
317
+ ref: F,
318
318
  role: "dialog",
319
319
  onMouseDown: k ? (_) => _.preventDefault() : void 0,
320
320
  "aria-label": a,
321
321
  "data-rg-theme": g || void 0,
322
322
  className: O("rg-grid-popup", f),
323
- style: { position: "fixed", top: T.top, left: T.left, ...u },
323
+ style: { position: "fixed", top: S.top, left: S.left, ...d },
324
324
  children: y
325
325
  }
326
326
  ),
327
327
  document.body
328
328
  );
329
329
  }
330
- function qn({ value: r, onChange: n, onPick: c, onBlur: a, onKeyDown: g, min: f, max: u, locale: k, invalid: y, label: E, theme: T, className: w, style: v }) {
331
- const _ = $(null);
332
- return /* @__PURE__ */ D(je, { children: [
333
- /* @__PURE__ */ d(
330
+ function Vn({ value: r, onChange: n, onPick: c, onBlur: a, onKeyDown: g, min: f, max: d, locale: k, invalid: y, label: F, theme: S, className: D, style: x }) {
331
+ const _ = A(null);
332
+ return /* @__PURE__ */ M(qe, { children: [
333
+ /* @__PURE__ */ u(
334
334
  "input",
335
335
  {
336
336
  ref: _,
@@ -339,56 +339,63 @@ function qn({ value: r, onChange: n, onPick: c, onBlur: a, onKeyDown: g, min: f,
339
339
  inputMode: "numeric",
340
340
  placeholder: "YYYY-MM-DD",
341
341
  autoComplete: "off",
342
- className: w,
343
- style: v,
342
+ className: D,
343
+ style: x,
344
344
  value: r,
345
- "aria-label": E,
345
+ "aria-label": F,
346
346
  "aria-invalid": y || void 0,
347
347
  "aria-haspopup": "dialog",
348
348
  "aria-expanded": !0,
349
- onChange: (C) => n(C.target.value.trim()),
349
+ onChange: (v) => n(v.target.value.trim()),
350
350
  onBlur: a,
351
- onKeyDown: g,
352
- onFocus: (C) => C.currentTarget.setSelectionRange(C.currentTarget.value.length, C.currentTarget.value.length)
351
+ onKeyDown: (v) => {
352
+ const T = v.ctrlKey || v.altKey || v.metaKey, N = v.key === "ArrowUp" ? { days: -7, months: 0 } : v.key === "ArrowDown" ? { days: 7, months: 0 } : T && v.key === "ArrowLeft" ? { days: -1, months: 0 } : T && v.key === "ArrowRight" ? { days: 1, months: 0 } : v.key === "PageUp" ? { days: 0, months: -1 } : v.key === "PageDown" ? { days: 0, months: 1 } : null;
353
+ if (!N || v.shiftKey) return g(v);
354
+ v.preventDefault();
355
+ const C = z(r) ?? /* @__PURE__ */ new Date(), G = new Date(C.getFullYear(), C.getMonth() + N.months + 1, 0).getDate(), oe = new Date(C.getFullYear(), C.getMonth() + N.months, Math.min(C.getDate(), G) + N.days);
356
+ let W = X(oe);
357
+ f && W < f && (W = f), d && W > d && (W = d), n(W);
358
+ },
359
+ onFocus: (v) => v.currentTarget.setSelectionRange(v.currentTarget.value.length, v.currentTarget.value.length)
353
360
  }
354
361
  ),
355
- /* @__PURE__ */ d(Jt, { anchorRef: _, open: !0, onClose: () => {
356
- }, label: E, theme: T, className: "rg-date-popup", keepFocus: !0, children: /* @__PURE__ */ d(Kr, { value: r, min: f, max: u, locale: k, onPick: c, keepFocus: !0 }) })
362
+ /* @__PURE__ */ u(Jt, { anchorRef: _, open: !0, onClose: () => {
363
+ }, label: F, theme: S, className: "rg-date-popup", keepFocus: !0, children: /* @__PURE__ */ u(Rr, { value: r, min: f, max: d, locale: k, onPick: c, keepFocus: !0 }) })
357
364
  ] });
358
365
  }
359
- function Lr(r) {
366
+ function $r(r) {
360
367
  return r.filterType ? r.filterType : r.type === "number" ? "number" : r.type === "date" ? "date" : r.type === "boolean" ? "select" : "text";
361
368
  }
362
- const Vn = (r) => typeof r == "object" && r !== null && !Array.isArray(r);
363
- function Br(r) {
369
+ const zn = (r) => typeof r == "object" && r !== null && !Array.isArray(r);
370
+ function Yr(r) {
364
371
  if (r == null) return !1;
365
372
  if (typeof r == "string") return r.trim() !== "";
366
373
  if (Array.isArray(r)) return r.length > 0;
367
- if (Vn(r)) {
374
+ if (zn(r)) {
368
375
  const n = r;
369
376
  return typeof n.min == "number" || typeof n.max == "number" || !!n.from || !!n.to;
370
377
  }
371
378
  return !1;
372
379
  }
373
- function Un(r, n, c, a) {
380
+ function Hn(r, n, c, a) {
374
381
  switch (r) {
375
382
  case "text":
376
383
  return c.toLowerCase().includes(String(n).trim().toLowerCase());
377
384
  case "exact":
378
385
  return c.toLowerCase() === String(n).trim().toLowerCase();
379
386
  case "number": {
380
- const { min: g, max: f } = n, u = typeof a == "number" ? a : a == null || a === "" ? NaN : Number(a);
381
- return Number.isNaN(u) ? !1 : (typeof g != "number" || u >= g) && (typeof f != "number" || u <= f);
387
+ const { min: g, max: f } = n, d = typeof a == "number" ? a : a == null || a === "" ? NaN : Number(a);
388
+ return Number.isNaN(d) ? !1 : (typeof g != "number" || d >= g) && (typeof f != "number" || d <= f);
382
389
  }
383
390
  case "date": {
384
- const { from: g, to: f } = n, u = Z(a);
385
- return u ? (!g || u >= g) && (!f || u <= f) : !1;
391
+ const { from: g, to: f } = n, d = X(a);
392
+ return d ? (!g || d >= g) && (!f || d <= f) : !1;
386
393
  }
387
394
  case "select":
388
395
  return n.includes(String(a ?? ""));
389
396
  }
390
397
  }
391
- function zn(r, n, c, a) {
398
+ function Jn(r, n, c, a) {
392
399
  if (r.filterOptions) return r.filterOptions.map((f) => typeof f == "string" ? { value: f, label: f } : f);
393
400
  if (r.type === "boolean")
394
401
  return [
@@ -397,19 +404,19 @@ function zn(r, n, c, a) {
397
404
  ];
398
405
  const g = /* @__PURE__ */ new Map();
399
406
  for (const f of n) {
400
- const u = c(f);
401
- if (u == null || u === "") continue;
402
- const k = String(u);
407
+ const d = c(f);
408
+ if (d == null || d === "") continue;
409
+ const k = String(d);
403
410
  g.has(k) || g.set(k, a(f));
404
411
  }
405
- return [...g].map(([f, u]) => ({ value: f, label: u })).sort((f, u) => f.label.localeCompare(u.label, void 0, { numeric: !0 }));
412
+ return [...g].map(([f, d]) => ({ value: f, label: d })).sort((f, d) => f.label.localeCompare(d.label, void 0, { numeric: !0 }));
406
413
  }
407
- const $r = (r) => {
414
+ const Ar = (r) => {
408
415
  if (r.trim() === "") return;
409
416
  const n = Number(r);
410
417
  return Number.isFinite(n) ? n : void 0;
411
- }, Yr = (r) => typeof r == "object" && r !== null && !Array.isArray(r);
412
- function Hn({
418
+ }, Wr = (r) => typeof r == "object" && r !== null && !Array.isArray(r);
419
+ function Xn({
413
420
  value: r,
414
421
  onChange: n,
415
422
  label: c,
@@ -417,16 +424,16 @@ function Hn({
417
424
  inputClassName: g,
418
425
  inputStyle: f
419
426
  }) {
420
- const u = Yr(r) ? r : {}, [k, y] = R(u.min === void 0 ? "" : String(u.min)), [E, T] = R(u.max === void 0 ? "" : String(u.max)), w = $(u), v = Rr((_, C) => {
421
- const P = $r(_), F = $r(C);
422
- w.current = { min: P, max: F }, n(P === void 0 && F === void 0 ? void 0 : { min: P, max: F });
427
+ const d = Wr(r) ? r : {}, [k, y] = R(d.min === void 0 ? "" : String(d.min)), [F, S] = R(d.max === void 0 ? "" : String(d.max)), D = A(d), x = Br((_, $) => {
428
+ const v = Ar(_), T = Ar($);
429
+ D.current = { min: v, max: T }, n(v === void 0 && T === void 0 ? void 0 : { min: v, max: T });
423
430
  }, a);
424
- return U(() => {
425
- u.min === w.current.min && u.max === w.current.max || (w.current = u, v.cancel(), y(u.min === void 0 ? "" : String(u.min)), T(u.max === void 0 ? "" : String(u.max)));
426
- }, [u.min, u.max]), /* @__PURE__ */ D("div", { className: "rg-grid__filter-fields", children: [
427
- /* @__PURE__ */ D("label", { className: "rg-grid__filter-field", children: [
428
- /* @__PURE__ */ d("span", { children: "Min" }),
429
- /* @__PURE__ */ d(
431
+ return V(() => {
432
+ d.min === D.current.min && d.max === D.current.max || (D.current = d, x.cancel(), y(d.min === void 0 ? "" : String(d.min)), S(d.max === void 0 ? "" : String(d.max)));
433
+ }, [d.min, d.max]), /* @__PURE__ */ M("div", { className: "rg-grid__filter-fields", children: [
434
+ /* @__PURE__ */ M("label", { className: "rg-grid__filter-field", children: [
435
+ /* @__PURE__ */ u("span", { children: "Min" }),
436
+ /* @__PURE__ */ u(
430
437
  "input",
431
438
  {
432
439
  autoFocus: !0,
@@ -436,226 +443,226 @@ function Hn({
436
443
  value: k,
437
444
  "aria-label": `Minimum ${c}`,
438
445
  onChange: (_) => {
439
- y(_.target.value), v.call(_.target.value, E);
446
+ y(_.target.value), x.call(_.target.value, F);
440
447
  },
441
- onKeyDown: (_) => _.key === "Enter" && v.flush()
448
+ onKeyDown: (_) => _.key === "Enter" && x.flush()
442
449
  }
443
450
  )
444
451
  ] }),
445
- /* @__PURE__ */ D("label", { className: "rg-grid__filter-field", children: [
446
- /* @__PURE__ */ d("span", { children: "Max" }),
447
- /* @__PURE__ */ d(
452
+ /* @__PURE__ */ M("label", { className: "rg-grid__filter-field", children: [
453
+ /* @__PURE__ */ u("span", { children: "Max" }),
454
+ /* @__PURE__ */ u(
448
455
  "input",
449
456
  {
450
457
  type: "number",
451
458
  className: O("rg-grid__filter-input", g),
452
459
  style: f,
453
- value: E,
460
+ value: F,
454
461
  "aria-label": `Maximum ${c}`,
455
462
  onChange: (_) => {
456
- T(_.target.value), v.call(k, _.target.value);
463
+ S(_.target.value), x.call(k, _.target.value);
457
464
  },
458
- onKeyDown: (_) => _.key === "Enter" && v.flush()
465
+ onKeyDown: (_) => _.key === "Enter" && x.flush()
459
466
  }
460
467
  )
461
468
  ] })
462
469
  ] });
463
470
  }
464
- function Jn({
471
+ function Gn({
465
472
  value: r,
466
473
  onChange: n,
467
474
  onEnter: c,
468
475
  label: a,
469
476
  kind: g,
470
477
  placeholder: f,
471
- debounce: u,
478
+ debounce: d,
472
479
  inputClassName: k,
473
480
  inputStyle: y
474
481
  }) {
475
- const [E, T] = R(r), w = $(r), v = Rr((_) => {
476
- w.current = _, n(_ || void 0);
477
- }, u);
478
- return U(() => {
479
- r !== w.current && (w.current = r, v.cancel(), T(r));
480
- }, [r]), /* @__PURE__ */ d(
482
+ const [F, S] = R(r), D = A(r), x = Br((_) => {
483
+ D.current = _, n(_ || void 0);
484
+ }, d);
485
+ return V(() => {
486
+ r !== D.current && (D.current = r, x.cancel(), S(r));
487
+ }, [r]), /* @__PURE__ */ u(
481
488
  "input",
482
489
  {
483
490
  autoFocus: !0,
484
491
  type: "text",
485
492
  className: O("rg-grid__filter-input", k),
486
493
  style: y,
487
- value: E,
494
+ value: F,
488
495
  placeholder: f ?? (g === "exact" ? "Exactly…" : `Filter ${a}…`),
489
496
  "aria-label": `Filter text for ${a}`,
490
497
  onChange: (_) => {
491
- T(_.target.value), v.call(_.target.value);
498
+ S(_.target.value), x.call(_.target.value);
492
499
  },
493
500
  onKeyDown: (_) => {
494
- _.key === "Enter" && (_.preventDefault(), v.flush(), c());
501
+ _.key === "Enter" && (_.preventDefault(), x.flush(), c());
495
502
  }
496
503
  }
497
504
  );
498
505
  }
499
- function Xn({
506
+ function Qn({
500
507
  value: r,
501
508
  onChange: n,
502
509
  label: c,
503
510
  inputClassName: a,
504
511
  inputStyle: g,
505
512
  min: f,
506
- max: u,
513
+ max: d,
507
514
  locale: k
508
515
  }) {
509
- const y = Yr(r) ? r : {}, E = (N, S) => n(!N && !S ? void 0 : { from: N || void 0, to: S || void 0 }), [T, w] = R(y.from ?? ""), [v, _] = R(y.to ?? "");
510
- U(() => {
511
- (J(T) ? T : "") !== (y.from ?? "") && w(y.from ?? ""), (J(v) ? v : "") !== (y.to ?? "") && _(y.to ?? "");
516
+ const y = Wr(r) ? r : {}, F = (N, C) => n(!N && !C ? void 0 : { from: N || void 0, to: C || void 0 }), [S, D] = R(y.from ?? ""), [x, _] = R(y.to ?? "");
517
+ V(() => {
518
+ (z(S) ? S : "") !== (y.from ?? "") && D(y.from ?? ""), (z(x) ? x : "") !== (y.to ?? "") && _(y.to ?? "");
512
519
  }, [y.from, y.to]);
513
- const C = (N, S) => {
514
- if ((N === "from" ? w : _)(S), S !== "" && !J(S)) return;
515
- const re = S || void 0;
516
- N === "from" ? E(re, y.to) : E(y.from, re);
517
- }, P = (N) => {
518
- N && (!y.from || y.to ? E(N, void 0) : N < y.from ? E(N, y.from) : E(y.from, N));
519
- }, F = (N, S, re) => /* @__PURE__ */ D("label", { className: "rg-grid__filter-field", children: [
520
- /* @__PURE__ */ d("span", { children: N === "from" ? "From" : "To" }),
521
- /* @__PURE__ */ d(
520
+ const $ = (N, C) => {
521
+ if ((N === "from" ? D : _)(C), C !== "" && !z(C)) return;
522
+ const G = C || void 0;
523
+ N === "from" ? F(G, y.to) : F(y.from, G);
524
+ }, v = (N) => {
525
+ N && (!y.from || y.to ? F(N, void 0) : N < y.from ? F(N, y.from) : F(y.from, N));
526
+ }, T = (N, C, G) => /* @__PURE__ */ M("label", { className: "rg-grid__filter-field", children: [
527
+ /* @__PURE__ */ u("span", { children: N === "from" ? "From" : "To" }),
528
+ /* @__PURE__ */ u(
522
529
  "input",
523
530
  {
524
- autoFocus: re,
531
+ autoFocus: G,
525
532
  type: "text",
526
533
  inputMode: "numeric",
527
534
  placeholder: "YYYY-MM-DD",
528
- className: O("rg-grid__filter-input", S !== "" && !J(S) && "rg-grid__filter-input--invalid", a),
535
+ className: O("rg-grid__filter-input", C !== "" && !z(C) && "rg-grid__filter-input--invalid", a),
529
536
  style: g,
530
- value: S,
537
+ value: C,
531
538
  "aria-label": `${c} ${N}`,
532
- "aria-invalid": S !== "" && !J(S) || void 0,
533
- onChange: (ue) => C(N, ue.target.value.trim())
539
+ "aria-invalid": C !== "" && !z(C) || void 0,
540
+ onChange: (oe) => $(N, oe.target.value.trim())
534
541
  }
535
542
  )
536
543
  ] });
537
- return /* @__PURE__ */ D("div", { className: "rg-grid__filter-fields rg-grid__filter-fields--stack", children: [
538
- /* @__PURE__ */ D("div", { className: "rg-grid__filter-date-row", children: [
539
- F("from", T, !0),
540
- F("to", v, !1)
544
+ return /* @__PURE__ */ M("div", { className: "rg-grid__filter-fields rg-grid__filter-fields--stack", children: [
545
+ /* @__PURE__ */ M("div", { className: "rg-grid__filter-date-row", children: [
546
+ T("from", S, !0),
547
+ T("to", x, !1)
541
548
  ] }),
542
- /* @__PURE__ */ d(Kr, { range: y, min: f, max: u, locale: k, onPick: P, hideFooter: !0 })
549
+ /* @__PURE__ */ u(Rr, { range: y, min: f, max: d, locale: k, onPick: v, hideFooter: !0 })
543
550
  ] });
544
551
  }
545
- function Gn({
552
+ function Zn({
546
553
  value: r,
547
554
  onChange: n,
548
555
  options: c
549
556
  }) {
550
- const a = Array.isArray(r) ? r : [], g = (f, u) => {
551
- const k = u ? [...a, f] : a.filter((y) => y !== f);
557
+ const a = Array.isArray(r) ? r : [], g = (f, d) => {
558
+ const k = d ? [...a, f] : a.filter((y) => y !== f);
552
559
  n(k.length ? k : void 0);
553
560
  };
554
- return /* @__PURE__ */ D("div", { className: "rg-grid__filter-fields rg-grid__filter-options", role: "group", children: [
555
- c.length === 0 && /* @__PURE__ */ d("span", { className: "rg-grid__filter-empty", children: "No values" }),
556
- c.map((f) => /* @__PURE__ */ d(
557
- Fe,
561
+ return /* @__PURE__ */ M("div", { className: "rg-grid__filter-fields rg-grid__filter-options", role: "group", children: [
562
+ c.length === 0 && /* @__PURE__ */ u("span", { className: "rg-grid__filter-empty", children: "No values" }),
563
+ c.map((f) => /* @__PURE__ */ u(
564
+ Se,
558
565
  {
559
566
  checked: a.includes(f.value),
560
- onChange: (u) => g(f.value, u),
567
+ onChange: (d) => g(f.value, d),
561
568
  label: f.label ?? f.value
562
569
  },
563
570
  f.value
564
571
  ))
565
572
  ] });
566
573
  }
567
- function Qn({
574
+ function eo({
568
575
  column: r,
569
576
  label: n,
570
577
  kind: c,
571
578
  value: a,
572
579
  onChange: g,
573
580
  options: f,
574
- debounce: u = 300,
581
+ debounce: d = 300,
575
582
  theme: k,
576
583
  indicatorClassName: y,
577
- indicatorStyle: E,
578
- popupClassName: T,
579
- popupStyle: w,
580
- inputClassName: v,
584
+ indicatorStyle: F,
585
+ popupClassName: S,
586
+ popupStyle: D,
587
+ inputClassName: x,
581
588
  inputStyle: _
582
589
  }) {
583
- const [C, P] = R(!1), F = $(null), N = Br(a), S = _e(() => P(!1), []), re = typeof a == "string" ? a : "", ue = () => {
590
+ const [$, v] = R(!1), T = A(null), N = Yr(a), C = be(() => v(!1), []), G = typeof a == "string" ? a : "", oe = () => {
584
591
  if (r.filterRenderer)
585
- return Te(r.filterRenderer, { column: r, value: re, onChange: (X) => g(X || void 0) });
592
+ return Fe(r.filterRenderer, { column: r, value: G, onChange: (W) => g(W || void 0) });
586
593
  switch (c) {
587
594
  case "number":
588
- return /* @__PURE__ */ d(Hn, { value: a, onChange: g, label: n, debounce: u, inputClassName: v, inputStyle: _ });
595
+ return /* @__PURE__ */ u(Xn, { value: a, onChange: g, label: n, debounce: d, inputClassName: x, inputStyle: _ });
589
596
  case "date":
590
- return /* @__PURE__ */ d(Xn, { value: a, onChange: g, label: n, min: r.dateMin, max: r.dateMax, locale: r.dateLocale, inputClassName: v, inputStyle: _ });
597
+ return /* @__PURE__ */ u(Qn, { value: a, onChange: g, label: n, min: r.dateMin, max: r.dateMax, locale: r.dateLocale, inputClassName: x, inputStyle: _ });
591
598
  case "select":
592
- return /* @__PURE__ */ d(Gn, { value: a, onChange: g, options: f });
599
+ return /* @__PURE__ */ u(Zn, { value: a, onChange: g, options: f });
593
600
  default:
594
- return /* @__PURE__ */ d(
595
- Jn,
601
+ return /* @__PURE__ */ u(
602
+ Gn,
596
603
  {
597
- value: re,
604
+ value: G,
598
605
  onChange: g,
599
606
  onEnter: () => {
600
- var X;
601
- P(!1), (X = F.current) == null || X.focus();
607
+ var W;
608
+ v(!1), (W = T.current) == null || W.focus();
602
609
  },
603
610
  label: n,
604
611
  kind: c,
605
612
  placeholder: r.filterPlaceholder,
606
- debounce: u,
607
- inputClassName: v,
613
+ debounce: d,
614
+ inputClassName: x,
608
615
  inputStyle: _
609
616
  }
610
617
  );
611
618
  }
612
619
  };
613
- return /* @__PURE__ */ D(je, { children: [
614
- /* @__PURE__ */ d(
620
+ return /* @__PURE__ */ M(qe, { children: [
621
+ /* @__PURE__ */ u(
615
622
  "button",
616
623
  {
617
- ref: F,
624
+ ref: T,
618
625
  type: "button",
619
626
  className: O(
620
627
  "rg-grid__filter-btn",
621
628
  N && "rg-grid__filter-btn--active",
622
- C && "rg-grid__filter-btn--open",
629
+ $ && "rg-grid__filter-btn--open",
623
630
  y
624
631
  ),
625
- style: E,
632
+ style: F,
626
633
  "aria-label": `Filter ${n}`,
627
634
  "aria-haspopup": "dialog",
628
- "aria-expanded": C,
635
+ "aria-expanded": $,
629
636
  "data-active": N || void 0,
630
- onClick: (X) => {
631
- X.stopPropagation(), P((V) => !V);
637
+ onClick: (W) => {
638
+ W.stopPropagation(), v((U) => !U);
632
639
  },
633
- onKeyDown: (X) => X.stopPropagation(),
634
- children: r.filterIndicator ? Te(r.filterIndicator, { column: r, active: N, open: C }) : /* @__PURE__ */ d("span", { className: "rg-grid__filter-dot", "aria-hidden": "true" })
640
+ onKeyDown: (W) => W.stopPropagation(),
641
+ children: r.filterIndicator ? Fe(r.filterIndicator, { column: r, active: N, open: $ }) : /* @__PURE__ */ u("span", { className: "rg-grid__filter-dot", "aria-hidden": "true" })
635
642
  }
636
643
  ),
637
- /* @__PURE__ */ D(
644
+ /* @__PURE__ */ M(
638
645
  Jt,
639
646
  {
640
- anchorRef: F,
641
- open: C,
642
- onClose: S,
647
+ anchorRef: T,
648
+ open: $,
649
+ onClose: C,
643
650
  label: `Filter ${n}`,
644
651
  theme: k,
645
- className: T,
646
- style: w,
652
+ className: S,
653
+ style: D,
647
654
  children: [
648
- ue(),
649
- N && /* @__PURE__ */ d("button", { type: "button", className: "rg-grid__filter-clear", onClick: () => g(void 0), children: "Clear" })
655
+ oe(),
656
+ N && /* @__PURE__ */ u("button", { type: "button", className: "rg-grid__filter-clear", onClick: () => g(void 0), children: "Clear" })
650
657
  ]
651
658
  }
652
659
  )
653
660
  ] });
654
661
  }
655
- function Zn({ columns: r, hidden: n, onToggle: c, theme: a, className: g, style: f }) {
656
- const [u, k] = R(!1), y = $(null), E = _e(() => k(!1), []), T = r.filter((w) => !n.has(w.field)).length;
657
- return /* @__PURE__ */ D(je, { children: [
658
- /* @__PURE__ */ d(
662
+ function to({ columns: r, hidden: n, onToggle: c, theme: a, className: g, style: f }) {
663
+ const [d, k] = R(!1), y = A(null), F = be(() => k(!1), []), S = r.filter((D) => !n.has(D.field)).length;
664
+ return /* @__PURE__ */ M(qe, { children: [
665
+ /* @__PURE__ */ u(
659
666
  "button",
660
667
  {
661
668
  ref: y,
@@ -663,46 +670,46 @@ function Zn({ columns: r, hidden: n, onToggle: c, theme: a, className: g, style:
663
670
  className: O("rg-grid__tool-btn", g),
664
671
  style: f,
665
672
  "aria-haspopup": "dialog",
666
- "aria-expanded": u,
667
- onClick: () => k((w) => !w),
673
+ "aria-expanded": d,
674
+ onClick: () => k((D) => !D),
668
675
  children: "Columns"
669
676
  }
670
677
  ),
671
- /* @__PURE__ */ d(Jt, { anchorRef: y, open: u, onClose: E, label: "Show or hide columns", theme: a, children: /* @__PURE__ */ d("div", { className: "rg-grid__filter-fields rg-grid__filter-options", role: "group", "aria-label": "Columns", children: r.filter((w) => w.hideable !== !1).map((w) => {
672
- const v = !n.has(w.field);
673
- return /* @__PURE__ */ d(
674
- Fe,
678
+ /* @__PURE__ */ u(Jt, { anchorRef: y, open: d, onClose: F, label: "Show or hide columns", theme: a, children: /* @__PURE__ */ u("div", { className: "rg-grid__filter-fields rg-grid__filter-options", role: "group", "aria-label": "Columns", children: r.filter((D) => D.hideable !== !1).map((D) => {
679
+ const x = !n.has(D.field);
680
+ return /* @__PURE__ */ u(
681
+ Se,
675
682
  {
676
- checked: v,
677
- disabled: v && T <= 1,
678
- onChange: (_) => c(w.field, !_),
679
- label: ke(w)
683
+ checked: x,
684
+ disabled: x && S <= 1,
685
+ onChange: (_) => c(D.field, !_),
686
+ label: we(D)
680
687
  },
681
- w.field
688
+ D.field
682
689
  );
683
690
  }) }) })
684
691
  ] });
685
692
  }
686
- const eo = /^[=+\-@\t\r]/;
687
- function to(r, n, c) {
693
+ const ro = /^[=+\-@\t\r]/;
694
+ function no(r, n, c) {
688
695
  if (r == null) return "";
689
696
  let a = String(r);
690
- return c && typeof r == "string" && eo.test(a) && !Number.isFinite(Number(a)) && (a = `'${a}`), a.includes(n) || /["\r\n]/.test(a) ? `"${a.replace(/"/g, '""')}"` : a;
697
+ return c && typeof r == "string" && ro.test(a) && !Number.isFinite(Number(a)) && (a = `'${a}`), a.includes(n) || /["\r\n]/.test(a) ? `"${a.replace(/"/g, '""')}"` : a;
691
698
  }
692
- function ro(r, n, c = {}) {
693
- const { delimiter: a = ",", sanitize: g = !0 } = c, f = (u) => u.map((k) => to(k, a, g)).join(a);
699
+ function oo(r, n, c = {}) {
700
+ const { delimiter: a = ",", sanitize: g = !0 } = c, f = (d) => d.map((k) => no(k, a, g)).join(a);
694
701
  return [f(r), ...n.map(f)].join(`\r
695
702
  `);
696
703
  }
697
- function no(r, n) {
704
+ function io(r, n) {
698
705
  if (typeof document > "u") return;
699
706
  const c = new Blob(["\uFEFF", r], { type: "text/csv;charset=utf-8" }), a = URL.createObjectURL(c), g = document.createElement("a");
700
707
  g.href = a, g.download = n, g.style.display = "none", document.body.appendChild(g), g.click(), g.remove(), setTimeout(() => URL.revokeObjectURL(a), 1e3);
701
708
  }
702
- const zt = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), Wr = (r, n) => Object.prototype.hasOwnProperty.call(r, n);
709
+ const zt = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), jr = (r, n) => Object.prototype.hasOwnProperty.call(r, n);
703
710
  function te(r, n) {
704
711
  if (r === null || typeof r != "object") return;
705
- if (Wr(r, n)) return r[n];
712
+ if (jr(r, n)) return r[n];
706
713
  let c = r;
707
714
  for (const a of n.split(".")) {
708
715
  if (c == null || typeof c != "object" || zt.has(a)) return;
@@ -719,208 +726,210 @@ function Pr(r, n, c) {
719
726
  }
720
727
  function Ht(r, n, c) {
721
728
  const a = r ?? {};
722
- if (Wr(a, n) || !n.includes("."))
729
+ if (jr(a, n) || !n.includes("."))
723
730
  return zt.has(n) ? r : Pr(a, n, c);
724
731
  const [g, ...f] = n.split(".");
725
732
  if (zt.has(g)) return r;
726
- const u = a[g];
727
- return Pr(a, g, Ht(u !== null && typeof u == "object" ? u : {}, f.join("."), c));
733
+ const d = a[g];
734
+ return Pr(a, g, Ht(d !== null && typeof d == "object" ? d : {}, f.join("."), c));
728
735
  }
729
- const be = 38, oo = 150, Ar = 10, Vt = (r, n) => `${typeof r}:${r}\0${n}`;
730
- function We(r, n) {
736
+ const me = 38, lo = 150, Kr = 10, Ut = (r, n) => `${typeof r}:${r}\0${n}`;
737
+ function je(r, n) {
731
738
  const c = te(n, r.field);
732
- return r.valueFormatter ? r.valueFormatter(c, n) : r.type === "boolean" && typeof c == "boolean" ? c ? "Yes" : "No" : r.type === "date" ? Wn(c, r.dateLocale, r.dateFormat) : c == null ? "" : c instanceof Date ? c.toLocaleDateString() : String(c);
739
+ return r.valueFormatter ? r.valueFormatter(c, n) : r.type === "boolean" && typeof c == "boolean" ? c ? "Yes" : "No" : r.type === "date" ? qn(c, r.dateLocale, r.dateFormat) : c == null ? "" : c instanceof Date ? c.toLocaleDateString() : String(c);
733
740
  }
734
- function io(r, n, c) {
741
+ function so(r, n, c) {
735
742
  if (c.type === "date") {
736
- const a = Z(r) ?? "", g = Z(n) ?? "";
743
+ const a = X(r) ?? "", g = X(n) ?? "";
737
744
  return a < g ? -1 : a > g ? 1 : 0;
738
745
  }
739
746
  return typeof r == "number" && typeof n == "number" ? r - n : r instanceof Date && n instanceof Date ? r.getTime() - n.getTime() : typeof r == "boolean" && typeof n == "boolean" ? Number(r) - Number(n) : String(r).localeCompare(String(n), void 0, { numeric: !0, sensitivity: "base" });
740
747
  }
741
- const lo = (r) => r ? Array.isArray(r) ? r : [r] : [], Or = (r) => r.type === "date" && r.validity.badInput;
742
- function fo({
748
+ const ao = (r) => r ? Array.isArray(r) ? r : [r] : [], Or = (r) => r.type === "date" && r.validity.badInput;
749
+ function ho({
743
750
  columns: r,
744
751
  rows: n,
745
752
  getRowId: c,
746
753
  editable: a = !1,
747
754
  enterMovesDown: g = !0,
748
755
  onCellEdit: f,
749
- onRowsChange: u,
756
+ onRowsChange: d,
750
757
  rowSelection: k = !1,
751
758
  selectedRowIds: y,
752
- defaultSelectedRowIds: E,
753
- onSelectionChange: T,
754
- isRowSelectable: w,
755
- sort: v,
759
+ defaultSelectedRowIds: F,
760
+ onSelectionChange: S,
761
+ isRowSelectable: D,
762
+ sort: x,
756
763
  defaultSort: _ = null,
757
- onSortChange: C,
758
- multiSort: P = !1,
759
- searchable: F = !1,
764
+ onSortChange: $,
765
+ multiSort: v = !1,
766
+ searchable: T = !1,
760
767
  searchPlaceholder: N = "Search…",
761
- search: S,
762
- onSearchChange: re,
763
- filters: ue,
764
- onFiltersChange: X,
765
- pagination: V = !1,
766
- paginationPosition: ce = "bottom",
767
- pageSize: qe = 10,
768
- pageSizeOptions: Se = [5, 10, 25, 50],
769
- page: yt,
770
- onPageChange: vt,
771
- onPageSizeChange: ne,
772
- serverSide: W = !1,
773
- rowCount: Ve,
774
- onQueryChange: b,
775
- queryDebounce: j = 250,
776
- filterDebounce: I = 300,
777
- loading: K,
778
- loadingRows: le,
779
- skeletonRow: fe,
780
- errorMessage: xt = "Could not load the data.",
781
- columnMenu: Ue = !1,
782
- onColumnVisibilityChange: kt,
783
- keyboardNavigation: wt = !1,
784
- virtualize: oe = !1,
785
- rowHeight: de = 40,
786
- overscan: Xt = 6,
787
- exportable: ze = !1,
788
- apiRef: Ie,
768
+ search: C,
769
+ onSearchChange: G,
770
+ filters: oe,
771
+ onFiltersChange: W,
772
+ pagination: U = !1,
773
+ paginationPosition: ae = "bottom",
774
+ showToolbar: Ue = !0,
775
+ showFooter: Ve = !0,
776
+ pageSize: vt = 10,
777
+ pageSizeOptions: Ie = [5, 10, 25, 50],
778
+ page: ce,
779
+ onPageChange: de,
780
+ onPageSizeChange: ke,
781
+ serverSide: m = !1,
782
+ rowCount: q,
783
+ onQueryChange: I,
784
+ queryDebounce: P = 250,
785
+ filterDebounce: ie = 300,
786
+ loading: _e,
787
+ loadingRows: xt,
788
+ skeletonRow: ze,
789
+ errorMessage: qr = "Could not load the data.",
790
+ columnMenu: Xt = !1,
791
+ onColumnVisibilityChange: wt,
792
+ keyboardNavigation: kt = !1,
793
+ virtualize: re = !1,
794
+ rowHeight: ue = 40,
795
+ overscan: Gt = 6,
796
+ exportable: He = !1,
797
+ apiRef: Le,
789
798
  onRowClick: Dt,
790
- toolbar: Gt,
791
- emptyMessage: jr = "No rows to show",
792
- striped: qr = !1,
793
- stripeColors: He,
799
+ toolbar: Qt,
800
+ emptyMessage: Ur = "No rows to show",
801
+ striped: Vr = !1,
802
+ stripeColors: Je,
794
803
  checkboxVariant: Nt = "native",
795
- animateRows: Qt = !0,
804
+ animateRows: Zt = !0,
796
805
  rowAnimationClassName: Mt,
797
- theme: Je,
798
- maxHeight: Xe,
799
- className: Vr,
800
- style: Ur,
806
+ theme: Xe,
807
+ maxHeight: Ge,
808
+ className: zr,
809
+ style: Hr,
801
810
  classNames: B = {},
802
811
  styles: L = {},
803
812
  rowClassName: Ct,
804
813
  rowStyle: Et
805
814
  }) {
806
- const q = (e, t) => ({
815
+ const j = (e, t) => ({
807
816
  className: O(t, B[e]),
808
817
  style: L[e]
809
- }), [Ge, Zt] = R(n), we = $(n);
810
- U(() => {
811
- we.current = n, Zt(n);
818
+ }), [Qe, er] = R(n), De = A(n);
819
+ V(() => {
820
+ De.current = n, er(n);
812
821
  }, [n]);
813
- const er = (e) => {
814
- we.current = e, Zt(e);
815
- }, [Le, zr] = Ye(S, "", re), [De, Hr] = Ye(ue, {}, X), [G, Jr] = Ye(v, lo(_), C), [Tt, Ne] = Ye(yt, 0, vt), [z, Xr] = R(qe), Gr = (e) => {
816
- Xr(e), ne == null || ne(e);
817
- }, [Qe, Qr] = R(() => new Set(r.filter((e) => e.hidden).map((e) => e.field))), Zr = (e, t) => {
818
- const o = new Set(Qe);
819
- t ? o.add(e) : o.delete(e), Qr(o), kt == null || kt([...o]);
820
- }, [Ft, tr] = R({}), [Ze, en] = R({}), [so, tn] = R(0), $e = $(/* @__PURE__ */ new Map()), [Pe, ye] = R(null), ge = $(0), et = $(null), tt = $(/* @__PURE__ */ new Map()), [St, rr] = R(null), It = $(null), Ae = $(null), [Lt, nr] = R({ top: 0, height: 0 }), M = ae(() => {
821
- const e = r.filter((t) => !Qe.has(t.field)).map((t) => t.type === "sequence" ? { ...t, sortable: !1, filterable: !1, editable: !1, filterRenderer: void 0 } : t);
822
+ const tr = (e) => {
823
+ De.current = e, er(e);
824
+ }, [$e, Jr] = We(C, "", G), [Ne, Xr] = We(oe, {}, W), [Q, Gr] = We(x, ao(_), $), [Tt, Me] = We(ce, 0, de), [H, Qr] = R(vt), Zr = (e) => {
825
+ Qr(e), ke == null || ke(e);
826
+ }, [Ze, en] = R(() => new Set(r.filter((e) => e.hidden).map((e) => e.field))), tn = (e, t) => {
827
+ const o = new Set(Ze);
828
+ t ? o.add(e) : o.delete(e), en(o), wt == null || wt([...o]);
829
+ }, [Ft, rr] = R({}), [et, rn] = R({}), [co, nn] = R(0), Ae = A(/* @__PURE__ */ new Map()), [Pe, ye] = R(null), fe = A(0), tt = A(null), rt = A(/* @__PURE__ */ new Map()), [St, nr] = R(null), It = A(null), Ke = A(null), [Lt, or] = R({ top: 0, height: 0 }), E = se(() => {
830
+ const e = r.filter((t) => !Ze.has(t.field)).map((t) => t.type === "sequence" ? { ...t, sortable: !1, filterable: !1, editable: !1, filterRenderer: void 0 } : t);
822
831
  return [
823
832
  ...e.filter((t) => t.pinned === "left"),
824
833
  ...e.filter((t) => t.pinned !== "left" && t.pinned !== "right"),
825
834
  ...e.filter((t) => t.pinned === "right")
826
835
  ];
827
- }, [r, Qe]), $t = (e) => e.sortable === !0, Q = k === "single" ? "single" : k ? "multiple" : null, Oe = M.length + (Q ? 1 : 0), Me = ae(
828
- () => Ge.map((e, t) => ({ row: e, index: t, id: c ? c(e, t) : t })),
829
- [Ge, c]
830
- ), or = $(/* @__PURE__ */ new Map());
831
- Me.forEach((e) => or.current.set(e.id, e.row));
832
- const rt = ae(
833
- () => Object.entries(De).filter(([e, t]) => {
834
- const o = M.find((s) => s.field === e);
835
- return !!o && !!o.filterable && Br(t);
836
+ }, [r, Ze]), $t = (e) => e.sortable === !0, Z = k === "single" ? "single" : k ? "multiple" : null, Oe = E.length + (Z ? 1 : 0), Ce = se(
837
+ () => Qe.map((e, t) => ({ row: e, index: t, id: c ? c(e, t) : t })),
838
+ [Qe, c]
839
+ ), ir = A(/* @__PURE__ */ new Map());
840
+ Ce.forEach((e) => ir.current.set(e.id, e.row));
841
+ const nt = se(
842
+ () => Object.entries(Ne).filter(([e, t]) => {
843
+ const o = E.find((s) => s.field === e);
844
+ return !!o && !!o.filterable && Yr(t);
836
845
  }),
837
- [De, M]
838
- ), [rn, nn] = R(Le);
839
- U(() => {
840
- if (!W) return;
841
- const e = setTimeout(() => nn(Le), j);
846
+ [Ne, E]
847
+ ), [on, ln] = R($e);
848
+ V(() => {
849
+ if (!m) return;
850
+ const e = setTimeout(() => ln($e), P);
842
851
  return () => clearTimeout(e);
843
- }, [Le, W, j]);
844
- const Ce = W ? rn : Le, ir = (e) => e.filterRenderer ? "text" : Lr(e), he = ae(() => {
845
- if (W) return Me;
846
- const e = Ce.trim().toLowerCase();
847
- let t = Me.filter(({ row: s }) => e && !M.some((i) => We(i, s).toLowerCase().includes(e)) ? !1 : rt.every(([i, l]) => {
848
- const m = M.find((p) => p.field === i);
849
- return Un(ir(m), l, We(m, s), te(s, i));
852
+ }, [$e, m, P]);
853
+ const Ee = m ? on : $e, lr = (e) => e.filterRenderer ? "text" : $r(e), ge = se(() => {
854
+ if (m) return Ce;
855
+ const e = Ee.trim().toLowerCase();
856
+ let t = Ce.filter(({ row: s }) => e && !E.some((i) => je(i, s).toLowerCase().includes(e)) ? !1 : nt.every(([i, l]) => {
857
+ const b = E.find((p) => p.field === i);
858
+ return Hn(lr(b), l, je(b, s), te(s, i));
850
859
  }));
851
- const o = G.map((s) => ({ col: M.find((i) => i.field === s.field), dir: s.direction === "asc" ? 1 : -1 })).filter((s) => !!s.col);
860
+ const o = Q.map((s) => ({ col: E.find((i) => i.field === s.field), dir: s.direction === "asc" ? 1 : -1 })).filter((s) => !!s.col);
852
861
  return o.length && (t = [...t].sort((s, i) => {
853
- for (const { col: l, dir: m } of o) {
854
- const p = te(s.row, l.field), x = te(i.row, l.field), h = p == null || p === "", Y = x == null || x === "";
862
+ for (const { col: l, dir: b } of o) {
863
+ const p = te(s.row, l.field), w = te(i.row, l.field), h = p == null || p === "", Y = w == null || w === "";
855
864
  if (h || Y) {
856
865
  if (h !== Y) return h ? 1 : -1;
857
866
  continue;
858
867
  }
859
- const ee = l.comparator ? l.comparator(p, x, s.row, i.row) : io(p, x, l);
860
- if (ee !== 0) return ee * m;
868
+ const ee = l.comparator ? l.comparator(p, w, s.row, i.row) : so(p, w, l);
869
+ if (ee !== 0) return ee * b;
861
870
  }
862
871
  return 0;
863
872
  })), t;
864
- }, [Me, M, Ce, rt, G, W]), nt = JSON.stringify([Ce, De, G, z]), lr = $(nt);
865
- U(() => {
866
- lr.current !== nt && (lr.current = nt, Ne(0));
867
- }, [nt]);
868
- const Ee = W ? Ve ?? Me.length : he.length, pe = V ? Math.max(1, Math.ceil(Ee / z)) : 1, H = Math.min(Tt, pe - 1), A = V && !W ? he.slice(H * z, H * z + z) : he, on = Ee === 0 ? 0 : V ? H * z + 1 : 1, ln = V ? Math.min(Ee, (H + 1) * z) : Ee, Pt = ae(
873
+ }, [Ce, E, Ee, nt, Q, m]), ot = JSON.stringify([Ee, Ne, Q, H]), sr = A(ot);
874
+ V(() => {
875
+ sr.current !== ot && (sr.current = ot, Me(0));
876
+ }, [ot]);
877
+ const Te = m ? q ?? Ce.length : ge.length, he = U ? Math.max(1, Math.ceil(Te / H)) : 1, J = Math.min(Tt, he - 1), K = U && !m ? ge.slice(J * H, J * H + H) : ge, sn = Te === 0 ? 0 : U ? J * H + 1 : 1, an = U ? Math.min(Te, (J + 1) * H) : Te, At = se(
869
878
  () => ({
870
- sort: G.filter((e) => {
879
+ sort: Q.filter((e) => {
871
880
  const t = r.find((o) => o.field === e.field);
872
881
  return !!t && $t(t);
873
882
  }),
874
- filters: Object.fromEntries(rt),
875
- search: Ce.trim(),
876
- page: H,
877
- pageSize: z
883
+ filters: Object.fromEntries(nt),
884
+ search: Ee.trim(),
885
+ page: J,
886
+ pageSize: H
878
887
  }),
879
888
  // eslint-disable-next-line react-hooks/exhaustive-deps
880
- [G, r, rt, Ce, H, z]
881
- ), sn = JSON.stringify(Pt), ot = $(Pt);
882
- ot.current = Pt;
883
- const it = $(b);
884
- it.current = b;
885
- const [an, lt] = R(!1), [cn, At] = R(!1), Ot = $(0), st = _e((e) => {
889
+ [Q, r, nt, Ee, J, H]
890
+ ), cn = JSON.stringify(At), it = A(At);
891
+ it.current = At;
892
+ const lt = A(I);
893
+ lt.current = I;
894
+ const [dn, st] = R(!1), [un, Pt] = R(!1), Kt = A(0), at = be((e) => {
886
895
  var s;
887
- const t = ++Ot.current, o = (s = it.current) == null ? void 0 : s.call(it, e);
888
- o && typeof o.then == "function" ? (lt(!0), At(!1), o.then(
896
+ const t = ++Kt.current, o = (s = lt.current) == null ? void 0 : s.call(lt, e);
897
+ o && typeof o.then == "function" ? (st(!0), Pt(!1), o.then(
889
898
  () => {
890
- t === Ot.current && lt(!1);
899
+ t === Kt.current && st(!1);
891
900
  },
892
901
  () => {
893
- t === Ot.current && (lt(!1), At(!0));
902
+ t === Kt.current && (st(!1), Pt(!0));
894
903
  }
895
- )) : (lt(!1), At(!1));
904
+ )) : (st(!1), Pt(!1));
896
905
  }, []);
897
- U(() => {
898
- W && st(ot.current);
899
- }, [W, sn, st]), U(() => {
900
- W && V && Tt > pe - 1 && Ne(pe - 1);
901
- }, [W, V, Tt, pe]);
902
- const Kt = K ?? an, sr = (e) => e.map((t) => or.current.get(t)).filter((t) => t !== void 0), [se, at] = Ye(
906
+ V(() => {
907
+ m && at(it.current);
908
+ }, [m, cn, at]), V(() => {
909
+ m && U && Tt > he - 1 && Me(he - 1);
910
+ }, [m, U, Tt, he]);
911
+ const Ot = _e ?? dn, ar = (e) => e.map((t) => ir.current.get(t)).filter((t) => t !== void 0), [le, ct] = We(
903
912
  y,
904
- E ?? [],
905
- (e) => T == null ? void 0 : T({ ids: e, rows: sr(e) })
906
- ), Rt = ae(() => new Set(se), [se]), ct = (e) => w ? w(e) : !0, dt = $(null), ar = $(!1), dn = (e, t) => {
907
- if (!Q || !ct(e.row)) return;
908
- if (Q === "single") {
909
- at(t ? [e.id] : []), dt.current = e.id;
913
+ F ?? [],
914
+ (e) => S == null ? void 0 : S({ ids: e, rows: ar(e) })
915
+ ), Rt = se(() => new Set(le), [le]), dt = (e) => D ? D(e) : !0, ut = A(null), cr = A(!1), fn = (e, t) => {
916
+ if (!Z || !dt(e.row)) return;
917
+ if (Z === "single") {
918
+ ct(t ? [e.id] : []), ut.current = e.id;
910
919
  return;
911
920
  }
912
- const o = new Set(se), s = ar.current && dt.current !== null ? A.findIndex((l) => l.id === dt.current) : -1, i = A.findIndex((l) => l.id === e.id);
921
+ const o = new Set(le), s = cr.current && ut.current !== null ? K.findIndex((l) => l.id === ut.current) : -1, i = K.findIndex((l) => l.id === e.id);
913
922
  if (s >= 0 && i >= 0)
914
923
  for (let l = Math.min(s, i); l <= Math.max(s, i); l++)
915
- ct(A[l].row) && (t ? o.add(A[l].id) : o.delete(A[l].id));
924
+ dt(K[l].row) && (t ? o.add(K[l].id) : o.delete(K[l].id));
916
925
  else t ? o.add(e.id) : o.delete(e.id);
917
- dt.current = e.id, at([...o]);
918
- }, Ke = ae(() => he.filter((e) => ct(e.row)), [he, w]), cr = Ke.filter((e) => Rt.has(e.id)).length, dr = Ke.length > 0 && cr === Ke.length, ur = (e) => {
919
- const t = new Set(se);
920
- Ke.forEach((o) => e ? t.add(o.id) : t.delete(o.id)), at([...t]);
921
- }, ut = (e, t, o) => ({
926
+ ut.current = e.id, ct([...o]);
927
+ }, Re = se(() => ge.filter((e) => dt(e.row)), [ge, D]), dr = Re.filter((e) => Rt.has(e.id)).length, ur = Re.length > 0 && dr === Re.length, fr = (e) => {
928
+ const t = new Set(le);
929
+ Re.forEach((o) => e ? t.add(o.id) : t.delete(o.id)), ct([...t]);
930
+ }, ft = (e, t, o) => ({
922
931
  value: te(t, e.field),
923
- formattedValue: We(e, t),
932
+ formattedValue: je(e, t),
924
933
  row: t,
925
934
  rowIndex: o,
926
935
  field: e.field,
@@ -928,127 +937,127 @@ function fo({
928
937
  }), Bt = (e, t) => {
929
938
  const o = e.editable ?? a;
930
939
  return typeof o == "function" ? o(t) : !!o;
931
- }, ft = (e, t) => Bt(e, t) && !(e.type === "boolean" && !e.cellEditor), un = (e, t) => {
932
- const o = ut(e, t.row, t.index), s = Bt(e, o);
940
+ }, gt = (e, t) => Bt(e, t) && !(e.type === "boolean" && !e.cellEditor), gn = (e, t) => {
941
+ const o = ft(e, t.row, t.index), s = Bt(e, o);
933
942
  return {
934
943
  ...o,
935
944
  editable: s,
936
- updateValue: (i) => s && gr(t, e, { value: i })
945
+ updateValue: (i) => s && hr(t, e, { value: i })
937
946
  };
938
- }, fr = (e, t) => {
947
+ }, gr = (e, t) => {
939
948
  if (!$t(e)) return;
940
- const o = G.find((l) => l.field === e.field), s = o ? o.direction === "asc" ? "desc" : null : "asc";
949
+ const o = Q.find((l) => l.field === e.field), s = o ? o.direction === "asc" ? "desc" : null : "asc";
941
950
  let i;
942
- t && P ? s ? o ? i = G.map((l) => l.field === e.field ? { ...l, direction: s } : l) : i = [...G, { field: e.field, direction: s }] : i = G.filter((l) => l.field !== e.field) : i = s ? [{ field: e.field, direction: s }] : [], Jr(i);
943
- }, gt = (e, t) => {
951
+ t && v ? s ? o ? i = Q.map((l) => l.field === e.field ? { ...l, direction: s } : l) : i = [...Q, { field: e.field, direction: s }] : i = Q.filter((l) => l.field !== e.field) : i = s ? [{ field: e.field, direction: s }] : [], Gr(i);
952
+ }, ht = (e, t) => {
944
953
  var o;
945
- return (o = tt.current.get(Vt(e, t))) == null ? void 0 : o.focus();
946
- }, me = () => {
947
- ge.current += 1, ye(null);
948
- }, fn = (e) => {
949
- for (const t of we.current) {
954
+ return (o = rt.current.get(Ut(e, t))) == null ? void 0 : o.focus();
955
+ }, pe = () => {
956
+ fe.current += 1, ye(null);
957
+ }, hn = (e) => {
958
+ for (const t of De.current) {
950
959
  const o = te(t, e.field);
951
960
  if (o != null && o !== "") return o;
952
961
  }
953
- }, ht = (e, t, o = {}) => {
954
- if (!ft(t, ut(t, e.row, e.index))) return !1;
962
+ }, pt = (e, t, o = {}) => {
963
+ if (!gt(t, ft(t, e.row, e.index))) return !1;
955
964
  const s = te(e.row, t.field);
956
965
  let i;
957
- return t.cellEditor ? i = s : t.type === "date" ? i = Z(s) ?? "" : i = o.text ?? (s == null ? "" : String(s)), et.current = i, ge.current += 1, ye({
966
+ return t.cellEditor ? i = s : t.type === "date" ? i = X(s) ?? "" : i = o.text ?? (s == null ? "" : String(s)), tt.current = i, fe.current += 1, ye({
958
967
  id: e.id,
959
968
  field: t.field,
960
969
  draft: i,
961
- session: ge.current,
970
+ session: fe.current,
962
971
  select: o.select ?? "end",
963
972
  invalid: !1
964
973
  }), !0;
965
- }, gr = (e, t, o) => {
966
- const s = we.current[e.index] ?? e.row, i = te(s, t.field);
974
+ }, hr = (e, t, o) => {
975
+ const s = De.current[e.index] ?? e.row, i = te(s, t.field);
967
976
  let l;
968
977
  if ("value" in o)
969
978
  l = o.value;
970
979
  else if (t.valueParser)
971
980
  l = t.valueParser(o.text, s);
972
981
  else if (t.type === "date") {
973
- if (o.text !== "" && !J(o.text)) return !1;
974
- l = jn(o.text, i ?? fn(t));
982
+ if (o.text !== "" && !z(o.text)) return !1;
983
+ l = Un(o.text, i ?? hn(t));
975
984
  } else if (t.type === "number")
976
985
  if (o.text.trim() === "") l = null;
977
986
  else {
978
- const x = Number(o.text);
979
- if (!Number.isFinite(x)) return !1;
980
- l = x;
987
+ const w = Number(o.text);
988
+ if (!Number.isFinite(w)) return !1;
989
+ l = w;
981
990
  }
982
991
  else
983
992
  l = o.text;
984
993
  if (t.type === "date") {
985
- if (Z(l) === Z(i)) return !0;
986
- const x = Z(l);
987
- if (x && (t.dateMin && x < t.dateMin || t.dateMax && x > t.dateMax)) return !1;
994
+ if (X(l) === X(i)) return !0;
995
+ const w = X(l);
996
+ if (w && (t.dateMin && w < t.dateMin || t.dateMax && w > t.dateMax)) return !1;
988
997
  } else if (Object.is(l, i))
989
998
  return !0;
990
999
  if (t.validate && !t.validate(l, s)) return !1;
991
- const m = Ht(s, t.field, l), p = we.current.map((x, h) => h === e.index ? m : x);
992
- return er(p), f == null || f({ rowId: e.id, rowIndex: e.index, field: t.field, oldValue: i, newValue: l, row: m }), u == null || u(p), !0;
993
- }, hr = (e, t, o) => {
994
- const s = A.findIndex((h) => h.id === e.id), i = M.findIndex((h) => h.field === t);
1000
+ const b = Ht(s, t.field, l), p = De.current.map((w, h) => h === e.index ? b : w);
1001
+ return tr(p), f == null || f({ rowId: e.id, rowIndex: e.index, field: t.field, oldValue: i, newValue: l, row: b }), d == null || d(p), !0;
1002
+ }, pr = (e, t, o) => {
1003
+ const s = K.findIndex((h) => h.id === e.id), i = E.findIndex((h) => h.field === t);
995
1004
  if (s < 0 || i < 0) return null;
996
- const l = (h, Y) => ft(Y, ut(Y, h.row, h.index));
1005
+ const l = (h, Y) => gt(Y, ft(Y, h.row, h.index));
997
1006
  if (o === "down" || o === "up") {
998
1007
  const h = o === "down" ? 1 : -1;
999
- for (let Y = s + h; Y >= 0 && Y < A.length; Y += h)
1000
- if (l(A[Y], M[i])) return { entry: A[Y], col: M[i] };
1008
+ for (let Y = s + h; Y >= 0 && Y < K.length; Y += h)
1009
+ if (l(K[Y], E[i])) return { entry: K[Y], col: E[i] };
1001
1010
  return null;
1002
1011
  }
1003
- const m = o === "right" ? 1 : -1;
1004
- let p = s, x = i + m;
1005
- for (; p >= 0 && p < A.length; ) {
1006
- for (; x >= 0 && x < M.length; ) {
1007
- if (l(A[p], M[x])) return { entry: A[p], col: M[x] };
1008
- x += m;
1012
+ const b = o === "right" ? 1 : -1;
1013
+ let p = s, w = i + b;
1014
+ for (; p >= 0 && p < K.length; ) {
1015
+ for (; w >= 0 && w < E.length; ) {
1016
+ if (l(K[p], E[w])) return { entry: K[p], col: E[w] };
1017
+ w += b;
1009
1018
  }
1010
- p += m, x = m > 0 ? 0 : M.length - 1;
1019
+ p += b, w = b > 0 ? 0 : E.length - 1;
1011
1020
  }
1012
1021
  return null;
1013
1022
  }, ve = (e, t, o, s = {}) => {
1014
1023
  const { move: i = "none", focus: l = !0 } = s;
1015
- if (!gr(e, t, o))
1024
+ if (!hr(e, t, o))
1016
1025
  return ye((p) => p && { ...p, invalid: !0 }), !1;
1017
- const m = i === "none" ? null : hr(e, t.field, i);
1018
- return m ? ht(m.entry, m.col, { select: "all" }) : (me(), l && gt(e.id, t.field)), !0;
1019
- }, pr = (e, t, o) => {
1026
+ const b = i === "none" ? null : pr(e, t.field, i);
1027
+ return b ? pt(b.entry, b.col, { select: "all" }) : (pe(), l && ht(e.id, t.field)), !0;
1028
+ }, mr = (e, t, o) => {
1020
1029
  if (e.nativeEvent.isComposing) return;
1021
1030
  const s = e.currentTarget.value, i = Or(e.currentTarget);
1022
1031
  if (e.key === "Enter") {
1023
- if (e.preventDefault(), i) return ye((m) => m && { ...m, invalid: !0 });
1032
+ if (e.preventDefault(), i) return ye((b) => b && { ...b, invalid: !0 });
1024
1033
  const l = g ? e.shiftKey ? "up" : "down" : "none";
1025
1034
  ve(t, o, { text: s }, { move: l });
1026
1035
  } else if (e.key === "Escape")
1027
- e.preventDefault(), me(), gt(t.id, o.field);
1036
+ e.preventDefault(), pe(), ht(t.id, o.field);
1028
1037
  else if (e.key === "Tab" && !i) {
1029
1038
  const l = e.shiftKey ? "left" : "right";
1030
- hr(t, o.field, l) && (e.preventDefault(), ve(t, o, { text: s }, { move: l }));
1039
+ pr(t, o.field, l) && (e.preventDefault(), ve(t, o, { text: s }, { move: l }));
1031
1040
  }
1032
- }, gn = (e, t) => {
1041
+ }, pn = (e, t) => {
1033
1042
  var l;
1034
- const o = A[e], s = M[t];
1043
+ const o = K[e], s = E[t];
1035
1044
  if (!o || !s) return;
1036
- rr({ id: o.id, field: s.field }), It.current = Vt(o.id, s.field);
1037
- const i = Ae.current;
1038
- if (oe && i) {
1039
- const m = ((l = i.querySelector("thead")) == null ? void 0 : l.clientHeight) ?? 0, p = e * de;
1040
- p < i.scrollTop ? i.scrollTo({ top: p, behavior: "auto" }) : p + de > i.scrollTop + i.clientHeight - m && i.scrollTo({ top: p + de - i.clientHeight + m, behavior: "auto" });
1045
+ nr({ id: o.id, field: s.field }), It.current = Ut(o.id, s.field);
1046
+ const i = Ke.current;
1047
+ if (re && i) {
1048
+ const b = ((l = i.querySelector("thead")) == null ? void 0 : l.clientHeight) ?? 0, p = e * ue;
1049
+ p < i.scrollTop ? i.scrollTo({ top: p, behavior: "auto" }) : p + ue > i.scrollTop + i.clientHeight - b && i.scrollTo({ top: p + ue - i.clientHeight + b, behavior: "auto" });
1041
1050
  }
1042
1051
  };
1043
- U(() => {
1052
+ V(() => {
1044
1053
  const e = It.current;
1045
1054
  if (!e) return;
1046
- const t = tt.current.get(e);
1055
+ const t = rt.current.get(e);
1047
1056
  t && (It.current = null, t.focus());
1048
1057
  });
1049
- const hn = (e, t, o) => {
1050
- if (!wt) return !1;
1051
- let s = A.findIndex((l) => l.id === t.id), i = M.findIndex((l) => l.field === o.field);
1058
+ const mn = (e, t, o) => {
1059
+ if (!kt) return !1;
1060
+ let s = K.findIndex((l) => l.id === t.id), i = E.findIndex((l) => l.field === o.field);
1052
1061
  if (s < 0 || i < 0) return !1;
1053
1062
  switch (e.key) {
1054
1063
  case "ArrowDown":
@@ -1064,105 +1073,105 @@ function fo({
1064
1073
  i -= 1;
1065
1074
  break;
1066
1075
  case "PageDown":
1067
- s += Ar;
1076
+ s += Kr;
1068
1077
  break;
1069
1078
  case "PageUp":
1070
- s -= Ar;
1079
+ s -= Kr;
1071
1080
  break;
1072
1081
  case "Home":
1073
1082
  i = 0, (e.ctrlKey || e.metaKey) && (s = 0);
1074
1083
  break;
1075
1084
  case "End":
1076
- i = M.length - 1, (e.ctrlKey || e.metaKey) && (s = A.length - 1);
1085
+ i = E.length - 1, (e.ctrlKey || e.metaKey) && (s = K.length - 1);
1077
1086
  break;
1078
1087
  default:
1079
1088
  return !1;
1080
1089
  }
1081
- return e.preventDefault(), gn(Math.max(0, Math.min(A.length - 1, s)), Math.max(0, Math.min(M.length - 1, i))), !0;
1082
- }, pn = (e, t, o, s) => {
1083
- e.target === e.currentTarget && (hn(e, t, o) || ft(o, s) && (e.key === "Enter" || e.key === "F2" ? (e.preventDefault(), ht(t, o)) : !o.cellEditor && o.type !== "date" && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (e.preventDefault(), ht(t, o, { text: e.key }))));
1090
+ return e.preventDefault(), pn(Math.max(0, Math.min(K.length - 1, s)), Math.max(0, Math.min(E.length - 1, i))), !0;
1091
+ }, bn = (e, t, o, s) => {
1092
+ e.target === e.currentTarget && (mn(e, t, o) || gt(o, s) && (e.key === "Enter" || e.key === "F2" ? (e.preventDefault(), pt(t, o)) : !o.cellEditor && o.type !== "date" && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (e.preventDefault(), pt(t, o, { text: e.key }))));
1084
1093
  };
1085
- Ut(() => {
1086
- if (!oe || !Ae.current) return;
1087
- const e = Ae.current, t = () => nr((s) => s.height === e.clientHeight ? s : { ...s, height: e.clientHeight });
1094
+ Vt(() => {
1095
+ if (!re || !Ke.current) return;
1096
+ const e = Ke.current, t = () => or((s) => s.height === e.clientHeight ? s : { ...s, height: e.clientHeight });
1088
1097
  if (t(), typeof ResizeObserver > "u") return;
1089
1098
  const o = new ResizeObserver(t);
1090
1099
  return o.observe(e), () => o.disconnect();
1091
- }, [oe]);
1092
- const Re = oe && !Kt && A.length > 0, mn = Lt.height || (typeof Xe == "number" ? Xe : 400), pt = Re ? Math.max(0, Math.floor(Lt.top / de) - Xt) : 0, Yt = Re ? Math.min(A.length, Math.ceil((Lt.top + mn) / de) + Xt) : A.length, bn = Re ? A.slice(pt, Yt) : A, mr = `${H}|${z}|${JSON.stringify(G)}|${Ce}|${JSON.stringify(De)}`, br = $(!0);
1093
- U(() => {
1094
- if (br.current) {
1095
- br.current = !1;
1100
+ }, [re]);
1101
+ const Be = re && !Ot && K.length > 0, _n = Lt.height || (typeof Ge == "number" ? Ge : 400), mt = Be ? Math.max(0, Math.floor(Lt.top / ue) - Gt) : 0, Yt = Be ? Math.min(K.length, Math.ceil((Lt.top + _n) / ue) + Gt) : K.length, yn = Be ? K.slice(mt, Yt) : K, br = `${J}|${H}|${JSON.stringify(Q)}|${Ee}|${JSON.stringify(Ne)}`, _r = A(!0);
1102
+ V(() => {
1103
+ if (_r.current) {
1104
+ _r.current = !1;
1096
1105
  return;
1097
1106
  }
1098
- const e = Ae.current;
1107
+ const e = Ke.current;
1099
1108
  e && typeof e.scrollTo == "function" && e.scrollTop > 0 && e.scrollTo({ top: 0, behavior: "smooth" });
1100
- }, [mr]);
1101
- const Wt = Object.keys(Ft).length > 0, mt = (e) => Ft[e.field] ?? (typeof e.width == "number" ? e.width : oo), _n = (e) => Math.max(40, typeof e.minWidth == "number" ? e.minWidth : 60), yn = (e, t) => {
1109
+ }, [br]);
1110
+ const Wt = Object.keys(Ft).length > 0, bt = (e) => Ft[e.field] ?? (typeof e.width == "number" ? e.width : lo), vn = (e) => Math.max(40, typeof e.minWidth == "number" ? e.minWidth : 60), xn = (e, t) => {
1102
1111
  e.preventDefault(), e.stopPropagation();
1103
1112
  const o = { ...Ft };
1104
- Wt || M.forEach((h) => {
1113
+ Wt || E.forEach((h) => {
1105
1114
  var Y;
1106
- return o[h.field] = ((Y = $e.current.get(h.field)) == null ? void 0 : Y.offsetWidth) ?? mt(h);
1115
+ return o[h.field] = ((Y = Ae.current.get(h.field)) == null ? void 0 : Y.offsetWidth) ?? bt(h);
1107
1116
  });
1108
- const s = e.clientX, i = o[t.field] ?? mt(t), l = e.currentTarget;
1109
- l.setPointerCapture(e.pointerId), tr(o);
1110
- const m = (h) => Math.min(t.maxWidth ?? 1 / 0, Math.max(_n(t), Math.round(h))), p = (h) => tr((Y) => ({ ...Y, [t.field]: m(i + h.clientX - s) })), x = () => {
1111
- l.removeEventListener("pointermove", p), l.removeEventListener("pointerup", x), l.removeEventListener("pointercancel", x);
1117
+ const s = e.clientX, i = o[t.field] ?? bt(t), l = e.currentTarget;
1118
+ l.setPointerCapture(e.pointerId), rr(o);
1119
+ const b = (h) => Math.min(t.maxWidth ?? 1 / 0, Math.max(vn(t), Math.round(h))), p = (h) => rr((Y) => ({ ...Y, [t.field]: b(i + h.clientX - s) })), w = () => {
1120
+ l.removeEventListener("pointermove", p), l.removeEventListener("pointerup", w), l.removeEventListener("pointercancel", w);
1112
1121
  };
1113
- l.addEventListener("pointermove", p), l.addEventListener("pointerup", x), l.addEventListener("pointercancel", x);
1122
+ l.addEventListener("pointermove", p), l.addEventListener("pointerup", w), l.addEventListener("pointercancel", w);
1114
1123
  };
1115
- Ut(() => {
1124
+ Vt(() => {
1116
1125
  var i, l;
1117
1126
  const e = {};
1118
- let t = Q && M.some((m) => m.pinned === "left") ? be : 0;
1119
- for (const m of M)
1120
- m.pinned === "left" && (e[m.field] = t, t += ((i = $e.current.get(m.field)) == null ? void 0 : i.offsetWidth) ?? 0);
1127
+ let t = Z && E.some((b) => b.pinned === "left") ? me : 0;
1128
+ for (const b of E)
1129
+ b.pinned === "left" && (e[b.field] = t, t += ((i = Ae.current.get(b.field)) == null ? void 0 : i.offsetWidth) ?? 0);
1121
1130
  let o = 0;
1122
- for (const m of [...M].reverse())
1123
- m.pinned === "right" && (e[m.field] = o, o += ((l = $e.current.get(m.field)) == null ? void 0 : l.offsetWidth) ?? 0);
1131
+ for (const b of [...E].reverse())
1132
+ b.pinned === "right" && (e[b.field] = o, o += ((l = Ae.current.get(b.field)) == null ? void 0 : l.offsetWidth) ?? 0);
1124
1133
  const s = Object.keys(e);
1125
- (s.length !== Object.keys(Ze).length || s.some((m) => e[m] !== Ze[m])) && en(e);
1126
- }), U(() => {
1127
- const e = () => tn((t) => t + 1);
1134
+ (s.length !== Object.keys(et).length || s.some((b) => e[b] !== et[b])) && rn(e);
1135
+ }), V(() => {
1136
+ const e = () => nn((t) => t + 1);
1128
1137
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
1129
1138
  }, []);
1130
- const _r = M.map((e) => e.pinned).lastIndexOf("left"), vn = M.findIndex((e) => e.pinned === "right"), bt = _r >= 0, yr = (e, t) => ({
1131
- className: e.pinned ? O("rg-grid__pinned", `rg-grid__pinned--${e.pinned}`, t === _r && "rg-grid__pinned--edge", t === vn && "rg-grid__pinned--edge") : void 0,
1132
- style: e.pinned === "left" ? { left: Ze[e.field] ?? 0 } : e.pinned === "right" ? { right: Ze[e.field] ?? 0 } : void 0
1133
- }), vr = typeof ze == "object" ? ze : {}, xr = (e = {}) => {
1134
- const t = { ...vr, ...e }, o = t.scope ?? "filtered", s = o === "page" ? A : o === "selected" ? Me.filter((p) => Rt.has(p.id)) : he, i = t.includeHidden ? r : M, l = i.map((p) => _t(p) || p.field), m = s.map(
1135
- ({ row: p }, x) => i.map((h) => {
1136
- if (h.type === "sequence") return Mr(h, x, o === "page" && V && !h.sequenceRestartEachPage ? H * z : 0);
1139
+ const yr = E.map((e) => e.pinned).lastIndexOf("left"), wn = E.findIndex((e) => e.pinned === "right"), _t = yr >= 0, vr = (e, t) => ({
1140
+ className: e.pinned ? O("rg-grid__pinned", `rg-grid__pinned--${e.pinned}`, t === yr && "rg-grid__pinned--edge", t === wn && "rg-grid__pinned--edge") : void 0,
1141
+ style: e.pinned === "left" ? { left: et[e.field] ?? 0 } : e.pinned === "right" ? { right: et[e.field] ?? 0 } : void 0
1142
+ }), xr = typeof He == "object" ? He : {}, wr = (e = {}) => {
1143
+ const t = { ...xr, ...e }, o = t.scope ?? "filtered", s = o === "page" ? K : o === "selected" ? Ce.filter((p) => Rt.has(p.id)) : ge, i = t.includeHidden ? r : E, l = i.map((p) => yt(p) || p.field), b = s.map(
1144
+ ({ row: p }, w) => i.map((h) => {
1145
+ if (h.type === "sequence") return Cr(h, w, o === "page" && U && !h.sequenceRestartEachPage ? J * H : 0);
1137
1146
  const Y = te(p, h.field);
1138
- return h.exportValue ? h.exportValue(Y, p) : h.type === "date" ? Z(Y) ?? "" : We(h, p);
1147
+ return h.exportValue ? h.exportValue(Y, p) : h.type === "date" ? X(Y) ?? "" : je(h, p);
1139
1148
  })
1140
1149
  );
1141
- return ro(l, m, { sanitize: t.sanitize });
1150
+ return oo(l, b, { sanitize: t.sanitize });
1142
1151
  }, kr = (e = {}) => {
1143
- const t = { ...vr, ...e };
1144
- no(xr(e), `${t.filename ?? "export"}.csv`);
1152
+ const t = { ...xr, ...e };
1153
+ io(wr(e), `${t.filename ?? "export"}.csv`);
1145
1154
  };
1146
- U(() => {
1147
- Ie && (Ie.current = {
1148
- getCsv: xr,
1155
+ V(() => {
1156
+ Le && (Le.current = {
1157
+ getCsv: wr,
1149
1158
  exportCsv: kr,
1150
- getSelectedRows: () => sr(se),
1151
- getSelectedRowIds: () => se,
1152
- selectAll: () => ur(!0),
1153
- clearSelection: () => at([]),
1159
+ getSelectedRows: () => ar(le),
1160
+ getSelectedRowIds: () => le,
1161
+ selectAll: () => fr(!0),
1162
+ clearSelection: () => ct([]),
1154
1163
  refresh: () => {
1155
- W && st(ot.current);
1164
+ m && at(it.current);
1156
1165
  }
1157
1166
  });
1158
- }), U(
1167
+ }), V(
1159
1168
  () => () => {
1160
- Ie && (Ie.current = null);
1169
+ Le && (Le.current = null);
1161
1170
  },
1162
- [Ie]
1171
+ [Le]
1163
1172
  );
1164
- const wr = (e) => {
1165
- var o, s, i, l, m, p, x, h;
1173
+ const Dr = (e) => {
1174
+ var o, s, i, l, b, p, w, h;
1166
1175
  const t = e.checkbox ?? {};
1167
1176
  return {
1168
1177
  variant: t.variant ?? Nt,
@@ -1176,98 +1185,98 @@ function fo({
1176
1185
  label: (l = t.classNames) == null ? void 0 : l.label
1177
1186
  },
1178
1187
  styles: {
1179
- root: { ...L.checkbox, ...(m = t.styles) == null ? void 0 : m.root },
1188
+ root: { ...L.checkbox, ...(b = t.styles) == null ? void 0 : b.root },
1180
1189
  control: { ...L.checkboxControl, ...(p = t.styles) == null ? void 0 : p.control },
1181
- indicator: { ...L.checkboxIndicator, ...(x = t.styles) == null ? void 0 : x.indicator },
1190
+ indicator: { ...L.checkboxIndicator, ...(w = t.styles) == null ? void 0 : w.indicator },
1182
1191
  label: (h = t.styles) == null ? void 0 : h.label
1183
1192
  }
1184
1193
  };
1185
- }, xe = (e) => e.stopPropagation(), xn = (e, t) => /* @__PURE__ */ d("span", { className: "rg-grid__checkbox-cell", onClick: xe, onDoubleClick: xe, children: /* @__PURE__ */ d(
1186
- Fe,
1194
+ }, xe = (e) => e.stopPropagation(), kn = (e, t) => /* @__PURE__ */ u("span", { className: "rg-grid__checkbox-cell", onClick: xe, onDoubleClick: xe, children: /* @__PURE__ */ u(
1195
+ Se,
1187
1196
  {
1188
- ...wr(e),
1197
+ ...Dr(e),
1189
1198
  checked: !!t.value,
1190
1199
  disabled: !t.editable,
1191
- "aria-label": `Toggle ${ke(e)}`,
1200
+ "aria-label": `Toggle ${we(e)}`,
1192
1201
  onChange: (o) => t.updateValue(o)
1193
1202
  }
1194
- ) }), Dr = (e) => he.filter((t) => Bt(e, ut(e, t.row, t.index))), kn = (e, t) => {
1195
- const o = new Map(Dr(e).map((l) => [l.index, l])), s = [], i = we.current.map((l, m) => {
1196
- const p = o.get(m);
1203
+ ) }), Nr = (e) => ge.filter((t) => Bt(e, ft(e, t.row, t.index))), Dn = (e, t) => {
1204
+ const o = new Map(Nr(e).map((l) => [l.index, l])), s = [], i = De.current.map((l, b) => {
1205
+ const p = o.get(b);
1197
1206
  if (!p) return l;
1198
- const x = te(l, e.field);
1199
- if (!!x === t || e.validate && !e.validate(t, l)) return l;
1207
+ const w = te(l, e.field);
1208
+ if (!!w === t || e.validate && !e.validate(t, l)) return l;
1200
1209
  const h = Ht(l, e.field, t);
1201
- return s.push({ rowId: p.id, rowIndex: m, field: e.field, oldValue: x, newValue: t, row: h }), h;
1210
+ return s.push({ rowId: p.id, rowIndex: b, field: e.field, oldValue: w, newValue: t, row: h }), h;
1202
1211
  });
1203
- s.length !== 0 && (er(i), s.forEach((l) => f == null ? void 0 : f(l)), u == null || u(i));
1204
- }, wn = (e) => {
1205
- const t = Dr(e), o = t.length > 0 ? t : he, s = o.filter((l) => !!te(l.row, e.field)).length, i = o.length > 0 && s === o.length;
1206
- return /* @__PURE__ */ d("span", { className: "rg-grid__header-checkbox", onClick: xe, onDoubleClick: xe, children: /* @__PURE__ */ d(
1207
- Fe,
1212
+ s.length !== 0 && (tr(i), s.forEach((l) => f == null ? void 0 : f(l)), d == null || d(i));
1213
+ }, Nn = (e) => {
1214
+ const t = Nr(e), o = t.length > 0 ? t : ge, s = o.filter((l) => !!te(l.row, e.field)).length, i = o.length > 0 && s === o.length;
1215
+ return /* @__PURE__ */ u("span", { className: "rg-grid__header-checkbox", onClick: xe, onDoubleClick: xe, children: /* @__PURE__ */ u(
1216
+ Se,
1208
1217
  {
1209
- ...wr(e),
1218
+ ...Dr(e),
1210
1219
  checked: i,
1211
1220
  indeterminate: s > 0 && !i,
1212
1221
  disabled: t.length === 0,
1213
- label: _t(e) || void 0,
1214
- "aria-label": `Select all ${ke(e)}`,
1215
- onChange: (l) => kn(e, l)
1222
+ label: yt(e) || void 0,
1223
+ "aria-label": `Select all ${we(e)}`,
1224
+ onChange: (l) => Dn(e, l)
1216
1225
  }
1217
1226
  ) });
1218
- }, Dn = (e, t, o) => {
1227
+ }, Mn = (e, t, o) => {
1219
1228
  if (t.cellEditor)
1220
- return /* @__PURE__ */ d(
1229
+ return /* @__PURE__ */ u(
1221
1230
  "div",
1222
1231
  {
1223
1232
  className: "rg-grid__custom-editor",
1224
1233
  onBlur: (i) => {
1225
- i.currentTarget.contains(i.relatedTarget) || o.session === ge.current && (ve(e, t, { value: et.current }, { focus: !1 }) || me());
1234
+ i.currentTarget.contains(i.relatedTarget) || o.session === fe.current && (ve(e, t, { value: tt.current }, { focus: !1 }) || pe());
1226
1235
  },
1227
1236
  onKeyDown: (i) => {
1228
- i.key === "Escape" && (i.preventDefault(), i.stopPropagation(), me(), gt(e.id, t.field));
1237
+ i.key === "Escape" && (i.preventDefault(), i.stopPropagation(), pe(), ht(e.id, t.field));
1229
1238
  },
1230
- children: Te(t.cellEditor, {
1239
+ children: Fe(t.cellEditor, {
1231
1240
  value: o.draft,
1232
1241
  row: e.row,
1233
1242
  rowIndex: e.index,
1234
1243
  field: t.field,
1235
1244
  column: t,
1236
1245
  onChange: (i) => {
1237
- et.current = i, ye((l) => l && l.session === o.session ? { ...l, draft: i, invalid: !1 } : l);
1246
+ tt.current = i, ye((l) => l && l.session === o.session ? { ...l, draft: i, invalid: !1 } : l);
1238
1247
  },
1239
1248
  onCommit: (i, l = "none") => {
1240
- o.session === ge.current && ve(e, t, { value: i === void 0 ? et.current : i }, { move: l });
1249
+ o.session === fe.current && ve(e, t, { value: i === void 0 ? tt.current : i }, { move: l });
1241
1250
  },
1242
1251
  onCancel: () => {
1243
- me(), gt(e.id, t.field);
1252
+ pe(), ht(e.id, t.field);
1244
1253
  }
1245
1254
  })
1246
1255
  }
1247
1256
  );
1248
1257
  const s = t.type === "date";
1249
- return s ? /* @__PURE__ */ d(
1250
- qn,
1258
+ return s ? /* @__PURE__ */ u(
1259
+ Vn,
1251
1260
  {
1252
1261
  value: o.draft === null || o.draft === void 0 ? "" : String(o.draft),
1253
- label: `Edit ${ke(t)}`,
1262
+ label: `Edit ${we(t)}`,
1254
1263
  invalid: o.invalid,
1255
1264
  min: t.dateMin,
1256
1265
  max: t.dateMax,
1257
1266
  locale: t.dateLocale,
1258
- theme: Je,
1267
+ theme: Xe,
1259
1268
  className: O("rg-grid__editor", o.invalid && "rg-grid__editor--invalid", B.editor),
1260
1269
  style: { textAlign: t.align, ...L.editor },
1261
1270
  onChange: (i) => ye((l) => l && { ...l, draft: i, invalid: !1 }),
1262
1271
  onPick: (i) => {
1263
- o.session === ge.current && ve(e, t, { text: i }, { focus: !0 });
1272
+ o.session === fe.current && ve(e, t, { text: i }, { focus: !0 });
1264
1273
  },
1265
1274
  onBlur: (i) => {
1266
- o.session === ge.current && (ve(e, t, { text: i.currentTarget.value }, { focus: !1 }) || me());
1275
+ o.session === fe.current && (ve(e, t, { text: i.currentTarget.value }, { focus: !1 }) || pe());
1267
1276
  },
1268
- onKeyDown: (i) => pr(i, e, t)
1277
+ onKeyDown: (i) => mr(i, e, t)
1269
1278
  }
1270
- ) : /* @__PURE__ */ d(
1279
+ ) : /* @__PURE__ */ u(
1271
1280
  "input",
1272
1281
  {
1273
1282
  autoFocus: !0,
@@ -1278,139 +1287,139 @@ function fo({
1278
1287
  style: { textAlign: t.align, ...L.editor },
1279
1288
  value: o.draft === null || o.draft === void 0 ? "" : String(o.draft),
1280
1289
  inputMode: t.type === "number" ? "decimal" : void 0,
1281
- "aria-label": `Edit ${ke(t)}`,
1290
+ "aria-label": `Edit ${we(t)}`,
1282
1291
  "aria-invalid": o.invalid || void 0,
1283
1292
  onChange: (i) => {
1284
1293
  const l = i.target.value;
1285
- ye((m) => m && { ...m, draft: l, invalid: !1 });
1294
+ ye((b) => b && { ...b, draft: l, invalid: !1 });
1286
1295
  },
1287
1296
  onFocus: (i) => {
1288
1297
  const l = i.currentTarget;
1289
1298
  s || (o.select === "all" ? l.select() : l.setSelectionRange(l.value.length, l.value.length));
1290
1299
  },
1291
1300
  onBlur: (i) => {
1292
- if (o.session === ge.current) {
1293
- if (Or(i.currentTarget)) return me();
1294
- ve(e, t, { text: i.currentTarget.value }, { focus: !1 }) || me();
1301
+ if (o.session === fe.current) {
1302
+ if (Or(i.currentTarget)) return pe();
1303
+ ve(e, t, { text: i.currentTarget.value }, { focus: !1 }) || pe();
1295
1304
  }
1296
1305
  },
1297
- onKeyDown: (i) => pr(i, e, t)
1306
+ onKeyDown: (i) => mr(i, e, t)
1298
1307
  }
1299
1308
  );
1300
- }, Nn = ae(() => {
1309
+ }, Cn = se(() => {
1301
1310
  const e = /* @__PURE__ */ new Map();
1302
- for (const t of M)
1303
- t.filterable && !t.filterRenderer && Lr(t) === "select" && e.set(t.field, zn(t, Ge, (o) => te(o, t.field), (o) => We(t, o)));
1311
+ for (const t of E)
1312
+ t.filterable && !t.filterRenderer && $r(t) === "select" && e.set(t.field, Jn(t, Qe, (o) => te(o, t.field), (o) => je(t, o)));
1304
1313
  return e;
1305
- }, [M, Ge]), Mn = qr || !!He, Cn = He ? { "--rg-stripe-a": He[0], "--rg-stripe-b": He[1] } : void 0, En = V && (ce === "top" || ce === "both"), Tn = V && (ce === "bottom" || ce === "both"), Fn = F || !!Gt || Ue || !!ze, Nr = (e) => /* @__PURE__ */ D(
1314
+ }, [E, Qe]), En = Vr || !!Je, Tn = Je ? { "--rg-stripe-a": Je[0], "--rg-stripe-b": Je[1] } : void 0, Fn = Ve && U && (ae === "top" || ae === "both"), Sn = Ve && U && (ae === "bottom" || ae === "both"), In = Ue && (T || !!Qt || Xt || !!He), Mr = (e) => /* @__PURE__ */ M(
1306
1315
  "div",
1307
1316
  {
1308
1317
  className: O("rg-grid__footer", e === "top" && "rg-grid__footer--top", B.footer),
1309
1318
  style: L.footer,
1310
1319
  "data-position": e,
1311
1320
  children: [
1312
- /* @__PURE__ */ D("span", { ...q("rowCount", "rg-grid__count"), children: [
1313
- Ee === 0 ? "0 rows" : `${on}–${ln} of ${Ee}`,
1314
- Q && se.length > 0 ? ` · ${se.length} selected` : ""
1321
+ /* @__PURE__ */ M("span", { ...j("rowCount", "rg-grid__count"), children: [
1322
+ Te === 0 ? "0 rows" : `${sn}–${an} of ${Te}`,
1323
+ Z && le.length > 0 ? ` · ${le.length} selected` : ""
1315
1324
  ] }),
1316
- /* @__PURE__ */ D("div", { ...q("pagination", "rg-grid__pagination"), children: [
1317
- /* @__PURE__ */ D("label", { className: "rg-grid__page-size-label", children: [
1325
+ /* @__PURE__ */ M("div", { ...j("pagination", "rg-grid__pagination"), children: [
1326
+ /* @__PURE__ */ M("label", { className: "rg-grid__page-size-label", children: [
1318
1327
  "Rows per page",
1319
- /* @__PURE__ */ d("select", { value: z, onChange: (t) => Gr(Number(t.target.value)), ...q("pageSize", "rg-grid__page-size"), children: (Se.includes(z) ? Se : [...Se, z].sort((t, o) => t - o)).map((t) => /* @__PURE__ */ d("option", { value: t, children: t }, t)) })
1328
+ /* @__PURE__ */ u("select", { value: H, onChange: (t) => Zr(Number(t.target.value)), ...j("pageSize", "rg-grid__page-size"), children: (Ie.includes(H) ? Ie : [...Ie, H].sort((t, o) => t - o)).map((t) => /* @__PURE__ */ u("option", { value: t, children: t }, t)) })
1320
1329
  ] }),
1321
- /* @__PURE__ */ d("button", { type: "button", "aria-label": "First page", disabled: H === 0, onClick: () => Ne(0), ...q("pageButton", "rg-grid__page-btn"), children: "«" }),
1322
- /* @__PURE__ */ d("button", { type: "button", "aria-label": "Previous page", disabled: H === 0, onClick: () => Ne(H - 1), ...q("pageButton", "rg-grid__page-btn"), children: "‹" }),
1323
- /* @__PURE__ */ D("span", { ...q("pageInfo", "rg-grid__page-info"), children: [
1330
+ /* @__PURE__ */ u("button", { type: "button", "aria-label": "First page", disabled: J === 0, onClick: () => Me(0), ...j("pageButton", "rg-grid__page-btn"), children: "«" }),
1331
+ /* @__PURE__ */ u("button", { type: "button", "aria-label": "Previous page", disabled: J === 0, onClick: () => Me(J - 1), ...j("pageButton", "rg-grid__page-btn"), children: "‹" }),
1332
+ /* @__PURE__ */ M("span", { ...j("pageInfo", "rg-grid__page-info"), children: [
1324
1333
  "Page ",
1325
- H + 1,
1334
+ J + 1,
1326
1335
  " of ",
1327
- pe
1336
+ he
1328
1337
  ] }),
1329
- /* @__PURE__ */ d("button", { type: "button", "aria-label": "Next page", disabled: H >= pe - 1, onClick: () => Ne(H + 1), ...q("pageButton", "rg-grid__page-btn"), children: "›" }),
1330
- /* @__PURE__ */ d("button", { type: "button", "aria-label": "Last page", disabled: H >= pe - 1, onClick: () => Ne(pe - 1), ...q("pageButton", "rg-grid__page-btn"), children: "»" })
1338
+ /* @__PURE__ */ u("button", { type: "button", "aria-label": "Next page", disabled: J >= he - 1, onClick: () => Me(J + 1), ...j("pageButton", "rg-grid__page-btn"), children: "›" }),
1339
+ /* @__PURE__ */ u("button", { type: "button", "aria-label": "Last page", disabled: J >= he - 1, onClick: () => Me(he - 1), ...j("pageButton", "rg-grid__page-btn"), children: "»" })
1331
1340
  ] })
1332
1341
  ]
1333
1342
  }
1334
- ), Sn = (e) => /* @__PURE__ */ d("tr", { className: "rg-grid__tr rg-grid__skeleton-row", "aria-hidden": "true", style: oe ? { height: de } : void 0, children: fe ? (
1343
+ ), Ln = (e) => /* @__PURE__ */ u("tr", { className: "rg-grid__tr rg-grid__skeleton-row", "aria-hidden": "true", style: re ? { height: ue } : void 0, children: ze ? (
1335
1344
  // A custom component draws the whole row content inside one wide cell
1336
- /* @__PURE__ */ d("td", { colSpan: Oe, className: "rg-grid__td rg-grid__skeleton-cell", children: Te(fe, { rowIndex: e, columns: M }) })
1337
- ) : /* @__PURE__ */ D(je, { children: [
1338
- Q && /* @__PURE__ */ d("td", { className: "rg-grid__td", children: /* @__PURE__ */ d("span", { ...q("skeleton", "rg-grid__skeleton"), style: { ...L.skeleton, width: 18 } }) }),
1339
- M.map((t, o) => /* @__PURE__ */ d("td", { className: "rg-grid__td", style: { textAlign: t.align }, children: /* @__PURE__ */ d("span", { ...q("skeleton", "rg-grid__skeleton"), style: { ...L.skeleton, width: `${55 + (e * 7 + o * 13) % 35}%` } }) }, t.field))
1340
- ] }) }, `sk${e}`), Mr = (e, t, o = V && !e.sequenceRestartEachPage ? H * z : 0) => (e.sequenceStart ?? 1) + o + t, In = (e, t) => {
1341
- const { row: o, id: s, index: i } = e, l = typeof Ct == "function" ? Ct(o, i) : Ct, m = typeof Et == "function" ? Et(o, i) : Et, p = Rt.has(s), x = typeof Mt == "function" ? Mt(o, i) : Mt;
1342
- return /* @__PURE__ */ D(
1345
+ /* @__PURE__ */ u("td", { colSpan: Oe, className: "rg-grid__td rg-grid__skeleton-cell", children: Fe(ze, { rowIndex: e, columns: E }) })
1346
+ ) : /* @__PURE__ */ M(qe, { children: [
1347
+ Z && /* @__PURE__ */ u("td", { className: "rg-grid__td", children: /* @__PURE__ */ u("span", { ...j("skeleton", "rg-grid__skeleton"), style: { ...L.skeleton, width: 18 } }) }),
1348
+ E.map((t, o) => /* @__PURE__ */ u("td", { className: "rg-grid__td", style: { textAlign: t.align }, children: /* @__PURE__ */ u("span", { ...j("skeleton", "rg-grid__skeleton"), style: { ...L.skeleton, width: `${55 + (e * 7 + o * 13) % 35}%` } }) }, t.field))
1349
+ ] }) }, `sk${e}`), Cr = (e, t, o = U && !e.sequenceRestartEachPage ? J * H : 0) => (e.sequenceStart ?? 1) + o + t, $n = (e, t) => {
1350
+ const { row: o, id: s, index: i } = e, l = typeof Ct == "function" ? Ct(o, i) : Ct, b = typeof Et == "function" ? Et(o, i) : Et, p = Rt.has(s), w = typeof Mt == "function" ? Mt(o, i) : Mt;
1351
+ return /* @__PURE__ */ M(
1343
1352
  "tr",
1344
1353
  {
1345
1354
  onClick: Dt ? () => Dt(o, i) : void 0,
1346
- "aria-selected": Q ? p : void 0,
1355
+ "aria-selected": Z ? p : void 0,
1347
1356
  className: O(
1348
1357
  "rg-grid__tr",
1349
1358
  "rg-grid__row",
1350
- Mn && (t % 2 === 0 ? "rg-grid__row--stripe-a" : "rg-grid__row--stripe-b"),
1359
+ En && (t % 2 === 0 ? "rg-grid__row--stripe-a" : "rg-grid__row--stripe-b"),
1351
1360
  // A custom animation class replaces the built-in slide-up. Rows are not animated while virtualizing.
1352
- Qt && !oe && (x || "rg-grid__row--enter"),
1361
+ Zt && !re && (w || "rg-grid__row--enter"),
1353
1362
  p && "rg-grid__row--selected",
1354
1363
  Dt && "rg-grid__row--clickable",
1355
1364
  B.row,
1356
1365
  l
1357
1366
  ),
1358
1367
  style: {
1359
- ...Qt && !oe ? { "--rg-i": Math.min(t, 24) } : null,
1360
- ...oe ? { height: de } : null,
1368
+ ...Zt && !re ? { "--rg-i": Math.min(t, 24) } : null,
1369
+ ...re ? { height: ue } : null,
1361
1370
  ...L.row,
1362
- ...m
1371
+ ...b
1363
1372
  },
1364
1373
  children: [
1365
- Q && /* @__PURE__ */ d(
1374
+ Z && /* @__PURE__ */ u(
1366
1375
  "td",
1367
1376
  {
1368
- className: O("rg-grid__td rg-grid__select-cell", bt && "rg-grid__pinned rg-grid__pinned--left"),
1369
- style: { width: be, minWidth: be, maxWidth: be, ...bt ? { left: 0 } : null },
1377
+ className: O("rg-grid__td rg-grid__select-cell", _t && "rg-grid__pinned rg-grid__pinned--left"),
1378
+ style: { width: me, minWidth: me, maxWidth: me, ..._t ? { left: 0 } : null },
1370
1379
  onClick: xe,
1371
- children: /* @__PURE__ */ d("span", { className: "rg-grid__checkbox-cell", onClickCapture: (h) => ar.current = h.shiftKey, children: /* @__PURE__ */ d(
1372
- Fe,
1380
+ children: /* @__PURE__ */ u("span", { className: "rg-grid__checkbox-cell", onClickCapture: (h) => cr.current = h.shiftKey, children: /* @__PURE__ */ u(
1381
+ Se,
1373
1382
  {
1374
1383
  variant: Nt,
1375
1384
  checked: p,
1376
- disabled: !ct(o),
1377
- "aria-label": Q === "single" ? "Select row" : `Select row ${i + 1}`,
1378
- onChange: (h) => dn(e, h),
1385
+ disabled: !dt(o),
1386
+ "aria-label": Z === "single" ? "Select row" : `Select row ${i + 1}`,
1387
+ onChange: (h) => fn(e, h),
1379
1388
  classNames: { root: B.checkbox, control: B.checkboxControl, indicator: B.checkboxIndicator },
1380
1389
  styles: { root: L.checkbox, control: L.checkboxControl, indicator: L.checkboxIndicator }
1381
1390
  }
1382
1391
  ) })
1383
1392
  }
1384
1393
  ),
1385
- M.map((h, Y) => {
1386
- let ee = un(h, e);
1394
+ E.map((h, Y) => {
1395
+ let ee = gn(h, e);
1387
1396
  if (h.type === "sequence") {
1388
- const ie = Mr(h, t);
1389
- ee = { ...ee, value: ie, formattedValue: h.valueFormatter ? h.valueFormatter(ie, o) : String(ie), editable: !1 };
1397
+ const ne = Cr(h, t);
1398
+ ee = { ...ee, value: ne, formattedValue: h.valueFormatter ? h.valueFormatter(ne, o) : String(ne), editable: !1 };
1390
1399
  }
1391
- const $n = typeof h.cellClassName == "function" ? h.cellClassName(ee) : h.cellClassName, Pn = typeof h.cellStyle == "function" ? h.cellStyle(ee) : h.cellStyle, Cr = Pe !== null && Pe.id === s && Pe.field === h.field, jt = ft(h, ee), Er = yr(h, Y), An = St ? St.id === s && St.field === h.field : t === 0 && Y === 0;
1392
- return /* @__PURE__ */ d(
1400
+ const Pn = typeof h.cellClassName == "function" ? h.cellClassName(ee) : h.cellClassName, Kn = typeof h.cellStyle == "function" ? h.cellStyle(ee) : h.cellStyle, Er = Pe !== null && Pe.id === s && Pe.field === h.field, jt = gt(h, ee), Tr = vr(h, Y), On = St ? St.id === s && St.field === h.field : t === 0 && Y === 0;
1401
+ return /* @__PURE__ */ u(
1393
1402
  "td",
1394
1403
  {
1395
- ref: (ie) => {
1396
- const Tr = Vt(s, h.field);
1397
- ie ? tt.current.set(Tr, ie) : tt.current.delete(Tr);
1404
+ ref: (ne) => {
1405
+ const Fr = Ut(s, h.field);
1406
+ ne ? rt.current.set(Fr, ne) : rt.current.delete(Fr);
1398
1407
  },
1399
- tabIndex: wt ? An ? 0 : -1 : jt ? 0 : void 0,
1400
- onFocus: wt ? (ie) => ie.target === ie.currentTarget && rr({ id: s, field: h.field }) : void 0,
1401
- onDoubleClick: jt ? () => ht(e, h) : void 0,
1402
- onKeyDown: (ie) => pn(ie, e, h, ee),
1408
+ tabIndex: kt ? On ? 0 : -1 : jt ? 0 : void 0,
1409
+ onFocus: kt ? (ne) => ne.target === ne.currentTarget && nr({ id: s, field: h.field }) : void 0,
1410
+ onDoubleClick: jt ? () => pt(e, h) : void 0,
1411
+ onKeyDown: (ne) => bn(ne, e, h, ee),
1403
1412
  className: O(
1404
1413
  "rg-grid__td",
1405
1414
  jt && "rg-grid__td--editable",
1406
- Cr && "rg-grid__td--editing",
1407
- Er.className,
1415
+ Er && "rg-grid__td--editing",
1416
+ Tr.className,
1408
1417
  B.cell,
1409
1418
  h.className,
1410
- $n
1419
+ Pn
1411
1420
  ),
1412
- style: { textAlign: h.align, ...L.cell, ...h.style, ...Pn, ...Er.style },
1413
- children: Cr && Pe ? Dn(e, h, Pe) : h.cellRenderer ? Te(h.cellRenderer, ee) : h.type === "boolean" && !h.cellEditor ? xn(h, ee) : ee.formattedValue
1421
+ style: { textAlign: h.align, ...L.cell, ...h.style, ...Kn, ...Tr.style },
1422
+ children: Er && Pe ? Mn(e, h, Pe) : h.cellRenderer ? Fe(h.cellRenderer, ee) : h.type === "boolean" && !h.cellEditor ? kn(h, ee) : ee.formattedValue
1414
1423
  },
1415
1424
  h.field
1416
1425
  );
@@ -1419,133 +1428,133 @@ function fo({
1419
1428
  },
1420
1429
  s
1421
1430
  );
1422
- }, Ln = le ?? (V ? Math.min(z, 20) : 5);
1423
- return /* @__PURE__ */ D(
1431
+ }, An = xt ?? (U ? Math.min(H, 20) : 5);
1432
+ return /* @__PURE__ */ M(
1424
1433
  "div",
1425
1434
  {
1426
- className: O("rg-grid", oe && "rg-grid--virtual", B.root, Vr),
1427
- style: { ...Cn, ...L.root, ...Ur },
1428
- "data-rg-theme": Je || void 0,
1429
- "aria-busy": Kt || void 0,
1435
+ className: O("rg-grid", re && "rg-grid--virtual", B.root, zr),
1436
+ style: { ...Tn, ...L.root, ...Hr },
1437
+ "data-rg-theme": Xe || void 0,
1438
+ "aria-busy": Ot || void 0,
1430
1439
  children: [
1431
- Fn && /* @__PURE__ */ D("div", { ...q("toolbar", "rg-grid__toolbar"), children: [
1432
- /* @__PURE__ */ D("div", { className: "rg-grid__toolbar-left", children: [
1433
- F && /* @__PURE__ */ d(
1440
+ In && /* @__PURE__ */ M("div", { ...j("toolbar", "rg-grid__toolbar"), children: [
1441
+ /* @__PURE__ */ M("div", { className: "rg-grid__toolbar-left", children: [
1442
+ T && /* @__PURE__ */ u(
1434
1443
  "input",
1435
1444
  {
1436
1445
  type: "search",
1437
- value: Le,
1438
- onChange: (e) => zr(e.target.value),
1446
+ value: $e,
1447
+ onChange: (e) => Jr(e.target.value),
1439
1448
  placeholder: N,
1440
1449
  "aria-label": "Search all columns",
1441
- ...q("search", "rg-grid__search")
1450
+ ...j("search", "rg-grid__search")
1442
1451
  }
1443
1452
  ),
1444
- Q && se.length > 0 && /* @__PURE__ */ D("span", { className: "rg-grid__selected-count", role: "status", children: [
1445
- se.length,
1453
+ Z && le.length > 0 && /* @__PURE__ */ M("span", { className: "rg-grid__selected-count", role: "status", children: [
1454
+ le.length,
1446
1455
  " selected"
1447
1456
  ] })
1448
1457
  ] }),
1449
- /* @__PURE__ */ D("div", { className: "rg-grid__toolbar-actions", children: [
1450
- Gt,
1451
- Ue && /* @__PURE__ */ d(
1452
- Zn,
1458
+ /* @__PURE__ */ M("div", { className: "rg-grid__toolbar-actions", children: [
1459
+ Qt,
1460
+ Xt && /* @__PURE__ */ u(
1461
+ to,
1453
1462
  {
1454
1463
  columns: r,
1455
- hidden: Qe,
1456
- onToggle: Zr,
1457
- theme: Je,
1464
+ hidden: Ze,
1465
+ onToggle: tn,
1466
+ theme: Xe,
1458
1467
  className: B.toolButton,
1459
1468
  style: L.toolButton
1460
1469
  }
1461
1470
  ),
1462
- ze && /* @__PURE__ */ d("button", { type: "button", onClick: () => kr(), ...q("toolButton", "rg-grid__tool-btn"), children: "Export CSV" })
1471
+ He && /* @__PURE__ */ u("button", { type: "button", onClick: () => kr(), ...j("toolButton", "rg-grid__tool-btn"), children: "Export CSV" })
1463
1472
  ] })
1464
1473
  ] }),
1465
- En && Nr("top"),
1466
- /* @__PURE__ */ d(
1474
+ Fn && Mr("top"),
1475
+ /* @__PURE__ */ u(
1467
1476
  "div",
1468
1477
  {
1469
- ref: Ae,
1470
- ...q("scroll", "rg-grid__scroll"),
1471
- onScroll: oe ? (e) => nr({ top: e.currentTarget.scrollTop, height: e.currentTarget.clientHeight }) : void 0,
1472
- style: { ...L.scroll, ...Xe !== void 0 ? { maxHeight: Xe } : oe ? { maxHeight: 400 } : null },
1473
- children: /* @__PURE__ */ D(
1478
+ ref: Ke,
1479
+ ...j("scroll", "rg-grid__scroll"),
1480
+ onScroll: re ? (e) => or({ top: e.currentTarget.scrollTop, height: e.currentTarget.clientHeight }) : void 0,
1481
+ style: { ...L.scroll, ...Ge !== void 0 ? { maxHeight: Ge } : re ? { maxHeight: 400 } : null },
1482
+ children: /* @__PURE__ */ M(
1474
1483
  "table",
1475
1484
  {
1476
- ...q("table", "rg-grid__table"),
1485
+ ...j("table", "rg-grid__table"),
1477
1486
  role: "grid",
1478
1487
  style: Wt ? {
1479
1488
  ...L.table,
1480
1489
  tableLayout: "fixed",
1481
- width: M.reduce((e, t) => e + mt(t), Q ? be : 0),
1490
+ width: E.reduce((e, t) => e + bt(t), Z ? me : 0),
1482
1491
  minWidth: "100%"
1483
1492
  } : L.table,
1484
1493
  children: [
1485
- /* @__PURE__ */ d("thead", { ...q("thead", "rg-grid__thead"), children: /* @__PURE__ */ D("tr", { ...q("headerRow", "rg-grid__tr"), children: [
1486
- Q && /* @__PURE__ */ d(
1494
+ /* @__PURE__ */ u("thead", { ...j("thead", "rg-grid__thead"), children: /* @__PURE__ */ M("tr", { ...j("headerRow", "rg-grid__tr"), children: [
1495
+ Z && /* @__PURE__ */ u(
1487
1496
  "th",
1488
1497
  {
1489
1498
  scope: "col",
1490
- className: O("rg-grid__th rg-grid__select-cell", bt && "rg-grid__pinned rg-grid__pinned--left", B.headerCell),
1491
- style: { width: be, minWidth: be, maxWidth: be, ...bt ? { left: 0 } : null, ...L.headerCell },
1492
- children: Q === "multiple" && /* @__PURE__ */ d("span", { className: "rg-grid__checkbox-cell", children: /* @__PURE__ */ d(
1493
- Fe,
1499
+ className: O("rg-grid__th rg-grid__select-cell", _t && "rg-grid__pinned rg-grid__pinned--left", B.headerCell),
1500
+ style: { width: me, minWidth: me, maxWidth: me, ..._t ? { left: 0 } : null, ...L.headerCell },
1501
+ children: Z === "multiple" && /* @__PURE__ */ u("span", { className: "rg-grid__checkbox-cell", children: /* @__PURE__ */ u(
1502
+ Se,
1494
1503
  {
1495
1504
  variant: Nt,
1496
- checked: dr,
1497
- indeterminate: cr > 0 && !dr,
1498
- disabled: Ke.length === 0,
1505
+ checked: ur,
1506
+ indeterminate: dr > 0 && !ur,
1507
+ disabled: Re.length === 0,
1499
1508
  "aria-label": "Select all rows",
1500
- onChange: ur,
1509
+ onChange: fr,
1501
1510
  classNames: { root: B.checkbox, control: B.checkboxControl, indicator: B.checkboxIndicator },
1502
1511
  styles: { root: L.checkbox, control: L.checkboxControl, indicator: L.checkboxIndicator }
1503
1512
  }
1504
1513
  ) })
1505
1514
  }
1506
1515
  ),
1507
- M.map((e, t) => {
1508
- const o = G.findIndex((p) => p.field === e.field), s = o >= 0 ? G[o].direction : null, i = $t(e), l = ir(e), m = yr(e, t);
1509
- return /* @__PURE__ */ D(
1516
+ E.map((e, t) => {
1517
+ const o = Q.findIndex((p) => p.field === e.field), s = o >= 0 ? Q[o].direction : null, i = $t(e), l = lr(e), b = vr(e, t);
1518
+ return /* @__PURE__ */ M(
1510
1519
  "th",
1511
1520
  {
1512
1521
  ref: (p) => {
1513
- p ? $e.current.set(e.field, p) : $e.current.delete(e.field);
1522
+ p ? Ae.current.set(e.field, p) : Ae.current.delete(e.field);
1514
1523
  },
1515
1524
  scope: "col",
1516
1525
  "aria-sort": s ? s === "asc" ? "ascending" : "descending" : i ? "none" : void 0,
1517
1526
  tabIndex: i ? 0 : void 0,
1518
- onClick: (p) => fr(e, p.shiftKey),
1527
+ onClick: (p) => gr(e, p.shiftKey),
1519
1528
  onKeyDown: (p) => {
1520
- i && p.target === p.currentTarget && (p.key === "Enter" || p.key === " ") && (p.preventDefault(), fr(e, p.shiftKey));
1529
+ i && p.target === p.currentTarget && (p.key === "Enter" || p.key === " ") && (p.preventDefault(), gr(e, p.shiftKey));
1521
1530
  },
1522
- className: O("rg-grid__th", i && "rg-grid__th--sortable", m.className, B.headerCell, e.className, e.headerClassName),
1531
+ className: O("rg-grid__th", i && "rg-grid__th--sortable", b.className, B.headerCell, e.className, e.headerClassName),
1523
1532
  style: {
1524
- width: Wt ? mt(e) : e.width,
1533
+ width: Wt ? bt(e) : e.width,
1525
1534
  minWidth: e.minWidth,
1526
1535
  textAlign: e.align,
1527
1536
  ...L.headerCell,
1528
1537
  ...e.style,
1529
1538
  ...e.headerStyle,
1530
- ...m.style
1539
+ ...b.style
1531
1540
  },
1532
1541
  children: [
1533
- /* @__PURE__ */ D("span", { className: "rg-grid__th-content", children: [
1534
- e.headerRenderer ? Te(e.headerRenderer, { column: e, sortDirection: s }) : e.headerCheckbox && e.type === "boolean" ? wn(e) : _t(e),
1535
- e.filterable && /* @__PURE__ */ d(
1536
- Qn,
1542
+ /* @__PURE__ */ M("span", { className: "rg-grid__th-content", children: [
1543
+ e.headerRenderer ? Fe(e.headerRenderer, { column: e, sortDirection: s }) : e.headerCheckbox && e.type === "boolean" ? Nn(e) : yt(e),
1544
+ e.filterable && /* @__PURE__ */ u(
1545
+ eo,
1537
1546
  {
1538
1547
  column: e,
1539
- label: ke(e),
1548
+ label: we(e),
1540
1549
  kind: l,
1541
- value: De[e.field],
1550
+ value: Ne[e.field],
1542
1551
  onChange: (p) => {
1543
- const x = { ...De };
1544
- p === void 0 ? delete x[e.field] : x[e.field] = p, Hr(x);
1552
+ const w = { ...Ne };
1553
+ p === void 0 ? delete w[e.field] : w[e.field] = p, Xr(w);
1545
1554
  },
1546
- options: Nn.get(e.field) ?? [],
1547
- debounce: e.filterDebounce ?? I,
1548
- theme: Je,
1555
+ options: Cn.get(e.field) ?? [],
1556
+ debounce: e.filterDebounce ?? ie,
1557
+ theme: Xe,
1549
1558
  indicatorClassName: O(B.filterIndicator, e.filterIndicatorClassName),
1550
1559
  indicatorStyle: { ...L.filterIndicator, ...e.filterIndicatorStyle },
1551
1560
  popupClassName: O(B.filterPopup, e.filterPopupClassName),
@@ -1554,19 +1563,19 @@ function fo({
1554
1563
  inputStyle: L.filterInput
1555
1564
  }
1556
1565
  ),
1557
- i && /* @__PURE__ */ D("span", { className: "rg-grid__sort", "aria-hidden": "true", children: [
1566
+ i && /* @__PURE__ */ M("span", { className: "rg-grid__sort", "aria-hidden": "true", children: [
1558
1567
  s === "asc" ? "▲" : s === "desc" ? "▼" : "↕",
1559
- s && G.length > 1 && /* @__PURE__ */ d("sup", { className: "rg-grid__sort-order", children: o + 1 })
1568
+ s && Q.length > 1 && /* @__PURE__ */ u("sup", { className: "rg-grid__sort-order", children: o + 1 })
1560
1569
  ] })
1561
1570
  ] }),
1562
- e.resizable && /* @__PURE__ */ d(
1571
+ e.resizable && /* @__PURE__ */ u(
1563
1572
  "span",
1564
1573
  {
1565
1574
  className: "rg-grid__resizer",
1566
1575
  role: "separator",
1567
1576
  "aria-orientation": "vertical",
1568
- "aria-label": `Resize ${ke(e)}`,
1569
- onPointerDown: (p) => yn(p, e),
1577
+ "aria-label": `Resize ${we(e)}`,
1578
+ onPointerDown: (p) => xn(p, e),
1570
1579
  onClick: xe,
1571
1580
  onDoubleClick: xe
1572
1581
  }
@@ -1577,26 +1586,26 @@ function fo({
1577
1586
  );
1578
1587
  })
1579
1588
  ] }) }),
1580
- /* @__PURE__ */ d("tbody", { ...q("tbody", "rg-grid__tbody"), children: Kt ? Array.from({ length: Ln }, (e, t) => Sn(t)) : cn ? /* @__PURE__ */ d("tr", { children: /* @__PURE__ */ D("td", { colSpan: Oe, ...q("empty", "rg-grid__empty rg-grid__error"), role: "alert", children: [
1581
- xt,
1589
+ /* @__PURE__ */ u("tbody", { ...j("tbody", "rg-grid__tbody"), children: Ot ? Array.from({ length: An }, (e, t) => Ln(t)) : un ? /* @__PURE__ */ u("tr", { children: /* @__PURE__ */ M("td", { colSpan: Oe, ...j("empty", "rg-grid__empty rg-grid__error"), role: "alert", children: [
1590
+ qr,
1582
1591
  " ",
1583
- /* @__PURE__ */ d("button", { type: "button", className: "rg-grid__tool-btn", onClick: () => st(ot.current), children: "Retry" })
1584
- ] }) }) : A.length === 0 ? /* @__PURE__ */ d("tr", { children: /* @__PURE__ */ d("td", { colSpan: Oe, ...q("empty", "rg-grid__empty"), children: jr }) }) : /* @__PURE__ */ D(je, { children: [
1585
- Re && pt > 0 && /* @__PURE__ */ d("tr", { "aria-hidden": "true", className: "rg-grid__spacer", children: /* @__PURE__ */ d("td", { colSpan: Oe, style: { height: pt * de } }) }),
1586
- bn.map((e, t) => In(e, pt + t)),
1587
- Re && Yt < A.length && /* @__PURE__ */ d("tr", { "aria-hidden": "true", className: "rg-grid__spacer", children: /* @__PURE__ */ d("td", { colSpan: Oe, style: { height: (A.length - Yt) * de } }) })
1588
- ] }) }, mr)
1592
+ /* @__PURE__ */ u("button", { type: "button", className: "rg-grid__tool-btn", onClick: () => at(it.current), children: "Retry" })
1593
+ ] }) }) : K.length === 0 ? /* @__PURE__ */ u("tr", { children: /* @__PURE__ */ u("td", { colSpan: Oe, ...j("empty", "rg-grid__empty"), children: Ur }) }) : /* @__PURE__ */ M(qe, { children: [
1594
+ Be && mt > 0 && /* @__PURE__ */ u("tr", { "aria-hidden": "true", className: "rg-grid__spacer", children: /* @__PURE__ */ u("td", { colSpan: Oe, style: { height: mt * ue } }) }),
1595
+ yn.map((e, t) => $n(e, mt + t)),
1596
+ Be && Yt < K.length && /* @__PURE__ */ u("tr", { "aria-hidden": "true", className: "rg-grid__spacer", children: /* @__PURE__ */ u("td", { colSpan: Oe, style: { height: (K.length - Yt) * ue } }) })
1597
+ ] }) }, br)
1589
1598
  ]
1590
1599
  }
1591
1600
  )
1592
1601
  }
1593
1602
  ),
1594
- Tn && Nr("bottom")
1603
+ Sn && Mr("bottom")
1595
1604
  ]
1596
1605
  }
1597
1606
  );
1598
1607
  }
1599
1608
  export {
1600
- Fe as Checkbox,
1601
- fo as DataGrid
1609
+ Se as Checkbox,
1610
+ ho as DataGrid
1602
1611
  };