schummar-table 0.51.6 → 0.51.10

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 (47) hide show
  1. package/dist/csvExporter.cjs +35 -2
  2. package/dist/csvExporter.cjs.map +1 -0
  3. package/dist/csvExporter.d.cts +3 -5
  4. package/dist/csvExporter.d.ts +3 -5
  5. package/dist/csvExporter.js +35 -2
  6. package/dist/csvExporter.js.map +1 -0
  7. package/dist/excelExporter.cjs +1 -4
  8. package/dist/excelExporter.cjs.map +1 -1
  9. package/dist/excelExporter.d.cts +1 -2
  10. package/dist/excelExporter.d.ts +2 -4
  11. package/dist/excelExporter.js +1 -2
  12. package/dist/excelExporter.js.map +1 -1
  13. package/dist/{exporter-ZZesPOOU.d.cts → exporter-BT2ehIIU.d.cts} +1 -1
  14. package/dist/{exporter-zK7PhTrL.d.ts → exporter-BT2ehIIU.d.ts} +1 -1
  15. package/dist/index.cjs +683 -744
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +67 -113
  18. package/dist/index.d.ts +67 -112
  19. package/dist/index.js +532 -586
  20. package/dist/index.js.map +1 -1
  21. package/dist/mui4Theme.cjs +24 -28
  22. package/dist/mui4Theme.cjs.map +1 -1
  23. package/dist/mui4Theme.d.cts +4 -11
  24. package/dist/mui4Theme.d.ts +4 -11
  25. package/dist/mui4Theme.js +14 -15
  26. package/dist/mui4Theme.js.map +1 -1
  27. package/dist/mui5Theme.cjs +24 -28
  28. package/dist/mui5Theme.cjs.map +1 -1
  29. package/dist/mui5Theme.d.cts +4 -11
  30. package/dist/mui5Theme.d.ts +4 -11
  31. package/dist/mui5Theme.js +14 -15
  32. package/dist/mui5Theme.js.map +1 -1
  33. package/dist/{chunk-Bp6m_JJh.js → rolldown-runtime-D7D4PA-g.js} +4 -4
  34. package/dist/{tableSettings-CCjCl2iG.js → tableSettings-BxTiw4tQ.js} +30 -27
  35. package/dist/tableSettings-BxTiw4tQ.js.map +1 -0
  36. package/dist/{tableSettings-D1MSPxbQ.cjs → tableSettings-PwnSZTD3.cjs} +139 -104
  37. package/dist/tableSettings-PwnSZTD3.cjs.map +1 -0
  38. package/dist/{types-1gz-mJJm.d.cts → types-dBWLcfCt.d.ts} +80 -12
  39. package/dist/{types-CJOB-Acy.d.ts → types-ikcaSVnB.d.cts} +80 -12
  40. package/package.json +48 -42
  41. package/dist/chunk-pbleEpgJ.cjs +0 -44
  42. package/dist/csvExporter-BGoiph1b.cjs +0 -41
  43. package/dist/csvExporter-BGoiph1b.cjs.map +0 -1
  44. package/dist/csvExporter-CqTylAk9.js +0 -35
  45. package/dist/csvExporter-CqTylAk9.js.map +0 -1
  46. package/dist/tableSettings-CCjCl2iG.js.map +0 -1
  47. package/dist/tableSettings-D1MSPxbQ.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,21 +1,12 @@
