@geovi/the-datagrid 0.0.13 → 0.1.0

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.
Files changed (48) hide show
  1. package/dist/base.css +1 -1
  2. package/dist/components.js +7 -5
  3. package/dist/grid/ReactDataGrid.d.ts.map +1 -1
  4. package/dist/grid/components/ColumnGroupHeaderCell.d.ts.map +1 -1
  5. package/dist/grid/components/FilterCell.d.ts.map +1 -1
  6. package/dist/grid/components/GridBody.d.ts.map +1 -1
  7. package/dist/grid/components/GridHeader.d.ts.map +1 -1
  8. package/dist/grid/components/HeaderCell.d.ts +6 -0
  9. package/dist/grid/components/HeaderCell.d.ts.map +1 -1
  10. package/dist/grid/hooks/useGridColumnResize.d.ts +3 -1
  11. package/dist/grid/hooks/useGridColumnResize.d.ts.map +1 -1
  12. package/dist/grid/utils/columnGroups.d.ts +8 -1
  13. package/dist/grid/utils/columnGroups.d.ts.map +1 -1
  14. package/dist/grid/utils/liveColumnResize.d.ts +21 -1
  15. package/dist/grid/utils/liveColumnResize.d.ts.map +1 -1
  16. package/dist/grid/utils/lockedColumns.d.ts +37 -2
  17. package/dist/grid/utils/lockedColumns.d.ts.map +1 -1
  18. package/dist/index.cjs +13 -13
  19. package/dist/index.css +1 -1
  20. package/dist/index.js +9429 -9235
  21. package/dist/providers/index.d.ts +2 -2
  22. package/dist/providers/index.d.ts.map +1 -1
  23. package/dist/style/theme/amber-dark/index.css +1 -1
  24. package/dist/style/theme/amber-light/index.css +1 -1
  25. package/dist/style/theme/blue-dark/index.css +1 -1
  26. package/dist/style/theme/blue-light/index.css +1 -1
  27. package/dist/style/theme/default-dark/index.css +1 -1
  28. package/dist/style/theme/default-light/index.css +1 -1
  29. package/dist/style/theme/green-dark/index.css +1 -1
  30. package/dist/style/theme/green-light/index.css +1 -1
  31. package/dist/style/theme/pink-dark/index.css +1 -1
  32. package/dist/style/theme/pink-light/index.css +1 -1
  33. package/dist/toolbar/RDGToolbar.d.ts +2 -15
  34. package/dist/toolbar/RDGToolbar.d.ts.map +1 -1
  35. package/dist/toolbar/RDGToolbarProvider.d.ts +12 -0
  36. package/dist/toolbar/RDGToolbarProvider.d.ts.map +1 -1
  37. package/dist/toolbar/api.d.ts +65 -0
  38. package/dist/toolbar/api.d.ts.map +1 -0
  39. package/dist/toolbar/columns.d.ts +12 -0
  40. package/dist/toolbar/columns.d.ts.map +1 -0
  41. package/dist/toolbar/export.d.ts +57 -0
  42. package/dist/toolbar/export.d.ts.map +1 -1
  43. package/dist/toolbar/index.d.ts +4 -2
  44. package/dist/toolbar/index.d.ts.map +1 -1
  45. package/dist/toolbar/store.d.ts +14 -0
  46. package/dist/toolbar/store.d.ts.map +1 -1
  47. package/dist/toolbar.js +510 -418
  48. package/package.json +1 -1
package/dist/toolbar.js CHANGED
@@ -1,55 +1,55 @@
1
1
  "use client";
2
2
  import "./toolbar.css";
3
- import * as me from "react";
4
- import Ie from "./index.js";
5
- const Me = me, u = Me.default ?? me, ge = u.Children, Ne = u.Component, he = u.Fragment, Ve = u.PureComponent, be = u.cloneElement, q = u.createContext, l = u.createElement, ke = u.createRef, Ge = u.forwardRef, G = u.isValidElement, je = u.lazy, Pe = u.memo, J = u.useCallback, ye = u.useContext, Ue = u.useDebugValue, Be = u.useDeferredValue, j = u.useEffect, W = u.useId, $e = u.useImperativeHandle, He = u.useInsertionEffect, Xe = u.useLayoutEffect, T = u.useMemo, We = u.useReducer, K = u.useRef, A = u.useState, Ke = u.use, ze = u.version, Ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3
+ import * as ce from "react";
4
+ import Me from "./index.js";
5
+ const Ie = ce, p = Ie.default ?? ce, ue = p.Children, Ve = p.Component, de = p.Fragment, ke = p.PureComponent, fe = p.cloneElement, Y = p.createContext, l = p.createElement, Ge = p.createRef, je = p.forwardRef, G = p.isValidElement, Pe = p.lazy, Ue = p.memo, q = p.useCallback, pe = p.useContext, Be = p.useDebugValue, $e = p.useDeferredValue, D = p.useEffect, W = p.useId, me = p.useImperativeHandle, Xe = p.useInsertionEffect, ge = p.useLayoutEffect, R = p.useMemo, He = p.useReducer, K = p.useRef, A = p.useState, We = p.use, Ke = p.version, ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6
6
  __proto__: null,
7
- Children: ge,
8
- Component: Ne,
9
- Fragment: he,
10
- PureComponent: Ve,
11
- cloneElement: be,
12
- createContext: q,
7
+ Children: ue,
8
+ Component: Ve,
9
+ Fragment: de,
10
+ PureComponent: ke,
11
+ cloneElement: fe,
12
+ createContext: Y,
13
13
  createElement: l,
14
- createRef: ke,
15
- default: u,
16
- forwardRef: Ge,
14
+ createRef: Ge,
15
+ default: p,
16
+ forwardRef: je,
17
17
  isValidElement: G,
18
- lazy: je,
19
- memo: Pe,
20
- use: Ke,
21
- useCallback: J,
22
- useContext: ye,
23
- useDebugValue: Ue,
24
- useDeferredValue: Be,
25
- useEffect: j,
18
+ lazy: Pe,
19
+ memo: Ue,
20
+ use: We,
21
+ useCallback: q,
22
+ useContext: pe,
23
+ useDebugValue: Be,
24
+ useDeferredValue: $e,
25
+ useEffect: D,
26
26
  useId: W,
27
- useImperativeHandle: $e,
28
- useInsertionEffect: He,
29
- useLayoutEffect: Xe,
30
- useMemo: T,
31
- useReducer: We,
27
+ useImperativeHandle: me,
28
+ useInsertionEffect: Xe,
29
+ useLayoutEffect: ge,
30
+ useMemo: R,
31
+ useReducer: He,
32
32
  useRef: K,
33
33
  useState: A,
34
- version: ze
34
+ version: Ke
35
35
  }, Symbol.toStringTag, { value: "Module" }));