1
- const require_chunk = require('./chunk-pbleEpgJ.cjs');
2
- const require_tableSettings = require('./tableSettings-D1MSPxbQ.cjs');
3
- require('./csvExporter-BGoiph1b.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_tableSettings = require("./tableSettings-PwnSZTD3.cjs");
4
3
  let react = require("react");
5
- react = require_chunk.__toESM(react);
6
4
  let immer = require("immer");
7
- immer = require_chunk.__toESM(immer);
8
- let __emotion_react = require("@emotion/react");
9
- __emotion_react = require_chunk.__toESM(__emotion_react);
10
- let __emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
11
- __emotion_react_jsx_runtime = require_chunk.__toESM(__emotion_react_jsx_runtime);
5
+ let _emotion_react = require("@emotion/react");
6
+ let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
12
7
  let nanoid = require("nanoid");
13
- nanoid = require_chunk.__toESM(nanoid);
14
8
  let temporal_polyfill = require("temporal-polyfill");
15
- temporal_polyfill = require_chunk.__toESM(temporal_polyfill);
16
9
  let date_fns = require("date-fns");
17
- date_fns = require_chunk.__toESM(date_fns);
18
-
19
10
  //#region src/misc/tableContext.ts
20
11
  const TableContext = (0, react.createContext)(null);
21
12
  const TableResetContext = (0, react.createContext)(() => void 0);
@@ -30,7 +21,6 @@ function useColumnContext() {
30
21
  if (value === null) throw new Error("No column context available");
31
22
  return value;
32
23
  }
33
-
34
24
  //#endregion
35
25
  //#region src/theme/defaultTheme/defaultColors.ts
36
26
  const defaultColors = {
@@ -54,13 +44,12 @@ const defaultColors = {
54
44
  border: "#777",
55
45
  borderLight: "#eee"
56
46
  };
57
-
58
47
  //#endregion
59
48
  //#region src/components/spinnner.tsx
60
- function Spinner({ className: className$2 }) {
61
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
62
- className: className$2,
63
- css: __emotion_react.css`
49
+ function Spinner({ className }) {
50
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
51
+ className,
52
+ css: _emotion_react.css`
64
53
  display: inline-block;
65
54
  position: relative;
66
55
  width: 1em;
@@ -97,24 +86,23 @@ function Spinner({ className: className$2 }) {
97
86
  }
98
87
  `,
99
88
  children: [
100
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {}),
101
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {}),
102
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {})
89
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {}),
90
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {}),
91
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {})
103
92
  ]
104
93
  });
105
94
  }
106
-
107
95
  //#endregion
108
96
  //#region src/theme/defaultTheme/badge.tsx
109
97
  const Badge = ({ badgeContent, children }) => {
110
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("span", {
98
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("span", {
111
99
  css: {
112
100
  display: "inline-flex",
113
101
  position: "relative",
114
102
  flexShrink: 0,
115
103
  verticalAlign: "middle"
116
104
  },
117
- children: [children, /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("span", {
105
+ children: [children, /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", {
118
106
  css: [{
119
107
  top: 0,
120
108
  right: 0,
@@ -142,11 +130,10 @@ const Badge = ({ badgeContent, children }) => {
142
130
  })]
143
131
  });
144
132
  };
145
-
146
133
  //#endregion
147
134
  //#region src/theme/defaultTheme/button.tsx
148
- const Button = ({ startIcon, children, variant = "text",...props }) => {
149
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("button", {
135
+ const Button = ({ startIcon, children, variant = "text", ...props }) => {
136
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("button", {
150
137
  css: [
151
138
  {
152
139
  padding: `var(--spacing) calc(var(--spacing) * 2)`,
@@ -176,17 +163,16 @@ const Button = ({ startIcon, children, variant = "text",...props }) => {
176
163
  }
177
164
  ],
178
165
  ...props,
179
- children: [startIcon && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("span", {
166
+ children: [startIcon && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", {
180
167
  css: { marginRight: `calc(var(--spacing) * 2)` },
181
168
  children: startIcon
182
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("span", { children })]
169
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", { children })]
183
170
  });
184
171
  };
185
-
186
172
  //#endregion
187
173
  //#region src/theme/defaultTheme/checkbox.tsx
188
- const Checkbox = ({ className: className$2,...props }) => {
189
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("label", {
174
+ const Checkbox = ({ className, ...props }) => {
175
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("label", {
190
176
  css: [{
191
177
  padding: "calc(var(--spacing) * 1.8)",
192
178
  display: "flex",
@@ -197,11 +183,11 @@ const Checkbox = ({ className: className$2,...props }) => {
197
183
  margin: 0
198
184
  }
199
185
  }, props.disabled && { color: "rgba(0, 0, 0, 0.26)" }],
200
- className: className$2,
201
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("input", {
186
+ className,
187
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("input", {
202
188
  type: "checkbox",
203
189
  ...props
204
- }), props.checked ? /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("svg", {
190
+ }), props.checked ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("svg", {
205
191
  css: {
206
192
  fontSize: "1.25rem",
207
193
  width: "1em",
@@ -211,8 +197,8 @@ const Checkbox = ({ className: className$2,...props }) => {
211
197
  focusable: "false",
212
198
  viewBox: "0 0 24 24",
213
199
  "aria-hidden": "true",
214
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", { d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" })
215
- }) : /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("svg", {
200
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", { d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" })
201
+ }) : /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("svg", {
216
202
  css: {
217
203
  fontSize: "1.25rem",
218
204
  width: "1em",
@@ -222,15 +208,14 @@ const Checkbox = ({ className: className$2,...props }) => {
222
208
  focusable: "false",
223
209
  viewBox: "0 0 24 24",
224
210
  "aria-hidden": "true",
225
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", { d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" })
211
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", { d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" })
226
212
  })]
227
213
  });
228
214
  };
229
-
230
215
  //#endregion
231
216
  //#region src/theme/defaultTheme/iconButton.tsx
232
217
  const IconButton = (props) => {
233
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("button", {
218
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("button", {
234
219
  css: {
235
220
  padding: "var(--spacing)",
236
221
  borderRadius: "50%",
@@ -248,12 +233,11 @@ const IconButton = (props) => {
248
233
  ...props
249
234
  });
250
235
  };
251
-
252
236
  //#endregion
253
237
  //#region src/theme/defaultTheme/textField.tsx
254
- const TextField = ({ startIcon, endIcon, className: className$2, inputRef, onBlur,...props }) => {
255
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
256
- className: className$2,
238
+ const TextField = ({ startIcon, endIcon, className, inputRef, onBlur, ...props }) => {
239
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
240
+ className,
257
241
  css: [{
258
242
  flex: 1,
259
243
  display: "flex",
@@ -267,7 +251,7 @@ const TextField = ({ startIcon, endIcon, className: className$2, inputRef, onBlu
267
251
  }],
268
252
  children: [
269
253
  startIcon,
270
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("input", {
254
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("input", {
271
255
  ref: inputRef,
272
256
  ...props,
273
257
  value: props.value ?? "",
@@ -289,7 +273,6 @@ const TextField = ({ startIcon, endIcon, className: className$2, inputRef, onBlu
289
273
  ]
290
274
  });
291
275
  };
292
-
293
276
  //#endregion
294
277
  //#region src/theme/defaultTheme/defaultComponents.ts
295
278
  const defaultComponents = {
@@ -301,178 +284,163 @@ const defaultComponents = {
301
284
  TextField,
302
285
  Spinner
303
286
  };
304
-
305
287
  //#endregion
306
288
  //#region src/theme/defaultTheme/defaultIcons.tsx
307
- const IconDefaultStyle = (0, __emotion_react.css)({
289
+ const IconDefaultStyle = (0, _emotion_react.css)({
308
290
  width: "1.5em",
309
291
  height: "1.5em",
310
292
  color: "inherit"
311
293
  });
312
294
  function Icon(svg) {
313
295
  return function IconComponent(props) {
314
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(__emotion_react.ClassNames, { children: ({ css: css$2 }) => (0, react.cloneElement)(svg, {
296
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(_emotion_react.ClassNames, { children: ({ css }) => (0, react.cloneElement)(svg, {
315
297
  ...props,
316
- className: css$2(IconDefaultStyle, props.className)
298
+ className: css(IconDefaultStyle, props.className)
317
299
  }) });
318
300
  };
319
301
  }
320
- const Settings = Icon(/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("svg", {
321
- xmlns: "http://www.w3.org/2000/svg",
322
- height: "24px",
323
- viewBox: "0 0 24 24",
324
- width: "24px",
325
- fill: "currentColor",
326
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", {
327
- d: "M0 0h24v24H0V0z",
328
- fill: "none"
329
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", { d: "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z" })]
330
- }));
331
- const Export$1 = Icon(/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("svg", {
332
- xmlns: "http://www.w3.org/2000/svg",
333
- enableBackground: "new 0 0 24 24",
334
- height: "24px",
335
- viewBox: "0 0 24 24",
336
- width: "24px",
337
- fill: "currentColor",
338
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("g", { children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("rect", {
339
- fill: "none",
340
- height: "24",
341
- width: "24"
342
- }) }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("g", { children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", { d: "M18,15v3H6v-3H4v3c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-3H18z M17,11l-1.41-1.41L13,12.17V4h-2v8.17L8.41,9.59L7,11l5,5 L17,11z" }) })]
343
- }));
344
- const Clipboard = Icon(/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("svg", {
345
- xmlns: "http://www.w3.org/2000/svg",
346
- height: "24px",
347
- viewBox: "0 0 24 24",
348
- width: "24px",
349
- fill: "currentColor",
350
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", {
351
- d: "M0 0h24v24H0V0z",
352
- fill: "none"
353
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", { d: "M19 2h-4.18C14.4.84 13.3 0 12 0S9.6.84 9.18 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z" })]
354
- }));
355
- const ChevronRight = Icon(/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("svg", {
356
- xmlns: "http://www.w3.org/2000/svg",
357
- height: "24px",
358
- viewBox: "0 0 24 24",
359
- width: "24px",
360
- fill: "currentColor",
361
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", {
362
- d: "M0 0h24v24H0V0z",
363
- fill: "none"
364
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", { d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z" })]
365
- }));
366
- const Search = Icon(/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("svg", {
367
- xmlns: "http://www.w3.org/2000/svg",
368
- height: "24px",
369
- viewBox: "0 0 24 24",
370
- width: "24px",
371
- fill: "currentColor",
372
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", {
373
- d: "M0 0h24v24H0V0z",
374
- fill: "none"
375
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", { d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" })]
376
- }));
377
- const Clear = Icon(/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("svg", {
378
- xmlns: "http://www.w3.org/2000/svg",
379
- height: "24px",
380
- viewBox: "0 0 24 24",
381
- width: "24px",
382
- fill: "currentColor",
383
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", {
384
- d: "M0 0h24v24H0V0z",
385
- fill: "none"
386
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" })]
387
- }));
388
- const ArrowDropDown = Icon(/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("svg", {
389
- xmlns: "http://www.w3.org/2000/svg",
390
- height: "24px",
391
- viewBox: "0 0 24 24",
392
- width: "24px",
393
- fill: "currentColor",
394
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", {
395
- d: "M0 0h24v24H0V0z",
396
- fill: "none"
397
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", { d: "M7 10l5 5 5-5H7z" })]
398
- }));
399
- const FilterList = Icon(/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("svg", {
400
- viewBox: "0 0 24 24",
401
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", {
402
- fill: "currentColor",
403
- d: "M14,12V19.88C14.04,20.18 13.94,20.5 13.71,20.71C13.32,21.1 12.69,21.1 12.3,20.71L10.29,18.7C10.06,18.47 9.96,18.16 10,17.87V12H9.97L4.21,4.62C3.87,4.19 3.95,3.56 4.38,3.22C4.57,3.08 4.78,3 5,3V3H19V3C19.22,3 19.43,3.08 19.62,3.22C20.05,3.56 20.13,4.19 19.79,4.62L14.03,12H14Z"
404
- })
405
- }));
406
- const ArrowUpward = Icon(/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("svg", {
407
- xmlns: "http://www.w3.org/2000/svg",
408
- height: "24px",
409
- viewBox: "0 0 24 24",
410
- width: "24px",
411
- fill: "currentColor",
412
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", {
413
- d: "M0 0h24v24H0V0z",
414
- fill: "none"
415
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("path", { d: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z" })]
416
- }));
417
- const defaultIcons = {
418
- Settings,
419
- Export: Export$1,
420
- Clipboard,
421
- ChevronRight,
422
- Search,
423
- Clear,
424
- ArrowDropDown,
425
- FilterList,
426
- ArrowUpward
427
- };
428
-
429
- //#endregion
430
- //#region src/theme/defaultTheme/defaultTexts.tsx
431
- const defaultTexts = {
432
- selectColumns: "Select visible columns",
433
- showAllColumns: "Show all",
434
- hideAllColumns: "Hide all",
435
- noResults: "No results",
436
- exportTitle: "Export",
437
- exportCopy: "To clipboard",
438
- exportDownload: "Download",
439
- today: "Today",
440
- thisWeek: "This week",
441
- thisMonth: "This month",
442
- thisYear: "This year",
443
- lastSevenDays: "Last 7 days",
444
- lastThirtyDays: "Last 30 days",
445
- clearFilters: "Clear all filters",
446
- reset: "Reset",
447
- loading: "Loading",
448
- deselectAll: "Deselect all",
449
- resetAll: "Reset table state",
450
- rangeMin: "Min",
451
- rangeMax: "Max",
452
- calendarWeek: "Wk"
453
- };
454
-
455
302
  //#endregion
456
303
  //#region src/theme/defaultTheme/index.tsx
457
304
  const defaultTableTheme = {
458
- text: defaultTexts,
305
+ text: {
306
+ selectColumns: "Select visible columns",
307
+ showAllColumns: "Show all",
308
+ hideAllColumns: "Hide all",
309
+ noResults: "No results",
310
+ exportTitle: "Export",
311
+ exportCopy: "To clipboard",
312
+ exportDownload: "Download",
313
+ today: "Today",
314
+ thisWeek: "This week",
315
+ thisMonth: "This month",
316
+ thisYear: "This year",
317
+ lastSevenDays: "Last 7 days",
318
+ lastThirtyDays: "Last 30 days",
319
+ clearFilters: "Clear all filters",
320
+ reset: "Reset",
321
+ loading: "Loading",
322
+ deselectAll: "Deselect all",
323
+ resetAll: "Reset table state",
324
+ rangeMin: "Min",
325
+ rangeMax: "Max",
326
+ calendarWeek: "Wk"
327
+ },
459
328
  components: defaultComponents,
460
- icons: defaultIcons,
329
+ icons: {
330
+ Settings: Icon(/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("svg", {
331
+ xmlns: "http://www.w3.org/2000/svg",
332
+ height: "24px",
333
+ viewBox: "0 0 24 24",
334
+ width: "24px",
335
+ fill: "currentColor",
336
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", {
337
+ d: "M0 0h24v24H0V0z",
338
+ fill: "none"
339
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", { d: "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z" })]
340
+ })),
341
+ Export: Icon(/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("svg", {
342
+ xmlns: "http://www.w3.org/2000/svg",
343
+ enableBackground: "new 0 0 24 24",
344
+ height: "24px",
345
+ viewBox: "0 0 24 24",
346
+ width: "24px",
347
+ fill: "currentColor",
348
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("g", { children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("rect", {
349
+ fill: "none",
350
+ height: "24",
351
+ width: "24"
352
+ }) }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("g", { children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", { d: "M18,15v3H6v-3H4v3c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-3H18z M17,11l-1.41-1.41L13,12.17V4h-2v8.17L8.41,9.59L7,11l5,5 L17,11z" }) })]
353
+ })),
354
+ Clipboard: Icon(/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("svg", {
355
+ xmlns: "http://www.w3.org/2000/svg",
356
+ height: "24px",
357
+ viewBox: "0 0 24 24",
358
+ width: "24px",
359
+ fill: "currentColor",
360
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", {
361
+ d: "M0 0h24v24H0V0z",
362
+ fill: "none"
363
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", { d: "M19 2h-4.18C14.4.84 13.3 0 12 0S9.6.84 9.18 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z" })]
364
+ })),
365
+ ChevronRight: Icon(/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("svg", {
366
+ xmlns: "http://www.w3.org/2000/svg",
367
+ height: "24px",
368
+ viewBox: "0 0 24 24",
369
+ width: "24px",
370
+ fill: "currentColor",
371
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", {
372
+ d: "M0 0h24v24H0V0z",
373
+ fill: "none"
374
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", { d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z" })]
375
+ })),
376
+ Search: Icon(/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("svg", {
377
+ xmlns: "http://www.w3.org/2000/svg",
378
+ height: "24px",
379
+ viewBox: "0 0 24 24",
380
+ width: "24px",
381
+ fill: "currentColor",
382
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", {
383
+ d: "M0 0h24v24H0V0z",
384
+ fill: "none"
385
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", { d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" })]
386
+ })),
387
+ Clear: Icon(/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("svg", {
388
+ xmlns: "http://www.w3.org/2000/svg",
389
+ height: "24px",
390
+ viewBox: "0 0 24 24",
391
+ width: "24px",
392
+ fill: "currentColor",
393
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", {
394
+ d: "M0 0h24v24H0V0z",
395
+ fill: "none"
396
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" })]
397
+ })),
398
+ ArrowDropDown: Icon(/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("svg", {
399
+ xmlns: "http://www.w3.org/2000/svg",
400
+ height: "24px",
401
+ viewBox: "0 0 24 24",
402
+ width: "24px",
403
+ fill: "currentColor",
404
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", {
405
+ d: "M0 0h24v24H0V0z",
406
+ fill: "none"
407
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", { d: "M7 10l5 5 5-5H7z" })]
408
+ })),
409
+ FilterList: Icon(/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("svg", {
410
+ viewBox: "0 0 24 24",
411
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", {
412
+ fill: "currentColor",
413
+ d: "M14,12V19.88C14.04,20.18 13.94,20.5 13.71,20.71C13.32,21.1 12.69,21.1 12.3,20.71L10.29,18.7C10.06,18.47 9.96,18.16 10,17.87V12H9.97L4.21,4.62C3.87,4.19 3.95,3.56 4.38,3.22C4.57,3.08 4.78,3 5,3V3H19V3C19.22,3 19.43,3.08 19.62,3.22C20.05,3.56 20.13,4.19 19.79,4.62L14.03,12H14Z"
414
+ })
415
+ })),
416
+ ArrowUpward: Icon(/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("svg", {
417
+ xmlns: "http://www.w3.org/2000/svg",
418
+ height: "24px",
419
+ viewBox: "0 0 24 24",
420
+ width: "24px",
421
+ fill: "currentColor",
422
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", {
423
+ d: "M0 0h24v24H0V0z",
424
+ fill: "none"
425
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", { d: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z" })]
426
+ }))
427
+ },
461
428
  colors: defaultColors,
462
429
  spacing: "5px"
463
430
  };
464
-
465
431
  //#endregion
466
432
  //#region src/hooks/useTableMemo.tsx
467
- const TableMemoContext = (0, react.createContext)(/* @__PURE__ */ new Map());
433
+ const TableMemoContext = (0, react.createContext)(void 0);
468
434
  function TableMemoContextProvider({ children }) {
469
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(TableMemoContext.Provider, {
435
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(TableMemoContext.Provider, {
470
436
  value: (0, react.useMemo)(() => /* @__PURE__ */ new Map(), []),
471
437
  children
472
438
  });
473
439
  }
474
440
  function useTableMemo() {
475
- const memoCache = (0, react.useContext)(TableMemoContext);
441
+ const contextCache = (0, react.useContext)(TableMemoContext);
442
+ const localCache = (0, react.useRef)(void 0);
443
+ const memoCache = contextCache ?? (localCache.current ??= /* @__PURE__ */ new Map());
476
444
  return (key, function_) => {
477
445
  let deps;
478
446
  if (Array.isArray(function_)) {
@@ -488,7 +456,6 @@ function useTableMemo() {
488
456
  return cachedValue[0];
489
457
  };
490
458
  }
491
-
492
459
  //#endregion
493
460
  //#region src/hooks/useTheme.ts
494
461
  const emptyStore = new require_tableSettings.Store(void 0);
@@ -496,7 +463,7 @@ function useTheme(selector) {
496
463
  const { theme: contextTableTheme = {} } = (0, react.useContext)(require_tableSettings.TableSettingsContext);
497
464
  const table = (0, react.useContext)(TableContext);
498
465
  const columnId = (0, react.useContext)(ColumnContext);
499
- const memo$3 = useTableMemo();
466
+ const memo = useTableMemo();
500
467
  const _globalTableTheme = require_tableSettings.globalTableTheme.useState();
501
468
  const process = (t) => {
502
469
  const rowClass = t.classes?.row;
@@ -509,15 +476,15 @@ function useTheme(selector) {
509
476
  ...t,
510
477
  classes: {
511
478
  ...t.classes,
512
- row: rowClass instanceof Function || Array.isArray(rowClass) ? memo$3("theme.classes.row", rowClass) : rowClass,
513
- cell: cellClass instanceof Function || Array.isArray(cellClass) ? memo$3("theme.classes.cell", cellClass) : cellClass,
514
- details: detailsClass instanceof Function || Array.isArray(detailsClass) ? memo$3("theme.classes.details", detailsClass) : detailsClass
479
+ row: rowClass instanceof Function || Array.isArray(rowClass) ? memo("theme.classes.row", rowClass) : rowClass,
480
+ cell: cellClass instanceof Function || Array.isArray(cellClass) ? memo("theme.classes.cell", cellClass) : cellClass,
481
+ details: detailsClass instanceof Function || Array.isArray(detailsClass) ? memo("theme.classes.details", detailsClass) : detailsClass
515
482
  },
516
483
  styles: {
517
484
  ...t.styles,
518
- row: rowStyles instanceof Function || Array.isArray(rowStyles) ? memo$3("theme.styles.row", rowStyles) : rowStyles,
519
- cell: cellStyles instanceof Function || Array.isArray(cellStyles) ? memo$3("theme.styles.cell", cellStyles) : cellStyles,
520
- details: detailsStyles instanceof Function || Array.isArray(detailsStyles) ? memo$3("theme.styles.details", detailsStyles) : detailsStyles
485
+ row: rowStyles instanceof Function || Array.isArray(rowStyles) ? memo("theme.styles.row", rowStyles) : rowStyles,
486
+ cell: cellStyles instanceof Function || Array.isArray(cellStyles) ? memo("theme.styles.cell", cellStyles) : cellStyles,
487
+ details: detailsStyles instanceof Function || Array.isArray(detailsStyles) ? memo("theme.styles.details", detailsStyles) : detailsStyles
521
488
  },
522
489
  text: { ...t.text }
523
490
  };
@@ -532,14 +499,15 @@ function useTheme(selector) {
532
499
  colors: state.props.colors,
533
500
  spacing: state.props.spacing
534
501
  };
535
- const column = state.activeColumns.find((column$1) => column$1.id === columnId);
536
- return selector(process(require_tableSettings.mergeThemes(defaultTableTheme, _globalTableTheme, contextTableTheme, localTheme, {
502
+ const column = state.activeColumns.find((column) => column.id === columnId);
503
+ const columnsTheme = {
537
504
  classes: column?.classes,
538
505
  styles: column?.styles
539
- })));
506
+ };
507
+ const theme = require_tableSettings.mergeThemes(defaultTableTheme, _globalTableTheme, contextTableTheme, localTheme, columnsTheme);
508
+ return selector(process(theme));
540
509
  }) ?? emptyStore.useState() ?? selector(process(require_tableSettings.mergeThemes(defaultTableTheme, _globalTableTheme, contextTableTheme)));
541
510
  }
542
-
543
511
  //#endregion
544
512
  //#region src/theme/useCssVariables.ts
545
513
  function useCssVariables() {
@@ -562,7 +530,6 @@ function useCssVariables() {
562
530
  };
563
531
  });
564
532
  }
565
-
566
533
  //#endregion
567
534
  //#region src/components/filterControl.tsx
568
535
  const FilterControlContext = (0, react.createContext)({
@@ -572,18 +539,18 @@ const FilterControlContext = (0, react.createContext)({
572
539
  function FilterControl() {
573
540
  const table = useTableContext();
574
541
  const columnId = useColumnContext();
575
- const Popover$1 = useTheme((t) => t.components.Popover);
542
+ const Popover = useTheme((t) => t.components.Popover);
576
543
  const classes = useTheme((t) => t.classes);
577
544
  const styles = useTheme((t) => t.styles);
578
- const IconButton$1 = useTheme((t) => t.components.IconButton);
579
- const FilterList$1 = useTheme((t) => t.icons.FilterList);
580
- const ArrowDropDown$1 = useTheme((t) => t.icons.ArrowDropDown);
545
+ const IconButton = useTheme((t) => t.components.IconButton);
546
+ const FilterList = useTheme((t) => t.icons.FilterList);
547
+ const ArrowDropDown = useTheme((t) => t.icons.ArrowDropDown);
581
548
  const cssVariables = useCssVariables();
582
549
  const [anchor, setAnchor] = (0, react.useState)(null);
583
550
  const isActive = table.useState((state) => {
584
- const filter$1 = state.filters.get(columnId);
551
+ const filter = state.filters.get(columnId);
585
552
  const filterValue = state.filterValues.get(columnId);
586
- return filter$1 !== void 0 && filterValue !== void 0 && filter$1.isActive(filterValue);
553
+ return filter !== void 0 && filterValue !== void 0 && filter.isActive(filterValue);
587
554
  });
588
555
  const filterClassNames = table.useState((state) => {
589
556
  return state.filters.get(columnId)?.classNames;
@@ -600,12 +567,12 @@ function FilterControl() {
600
567
  function close() {
601
568
  setAnchor(null);
602
569
  }
603
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(FilterControlContext.Provider, {
570
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(FilterControlContext.Provider, {
604
571
  value: {
605
572
  isActive: !!anchor,
606
573
  close
607
574
  },
608
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(IconButton$1, {
575
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(IconButton, {
609
576
  onClick: (event) => setAnchor(event.currentTarget),
610
577
  onContextMenu: (event) => {
611
578
  reset();
@@ -613,32 +580,31 @@ function FilterControl() {
613
580
  return false;
614
581
  },
615
582
  css: [{ color: "#b0bac9" }, isActive && { color: "var(--primaryMain) !important" }],
616
- children: isActive ? /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(FilterList$1, {}) : /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ArrowDropDown$1, {})
617
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
583
+ children: isActive ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(FilterList, {}) : /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ArrowDropDown, {})
584
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
618
585
  onPointerDown: (event) => {
619
586
  event.stopPropagation();
620
587
  },
621
588
  onPointerMove: (event) => {
622
589
  event.stopPropagation();
623
590
  },
624
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(__emotion_react.ClassNames, { children: ({ css: css$2, cx: cx$1 }) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Popover$1, {
591
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(_emotion_react.ClassNames, { children: ({ css, cx }) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Popover, {
625
592
  open: true,
626
593
  hidden: !anchor,
627
594
  onClose: close,
628
595
  anchorEl: anchor ?? document.body,
629
596
  css: [cssVariables, styles?.popover],
630
- className: cx$1(classes?.popover, filterClassNames?.popover),
631
- backdropClassName: cx$1(classes?.popoverBackdrop, filterClassNames?.popoverBackdrop, css$2(styles?.popoverBackdrop)),
597
+ className: cx(classes?.popover, filterClassNames?.popover),
598
+ backdropClassName: cx(classes?.popoverBackdrop, filterClassNames?.popoverBackdrop, css(styles?.popoverBackdrop)),
632
599
  children: filter
633
600
  }) })
634
601
  })]
635
602
  });
636
603
  }
637
-
638
604
  //#endregion
639
605
  //#region src/components/autoFocusTextField.tsx
640
606
  function AutoFocusTextField(props) {
641
- const TextField$1 = useTheme((t) => t.components.TextField);
607
+ const TextField = useTheme((t) => t.components.TextField);
642
608
  const ref = (0, react.useRef)(null);
643
609
  const { isActive } = (0, react.useContext)(FilterControlContext);
644
610
  (0, react.useLayoutEffect)(() => {
@@ -646,7 +612,7 @@ function AutoFocusTextField(props) {
646
612
  ref.current?.focus();
647
613
  });
648
614
  }, [isActive]);
649
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(TextField$1, {
615
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(TextField, {
650
616
  ...props,
651
617
  inputRef: ref,
652
618
  css: { input: {
@@ -655,7 +621,6 @@ function AutoFocusTextField(props) {
655
621
  } }
656
622
  });
657
623
  }
658
-
659
624
  //#endregion
660
625
  //#region src/misc/debounce.ts
661
626
  function debounce(function_, ms) {
@@ -687,7 +652,6 @@ function debounce(function_, ms) {
687
652
  }
688
653
  });
689
654
  }
690
-
691
655
  //#endregion
692
656
  //#region src/hooks/useFilter.ts
693
657
  function useFilter(impl) {
@@ -728,17 +692,17 @@ function useFilter(impl) {
728
692
  (0, react.useLayoutEffect)(() => {
729
693
  implRef.current = impl;
730
694
  });
731
- const delayedUpdate = (0, react.useMemo)(() => debounce((value$1) => {
732
- const { value: controlledValue, onChange: onChange$1 } = implRef.current;
695
+ const delayedUpdate = (0, react.useMemo)(() => debounce((value) => {
696
+ const { value: controlledValue, onChange } = implRef.current;
733
697
  if (controlledValue === void 0) table.update((state) => {
734
- state.filterValues.set(columnId, value$1);
698
+ state.filterValues.set(columnId, value);
735
699
  });
736
- onChange$1?.(value$1);
700
+ onChange?.(value);
737
701
  setDirtyValue(void 0);
738
702
  }, 500), [table]);
739
- function onChange(value$1) {
740
- setDirtyValue(value$1);
741
- delayedUpdate(value$1);
703
+ function onChange(value) {
704
+ setDirtyValue(value);
705
+ delayedUpdate(value);
742
706
  }
743
707
  (0, react.useEffect)(() => delayedUpdate.flush(), [delayedUpdate]);
744
708
  const context = (0, react.useContext)(FilterControlContext);
@@ -749,7 +713,6 @@ function useFilter(impl) {
749
713
  ...context
750
714
  };
751
715
  }
752
-
753
716
  //#endregion
754
717
  //#region src/components/filterDialog.tsx
755
718
  var filterDialog_default = (0, react.forwardRef)(FilterDialog);
@@ -758,19 +721,19 @@ function FilterDialog(_props, ref) {
758
721
  const columnId = useColumnContext();
759
722
  const classes = useTheme((t) => t.classes);
760
723
  const styles = useTheme((t) => t.styles);
761
- const IconButton$1 = useTheme((t) => t.components.IconButton);
762
- const FilterList$1 = useTheme((t) => t.icons.FilterList);
724
+ const IconButton = useTheme((t) => t.components.IconButton);
725
+ const FilterList = useTheme((t) => t.icons.FilterList);
763
726
  const filter = table.useState((state) => state.activeColumns.find((column) => column.id === columnId)?.filter);
764
727
  const label = table.useState((state) => {
765
728
  return state.activeColumns.find((column) => column.id === columnId)?.header ?? null;
766
729
  });
767
730
  const isActive = table.useState((state) => {
768
- const filter$1 = state.filters.get(columnId);
731
+ const filter = state.filters.get(columnId);
769
732
  const filterValue = state.filterValues.get(columnId);
770
- return filter$1 !== void 0 && filterValue !== void 0 && filter$1.isActive(filterValue);
733
+ return filter !== void 0 && filterValue !== void 0 && filter.isActive(filterValue);
771
734
  });
772
735
  const { close } = (0, react.useContext)(FilterControlContext);
773
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("dialog", {
736
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("dialog", {
774
737
  ref,
775
738
  onClick: close,
776
739
  className: classes?.dialog,
@@ -780,9 +743,9 @@ function FilterDialog(_props, ref) {
780
743
  borderRadius: 4,
781
744
  "::backdrop": { backgroundColor: "rgba(0, 0, 0, 0.7)" }
782
745
  }, styles?.dialog],
783
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
746
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
784
747
  onClick: (e) => e.stopPropagation(),
785
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
748
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
786
749
  css: {
787
750
  position: "relative",
788
751
  padding: 10,
@@ -792,8 +755,8 @@ function FilterDialog(_props, ref) {
792
755
  gap: 10
793
756
  },
794
757
  children: [
795
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(FilterList$1, { css: { color: isActive ? "var(--primaryMain)" : "#b0bac9" } }),
796
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
758
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(FilterList, { css: { color: isActive ? "var(--primaryMain)" : "#b0bac9" } }),
759
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
797
760
  css: {
798
761
  whiteSpace: "nowrap",
799
762
  overflow: "hidden",
@@ -802,7 +765,7 @@ function FilterDialog(_props, ref) {
802
765
  },
803
766
  children: label
804
767
  }),
805
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(IconButton$1, {
768
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(IconButton, {
806
769
  onClick: close,
807
770
  css: {
808
771
  position: "absolute",
@@ -816,29 +779,28 @@ function FilterDialog(_props, ref) {
816
779
  children: "✕"
817
780
  })
818
781
  ]
819
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
782
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
820
783
  css: { overflow: "auto" },
821
784
  children: filter
822
785
  })]
823
786
  })
824
787
  });
825
788
  }
826
-
827
789
  //#endregion
828
790
  //#region src/components/nestedFilterControl.tsx
829
791
  function NestedFilterControl() {
830
792
  const table = useTableContext();
831
793
  const columnId = useColumnContext();
832
- const Button$1 = useTheme((t) => t.components.Button);
833
- const FilterList$1 = useTheme((t) => t.icons.FilterList);
794
+ const Button = useTheme((t) => t.components.Button);
795
+ const FilterList = useTheme((t) => t.icons.FilterList);
834
796
  const dialog = (0, react.useRef)(null);
835
797
  const label = table.useState((state) => {
836
798
  return state.activeColumns.find((column) => column.id === columnId)?.header ?? null;
837
799
  });
838
800
  const isActive = table.useState((state) => {
839
- const filter$1 = state.filters.get(columnId);
801
+ const filter = state.filters.get(columnId);
840
802
  const filterValue = state.filterValues.get(columnId);
841
- return filter$1 !== void 0 && filterValue !== void 0 && filter$1.isActive(filterValue);
803
+ return filter !== void 0 && filterValue !== void 0 && filter.isActive(filterValue);
842
804
  });
843
805
  const filter = table.useState((state) => state.activeColumns.find((column) => column.id === columnId)?.filter);
844
806
  (0, react.useEffect)(() => () => {
@@ -857,39 +819,38 @@ function NestedFilterControl() {
857
819
  dialog.current?.close();
858
820
  parentContext.close();
859
821
  }
860
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(FilterControlContext.Provider, {
822
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(FilterControlContext.Provider, {
861
823
  value: {
862
824
  isActive: true,
863
825
  close
864
826
  },
865
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Button$1, {
827
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Button, {
866
828
  onClick: () => dialog.current?.showModal(),
867
829
  onContextMenu: (event) => {
868
830
  reset();
869
831
  event.preventDefault();
870
832
  return false;
871
833
  },
872
- startIcon: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(FilterList$1, { css: { color: isActive ? "var(--primaryMain)" : "#b0bac9" } }),
834
+ startIcon: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(FilterList, { css: { color: isActive ? "var(--primaryMain)" : "#b0bac9" } }),
873
835
  css: {
874
836
  width: "100%",
875
837
  color: isActive ? "var(--primaryMain)" : "var(--color-text)"
876
838
  },
877
839
  children: label
878
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
840
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
879
841
  onPointerDown: (event) => {
880
842
  event.stopPropagation();
881
843
  },
882
844
  onPointerMove: (event) => {
883
845
  event.stopPropagation();
884
846
  },
885
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(filterDialog_default, { ref: dialog })
847
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(filterDialog_default, { ref: dialog })
886
848
  })]
887
849
  });
888
850
  }
889
-
890
851
  //#endregion
891
852
  //#region src/components/combinedFilter.tsx
892
- function CombinedFilter({ columnIds: inputColumnIds,...props }) {
853
+ function CombinedFilter({ columnIds: inputColumnIds, ...props }) {
893
854
  const table = useTableContext();
894
855
  const columnIds = table.useState((state) => {
895
856
  return inputColumnIds ?? state.activeColumns.filter((column) => column.filter !== void 0 && !state.visibleColumns.some((c) => c.id === column.id)).map((column) => column.id);
@@ -921,12 +882,11 @@ function CombinedFilter({ columnIds: inputColumnIds,...props }) {
921
882
  }
922
883
  }
923
884
  });
924
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", { children: columnIds.map((columnId) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ColumnContext.Provider, {
885
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", { children: columnIds.map((columnId) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ColumnContext.Provider, {
925
886
  value: columnId,
926
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(NestedFilterControl, {})
887
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(NestedFilterControl, {})
927
888
  }, columnId)) });
928
889
  }
929
-
930
890
  //#endregion
931
891
  //#region src/misc/defaults.ts
932
892
  function defaults(first, ...more) {
@@ -936,7 +896,6 @@ function defaults(first, ...more) {
936
896
  return copy;
937
897
  }, first);
938
898
  }
939
-
940
899
  //#endregion
941
900
  //#region src/vendor/dayzed/utils.ts
942
901
  /**
@@ -1007,7 +966,8 @@ function addMonth({ calendars, offset, maxDate }) {
1007
966
  function isBackDisabled({ calendars, minDate }) {
1008
967
  if (!minDate) return false;
1009
968
  const { firstDayOfMonth } = calendars[0];
1010
- if ((0, date_fns.isBefore)((0, date_fns.addDays)(firstDayOfMonth, -1), minDate)) return true;
969
+ const firstDayOfMonthMinusOne = (0, date_fns.addDays)(firstDayOfMonth, -1);
970
+ if ((0, date_fns.isBefore)(firstDayOfMonthMinusOne, minDate)) return true;
1011
971
  return false;
1012
972
  }
1013
973
  /**
@@ -1021,7 +981,8 @@ function isBackDisabled({ calendars, minDate }) {
1021
981
  function isForwardDisabled({ calendars, maxDate }) {
1022
982
  if (!maxDate) return false;
1023
983
  const { lastDayOfMonth } = calendars[calendars.length - 1];
1024
- if ((0, date_fns.isBefore)(maxDate, (0, date_fns.addDays)(lastDayOfMonth, 1))) return true;
984
+ const lastDayOfMonthPlusOne = (0, date_fns.addDays)(lastDayOfMonth, 1);
985
+ if ((0, date_fns.isBefore)(maxDate, lastDayOfMonthPlusOne)) return true;
1025
986
  return false;
1026
987
  }
1027
988
  /**
@@ -1274,7 +1235,6 @@ function isSelectable(minDate, maxDate, date) {
1274
1235
  if (minDate && (0, date_fns.isBefore)(date, minDate) || maxDate && (0, date_fns.isBefore)(maxDate, date)) return false;
1275
1236
  return true;
1276
1237
  }
1277
-
1278
1238
  //#endregion
1279
1239
  //#region src/vendor/dayzed/dayzed.ts
1280
1240
  function isOffsetControlled(propOffset) {
@@ -1283,7 +1243,7 @@ function isOffsetControlled(propOffset) {
1283
1243
  function getOffset(prop, state) {
1284
1244
  return isOffsetControlled(prop) ? prop : state;
1285
1245
  }
1286
- function getDateProps(onDateSelected, { onClick, dateObj = requiredProp("getDateProps", "dateObj"),...rest } = {}) {
1246
+ function getDateProps(onDateSelected, { onClick, dateObj = requiredProp("getDateProps", "dateObj"), ...rest } = {}) {
1287
1247
  return {
1288
1248
  onClick: composeEventHandlers(onClick, (event) => {
1289
1249
  onDateSelected?.(dateObj, event);
@@ -1295,7 +1255,7 @@ function getDateProps(onDateSelected, { onClick, dateObj = requiredProp("getDate
1295
1255
  ...rest
1296
1256
  };
1297
1257
  }
1298
- function getBackProps({ minDate, offsetMonth, handleOffsetChanged }, { onClick, offset = 1, calendars = requiredProp("getBackProps", "calendars"),...rest } = {}) {
1258
+ function getBackProps({ minDate, offsetMonth, handleOffsetChanged }, { onClick, offset = 1, calendars = requiredProp("getBackProps", "calendars"), ...rest } = {}) {
1299
1259
  return {
1300
1260
  onClick: composeEventHandlers(onClick, () => {
1301
1261
  handleOffsetChanged(offsetMonth - subtractMonth({
@@ -1312,7 +1272,7 @@ function getBackProps({ minDate, offsetMonth, handleOffsetChanged }, { onClick,
1312
1272
  ...rest
1313
1273
  };
1314
1274
  }
1315
- function getForwardProps({ maxDate, offsetMonth, handleOffsetChanged }, { onClick, offset = 1, calendars = requiredProp("getForwardProps", "calendars"),...rest } = {}) {
1275
+ function getForwardProps({ maxDate, offsetMonth, handleOffsetChanged }, { onClick, offset = 1, calendars = requiredProp("getForwardProps", "calendars"), ...rest } = {}) {
1316
1276
  return {
1317
1277
  onClick: composeEventHandlers(onClick, () => {
1318
1278
  handleOffsetChanged(offsetMonth + addMonth({
@@ -1360,7 +1320,6 @@ function useDayzed({ date = /* @__PURE__ */ new Date(), maxDate, minDate, months
1360
1320
  })
1361
1321
  };
1362
1322
  }
1363
-
1364
1323
  //#endregion
1365
1324
  //#region src/hooks/useLatestRef.ts
1366
1325
  function useLatestRef(value) {
@@ -1370,7 +1329,6 @@ function useLatestRef(value) {
1370
1329
  }, [value]);
1371
1330
  return latestValue;
1372
1331
  }
1373
-
1374
1332
  //#endregion
1375
1333
  //#region src/components/dateInput.tsx
1376
1334
  const className$1 = "schummar-table-date-input";
@@ -1397,11 +1355,11 @@ function DateInput({ value, onChange, locale }) {
1397
1355
  const id = (0, react.useMemo)(() => (0, nanoid.nanoid)(), []);
1398
1356
  const [localValue, setLocalValue] = (0, react.useState)();
1399
1357
  const latestValue = useLatestRef(value);
1400
- const commit = (0, react.useMemo)(() => debounce((localValue$1 = {}, value$1, onChange$1) => {
1401
- if (value$1 !== latestValue.current) return;
1402
- const date = buildDate(localValue$1, value$1 ?? void 0);
1358
+ const commit = (0, react.useMemo)(() => debounce((localValue = {}, value, onChange) => {
1359
+ if (value !== latestValue.current) return;
1360
+ const date = buildDate(localValue, value ?? void 0);
1403
1361
  setLocalValue(void 0);
1404
- onChange$1(isNaN(date.getTime()) ? null : date);
1362
+ onChange(isNaN(date.getTime()) ? null : date);
1405
1363
  }, 100), []);
1406
1364
  const format = (0, react.useMemo)(() => new Intl.DateTimeFormat(locale, {
1407
1365
  day: "2-digit",
@@ -1415,12 +1373,12 @@ function DateInput({ value, onChange, locale }) {
1415
1373
  parts = format.formatToParts(defaultDate$1);
1416
1374
  }
1417
1375
  const isEmpty = !value;
1418
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
1376
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
1419
1377
  css: {
1420
1378
  display: "flex",
1421
1379
  alignItems: "baseline"
1422
1380
  },
1423
- children: parts.map(({ type, value: partValue }, index) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(react.Fragment, { children: isIncludedType$1(type) ? /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("input", {
1381
+ children: parts.map(({ type, value: partValue }, index) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react.Fragment, { children: isIncludedType$1(type) ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("input", {
1424
1382
  className: `${className$1}-${id}`,
1425
1383
  css: {
1426
1384
  boxSizing: "content-box",
@@ -1458,16 +1416,15 @@ function DateInput({ value, onChange, locale }) {
1458
1416
  onBlur: () => {
1459
1417
  commit(localValue, value, onChange);
1460
1418
  }
1461
- }) : type === "literal" ? /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("span", { children: partValue }) : null }, index))
1419
+ }) : type === "literal" ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", { children: partValue }) : null }, index))
1462
1420
  });
1463
1421
  }
1464
-
1465
1422
  //#endregion
1466
1423
  //#region src/components/text.tsx
1467
1424
  function Text({ id }) {
1468
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(__emotion_react_jsx_runtime.Fragment, { children: useTheme((t) => t.text[id]) });
1425
+ const text = useTheme((t) => t.text[id]);
1426
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(_emotion_react_jsx_runtime.Fragment, { children: text });
1469
1427
  }
1470
-
1471
1428
  //#endregion
1472
1429
  //#region src/components/timeInput.tsx
1473
1430
  const className = "schummar-table-time-input";
@@ -1494,11 +1451,11 @@ function TimeInput({ value, onChange, locale, showSeconds = true }) {
1494
1451
  const id = (0, react.useMemo)(() => (0, nanoid.nanoid)(), []);
1495
1452
  const [localValue, setLocalValue] = (0, react.useState)();
1496
1453
  const latestValue = useLatestRef(value);
1497
- const commit = (0, react.useMemo)(() => debounce((localValue$1 = {}, value$1, onChange$1) => {
1498
- if (value$1 !== latestValue.current) return;
1499
- const date = buildTime(localValue$1, value$1 ?? void 0);
1454
+ const commit = (0, react.useMemo)(() => debounce((localValue = {}, value, onChange) => {
1455
+ if (value !== latestValue.current) return;
1456
+ const date = buildTime(localValue, value ?? void 0);
1500
1457
  setLocalValue(void 0);
1501
- onChange$1(isNaN(date.getTime()) ? null : date);
1458
+ onChange(isNaN(date.getTime()) ? null : date);
1502
1459
  }, 100), []);
1503
1460
  const format = (0, react.useMemo)(() => new Intl.DateTimeFormat(locale, {
1504
1461
  hour: "2-digit",
@@ -1512,12 +1469,12 @@ function TimeInput({ value, onChange, locale, showSeconds = true }) {
1512
1469
  parts = format.formatToParts(defaultDate);
1513
1470
  }
1514
1471
  const isEmpty = !value;
1515
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
1472
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
1516
1473
  css: {
1517
1474
  display: "flex",
1518
1475
  alignItems: "baseline"
1519
1476
  },
1520
- children: parts.map(({ type, value: partValue }, index) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(react.Fragment, { children: isIncludedType(type) ? /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("input", {
1477
+ children: parts.map(({ type, value: partValue }, index) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react.Fragment, { children: isIncludedType(type) ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("input", {
1521
1478
  className: `${className}-${id}`,
1522
1479
  css: {
1523
1480
  boxSizing: "content-box",
@@ -1555,16 +1512,15 @@ function TimeInput({ value, onChange, locale, showSeconds = true }) {
1555
1512
  onBlur: () => {
1556
1513
  commit(localValue, value, onChange);
1557
1514
  }
1558
- }) : type === "literal" ? /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("span", { children: partValue }) : null }, index))
1515
+ }) : type === "literal" ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", { children: partValue }) : null }, index))
1559
1516
  });
1560
1517
  }
1561
-
1562
1518
  //#endregion
1563
1519
  //#region src/components/datePicker.tsx
1564
1520
  const DatePickerContext = (0, react.createContext)({});
1565
- function DatePickerProvider({ children,...props }) {
1521
+ function DatePickerProvider({ children, ...props }) {
1566
1522
  const value = (0, react.useMemo)(() => props, [JSON.stringify(props)]);
1567
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(DatePickerContext.Provider, {
1523
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(DatePickerContext.Provider, {
1568
1524
  value,
1569
1525
  children
1570
1526
  });
@@ -1593,8 +1549,7 @@ const lastDays = (days) => {
1593
1549
  };
1594
1550
  const today = () => lastDays(1);
1595
1551
  const thisWeek = (delta = 0, firstDayOfWeek = 1) => {
1596
- const now = /* @__PURE__ */ new Date();
1597
- const min = new Date(now);
1552
+ const min = /* @__PURE__ */ new Date(/* @__PURE__ */ new Date());
1598
1553
  let diff = min.getDay() - firstDayOfWeek;
1599
1554
  if (diff < 0) diff += 7;
1600
1555
  min.setDate(min.getDate() - diff + delta * 7);
@@ -1606,8 +1561,7 @@ const thisWeek = (delta = 0, firstDayOfWeek = 1) => {
1606
1561
  };
1607
1562
  };
1608
1563
  const thisMonth = (delta = 0) => {
1609
- const now = /* @__PURE__ */ new Date();
1610
- const min = new Date(now);
1564
+ const min = /* @__PURE__ */ new Date(/* @__PURE__ */ new Date());
1611
1565
  min.setDate(1);
1612
1566
  min.setMonth(min.getMonth() + delta);
1613
1567
  const max = new Date(min);
@@ -1619,8 +1573,7 @@ const thisMonth = (delta = 0) => {
1619
1573
  };
1620
1574
  };
1621
1575
  const thisYear = (delta = 0) => {
1622
- const now = /* @__PURE__ */ new Date();
1623
- const min = new Date(now);
1576
+ const min = /* @__PURE__ */ new Date(/* @__PURE__ */ new Date());
1624
1577
  min.setDate(1);
1625
1578
  min.setMonth(0);
1626
1579
  min.setFullYear(min.getFullYear() + delta);
@@ -1638,27 +1591,27 @@ const getCalendarWeek = (date) => {
1638
1591
  };
1639
1592
  const commonQuickOptions = {
1640
1593
  today: {
1641
- label: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Text, { id: "today" }),
1594
+ label: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Text, { id: "today" }),
1642
1595
  value: today
1643
1596
  },
1644
1597
  thisWeek: {
1645
- label: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Text, { id: "thisWeek" }),
1598
+ label: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Text, { id: "thisWeek" }),
1646
1599
  value: (props) => thisWeek(0, props.firstDayOfWeek)
1647
1600
  },
1648
1601
  thisMonth: {
1649
- label: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Text, { id: "thisMonth" }),
1602
+ label: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Text, { id: "thisMonth" }),
1650
1603
  value: () => thisMonth()
1651
1604
  },
1652
1605
  thisYear: {
1653
- label: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Text, { id: "thisYear" }),
1606
+ label: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Text, { id: "thisYear" }),
1654
1607
  value: () => thisYear()
1655
1608
  },
1656
1609
  lastSevenDays: {
1657
- label: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Text, { id: "lastSevenDays" }),
1610
+ label: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Text, { id: "lastSevenDays" }),
1658
1611
  value: () => lastDays(7)
1659
1612
  },
1660
1613
  lastThirtyDays: {
1661
- label: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Text, { id: "lastThirtyDays" }),
1614
+ label: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Text, { id: "lastThirtyDays" }),
1662
1615
  value: () => lastDays(30)
1663
1616
  }
1664
1617
  };
@@ -1687,19 +1640,19 @@ function getValueForComparison(value) {
1687
1640
  }
1688
1641
  function DatePicker(props) {
1689
1642
  const { value, rangeSelect, locale, firstDayOfWeek = 1, defaultDateInView, quickOptions = ["today", "thisWeek"], noReset, minDate, maxDate, showCalendarWeek, blockedRanges = [], showTime } = defaults(props, (0, react.useContext)(DatePickerContext));
1690
- function onChange(value$1, source) {
1691
- if (value$1 instanceof Date) value$1 = dateClamp(value$1, minDate, maxDate);
1692
- else if (value$1) value$1 = {
1693
- min: dateClamp(value$1.min, minDate, maxDate),
1694
- max: dateClamp(value$1.max, minDate, maxDate)
1643
+ function onChange(value, source) {
1644
+ if (value instanceof Date) value = dateClamp(value, minDate, maxDate);
1645
+ else if (value) value = {
1646
+ min: dateClamp(value.min, minDate, maxDate),
1647
+ max: dateClamp(value.max, minDate, maxDate)
1695
1648
  };
1696
- props.onChange(value$1, source);
1649
+ props.onChange(value, source);
1697
1650
  }
1698
- const Button$1 = useTheme((t) => t.components.Button);
1699
- const IconButton$1 = useTheme((t) => t.components.IconButton);
1700
- const ChevronRight$1 = useTheme((t) => t.icons.ChevronRight);
1651
+ const Button = useTheme((t) => t.components.Button);
1652
+ const IconButton = useTheme((t) => t.components.IconButton);
1653
+ const ChevronRight = useTheme((t) => t.icons.ChevronRight);
1701
1654
  const cssVariables = useCssVariables();
1702
- function getDayCssStyles({ disabled, prevMonth, nextMonth, today: today$1, blocked, selected, preSelected }) {
1655
+ function getDayCssStyles({ disabled, prevMonth, nextMonth, today, blocked, selected, preSelected }) {
1703
1656
  return [
1704
1657
  {
1705
1658
  padding: 10,
@@ -1710,7 +1663,7 @@ function DatePicker(props) {
1710
1663
  color: "inherit"
1711
1664
  },
1712
1665
  (prevMonth || nextMonth) && { color: "var(--date-picker-disemphasized, #bdbdbd)" },
1713
- today$1 && { outline: "1px solid var(--secondaryMain)" },
1666
+ today && { outline: "1px solid var(--secondaryMain)" },
1714
1667
  blocked && {
1715
1668
  background: "var(--blockedMain)",
1716
1669
  color: "var(--blockedContrastText)"
@@ -1750,27 +1703,27 @@ function DatePicker(props) {
1750
1703
  const min = dirty ? dirty.min : value instanceof Date ? value : value?.min;
1751
1704
  const max = dirty ? dirty.max : value instanceof Date ? value : value?.max;
1752
1705
  const resolvedQuickOptions = [...quickOptions, ...noReset ? [] : [{
1753
- label: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Text, { id: "reset" }),
1706
+ label: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Text, { id: "reset" }),
1754
1707
  value: null
1755
1708
  }]].map((option, index) => {
1756
- if (option instanceof Function) return option((value$2) => {
1709
+ if (option instanceof Function) return option((value) => {
1757
1710
  setDirty(void 0);
1758
- onChange(value$2, "quickOption");
1711
+ onChange(value, "quickOption");
1759
1712
  });
1760
- const { label, value: value$1 } = typeof option === "string" ? commonQuickOptions[option] : option;
1761
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Button$1, {
1713
+ const { label, value } = typeof option === "string" ? commonQuickOptions[option] : option;
1714
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Button, {
1762
1715
  variant: "text",
1763
1716
  type: "button",
1764
1717
  css: { color: "inherit" },
1765
1718
  onClick: () => {
1766
1719
  setDirty(void 0);
1767
- if (value$1 instanceof Function) onChange(value$1(props), "quickOption");
1768
- else onChange(value$1, "quickOption");
1720
+ if (value instanceof Function) onChange(value(props), "quickOption");
1721
+ else onChange(value, "quickOption");
1769
1722
  },
1770
1723
  children: label
1771
1724
  }, index);
1772
1725
  });
1773
- const { calendars, getBackProps: getBackProps$1, getForwardProps: getForwardProps$1, getDateProps: getDateProps$1 } = useDayzed({
1726
+ const { calendars, getBackProps, getForwardProps, getDateProps } = useDayzed({
1774
1727
  onDateSelected: () => void 0,
1775
1728
  firstDayOfWeek,
1776
1729
  showOutsideDays: true,
@@ -1793,23 +1746,25 @@ function DatePicker(props) {
1793
1746
  (0, react.useEffect)(() => {
1794
1747
  if (!rangeSelect) setDirty(void 0);
1795
1748
  }, [rangeSelect]);
1796
- function set(source, min$1, max$1, edit) {
1749
+ function set(source, min, max, edit) {
1797
1750
  if (!rangeSelect) {
1798
- onChange(min$1 ?? null, source);
1751
+ onChange(min ?? null, source);
1799
1752
  return;
1800
1753
  }
1801
- if (min$1 && max$1 && min$1 > max$1) if (edit === "min") max$1 = min$1;
1802
- else if (edit === "max") min$1 = max$1;
1803
- else [min$1, max$1] = [max$1, min$1];
1804
- if (!min$1 === !max$1) {
1754
+ if (min && max && min > max) {
1755
+ if (edit === "min") max = min;
1756
+ else if (edit === "max") min = max;
1757
+ else [min, max] = [max, min];
1758
+ }
1759
+ if (!min === !max) {
1805
1760
  setDirty(void 0);
1806
- onChange(min$1 && max$1 ? {
1807
- min: min$1,
1808
- max: endOfDay(max$1)
1761
+ onChange(min && max ? {
1762
+ min,
1763
+ max: endOfDay(max)
1809
1764
  } : null, source);
1810
1765
  } else setDirty({
1811
- min: min$1,
1812
- max: max$1
1766
+ min,
1767
+ max
1813
1768
  });
1814
1769
  }
1815
1770
  const formatMonth = (0, react.useMemo)(() => {
@@ -1820,10 +1775,10 @@ function DatePicker(props) {
1820
1775
  const { format } = new Intl.DateTimeFormat(locale, { year: "numeric" });
1821
1776
  return (year) => format(new Date(year, 0, 1));
1822
1777
  }, [locale]);
1823
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
1778
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
1824
1779
  css: [cssVariables, { color: "var(--table-text-color)" }],
1825
1780
  children: [
1826
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
1781
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
1827
1782
  css: {
1828
1783
  display: "grid",
1829
1784
  gridAutoFlow: "column",
@@ -1836,29 +1791,29 @@ function DatePicker(props) {
1836
1791
  alignItems: "center"
1837
1792
  }
1838
1793
  },
1839
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(DateInput, {
1794
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(DateInput, {
1840
1795
  value: min ?? null,
1841
1796
  onChange: (newMin) => set("input", newMin ?? void 0, max, "min"),
1842
1797
  locale
1843
- }), showTime && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(TimeInput, {
1798
+ }), showTime && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(TimeInput, {
1844
1799
  value: min ?? null,
1845
1800
  onChange: (newMin) => set("input", newMin ?? void 0, max, "min"),
1846
1801
  locale,
1847
1802
  showSeconds: typeof showTime === "boolean" ? true : showTime.showSeconds
1848
- })] }), rangeSelect && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(__emotion_react_jsx_runtime.Fragment, { children: [" - ", /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(DateInput, {
1803
+ })] }), rangeSelect && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [" - ", /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(DateInput, {
1849
1804
  value: max ?? null,
1850
1805
  onChange: (newMax) => set("input", min, newMax ?? void 0, "max"),
1851
1806
  locale
1852
- }), showTime && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(TimeInput, {
1807
+ }), showTime && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(TimeInput, {
1853
1808
  value: max ?? null,
1854
1809
  onChange: (newMax) => set("input", min, newMax ?? void 0, "max"),
1855
1810
  locale,
1856
1811
  showSeconds: typeof showTime === "boolean" ? true : showTime.showSeconds
1857
1812
  })] })] })]
1858
1813
  }),
1859
- calendars.map(({ month, year, weeks }) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
1814
+ calendars.map(({ month, year, weeks }) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
1860
1815
  css: { display: "grid" },
1861
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
1816
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
1862
1817
  css: {
1863
1818
  margin: "calc(var(--spacing) * 4) 0",
1864
1819
  display: "grid",
@@ -1867,12 +1822,12 @@ function DatePicker(props) {
1867
1822
  alignItems: "center"
1868
1823
  },
1869
1824
  children: [
1870
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(IconButton$1, {
1825
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(IconButton, {
1871
1826
  type: "button",
1872
- ...getBackProps$1({ calendars }),
1873
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ChevronRight$1, { css: { transform: "rotate3d(0, 0, 1, 180deg)" } })
1827
+ ...getBackProps({ calendars }),
1828
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ChevronRight, { css: { transform: "rotate3d(0, 0, 1, 180deg)" } })
1874
1829
  }),
1875
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
1830
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
1876
1831
  css: { display: "flex" },
1877
1832
  children: [
1878
1833
  formatMonth(month),
@@ -1880,28 +1835,28 @@ function DatePicker(props) {
1880
1835
  formatYear(year)
1881
1836
  ]
1882
1837
  }),
1883
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(IconButton$1, {
1838
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(IconButton, {
1884
1839
  type: "button",
1885
- ...getForwardProps$1({ calendars }),
1886
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ChevronRight$1, {})
1840
+ ...getForwardProps({ calendars }),
1841
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ChevronRight, {})
1887
1842
  })
1888
1843
  ]
1889
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
1844
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
1890
1845
  css: {
1891
1846
  justifySelf: "center",
1892
1847
  display: "grid",
1893
1848
  gridTemplateColumns: "repeat(8, max-content)"
1894
1849
  },
1895
1850
  children: [
1896
- showCalendarWeek ? /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
1851
+ showCalendarWeek ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
1897
1852
  css: {
1898
1853
  justifySelf: "center",
1899
1854
  padding: 10,
1900
1855
  borderRight: "1px solid var(--date-picker-separator, var(--table-border, #bdbdbd))"
1901
1856
  },
1902
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Text, { id: "calendarWeek" })
1903
- }) : /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {}),
1904
- weekDays.map((_v, weekDay) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
1857
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Text, { id: "calendarWeek" })
1858
+ }) : /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {}),
1859
+ weekDays.map((_v, weekDay) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
1905
1860
  css: {
1906
1861
  justifySelf: "center",
1907
1862
  padding: 10
@@ -1912,7 +1867,7 @@ function DatePicker(props) {
1912
1867
  const weekStart = week[0];
1913
1868
  const weekEnd = week[6];
1914
1869
  const weekDisabled = !rangeSelect || minDate && weekEnd.date < minDate || maxDate && weekStart.date > maxDate;
1915
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(react.Fragment, { children: [showCalendarWeek ? /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("button", {
1870
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(react.Fragment, { children: [showCalendarWeek ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("button", {
1916
1871
  type: "button",
1917
1872
  css: {
1918
1873
  padding: 10,
@@ -1933,10 +1888,10 @@ function DatePicker(props) {
1933
1888
  }),
1934
1889
  onPointerOut: () => !weekDisabled && setHovered(void 0),
1935
1890
  children: getCalendarWeek(weekEnd.date)
1936
- }) : /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {}), week.map((dateObject, dayIndex) => {
1937
- if (!dateObject) return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {}, dayIndex);
1891
+ }) : /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {}), week.map((dateObject, dayIndex) => {
1892
+ if (!dateObject) return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {}, dayIndex);
1938
1893
  const { prevMonth, nextMonth, date } = dateObject;
1939
- const today$1 = startOfDay(date).getTime() === now.getTime();
1894
+ const today = startOfDay(date).getTime() === now.getTime();
1940
1895
  const disabled = minDate && date < minDate || maxDate && date > maxDate;
1941
1896
  const selected = date.getTime() === min?.getTime() || min && max && dateIntersect(date, {
1942
1897
  min,
@@ -1949,22 +1904,24 @@ function DatePicker(props) {
1949
1904
  min: hovered.max,
1950
1905
  max: min
1951
1906
  }));
1952
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("button", {
1907
+ const blocked = blockedRanges.some((range) => dateIntersect(date, range));
1908
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("button", {
1953
1909
  type: "button",
1954
1910
  css: getDayCssStyles({
1955
1911
  disabled,
1956
1912
  prevMonth,
1957
1913
  nextMonth,
1958
- today: today$1,
1959
- blocked: blockedRanges.some((range) => dateIntersect(date, range)),
1914
+ today,
1915
+ blocked,
1960
1916
  selected,
1961
1917
  preSelected
1962
1918
  }),
1963
- ...getDateProps$1({ dateObj: dateObject }),
1919
+ ...getDateProps({ dateObj: dateObject }),
1964
1920
  onClick: () => {
1965
- if (dirty) if (min) set("calendar", min, date);
1966
- else set("calendar", date, max);
1967
- else set("calendar", date);
1921
+ if (dirty) {
1922
+ if (min) set("calendar", min, date);
1923
+ else set("calendar", date, max);
1924
+ } else set("calendar", date);
1968
1925
  },
1969
1926
  onPointerOver: () => setHovered({
1970
1927
  min: date,
@@ -1979,7 +1936,7 @@ function DatePicker(props) {
1979
1936
  ]
1980
1937
  })]
1981
1938
  }, `${month}${year}`)),
1982
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
1939
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
1983
1940
  css: {
1984
1941
  marginTop: "var(--spacing)",
1985
1942
  display: "grid",
@@ -1991,7 +1948,6 @@ function DatePicker(props) {
1991
1948
  ]
1992
1949
  });
1993
1950
  }
1994
-
1995
1951
  //#endregion
1996
1952
  //#region src/components/dateFilter.tsx
1997
1953
  function convertDate(x) {
@@ -2013,7 +1969,7 @@ function convertDateOrArray(x) {
2013
1969
  if (Array.isArray(x)) return x.map(convertDateOrRange).filter(Boolean);
2014
1970
  return convertDateOrRange(x);
2015
1971
  }
2016
- function DateFilter({ locale, firstDayOfWeek, defaultDateInView, quickOptions, singleSelect, filterBy = convertDateOrArray, minDate, maxDate, showCalendarWeek, showTime,...props }) {
1972
+ function DateFilter({ locale, firstDayOfWeek, defaultDateInView, quickOptions, singleSelect, filterBy = convertDateOrArray, minDate, maxDate, showCalendarWeek, showTime, ...props }) {
2017
1973
  const { value = null, onChange, close } = useFilter({
2018
1974
  ...props,
2019
1975
  filterBy,
@@ -2021,20 +1977,20 @@ function DateFilter({ locale, firstDayOfWeek, defaultDateInView, quickOptions, s
2021
1977
  isActive(filterValue) {
2022
1978
  return !!filterValue;
2023
1979
  },
2024
- test(filterValue, value$1) {
2025
- return dateIntersect(filterValue, value$1);
1980
+ test(filterValue, value) {
1981
+ return dateIntersect(filterValue, value);
2026
1982
  }
2027
1983
  });
2028
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
1984
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
2029
1985
  css: {
2030
1986
  padding: "calc(var(--spacing) * 2)",
2031
1987
  display: "grid"
2032
1988
  },
2033
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(DatePicker, {
1989
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(DatePicker, {
2034
1990
  rangeSelect: !singleSelect,
2035
1991
  value,
2036
- onChange: (value$1, source) => {
2037
- onChange(value$1);
1992
+ onChange: (value, source) => {
1993
+ onChange(value);
2038
1994
  if (source !== "input") close();
2039
1995
  },
2040
1996
  locale,
@@ -2048,10 +2004,9 @@ function DateFilter({ locale, firstDayOfWeek, defaultDateInView, quickOptions, s
2048
2004
  })
2049
2005
  });
2050
2006
  }
2051
-
2052
2007
  //#endregion
2053
2008
  //#region src/misc/helpers.ts
2054
- var helpers_exports = /* @__PURE__ */ require_chunk.__export({
2009
+ var helpers_exports = /* @__PURE__ */ require_tableSettings.__exportAll({
2055
2010
  asNumber: () => asNumber,
2056
2011
  asNumberOrArray: () => asNumberOrArray,
2057
2012
  asString: () => asString,
@@ -2069,8 +2024,8 @@ var helpers_exports = /* @__PURE__ */ require_chunk.__export({
2069
2024
  subStringMatch: () => subStringMatch,
2070
2025
  uniq: () => uniq
2071
2026
  });
2072
- const flatMap = (array, flatMap$1) => {
2073
- return [...array].flatMap(flatMap$1);
2027
+ const flatMap = (array, flatMap) => {
2028
+ return [...array].flatMap(flatMap);
2074
2029
  };
2075
2030
  const orderBy = (array, selectors = [], direction = [], locale, options) => {
2076
2031
  if (selectors.length === 0) selectors = [(t) => t];
@@ -2081,7 +2036,11 @@ const orderBy = (array, selectors = [], direction = [], locale, options) => {
2081
2036
  const _direction = direction[i] === "desc" ? -1 : 1;
2082
2037
  const _locale = locale?.[i];
2083
2038
  const _options = options?.[i];
2084
- if (typeof _a === "string" && typeof _b === "string") return _a.localeCompare(_b, _locale, _options) * _direction;
2039
+ if (typeof _a === "string" && typeof _b === "string") {
2040
+ const result = _a.localeCompare(_b, _locale, _options);
2041
+ if (result !== 0) return result * _direction;
2042
+ continue;
2043
+ }
2085
2044
  if (_a > _b) return _direction;
2086
2045
  if (_a < _b) return -_direction;
2087
2046
  }
@@ -2145,12 +2104,11 @@ const castArray = (a) => Array.isArray(a) ? a : [a];
2145
2104
  const cx = (...classNames) => classNames.flatMap((entry) => {
2146
2105
  if (!entry) return [];
2147
2106
  if (typeof entry === "string") return [entry];
2148
- return Object.entries(entry).filter(([, predicate]) => predicate).map(([className$2]) => className$2);
2107
+ return Object.entries(entry).filter(([, predicate]) => predicate).map(([className]) => className);
2149
2108
  }).join(" ");
2150
2109
  function isTruthy(x) {
2151
2110
  return !!x;
2152
2111
  }
2153
-
2154
2112
  //#endregion
2155
2113
  //#region src/components/numberField.tsx
2156
2114
  const Pattern = /^-?\d*(?:[.,]\d*)?$/;
@@ -2160,14 +2118,14 @@ const printNumber = (value, locale) => {
2160
2118
  };
2161
2119
  const parseNumber = (value) => {
2162
2120
  if (value === "") return null;
2163
- const asNumber$1 = Number(value.replace(",", "."));
2164
- return Number.isNaN(asNumber$1) ? null : asNumber$1;
2121
+ const asNumber = Number(value.replace(",", "."));
2122
+ return Number.isNaN(asNumber) ? null : asNumber;
2165
2123
  };
2166
- function NumberField({ value: commitedValue = null, onChange,...textFieldProps }) {
2124
+ function NumberField({ value: commitedValue = null, onChange, ...textFieldProps }) {
2167
2125
  const locale = useTheme((t) => t.locale);
2168
- const TextField$1 = useTheme((t) => t.components.TextField);
2126
+ const TextField = useTheme((t) => t.components.TextField);
2169
2127
  const [value = printNumber(commitedValue, locale), setValue] = (0, react.useState)();
2170
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(TextField$1, {
2128
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(TextField, {
2171
2129
  value,
2172
2130
  onChange: (event) => {
2173
2131
  if (Pattern.test(event.target.value)) setValue(event.target.value);
@@ -2183,10 +2141,9 @@ function NumberField({ value: commitedValue = null, onChange,...textFieldProps }
2183
2141
  } }
2184
2142
  });
2185
2143
  }
2186
-
2187
2144
  //#endregion
2188
2145
  //#region src/components/rangeFilter.tsx
2189
- function RangeFilter({ min, max, filterBy = asNumberOrArray,...props }) {
2146
+ function RangeFilter({ min, max, filterBy = asNumberOrArray, ...props }) {
2190
2147
  const rangeMinText = useTheme((t) => t.text.rangeMin);
2191
2148
  const rangeMaxText = useTheme((t) => t.text.rangeMax);
2192
2149
  const table = useTableContext();
@@ -2196,16 +2153,17 @@ function RangeFilter({ min, max, filterBy = asNumberOrArray,...props }) {
2196
2153
  if (typeof min === "number" && typeof max === "number") return [min, max];
2197
2154
  const column = state.activeColumns.find((c) => c.id === columnId);
2198
2155
  if (!column) return [0, 100];
2199
- let minValue$1;
2200
- let maxValue$1;
2156
+ let minValue;
2157
+ let maxValue;
2201
2158
  for (const item of state.items) {
2202
- const numberValues = castArray(filterByFunction(column.value(item.value), item.value)).filter((value$1) => value$1 !== null);
2203
- for (const value$1 of numberValues) {
2204
- minValue$1 = Math.min(minValue$1 ?? value$1, value$1);
2205
- maxValue$1 = Math.max(maxValue$1 ?? value$1, value$1);
2159
+ const columnValue = column.value(item.value);
2160
+ const numberValues = castArray(filterByFunction(columnValue, item.value)).filter((value) => value !== null);
2161
+ for (const value of numberValues) {
2162
+ minValue = Math.min(minValue ?? value, value);
2163
+ maxValue = Math.max(maxValue ?? value, value);
2206
2164
  }
2207
2165
  }
2208
- return [min ?? minValue$1, max ?? maxValue$1];
2166
+ return [min ?? minValue, max ?? maxValue];
2209
2167
  });
2210
2168
  const { value, onChange } = useFilter({
2211
2169
  ...props,
@@ -2214,20 +2172,20 @@ function RangeFilter({ min, max, filterBy = asNumberOrArray,...props }) {
2214
2172
  isActive(filterValue) {
2215
2173
  return !!filterValue;
2216
2174
  },
2217
- test(filterValue, value$1) {
2175
+ test(filterValue, value) {
2218
2176
  if (!filterValue || filterValue[0] === null && filterValue[1] === null) return true;
2219
- const min$1 = filterValue[0] ?? Number.NEGATIVE_INFINITY;
2220
- const max$1 = filterValue[1] ?? Number.POSITIVE_INFINITY;
2221
- return value$1 !== null && value$1 >= min$1 && value$1 <= max$1;
2177
+ const min = filterValue[0] ?? Number.NEGATIVE_INFINITY;
2178
+ const max = filterValue[1] ?? Number.POSITIVE_INFINITY;
2179
+ return value !== null && value >= min && value <= max;
2222
2180
  }
2223
2181
  });
2224
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
2182
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
2225
2183
  css: {
2226
2184
  padding: `calc(var(--spacing) * 2)`,
2227
2185
  display: "grid",
2228
2186
  gap: "1em"
2229
2187
  },
2230
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
2188
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
2231
2189
  css: {
2232
2190
  display: "flex",
2233
2191
  gap: "1em",
@@ -2235,13 +2193,13 @@ function RangeFilter({ min, max, filterBy = asNumberOrArray,...props }) {
2235
2193
  "& > *": { width: "10em" }
2236
2194
  },
2237
2195
  children: [
2238
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(NumberField, {
2196
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(NumberField, {
2239
2197
  value: value?.[0],
2240
2198
  onChange: (newMin) => onChange(normalize(newMin, value?.[1], "min", {
2241
2199
  min,
2242
2200
  max
2243
2201
  })),
2244
- startIcon: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("span", {
2202
+ startIcon: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", {
2245
2203
  css: { margin: "0 calc(var(--spacing) * 2)" },
2246
2204
  children: rangeMinText
2247
2205
  }),
@@ -2249,13 +2207,13 @@ function RangeFilter({ min, max, filterBy = asNumberOrArray,...props }) {
2249
2207
  css: { alignItems: "baseline" }
2250
2208
  }),
2251
2209
  "-",
2252
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(NumberField, {
2210
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(NumberField, {
2253
2211
  value: value?.[1],
2254
2212
  onChange: (newMax) => onChange(normalize(value?.[0], newMax, "max", {
2255
2213
  min,
2256
2214
  max
2257
2215
  })),
2258
- startIcon: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("span", {
2216
+ startIcon: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", {
2259
2217
  css: { margin: "0 calc(var(--spacing) * 2)" },
2260
2218
  children: rangeMaxText
2261
2219
  }),
@@ -2269,18 +2227,19 @@ function RangeFilter({ min, max, filterBy = asNumberOrArray,...props }) {
2269
2227
  function normalize(min, max, changed, limits) {
2270
2228
  min ??= null;
2271
2229
  max ??= null;
2272
- if (min !== null && max !== null && min > max) if (changed === "min") max = min;
2273
- else min = max;
2230
+ if (min !== null && max !== null && min > max) {
2231
+ if (changed === "min") max = min;
2232
+ else min = max;
2233
+ }
2274
2234
  return min !== null || max !== null ? [clamp(min, limits.min, limits.max), clamp(max, limits.min, limits.max)] : null;
2275
2235
  }
2276
2236
  function clamp(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFINITY) {
2277
2237
  return value === null ? null : Math.min(Math.max(value, min), max);
2278
2238
  }
2279
-
2280
2239
  //#endregion
2281
2240
  //#region src/components/formControlLabel.tsx
2282
2241
  function FormControlLabel({ control, label, disabled }) {
2283
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("label", {
2242
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("label", {
2284
2243
  css: [{
2285
2244
  display: "flex",
2286
2245
  alignItems: "center",
@@ -2288,16 +2247,15 @@ function FormControlLabel({ control, label, disabled }) {
2288
2247
  userSelect: "none",
2289
2248
  "& > *": { cursor: "pointer" }
2290
2249
  }, disabled && { color: "rgba(0, 0, 0, 0.26)" }],
2291
- children: [control, /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("span", {
2250
+ children: [control, /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", {
2292
2251
  css: { marginLeft: "var(--spacing)" },
2293
2252
  children: label
2294
2253
  })]
2295
2254
  });
2296
2255
  }
2297
-
2298
2256
  //#endregion
2299
2257
  //#region src/components/virtualList.tsx
2300
- function VirtualList({ virtual = true, items, children,...props }) {
2258
+ function VirtualList({ virtual = true, items, children, ...props }) {
2301
2259
  const container = (0, react.useRef)(null);
2302
2260
  const [, setId] = (0, react.useState)({});
2303
2261
  const throttleScroll = (typeof virtual === "boolean" ? void 0 : virtual)?.throttleScroll ?? 16;
@@ -2317,7 +2275,7 @@ function VirtualList({ virtual = true, items, children,...props }) {
2317
2275
  virtual,
2318
2276
  throttleScroll
2319
2277
  ]);
2320
- if (!virtual) return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
2278
+ if (!virtual) return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
2321
2279
  ...props,
2322
2280
  css: {
2323
2281
  overflowY: "auto",
@@ -2331,7 +2289,7 @@ function VirtualList({ virtual = true, items, children,...props }) {
2331
2289
  const to = container.current?.clientHeight ? Math.min(items.length, Math.ceil((container.current.scrollTop + container.current.clientHeight + (overscanBottom ?? overscan)) / itemHeight)) : 1;
2332
2290
  const before = from * itemHeight;
2333
2291
  const after = (items.length - to) * itemHeight;
2334
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
2292
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
2335
2293
  ...props,
2336
2294
  onScroll: (event) => {
2337
2295
  update();
@@ -2343,12 +2301,12 @@ function VirtualList({ virtual = true, items, children,...props }) {
2343
2301
  display: "grid"
2344
2302
  },
2345
2303
  children: [
2346
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
2304
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
2347
2305
  "data-virtual-before": true,
2348
2306
  style: { height: before }
2349
2307
  }),
2350
2308
  items.slice(from, to).map((item, index) => children(item, index + from)),
2351
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
2309
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
2352
2310
  "data-virtual-after": true,
2353
2311
  style: { height: after }
2354
2312
  })
@@ -2360,7 +2318,6 @@ function averageItemHeight(container) {
2360
2318
  const heights = Array.from(container.children).slice(1, -1).map((child) => child.clientHeight);
2361
2319
  return heights.reduce((a, b) => a + b, 0) / heights.length;
2362
2320
  }
2363
-
2364
2321
  //#endregion
2365
2322
  //#region src/components/selectFilter.tsx
2366
2323
  function toggle(set, value, singleSelect) {
@@ -2369,11 +2326,11 @@ function toggle(set, value, singleSelect) {
2369
2326
  else newSet.add(value);
2370
2327
  return newSet;
2371
2328
  }
2372
- function SelectFilter({ options: providedOptions, stringValue = asString, render = stringValue, singleSelect, hideSearchField, hideResetButton,...props }) {
2373
- const IconButton$1 = useTheme((t) => t.components.IconButton);
2374
- const Checkbox$1 = useTheme((t) => t.components.Checkbox);
2375
- const Search$1 = useTheme((t) => t.icons.Search);
2376
- const Clear$1 = useTheme((t) => t.icons.Clear);
2329
+ function SelectFilter({ options: providedOptions, stringValue = asString, render = stringValue, singleSelect, hideSearchField, hideResetButton, virtual, ...props }) {
2330
+ const IconButton = useTheme((t) => t.components.IconButton);
2331
+ const Checkbox = useTheme((t) => t.components.Checkbox);
2332
+ const Search = useTheme((t) => t.icons.Search);
2333
+ const Clear = useTheme((t) => t.icons.Clear);
2377
2334
  const deselectAll = useTheme((t) => t.text.deselectAll);
2378
2335
  const noResults = useTheme((t) => t.text.noResults);
2379
2336
  const table = useTableContext();
@@ -2384,13 +2341,13 @@ function SelectFilter({ options: providedOptions, stringValue = asString, render
2384
2341
  isActive(filterValue) {
2385
2342
  return filterValue.size > 0;
2386
2343
  },
2387
- test(filterValue, value$1) {
2388
- return filterValue.has(value$1);
2344
+ test(filterValue, value) {
2345
+ return filterValue.has(value);
2389
2346
  }
2390
2347
  });
2391
2348
  const options = table.useState((state) => {
2392
2349
  if (providedOptions) return uniq(providedOptions);
2393
- const column = state.activeColumns.find((column$1) => column$1.id === columnId);
2350
+ const column = state.activeColumns.find((column) => column.id === columnId);
2394
2351
  if (!column) return [];
2395
2352
  return orderBy(uniq(flatMap(state.items, (item) => castArray(filterBy(column.value(item.value), item.value)))));
2396
2353
  });
@@ -2398,11 +2355,11 @@ function SelectFilter({ options: providedOptions, stringValue = asString, render
2398
2355
  const filtered = options.filter((option) => !query || stringValue(option).toLowerCase().includes(query.toLowerCase()));
2399
2356
  const delayedValue = (0, react.useMemo)(() => value, [isActive]);
2400
2357
  const ordered = filtered.filter((option) => delayedValue.has(option)).concat(filtered.filter((option) => !delayedValue.has(option)));
2401
- const Button$1 = useTheme((t) => t.components.Button);
2358
+ const Button = useTheme((t) => t.components.Button);
2402
2359
  (0, react.useEffect)(() => {
2403
2360
  setQuery("");
2404
2361
  }, [isActive]);
2405
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
2362
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
2406
2363
  css: {
2407
2364
  padding: "calc(var(--spacing) * 2)",
2408
2365
  display: "grid",
@@ -2410,16 +2367,16 @@ function SelectFilter({ options: providedOptions, stringValue = asString, render
2410
2367
  gap: "var(--spacing)"
2411
2368
  },
2412
2369
  children: [
2413
- !hideSearchField && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(AutoFocusTextField, {
2370
+ !hideSearchField && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(AutoFocusTextField, {
2414
2371
  value: query,
2415
2372
  onChange: (event) => setQuery(event.target.value),
2416
- endIcon: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(IconButton$1, {
2373
+ endIcon: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(IconButton, {
2417
2374
  onClick: () => setQuery(""),
2418
- children: !query ? /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Search$1, {}) : /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Clear$1, {})
2375
+ children: !query ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Search, {}) : /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Clear, {})
2419
2376
  }),
2420
2377
  css: { marginBottom: "var(--spacing)" }
2421
2378
  }),
2422
- !hideResetButton && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Button$1, {
2379
+ !hideResetButton && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Button, {
2423
2380
  disabled: value.size === 0,
2424
2381
  onClick: () => onChange(/* @__PURE__ */ new Set()),
2425
2382
  variant: "outlined",
@@ -2431,8 +2388,9 @@ function SelectFilter({ options: providedOptions, stringValue = asString, render
2431
2388
  },
2432
2389
  children: deselectAll
2433
2390
  }),
2434
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(VirtualList, {
2391
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(VirtualList, {
2435
2392
  items: ordered,
2393
+ virtual,
2436
2394
  css: {
2437
2395
  width: "20em",
2438
2396
  maxWidth: "100%",
@@ -2441,22 +2399,21 @@ function SelectFilter({ options: providedOptions, stringValue = asString, render
2441
2399
  display: "grid",
2442
2400
  gridTemplateColumns: "minmax(0, 1fr)"
2443
2401
  },
2444
- children: (option, index) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(FormControlLabel, {
2445
- control: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Checkbox$1, {
2402
+ children: (option, index) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(FormControlLabel, {
2403
+ control: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Checkbox, {
2446
2404
  checked: value.has(option),
2447
2405
  onChange: () => onChange(toggle(value, option, singleSelect))
2448
2406
  }),
2449
2407
  label: render(option)
2450
2408
  }, index)
2451
2409
  }),
2452
- ordered.length === 0 && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("span", {
2410
+ ordered.length === 0 && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", {
2453
2411
  css: { textAlign: "center" },
2454
2412
  children: noResults
2455
2413
  })
2456
2414
  ]
2457
2415
  });
2458
2416
  }
2459
-
2460
2417
  //#endregion
2461
2418
  //#region src/hooks/useTableRef.ts
2462
2419
  function useTableRef(table, ref) {
@@ -2495,7 +2452,6 @@ function useTableRef(table, ref) {
2495
2452
  }
2496
2453
  }), [table]);
2497
2454
  }
2498
-
2499
2455
  //#endregion
2500
2456
  //#region src/misc/queue.ts
2501
2457
  var Queue = class {
@@ -2529,7 +2485,6 @@ var Queue = class {
2529
2485
  this.isRunning = false;
2530
2486
  }
2531
2487
  };
2532
-
2533
2488
  //#endregion
2534
2489
  //#region src/internalState/tableStateStorage.ts
2535
2490
  const KEYS = [
@@ -2543,22 +2498,22 @@ const KEYS = [
2543
2498
  ];
2544
2499
  const storageName = (id) => `schummar-table_state-v1_${id}`;
2545
2500
  function stringify(value) {
2546
- function prepare(value$1) {
2547
- if (value$1 instanceof Date) return { __date: value$1.toJSON() };
2548
- if (value$1 instanceof Set) return { __set: Array.from(value$1).map(prepare) };
2549
- if (value$1 instanceof Map) return { __map: Array.from(value$1.entries()).map((entry) => entry.map(prepare)) };
2550
- if (Array.isArray(value$1)) return value$1.map(prepare);
2551
- if (value$1 instanceof Object) return Object.fromEntries(Object.entries(value$1).map(([k, v]) => [k, prepare(v)]));
2552
- return value$1;
2501
+ function prepare(value) {
2502
+ if (value instanceof Date) return { __date: value.toJSON() };
2503
+ if (value instanceof Set) return { __set: Array.from(value).map(prepare) };
2504
+ if (value instanceof Map) return { __map: Array.from(value.entries()).map((entry) => entry.map(prepare)) };
2505
+ if (Array.isArray(value)) return value.map(prepare);
2506
+ if (value instanceof Object) return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, prepare(v)]));
2507
+ return value;
2553
2508
  }
2554
2509
  return JSON.stringify(prepare(value));
2555
2510
  }
2556
2511
  function parse(value) {
2557
- return JSON.parse(value, (_key, value$1) => {
2558
- if (value$1 instanceof Object && "__date" in value$1) return new Date(value$1.__date);
2559
- if (value$1 instanceof Object && "__set" in value$1) return new Set(value$1.__set);
2560
- if (value$1 instanceof Object && "__map" in value$1) return new Map(value$1.__map);
2561
- return value$1;
2512
+ return JSON.parse(value, (_key, value) => {
2513
+ if (value instanceof Object && "__date" in value) return new Date(value.__date);
2514
+ if (value instanceof Object && "__set" in value) return new Set(value.__set);
2515
+ if (value instanceof Object && "__map" in value) return new Map(value.__map);
2516
+ return value;
2562
2517
  });
2563
2518
  }
2564
2519
  function useTableStateStorage(table) {
@@ -2579,23 +2534,25 @@ function useTableStateStorage(table) {
2579
2534
  const data = parse(json);
2580
2535
  table.getState().props.debug?.("load", json, data);
2581
2536
  function applyUpdate(state, key) {
2582
- if ((!include || include.includes(key)) && !exclude?.includes(key) && key in data) if (key === "filterValues") for (const [id$1, value] of data[key]) {
2583
- const filter = state.filters.get(id$1);
2584
- if (filter && (filter.persist ?? filter.value === void 0)) {
2585
- state.filterValues.set(id$1, value);
2586
- state.filters.get(id$1)?.onChange?.(value);
2537
+ if ((!include || include.includes(key)) && !exclude?.includes(key) && key in data) {
2538
+ if (key === "filterValues") for (const [id, value] of data[key]) {
2539
+ const filter = state.filters.get(id);
2540
+ if (filter && (filter.persist ?? filter.value === void 0)) {
2541
+ state.filterValues.set(id, value);
2542
+ state.filters.get(id)?.onChange?.(value);
2543
+ }
2587
2544
  }
2588
- }
2589
- else {
2590
- if (key === "expanded" || key === "hiddenColumns" || key === "selection" || key === "sort") {
2591
- if (state.props[key] !== void 0) return;
2592
- state.props[`on${key.slice(0, 1).toUpperCase() + key.slice(1)}Change`]?.(data[key]);
2545
+ else {
2546
+ if (key === "expanded" || key === "hiddenColumns" || key === "selection" || key === "sort") {
2547
+ if (state.props[key] !== void 0) return;
2548
+ state.props[`on${key.slice(0, 1).toUpperCase() + key.slice(1)}Change`]?.(data[key]);
2549
+ }
2550
+ state[key] = data[key];
2593
2551
  }
2594
- state[key] = data[key];
2595
2552
  }
2596
2553
  }
2597
2554
  table.update((state) => {
2598
- for (const key of KEYS.filter((key$1) => key$1 !== "filterValues")) applyUpdate(state, key);
2555
+ for (const key of KEYS.filter((key) => key !== "filterValues")) applyUpdate(state, key);
2599
2556
  });
2600
2557
  await new Promise((resolve) => {
2601
2558
  setTimeout(resolve);
@@ -2617,12 +2574,14 @@ function useTableStateStorage(table) {
2617
2574
  if (!state.props.persist) return;
2618
2575
  const { storage, id, include, exclude } = state.props.persist;
2619
2576
  const data = {};
2620
- for (const key of KEYS) if ((!include || include.includes(key)) && !exclude?.includes(key)) if (key === "filterValues") {
2621
- data[key] = /* @__PURE__ */ new Map();
2622
- for (const [id$1, value] of state.filterValues) if (state.filters.get(id$1)?.persist ?? state.filters.get(id$1)?.value === void 0) data.filterValues.set(id$1, value);
2623
- } else {
2624
- if ((key === "expanded" || key === "hiddenColumns" || key === "selection" || key === "sort") && state.props[key] !== void 0) continue;
2625
- data[key] = state[key];
2577
+ for (const key of KEYS) if ((!include || include.includes(key)) && !exclude?.includes(key)) {
2578
+ if (key === "filterValues") {
2579
+ data[key] = /* @__PURE__ */ new Map();
2580
+ for (const [id, value] of state.filterValues) if (state.filters.get(id)?.persist ?? state.filters.get(id)?.value === void 0) data.filterValues.set(id, value);
2581
+ } else {
2582
+ if ((key === "expanded" || key === "hiddenColumns" || key === "selection" || key === "sort") && state.props[key] !== void 0) continue;
2583
+ data[key] = state[key];
2584
+ }
2626
2585
  }
2627
2586
  return {
2628
2587
  storage,
@@ -2650,22 +2609,21 @@ function useTableStateStorage(table) {
2650
2609
  }
2651
2610
  return [isHydrated, clear];
2652
2611
  }
2653
-
2654
2612
  //#endregion
2655
2613
  //#region src/internalState/calcItems.ts
2656
2614
  function calcItems(state) {
2657
- (0, react.useEffect)(() => state.addReaction((state$1) => [
2658
- state$1.props.items,
2659
- state$1.props.id,
2660
- state$1.props.parentId,
2661
- state$1.props.revealFiltered,
2662
- state$1.props.externalSort,
2663
- state$1.props.locale,
2664
- state$1.sort,
2665
- state$1.filters,
2666
- state$1.filterValues,
2667
- state$1.activeColumns,
2668
- state$1.expanded
2615
+ (0, react.useEffect)(() => state.addReaction((state) => [
2616
+ state.props.items,
2617
+ state.props.id,
2618
+ state.props.parentId,
2619
+ state.props.revealFiltered,
2620
+ state.props.externalSort,
2621
+ state.props.locale,
2622
+ state.sort,
2623
+ state.filters,
2624
+ state.filterValues,
2625
+ state.activeColumns,
2626
+ state.expanded
2669
2627
  ], ([items = [], id, parentId, revealFiltered, externalSort, locale, sort, filters, filterValues, activeColumns], draft) => {
2670
2628
  const tableItems = items.map((item) => ({
2671
2629
  id: id(item),
@@ -2676,14 +2634,14 @@ function calcItems(state) {
2676
2634
  let sorted;
2677
2635
  if (sort.length === 0 || externalSort) sorted = tableItems;
2678
2636
  else {
2679
- const selectors = flatMap(sort, (sort$1) => {
2680
- const column = activeColumns.find((column$1) => column$1.id === sort$1.columnId);
2637
+ const selectors = flatMap(sort, (sort) => {
2638
+ const column = activeColumns.find((column) => column.id === sort.columnId);
2681
2639
  if (!column) return [];
2682
2640
  return column.sortBy.map((sortBy) => ({
2683
2641
  selector: (item) => sortBy(column.value(item), item),
2684
- direction: sort$1.direction,
2685
- locale: sort$1.locale ?? locale,
2686
- options: sort$1.options
2642
+ direction: sort.direction,
2643
+ locale: sort.locale ?? locale,
2644
+ options: sort.options
2687
2645
  }));
2688
2646
  }).filter(Boolean);
2689
2647
  sorted = orderBy(tableItems, selectors.map((x) => (item) => x.selector(item.value)), selectors.map((x) => x.direction), selectors.map((x) => x.locale), selectors.map((x) => x.options));
@@ -2693,8 +2651,8 @@ function calcItems(state) {
2693
2651
  for (const item of sorted) (item.parentId !== void 0 && item.parentId !== null ? lookup.get(item.parentId) : void 0)?.children.push(item);
2694
2652
  const allItems = new Array();
2695
2653
  const allItemsById = /* @__PURE__ */ new Map();
2696
- const traverse = (items$1) => {
2697
- for (const item of items$1) {
2654
+ const traverse = (items) => {
2655
+ for (const item of items) {
2698
2656
  allItems.push(item);
2699
2657
  allItemsById.set(item.id, item);
2700
2658
  traverse(item.children);
@@ -2711,12 +2669,13 @@ function calcItems(state) {
2711
2669
  if (!filter || filter.external) return true;
2712
2670
  const filterValue = filterValues.get(column.id);
2713
2671
  if (filterValue === void 0 || !filter.isActive(filterValue)) return true;
2714
- return castArray((filter.filterBy ?? ((x) => x))(column.value(item.value), item.value)).some((value) => filter.test(filterValue, value));
2672
+ const value = (filter.filterBy ?? ((x) => x))(column.value(item.value), item.value);
2673
+ return castArray(value).some((value) => filter.test(filterValue, value));
2715
2674
  });
2716
2675
  if (isActive && item.parentId !== void 0 && item.parentId !== null) {
2717
2676
  activeSet.add(item.parentId);
2718
- if (revealFiltered && Array.from(filters.entries()).some(([id$1, filter]) => {
2719
- const filterValue = filterValues.get(id$1);
2677
+ if (revealFiltered && Array.from(filters.entries()).some(([id, filter]) => {
2678
+ const filterValue = filterValues.get(id);
2720
2679
  return !!filter && filterValue !== void 0 && filter.isActive(filterValue);
2721
2680
  })) {
2722
2681
  expandedChanged ||= !draft.expanded.has(item.parentId);
@@ -2735,23 +2694,20 @@ function calcItems(state) {
2735
2694
  });
2736
2695
  }, { runNow: true }), [state]);
2737
2696
  }
2738
-
2739
2697
  //#endregion
2740
2698
  //#region src/exporters/serializer.ts
2741
2699
  function defaultSerializer(x) {
2742
2700
  if (x instanceof Date || typeof x === "number" || typeof x === "string") return x;
2743
2701
  return JSON.stringify(x) ?? "";
2744
2702
  }
2745
-
2746
2703
  //#endregion
2747
2704
  //#region src/misc/overrides.ts
2748
- function overrides(first, ...overrides$1) {
2749
- return overrides$1.reduce((result, source) => {
2705
+ function overrides(first, ...overrides) {
2706
+ return overrides.reduce((result, source) => {
2750
2707
  for (const [key, value] of Object.entries(source ?? {})) if (value !== void 0) result[key] = value;
2751
2708
  return result;
2752
2709
  }, { ...first });
2753
2710
  }
2754
-
2755
2711
  //#endregion
2756
2712
  //#region src/internalState/calcProps.ts
2757
2713
  const defaultProps = {
@@ -2795,28 +2751,28 @@ function calc(props, cache) {
2795
2751
  });
2796
2752
  const globalDefaults = props.defaultColumnProps;
2797
2753
  const mapColumn = ({ id: _id, header, exportHeader, footer, value, renderCell, exportCell, sortBy, disableSort, hidden, classes, styles, filter, width, displaySize }, index) => {
2798
- const id$1 = _id ?? index;
2799
- const cacheKey = typeof id$1 === "string" ? `s${id$1}` : `n${id$1}`;
2800
- const defaults$1 = {
2754
+ const id = _id ?? index;
2755
+ const cacheKey = typeof id === "string" ? `s${id}` : `n${id}`;
2756
+ const defaults = {
2801
2757
  ...globalDefaults,
2802
- ...columnProps?.(id$1)
2758
+ ...columnProps?.(id)
2803
2759
  };
2804
2760
  return {
2805
- id: id$1,
2806
- header: header ?? defaults$1?.header ?? null,
2807
- exportHeader: exportHeader ?? defaults$1?.exportHeader ?? id$1,
2808
- footer: footer ?? defaults$1?.footer ?? null,
2761
+ id,
2762
+ header: header ?? defaults?.header ?? null,
2763
+ exportHeader: exportHeader ?? defaults?.exportHeader ?? id,
2764
+ footer: footer ?? defaults?.footer ?? null,
2809
2765
  value: cache(`columns.${cacheKey}.value`, value),
2810
- renderCell: cache(`columns.${cacheKey}.renderCell`, renderCell ?? defaults$1?.renderCell ?? asString),
2811
- exportCell: exportCell ?? defaults$1?.exportCell ?? defaultSerializer,
2812
- sortBy: (sortBy ?? defaults$1?.sortBy ?? [(v) => typeof v === "number" || v instanceof Date ? v : v === null || v === void 0 ? "" : String(v)]).map((function_, i) => cache(`columns.${cacheKey}.sortBy.${i}`, function_)),
2813
- disableSort: disableSort ?? defaults$1?.disableSort ?? false,
2814
- hidden: hidden ?? defaults$1?.hidden,
2815
- classes: classes ?? defaults$1?.classes,
2816
- styles: styles ?? defaults$1?.styles,
2817
- filter: filter ?? defaults$1?.filter,
2818
- width: width ?? defaults$1?.width,
2819
- displaySize: (displaySize ?? defaults$1.displaySize) !== void 0 ? castArray(displaySize ?? defaults$1.displaySize) : void 0
2766
+ renderCell: cache(`columns.${cacheKey}.renderCell`, renderCell ?? defaults?.renderCell ?? asString),
2767
+ exportCell: exportCell ?? defaults?.exportCell ?? defaultSerializer,
2768
+ sortBy: (sortBy ?? defaults?.sortBy ?? [(v) => typeof v === "number" || v instanceof Date ? v : v === null || v === void 0 ? "" : String(v)]).map((function_, i) => cache(`columns.${cacheKey}.sortBy.${i}`, function_)),
2769
+ disableSort: disableSort ?? defaults?.disableSort ?? props.disableSort ?? false,
2770
+ hidden: hidden ?? defaults?.hidden,
2771
+ classes: classes ?? defaults?.classes,
2772
+ styles: styles ?? defaults?.styles,
2773
+ filter: filter ?? defaults?.filter,
2774
+ width: width ?? defaults?.width,
2775
+ displaySize: (displaySize ?? defaults.displaySize) !== void 0 ? castArray(displaySize ?? defaults.displaySize) : void 0
2820
2776
  };
2821
2777
  };
2822
2778
  const columns = inputColumns?.filter((x) => !!x).map(mapColumn);
@@ -2824,7 +2780,7 @@ function calc(props, cache) {
2824
2780
  const wrapCell = props.wrapCell && cache("wrapCell", props.wrapCell);
2825
2781
  const rowAction = props.rowAction instanceof Function || Array.isArray(props.rowAction) ? cache("rowAction", props.rowAction) : props.rowAction;
2826
2782
  const rowDetails = props.rowDetails instanceof Function || Array.isArray(props.rowDetails) ? cache("rowDetails", props.rowDetails) : props.rowDetails;
2827
- const displaySizeOverrides = props.displaySizeOverrides && Object.fromEntries(Object.entries(props.displaySizeOverrides ?? {}).map(([size, overrides$1]) => [size, overrides$1 && calc(overrides$1, cache)]));
2783
+ const displaySizeOverrides = props.displaySizeOverrides && Object.fromEntries(Object.entries(props.displaySizeOverrides ?? {}).map(([size, overrides]) => [size, overrides && calc(overrides, cache)]));
2828
2784
  return {
2829
2785
  ...props,
2830
2786
  id,
@@ -2847,15 +2803,14 @@ function calc(props, cache) {
2847
2803
  displaySizeOverrides
2848
2804
  };
2849
2805
  }
2850
-
2851
2806
  //#endregion
2852
2807
  //#region src/internalState/cleanupState.ts
2853
2808
  function cleanupState(state) {
2854
- (0, react.useEffect)(() => state.addReaction((state$1) => [
2855
- state$1.props.columns,
2856
- state$1.itemsById,
2857
- state$1.activeItemsById,
2858
- state$1.activeColumns
2809
+ (0, react.useEffect)(() => state.addReaction((state) => [
2810
+ state.props.columns,
2811
+ state.itemsById,
2812
+ state.activeItemsById,
2813
+ state.activeColumns
2859
2814
  ], ([columns, itemsById, activeItemsById, activeColumns], draft) => {
2860
2815
  const columnIds = new Set(columns.map((column) => column.id));
2861
2816
  const activeColumnIds = new Set(activeColumns.map((column) => column.id));
@@ -2889,25 +2844,23 @@ function cleanupState(state) {
2889
2844
  }
2890
2845
  }, { runNow: true }), [state]);
2891
2846
  }
2892
-
2893
2847
  //#endregion
2894
2848
  //#region src/internalState/filterColumns.ts
2895
2849
  function filterColumns(state) {
2896
- (0, react.useEffect)(() => state.addReaction((state$1) => [
2897
- state$1.props.columns,
2898
- state$1.hiddenColumns,
2899
- state$1.columnOrder,
2900
- state$1.displaySize
2850
+ (0, react.useEffect)(() => state.addReaction((state) => [
2851
+ state.props.columns,
2852
+ state.hiddenColumns,
2853
+ state.columnOrder,
2854
+ state.displaySize
2901
2855
  ], ([columns, hiddenColumns, columnOrder, displaySize], draft) => {
2902
2856
  draft.activeColumns = orderBy(columns.filter((column) => !(column.hidden ?? hiddenColumns.has(column.id))), [(column) => columnOrder.indexOf(column.id)]);
2903
2857
  draft.visibleColumns = draft.activeColumns.filter((column) => displaySize === void 0 || column.displaySize === void 0 || column.displaySize.includes(displaySize));
2904
2858
  }, { runNow: true }), [state]);
2905
- (0, react.useEffect)(() => state.addReaction((state$1) => new Set(state$1.visibleColumns.map((column) => column.id)), (_, draft) => {
2859
+ (0, react.useEffect)(() => state.addReaction((state) => new Set(state.visibleColumns.map((column) => column.id)), (_, draft) => {
2906
2860
  draft.rowHeights.clear();
2907
2861
  draft.rowHeightsKey = Math.random();
2908
2862
  }, { runNow: false }), [state]);
2909
2863
  }
2910
-
2911
2864
  //#endregion
2912
2865
  //#region src/internalState/normalizeExpanded.ts
2913
2866
  function normalizeExpanded(table) {
@@ -2941,7 +2894,6 @@ function normalizeExpanded(table) {
2941
2894
  if (hasChanged) state.props.onExpandedChange?.(new Set(expanded));
2942
2895
  }, { runNow: true }), [table]);
2943
2896
  }
2944
-
2945
2897
  //#endregion
2946
2898
  //#region src/internalState/syncSelections.ts
2947
2899
  function syncSelections(table) {
@@ -2961,7 +2913,6 @@ function syncSelections(table) {
2961
2913
  }
2962
2914
  }, { runNow: true }), [table]);
2963
2915
  }
2964
-
2965
2916
  //#endregion
2966
2917
  //#region src/internalState/watchDisplaySize.ts
2967
2918
  function watchDisplaySize(state) {
@@ -2975,22 +2926,21 @@ function watchDisplaySize(state) {
2975
2926
  document.defaultView?.addEventListener("resize", onResize);
2976
2927
  return () => document.defaultView?.removeEventListener("resize", onResize);
2977
2928
  }, [state]);
2978
- (0, react.useEffect)(() => state.addReaction((state$1) => ({
2979
- displaySizePx: state$1.displaySizePx,
2980
- displaySize: state$1.props.displaySize
2929
+ (0, react.useEffect)(() => state.addReaction((state) => ({
2930
+ displaySizePx: state.displaySizePx,
2931
+ displaySize: state.props.displaySize
2981
2932
  }), ({ displaySizePx, displaySize }, draft) => {
2982
2933
  if (displaySizePx === void 0) return;
2983
2934
  if (typeof displaySize === "object") draft.displaySize = Object.entries(displaySize).find(([, maxWidth]) => maxWidth !== void 0 && maxWidth >= displaySizePx)?.[0];
2984
2935
  else draft.displaySize = displaySize;
2985
2936
  }), [state]);
2986
- (0, react.useEffect)(() => state.addReaction((state$1) => ({
2987
- props: state$1.normalizedProps,
2988
- displaySize: state$1.displaySize
2937
+ (0, react.useEffect)(() => state.addReaction((state) => ({
2938
+ props: state.normalizedProps,
2939
+ displaySize: state.displaySize
2989
2940
  }), ({ props, displaySize }, draft) => {
2990
2941
  draft.props = (0, immer.castDraft)(overrides(props, displaySize ? props.displaySizeOverrides?.[displaySize] : void 0));
2991
2942
  }), [state]);
2992
2943
  }
2993
-
2994
2944
  //#endregion
2995
2945
  //#region src/internalState/useTableState.ts
2996
2946
  function useTableState(_props) {
@@ -3036,30 +2986,29 @@ function useTableState(_props) {
3036
2986
  cleanupState(state);
3037
2987
  watchDisplaySize(state);
3038
2988
  (0, react.useEffect)(() => {
3039
- state.update((state$1) => {
3040
- state$1.normalizedProps = (0, immer.castDraft)(props);
3041
- if (props.sort) state$1.sort = props.sort;
3042
- if (props.selection) state$1.selection = props.selection;
3043
- if (props.expanded) state$1.expanded = props.expanded;
3044
- if (props.hiddenColumns) state$1.hiddenColumns = props.hiddenColumns;
3045
- for (const column of props.columns) if (!state$1.columnOrder.includes(column.id)) {
2989
+ state.update((state) => {
2990
+ state.normalizedProps = (0, immer.castDraft)(props);
2991
+ if (props.sort) state.sort = props.sort;
2992
+ if (props.selection) state.selection = props.selection;
2993
+ if (props.expanded) state.expanded = props.expanded;
2994
+ if (props.hiddenColumns) state.hiddenColumns = props.hiddenColumns;
2995
+ for (const column of props.columns) if (!state.columnOrder.includes(column.id)) {
3046
2996
  const index = props.columns.indexOf(column);
3047
- state$1.columnOrder.splice(index, 0, column.id);
2997
+ state.columnOrder.splice(index, 0, column.id);
3048
2998
  }
3049
2999
  });
3050
3000
  }, [state, props]);
3051
3001
  return [state, reset];
3052
3002
  }
3053
-
3054
3003
  //#endregion
3055
3004
  //#region src/components/clearFiltersButton.tsx
3056
3005
  function ClearFiltersButton() {
3057
- const Button$1 = useTheme((t) => t.components.Button);
3006
+ const Button = useTheme((t) => t.components.Button);
3058
3007
  const textClearFilters = useTheme((t) => t.text.clearFilters);
3059
3008
  const table = useTableContext();
3060
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3009
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
3061
3010
  css: require_tableSettings.defaultClasses.clearFiltersButton,
3062
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Button$1, {
3011
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Button, {
3063
3012
  variant: "outlined",
3064
3013
  onClick: () => {
3065
3014
  table.update((state) => {
@@ -3073,7 +3022,6 @@ function ClearFiltersButton() {
3073
3022
  })
3074
3023
  });
3075
3024
  }
3076
-
3077
3025
  //#endregion
3078
3026
  //#region src/components/columnFooter.tsx
3079
3027
  function ColumnFooter() {
@@ -3088,7 +3036,7 @@ function ColumnFooter() {
3088
3036
  const content = table.useState((state) => {
3089
3037
  return state.activeColumns.find((column) => column.id === columnId)?.footer;
3090
3038
  });
3091
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3039
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
3092
3040
  className: cx(classes, columnClasses),
3093
3041
  css: [
3094
3042
  require_tableSettings.defaultClasses.footerCell,
@@ -3101,7 +3049,6 @@ function ColumnFooter() {
3101
3049
  children: content
3102
3050
  });
3103
3051
  }
3104
-
3105
3052
  //#endregion
3106
3053
  //#region src/components/resizeHandle.tsx
3107
3054
  function ResizeHandle() {
@@ -3135,7 +3082,7 @@ function ResizeHandle() {
3135
3082
  });
3136
3083
  }
3137
3084
  if (!enabled) return null;
3138
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ResizeHandleView, {
3085
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ResizeHandleView, {
3139
3086
  enabled,
3140
3087
  onPointerDown: enabled ? onPointerDown : void 0,
3141
3088
  onPointerMove: enabled ? onPointerMove : void 0,
@@ -3143,11 +3090,11 @@ function ResizeHandle() {
3143
3090
  onDoubleClick: enabled ? onDoubleClick : void 0
3144
3091
  });
3145
3092
  }
3146
- function ResizeHandleView({ enabled,...props }) {
3147
- const className$2 = useTheme((theme) => theme.classes?.columnDivider);
3093
+ function ResizeHandleView({ enabled, ...props }) {
3094
+ const className = useTheme((theme) => theme.classes?.columnDivider);
3148
3095
  const styles = useTheme((theme) => theme.styles?.columnDivider);
3149
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3150
- className: className$2,
3096
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
3097
+ className,
3151
3098
  css: [{
3152
3099
  alignSelf: "stretch",
3153
3100
  padding: "0 5px",
@@ -3166,24 +3113,23 @@ function ResizeHandleView({ enabled,...props }) {
3166
3113
  ...props
3167
3114
  });
3168
3115
  }
3169
-
3170
3116
  //#endregion
3171
3117
  //#region src/components/sortComponent.tsx
3172
3118
  function SortComponent({ children }) {
3173
3119
  const table = useTableContext();
3174
3120
  const columnId = useColumnContext();
3175
- const Badge$1 = useTheme((t) => t.components.Badge);
3176
- const ArrowUpward$1 = useTheme((t) => t.icons.ArrowUpward);
3121
+ const Badge = useTheme((t) => t.components.Badge);
3122
+ const ArrowUpward = useTheme((t) => t.icons.ArrowUpward);
3177
3123
  const { direction, index, sortDisabled } = table.useState((state) => {
3178
- const index$1 = state.sort.findIndex((s) => s.columnId === columnId) ?? -1;
3179
- const column = state.activeColumns.find((column$1) => column$1.id === columnId);
3124
+ const index = state.sort.findIndex((s) => s.columnId === columnId) ?? -1;
3125
+ const column = state.activeColumns.find((column) => column.id === columnId);
3180
3126
  return {
3181
- direction: state.sort[index$1]?.direction,
3182
- index: index$1 >= 0 && state.sort.length > 1 ? index$1 + 1 : void 0,
3127
+ direction: state.sort[index]?.direction,
3128
+ index: index >= 0 && state.sort.length > 1 ? index + 1 : void 0,
3183
3129
  sortDisabled: column?.disableSort ?? state.props.disableSort
3184
3130
  };
3185
3131
  });
3186
- function toggle$1(event, off) {
3132
+ function toggle(event, off) {
3187
3133
  if (sortDisabled) return;
3188
3134
  const { props: { sort: controlledSort, onSortChange } } = table.getState();
3189
3135
  const newDirection = direction === "asc" ? "desc" : "asc";
@@ -3199,7 +3145,7 @@ function SortComponent({ children }) {
3199
3145
  event.preventDefault();
3200
3146
  return false;
3201
3147
  }
3202
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
3148
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
3203
3149
  css: {
3204
3150
  userSelect: "none",
3205
3151
  display: "grid",
@@ -3211,11 +3157,11 @@ function SortComponent({ children }) {
3211
3157
  textOverflow: "ellipsis"
3212
3158
  }
3213
3159
  },
3214
- onClick: (event) => toggle$1(event),
3215
- onContextMenu: (event) => toggle$1(event, true),
3216
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", { children }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Badge$1, {
3160
+ onClick: (event) => toggle(event),
3161
+ onContextMenu: (event) => toggle(event, true),
3162
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", { children }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Badge, {
3217
3163
  badgeContent: sortDisabled ? 0 : index,
3218
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("span", {
3164
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", {
3219
3165
  css: [
3220
3166
  {
3221
3167
  transition: "all 300ms",
@@ -3224,12 +3170,11 @@ function SortComponent({ children }) {
3224
3170
  !direction && { opacity: 0 },
3225
3171
  direction === "desc" && { transform: "rotate3d(0, 0, 1, 180deg)" }
3226
3172
  ],
3227
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ArrowUpward$1, {})
3173
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ArrowUpward, {})
3228
3174
  })
3229
3175
  })]
3230
3176
  });
3231
3177
  }
3232
-
3233
3178
  //#endregion
3234
3179
  //#region src/components/columnHeader.tsx
3235
3180
  const ColumnHeaderContext = new require_tableSettings.StoreScope({ items: /* @__PURE__ */ new Map() });
@@ -3243,7 +3188,7 @@ function ColumnHeader({ index }) {
3243
3188
  const classes = useTheme((theme) => theme.classes?.headerCell);
3244
3189
  const styles = useTheme((theme) => theme.styles?.headerCell);
3245
3190
  const { header, columnClasses, columnStyles } = table.useState((state) => {
3246
- const column = state.activeColumns.find((column$1) => column$1.id === columnId);
3191
+ const column = state.activeColumns.find((column) => column.id === columnId);
3247
3192
  return {
3248
3193
  header: column?.header,
3249
3194
  columnClasses: column?.classes?.headerCell,
@@ -3251,8 +3196,8 @@ function ColumnHeader({ index }) {
3251
3196
  };
3252
3197
  });
3253
3198
  const store = ColumnHeaderContext.useStore();
3254
- const draggingStart = (0, react.useRef)();
3255
- const clone = (0, react.useRef)();
3199
+ const draggingStart = (0, react.useRef)(void 0);
3200
+ const clone = (0, react.useRef)(void 0);
3256
3201
  (0, react.useEffect)(() => {
3257
3202
  const div = ref.current;
3258
3203
  if (!div) return;
@@ -3311,24 +3256,24 @@ function ColumnHeader({ index }) {
3311
3256
  div.style.color = "rgba(0, 0, 0, 0.2)";
3312
3257
  }
3313
3258
  clone.current.style.left = `${draggingStart.current.bounds.left + event.clientX - draggingStart.current.mouseX}px`;
3314
- const index$1 = state.columnOrder.indexOf(columnId);
3259
+ const index = state.columnOrder.indexOf(columnId);
3315
3260
  const targetIndex = calcTargetIndex(div.offsetLeft + event.clientX - draggingStart.current.mouseX);
3316
- const columns = table.getState().columnOrder.map((id, index$2) => ({
3261
+ const columns = table.getState().columnOrder.map((id, index) => ({
3317
3262
  id,
3318
- index: index$2,
3263
+ index,
3319
3264
  width: store.getState().items.get(id)?.offsetWidth ?? 0
3320
3265
  }));
3321
3266
  state.columnOrder.forEach((id, i) => {
3322
3267
  let offset = 0;
3323
- if (i === index$1) {
3324
- if (targetIndex > index$1) offset = columns.slice(index$1 + 1, targetIndex + 1).reduce((sum, col) => sum + col.width, 0);
3325
- else if (targetIndex < index$1) offset = -columns.slice(targetIndex, index$1).reduce((sum, col) => sum + col.width, 0);
3326
- } else if (i >= targetIndex && i < index$1) offset = div.offsetWidth;
3327
- else if (i > index$1 && i <= targetIndex) offset = -div.offsetWidth;
3268
+ if (i === index) {
3269
+ if (targetIndex > index) offset = columns.slice(index + 1, targetIndex + 1).reduce((sum, col) => sum + col.width, 0);
3270
+ else if (targetIndex < index) offset = -columns.slice(targetIndex, index).reduce((sum, col) => sum + col.width, 0);
3271
+ } else if (i >= targetIndex && i < index) offset = div.offsetWidth;
3272
+ else if (i > index && i <= targetIndex) offset = -div.offsetWidth;
3328
3273
  state.columnStyleOverride.set(id, {
3329
3274
  transition: "transform 500ms",
3330
3275
  transform: `translate3d(${offset}px, 0, 0)`,
3331
- zIndex: i === index$1 ? 1 : void 0
3276
+ zIndex: i === index ? 1 : void 0
3332
3277
  });
3333
3278
  });
3334
3279
  });
@@ -3337,9 +3282,9 @@ function ColumnHeader({ index }) {
3337
3282
  table.update((state) => {
3338
3283
  const div = ref.current;
3339
3284
  if (!div || draggingStart.current === void 0) return;
3340
- const index$1 = state.columnOrder.indexOf(columnId);
3285
+ const index = state.columnOrder.indexOf(columnId);
3341
3286
  const targetIndex = calcTargetIndex(div.offsetLeft + event.clientX - draggingStart.current.mouseX);
3342
- state.columnOrder.splice(index$1, 1);
3287
+ state.columnOrder.splice(index, 1);
3343
3288
  state.columnOrder.splice(targetIndex, 0, columnId);
3344
3289
  clone.current?.remove();
3345
3290
  div.style.color = "";
@@ -3348,7 +3293,7 @@ function ColumnHeader({ index }) {
3348
3293
  clone.current = void 0;
3349
3294
  });
3350
3295
  }
3351
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
3296
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
3352
3297
  ref,
3353
3298
  className: cx(classes, columnClasses),
3354
3299
  css: [
@@ -3369,22 +3314,21 @@ function ColumnHeader({ index }) {
3369
3314
  onPointerMove: enabled ? onPointerMove : void 0,
3370
3315
  onPointerUp: enabled ? onPointerUp : void 0,
3371
3316
  children: [
3372
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(SortComponent, { children: header }),
3373
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", { css: { flex: 1 } }),
3374
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(FilterControl, {}),
3375
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ResizeHandle, {})
3317
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(SortComponent, { children: header }),
3318
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", { css: { flex: 1 } }),
3319
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(FilterControl, {}),
3320
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ResizeHandle, {})
3376
3321
  ]
3377
3322
  });
3378
3323
  }
3379
-
3380
3324
  //#endregion
3381
3325
  //#region src/components/columnSelection.tsx
3382
3326
  function ColumnSelection() {
3383
- const IconButton$1 = useTheme((t) => t.components.IconButton);
3384
- const Popover$1 = useTheme((t) => t.components.Popover);
3385
- const Checkbox$1 = useTheme((t) => t.components.Checkbox);
3386
- const Button$1 = useTheme((t) => t.components.Button);
3387
- const Settings$1 = useTheme((t) => t.icons.Settings);
3327
+ const IconButton = useTheme((t) => t.components.IconButton);
3328
+ const Popover = useTheme((t) => t.components.Popover);
3329
+ const Checkbox = useTheme((t) => t.components.Checkbox);
3330
+ const Button = useTheme((t) => t.components.Button);
3331
+ const Settings = useTheme((t) => t.icons.Settings);
3388
3332
  const selectColumns = useTheme((t) => t.text.selectColumns);
3389
3333
  const resetAll = useTheme((t) => t.text.resetAll);
3390
3334
  const showAll = useTheme((t) => t.text.showAllColumns);
@@ -3396,57 +3340,57 @@ function ColumnSelection() {
3396
3340
  const columns = table.useState((state) => orderBy(state.props.columns.filter((column) => state.displaySize === void 0 || column.displaySize === void 0 || column.displaySize.includes(state.displaySize)), [(column) => state.columnOrder.indexOf(column.id)]));
3397
3341
  const hiddenColumns = table.useState((state) => state.hiddenColumns);
3398
3342
  const [anchorElement, setAnchorElement] = (0, react.useState)(null);
3399
- const toggle$1 = (column, state) => {
3343
+ const toggle = (column, state) => {
3400
3344
  const { props: { hiddenColumns: controlledHiddenColumns, onHiddenColumnsChange } } = table.getState();
3401
3345
  const newValue = new Set(hiddenColumns);
3402
- for (const columnId of column ? [column.id] : columns.map((column$1) => column$1.id)) if (state ?? hiddenColumns.has(columnId)) newValue.delete(columnId);
3346
+ for (const columnId of column ? [column.id] : columns.map((column) => column.id)) if (state ?? hiddenColumns.has(columnId)) newValue.delete(columnId);
3403
3347
  else newValue.add(columnId);
3404
- if (!controlledHiddenColumns) table.update((state$1) => {
3405
- state$1.hiddenColumns = newValue;
3348
+ if (!controlledHiddenColumns) table.update((state) => {
3349
+ state.hiddenColumns = newValue;
3406
3350
  });
3407
3351
  onHiddenColumnsChange?.(newValue);
3408
3352
  };
3409
3353
  const allVisible = columns.every((column) => !hiddenColumns.has(column.id));
3410
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(__emotion_react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(IconButton$1, {
3354
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(IconButton, {
3411
3355
  onClick: (event) => setAnchorElement(anchorElement ? null : event.currentTarget),
3412
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Settings$1, {})
3413
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Popover$1, {
3356
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Settings, {})
3357
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Popover, {
3414
3358
  anchorEl: anchorElement,
3415
3359
  open: !!anchorElement,
3416
3360
  onClose: () => setAnchorElement(null),
3417
3361
  css: cssVariables,
3418
3362
  className: classes?.popover,
3419
3363
  backdropClassName: classes?.popoverBackdrop,
3420
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
3364
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
3421
3365
  css: {
3422
3366
  padding: `calc(var(--spacing) * 2)`,
3423
3367
  display: "grid"
3424
3368
  },
3425
3369
  children: [
3426
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3370
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
3427
3371
  css: { marginBottom: "var(--spacing)" },
3428
3372
  children: selectColumns
3429
3373
  }),
3430
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
3374
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
3431
3375
  css: {
3432
3376
  margin: "0.5em 0",
3433
3377
  display: "flex",
3434
3378
  gap: "0.5em"
3435
3379
  },
3436
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Button$1, {
3380
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Button, {
3437
3381
  variant: "outlined",
3438
- onClick: () => toggle$1(void 0, !allVisible),
3382
+ onClick: () => toggle(void 0, !allVisible),
3439
3383
  children: allVisible ? hideAll : showAll
3440
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Button$1, {
3384
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Button, {
3441
3385
  variant: "outlined",
3442
3386
  onClick: reset,
3443
3387
  children: resetAll
3444
3388
  })]
3445
3389
  }),
3446
- columns.map((column) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(FormControlLabel, {
3447
- control: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Checkbox$1, {
3390
+ columns.map((column) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(FormControlLabel, {
3391
+ control: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Checkbox, {
3448
3392
  checked: !(column.hidden ?? hiddenColumns.has(column.id)),
3449
- onChange: () => toggle$1(column),
3393
+ onChange: () => toggle(column),
3450
3394
  disabled: column.hidden !== void 0
3451
3395
  }),
3452
3396
  label: column.header
@@ -3455,17 +3399,16 @@ function ColumnSelection() {
3455
3399
  })
3456
3400
  })] });
3457
3401
  }
3458
-
3459
3402
  //#endregion
3460
3403
  //#region src/components/export.tsx
3461
3404
  function Export() {
3462
3405
  const { exporters: contextExporters } = (0, react.useContext)(require_tableSettings.TableSettingsContext);
3463
3406
  const table = useTableContext();
3464
- const Button$1 = useTheme((t) => t.components.Button);
3465
- const IconButton$1 = useTheme((t) => t.components.IconButton);
3466
- const Popover$1 = useTheme((t) => t.components.Popover);
3407
+ const Button = useTheme((t) => t.components.Button);
3408
+ const IconButton = useTheme((t) => t.components.IconButton);
3409
+ const Popover = useTheme((t) => t.components.Popover);
3467
3410
  const ExportIcon = useTheme((t) => t.icons.Export);
3468
- const Clipboard$1 = useTheme((t) => t.icons.Clipboard);
3411
+ const Clipboard = useTheme((t) => t.icons.Clipboard);
3469
3412
  const exportTitle = useTheme((t) => t.text.exportTitle);
3470
3413
  const exportCopy = useTheme((t) => t.text.exportCopy);
3471
3414
  const exportDownload = useTheme((t) => t.text.exportDownload);
@@ -3503,17 +3446,17 @@ function Export() {
3503
3446
  URL.revokeObjectURL(url);
3504
3447
  }
3505
3448
  }
3506
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(__emotion_react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(IconButton$1, {
3449
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(IconButton, {
3507
3450
  onClick: (event) => setAnchor(anchor ? null : event.currentTarget),
3508
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ExportIcon, { css: !!anchor && { color: "var(--primaryMain)" } })
3509
- }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Popover$1, {
3451
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ExportIcon, { css: !!anchor && { color: "var(--primaryMain)" } })
3452
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Popover, {
3510
3453
  open: !!anchor,
3511
3454
  onClose: () => setAnchor(null),
3512
3455
  anchorEl: anchor,
3513
3456
  css: cssVariables,
3514
3457
  className: classes?.popover,
3515
3458
  backdropClassName: classes?.popoverBackdrop,
3516
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
3459
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
3517
3460
  css: {
3518
3461
  padding: `calc(var(--spacing) * 2)`,
3519
3462
  display: "grid",
@@ -3521,11 +3464,11 @@ function Export() {
3521
3464
  gap: "var(--spacing)",
3522
3465
  "& > *": { justifyContent: "start" }
3523
3466
  },
3524
- children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3467
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
3525
3468
  css: { marginBottom: "var(--spacing)" },
3526
3469
  children: exportTitle
3527
- }), exporters.map((entry, index) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(Button$1, {
3528
- startIcon: entry.action === "copy" ? /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Clipboard$1, {}) : /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ExportIcon, {}),
3470
+ }), exporters.map((entry, index) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(Button, {
3471
+ startIcon: entry.action === "copy" ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Clipboard, {}) : /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ExportIcon, {}),
3529
3472
  onClick: () => execute(entry),
3530
3473
  children: [
3531
3474
  entry.action === "copy" ? exportCopy : exportDownload,
@@ -3537,7 +3480,6 @@ function Export() {
3537
3480
  })
3538
3481
  })] });
3539
3482
  }
3540
-
3541
3483
  //#endregion
3542
3484
  //#region src/misc/calcClassNames.ts
3543
3485
  function calcClassNames(classes, item, index) {
@@ -3554,22 +3496,21 @@ function calcCss(styles, item, index) {
3554
3496
  index % 2 === 1 && styles?.oddCell
3555
3497
  ];
3556
3498
  }
3557
-
3558
3499
  //#endregion
3559
3500
  //#region src/components/cell.tsx
3560
3501
  const defaultWrapCell = (content) => {
3561
- if (typeof content === "string") return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("span", {
3502
+ if (typeof content === "string") return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", {
3562
3503
  css: require_tableSettings.defaultClasses.text,
3563
3504
  title: content,
3564
3505
  children: content
3565
3506
  });
3566
3507
  return content;
3567
3508
  };
3568
- const Cell = (0, react.memo)(function Cell$1({ itemId, rowIndex }) {
3509
+ const Cell = (0, react.memo)(function Cell({ itemId, rowIndex }) {
3569
3510
  const table = useTableContext();
3570
3511
  const columnId = useColumnContext();
3571
3512
  const column = table.useState((state) => {
3572
- const col = state.activeColumns.find((column$1) => column$1.id === columnId);
3513
+ const col = state.activeColumns.find((column) => column.id === columnId);
3573
3514
  return col && {
3574
3515
  value: col.value,
3575
3516
  renderCell: col.renderCell
@@ -3581,25 +3522,24 @@ const Cell = (0, react.memo)(function Cell$1({ itemId, rowIndex }) {
3581
3522
  (0, react.useLayoutEffect)(() => {
3582
3523
  table.getState().props.debugRender?.("render cell", itemId, columnId);
3583
3524
  });
3584
- const className$2 = useTheme((t) => cx(...calcClassNames(t.classes, item?.value, rowIndex)));
3525
+ const className = useTheme((t) => cx(...calcClassNames(t.classes, item?.value, rowIndex)));
3585
3526
  const styles = useTheme((t) => calcCss(t.styles, item?.value, rowIndex));
3586
3527
  if (!column || !item) return null;
3587
3528
  const content = column.renderCell(column.value(item.value), item.value);
3588
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3589
- className: className$2,
3529
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
3530
+ className,
3590
3531
  css: [require_tableSettings.defaultClasses.cell, styles],
3591
3532
  style: columnStyleOverride,
3592
3533
  children: wrapCell(content, column.value(item.value), item.value, rowIndex)
3593
3534
  });
3594
3535
  });
3595
-
3596
3536
  //#endregion
3597
3537
  //#region src/components/details.tsx
3598
- const Details = (0, react.forwardRef)(function Details$1({ itemId, rowIndex }, ref) {
3538
+ const Details = (0, react.forwardRef)(function Details({ itemId, rowIndex }, ref) {
3599
3539
  const table = useTableContext();
3600
3540
  const classes = useTheme((t) => t.classes);
3601
3541
  const styles = useTheme((t) => t.styles);
3602
- const { details, className: className$2, css: css$2 } = table.useState((state) => {
3542
+ const { details, className, css } = table.useState((state) => {
3603
3543
  const item = state.activeItemsById.get(itemId);
3604
3544
  return {
3605
3545
  details: state.expanded.has(itemId) ? state.props.rowDetails instanceof Function ? item ? state.props.rowDetails(item.value, rowIndex) : null : state.props.rowDetails : void 0,
@@ -3607,24 +3547,23 @@ const Details = (0, react.forwardRef)(function Details$1({ itemId, rowIndex }, r
3607
3547
  css: styles?.details instanceof Function ? styles.details(item?.value, rowIndex) : styles?.details
3608
3548
  };
3609
3549
  });
3610
- return details ? /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3550
+ return details ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
3611
3551
  ref,
3612
- className: className$2,
3613
- css: [require_tableSettings.defaultClasses.details, css$2],
3552
+ className,
3553
+ css: [require_tableSettings.defaultClasses.details, css],
3614
3554
  children: details
3615
3555
  }) : null;
3616
3556
  });
3617
-
3618
3557
  //#endregion
3619
3558
  //#region src/components/expandControl.tsx
3620
3559
  function ExpandControl({ itemId, hasDeferredChildren }) {
3621
- const IconButton$1 = useTheme((t) => t.components.IconButton);
3622
- const Spinner$1 = useTheme((t) => t.components.Spinner);
3623
- const ChevronRight$1 = useTheme((t) => t.icons.ChevronRight);
3560
+ const IconButton = useTheme((t) => t.components.IconButton);
3561
+ const Spinner = useTheme((t) => t.components.Spinner);
3562
+ const ChevronRight = useTheme((t) => t.icons.ChevronRight);
3624
3563
  const table = useTableContext();
3625
3564
  const isExpanded = table.useState((state) => state.expanded.has(itemId));
3626
3565
  const hasChildren = table.useState((state) => !!state.activeItemsById.get(itemId)?.children.length);
3627
- function toggle$1(e) {
3566
+ function toggle(e) {
3628
3567
  e.preventDefault();
3629
3568
  e.stopPropagation();
3630
3569
  const { props: { expanded: controlledExpanded, expandOnlyOne, onExpandedChange }, expanded, activeItemsById } = table.getState();
@@ -3644,30 +3583,29 @@ function ExpandControl({ itemId, hasDeferredChildren }) {
3644
3583
  state.expanded = newExpanded;
3645
3584
  });
3646
3585
  }
3647
- if (isExpanded && hasDeferredChildren && !hasChildren) return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Spinner$1, { css: { margin: "0 var(--spacing)" } });
3648
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(IconButton$1, {
3649
- onClick: toggle$1,
3650
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("span", {
3586
+ if (isExpanded && hasDeferredChildren && !hasChildren) return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Spinner, { css: { margin: "0 var(--spacing)" } });
3587
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(IconButton, {
3588
+ onClick: toggle,
3589
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", {
3651
3590
  css: {
3652
3591
  display: "inline-flex",
3653
3592
  transition: "all 300ms",
3654
3593
  transform: isExpanded ? "rotate3d(0, 0, 1, 90deg)" : "rotate3d(0, 0, 1, 0deg)"
3655
3594
  },
3656
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ChevronRight$1, {})
3595
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ChevronRight, {})
3657
3596
  })
3658
3597
  });
3659
3598
  }
3660
-
3661
3599
  //#endregion
3662
3600
  //#region src/components/selectComponent.tsx
3663
3601
  function SelectComponent({ itemId }) {
3664
3602
  const table = useTableContext();
3665
- const Checkbox$1 = useTheme((t) => t.components.Checkbox);
3666
- const isSelected$1 = table.useState((state) => {
3603
+ const Checkbox = useTheme((t) => t.components.Checkbox);
3604
+ const isSelected = table.useState((state) => {
3667
3605
  const itemIds = itemId ? [itemId] : Array.from(state.activeItemsById.keys());
3668
- return state.activeItemsById.size > 0 && itemIds.every((itemId$1) => state.selection.has(itemId$1));
3606
+ return state.activeItemsById.size > 0 && itemIds.every((itemId) => state.selection.has(itemId));
3669
3607
  });
3670
- function toggle$1(event) {
3608
+ function toggle(event) {
3671
3609
  const mouseEvent = event.nativeEvent;
3672
3610
  const { activeItems, activeItemsById, lastSelectedId, selection, props: { selectSyncChildren, selection: controlledSelection, onSelectionChange } } = table.getState();
3673
3611
  let range;
@@ -3680,9 +3618,9 @@ function SelectComponent({ itemId }) {
3680
3618
  range = item ? [item] : activeItems;
3681
3619
  }
3682
3620
  const newSelection = new Set(selection);
3683
- for (const item of range) if (isSelected$1) newSelection.delete(item.id);
3621
+ for (const item of range) if (isSelected) newSelection.delete(item.id);
3684
3622
  else newSelection.add(item.id);
3685
- if (selectSyncChildren && isSelected$1) {
3623
+ if (selectSyncChildren && isSelected) {
3686
3624
  for (const ancestor of getAncestors(activeItemsById, ...range)) newSelection.delete(ancestor);
3687
3625
  for (const descendant of getDescendants(...range)) newSelection.delete(descendant);
3688
3626
  }
@@ -3694,41 +3632,40 @@ function SelectComponent({ itemId }) {
3694
3632
  state.lastSelectedId = itemId;
3695
3633
  });
3696
3634
  }
3697
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Checkbox$1, {
3635
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Checkbox, {
3698
3636
  css: {
3699
3637
  justifySelf: "start",
3700
3638
  color: "#c9cfda"
3701
3639
  },
3702
- checked: isSelected$1,
3703
- onChange: toggle$1
3640
+ checked: isSelected,
3641
+ onChange: toggle
3704
3642
  });
3705
3643
  }
3706
-
3707
3644
  //#endregion
3708
3645
  //#region src/components/row.tsx
3709
- const Row = (0, react.memo)(function Row$1({ itemId, rowIndex, rowHeightsKey }) {
3646
+ const Row = (0, react.memo)(function Row({ itemId, rowIndex, rowHeightsKey }) {
3710
3647
  const table = useTableContext();
3711
3648
  const divRef = (0, react.useRef)(null);
3712
3649
  const detailsDivRef = (0, react.useRef)(null);
3713
3650
  const classes = useTheme((t) => t.classes);
3714
3651
  const styles = useTheme((t) => t.styles);
3715
3652
  const item = table.useState((state) => state.activeItemsById.get(itemId));
3716
- const wrapRow = table.useState((state) => state.props.wrapRow) ?? ((props) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", { ...props }));
3653
+ const wrapRow = table.useState((state) => state.props.wrapRow) ?? ((props) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", { ...props }));
3717
3654
  const rowClassName = classes?.row instanceof Function ? classes.row(item?.value, rowIndex) : classes?.row;
3718
3655
  const rowStyles = styles?.row instanceof Function ? styles.row(item?.value, rowIndex) : styles?.row;
3719
3656
  const subgrid = table.useState((state) => state.props.subgrid);
3720
3657
  const { cellClassName, css_, indent, hasChildren, hasDeferredChildren, columnIds, enableSelection, rowAction, hasDetails } = table.useState((state) => {
3721
- const item$1 = state.activeItemsById.get(itemId);
3658
+ const item = state.activeItemsById.get(itemId);
3722
3659
  return {
3723
- cellClassName: cx(...calcClassNames(classes, item$1?.value, rowIndex)),
3724
- css_: calcCss(styles, item$1?.value, rowIndex),
3725
- indent: item$1 ? getAncestors(state.activeItemsById, item$1).size : 0,
3726
- hasChildren: !!item$1?.children.length,
3727
- hasDeferredChildren: item$1 && state.props.hasDeferredChildren?.(item$1.value),
3660
+ cellClassName: cx(...calcClassNames(classes, item?.value, rowIndex)),
3661
+ css_: calcCss(styles, item?.value, rowIndex),
3662
+ indent: item ? getAncestors(state.activeItemsById, item).size : 0,
3663
+ hasChildren: !!item?.children.length,
3664
+ hasDeferredChildren: item && state.props.hasDeferredChildren?.(item.value),
3728
3665
  columnIds: state.visibleColumns.map((column) => column.id),
3729
3666
  enableSelection: state.props.enableSelection,
3730
- rowAction: state.props.rowAction instanceof Function ? item$1 ? state.props.rowAction(item$1.value, rowIndex) : null : state.props.rowAction,
3731
- hasDetails: state.props.rowDetails instanceof Function ? item$1 ? !!state.props.rowDetails(item$1.value, rowIndex) : null : !!state.props.rowDetails
3667
+ rowAction: state.props.rowAction instanceof Function ? item ? state.props.rowAction(item.value, rowIndex) : null : state.props.rowAction,
3668
+ hasDetails: state.props.rowDetails instanceof Function ? item ? !!state.props.rowDetails(item.value, rowIndex) : null : !!state.props.rowDetails
3732
3669
  };
3733
3670
  });
3734
3671
  (0, react.useLayoutEffect)(() => {
@@ -3760,19 +3697,19 @@ const Row = (0, react.memo)(function Row$1({ itemId, rowIndex, rowHeightsKey })
3760
3697
  table.getState().props.debugRender?.("render row", itemId);
3761
3698
  });
3762
3699
  if (!item) return null;
3763
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(__emotion_react.ClassNames, { children: ({ css: css$2, cx: cx$1 }) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(__emotion_react_jsx_runtime.Fragment, { children: wrapRow({
3764
- className: cx$1(css$2([subgrid ? {
3700
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(_emotion_react.ClassNames, { children: ({ css, cx }) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(_emotion_react_jsx_runtime.Fragment, { children: wrapRow({
3701
+ className: cx(css([subgrid ? {
3765
3702
  gridColumn: `1 / -1`,
3766
3703
  display: "grid",
3767
3704
  gridTemplateColumns: "subgrid"
3768
3705
  } : { display: "contents" }, rowStyles]), rowClassName),
3769
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(__emotion_react_jsx_runtime.Fragment, { children: [
3770
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3706
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [
3707
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
3771
3708
  className: cellClassName,
3772
3709
  css: [require_tableSettings.defaultClasses.cellFill, css_],
3773
3710
  ref: divRef
3774
3711
  }),
3775
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
3712
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
3776
3713
  className: cellClassName,
3777
3714
  css: [
3778
3715
  require_tableSettings.defaultClasses.cell,
@@ -3780,27 +3717,27 @@ const Row = (0, react.memo)(function Row$1({ itemId, rowIndex, rowHeightsKey })
3780
3717
  css_
3781
3718
  ],
3782
3719
  children: [
3783
- indent > 0 && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", { css: { width: indent * 20 } }),
3784
- enableSelection && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(SelectComponent, { itemId }),
3785
- (hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ExpandControl, {
3720
+ indent > 0 && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", { css: { width: indent * 20 } }),
3721
+ enableSelection && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(SelectComponent, { itemId }),
3722
+ (hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ExpandControl, {
3786
3723
  itemId,
3787
3724
  hasDeferredChildren
3788
3725
  }),
3789
3726
  rowAction
3790
3727
  ]
3791
3728
  }),
3792
- columnIds.map((columnId) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ColumnContext.Provider, {
3729
+ columnIds.map((columnId) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ColumnContext.Provider, {
3793
3730
  value: columnId,
3794
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Cell, {
3731
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Cell, {
3795
3732
  itemId,
3796
3733
  rowIndex
3797
3734
  })
3798
3735
  }, columnId)),
3799
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3736
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
3800
3737
  className: cellClassName,
3801
3738
  css: [require_tableSettings.defaultClasses.cellFill, css_]
3802
3739
  }),
3803
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Details, {
3740
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Details, {
3804
3741
  ref: detailsDivRef,
3805
3742
  itemId,
3806
3743
  rowIndex
@@ -3808,7 +3745,6 @@ const Row = (0, react.memo)(function Row$1({ itemId, rowIndex, rowHeightsKey })
3808
3745
  ] })
3809
3746
  }, item.value, rowIndex) }) });
3810
3747
  });
3811
-
3812
3748
  //#endregion
3813
3749
  //#region src/components/virtualized.tsx
3814
3750
  const findScrollRoot = (x) => {
@@ -3822,19 +3758,19 @@ const relativeOffset = (x, y) => {
3822
3758
  if (x.offsetParent instanceof HTMLElement) return relativeOffset(x.offsetParent, y) + x.offsetTop;
3823
3759
  return 0;
3824
3760
  };
3825
- function Virtualized({ header, footer, children,...props }) {
3761
+ function Virtualized({ header, footer, children, ...props }) {
3826
3762
  const table = useTableContext();
3827
3763
  const virtual = table.useState((state) => state.props.virtual);
3828
3764
  const probeRef = (0, react.useRef)(null);
3829
3765
  const [, setId] = (0, react.useState)({});
3830
3766
  const { itemIds = [], from = 0, to, before = 0, after = 0 } = table.useState((state) => {
3831
- const itemIds$1 = state.activeItems.map((item) => item.id);
3767
+ const itemIds = state.activeItems.map((item) => item.id);
3832
3768
  const root = probeRef.current && findScrollRoot(probeRef.current);
3833
- if (!state.props.virtual) return { itemIds: itemIds$1 };
3769
+ if (!state.props.virtual) return { itemIds };
3834
3770
  if (!probeRef.current || !root || !document.contains(root)) return {};
3835
3771
  const { rowHeight, initalRowHeight, overscan = 100, overscanTop, overscanBottom } = (state.props.virtual instanceof Object ? state.props.virtual : void 0) ?? {};
3836
3772
  let totalHeight = 0;
3837
- const rowHeights = itemIds$1.map((itemId, index) => {
3773
+ const rowHeights = itemIds.map((itemId, index) => {
3838
3774
  const h = rowHeight ?? state.rowHeights.get(itemId) ?? initalRowHeight ?? (index === 0 ? 100 : totalHeight / index);
3839
3775
  totalHeight += h;
3840
3776
  return h;
@@ -3843,26 +3779,26 @@ function Virtualized({ header, footer, children,...props }) {
3843
3779
  const headerHeight = probeRef.current.offsetTop;
3844
3780
  const topOfTable = root.scrollTop - probeOffset + headerHeight;
3845
3781
  const bottomOfTable = topOfTable + root.clientHeight - headerHeight;
3846
- let from$1 = 0;
3847
- let to$1 = itemIds$1.length;
3848
- let before$1 = 0;
3849
- let after$1 = 0;
3782
+ let from = 0;
3783
+ let to = itemIds.length;
3784
+ let before = 0;
3785
+ let after = 0;
3850
3786
  for (const h of rowHeights) {
3851
- if (before$1 + h > topOfTable - (overscanTop ?? overscan)) break;
3852
- from$1++;
3853
- before$1 += h;
3787
+ if (before + h > topOfTable - (overscanTop ?? overscan)) break;
3788
+ from++;
3789
+ before += h;
3854
3790
  }
3855
3791
  for (const h of rowHeights.reverse()) {
3856
- if (after$1 + h > totalHeight - bottomOfTable - (overscanBottom ?? overscan)) break;
3857
- to$1--;
3858
- after$1 += h;
3792
+ if (after + h > totalHeight - bottomOfTable - (overscanBottom ?? overscan)) break;
3793
+ to--;
3794
+ after += h;
3859
3795
  }
3860
3796
  return {
3861
- itemIds: itemIds$1.slice(from$1, to$1),
3862
- from: from$1,
3863
- to: to$1,
3864
- before: before$1,
3865
- after: after$1
3797
+ itemIds: itemIds.slice(from, to),
3798
+ from,
3799
+ to,
3800
+ before,
3801
+ after
3866
3802
  };
3867
3803
  }, { throttle: 16 });
3868
3804
  const throttleScroll = (typeof virtual === "boolean" ? void 0 : virtual)?.throttleScroll ?? 16;
@@ -3880,11 +3816,11 @@ function Virtualized({ header, footer, children,...props }) {
3880
3816
  (0, react.useLayoutEffect)(() => {
3881
3817
  table.getState().props.debugRender?.(`Virtualized render ${from} to ${to}`);
3882
3818
  });
3883
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
3819
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
3884
3820
  ...props,
3885
3821
  children: [
3886
3822
  header,
3887
- virtual && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3823
+ virtual && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
3888
3824
  style: {
3889
3825
  gridColumn: "1 / -1",
3890
3826
  height: before
@@ -3892,7 +3828,7 @@ function Virtualized({ header, footer, children,...props }) {
3892
3828
  ref: probeRef
3893
3829
  }),
3894
3830
  children(itemIds, from),
3895
- virtual && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", { style: {
3831
+ virtual && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", { style: {
3896
3832
  gridColumn: "1 / -1",
3897
3833
  height: after
3898
3834
  } }),
@@ -3900,14 +3836,19 @@ function Virtualized({ header, footer, children,...props }) {
3900
3836
  ]
3901
3837
  });
3902
3838
  }
3903
-
3904
3839
  //#endregion
3905
3840
  //#region src/components/table.tsx
3906
3841
  const Table = (0, react.forwardRef)(_Table);
3907
3842
  function _Table(props, ref) {
3843
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(TableMemoContextProvider, { children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(TableWithState, {
3844
+ props,
3845
+ tableRef: ref
3846
+ }) });
3847
+ }
3848
+ function TableWithState({ props, tableRef }) {
3908
3849
  const [table, resetState] = useTableState(props);
3909
3850
  const [isHydrated, clearStorage] = useTableStateStorage(table);
3910
- useTableRef(table, ref);
3851
+ useTableRef(table, tableRef);
3911
3852
  async function reset() {
3912
3853
  await clearStorage();
3913
3854
  resetState();
@@ -3915,11 +3856,11 @@ function _Table(props, ref) {
3915
3856
  (0, react.useLayoutEffect)(() => {
3916
3857
  table.getState().props.debugRender?.("render table");
3917
3858
  });
3918
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(TableContext.Provider, {
3859
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(TableContext.Provider, {
3919
3860
  value: table,
3920
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(TableResetContext.Provider, {
3861
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(TableResetContext.Provider, {
3921
3862
  value: reset,
3922
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(TableMemoContextProvider, { children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(TableLoadingState, { isHydrated }) })
3863
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(TableLoadingState, { isHydrated })
3923
3864
  })
3924
3865
  });
3925
3866
  }
@@ -3930,9 +3871,9 @@ function TableLoadingState({ isHydrated }) {
3930
3871
  const handle = setTimeout(() => setShowLoading(true), 500);
3931
3872
  return () => clearTimeout(handle);
3932
3873
  });
3933
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(__emotion_react_jsx_runtime.Fragment, { children: [!isHydrated && showLoading && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", { children: loadingText }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(TableInner, { hidden: !isHydrated })] });
3874
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [!isHydrated && showLoading && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", { children: loadingText }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(TableInner, { hidden: !isHydrated })] });
3934
3875
  }
3935
- const TableInner = (0, react.memo)(function TableInner$1({ hidden }) {
3876
+ const TableInner = (0, react.memo)(function TableInner({ hidden }) {
3936
3877
  const table = useTableContext();
3937
3878
  const fullWidth = table.useState((state) => state.props.fullWidth);
3938
3879
  const visibleColumns = table.useState((state) => state.visibleColumns.map((column) => ({
@@ -3964,7 +3905,7 @@ const TableInner = (0, react.memo)(function TableInner$1({ hidden }) {
3964
3905
  (0, react.useLayoutEffect)(() => {
3965
3906
  table.getState().props.debugRender?.("render table inner");
3966
3907
  });
3967
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Virtualized, {
3908
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Virtualized, {
3968
3909
  className: classes?.table,
3969
3910
  css: [
3970
3911
  cssVariables,
@@ -3978,8 +3919,8 @@ const TableInner = (0, react.memo)(function TableInner$1({ hidden }) {
3978
3919
  ...visibleColumns.map((column) => columnWidths.get(column.id) ?? column.width ?? "max-content"),
3979
3920
  fullWidth === "left" || fullWidth === true ? "auto" : "0"
3980
3921
  ].join(" ") },
3981
- header: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(__emotion_react_jsx_runtime.Fragment, { children: [
3982
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3922
+ header: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [
3923
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
3983
3924
  className: classes?.headerCell,
3984
3925
  css: [
3985
3926
  {
@@ -3992,7 +3933,7 @@ const TableInner = (0, react.memo)(function TableInner$1({ hidden }) {
3992
3933
  styles?.headerCell
3993
3934
  ]
3994
3935
  }),
3995
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
3936
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
3996
3937
  className: classes?.headerCell,
3997
3938
  css: [
3998
3939
  {
@@ -4005,17 +3946,17 @@ const TableInner = (0, react.memo)(function TableInner$1({ hidden }) {
4005
3946
  styles?.headerCell
4006
3947
  ],
4007
3948
  children: [
4008
- enableSelection && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(SelectComponent, {}),
4009
- enableColumnSelection && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ColumnSelection, {}),
4010
- enableExport && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Export, {}),
4011
- (enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(__emotion_react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", { css: { flex: 1 } }), /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ResizeHandleView, {})] })
3949
+ enableSelection && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(SelectComponent, {}),
3950
+ enableColumnSelection && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ColumnSelection, {}),
3951
+ enableExport && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Export, {}),
3952
+ (enableSelection || enableColumnSelection || enableExport) && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", { css: { flex: 1 } }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ResizeHandleView, {})] })
4012
3953
  ]
4013
3954
  }),
4014
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ColumnHeaderContext.Provider, { children: visibleColumns.map((column, index) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ColumnContext.Provider, {
3955
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ColumnHeaderContext.Provider, { children: visibleColumns.map((column, index) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ColumnContext.Provider, {
4015
3956
  value: column.id,
4016
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ColumnHeader, { index })
3957
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ColumnHeader, { index })
4017
3958
  }, column.id)) }),
4018
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3959
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
4019
3960
  className: classes?.headerCell,
4020
3961
  css: [
4021
3962
  {
@@ -4029,8 +3970,8 @@ const TableInner = (0, react.memo)(function TableInner$1({ hidden }) {
4029
3970
  ]
4030
3971
  })
4031
3972
  ] }),
4032
- footer: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(__emotion_react_jsx_runtime.Fragment, { children: [enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ClearFiltersButton, {}), hasFooter && /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)(__emotion_react_jsx_runtime.Fragment, { children: [
4033
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3973
+ footer: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [enableClearFiltersButton && hasActiveFilters && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ClearFiltersButton, {}), hasFooter && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [
3974
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
4034
3975
  className: classes?.footerCell,
4035
3976
  css: [
4036
3977
  { gridColumn: 1 },
@@ -4040,7 +3981,7 @@ const TableInner = (0, react.memo)(function TableInner$1({ hidden }) {
4040
3981
  styles?.footerCell
4041
3982
  ]
4042
3983
  }),
4043
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3984
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
4044
3985
  className: classes?.footerCell,
4045
3986
  css: [
4046
3987
  require_tableSettings.defaultClasses.footerFill,
@@ -4049,11 +3990,11 @@ const TableInner = (0, react.memo)(function TableInner$1({ hidden }) {
4049
3990
  styles?.footerCell
4050
3991
  ]
4051
3992
  }),
4052
- visibleColumns.map((column) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ColumnContext.Provider, {
3993
+ visibleColumns.map((column) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ColumnContext.Provider, {
4053
3994
  value: column.id,
4054
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(ColumnFooter, {})
3995
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ColumnFooter, {})
4055
3996
  }, column.id)),
4056
- /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
3997
+ /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
4057
3998
  className: classes?.footerCell,
4058
3999
  css: [
4059
4000
  require_tableSettings.defaultClasses.footerFill,
@@ -4063,29 +4004,28 @@ const TableInner = (0, react.memo)(function TableInner$1({ hidden }) {
4063
4004
  ]
4064
4005
  })
4065
4006
  ] })] }),
4066
- children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Row, {
4007
+ children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Row, {
4067
4008
  itemId,
4068
4009
  rowIndex: startIndex + index,
4069
4010
  rowHeightsKey
4070
4011
  }, itemId))
4071
4012
  });
4072
4013
  });
4073
-
4074
4014
  //#endregion
4075
4015
  //#region src/components/textFilter.tsx
4076
4016
  function substringCompare(itemValue, filterValue) {
4077
4017
  return itemValue.toLowerCase().includes(filterValue.toLowerCase());
4078
4018
  }
4079
4019
  function prefixCompare(itemValue, filterValue) {
4080
- return itemValue.toLowerCase().includes(filterValue.toLowerCase());
4020
+ return itemValue.toLowerCase().startsWith(filterValue.toLowerCase());
4081
4021
  }
4082
4022
  function exactCompare(itemValue, filterValue) {
4083
4023
  return itemValue.toLowerCase() === filterValue.toLowerCase();
4084
4024
  }
4085
- function TextFilter({ compare = substringCompare, filterBy = asStringOrArray, placeholder,...props }) {
4086
- const IconButton$1 = useTheme((t) => t.components.IconButton);
4087
- const Search$1 = useTheme((t) => t.icons.Search);
4088
- const Clear$1 = useTheme((t) => t.icons.Clear);
4025
+ function TextFilter({ compare = substringCompare, filterBy = asStringOrArray, placeholder, ...props }) {
4026
+ const IconButton = useTheme((t) => t.components.IconButton);
4027
+ const Search = useTheme((t) => t.icons.Search);
4028
+ const Clear = useTheme((t) => t.icons.Clear);
4089
4029
  const { value = "", onChange, close } = useFilter({
4090
4030
  ...props,
4091
4031
  filterBy,
@@ -4093,30 +4033,29 @@ function TextFilter({ compare = substringCompare, filterBy = asStringOrArray, pl
4093
4033
  isActive(filterValue) {
4094
4034
  return !!filterValue;
4095
4035
  },
4096
- test(filterValue, value$1) {
4097
- return compare(value$1, filterValue);
4036
+ test(filterValue, value) {
4037
+ return compare(value, filterValue);
4098
4038
  }
4099
4039
  });
4100
- return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)("div", {
4040
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
4101
4041
  css: {
4102
4042
  padding: `calc(var(--spacing) * 2)`,
4103
4043
  display: "grid"
4104
4044
  },
4105
- children: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(AutoFocusTextField, {
4045
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(AutoFocusTextField, {
4106
4046
  value,
4107
4047
  onChange: (event) => onChange(event.target.value),
4108
4048
  onKeyUp: (event) => {
4109
4049
  if (event.key === "Enter") close();
4110
4050
  },
4111
- endIcon: /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(IconButton$1, {
4051
+ endIcon: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(IconButton, {
4112
4052
  onClick: () => onChange(""),
4113
- children: !value ? /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Search$1, {}) : /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsx)(Clear$1, {})
4053
+ children: !value ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Search, {}) : /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Clear, {})
4114
4054
  }),
4115
4055
  placeholder
4116
4056
  })
4117
4057
  });
4118
4058
  }
4119
-
4120
4059
  //#endregion
4121
4060
  //#region src/misc/textMatch.ts
4122
4061
  const textMatch = (text, query) => {
@@ -4135,7 +4074,6 @@ const termMatch = (text, query) => {
4135
4074
  }
4136
4075
  return true;
4137
4076
  };
4138
-
4139
4077
  //#endregion
4140
4078
  exports.AutoFocusTextField = AutoFocusTextField;
4141
4079
  exports.ColumnContext = ColumnContext;
@@ -4158,11 +4096,11 @@ exports.dateIntersect = dateIntersect;
4158
4096
  exports.endOfDay = endOfDay;
4159
4097
  exports.exactCompare = exactCompare;
4160
4098
  exports.getCalendarWeek = getCalendarWeek;
4161
- Object.defineProperty(exports, 'helpers', {
4162
- enumerable: true,
4163
- get: function () {
4164
- return helpers_exports;
4165
- }
4099
+ Object.defineProperty(exports, "helpers", {
4100
+ enumerable: true,
4101
+ get: function() {
4102
+ return helpers_exports;
4103
+ }
4166
4104
  });
4167
4105
  exports.lastDays = lastDays;
4168
4106
  exports.mergeThemes = require_tableSettings.mergeThemes;
@@ -4179,4 +4117,5 @@ exports.useColumnContext = useColumnContext;
4179
4117
  exports.useFilter = useFilter;
4180
4118
  exports.useTableContext = useTableContext;
4181
4119
  exports.useTheme = useTheme;
4120
+
4182
4121
  //# sourceMappingURL=index.cjs.map