36
- let oe = 0;
37
- function qe(e) {
38
- const [t] = A(() => (oe += 1, `${e}-${oe}`));
36
+ let ee = 0;
37
+ function Ye(e) {
38
+ const [t] = A(() => (ee += 1, `${e}-${ee}`));
39
39
  return t;
40
40
  }
41
- const Je = typeof W == "function" ? (e) => `${e}-${W()}` : qe;
42
- function V(e = "tdg") {
43
- return Je(e);
41
+ const qe = typeof W == "function" ? (e) => `${e}-${W()}` : Ye;
42
+ function k(e = "tdg") {
43
+ return qe(e);
44
44
  }
45
- function P(e) {
46
- const { children: t, className: n } = e;
45
+ function j(e) {
46
+ const { children: t, className: r } = e;
47
47
  return /* @__PURE__ */ l(
48
48
  "svg",
49
49
  {
50
50
  "aria-hidden": "true",
51
51
  focusable: "false",
52
- className: n,
52
+ className: r,
53
53
  viewBox: "0 0 24 24",
54
54
  fill: "none",
55
55
  stroke: "currentColor",
@@ -60,388 +60,493 @@ function P(e) {
60
60
  t
61
61
  );
62
62
  }
63
- function se(e) {
64
- return /* @__PURE__ */ l(P, { className: e.className }, /* @__PURE__ */ l("path", { d: "M12 3v12" }), /* @__PURE__ */ l("path", { d: "m7 10 5 5 5-5" }), /* @__PURE__ */ l("path", { d: "M4 21h16" }));
63
+ function te(e) {
64
+ return /* @__PURE__ */ l(j, { className: e.className }, /* @__PURE__ */ l("path", { d: "M12 3v12" }), /* @__PURE__ */ l("path", { d: "m7 10 5 5 5-5" }), /* @__PURE__ */ l("path", { d: "M4 21h16" }));
65
+ }
66
+ function Je(e) {
67
+ return /* @__PURE__ */ l(j, { className: e.className }, /* @__PURE__ */ l("path", { d: "M3 4h18l-7 8v8l-4-2v-6z" }));
65
68
  }
66
69
  function Qe(e) {
67
- return /* @__PURE__ */ l(P, { className: e.className }, /* @__PURE__ */ l("path", { d: "M3 4h18l-7 8v8l-4-2v-6z" }));
70
+ return /* @__PURE__ */ l(j, { className: e.className }, /* @__PURE__ */ l("path", { d: "M3 4h18l-7 8v8l-4-2v-6z" }), /* @__PURE__ */ l("path", { d: "m16 16 5 5" }), /* @__PURE__ */ l("path", { d: "m21 16-5 5" }));
68
71
  }
69
72
  function Ze(e) {
70
- return /* @__PURE__ */ l(P, { className: e.className }, /* @__PURE__ */ l("path", { d: "M3 4h18l-7 8v8l-4-2v-6z" }), /* @__PURE__ */ l("path", { d: "m16 16 5 5" }), /* @__PURE__ */ l("path", { d: "m21 16-5 5" }));
71
- }
72
- function et(e) {
73
- return /* @__PURE__ */ l(P, { className: e.className }, /* @__PURE__ */ l("path", { d: "M3 12a9 9 0 1 0 3-6.7" }), /* @__PURE__ */ l("path", { d: "M3 4v5h5" }));
73
+ return /* @__PURE__ */ l(j, { className: e.className }, /* @__PURE__ */ l("path", { d: "M3 12a9 9 0 1 0 3-6.7" }), /* @__PURE__ */ l("path", { d: "M3 4v5h5" }));
74
74
  }
75
- const R = "default";
76
- q({
77
- themeName: R,
78
- themeBase: R,
75
+ const v = "default";
76
+ Y({
77
+ themeName: v,
78
+ themeBase: v,
79
79
  portalContainer: null
80
80
  });
81
- function Ee(e) {
82
- const t = String(e ?? R).trim();
83
- return t.length > 0 ? t : R;
81
+ function he(e) {
82
+ const t = String(e ?? v).trim();
83
+ return t.length > 0 ? t : v;
84
+ }
85
+ function et(e) {
86
+ return he(e).toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || v;
84
87
  }
85
88
  function tt(e) {
86
- return Ee(e).toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || R;
89
+ const t = et(e);
90
+ return t === v ? v : t === "dark" || t.endsWith("-dark") || t.endsWith("_dark") ? "dark" : t === "light" || t.endsWith("-light") || t.endsWith("_light") ? "light" : v;
87
91
  }
88
- function rt(e) {
89
- const t = tt(e);
90
- return t === R ? R : t === "dark" || t.endsWith("-dark") || t.endsWith("_dark") ? "dark" : t === "light" || t.endsWith("-light") || t.endsWith("_light") ? "light" : R;
92
+ function F(e) {
93
+ return String(e.id ?? e.name ?? "");
91
94
  }
92
- const nt = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", Se = "yyyy-mm-dd hh:mm";
93
- class ot extends Error {
95
+ function be(e, t) {
96
+ const r = /* @__PURE__ */ new Map();
97
+ for (const n of e) {
98
+ const s = F(n);
99
+ s && !r.has(s) && r.set(s, n);
100
+ }
101
+ const o = [];
102
+ for (const n of t) {
103
+ const s = r.get(n);
104
+ s && (o.push(s), r.delete(n));
105
+ }
106
+ return o.push(...r.values()), o;
107
+ }
108
+ const nt = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", Ee = "yyyy-mm-dd hh:mm";
109
+ class rt extends Error {
94
110
  constructor(t) {
95
111
  super(
96
112
  'XLSX export needs the optional "xlsx" peer dependency. Install it with `npm install xlsx`, or drop "xlsx" from the toolbar\'s exportFormats.'
97
113
  ), this.name = "MissingXlsxDependencyError", this.cause = t;
98
114
  }
99
115
  }
100
- class st extends Error {
101
- constructor(t, n) {
116
+ class ot extends Error {
117
+ constructor(t, r) {
102
118
  super(
103
119
  `Writing the XLSX workbook failed. If exportDateFormat is set it must be an Excel number format code the writer accepts - dot separators are rejected, so prefer "yyyy-mm-dd hh:mm" or "dd/mm/yyyy hh:mm" over "dd.mm.yyyy hh:mm". Received ${JSON.stringify(t)}. Format the value with column.exportValue instead when you need exact text.`
104
- ), this.name = "XlsxWriteError", this.cause = n;
120
+ ), this.name = "XlsxWriteError", this.cause = r;
105
121
  }
106
122
  }
107
- function at(e) {
123
+ function st(e) {
108
124
  const t = e.replace(/[[\]:*?/\\]/g, " ").trim();
109
125
  return t ? t.slice(0, 31) : "Export";
110
126
  }
111
- async function lt() {
127
+ async function at() {
112
128
  try {
113
129
  return await import("xlsx");
114
130
  } catch (e) {
115
- throw new ot(e);
131
+ throw new rt(e);
116
132
  }
117
133
  }
118
- async function it(e, t = {}) {
119
- const { dateFormat: n = Se, sheetName: o = "Export" } = t, r = await lt(), s = {
134
+ async function lt(e, t = {}) {
135
+ const { dateFormat: r = Ee, sheetName: o = "Export" } = t, n = await at(), s = {
120
136
  cellDates: !0,
121
- dateNF: n
137
+ dateNF: r
122
138
  };
123
139
  try {
124
- const c = r.utils.aoa_to_sheet(
140
+ const i = n.utils.aoa_to_sheet(
125
141
  [e.headers, ...e.rows],
126
142
  s
127
- ), d = r.utils.book_new();
128
- return r.utils.book_append_sheet(d, c, at(o)), r.write(d, {
143
+ ), u = n.utils.book_new();
144
+ return n.utils.book_append_sheet(u, i, st(o)), n.write(u, {
129
145
  bookType: "xlsx",
130
146
  type: "array",
131
147
  ...s
132
148
  });
133
- } catch (c) {
134
- throw new st(n, c);
149
+ } catch (i) {
150
+ throw new ot(r, i);
135
151
  }
136
152
  }
137
- const ct = `\r
138
- `, ut = "\uFEFF";
153
+ const it = "grid-export", ct = "view", ut = `\r
154
+ `, dt = "\uFEFF";
139
155
  function z(e) {
140
156
  return String(e.id ?? e.name ?? "");
141
157
  }
142
- function Q(e) {
158
+ function J(e) {
143
159
  return String(e.name ?? e.id ?? "");
144
160
  }
145
- function dt(e) {
161
+ function ft(e) {
146
162
  return typeof e.header == "string" && e.header.trim() ? e.header : typeof e.header == "number" ? String(e.header) : z(e);
147
163
  }
148
- function ae(e) {
149
- const { columns: t, columnOrder: n, columnVisibilityMap: o } = e, r = /* @__PURE__ */ new Map();
150
- for (const c of t) {
151
- const d = z(c);
152
- d && !r.has(d) && r.set(d, c);
164
+ function ye(e) {
165
+ const { columns: t, columnOrder: r, columnVisibilityMap: o } = e, n = /* @__PURE__ */ new Map();
166
+ for (const i of t) {
167
+ const u = z(i);
168
+ u && !n.has(u) && n.set(u, i);
153
169
  }
154
170
  const s = [];
155
- for (const c of n) {
156
- const d = r.get(c);
157
- d && (s.push(d), r.delete(c));
171
+ for (const i of r) {
172
+ const u = n.get(i);
173
+ u && (s.push(u), n.delete(i));
158
174
  }
159
- return s.push(...r.values()), s.filter((c) => c.exportable === !1 || !Q(c) ? !1 : c.exportWhenHidden ? !0 : o[z(c)] !== !1);
175
+ return s.push(...n.values()), s.filter((i) => i.exportable === !1 || !J(i) ? !1 : i.exportWhenHidden ? !0 : o[z(i)] !== !1);
160
176
  }
161
- function ft(e, t) {
177
+ function pt(e, t) {
162
178
  if (!(typeof e != "object" || e == null))
163
179
  return e[t];
164
180
  }
165
- function pt(e, t) {
166
- const n = ft(t, Q(e));
167
- if (typeof e.exportValue != "function") return n;
181
+ function mt(e, t) {
182
+ const r = pt(t, J(e));
183
+ if (typeof e.exportValue != "function") return r;
168
184
  try {
169
- return e.exportValue({ value: n, data: t, column: e });
185
+ return e.exportValue({ value: r, data: t, column: e });
170
186
  } catch {
171
- return n;
187
+ return r;
172
188
  }
173
189
  }
174
- function mt(e, t) {
190
+ function gt(e, t) {
175
191
  return {
176
- headers: e.map(dt),
177
- fields: e.map(Q),
192
+ headers: e.map(ft),
193
+ fields: e.map(J),
178
194
  rows: t.map(
179
- (n) => e.map((o) => pt(o, n))
195
+ (r) => e.map((o) => mt(o, r))
180
196
  )
181
197
  };
182
198
  }
183
- function gt(e) {
199
+ function ht(e) {
184
200
  return e == null ? "" : e instanceof Date ? Number.isNaN(e.getTime()) ? "" : e.toISOString() : typeof e == "object" ? JSON.stringify(e) ?? "" : String(e);
185
201
  }
186
- function le(e) {
187
- const t = gt(e);
202
+ function ne(e) {
203
+ const t = ht(e);
188
204
  return /["\n\r,]/.test(t) ? `"${t.replace(/"/g, '""')}"` : t;
189
205
  }
190
- function ht(e) {
206
+ function bt(e) {
191
207
  const t = [
192
- e.headers.map(le).join(","),
193
- ...e.rows.map((n) => n.map(le).join(","))
208
+ e.headers.map(ne).join(","),
209
+ ...e.rows.map((r) => r.map(ne).join(","))
194
210
  ];
195
- return `${ut}${t.join(ct)}`;
211
+ return `${dt}${t.join(ut)}`;
196
212
  }
197
- function bt(e) {
213
+ function Et(e) {
198
214
  const t = e.rows.map(
199
- (n) => Object.fromEntries(
200
- n.map((o, r) => [
201
- e.fields[r],
215
+ (r) => Object.fromEntries(
216
+ r.map((o, n) => [
217
+ e.fields[n],
202
218
  o === void 0 ? null : o
203
219
  ])
204
220
  )
205
221
  );
206
222
  return JSON.stringify(t, null, 2);
207
223
  }
208
- const Y = {
224
+ const P = {
209
225
  csv: {
210
226
  label: "CSV",
211
227
  extension: "csv",
212
228
  mimeType: "text/csv;charset=utf-8",
213
- createContent: (e) => ht(e)
229
+ createContent: (e) => bt(e)
214
230
  },
215
231
  json: {
216
232
  label: "JSON",
217
233
  extension: "json",
218
234
  mimeType: "application/json;charset=utf-8",
219
- createContent: (e) => bt(e)
235
+ createContent: (e) => Et(e)
220
236
  },
221
237
  xlsx: {
222
238
  label: "Excel",
223
239
  extension: "xlsx",
224
240
  mimeType: nt,
225
- createContent: (e, t) => it(e, t)
241
+ createContent: (e, t) => lt(e, t)
226
242
  }
227
243
  }, yt = ["csv", "json"];
228
- function Et(e, t, n) {
244
+ function St(e, t, r) {
229
245
  if (typeof document > "u" || typeof URL > "u") return 0;
230
- const o = new Blob([t], { type: n }), r = URL.createObjectURL(o), s = document.createElement("a");
231
- return s.href = r, s.download = e, s.rel = "noopener", document.body.append(s), s.click(), s.remove(), URL.revokeObjectURL(r), o.size;
246
+ const o = new Blob([t], { type: r }), n = URL.createObjectURL(o), s = document.createElement("a");
247
+ return s.href = n, s.download = e, s.rel = "noopener", document.body.append(s), s.click(), s.remove(), URL.revokeObjectURL(n), o.size;
232
248
  }
233
- function St(e) {
249
+ function Se(...e) {
250
+ const t = {};
251
+ for (const r of e)
252
+ r && (t.scope ??= r.scope, t.fileName ??= r.fileName, t.dateFormat ??= r.dateFormat, t.sheetName ??= r.sheetName);
253
+ return t;
254
+ }
255
+ async function xe(e, t, r = {}) {
256
+ const o = P[t];
257
+ if (!o) return null;
258
+ const n = ye(e);
259
+ if (n.length === 0) return null;
260
+ const s = r.scope ?? ct, i = s === "all" ? e.getAllRows() : e.getViewRows(), u = gt(n, i), f = {
261
+ format: t,
262
+ scope: s,
263
+ rowCount: u.rows.length,
264
+ columnCount: u.headers.length
265
+ }, E = typeof r.fileName == "function" ? r.fileName(f) : r.fileName ?? it, S = await o.createContent(u, {
266
+ dateFormat: r.dateFormat ?? Ee,
267
+ sheetName: r.sheetName ?? E
268
+ }), d = `${E}.${o.extension}`, h = St(d, S, o.mimeType);
269
+ return { ...f, fileName: d, byteLength: h };
270
+ }
271
+ function xt(e) {
234
272
  if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
235
273
  var t = e.default;
236
274
  if (typeof t == "function") {
237
- var n = function o() {
238
- var r = !1;
275
+ var r = function o() {
276
+ var n = !1;
239
277
  try {
240
- r = this instanceof o;
278
+ n = this instanceof o;
241
279
  } catch {
242
280
  }
243
- return r ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
281
+ return n ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
244
282
  };
245
- n.prototype = t.prototype;
246
- } else n = {};
247
- return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(o) {
248
- var r = Object.getOwnPropertyDescriptor(e, o);
249
- Object.defineProperty(n, o, r.get ? r : {
283
+ r.prototype = t.prototype;
284
+ } else r = {};
285
+ return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(e).forEach(function(o) {
286
+ var n = Object.getOwnPropertyDescriptor(e, o);
287
+ Object.defineProperty(r, o, n.get ? n : {
250
288
  enumerable: !0,
251
289
  get: function() {
252
290
  return e[o];
253
291
  }
254
292
  });
255
- }), n;
256
- }
257
- var I = { exports: {} }, H = {};
258
- const xe = /* @__PURE__ */ St(Ye);
259
- var ie;
260
- function xt() {
261
- if (ie) return H;
262
- ie = 1;
263
- var e = xe;
264
- function t(f, h) {
265
- return f === h && (f !== 0 || 1 / f === 1 / h) || f !== f && h !== h;
293
+ }), r;
294
+ }
295
+ var I = { exports: {} }, X = {};
296
+ const _e = /* @__PURE__ */ xt(ze);
297
+ var re;
298
+ function _t() {
299
+ if (re) return X;
300
+ re = 1;
301
+ var e = _e;
302
+ function t(d, h) {
303
+ return d === h && (d !== 0 || 1 / d === 1 / h) || d !== d && h !== h;
266
304
  }
267
- var n = typeof Object.is == "function" ? Object.is : t, o = e.useState, r = e.useEffect, s = e.useLayoutEffect, c = e.useDebugValue;
268
- function d(f, h) {
269
- var i = h(), p = o({ inst: { value: i, getSnapshot: h } }), m = p[0].inst, b = p[1];
305
+ var r = typeof Object.is == "function" ? Object.is : t, o = e.useState, n = e.useEffect, s = e.useLayoutEffect, i = e.useDebugValue;
306
+ function u(d, h) {
307
+ var c = h(), m = o({ inst: { value: c, getSnapshot: h } }), g = m[0].inst, y = m[1];
270
308
  return s(
271
309
  function() {
272
- m.value = i, m.getSnapshot = h, y(m) && b({ inst: m });
310
+ g.value = c, g.getSnapshot = h, f(g) && y({ inst: g });
273
311
  },
274
- [f, i, h]
275
- ), r(
312
+ [d, c, h]
313
+ ), n(
276
314
  function() {
277
- return y(m) && b({ inst: m }), f(function() {
278
- y(m) && b({ inst: m });
315
+ return f(g) && y({ inst: g }), d(function() {
316
+ f(g) && y({ inst: g });
279
317
  });
280
318
  },
281
- [f]
282
- ), c(i), i;
319
+ [d]
320
+ ), i(c), c;
283
321
  }
284
- function y(f) {
285
- var h = f.getSnapshot;
286
- f = f.value;
322
+ function f(d) {
323
+ var h = d.getSnapshot;
324
+ d = d.value;
287
325
  try {
288
- var i = h();
289
- return !n(f, i);
326
+ var c = h();
327
+ return !r(d, c);
290
328
  } catch {
291
329
  return !0;
292
330
  }
293
331
  }
294
- function E(f, h) {
332
+ function E(d, h) {
295
333
  return h();
296
334
  }
297
- var O = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? E : d;
298
- return H.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : O, H;
299
- }
300
- var X = {};
301
- var ce;
302
- function _t() {
303
- return ce || (ce = 1, process.env.NODE_ENV !== "production" && (function() {
304
- function e(i, p) {
305
- return i === p && (i !== 0 || 1 / i === 1 / p) || i !== i && p !== p;
335
+ var S = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? E : u;
336
+ return X.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : S, X;
337
+ }
338
+ var H = {};
339
+ var oe;
340
+ function Ot() {
341
+ return oe || (oe = 1, process.env.NODE_ENV !== "production" && (function() {
342
+ function e(c, m) {
343
+ return c === m && (c !== 0 || 1 / c === 1 / m) || c !== c && m !== m;
306
344
  }
307
- function t(i, p) {
308
- O || r.startTransition === void 0 || (O = !0, console.error(
345
+ function t(c, m) {
346
+ S || n.startTransition === void 0 || (S = !0, console.error(
309
347
  "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
310
348
  ));
311
- var m = p();
312
- if (!f) {
313
- var b = p();
314
- s(m, b) || (console.error(
349
+ var g = m();
350
+ if (!d) {
351
+ var y = m();
352
+ s(g, y) || (console.error(
315
353
  "The result of getSnapshot should be cached to avoid an infinite loop"
316
- ), f = !0);
354
+ ), d = !0);
317
355
  }
318
- b = c({
319
- inst: { value: m, getSnapshot: p }
356
+ y = i({
357
+ inst: { value: g, getSnapshot: m }
320
358
  });
321
- var a = b[0].inst, S = b[1];
322
- return y(
359
+ var a = y[0].inst, _ = y[1];
360
+ return f(
323
361
  function() {
324
- a.value = m, a.getSnapshot = p, n(a) && S({ inst: a });
362
+ a.value = g, a.getSnapshot = m, r(a) && _({ inst: a });
325
363
  },
326
- [i, m, p]
327
- ), d(
364
+ [c, g, m]
365
+ ), u(
328
366
  function() {
329
- return n(a) && S({ inst: a }), i(function() {
330
- n(a) && S({ inst: a });
367
+ return r(a) && _({ inst: a }), c(function() {
368
+ r(a) && _({ inst: a });
331
369
  });
332
370
  },
333
- [i]
334
- ), E(m), m;
371
+ [c]
372
+ ), E(g), g;
335
373
  }
336
- function n(i) {
337
- var p = i.getSnapshot;
338
- i = i.value;
374
+ function r(c) {
375
+ var m = c.getSnapshot;
376
+ c = c.value;
339
377
  try {
340
- var m = p();
341
- return !s(i, m);
378
+ var g = m();
379
+ return !s(c, g);
342
380
  } catch {
343
381
  return !0;
344
382
  }
345
383
  }
346
- function o(i, p) {
347
- return p();
384
+ function o(c, m) {
385
+ return m();
348
386
  }
349
387
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
350
- var r = xe, s = typeof Object.is == "function" ? Object.is : e, c = r.useState, d = r.useEffect, y = r.useLayoutEffect, E = r.useDebugValue, O = !1, f = !1, h = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? o : t;
351
- X.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : h, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
352
- })()), X;
388
+ var n = _e, s = typeof Object.is == "function" ? Object.is : e, i = n.useState, u = n.useEffect, f = n.useLayoutEffect, E = n.useDebugValue, S = !1, d = !1, h = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? o : t;
389
+ H.useSyncExternalStore = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : h, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
390
+ })()), H;
353
391
  }
354
- var ue;
355
- function vt() {
356
- return ue || (ue = 1, process.env.NODE_ENV === "production" ? I.exports = xt() : I.exports = _t()), I.exports;
392
+ var se;
393
+ function Tt() {
394
+ return se || (se = 1, process.env.NODE_ENV === "production" ? I.exports = _t() : I.exports = Ot()), I.exports;
357
395
  }
358
- var Ot = vt();
359
- const Tt = [], Rt = [], wt = {}, Ct = [], Lt = () => {
360
- }, Dt = () => {
396
+ var Oe = Tt();
397
+ const Rt = Object.keys(
398
+ P
399
+ );
400
+ function vt(e) {
401
+ let t = null, r = null;
402
+ const o = () => {
403
+ const n = e.getSnapshot();
404
+ return t === n && r || (t = n, r = {
405
+ attached: e.isAttached(),
406
+ columns: be(n.columns, n.columnOrder),
407
+ columnVisibilityMap: n.columnVisibilityMap,
408
+ theme: n.theme,
409
+ filteringEnabled: n.filteringEnabled,
410
+ canToggleFiltering: n.canToggleFiltering,
411
+ filtered: n.filtered
412
+ }), r;
413
+ };
414
+ return {
415
+ async exportGrid(n, s) {
416
+ return xe(
417
+ e.getSnapshot(),
418
+ n,
419
+ Se(s, e.getExportDefaults())
420
+ );
421
+ },
422
+ getExportFormats: () => Rt,
423
+ getColumns: () => o().columns,
424
+ isColumnVisible(n) {
425
+ const s = e.getSnapshot();
426
+ return s.columnVisibilityMap[n] === !1 ? !1 : s.columns.some(
427
+ (i) => F(i) === n
428
+ );
429
+ },
430
+ setColumnVisible(n, s) {
431
+ e.getSnapshot().setColumnVisible(n, s);
432
+ },
433
+ isFilteringEnabled: () => e.getSnapshot().filteringEnabled,
434
+ canToggleFiltering: () => e.getSnapshot().canToggleFiltering,
435
+ setFilteringEnabled(n) {
436
+ e.getSnapshot().setFilteringEnabled(n);
437
+ },
438
+ isFiltered: () => e.getSnapshot().filtered,
439
+ clearAllFilters() {
440
+ e.getSnapshot().clearAllFilters();
441
+ },
442
+ getViewRows: () => e.getSnapshot().getViewRows(),
443
+ getAllRows: () => e.getSnapshot().getAllRows(),
444
+ getState: o,
445
+ subscribe: (n) => e.subscribe(n)
446
+ };
447
+ }
448
+ const wt = [], Ct = [], Lt = {}, Ft = [], Dt = () => {
361
449
  }, At = () => {
362
- }, de = () => Ct, M = {
363
- columns: Tt,
364
- columnOrder: Rt,
365
- columnVisibilityMap: wt,
450
+ }, Nt = () => {
451
+ }, ae = () => Ft, L = {
452
+ columns: wt,
453
+ columnOrder: Ct,
454
+ columnVisibilityMap: Lt,
366
455
  theme: "default",
367
- setColumnVisible: Lt,
456
+ setColumnVisible: Dt,
368
457
  filteringEnabled: !1,
369
458
  canToggleFiltering: !1,
370
- setFilteringEnabled: Dt,
459
+ setFilteringEnabled: At,
371
460
  filtered: !1,
372
- clearAllFilters: At,
373
- getViewRows: de,
374
- getAllRows: de
461
+ clearAllFilters: Nt,
462
+ getViewRows: ae,
463
+ getAllRows: ae
375
464
  };
376
- function fe(e, t) {
377
- return e === t || e.length === t.length && e.every((n, o) => n === t[o]);
465
+ function le(e, t) {
466
+ return e === t || e.length === t.length && e.every((r, o) => r === t[o]);
378
467
  }
379
- function Ft(e, t) {
468
+ function Mt(e, t) {
380
469
  if (e === t) return !0;
381
- const n = Object.keys(e), o = Object.keys(t);
382
- return n.length === o.length && n.every(
383
- (r) => Object.prototype.hasOwnProperty.call(t, r) && e[r] === t[r]
470
+ const r = Object.keys(e), o = Object.keys(t);
471
+ return r.length === o.length && r.every(
472
+ (n) => Object.prototype.hasOwnProperty.call(t, n) && e[n] === t[n]
384
473
  );
385
474
  }
386
475
  function It(e, t) {
387
- return fe(e.columns, t.columns) && fe(e.columnOrder, t.columnOrder) && Ft(e.columnVisibilityMap, t.columnVisibilityMap) && e.theme === t.theme && e.setColumnVisible === t.setColumnVisible && e.filteringEnabled === t.filteringEnabled && e.canToggleFiltering === t.canToggleFiltering && e.setFilteringEnabled === t.setFilteringEnabled && e.filtered === t.filtered && e.clearAllFilters === t.clearAllFilters && e.getViewRows === t.getViewRows && e.getAllRows === t.getAllRows;
388
- }
389
- function Mt() {
390
- let e = null, t = M;
391
- const n = /* @__PURE__ */ new Set(), o = (r) => {
392
- It(t, r) || (t = r, n.forEach((s) => s()));
393
- };
476
+ return le(e.columns, t.columns) && le(e.columnOrder, t.columnOrder) && Mt(e.columnVisibilityMap, t.columnVisibilityMap) && e.theme === t.theme && e.setColumnVisible === t.setColumnVisible && e.filteringEnabled === t.filteringEnabled && e.canToggleFiltering === t.canToggleFiltering && e.setFilteringEnabled === t.setFilteringEnabled && e.filtered === t.filtered && e.clearAllFilters === t.clearAllFilters && e.getViewRows === t.getViewRows && e.getAllRows === t.getAllRows;
477
+ }
478
+ function Vt() {
479
+ let e = null, t = L, r;
480
+ const o = /* @__PURE__ */ new Set(), n = (f) => {
481
+ It(t, f) || (t = f, o.forEach((E) => E()));
482
+ }, s = () => t, i = () => r, u = (f) => (o.add(f), () => {
483
+ o.delete(f);
484
+ });
394
485
  return {
486
+ api: vt({
487
+ getSnapshot: s,
488
+ subscribe: u,
489
+ getExportDefaults: i,
490
+ isAttached: () => t !== L
491
+ }),
395
492
  createTargetRegistration() {
396
- const r = /* @__PURE__ */ Symbol("rdg-toolbar-target");
397
- let s = !1, c = null;
493
+ const f = /* @__PURE__ */ Symbol("rdg-toolbar-target");
494
+ let E = !1, S = null;
398
495
  return {
399
496
  controller: {
400
497
  publish(d) {
401
- c = d, s && e === r && o(d);
498
+ S = d, E && e === f && n(d);
402
499
  }
403
500
  },
404
501
  attach() {
405
- if (e !== null && e !== r)
502
+ if (e !== null && e !== f)
406
503
  throw new Error(
407
504
  "RDGToolbarProvider supports one ReactDataGrid target. Use a separate provider for each grid."
408
505
  );
409
- return s = !0, e = r, c && o(c), () => {
410
- s && (s = !1, e === r && (e = null, o(M)));
506
+ return E = !0, e = f, S && n(S), () => {
507
+ E && (E = !1, e === f && (e = null, n(L)));
411
508
  };
412
509
  }
413
510
  };
414
511
  },
415
512
  dispose() {
416
- e = null, t = M, n.clear();
513
+ e = null, t = L, r = void 0, o.clear();
417
514
  },
418
- getSnapshot: () => t,
419
- getServerSnapshot: () => M,
420
- subscribe(r) {
421
- return n.add(r), () => n.delete(r);
422
- }
515
+ getExportDefaults: i,
516
+ getSnapshot: s,
517
+ getServerSnapshot: () => L,
518
+ setExportDefaults(f) {
519
+ r = f;
520
+ },
521
+ subscribe: u
423
522
  };
424
523
  }
425
- const _e = q(
524
+ const Te = Y(
426
525
  null
427
526
  );
428
- function ve() {
429
- const e = ye(_e);
527
+ function U() {
528
+ const e = pe(Te);
430
529
  if (!e)
431
530
  throw new Error(
432
531
  "RDG toolbar components must be rendered inside RDGToolbarProvider."
433
532
  );
434
533
  return e;
435
534
  }
436
- function Nt() {
437
- const e = ve();
438
- return Ot.useSyncExternalStore(
535
+ function kt() {
536
+ const e = U();
537
+ return Oe.useSyncExternalStore(
439
538
  e.subscribe,
440
539
  e.getSnapshot,
441
540
  e.getServerSnapshot
442
541
  );
443
542
  }
444
- const N = {
543
+ function zt() {
544
+ return U().api;
545
+ }
546
+ function Yt(e) {
547
+ return Oe.useSyncExternalStore(e.subscribe, e.getState, e.getState);
548
+ }
549
+ const V = {
445
550
  export: "Export",
446
551
  showFilters: "Show filters",
447
552
  hideFilters: "Hide filters",
@@ -450,109 +555,91 @@ const N = {
450
555
  exportSingle: {},
451
556
  filteringControlledHint: "The grid owns its filter row through the enableFiltering prop."
452
557
  };
453
- function k(e) {
454
- return String(e.id ?? e.name ?? "");
455
- }
456
- function Vt(e) {
457
- return typeof e.header == "string" && e.header.trim() || typeof e.header == "number" ? e.header : k(e);
458
- }
459
- function kt(e, t) {
460
- const n = /* @__PURE__ */ new Map();
461
- for (const r of e) {
462
- const s = k(r);
463
- s && !n.has(s) && n.set(s, r);
464
- }
465
- const o = [];
466
- for (const r of t) {
467
- const s = n.get(r);
468
- s && (o.push(s), n.delete(r));
469
- }
470
- return o.push(...n.values()), o;
558
+ function Gt(e) {
559
+ return typeof e.header == "string" && e.header.trim() || typeof e.header == "number" ? e.header : F(e);
471
560
  }
472
- function Wt(e) {
561
+ function qt(e) {
473
562
  const {
474
563
  children: t,
475
- ariaLabel: n = "Visible column toggles",
564
+ ariaLabel: r = "Visible column toggles",
476
565
  title: o = "Visible columns",
477
- description: r = "Choose which columns are visible in the grid.",
566
+ description: n = "Choose which columns are visible in the grid.",
478
567
  showColumnToggles: s = !0,
479
- showExport: c = !1,
480
- showFilterToggle: d = !1,
481
- showClearFilters: y = !1,
482
- exportScope: E = "view",
483
- exportFormats: O = yt,
484
- exportFileName: f = "grid-export",
485
- exportDateFormat: h = Se,
486
- exportSheetName: i,
487
- onExportSuccess: p,
488
- onExportError: m,
489
- labels: b,
568
+ showExport: i = !1,
569
+ showFilterToggle: u = !1,
570
+ showClearFilters: f = !1,
571
+ // No literal defaults here: one would be indistinguishable from a passed
572
+ // value and would outrank the provider's `exportDefaults`.
573
+ exportScope: E,
574
+ exportFormats: S = yt,
575
+ exportFileName: d,
576
+ exportDateFormat: h,
577
+ exportSheetName: c,
578
+ onExportSuccess: m,
579
+ onExportError: g,
580
+ labels: y,
490
581
  className: a
491
- } = e, [S, x] = A(!1), L = V("tdg-toolbar-title"), D = V("tdg-toolbar-description"), g = Nt(), Z = Ee(g.theme), we = rt(Z), w = T(
582
+ } = e, [_, O] = A(!1), C = U(), N = k("tdg-toolbar-title"), B = k("tdg-toolbar-description"), b = kt(), Q = he(b.theme), Ce = tt(Q), w = R(
492
583
  () => ({
493
- ...N,
494
- ...b,
584
+ ...V,
585
+ ...y,
495
586
  // A caller passing `exportFormats: undefined` out of a conditional would
496
587
  // otherwise defeat the spread and leave the lookups below without a map.
497
- exportFormats: b?.exportFormats ?? N.exportFormats,
498
- exportSingle: b?.exportSingle ?? N.exportSingle,
499
- filteringControlledHint: b?.filteringControlledHint ?? N.filteringControlledHint
588
+ exportFormats: y?.exportFormats ?? V.exportFormats,
589
+ exportSingle: y?.exportSingle ?? V.exportSingle,
590
+ filteringControlledHint: y?.filteringControlledHint ?? V.filteringControlledHint
500
591
  }),
501
- [b]
502
- ), U = T(
503
- () => kt(g.columns, g.columnOrder),
504
- [g.columnOrder, g.columns]
505
- ), Ce = T(
506
- () => U.filter((_) => _.hideable !== !1),
507
- [U]
508
- ), Le = U.reduce(
509
- (_, v) => _ + (g.columnVisibilityMap[k(v)] === !1 ? 0 : 1),
592
+ [y]
593
+ ), $ = R(
594
+ () => be(b.columns, b.columnOrder),
595
+ [b.columnOrder, b.columns]
596
+ ), Le = R(
597
+ () => $.filter((T) => T.hideable !== !1),
598
+ [$]
599
+ ), Fe = $.reduce(
600
+ (T, x) => T + (b.columnVisibilityMap[F(x)] === !1 ? 0 : 1),
510
601
  0
511
- ), ee = T(
512
- () => O.filter(
513
- (_) => Y[_] != null
602
+ ), Z = R(
603
+ () => S.filter(
604
+ (T) => P[T] != null
514
605
  ),
515
- [O]
516
- ), De = T(
517
- () => c ? ae(g).length : 0,
518
- [c, g]
519
- ) === 0 || ee.length === 0, Ae = J(
520
- async (_) => {
521
- const v = Y[_];
522
- if (!v) return;
523
- const C = ae(g);
524
- if (C.length === 0) return;
525
- const B = E === "all" ? g.getAllRows() : g.getViewRows(), $ = mt(C, B), te = {
526
- format: _,
527
- scope: E,
528
- rowCount: $.rows.length,
529
- columnCount: $.headers.length
530
- }, re = typeof f == "function" ? f(te) : f;
531
- x(!0);
606
+ [S]
607
+ ), De = R(
608
+ () => i ? ye(b).length : 0,
609
+ [i, b]
610
+ ) === 0 || Z.length === 0, Ae = q(
611
+ async (T) => {
612
+ O(!0);
532
613
  try {
533
- const F = await v.createContent($, {
534
- dateFormat: h,
535
- sheetName: i ?? re
536
- }), ne = `${re}.${v.extension}`, Fe = Et(
537
- ne,
538
- F,
539
- v.mimeType
614
+ const x = await xe(
615
+ b,
616
+ T,
617
+ Se(
618
+ {
619
+ scope: E,
620
+ fileName: d,
621
+ dateFormat: h,
622
+ sheetName: c
623
+ },
624
+ C.getExportDefaults()
625
+ )
540
626
  );
541
- p?.({ ...te, fileName: ne, byteLength: Fe });
542
- } catch (F) {
543
- m?.(F), m || console.error(F);
627
+ x && m?.(x);
628
+ } catch (x) {
629
+ g?.(x), g || console.error(x);
544
630
  } finally {
545
- x(!1);
631
+ O(!1);
546
632
  }
547
633
  },
548
634
  [
549
635
  h,
550
- f,
636
+ d,
551
637
  E,
552
- i,
638
+ c,
639
+ g,
553
640
  m,
554
- p,
555
- g
641
+ b,
642
+ C
556
643
  ]
557
644
  );
558
645
  return /* @__PURE__ */ l(
@@ -560,238 +647,243 @@ function Wt(e) {
560
647
  {
561
648
  className: a ? `tdg-toolbar-root ${a}` : "tdg-toolbar-root",
562
649
  "data-slot": "rdg-toolbar",
563
- "data-theme": Z,
564
- "data-theme-base": we,
650
+ "data-theme": Q,
651
+ "data-theme-base": Ce,
565
652
  role: o != null ? "region" : void 0,
566
- "aria-labelledby": o != null ? L : void 0,
567
- "aria-describedby": r != null ? D : void 0
653
+ "aria-labelledby": o != null ? N : void 0,
654
+ "aria-describedby": n != null ? B : void 0
568
655
  },
569
- o != null || r != null ? /* @__PURE__ */ l("div", { "data-slot": "rdg-toolbar-heading" }, o != null ? /* @__PURE__ */ l(
656
+ o != null || n != null ? /* @__PURE__ */ l("div", { "data-slot": "rdg-toolbar-heading" }, o != null ? /* @__PURE__ */ l(
570
657
  "div",
571
658
  {
572
- id: L,
659
+ id: N,
573
660
  "data-slot": "rdg-toolbar-title",
574
661
  role: "heading",
575
662
  "aria-level": 2
576
663
  },
577
664
  o
578
- ) : null, r != null ? /* @__PURE__ */ l("div", { id: D, "data-slot": "rdg-toolbar-description" }, r) : null) : null,
665
+ ) : null, n != null ? /* @__PURE__ */ l("div", { id: B, "data-slot": "rdg-toolbar-description" }, n) : null) : null,
579
666
  /* @__PURE__ */ l("div", { "data-slot": "rdg-toolbar-body" }, s ? /* @__PURE__ */ l(
580
667
  "div",
581
668
  {
582
669
  role: "group",
583
- "aria-label": n,
584
- "aria-describedby": r != null ? D : void 0,
670
+ "aria-label": r,
671
+ "aria-describedby": n != null ? B : void 0,
585
672
  "data-slot": "rdg-column-toggle-list"
586
673
  },
587
- Ce.map((_) => {
588
- const v = k(_), C = g.columnVisibilityMap[v] !== !1, B = C && Le <= 1;
674
+ Le.map((T) => {
675
+ const x = F(T), M = b.columnVisibilityMap[x] !== !1, Ne = M && Fe <= 1;
589
676
  return /* @__PURE__ */ l(
590
677
  "button",
591
678
  {
592
- key: v,
679
+ key: x,
593
680
  type: "button",
594
- "aria-pressed": C,
595
- disabled: B,
596
- "data-state": C ? "on" : "off",
681
+ "aria-pressed": M,
682
+ disabled: Ne,
683
+ "data-state": M ? "on" : "off",
597
684
  "data-slot": "rdg-column-toggle",
598
- "data-column-id": v,
599
- onClick: () => g.setColumnVisible(v, !C)
685
+ "data-column-id": x,
686
+ onClick: () => b.setColumnVisible(x, !M)
600
687
  },
601
- Vt(_)
688
+ Gt(T)
602
689
  );
603
690
  })
604
- ) : null, c || d || y || t != null ? /* @__PURE__ */ l("div", { "data-slot": "rdg-toolbar-actions" }, c ? /* @__PURE__ */ l(
605
- Gt,
691
+ ) : null, i || u || f || t != null ? /* @__PURE__ */ l("div", { "data-slot": "rdg-toolbar-actions" }, i ? /* @__PURE__ */ l(
692
+ jt,
606
693
  {
607
- disabled: De || S,
608
- formats: ee,
694
+ disabled: De || _,
695
+ formats: Z,
609
696
  label: w.export,
610
697
  formatLabels: w.exportFormats,
611
698
  singleLabels: w.exportSingle,
612
699
  onExport: Ae
613
700
  }
614
- ) : null, d ? /* @__PURE__ */ l(
701
+ ) : null, u ? /* @__PURE__ */ l(
615
702
  "button",
616
703
  {
617
704
  type: "button",
618
- "aria-pressed": g.filteringEnabled,
619
- "data-state": g.filteringEnabled ? "on" : "off",
705
+ "aria-pressed": b.filteringEnabled,
706
+ "data-state": b.filteringEnabled ? "on" : "off",
620
707
  "data-slot": "rdg-toolbar-filter-toggle",
621
- disabled: !g.canToggleFiltering,
622
- title: g.canToggleFiltering ? void 0 : w.filteringControlledHint,
623
- onClick: () => g.setFilteringEnabled(!g.filteringEnabled)
708
+ disabled: !b.canToggleFiltering,
709
+ title: b.canToggleFiltering ? void 0 : w.filteringControlledHint,
710
+ onClick: () => b.setFilteringEnabled(!b.filteringEnabled)
624
711
  },
625
- g.filteringEnabled ? /* @__PURE__ */ l(Ze, null) : /* @__PURE__ */ l(Qe, null),
626
- g.filteringEnabled ? w.hideFilters : w.showFilters
627
- ) : null, y ? /* @__PURE__ */ l(
712
+ b.filteringEnabled ? /* @__PURE__ */ l(Qe, null) : /* @__PURE__ */ l(Je, null),
713
+ b.filteringEnabled ? w.hideFilters : w.showFilters
714
+ ) : null, f ? /* @__PURE__ */ l(
628
715
  "button",
629
716
  {
630
717
  type: "button",
631
718
  "data-slot": "rdg-toolbar-clear-filters",
632
- disabled: !g.filtered,
633
- onClick: () => g.clearAllFilters()
719
+ disabled: !b.filtered,
720
+ onClick: () => b.clearAllFilters()
634
721
  },
635
- /* @__PURE__ */ l(et, null),
722
+ /* @__PURE__ */ l(Ze, null),
636
723
  w.clearFilters
637
724
  ) : null, t) : null)
638
725
  );
639
726
  }
640
- function Gt(e) {
641
- const { disabled: t, formats: n, label: o, formatLabels: r, singleLabels: s, onExport: c } = e, [d, y] = A(!1), E = K(null), O = K(null), f = V("tdg-toolbar-export-menu"), h = V("tdg-toolbar-export-trigger"), i = n.length === 1 ? n[0] : null, p = (a) => r[a] ?? Y[a].label;
642
- j(() => {
643
- if (!d) return;
644
- const a = (S) => {
645
- const x = E.current;
646
- x && !x.contains(S.target) && y(!1);
727
+ function jt(e) {
728
+ const { disabled: t, formats: r, label: o, formatLabels: n, singleLabels: s, onExport: i } = e, [u, f] = A(!1), E = K(null), S = K(null), d = k("tdg-toolbar-export-menu"), h = k("tdg-toolbar-export-trigger"), c = r.length === 1 ? r[0] : null, m = (a) => n[a] ?? P[a].label;
729
+ D(() => {
730
+ if (!u) return;
731
+ const a = (_) => {
732
+ const O = E.current;
733
+ O && !O.contains(_.target) && f(!1);
647
734
  };
648
735
  return document.addEventListener("pointerdown", a, !0), () => document.removeEventListener("pointerdown", a, !0);
649
- }, [d]);
650
- const m = J(() => {
651
- y(!1), O.current?.focus();
652
- }, []), b = (a, S) => {
653
- const x = Array.from(
736
+ }, [u]);
737
+ const g = q(() => {
738
+ f(!1), S.current?.focus();
739
+ }, []), y = (a, _) => {
740
+ const O = Array.from(
654
741
  E.current?.querySelectorAll(
655
742
  '[data-slot="rdg-toolbar-export-format"]'
656
743
  ) ?? []
657
744
  );
658
- if (x.length === 0) return;
659
- const L = x.indexOf(a), D = L < 0 ? 0 : (L + S + x.length) % x.length;
660
- x[D]?.focus();
745
+ if (O.length === 0) return;
746
+ const C = O.indexOf(a), N = C < 0 ? 0 : (C + _ + O.length) % O.length;
747
+ O[N]?.focus();
661
748
  };
662
- return i ? /* @__PURE__ */ l(
749
+ return c ? /* @__PURE__ */ l(
663
750
  "button",
664
751
  {
665
752
  type: "button",
666
753
  "data-slot": "rdg-toolbar-export",
667
- "data-export-format": i,
754
+ "data-export-format": c,
668
755
  disabled: t,
669
756
  onClick: () => {
670
- c(i);
757
+ i(c);
671
758
  }
672
759
  },
673
- /* @__PURE__ */ l(se, null),
674
- s[i] ?? /* @__PURE__ */ l(he, null, o, " ", p(i))
760
+ /* @__PURE__ */ l(te, null),
761
+ s[c] ?? /* @__PURE__ */ l(de, null, o, " ", m(c))
675
762
  ) : /* @__PURE__ */ l("div", { "data-slot": "rdg-toolbar-export-wrapper", ref: E }, /* @__PURE__ */ l(
676
763
  "button",
677
764
  {
678
765
  type: "button",
679
- ref: O,
766
+ ref: S,
680
767
  id: h,
681
768
  "data-slot": "rdg-toolbar-export",
682
- "data-state": d ? "on" : "off",
769
+ "data-state": u ? "on" : "off",
683
770
  "aria-haspopup": "menu",
684
- "aria-expanded": d,
685
- "aria-controls": d ? f : void 0,
771
+ "aria-expanded": u,
772
+ "aria-controls": u ? d : void 0,
686
773
  disabled: t,
687
- onClick: () => y((a) => !a),
774
+ onClick: () => f((a) => !a),
688
775
  onKeyDown: (a) => {
689
- (a.key === "ArrowDown" || a.key === "ArrowUp") && (a.preventDefault(), y(!0));
776
+ (a.key === "ArrowDown" || a.key === "ArrowUp") && (a.preventDefault(), f(!0));
690
777
  }
691
778
  },
692
- /* @__PURE__ */ l(se, null),
779
+ /* @__PURE__ */ l(te, null),
693
780
  o
694
- ), d ? /* @__PURE__ */ l(
781
+ ), u ? /* @__PURE__ */ l(
695
782
  "div",
696
783
  {
697
- id: f,
784
+ id: d,
698
785
  role: "menu",
699
786
  "aria-labelledby": h,
700
787
  "data-slot": "rdg-toolbar-export-menu",
701
788
  onKeyDown: (a) => {
702
789
  if (a.key === "Escape") {
703
- a.stopPropagation(), m();
790
+ a.stopPropagation(), g();
704
791
  return;
705
792
  }
706
793
  if (a.key === "ArrowDown") {
707
- a.preventDefault(), b(a.target, 1);
794
+ a.preventDefault(), y(a.target, 1);
708
795
  return;
709
796
  }
710
- a.key === "ArrowUp" && (a.preventDefault(), b(a.target, -1));
797
+ a.key === "ArrowUp" && (a.preventDefault(), y(a.target, -1));
711
798
  }
712
799
  },
713
- n.map((a, S) => /* @__PURE__ */ l(
800
+ r.map((a, _) => /* @__PURE__ */ l(
714
801
  "button",
715
802
  {
716
803
  key: a,
717
804
  type: "button",
718
805
  role: "menuitem",
719
- autoFocus: S === 0,
806
+ autoFocus: _ === 0,
720
807
  "data-slot": "rdg-toolbar-export-format",
721
808
  "data-export-format": a,
722
809
  onClick: () => {
723
- m(), c(a);
810
+ g(), i(a);
724
811
  }
725
812
  },
726
- p(a)
813
+ m(a)
727
814
  ))
728
815
  ) : null);
729
816
  }
730
- const jt = /* @__PURE__ */ Symbol.for("@geovi/the-datagrid/toolbar-target");
731
- function Oe(e) {
732
- return typeof e != "function" && typeof e != "object" || !e ? !1 : e === Ie || e[jt] === !0;
817
+ const Pt = /* @__PURE__ */ Symbol.for("@geovi/the-datagrid/toolbar-target");
818
+ function Re(e) {
819
+ return typeof e != "function" && typeof e != "object" || !e ? !1 : e === Me || e[Pt] === !0;
733
820
  }
734
- const Pt = /* @__PURE__ */ Symbol.for(
821
+ const Ut = /* @__PURE__ */ Symbol.for(
735
822
  "@geovi/the-datagrid/search-target-component"
736
- ), Te = /* @__PURE__ */ Symbol.for(
823
+ ), ve = /* @__PURE__ */ Symbol.for(
737
824
  "@geovi/the-datagrid/toolbar-target-component"
738
825
  );
739
- function pe(e, t) {
826
+ function ie(e, t) {
740
827
  return typeof e != "function" && typeof e != "object" || !e ? !1 : e[t] === !0;
741
828
  }
742
- function Ut(e) {
743
- return pe(e, Pt) || pe(e, Te);
829
+ function Bt(e) {
830
+ return ie(e, Ut) || ie(e, ve);
744
831
  }
745
- function Bt(e, t) {
746
- let n = e;
832
+ function $t(e, t) {
833
+ let r = e;
747
834
  const o = /* @__PURE__ */ new Set();
748
- for (; !o.has(n); ) {
749
- if (o.add(n), t(n.type))
750
- return n;
751
- if (!Ut(n.type)) return null;
752
- const r = n.props.children;
753
- if (!G(r)) return null;
754
- n = r;
835
+ for (; !o.has(r); ) {
836
+ if (o.add(r), t(r.type))
837
+ return r;
838
+ if (!Bt(r.type)) return null;
839
+ const n = r.props.children;
840
+ if (!G(n)) return null;
841
+ r = n;
755
842
  }
756
843
  return null;
757
844
  }
758
- function $t(e, t) {
845
+ function Xt(e, t) {
759
846
  typeof e != "function" && typeof e != "object" || !e || Object.defineProperty(e, t, { value: !0 });
760
847
  }
761
- function Re(e) {
762
- const { children: t } = e, n = e.__rdgSearchController, o = ve(), r = T(
848
+ function we(e) {
849
+ const { children: t } = e, r = e.__rdgSearchController, o = U(), n = R(
763
850
  () => o.createTargetRegistration(),
764
851
  [o]
765
852
  );
766
- if (j(() => r.attach(), [r]), !G(t))
853
+ if (D(() => n.attach(), [n]), !G(t))
767
854
  throw new Error(
768
855
  "RDGToolbarTarget expects exactly one ReactDataGrid child."
769
856
  );
770
- if (!Bt(t, Oe))
857
+ if (!$t(t, Re))
771
858
  throw new Error("RDGToolbarTarget expects a ReactDataGrid child.");
772
859
  const s = {
773
- __rdgToolbarController: r.controller
860
+ __rdgToolbarController: n.controller
774
861
  };
775
- return n !== void 0 && (s.__rdgSearchController = n), be(
862
+ return r !== void 0 && (s.__rdgSearchController = r), fe(
776
863
  t,
777
864
  s
778
865
  );
779
866
  }
780
- $t(Re, Te);
781
- function Kt(e) {
782
- const { children: t } = e, [n] = A(Mt);
783
- j(() => () => n.dispose(), [n]);
784
- const o = T(
785
- () => ge.map(
867
+ Xt(we, ve);
868
+ const Ht = typeof window > "u" ? D : ge;
869
+ function Jt(e) {
870
+ const { children: t, apiRef: r, exportDefaults: o } = e, [n] = A(Vt);
871
+ D(() => () => n.dispose(), [n]), Ht(() => {
872
+ n.setExportDefaults(o);
873
+ }, [n, o]), me(r, () => n.api, [n]);
874
+ const s = R(
875
+ () => ue.map(
786
876
  t,
787
- (r) => G(r) && Oe(r.type) ? /* @__PURE__ */ l(Re, null, r) : r
877
+ (i) => G(i) && Re(i.type) ? /* @__PURE__ */ l(we, null, i) : i
788
878
  ),
789
879
  [t]
790
880
  );
791
- return /* @__PURE__ */ l(_e.Provider, { value: n }, o);
881
+ return /* @__PURE__ */ l(Te.Provider, { value: n }, s);
792
882
  }
793
883
  export {
794
- Wt as RDGToolbar,
795
- Kt as RDGToolbarProvider,
796
- Re as RDGToolbarTarget
884
+ qt as RDGToolbar,
885
+ Jt as RDGToolbarProvider,
886
+ we as RDGToolbarTarget,
887
+ zt as useRDGToolbarApi,
888
+ Yt as useRDGToolbarApiState
797
889
  };