mig-schema-table 5.0.8 → 5.0.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.
@@ -2,7 +2,7 @@ import { default as default_2 } from 'react';
2
2
  import { default as default_3 } from 'react-window-infinite-loader';
3
3
  import { Dispatch } from 'react';
4
4
  import { InputHTMLAttributes } from 'react';
5
- import { JSX as JSX_2 } from 'react/jsx-runtime';
5
+ import { JSX } from 'react/jsx-runtime';
6
6
  import { oas31 } from 'openapi3-ts';
7
7
  import { SetStateAction } from 'react';
8
8
  import { VariableSizeGrid } from 'react-window';
@@ -141,16 +141,16 @@ declare interface IThProps {
141
141
 
142
142
  export declare const MINIMUM_COLUMN_WIDTH = 25;
143
143
 
144
- export declare const Refresher: default_2.MemoExoticComponent<({ refresh, period }: IRefresherProps) => JSX_2.Element>;
144
+ export declare const Refresher: default_2.MemoExoticComponent<({ refresh, period }: IRefresherProps) => JSX.Element>;
145
145
 
146
146
  export declare const RESIZER_WIDTH = 3;
147
147
 
148
148
  export declare const SchemaTable: typeof SchemaTable_2;
149
149
 
150
- declare const SchemaTable_2: <T>({ CustomElement, CustomSearchInput, Heading, autoRender, checkedIndexes, config, customElementProps, data, defaultColumnFilters, defaultSortAsc, defaultSortColumn, disabledCheckedIndexes, displayTimezone, enableAutoFocus, enableRowCounter, getRowClassName, getRowSelected, getSearchQueryFilterResult, infiniteLoaderRef, isColumnFilterable, isExportable, isResizable, isSearchable, isSortable, itemCount, loadMoreItems, maxHeight, onRowClick, onRowDoubleClick, onSearchEnter, onTableDataStateChange, rowHeight, schema, searchPlaceholder, setCheckedIndexes, settingsStorageKey, style, translate, useFilterStateHash, variableSizeGridRef, width, }: ISchemaTableProps<T>) => JSX_2.Element;
150
+ declare const SchemaTable_2: <T>({ CustomElement, CustomSearchInput, Heading, autoRender, checkedIndexes, config, customElementProps, data, defaultColumnFilters, defaultSortAsc, defaultSortColumn, disabledCheckedIndexes, displayTimezone, enableAutoFocus, enableRowCounter, getRowClassName, getRowSelected, getSearchQueryFilterResult, infiniteLoaderRef, isColumnFilterable, isExportable, isResizable, isSearchable, isSortable, itemCount, loadMoreItems, maxHeight, onRowClick, onRowDoubleClick, onSearchEnter, onTableDataStateChange, rowHeight, schema, searchPlaceholder, setCheckedIndexes, settingsStorageKey, style, translate, useFilterStateHash, variableSizeGridRef, width, }: ISchemaTableProps<T>) => JSX.Element;
151
151
 
152
152
  export declare const Th: typeof Th_2;
153
153
 
154
- declare const Th_2: <T>({ index, style }: IThProps) => JSX_2.Element;
154
+ declare const Th_2: <T>({ index, style }: IThProps) => JSX.Element;
155
155
 
156
156
  export { }
@@ -1,11 +1,11 @@
1
- import { jsx as t, jsxs as W, Fragment as wt } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as W, Fragment as Wt } from "react/jsx-runtime";
2
2
  import * as Ft from "react";
3
3
  import e from "react";
4
4
  import { createPortal as jt } from "react-dom";
5
5
  import { VariableSizeGrid as lt, VariableSizeList as Bt } from "react-window";
6
6
  import { format as Qt, endOfDay as zt, differenceInSeconds as Ut } from "date-fns";
7
7
  import { nl as Jt } from "date-fns/locale";
8
- import { unCamel as Vt, emptyFn as ve, timeZone as Te, localeFormatInTimeZone as yt, parseLocationHash as ct, serializeLocationHash as ze } from "mig-data-tools";
8
+ import { unCamel as Vt, emptyFn as ve, timeZone as Te, localeFormatInTimeZone as wt, parseLocationHash as ct, serializeLocationHash as ze } from "mig-data-tools";
9
9
  import { range as Pt, debounce as Zt, difference as qt, isEqual as et, isFinite as Gt, sum as Xt } from "lodash";
10
10
  import ut from "react-datepicker";
11
11
  import { nl as dt } from "date-fns/locale/nl";
@@ -13,9 +13,9 @@ import { TZDate as Ue } from "@date-fns/tz";
13
13
  import { useFloating as mt, flip as ht } from "@floating-ui/react-dom";
14
14
  import Ht from "react-window-infinite-loader";
15
15
  import { saveAs as Yt } from "file-saver";
16
- const tt = (n, o) => (
16
+ const tt = (t, o) => (
17
17
  // replace jan. with jan
18
- Qt(n, o, { locale: Jt }).replace(".", "")
18
+ Qt(t, o, { locale: Jt }).replace(".", "")
19
19
  ), Kt = {
20
20
  "Europe/Amsterdam": "AMS",
21
21
  "Europe/Berlin": "AMS",
@@ -23,14 +23,14 @@ const tt = (n, o) => (
23
23
  "Asia/Bangkok": "JKT",
24
24
  showingFilteredCountOfTotalCount: "Showing {0} of {1}"
25
25
  };
26
- function ft(n, ...o) {
27
- let u = Kt[n] || Vt(n);
26
+ function ft(t, ...o) {
27
+ let u = Kt[t] || Vt(t);
28
28
  return o.forEach((p, f) => {
29
29
  u = u.replace(`{${f}}`, `${p}`);
30
30
  }), u;
31
31
  }
32
- const ee = "SELECT_ALL_COLUMN_NAME", bt = 40, vt = "dd MMM yyyy", Je = "dd MMM yyyy HH:mm", kt = 25, gt = 50, en = 3;
33
- var be = /* @__PURE__ */ ((n) => (n.GT = "GT", n.LT = "LT", n.EQ = "EQ", n))(be || {}), $e = /* @__PURE__ */ ((n) => (n.UNAVAILABLE = "UNAVAILABLE", n.AVAILABLE = "AVAILABLE", n.ACTIVE = "ACTIVE", n))($e || {});
32
+ const ee = "SELECT_ALL_COLUMN_NAME", bt = 40, yt = "dd MMM yyyy", Je = "dd MMM yyyy HH:mm", vt = 25, gt = 50, en = 3;
33
+ var be = /* @__PURE__ */ ((t) => (t.GT = "GT", t.LT = "LT", t.EQ = "EQ", t))(be || {}), $e = /* @__PURE__ */ ((t) => (t.UNAVAILABLE = "UNAVAILABLE", t.AVAILABLE = "AVAILABLE", t.ACTIVE = "ACTIVE", t))($e || {});
34
34
  const Me = Ft.createContext({
35
35
  checkedIndexes: [],
36
36
  columnNames: [],
@@ -56,7 +56,7 @@ const Me = Ft.createContext({
56
56
  sortAsc: !1
57
57
  },
58
58
  translate: ve
59
- }), tn = { type: "boolean" }, nn = ({ columnIndex: n, rowIndex: o, style: u }) => {
59
+ }), tn = { type: "boolean" }, nn = ({ columnIndex: t, rowIndex: o, style: u }) => {
60
60
  const {
61
61
  checkedIndexes: p,
62
62
  columnNames: f,
@@ -75,7 +75,7 @@ const Me = Ft.createContext({
75
75
  sortedRenderData: D,
76
76
  sourceData: s,
77
77
  translate: m
78
- } = e.useContext(Me), b = f[n], w = b === ee ? tn : S[b], U = l ? l[b] : void 0, te = e.useCallback(
78
+ } = e.useContext(Me), b = f[t], w = b === ee ? tn : S[b], U = l ? l[b] : void 0, te = e.useCallback(
79
79
  (v) => {
80
80
  Z && Z((A) => A && A.includes(v) ? A.filter((E) => E !== v) : A ? [...A, v] : [v]);
81
81
  },
@@ -108,7 +108,7 @@ const Me = Ft.createContext({
108
108
  let v = b === ee ? void 0 : L[b];
109
109
  if (w?.format && w.format === "date-time" && se !== !1) {
110
110
  const k = s ? s[L._index] : void 0, E = k ? k[b] : void 0, ce = E ? new Date(E) : void 0;
111
- ce && re && (v = `${yt(
111
+ ce && re && (v = `${wt(
112
112
  ce,
113
113
  re,
114
114
  Je
@@ -134,7 +134,7 @@ const Me = Ft.createContext({
134
134
  }
135
135
  return {
136
136
  "data-row-index": o,
137
- "data-column-index": n,
137
+ "data-column-index": t,
138
138
  style: u,
139
139
  className: A.join(" "),
140
140
  title: v,
@@ -151,7 +151,7 @@ const Me = Ft.createContext({
151
151
  s,
152
152
  I,
153
153
  R,
154
- n,
154
+ t,
155
155
  u,
156
156
  ne,
157
157
  C,
@@ -193,9 +193,9 @@ const Me = Ft.createContext({
193
193
  if (!L || !B)
194
194
  return null;
195
195
  if (!T || s && !s[L._index])
196
- return /* @__PURE__ */ t("div", { ...B, children: "loading" });
196
+ return /* @__PURE__ */ n("div", { ...B, children: "loading" });
197
197
  if (b === ee)
198
- return /* @__PURE__ */ t("div", { ...B, onMouseDown: V, children: /* @__PURE__ */ t("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ t(
198
+ return /* @__PURE__ */ n("div", { ...B, onMouseDown: V, children: /* @__PURE__ */ n("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ n(
199
199
  "input",
200
200
  {
201
201
  ref: _e,
@@ -206,7 +206,7 @@ const Me = Ft.createContext({
206
206
  }
207
207
  ) }) });
208
208
  if (G && s)
209
- return /* @__PURE__ */ t("div", { ...B, children: /* @__PURE__ */ t(
209
+ return /* @__PURE__ */ n("div", { ...B, children: /* @__PURE__ */ n(
210
210
  G,
211
211
  {
212
212
  dataIndex: L._index,
@@ -216,7 +216,7 @@ const Me = Ft.createContext({
216
216
  }
217
217
  ) });
218
218
  const q = L[b];
219
- return w?.format === "url" && q ? /* @__PURE__ */ t(
219
+ return w?.format === "url" && q ? /* @__PURE__ */ n(
220
220
  "a",
221
221
  {
222
222
  href: q,
@@ -225,33 +225,33 @@ const Me = Ft.createContext({
225
225
  ...B,
226
226
  children: q
227
227
  }
228
- ) : /* @__PURE__ */ t("div", { ...B, children: q });
228
+ ) : /* @__PURE__ */ n("div", { ...B, children: q });
229
229
  }, pt = e.memo(nn);
230
230
  function rn() {
231
- const { checkedIndexes: n, disabledCheckedIndexes: o, sortedRenderData: u } = e.useContext(Me);
231
+ const { checkedIndexes: t, disabledCheckedIndexes: o, sortedRenderData: u } = e.useContext(Me);
232
232
  return e.useMemo(() => {
233
233
  const p = [...u || []].filter(
234
- (f) => (n ? n.includes(f._index) : !0) || (o ? !o.includes(f._index) : !0)
234
+ (f) => (t ? t.includes(f._index) : !0) || (o ? !o.includes(f._index) : !0)
235
235
  );
236
- return n?.length !== 0 && p.length === n?.length;
237
- }, [n, o, u]);
236
+ return t?.length !== 0 && p.length === t?.length;
237
+ }, [t, o, u]);
238
238
  }
239
- function xt(n, o, u) {
240
- return !!(n && u?.isSortable !== !1 && (o || u?.renderData || u?.sort));
239
+ function kt(t, o, u) {
240
+ return !!(t && u?.isSortable !== !1 && (o || u?.renderData || u?.sort));
241
241
  }
242
- function Dt() {
243
- const { setCustomColumnWidths: n, settingsStorageKey: o } = e.useContext(Me);
242
+ function xt() {
243
+ const { setCustomColumnWidths: t, settingsStorageKey: o } = e.useContext(Me);
244
244
  return e.useCallback(
245
245
  (u) => {
246
246
  o && localStorage.setItem(
247
247
  `${o}.columnWidths`,
248
248
  JSON.stringify(Array.from(u))
249
- ), n(u);
249
+ ), t(u);
250
250
  },
251
- [n, o]
251
+ [t, o]
252
252
  );
253
253
  }
254
- const on = ({ index: n, style: o }) => {
254
+ const on = ({ index: t, style: o }) => {
255
255
  const {
256
256
  checkedIndexes: u,
257
257
  columnNames: p,
@@ -273,10 +273,10 @@ const on = ({ index: n, style: o }) => {
273
273
  sortedRenderData: m,
274
274
  translate: b,
275
275
  displayTimezone: w
276
- } = e.useContext(Me), [U, te] = e.useState(!1), le = n === _, ne = Dt(), C = p[n], L = C === ee ? { type: "boolean" } : $[C], se = s.sortColumn === C ? s.sortAsc : void 0, G = l ? l[C] : void 0;
276
+ } = e.useContext(Me), [U, te] = e.useState(!1), le = t === _, ne = xt(), C = p[t], L = C === ee ? { type: "boolean" } : $[C], se = s.sortColumn === C ? s.sortAsc : void 0, G = l ? l[C] : void 0;
277
277
  let re = R && (L || G?.FilterMenu) && G?.isFilterable !== !1 ? $e.AVAILABLE : $e.UNAVAILABLE;
278
278
  s.columnFilterMap && s.columnFilterMap[C] !== void 0 && (re = $e.ACTIVE);
279
- const B = xt(
279
+ const B = kt(
280
280
  I,
281
281
  L,
282
282
  G
@@ -351,9 +351,9 @@ const on = ({ index: n, style: o }) => {
351
351
  oe && (te(!1), S(-1));
352
352
  }, [oe, S]), Ve = e.useCallback(
353
353
  (j) => {
354
- oe && (j.preventDefault(), S(n));
354
+ oe && (j.preventDefault(), S(t));
355
355
  },
356
- [n, oe, S]
356
+ [t, oe, S]
357
357
  ), Pe = e.useCallback(
358
358
  (j) => {
359
359
  if (S(-1), !oe || !C)
@@ -373,7 +373,7 @@ const on = ({ index: n, style: o }) => {
373
373
  O
374
374
  ]);
375
375
  if (C === ee)
376
- return /* @__PURE__ */ t("div", { style: o, className: V.join(" "), children: /* @__PURE__ */ t(
376
+ return /* @__PURE__ */ n("div", { style: o, className: V.join(" "), children: /* @__PURE__ */ n(
377
377
  "div",
378
378
  {
379
379
  style: {
@@ -381,7 +381,7 @@ const on = ({ index: n, style: o }) => {
381
381
  textAlign: "center"
382
382
  },
383
383
  title: `${u?.length || 0} selected`,
384
- children: /* @__PURE__ */ t(
384
+ children: /* @__PURE__ */ n(
385
385
  "input",
386
386
  {
387
387
  type: "checkbox",
@@ -429,17 +429,17 @@ const on = ({ index: n, style: o }) => {
429
429
  style: { lineHeight: "44px" },
430
430
  onClick: E,
431
431
  children: [
432
- /* @__PURE__ */ t("span", { className: "mig-schema-table__th__label-body-text", children: Ce }),
433
- se === void 0 ? null : /* @__PURE__ */ t("span", { className: "mig-schema-table__th__sort-icon", children: se ? "↓" : "↑" })
432
+ /* @__PURE__ */ n("span", { className: "mig-schema-table__th__label-body-text", children: Ce }),
433
+ se === void 0 ? null : /* @__PURE__ */ n("span", { className: "mig-schema-table__th__sort-icon", children: se ? "↓" : "↑" })
434
434
  ]
435
435
  }
436
436
  ),
437
- B || re !== $e.UNAVAILABLE ? /* @__PURE__ */ t(
437
+ B || re !== $e.UNAVAILABLE ? /* @__PURE__ */ n(
438
438
  "button",
439
439
  {
440
440
  className: "mig-schema-table__th__trigger-el",
441
441
  onClick: me,
442
- children: /* @__PURE__ */ t(
442
+ children: /* @__PURE__ */ n(
443
443
  "svg",
444
444
  {
445
445
  xmlns: "http://www.w3.org/2000/svg",
@@ -451,7 +451,7 @@ const on = ({ index: n, style: o }) => {
451
451
  strokeWidth: "2",
452
452
  strokeLinecap: "round",
453
453
  strokeLinejoin: "round",
454
- children: /* @__PURE__ */ t("polyline", { points: "6 9 12 15 18 9" })
454
+ children: /* @__PURE__ */ n("polyline", { points: "6 9 12 15 18 9" })
455
455
  }
456
456
  )
457
457
  }
@@ -465,7 +465,7 @@ const on = ({ index: n, style: o }) => {
465
465
  [be.EQ]: "="
466
466
  }, ln = e.memo(
467
467
  ({
468
- columnFilterValue: n,
468
+ columnFilterValue: t,
469
469
  onChange: o,
470
470
  onInputKeyDown: u,
471
471
  propIsRequired: p,
@@ -473,7 +473,7 @@ const on = ({ index: n, style: o }) => {
473
473
  propSchema: l,
474
474
  translate: O
475
475
  }) => {
476
- const { displayTimezone: _ } = e.useContext(Me), { type: R, format: I, minimum: T, maximum: $ } = l || {}, M = n, y = I === "date-time";
476
+ const { displayTimezone: _ } = e.useContext(Me), { type: R, format: I, minimum: T, maximum: $ } = l || {}, M = t, y = I === "date-time";
477
477
  let S, Z, Y, D;
478
478
  switch (R) {
479
479
  case "number":
@@ -492,7 +492,7 @@ const on = ({ index: n, style: o }) => {
492
492
  }, /* @__PURE__ */ W("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: [
493
493
  p ? null : /* @__PURE__ */ W("li", { style: { padding: 8 }, children: [
494
494
  /* @__PURE__ */ W("label", { className: "d-flex", children: [
495
- /* @__PURE__ */ t(
495
+ /* @__PURE__ */ n(
496
496
  "input",
497
497
  {
498
498
  type: "checkbox",
@@ -509,13 +509,13 @@ const on = ({ index: n, style: o }) => {
509
509
  ),
510
510
  "Hide empty values"
511
511
  ] }),
512
- /* @__PURE__ */ t("hr", {})
512
+ /* @__PURE__ */ n("hr", {})
513
513
  ] }),
514
514
  Object.keys(be).map((s) => {
515
515
  const m = S[s];
516
516
  return /* @__PURE__ */ W("li", { children: [
517
- /* @__PURE__ */ t("label", { style: { width: 40, paddingLeft: 16 }, children: an[s] }),
518
- /* @__PURE__ */ t(
517
+ /* @__PURE__ */ n("label", { style: { width: 40, paddingLeft: 16 }, children: an[s] }),
518
+ /* @__PURE__ */ n(
519
519
  "input",
520
520
  {
521
521
  className: "form-control",
@@ -546,7 +546,7 @@ const on = ({ index: n, style: o }) => {
546
546
  })
547
547
  ] });
548
548
  case "boolean":
549
- return Y = ["✓", "✕"], p || Y.push("?"), D = M ? "✓" : "✕", M === null && (D = "?"), M === void 0 && (D = ""), /* @__PURE__ */ t("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: /* @__PURE__ */ t("li", { children: /* @__PURE__ */ W(
549
+ return Y = ["✓", "✕"], p || Y.push("?"), D = M ? "✓" : "✕", M === null && (D = "?"), M === void 0 && (D = ""), /* @__PURE__ */ n("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: /* @__PURE__ */ n("li", { children: /* @__PURE__ */ W(
550
550
  "select",
551
551
  {
552
552
  autoFocus: !0,
@@ -569,8 +569,8 @@ const on = ({ index: n, style: o }) => {
569
569
  }
570
570
  },
571
571
  children: [
572
- /* @__PURE__ */ t("option", { value: "", children: "All" }, "all"),
573
- Y.map((s) => /* @__PURE__ */ t(
572
+ /* @__PURE__ */ n("option", { value: "", children: "All" }, "all"),
573
+ Y.map((s) => /* @__PURE__ */ n(
574
574
  "option",
575
575
  {
576
576
  value: s,
@@ -584,7 +584,7 @@ const on = ({ index: n, style: o }) => {
584
584
  // @ts-expect-error falls through
585
585
  case "string":
586
586
  if (l?.enum)
587
- return /* @__PURE__ */ t("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: /* @__PURE__ */ t("li", { children: /* @__PURE__ */ W(
587
+ return /* @__PURE__ */ n("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: /* @__PURE__ */ n("li", { children: /* @__PURE__ */ W(
588
588
  "select",
589
589
  {
590
590
  autoFocus: !0,
@@ -595,8 +595,8 @@ const on = ({ index: n, style: o }) => {
595
595
  o(s.currentTarget.value || void 0, !0);
596
596
  },
597
597
  children: [
598
- /* @__PURE__ */ t("option", { value: "", children: "All" }, "all"),
599
- l.enum.map((s) => /* @__PURE__ */ t(
598
+ /* @__PURE__ */ n("option", { value: "", children: "All" }, "all"),
599
+ l.enum.map((s) => /* @__PURE__ */ n(
600
600
  "option",
601
601
  {
602
602
  value: s,
@@ -608,7 +608,7 @@ const on = ({ index: n, style: o }) => {
608
608
  }
609
609
  ) }) });
610
610
  if (y || I === "date") {
611
- const s = y ? Je : vt, m = n || {
611
+ const s = y ? Je : yt, m = t || {
612
612
  from: void 0,
613
613
  to: void 0,
614
614
  filterEmpty: void 0
@@ -616,7 +616,7 @@ const on = ({ index: n, style: o }) => {
616
616
  return /* @__PURE__ */ W("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: [
617
617
  p ? null : /* @__PURE__ */ W("li", { style: { padding: 8 }, children: [
618
618
  /* @__PURE__ */ W("label", { className: "d-flex", children: [
619
- /* @__PURE__ */ t(
619
+ /* @__PURE__ */ n(
620
620
  "input",
621
621
  {
622
622
  type: "checkbox",
@@ -632,11 +632,11 @@ const on = ({ index: n, style: o }) => {
632
632
  ),
633
633
  "Hide empty values"
634
634
  ] }),
635
- /* @__PURE__ */ t("hr", {})
635
+ /* @__PURE__ */ n("hr", {})
636
636
  ] }),
637
637
  /* @__PURE__ */ W("li", { style: { padding: 8 }, children: [
638
- /* @__PURE__ */ t("label", { style: { width: 120, paddingLeft: 4 }, children: "After" }),
639
- /* @__PURE__ */ t(
638
+ /* @__PURE__ */ n("label", { style: { width: 120, paddingLeft: 4 }, children: "After" }),
639
+ /* @__PURE__ */ n(
640
640
  ut,
641
641
  {
642
642
  dateFormat: s,
@@ -655,7 +655,7 @@ const on = ({ index: n, style: o }) => {
655
655
  const w = b ? Ue.tz(_ || Te, b) : void 0;
656
656
  o(
657
657
  {
658
- ...n,
658
+ ...t,
659
659
  from: w
660
660
  },
661
661
  !0
@@ -674,8 +674,8 @@ const on = ({ index: n, style: o }) => {
674
674
  )
675
675
  ] }),
676
676
  /* @__PURE__ */ W("li", { style: { padding: 8 }, children: [
677
- /* @__PURE__ */ t("label", { style: { width: 120, paddingLeft: 4 }, children: "Before" }),
678
- /* @__PURE__ */ t(
677
+ /* @__PURE__ */ n("label", { style: { width: 120, paddingLeft: 4 }, children: "Before" }),
678
+ /* @__PURE__ */ n(
679
679
  ut,
680
680
  {
681
681
  id: "filter-date",
@@ -696,7 +696,7 @@ const on = ({ index: n, style: o }) => {
696
696
  const w = b ? y ? Ue.tz(_ || Te, b) : zt(b) : void 0;
697
697
  m.from && w && w < m.from || o(
698
698
  {
699
- ...n,
699
+ ...t,
700
700
  to: w
701
701
  },
702
702
  !0
@@ -717,7 +717,7 @@ const on = ({ index: n, style: o }) => {
717
717
  }
718
718
  // falls through
719
719
  default:
720
- return /* @__PURE__ */ t("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
720
+ return /* @__PURE__ */ n("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
721
721
  "input",
722
722
  {
723
723
  autoFocus: !0,
@@ -739,7 +739,7 @@ const on = ({ index: n, style: o }) => {
739
739
  }
740
740
  }
741
741
  ), cn = ({
742
- isSortable: n,
742
+ isSortable: t,
743
743
  isFilterable: o,
744
744
  onChange: u,
745
745
  onClose: p,
@@ -796,21 +796,21 @@ const on = ({ index: n, style: o }) => {
796
796
  ), s = e.useCallback(() => {
797
797
  u(void 0, !0);
798
798
  }, [u]);
799
- return !n && !o ? null : /* @__PURE__ */ W(wt, { children: [
800
- /* @__PURE__ */ t(
799
+ return !t && !o ? null : /* @__PURE__ */ W(Wt, { children: [
800
+ /* @__PURE__ */ n(
801
801
  "div",
802
802
  {
803
803
  className: "mig-schema-table mig-schema-table__th-menu",
804
804
  ref: y.refs.setFloating,
805
805
  style: y.floatingStyles,
806
806
  children: /* @__PURE__ */ W("ol", { className: "mig-schema-table-menu", children: [
807
- n ? /* @__PURE__ */ W("li", { onClick: Y, style: { padding: 8 }, children: [
808
- /* @__PURE__ */ t("span", { className: "mig-schema-table__th-menu__icon", children: "↓" }),
807
+ t ? /* @__PURE__ */ W("li", { onClick: Y, style: { padding: 8 }, children: [
808
+ /* @__PURE__ */ n("span", { className: "mig-schema-table__th-menu__icon", children: "↓" }),
809
809
  " ",
810
810
  $("sortAscending")
811
811
  ] }) : null,
812
- n ? /* @__PURE__ */ W("li", { onClick: D, style: { padding: 8 }, children: [
813
- /* @__PURE__ */ t("span", { className: "mig-schema-table__th-menu__icon", children: "↑" }),
812
+ t ? /* @__PURE__ */ W("li", { onClick: D, style: { padding: 8 }, children: [
813
+ /* @__PURE__ */ n("span", { className: "mig-schema-table__th-menu__icon", children: "↑" }),
814
814
  " ",
815
815
  $("sortDescending")
816
816
  ] }) : null,
@@ -822,7 +822,7 @@ const on = ({ index: n, style: o }) => {
822
822
  S.refs.setReference(m.currentTarget);
823
823
  },
824
824
  children: [
825
- /* @__PURE__ */ t("span", { className: "mig-schema-table__th-menu__icon", children: /* @__PURE__ */ t(
825
+ /* @__PURE__ */ n("span", { className: "mig-schema-table__th-menu__icon", children: /* @__PURE__ */ n(
826
826
  "input",
827
827
  {
828
828
  type: "checkbox",
@@ -832,21 +832,21 @@ const on = ({ index: n, style: o }) => {
832
832
  onChange: s
833
833
  }
834
834
  ) }),
835
- /* @__PURE__ */ t("label", { htmlFor: "mig-schema-table__th-menu__filters", children: $("filters") }),
836
- /* @__PURE__ */ t("div", { className: "mig-schema-table__th-menu__sub-menu-indicator" })
835
+ /* @__PURE__ */ n("label", { htmlFor: "mig-schema-table__th-menu__filters", children: $("filters") }),
836
+ /* @__PURE__ */ n("div", { className: "mig-schema-table__th-menu__sub-menu-indicator" })
837
837
  ]
838
838
  }
839
839
  ) : null
840
840
  ] })
841
841
  }
842
842
  ),
843
- S.elements.reference ? /* @__PURE__ */ t(
843
+ S.elements.reference ? /* @__PURE__ */ n(
844
844
  "div",
845
845
  {
846
846
  className: "mig-schema-table mig-schema-table__th-menu__sub-menu",
847
847
  ref: S.refs.setFloating,
848
848
  style: S.floatingStyles,
849
- children: /* @__PURE__ */ t(
849
+ children: /* @__PURE__ */ n(
850
850
  Z,
851
851
  {
852
852
  columnFilterValue: M,
@@ -862,19 +862,19 @@ const on = ({ index: n, style: o }) => {
862
862
  ) : null
863
863
  ] });
864
864
  }, un = e.memo(cn), dn = ({
865
- columnWidths: n,
865
+ columnWidths: t,
866
866
  resizeColumnIndex: o,
867
867
  setResizeColumnIndex: u,
868
868
  tableBodyHeight: p
869
869
  }) => {
870
- const [f, l] = e.useState(0), O = Dt(), _ = e.useCallback(
870
+ const [f, l] = e.useState(0), O = xt(), _ = e.useCallback(
871
871
  ($) => {
872
- const M = n.map(
873
- (y, S) => S === o ? Math.max(y + $, kt) : y
872
+ const M = t.map(
873
+ (y, S) => S === o ? Math.max(y + $, vt) : y
874
874
  );
875
875
  O(M);
876
876
  },
877
- [n, o, O]
877
+ [t, o, O]
878
878
  );
879
879
  let R = 0;
880
880
  const I = e.useCallback(
@@ -888,10 +888,10 @@ const on = ({ index: n, style: o }) => {
888
888
  },
889
889
  [f, _, u]
890
890
  );
891
- return /* @__PURE__ */ t("div", { children: [...n].map(($, M) => {
891
+ return /* @__PURE__ */ n("div", { children: [...t].map(($, M) => {
892
892
  R += $;
893
893
  const y = ["mig-schema-table__column_resizer"];
894
- return M === o && y.push("mig-schema-table__column_resizer--dragged"), /* @__PURE__ */ t(
894
+ return M === o && y.push("mig-schema-table__column_resizer--dragged"), /* @__PURE__ */ n(
895
895
  "div",
896
896
  {
897
897
  style: { left: R - en, bottom: p },
@@ -904,13 +904,13 @@ const on = ({ index: n, style: o }) => {
904
904
  M
905
905
  );
906
906
  }) });
907
- }, _t = (n) => {
907
+ }, _t = (t) => {
908
908
  const [o, u] = e.useState({ width: 0, height: 0 }), p = e.useMemo(
909
909
  () => Zt(u, 100),
910
910
  []
911
911
  );
912
912
  return e.useEffect(() => {
913
- if (!n)
913
+ if (!t)
914
914
  return;
915
915
  const f = new ResizeObserver((l) => {
916
916
  for (const O of l) {
@@ -920,30 +920,30 @@ const on = ({ index: n, style: o }) => {
920
920
  );
921
921
  }
922
922
  });
923
- return f.observe(n), () => {
923
+ return f.observe(t), () => {
924
924
  f.disconnect();
925
925
  };
926
- }, [p, n]), o;
927
- }, mn = () => new Promise((n, o) => {
926
+ }, [p, t]), o;
927
+ }, mn = () => new Promise((t, o) => {
928
928
  if (window.ExcelJS) {
929
- n(window.ExcelJS);
929
+ t(window.ExcelJS);
930
930
  return;
931
931
  }
932
932
  const u = document.createElement("script");
933
933
  u.src = "https://cdnjs.cloudflare.com/ajax/libs/exceljs/4.4.0/exceljs.bare.min.js", u.onload = () => {
934
- n(window.ExcelJS);
934
+ t(window.ExcelJS);
935
935
  }, u.onerror = () => {
936
936
  o(new Error("Failed to load ExcelJS library"));
937
937
  }, document.head.appendChild(u);
938
- }), hn = async (n) => {
938
+ }), hn = async (t) => {
939
939
  const { Workbook: o } = await mn(), u = new o(), p = u.addWorksheet("Data");
940
- n.length && (p.addRow(
941
- qt(Object.keys(n[0]), [
940
+ t.length && (p.addRow(
941
+ qt(Object.keys(t[0]), [
942
942
  "_index",
943
943
  "SELECT_ALL_COLUMN_NAME"
944
944
  ])
945
945
  ), p.getRow(1).font = { bold: !0 }, p.addRows(
946
- n.map((f) => {
946
+ t.map((f) => {
947
947
  const { _index: l, SELECT_ALL_COLUMN_NAME: O, ..._ } = f;
948
948
  return Object.values(_);
949
949
  })
@@ -959,17 +959,17 @@ const on = ({ index: n, style: o }) => {
959
959
  style: "currency",
960
960
  currency: "EUR"
961
961
  });
962
- function gn(n, o) {
962
+ function gn(t, o) {
963
963
  const { TdBody: u, sortByValue: p } = o || {};
964
964
  if (p !== void 0)
965
965
  return p;
966
- if (!n)
966
+ if (!t)
967
967
  return !1;
968
- const { format: f, type: l } = n;
968
+ const { format: f, type: l } = t;
969
969
  return f?.startsWith("date") || l === "boolean" || l === "integer" || l === "number" || !!u;
970
970
  }
971
971
  const pn = ({
972
- CustomElement: n,
972
+ CustomElement: t,
973
973
  CustomSearchInput: o,
974
974
  Heading: u = Bt,
975
975
  autoRender: p,
@@ -1018,7 +1018,7 @@ const pn = ({
1018
1018
  columnFilterMap: R || {},
1019
1019
  sortColumn: T,
1020
1020
  sortAsc: I
1021
- }), [z, Tt] = e.useState(
1021
+ }), [z, Dt] = e.useState(
1022
1022
  E ? ct(window.location.hash) : null
1023
1023
  );
1024
1024
  e.useEffect(() => {
@@ -1036,7 +1036,7 @@ const pn = ({
1036
1036
  if (!E)
1037
1037
  return;
1038
1038
  const r = () => {
1039
- Tt(ct(window.location.hash));
1039
+ Dt(ct(window.location.hash));
1040
1040
  };
1041
1041
  return window.addEventListener("hashchange", r), () => {
1042
1042
  window.removeEventListener("hashchange", r);
@@ -1067,7 +1067,7 @@ const pn = ({
1067
1067
  ), Ae = e.useMemo(
1068
1068
  () => me || Math.floor(Re.width || 0),
1069
1069
  [Re.width, me]
1070
- ), Ne = e.useMemo(() => !et(a, fe) && J, [a, fe, J]), { properties: ae, required: Mt } = e.useMemo(
1070
+ ), Ne = e.useMemo(() => !et(a, fe) && J, [a, fe, J]), { properties: ae, required: Tt } = e.useMemo(
1071
1071
  () => ({
1072
1072
  properties: {},
1073
1073
  required: [],
@@ -1130,10 +1130,10 @@ const pn = ({
1130
1130
  g
1131
1131
  ) ? "-" : tt(
1132
1132
  new Date(g),
1133
- N?.dateFormat || vt
1133
+ N?.dateFormat || yt
1134
1134
  ), d;
1135
1135
  if (h.format === "date-time" && g)
1136
- return d[i] = M ? yt(
1136
+ return d[i] = M ? wt(
1137
1137
  new Date(g),
1138
1138
  M,
1139
1139
  Je
@@ -1169,7 +1169,7 @@ const pn = ({
1169
1169
  Math.floor(
1170
1170
  (Ae - Xe) / Ge
1171
1171
  ),
1172
- kt
1172
+ vt
1173
1173
  );
1174
1174
  let d = (Ae - Xe) % Ge;
1175
1175
  const i = new Uint16Array(
@@ -1325,7 +1325,7 @@ const pn = ({
1325
1325
  ke({ ...a, sortColumn: r, sortAsc: c });
1326
1326
  },
1327
1327
  [a, z, E]
1328
- ), Et = e.useCallback(
1328
+ ), Mt = e.useCallback(
1329
1329
  (r) => {
1330
1330
  ke({
1331
1331
  ...a,
@@ -1381,12 +1381,12 @@ const pn = ({
1381
1381
  C,
1382
1382
  ot,
1383
1383
  Re.height
1384
- ]), Lt = e.useCallback(
1384
+ ]), Et = e.useCallback(
1385
1385
  (r) => {
1386
1386
  j(void 0), r.preventDefault(), r.stopPropagation();
1387
1387
  },
1388
1388
  []
1389
- ), At = e.useCallback(
1389
+ ), Lt = e.useCallback(
1390
1390
  (r, c) => {
1391
1391
  if (!Q)
1392
1392
  return;
@@ -1420,7 +1420,7 @@ const pn = ({
1420
1420
  Q,
1421
1421
  E
1422
1422
  ]
1423
- ), Nt = e.useCallback(() => {
1423
+ ), At = e.useCallback(() => {
1424
1424
  const r = {
1425
1425
  searchQuery: "",
1426
1426
  columnFilterMap: {},
@@ -1429,19 +1429,19 @@ const pn = ({
1429
1429
  sortAsc: I
1430
1430
  };
1431
1431
  E && (window.location.hash = ze(r)), qe(r), ke(r);
1432
- }, [E, I, T]), It = e.useCallback(() => {
1432
+ }, [E, I, T]), Nt = e.useCallback(() => {
1433
1433
  const r = z?.searchQuery || "";
1434
1434
  E && // prevent hash change for undefined vs empty string compare
1435
1435
  (a.searchQuery || r) && a.searchQuery !== r && (window.location.hash = ze({
1436
1436
  ...z,
1437
1437
  searchQuery: a.searchQuery
1438
1438
  }));
1439
- }, [z, a.searchQuery, E]), St = e.useCallback(
1439
+ }, [z, a.searchQuery, E]), It = e.useCallback(
1440
1440
  async (r) => {
1441
- r.preventDefault(), r.stopPropagation(), X && hn(X);
1441
+ r.preventDefault(), r.stopPropagation(), X && await hn(X);
1442
1442
  },
1443
1443
  [X]
1444
- ), $t = e.useCallback(() => {
1444
+ ), St = e.useCallback(() => {
1445
1445
  v && (localStorage.removeItem(`${v}.columnNames`), localStorage.removeItem(`${v}.columnWidths`), oe(void 0), Oe(void 0));
1446
1446
  }, [v]), Ke = e.useCallback(
1447
1447
  (r) => {
@@ -1451,7 +1451,7 @@ const pn = ({
1451
1451
  return c && x[c._index] !== void 0;
1452
1452
  },
1453
1453
  [le, ne, X, x]
1454
- ), Ot = e.useMemo(() => pe ? !(x && !Ne) && !ne ? /* @__PURE__ */ t(
1454
+ ), $t = e.useMemo(() => pe ? !(x && !Ne) && !ne ? /* @__PURE__ */ n(
1455
1455
  "div",
1456
1456
  {
1457
1457
  style: {
@@ -1464,16 +1464,16 @@ const pn = ({
1464
1464
  alignItems: "center",
1465
1465
  justifyContent: "center"
1466
1466
  },
1467
- children: Ne ? /* @__PURE__ */ t("button", { onClick: De, className: "btn border", children: "Refresh data" }) : /* @__PURE__ */ t("div", { children: "⌛ Loading..." })
1467
+ children: Ne ? /* @__PURE__ */ n("button", { onClick: De, className: "btn border", children: "Refresh data" }) : /* @__PURE__ */ n("div", { children: "⌛ Loading..." })
1468
1468
  }
1469
- ) : ne && le ? /* @__PURE__ */ t(
1469
+ ) : ne && le ? /* @__PURE__ */ n(
1470
1470
  Ht,
1471
1471
  {
1472
1472
  ref: s,
1473
1473
  isItemLoaded: Ke,
1474
1474
  itemCount: le,
1475
1475
  loadMoreItems: ne,
1476
- children: ({ onItemsRendered: c, ref: d }) => /* @__PURE__ */ t(
1476
+ children: ({ onItemsRendered: c, ref: d }) => /* @__PURE__ */ n(
1477
1477
  lt,
1478
1478
  {
1479
1479
  className: "mig-schema-table__tbody",
@@ -1503,7 +1503,7 @@ const pn = ({
1503
1503
  )}`
1504
1504
  )
1505
1505
  }
1506
- ) : /* @__PURE__ */ t(
1506
+ ) : /* @__PURE__ */ n(
1507
1507
  lt,
1508
1508
  {
1509
1509
  className: "mig-schema-table__tbody",
@@ -1540,7 +1540,7 @@ const pn = ({
1540
1540
  x,
1541
1541
  pe,
1542
1542
  ce
1543
- ]), Rt = e.useMemo(
1543
+ ]), Ot = e.useMemo(
1544
1544
  () => ({
1545
1545
  ...A,
1546
1546
  width: me ? Math.min(ue, Ae) : void 0,
@@ -1548,8 +1548,8 @@ const pn = ({
1548
1548
  maxHeight: C === "100%" ? "100%" : void 0
1549
1549
  }),
1550
1550
  [C, ue, A, Ae, me]
1551
- ), Wt = o || "input";
1552
- return /* @__PURE__ */ t(
1551
+ ), Rt = o || "input";
1552
+ return /* @__PURE__ */ n(
1553
1553
  Me.Provider,
1554
1554
  {
1555
1555
  value: {
@@ -1569,7 +1569,7 @@ const pn = ({
1569
1569
  onRowClick: L,
1570
1570
  onRowDoubleClick: se,
1571
1571
  properties: ae,
1572
- required: Mt,
1572
+ required: Tt,
1573
1573
  setCheckedIndexes: q,
1574
1574
  setCustomColumnNames: oe,
1575
1575
  setCustomColumnWidths: Oe,
@@ -1588,7 +1588,7 @@ const pn = ({
1588
1588
  {
1589
1589
  className: `mig-schema-table${L ? " mig-schema-table--clickable-rows" : ""}`,
1590
1590
  ref: nt,
1591
- style: Rt,
1591
+ style: Ot,
1592
1592
  role: "table",
1593
1593
  children: [
1594
1594
  /* @__PURE__ */ W(
@@ -1597,8 +1597,8 @@ const pn = ({
1597
1597
  className: "mig-schema-table__action-container",
1598
1598
  ref: rt,
1599
1599
  children: [
1600
- /* @__PURE__ */ t("div", { children: U ? /* @__PURE__ */ t(
1601
- Wt,
1600
+ /* @__PURE__ */ n("div", { children: U ? /* @__PURE__ */ n(
1601
+ Rt,
1602
1602
  {
1603
1603
  className: "mig-schema-table__search",
1604
1604
  type: "search",
@@ -1606,46 +1606,46 @@ const pn = ({
1606
1606
  autoComplete: "off",
1607
1607
  placeholder: _e || k("search..."),
1608
1608
  value: a.searchQuery,
1609
- onChange: Et,
1609
+ onChange: Mt,
1610
1610
  onKeyDown: at,
1611
1611
  autoFocus: y,
1612
- onBlur: It
1612
+ onBlur: Nt
1613
1613
  }
1614
1614
  ) : null }),
1615
- n ? /* @__PURE__ */ t(
1616
- n,
1615
+ t ? /* @__PURE__ */ n(
1616
+ t,
1617
1617
  {
1618
1618
  ...O,
1619
1619
  renderData: X
1620
1620
  }
1621
- ) : /* @__PURE__ */ t("div", { className: "mig-schema-table__custom_element_placeholder" }),
1622
- S && Array.isArray(_) ? /* @__PURE__ */ t("span", { className: "mig-schema-table__row_counter", children: k(
1621
+ ) : /* @__PURE__ */ n("div", { className: "mig-schema-table__custom_element_placeholder" }),
1622
+ S && Array.isArray(_) ? /* @__PURE__ */ n("span", { className: "mig-schema-table__row_counter", children: k(
1623
1623
  "showingFilteredCountOfTotalCount",
1624
1624
  X?.length || 0,
1625
1625
  _.length
1626
1626
  ) }) : null,
1627
- b ? /* @__PURE__ */ t(
1627
+ b ? /* @__PURE__ */ n(
1628
1628
  "button",
1629
1629
  {
1630
- onClick: St,
1630
+ onClick: It,
1631
1631
  style: { marginLeft: 8 },
1632
1632
  disabled: !X?.length,
1633
1633
  children: k("exportData")
1634
1634
  }
1635
1635
  ) : null,
1636
- U || m ? /* @__PURE__ */ t(
1636
+ U || m ? /* @__PURE__ */ n(
1637
1637
  "button",
1638
1638
  {
1639
- onClick: Nt,
1639
+ onClick: At,
1640
1640
  style: { marginLeft: 8 },
1641
1641
  disabled: a.columnFilterMap && a.searchQuery ? Object.keys(a.columnFilterMap).length + a.searchQuery.length === 0 : !1,
1642
1642
  children: k("clearFilters")
1643
1643
  }
1644
1644
  ) : null,
1645
- v ? /* @__PURE__ */ t(
1645
+ v ? /* @__PURE__ */ n(
1646
1646
  "button",
1647
1647
  {
1648
- onClick: $t,
1648
+ onClick: St,
1649
1649
  style: { marginLeft: 8 },
1650
1650
  disabled: !We && !Fe,
1651
1651
  children: k("clearSettings")
@@ -1655,7 +1655,7 @@ const pn = ({
1655
1655
  }
1656
1656
  ),
1657
1657
  /* @__PURE__ */ W("div", { className: "mig-schema-table__column_resize_container", children: [
1658
- /* @__PURE__ */ t(
1658
+ /* @__PURE__ */ n(
1659
1659
  u,
1660
1660
  {
1661
1661
  height: gt,
@@ -1674,8 +1674,8 @@ const pn = ({
1674
1674
  " "
1675
1675
  )}`
1676
1676
  ),
1677
- Ot,
1678
- w ? /* @__PURE__ */ t(
1677
+ $t,
1678
+ w ? /* @__PURE__ */ n(
1679
1679
  dn,
1680
1680
  {
1681
1681
  columnWidths: ie,
@@ -1685,18 +1685,19 @@ const pn = ({
1685
1685
  }
1686
1686
  ) : null
1687
1687
  ] }),
1688
- x ? x.length > 0 ? /* @__PURE__ */ t(wt, { children: jt(
1689
- Q ? /* @__PURE__ */ t(
1688
+ x && x.length === 0 ? /* @__PURE__ */ n("div", { className: "mig-schema-table__no_data", children: "No data found" }) : null,
1689
+ Q ? jt(
1690
+ /* @__PURE__ */ n(
1690
1691
  un,
1691
1692
  {
1692
1693
  isFilterable: m && Q.propConfig?.isFilterable !== !1,
1693
- isSortable: xt(
1694
- !!te,
1694
+ isSortable: kt(
1695
+ te,
1695
1696
  V.properties[Q.propName],
1696
1697
  Q.propConfig
1697
1698
  ),
1698
- onChange: At,
1699
- onClose: Lt,
1699
+ onChange: Lt,
1700
+ onClose: Et,
1700
1701
  onInputKeyDown: at,
1701
1702
  propConfig: Q.propConfig,
1702
1703
  propIsRequired: Q.propIsRequired,
@@ -1707,18 +1708,18 @@ const pn = ({
1707
1708
  translate: k,
1708
1709
  value: a.columnFilterMap ? a.columnFilterMap[Q.propName] : null
1709
1710
  }
1710
- ) : null,
1711
+ ),
1711
1712
  document.body
1712
- ) }) : /* @__PURE__ */ t("div", { className: "mig-schema-table__no_data", children: "No data found" }) : null
1713
+ ) : null
1713
1714
  ]
1714
1715
  }
1715
1716
  )
1716
1717
  }
1717
1718
  );
1718
- }, In = e.memo(pn), Sn = e.memo(({ refresh: n, period: o = 60 }) => {
1719
+ }, In = e.memo(pn), Sn = e.memo(({ refresh: t, period: o = 60 }) => {
1719
1720
  const [u, p] = e.useState(/* @__PURE__ */ new Date()), [f, l] = e.useState(/* @__PURE__ */ new Date()), O = e.useCallback(() => {
1720
- l(/* @__PURE__ */ new Date()), n();
1721
- }, [n]), _ = e.useMemo(
1721
+ l(/* @__PURE__ */ new Date()), t();
1722
+ }, [t]), _ = e.useMemo(
1722
1723
  () => Ut(u, f),
1723
1724
  [u, f]
1724
1725
  );
@@ -1746,10 +1747,10 @@ const pn = ({
1746
1747
  );
1747
1748
  });
1748
1749
  export {
1749
- vt as DEFAULT_DATE_FORMAT,
1750
+ yt as DEFAULT_DATE_FORMAT,
1750
1751
  Je as DEFAULT_DATE_TIME_FORMAT,
1751
1752
  $e as EColumnFilterStatus,
1752
- kt as MINIMUM_COLUMN_WIDTH,
1753
+ vt as MINIMUM_COLUMN_WIDTH,
1753
1754
  en as RESIZER_WIDTH,
1754
1755
  Sn as Refresher,
1755
1756
  In as SchemaTable,
@@ -1 +1 @@
1
- (function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("react-dom"),require("react-window"),require("date-fns"),require("date-fns/locale"),require("mig-data-tools"),require("lodash"),require("react-datepicker"),require("date-fns/locale/nl"),require("@date-fns/tz"),require("@floating-ui/react-dom"),require("react-window-infinite-loader"),require("file-saver")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom","react-window","date-fns","date-fns/locale","mig-data-tools","lodash","react-datepicker","date-fns/locale/nl","@date-fns/tz","@floating-ui/react-dom","react-window-infinite-loader","file-saver"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E["mig-schema-table"]={},E.jsxRuntime,E.React,E.ReactDOM,E.reactWindow,E.dateFns,E.locale,E.migDataTools,E.lodash,E.DatePicker,E.nl,E.tz,E.reactDom,E.InfiniteLoader,E.fileSaver))})(this,(function(E,e,t,kt,Pe,Ve,xt,j,ge,ot,it,Fe,We,Mt,Et){"use strict";function Tt(n){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const a in n)if(a!=="default"){const m=Object.getOwnPropertyDescriptor(n,a);Object.defineProperty(r,a,m.get?m:{enumerable:!0,get:()=>n[a]})}}return r.default=n,Object.freeze(r)}const Dt=Tt(t),Je=(n,r)=>Ve.format(n,r,{locale:xt.nl}).replace(".",""),Lt={"Europe/Amsterdam":"AMS","Europe/Berlin":"AMS","Asia/Jakarta":"JKT","Asia/Bangkok":"JKT",showingFilteredCountOfTotalCount:"Showing {0} of {1}"};function lt(n,...r){let a=Lt[n]||j.unCamel(n);return r.forEach((m,b)=>{a=a.replace(`{${b}}`,`${m}`)}),a}const R="SELECT_ALL_COLUMN_NAME",at=40,He="dd MMM yyyy",Le="dd MMM yyyy HH:mm",Ge=25,ct=50,dt=3;var fe=(n=>(n.GT="GT",n.LT="LT",n.EQ="EQ",n))(fe||{}),xe=(n=>(n.UNAVAILABLE="UNAVAILABLE",n.AVAILABLE="AVAILABLE",n.ACTIVE="ACTIVE",n))(xe||{});const Me=Dt.createContext({checkedIndexes:[],columnNames:[],columnWidths:new Uint16Array,config:{},disabledCheckedIndexes:[],dropTargetIndex:-1,isColumnFilterable:!1,isItemLoaded:()=>!1,isSortable:!1,properties:{},required:[],setCustomColumnNames:j.emptyFn,setCustomColumnWidths:j.emptyFn,setDropTargetIndex:j.emptyFn,setFilterSortColumn:j.emptyFn,setLastCheckChangedRowIndex:j.emptyFn,setMenuConfig:j.emptyFn,tableDataState:{searchQuery:"",columnFilterMap:{},sortColumn:"",sortAsc:!1},translate:j.emptyFn}),At={type:"boolean"},It=({columnIndex:n,rowIndex:r,style:a})=>{const{checkedIndexes:m,columnNames:b,config:c,disabledCheckedIndexes:F,displayTimezone:_,getRowClassName:W,getRowSelected:S,isItemLoaded:T,lastCheckChangedRowIndex:$,onRowClick:D,onRowDoubleClick:y,properties:O,setCheckedIndexes:H,setLastCheckChangedRowIndex:ee,sortedRenderData:M,sourceData:o,translate:h}=t.useContext(Me),p=b[n],w=p===R?At:O[p],Z=c?c[p]:void 0,ne=t.useCallback(v=>{H&&H(I=>I&&I.includes(v)?I.filter(L=>L!==v):I?[...I,v]:[v])},[H]),ce=T(r),re=t.useCallback(v=>{if(!o||!M||!D||!ce)return;const{rowIndex:I}=v.currentTarget.dataset;if(!I)return;const k=M[parseInt(I,10)];D(o[k._index],k._index,v)},[ce,D,M,o]),C=t.useCallback(v=>{if(!o||!M||!y||!T)return;const{rowIndex:I}=v.currentTarget.dataset;if(!I)return;const k=M[parseInt(I,10)];y(o[k._index],k._index,v)},[T,y,M,o]),A=M?M[r]:void 0,{showTimezones:ie,TdBody:X}=Z||{},se=t.useMemo(()=>_?null:j.timeZone.startsWith("Europe/")?"Asia/Jakarta":"Europe/Amsterdam",[_]),z=t.useMemo(()=>{if(!A||!M)return;let v=p===R?void 0:A[p];if(w?.format&&w.format==="date-time"&&ie!==!1){const k=o?o[A._index]:void 0,L=k?k[p]:void 0,de=L?new Date(L):void 0;de&&se&&(v=`${j.localeFormatInTimeZone(de,se,Le)} (${h(se)})`)}const I=["mig-schema-table__td",`mig-schema-table__td--${r%2?"odd":"even"}`,`mig-schema-table__td--prop-${p}`];switch(o&&S&&S(o[A._index],A._index)&&I.push("mig-schema-table__td--selected"),o&&W&&I.push(W(o[A._index],A._index,M)),w?.type){case"boolean":I.push(`text-${Z?.align||"center"}`);break;case"number":case"integer":I.push(`text-${Z?.align||"end"}`);break;default:Z?.align&&I.push(`text-${Z.align}`)}return{"data-row-index":r,"data-column-index":n,style:a,className:I.join(" "),title:v,onClick:p===R?void 0:re,onDoubleClick:p===R?void 0:C}},[A,M,p,w,ie,r,o,S,W,n,a,re,C,se,h,Z]),V=t.useCallback(v=>{if(!ne||!A)return;const I=parseInt(v.currentTarget.dataset.rowIndex);if(v.shiftKey&&$!==void 0){const k=m?.includes($)?$:void 0;if(k!==void 0&&M){const L=r;for(const de of ge.range(L>k?k+1:L,L>k?L+1:k)){const me=M[de]._index;(!F||!F.includes(me))&&ne(me)}}}else ne(A._index);ee(I),we.current?.focus()},[m,F,$,ne,A,r,ee,M]),we=t.useRef(null);if(!A||!z)return null;if(!T||o&&!o[A._index])return e.jsx("div",{...z,children:"loading"});if(p===R)return e.jsx("div",{...z,onMouseDown:V,children:e.jsx("div",{style:{textAlign:"center"},children:e.jsx("input",{ref:we,type:"checkbox",readOnly:!0,checked:m?.includes(A._index),disabled:F?.includes(A._index)})})});if(X&&o)return e.jsx("div",{...z,children:e.jsx(X,{dataIndex:A._index,rowData:o[A._index],rowIndex:r,...Z?.tdBodyProps})});const G=A[p];return w?.format==="url"&&G?e.jsx("a",{href:G,target:"_blank",rel:"noopener noreferrer",...z,children:G}):e.jsx("div",{...z,children:G})},ut=t.memo(It);function Nt(){const{checkedIndexes:n,disabledCheckedIndexes:r,sortedRenderData:a}=t.useContext(Me);return t.useMemo(()=>{const m=[...a||[]].filter(b=>(n?n.includes(b._index):!0)||(r?!r.includes(b._index):!0));return n?.length!==0&&m.length===n?.length},[n,r,a])}function ht(n,r,a){return!!(n&&a?.isSortable!==!1&&(r||a?.renderData||a?.sort))}function ft(){const{setCustomColumnWidths:n,settingsStorageKey:r}=t.useContext(Me);return t.useCallback(a=>{r&&localStorage.setItem(`${r}.columnWidths`,JSON.stringify(Array.from(a))),n(a)},[n,r])}const St=({index:n,style:r})=>{const{checkedIndexes:a,columnNames:m,columnWidths:b,config:c,disabledCheckedIndexes:F,dropTargetIndex:_,isColumnFilterable:W,isSortable:S,setCheckedIndexes:T,properties:$,required:D,setCustomColumnNames:y,setDropTargetIndex:O,setFilterSortColumn:H,setMenuConfig:ee,settingsStorageKey:M,tableDataState:o,sortedRenderData:h,translate:p,displayTimezone:w}=t.useContext(Me),[Z,ne]=t.useState(!1),ce=n===_,re=ft(),C=m[n],A=C===R?{type:"boolean"}:$[C],ie=o.sortColumn===C?o.sortAsc:void 0,X=c?c[C]:void 0;let se=W&&(A||X?.FilterMenu)&&X?.isFilterable!==!1?xe.AVAILABLE:xe.UNAVAILABLE;o.columnFilterMap&&o.columnFilterMap[C]!==void 0&&(se=xe.ACTIVE);const z=ht(S,A,X),V=["mig-schema-table__th",`mig-schema-table__th--filter-${se}`,`mig-schema-table__th--prop-${C}`];V.push(z?"mig-schema-table__th--sortable":"mig-schema-table__th--unsortable"),ie!==void 0&&V.push("mig-schema-table__th--sorted"),Z&&V.push("mig-schema-table__th--dragging"),ce&&V.push("mig-schema-table__th--drop-target");const{format:we}=A||{},{align:G,defaultSortDesc:v,showTimezones:I=!w,title:k}=X||{},L=t.useCallback(()=>{if(z){if(ie===void 0){H(C,!v);return}H(C,!ie)}},[z,v,C,H,ie]),de=D.includes(C),me=t.useCallback(Q=>{const be=Q.currentTarget;ee(ve=>{if(ve?.propName!==C)return{propConfig:X,propIsRequired:de,propName:C,referenceElement:be}})},[X,de,C,ee]),ye=t.useMemo(()=>k!==void 0?k:we==="date-time"&&I?`${p(C)} (${p(w||j.timeZone)})`:p(C),[k,we,I,p,C,w]),oe=t.useCallback((Q,be)=>{if(!m||!b)return;const ve=m.indexOf(Q),P=[...m];P.splice(ve,1);const x=P.indexOf(be);P.splice(x+1,0,Q),y(P);const _e=[...b],pe=_e[ve];_e.splice(ve,1),_e.splice(x+1,0,pe),re(new Uint16Array(_e)),M&&localStorage.setItem(`${M}.columnNames`,JSON.stringify(P))},[m,b,re,M,y]),Ae=t.useCallback(Q=>{oe&&(ne(!0),Q.dataTransfer.effectAllowed="move",Q.dataTransfer.dropEffect="move",Q.dataTransfer.setData("text/plain",C))},[oe,C]),je=t.useCallback(()=>{oe&&(ne(!1),O(-1))},[oe,O]),Xe=t.useCallback(Q=>{oe&&(Q.preventDefault(),O(n))},[n,oe,O]),Ye=t.useCallback(Q=>{if(O(-1),!oe||!C)return;const be=Q.dataTransfer.getData("text/plain");!be||be===C||oe(be,C)},[oe,C,O]),Ie=Nt(),Ke=t.useCallback(()=>{!T||!h||T(Ie?[]:h.map(Q=>Q._index).filter(Q=>!F?.includes(Q)))},[T,h,Ie,F]);if(C===R)return e.jsx("div",{style:r,className:V.join(" "),children:e.jsx("div",{style:{width:"100%",textAlign:"center"},title:`${a?.length||0} selected`,children:e.jsx("input",{type:"checkbox",name:"selectAll",checked:Ie,onChange:Ke})})});switch(A?.type){case"boolean":V.push(`text-${G||"center"}`,`justify-content-${G||"center"}`);break;case"integer":case"number":V.push(`text-${G||"end"}`,`justify-content-${G||"end"}`);break;default:G&&V.push(`text-${G}`)}let U=X?.hoverTitle;return!U&&typeof ye=="string"&&(U=ye),e.jsxs("div",{className:V.join(" "),style:r,title:U,draggable:!0,onDragStart:Ae,onDragEnd:je,onDragOver:Xe,onDrop:Ye,children:[e.jsxs("div",{className:"mig-schema-table__th__label-body",style:{lineHeight:"44px"},onClick:L,children:[e.jsx("span",{className:"mig-schema-table__th__label-body-text",children:ye}),ie===void 0?null:e.jsx("span",{className:"mig-schema-table__th__sort-icon",children:ie?"↓":"↑"})]}),z||se!==xe.UNAVAILABLE?e.jsx("button",{className:"mig-schema-table__th__trigger-el",onClick:me,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#404040",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}):null]})},mt=t.memo(St),Ot={[fe.GT]:">",[fe.LT]:"<",[fe.EQ]:"="},$t=t.memo(({columnFilterValue:n,onChange:r,onInputKeyDown:a,propIsRequired:m,propName:b,propSchema:c,translate:F})=>{const{displayTimezone:_}=t.useContext(Me),{type:W,format:S,minimum:T,maximum:$}=c||{},D=n,y=S==="date-time";let O,H,ee,M;switch(W){case"number":case"integer":return O=D||{},H=(o,h,p)=>{const w={...O,[o]:h.value===""?void 0:parseInt(h.value)},Z=Object.values(w).find(ne=>isFinite(ne));r(Z!==void 0&&(T===void 0||Z>=T)?w:void 0,p)},e.jsxs("ol",{className:"mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component",children:[m?null:e.jsxs("li",{style:{padding:8},children:[e.jsxs("label",{className:"d-flex",children:[e.jsx("input",{type:"checkbox",style:{marginRight:14},checked:!!O.filterEmpty,onChange:()=>{const{filterEmpty:o,...h}=O;o||(h.filterEmpty=!0),r(Object.keys(h).length?h:void 0,!0)}}),"Hide empty values"]}),e.jsx("hr",{})]}),Object.keys(fe).map(o=>{const h=O[o];return e.jsxs("li",{children:[e.jsx("label",{style:{width:40,paddingLeft:16},children:Ot[o]}),e.jsx("input",{className:"form-control",style:{width:120},type:"number",value:h!==void 0?h:"","data-prop-name":b,onChange:p=>{H(o,p.currentTarget,!1)},onBlur:p=>{H(o,p.currentTarget,!0)},onKeyDown:a,min:T,max:$})]},o)})]});case"boolean":return ee=["✓","✕"],m||ee.push("?"),M=D?"✓":"✕",D===null&&(M="?"),D===void 0&&(M=""),e.jsx("ol",{className:"mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component",children:e.jsx("li",{children:e.jsxs("select",{autoFocus:!0,className:"form-select",value:M,"data-prop-name":b,onChange:o=>{switch(o.currentTarget.value){case"✓":r(!0,!0);break;case"✕":r(!1,!0);break;case"?":r(null,!0);break;default:r(void 0,!0)}},children:[e.jsx("option",{value:"",children:"All"},"all"),ee.map(o=>e.jsx("option",{value:o,children:o},`column-filter-select-${o}`))]})})});case"string":if(c?.enum)return e.jsx("ol",{className:"mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component",children:e.jsx("li",{children:e.jsxs("select",{autoFocus:!0,className:"form-select",value:D,"data-prop-name":b,onChange:o=>{r(o.currentTarget.value||void 0,!0)},children:[e.jsx("option",{value:"",children:"All"},"all"),c.enum.map(o=>e.jsx("option",{value:o,children:F(o)},`column-filter-select-${o}`))]})})});if(y||S==="date"){const o=y?Le:He,h=n||{from:void 0,to:void 0,filterEmpty:void 0};return e.jsxs("ol",{className:"mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component",children:[m?null:e.jsxs("li",{style:{padding:8},children:[e.jsxs("label",{className:"d-flex",children:[e.jsx("input",{type:"checkbox",checked:!!h.filterEmpty,onChange:()=>{const{filterEmpty:p,...w}=h;p||(w.filterEmpty=!0),r(Object.keys(w).length?w:void 0,!0)}}),"Hide empty values"]}),e.jsx("hr",{})]}),e.jsxs("li",{style:{padding:8},children:[e.jsx("label",{style:{width:120,paddingLeft:4},children:"After"}),e.jsx(ot,{dateFormat:o,"data-prop-name":b,locale:it.nl,selected:h.from?new Fe.TZDate(h.from).withTimeZone(_||j.timeZone):null,onChange:p=>{if(!p&&!h.to){r(void 0,!0);return}if(h.to&&p&&p>h.to)return;const w=p?Fe.TZDate.tz(_||j.timeZone,p):void 0;r({...n,from:w},!0)},placeholderText:o,isClearable:!0,selectsStart:!0,showTimeSelect:y,showTimeInput:y,showMonthDropdown:!0,showYearDropdown:!0,timeIntervals:15,shouldCloseOnSelect:!y})]}),e.jsxs("li",{style:{padding:8},children:[e.jsx("label",{style:{width:120,paddingLeft:4},children:"Before"}),e.jsx(ot,{id:"filter-date",dateFormat:o,"data-prop-name":b,locale:it.nl,selectsEnd:!0,selected:h.to?new Fe.TZDate(h.to).withTimeZone(_||j.timeZone):null,showMonthDropdown:!0,showYearDropdown:!0,onChange:p=>{if(!p&&!h.from){r(void 0,!0);return}const w=p?y?Fe.TZDate.tz(_||j.timeZone,p):Ve.endOfDay(p):void 0;h.from&&w&&w<h.from||r({...n,to:w},!0)},placeholderText:o,isClearable:!0,startDate:h.from,endDate:h.to,showTimeInput:y,showTimeSelect:y,timeIntervals:15,shouldCloseOnSelect:!y})]})]})}default:return e.jsx("ol",{className:"mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component",children:e.jsx("li",{children:e.jsx("input",{autoFocus:!0,type:"search",className:"form-control",placeholder:`Search ${b}`,"aria-label":`Search ${b}`,value:D||"","data-prop-name":b,onChange:o=>{r(o.currentTarget.value||void 0,!1)},onKeyDown:a,onBlur:o=>{r(o.currentTarget.value||void 0,!0)}})})})}}),Ft=({isSortable:n,isFilterable:r,onChange:a,onClose:m,onInputKeyDown:b,propConfig:c,propIsRequired:F,propName:_,propSchema:W,referenceElement:S,setFilterSortColumn:T,translate:$,value:D})=>{const y=We.useFloating({placement:"bottom-start",elements:{reference:S},middleware:[We.flip()]}),O=We.useFloating({placement:"right-start",middleware:[We.flip()]});t.useEffect(()=>{const h=p=>{if(!y.elements.floating)return;let w=p.target;for(;w&&y.elements.floating;){if(w===y.elements.floating||w===O.elements.floating)return;w=w.parentNode===window.document?null:w.parentNode}m(p)};return window.addEventListener("click",h,{capture:!0}),()=>{window.removeEventListener("click",h,{capture:!0})}},[y.elements.floating,m,O.elements.floating]);const H=c?.FilterMenu||$t,ee=t.useCallback(h=>{T(_,!0),m(h)},[m,_,T]),M=t.useCallback(h=>{T(_,!1),m(h)},[m,_,T]),o=t.useCallback(()=>{a(void 0,!0)},[a]);return!n&&!r?null:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mig-schema-table mig-schema-table__th-menu",ref:y.refs.setFloating,style:y.floatingStyles,children:e.jsxs("ol",{className:"mig-schema-table-menu",children:[n?e.jsxs("li",{onClick:ee,style:{padding:8},children:[e.jsx("span",{className:"mig-schema-table__th-menu__icon",children:"↓"})," ",$("sortAscending")]}):null,n?e.jsxs("li",{onClick:M,style:{padding:8},children:[e.jsx("span",{className:"mig-schema-table__th-menu__icon",children:"↑"})," ",$("sortDescending")]}):null,r?e.jsxs("li",{style:{padding:8},onMouseOver:h=>{O.refs.setReference(h.currentTarget)},children:[e.jsx("span",{className:"mig-schema-table__th-menu__icon",children:e.jsx("input",{type:"checkbox",id:"mig-schema-table__th-menu__filters",checked:D!==void 0,disabled:D===void 0,onChange:o})}),e.jsx("label",{htmlFor:"mig-schema-table__th-menu__filters",children:$("filters")}),e.jsx("div",{className:"mig-schema-table__th-menu__sub-menu-indicator"})]}):null]})}),O.elements.reference?e.jsx("div",{className:"mig-schema-table mig-schema-table__th-menu__sub-menu",ref:O.refs.setFloating,style:O.floatingStyles,children:e.jsx(H,{columnFilterValue:D,onChange:a,onInputKeyDown:b,propIsRequired:F,propName:_,propSchema:W,translate:$})}):null]})},Wt=t.memo(Ft),jt=({columnWidths:n,resizeColumnIndex:r,setResizeColumnIndex:a,tableBodyHeight:m})=>{const[b,c]=t.useState(0),F=ft(),_=t.useCallback($=>{const D=n.map((y,O)=>O===r?Math.max(y+$,Ge):y);F(D)},[n,r,F]);let W=0;const S=t.useCallback($=>{a(parseInt($.currentTarget.dataset.columnIndex)),c($.clientX)},[a]),T=t.useCallback($=>{_($.clientX-b),c(0),a(-1)},[b,_,a]);return e.jsx("div",{children:[...n].map(($,D)=>{W+=$;const y=["mig-schema-table__column_resizer"];return D===r&&y.push("mig-schema-table__column_resizer--dragged"),e.jsx("div",{style:{left:W-dt,bottom:m},className:y.join(" "),draggable:"true","data-column-index":D,onDragStart:S,onDragEnd:T},D)})})},bt=n=>{const[r,a]=t.useState({width:0,height:0}),m=t.useMemo(()=>ge.debounce(a,100),[]);return t.useEffect(()=>{if(!n)return;const b=new ResizeObserver(c=>{for(const F of c){const{blockSize:_,inlineSize:W}=F.borderBoxSize[0];m(S=>W&&_&&(S.width!==W||S.height!==_)?{width:W,height:_}:S)}});return b.observe(n),()=>{b.disconnect()}},[m,n]),r},Bt=()=>new Promise((n,r)=>{if(window.ExcelJS){n(window.ExcelJS);return}const a=document.createElement("script");a.src="https://cdnjs.cloudflare.com/ajax/libs/exceljs/4.4.0/exceljs.bare.min.js",a.onload=()=>{n(window.ExcelJS)},a.onerror=()=>{r(new Error("Failed to load ExcelJS library"))},document.head.appendChild(a)}),Qt=async n=>{const{Workbook:r}=await Bt(),a=new r,m=a.addWorksheet("Data");n.length&&(m.addRow(ge.difference(Object.keys(n[0]),["_index","SELECT_ALL_COLUMN_NAME"])),m.getRow(1).font={bold:!0},m.addRows(n.map(b=>{const{_index:c,SELECT_ALL_COLUMN_NAME:F,..._}=b;return Object.values(_)})),a.xlsx.writeBuffer().then(b=>{const c=new Blob([b],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});Et.saveAs(c,"export.xlsx")}).catch(b=>{console.error("Error generating Excel file:",b)}))},pt=new Date("1000-01-01 00:00:00Z"),zt=new Intl.NumberFormat("nl-NL"),Ut=new Intl.NumberFormat("nl-NL",{style:"currency",currency:"EUR"});function qt(n,r){const{TdBody:a,sortByValue:m}=r||{};if(m!==void 0)return m;if(!n)return!1;const{format:b,type:c}=n;return b?.startsWith("date")||c==="boolean"||c==="integer"||c==="number"||!!a}const Zt=({CustomElement:n,CustomSearchInput:r,Heading:a=Pe.VariableSizeList,autoRender:m,checkedIndexes:b,config:c,customElementProps:F,data:_,defaultColumnFilters:W,defaultSortAsc:S=!1,defaultSortColumn:T,disabledCheckedIndexes:$,displayTimezone:D,enableAutoFocus:y=!0,enableRowCounter:O=!0,getRowClassName:H,getRowSelected:ee,getSearchQueryFilterResult:M,infiniteLoaderRef:o,isColumnFilterable:h=!0,isExportable:p=!0,isResizable:w=!0,isSearchable:Z=!0,isSortable:ne=!0,itemCount:ce,loadMoreItems:re,maxHeight:C,onRowClick:A,onRowDoubleClick:ie,onSearchEnter:X,onTableDataStateChange:se,rowHeight:z=36,schema:V,searchPlaceholder:we,setCheckedIndexes:G,settingsStorageKey:v,style:I,translate:k=lt,useFilterStateHash:L,variableSizeGridRef:de,width:me})=>{const[ye,oe]=t.useState(),[Ae,je]=t.useState(),[Xe,Ye]=t.useState(-1),[Ie,Ke]=t.useState(-1),[U,Q]=t.useState(),[be,ve]=t.useState(),P=_ instanceof Function,[x,_e]=t.useState(P?void 0:_),[pe,Re]=t.useState(),[i,Ee]=t.useState({searchQuery:"",columnFilterMap:W||{},sortColumn:T,sortAsc:S}),[q,Jt]=t.useState(L?j.parseLocationHash(window.location.hash):null);t.useEffect(()=>{P||_e(_)},[_,P]),t.useEffect(()=>{!P||x!==void 0||_(q&&Object.keys(q).length!==0?{...q,columnFilterMap:q.columnFilterMap||{}}:i).then(_e)},[_,P,q,x,i]),t.useEffect(()=>{pe||Re(i)},[i,pe]),t.useEffect(()=>{if(!L)return;const s=()=>{Jt(j.parseLocationHash(window.location.hash))};return window.addEventListener("hashchange",s),()=>{window.removeEventListener("hashchange",s)}},[L]),t.useEffect(()=>{if(!L)return;const{columnFilterMap:s,searchQuery:d,sortAsc:u,sortColumn:l}=q||{},f={searchQuery:d||"",columnFilterMap:s||W||{},sortAsc:u===void 0?S:u,sortColumn:l===void 0?T:l};Ee(N=>ge.isEqual(f,N)?N:f)},[q,L,W,S,T]),t.useEffect(()=>{se&&se(i)},[se,i]);const gt=t.useRef(null),_t=t.useRef(null),Be=bt(gt.current),Ct=bt(_t.current),Ne=t.useMemo(()=>me||Math.floor(Be.width||0),[Be.width,me]),Se=t.useMemo(()=>!ge.isEqual(i,pe)&&P,[i,pe,P]),{properties:le,required:Ht}=t.useMemo(()=>({properties:{},required:[],...V}),[V]),Qe=v?localStorage.getItem(`${v}.columnNames`):null,ze=v?localStorage.getItem(`${v}.columnWidths`):null,te=t.useMemo(()=>{if(ye)return ye;const s=Qe?JSON.parse(Qe):void 0;let d=Object.keys(le);if(G&&d.unshift(R),c){Object.keys(c).forEach(l=>{d.includes(l)||d.push(l)});const u=Object.entries(c).reduce((l,[f,N])=>(N.hidden&&l.push(f),l),[]);d=d.filter(l=>!u.includes(l)).sort((l,f)=>{let N=c[l]?c[l].order:void 0;N===void 0&&(N=Object.keys(le).findIndex(K=>K===l));let g=c[f]?c[f].order:void 0;return g===void 0&&(g=Object.keys(le).findIndex(K=>K===f)),f===R||l===R?0:N===-1?1:g===-1?-1:N-g})}return s?.length===d.length?s:d},[c,ye,G,le,Qe]),Ue=t.useMemo(()=>x&&te?x.map((s,d)=>te.reduce((u,l)=>{const f=le[l],N=c?c[l]:void 0;if(N?.renderData)return u[l]=N.renderData(s,d),u;if(!f||l===R)return u[l]="",u;const g=s?s[l]:"";switch(f.type){case"array":return u[l]=f.items?.type==="string"&&g?g.map(K=>k(K)).join(", "):JSON.stringify(g),u;case"boolean":return u[l]=g===void 0?"?":g?"✓":"✕",u;case"number":case"integer":return g===void 0?(u[l]="",u):(u[l]=f.format==="currency"?Ut.format(g):zt.format(g),u);case"string":if(f.format==="date"&&g)return u[l]=["2999-12-31","1970-01-01"].includes(g)?"-":Je(new Date(g),N?.dateFormat||He),u;if(f.format==="date-time"&&g)return u[l]=D?j.localeFormatInTimeZone(new Date(g),D,Le):Je(new Date(g),N?.dateFormat||Le),u;if(f.enum)return u[l]=g?k(g):"",u;default:return u[l]=g?`${g}`:"",u}},{_index:d})):void 0,[x,te,le,c,k,D]),Te=te?te.length:0,{dynamicWidthColumnCount:et,fixedWidthColumnsWidth:tt}=t.useMemo(()=>{let s=0,d=0;return(te||[]).forEach(u=>{if(u===R){s+=at;return}const l=c?c[u]:void 0;l?.width?s+=l.width:d+=1},0),{dynamicWidthColumnCount:d,fixedWidthColumnsWidth:s}},[te,c]),ae=t.useMemo(()=>{if(Ae)return new Uint16Array(Ae);const s=ze?new Uint16Array(JSON.parse(ze)):void 0,d=Math.max(Math.floor((Ne-tt)/et),Ge);let u=(Ne-tt)%et;const l=new Uint16Array(te.map(f=>{if(f===R)return at;const N=c?c[f]:void 0;return N?.width?N?.width:u?(u-=1,d+1):d}));return s?.length===l.length?s:l},[te,c,Ae,et,tt,ze,Ne]),qe=t.useCallback(s=>ae?ae[s]:1,[ae]),Oe=t.useMemo(()=>{if(!Ue||!h&&!Z||P)return Ue;const{searchQuery:s}=i,d=s.toLowerCase()||"",u=l=>x&&M?M(x[l._index],s):!(te&&!te.find(f=>`${l[f]}`.toLowerCase().includes(d)));return Ue.filter(l=>{let f=u(l);return!f||!i.columnFilterMap?!1:(Object.entries(i.columnFilterMap).forEach(([N,g])=>{if(!f||g===void 0)return;const K=c?c[N]:void 0;if(x&&K?.filter){f=K.filter(x[l._index],g);return}const he=le[N],B=x[l._index]?.[N];switch(he?.type){case"boolean":case"number":case"integer":if(g&&typeof g=="object"){g.filterEmpty&&B===void 0&&(f=!1);for(const J of Object.keys(fe)){const ke=g[J];if(f&&ge.isFinite(ke))switch(J){case fe.EQ:B!==ke&&(f=!1);break;case fe.GT:B<=ke&&(f=!1);break;case fe.LT:B>=ke&&(f=!1);break}}}else{if(B===void 0&&g===null)return!0;f=B===g}break;case"string":if(typeof g=="object"&&(he.format==="date"||he.format==="date-time")){const{from:J,to:ke,filterEmpty:vt}=g;if(!B)f=!vt;else{const Ze=B?new Date(B):void 0;(vt===!1||J&&(!Ze||Ze<J)||ke&&(!Ze||Ze>ke))&&(f=!1)}return}default:if(he?.enum){f=B===g;return}f=`${l[N]}`.toLowerCase().includes(`${g}`.toLowerCase())}}),f)})},[Ue,h,Z,P,i,M,te,c,x,le]),Y=t.useMemo(()=>{const{sortAsc:s,sortColumn:d}=i;if(!d||!Oe||!x||P)return Oe;const u=le[d],l=c?c[d]:void 0,f=l?.sort;if(f)return Oe.sort((K,he)=>{const B=x[K._index],J=x[he._index];return B?J?f(B,J,s===void 0?S:s):-1:1});const N=u&&u.format?.startsWith("date"),g=qt(u,l);return Oe.sort((K,he)=>{let B=g&&x[K._index]?x[K._index][d]:`${K[d]}`.toLowerCase(),J=g&&x[he._index]?x[he._index][d]:`${he[d]}`.toLowerCase();return g&&N&&(B=new Date(B),isNaN(B.getTime())&&(B=pt),J=new Date(J),isNaN(J.getTime())&&(J=pt)),B===J?0:B?J?(B<J?1:-1)*(s?-1:1):s?1:-1:s?-1:1})},[c,S,Oe,P,le,x,i]),wt=t.useCallback(s=>{const d={...i.columnFilterMap};delete d[s],Ee({...i,columnFilterMap:d})},[i]),nt=t.useCallback((s,d)=>{if(L){window.location.hash=j.serializeLocationHash({...q,sortColumn:s,sortAsc:d});return}Ee({...i,sortColumn:s,sortAsc:d})},[i,q,L]),Gt=t.useCallback(s=>{Ee({...i,searchQuery:s.currentTarget.value})},[i]),De=t.useCallback(()=>{Re(i),_e(void 0)},[i]);t.useEffect(()=>{if(!m||!q||!pe||!L)return;const s=Object.keys(q);let d=!1;for(const u of s){const l=q[u],f=pe[u];if(typeof l=="string"&&l!==f){d=!0;break}if(typeof l=="object"&&!ge.isEqual(l,f)){d=!0;break}}d&&De()},[m,q,pe,De,L]);const yt=t.useCallback(s=>{s.key==="Enter"&&(Q(void 0),Se&&De(),X&&s.currentTarget.className==="mig-schema-table__search"&&X(i.searchQuery||""))},[Se,i.searchQuery,X,De]),rt=t.useCallback(()=>z,[z]),ue=t.useMemo(()=>ge.sum(ae),[ae]),$e=t.useMemo(()=>Y?Y.length:0,[Y]),Ce=t.useMemo(()=>{const s=z*$e;let d;if(C&&(d=C==="100%"?Be.height:C,!d))return 0;const u=d?d-Ct.height-ct:0;return u&&u<s?u:s},[z,$e,C,Ct,Be.height]),Xt=t.useCallback(s=>{Q(void 0),s.preventDefault(),s.stopPropagation()},[]),Yt=t.useCallback((s,d)=>{if(!U)return;if(L&&d!==!1){window.location.hash=j.serializeLocationHash({...q,columnFilterMap:{...i.columnFilterMap,[U.propName]:s}});return}if(s===void 0){wt(U.propName);return}const u={...i.columnFilterMap,[U.propName]:s};Ee({...i,columnFilterMap:u})},[wt,i,q,U,L]),Kt=t.useCallback(()=>{const s={searchQuery:"",columnFilterMap:{},sortColumn:T,sortAsc:S};L&&(window.location.hash=j.serializeLocationHash(s)),Re(s),Ee(s)},[L,S,T]),Rt=t.useCallback(()=>{const s=q?.searchQuery||"";L&&(i.searchQuery||s)&&i.searchQuery!==s&&(window.location.hash=j.serializeLocationHash({...q,searchQuery:i.searchQuery}))},[q,i.searchQuery,L]),en=t.useCallback(async s=>{s.preventDefault(),s.stopPropagation(),Y&&Qt(Y)},[Y]),tn=t.useCallback(()=>{v&&(localStorage.removeItem(`${v}.columnNames`),localStorage.removeItem(`${v}.columnWidths`),oe(void 0),je(void 0))},[v]),st=t.useCallback(s=>{if(!Y||!x||!re||!ce)return!0;const d=Y[s];return d&&x[d._index]!==void 0},[ce,re,Y,x]),nn=t.useMemo(()=>Ce?!(x&&!Se)&&!re?e.jsx("div",{style:{width:ue,height:Math.max(50,Ce),border:"1px solid #BBB",textAlign:"center",display:"flex",backgroundColor:"#CCC",alignItems:"center",justifyContent:"center"},children:Se?e.jsx("button",{onClick:De,className:"btn border",children:"Refresh data"}):e.jsx("div",{children:"⌛ Loading..."})}):re&&ce?e.jsx(Mt,{ref:o,isItemLoaded:st,itemCount:ce,loadMoreItems:re,children:({onItemsRendered:d,ref:u})=>e.jsx(Pe.VariableSizeGrid,{className:"mig-schema-table__tbody",estimatedRowHeight:z,height:Ce,width:ue,columnWidth:qe,rowHeight:rt,columnCount:Te,rowCount:$e,ref:u,onItemsRendered:({overscanRowStartIndex:l,overscanRowStopIndex:f,visibleRowStartIndex:N,visibleRowStopIndex:g})=>d({overscanStartIndex:l,overscanStopIndex:f,visibleStartIndex:N,visibleStopIndex:g}),children:ut},`tbody_${Ce}_${ue}_${i.sortColumn}_${i.sortAsc}_${i.searchQuery}_${Te}_${ae.join(" ")}`)}):e.jsx(Pe.VariableSizeGrid,{className:"mig-schema-table__tbody",estimatedRowHeight:z,height:Ce,width:ue,columnWidth:qe,rowHeight:rt,columnCount:Te,rowCount:$e,ref:de,children:ut},`tbody_${Ce}_${ue}_${i.sortColumn}_${i.sortAsc}_${i.searchQuery}_${Te}_${ae.join(" ")}`):null,[Te,ae,qe,rt,o,Se,st,ce,re,De,$e,z,ue,i.searchQuery,i.sortAsc,i.sortColumn,x,Ce,de]),rn=t.useMemo(()=>({...I,width:me?Math.min(ue,Ne):void 0,height:C==="100%"?"100%":void 0,maxHeight:C==="100%"?"100%":void 0}),[C,ue,I,Ne,me]),sn=r||"input";return e.jsx(Me.Provider,{value:{checkedIndexes:b,columnNames:te,columnWidths:ae,config:c,disabledCheckedIndexes:$,displayTimezone:D,dropTargetIndex:Ie,getRowClassName:H,getRowSelected:ee,isColumnFilterable:h,isItemLoaded:st,isSortable:ne,lastCheckChangedRowIndex:be,onRowClick:A,onRowDoubleClick:ie,properties:le,required:Ht,setCheckedIndexes:G,setCustomColumnNames:oe,setCustomColumnWidths:je,setDropTargetIndex:Ke,setFilterSortColumn:nt,setLastCheckChangedRowIndex:ve,setMenuConfig:Q,settingsStorageKey:v,sortedRenderData:Y,sourceData:x,tableDataState:i,translate:k||lt},children:e.jsxs("div",{className:`mig-schema-table${A?" mig-schema-table--clickable-rows":""}`,ref:gt,style:rn,role:"table",children:[e.jsxs("div",{className:"mig-schema-table__action-container",ref:_t,children:[e.jsx("div",{children:Z?e.jsx(sn,{className:"mig-schema-table__search",type:"search",name:"search",autoComplete:"off",placeholder:we||k("search..."),value:i.searchQuery,onChange:Gt,onKeyDown:yt,autoFocus:y,onBlur:Rt}):null}),n?e.jsx(n,{...F,renderData:Y}):e.jsx("div",{className:"mig-schema-table__custom_element_placeholder"}),O&&Array.isArray(_)?e.jsx("span",{className:"mig-schema-table__row_counter",children:k("showingFilteredCountOfTotalCount",Y?.length||0,_.length)}):null,p?e.jsx("button",{onClick:en,style:{marginLeft:8},disabled:!Y?.length,children:k("exportData")}):null,Z||h?e.jsx("button",{onClick:Kt,style:{marginLeft:8},disabled:i.columnFilterMap&&i.searchQuery?Object.keys(i.columnFilterMap).length+i.searchQuery.length===0:!1,children:k("clearFilters")}):null,v?e.jsx("button",{onClick:tn,style:{marginLeft:8},disabled:!Qe&&!ze,children:k("clearSettings")}):null]}),e.jsxs("div",{className:"mig-schema-table__column_resize_container",children:[e.jsx(a,{height:ct,itemCount:Te,itemSize:qe,layout:"horizontal",width:ue,sortAsc:i.sortAsc,setFilterSortColumn:nt,sortColumn:i.sortColumn,sortedRenderData:Y,className:"mig-schema-table__th-row",children:mt},`thead_${ue}_${i.sortColumn}_${i.sortAsc}_${i.searchQuery}_${ae.join(" ")}`),nn,w?e.jsx(jt,{columnWidths:ae,resizeColumnIndex:Xe,setResizeColumnIndex:Ye,tableBodyHeight:Ce}):null]}),x?x.length>0?e.jsx(e.Fragment,{children:kt.createPortal(U?e.jsx(Wt,{isFilterable:h&&U.propConfig?.isFilterable!==!1,isSortable:ht(!!ne,V.properties[U.propName],U.propConfig),onChange:Yt,onClose:Xt,onInputKeyDown:yt,propConfig:U.propConfig,propIsRequired:U.propIsRequired,propName:U.propName,propSchema:V.properties[U.propName],referenceElement:U.referenceElement,setFilterSortColumn:nt,translate:k,value:i.columnFilterMap?i.columnFilterMap[U.propName]:null}):null,document.body)}):e.jsx("div",{className:"mig-schema-table__no_data",children:"No data found"}):null]})})},Pt=t.memo(Zt),Vt=t.memo(({refresh:n,period:r=60})=>{const[a,m]=t.useState(new Date),[b,c]=t.useState(new Date),F=t.useCallback(()=>{c(new Date),n()},[n]),_=t.useMemo(()=>Ve.differenceInSeconds(a,b),[a,b]);t.useEffect(()=>{_>r&&F()},[_,a,b,r,F]),t.useEffect(()=>{const T=setInterval(()=>{m(new Date)},1e3);return()=>{clearInterval(T)}},[]);const W=r-_;return e.jsxs("div",{className:"mx-auto",title:`Refresh ${W>0?`in ${W} seconds`:"NOW"}`,children:["Last update ",Je(b,"HH:mm")]})});E.DEFAULT_DATE_FORMAT=He,E.DEFAULT_DATE_TIME_FORMAT=Le,E.EColumnFilterStatus=xe,E.MINIMUM_COLUMN_WIDTH=Ge,E.RESIZER_WIDTH=dt,E.Refresher=Vt,E.SchemaTable=Pt,E.Th=mt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(E,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("react/jsx-runtime"),require("react"),require("react-dom"),require("react-window"),require("date-fns"),require("date-fns/locale"),require("mig-data-tools"),require("lodash"),require("react-datepicker"),require("date-fns/locale/nl"),require("@date-fns/tz"),require("@floating-ui/react-dom"),require("react-window-infinite-loader"),require("file-saver")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom","react-window","date-fns","date-fns/locale","mig-data-tools","lodash","react-datepicker","date-fns/locale/nl","@date-fns/tz","@floating-ui/react-dom","react-window-infinite-loader","file-saver"],t):(E=typeof globalThis<"u"?globalThis:E||self,t(E["mig-schema-table"]={},E.jsxRuntime,E.React,E.ReactDOM,E.reactWindow,E.dateFns,E.locale,E.migDataTools,E.lodash,E.DatePicker,E.nl,E.tz,E.reactDom,E.InfiniteLoader,E.fileSaver))})(this,(function(E,t,e,kt,Pe,Ve,xt,j,ge,ot,it,Fe,We,Mt,Et){"use strict";function Tt(n){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const a in n)if(a!=="default"){const m=Object.getOwnPropertyDescriptor(n,a);Object.defineProperty(r,a,m.get?m:{enumerable:!0,get:()=>n[a]})}}return r.default=n,Object.freeze(r)}const Dt=Tt(e),Je=(n,r)=>Ve.format(n,r,{locale:xt.nl}).replace(".",""),Lt={"Europe/Amsterdam":"AMS","Europe/Berlin":"AMS","Asia/Jakarta":"JKT","Asia/Bangkok":"JKT",showingFilteredCountOfTotalCount:"Showing {0} of {1}"};function lt(n,...r){let a=Lt[n]||j.unCamel(n);return r.forEach((m,b)=>{a=a.replace(`{${b}}`,`${m}`)}),a}const R="SELECT_ALL_COLUMN_NAME",at=40,He="dd MMM yyyy",Le="dd MMM yyyy HH:mm",Ge=25,ct=50,dt=3;var fe=(n=>(n.GT="GT",n.LT="LT",n.EQ="EQ",n))(fe||{}),xe=(n=>(n.UNAVAILABLE="UNAVAILABLE",n.AVAILABLE="AVAILABLE",n.ACTIVE="ACTIVE",n))(xe||{});const Me=Dt.createContext({checkedIndexes:[],columnNames:[],columnWidths:new Uint16Array,config:{},disabledCheckedIndexes:[],dropTargetIndex:-1,isColumnFilterable:!1,isItemLoaded:()=>!1,isSortable:!1,properties:{},required:[],setCustomColumnNames:j.emptyFn,setCustomColumnWidths:j.emptyFn,setDropTargetIndex:j.emptyFn,setFilterSortColumn:j.emptyFn,setLastCheckChangedRowIndex:j.emptyFn,setMenuConfig:j.emptyFn,tableDataState:{searchQuery:"",columnFilterMap:{},sortColumn:"",sortAsc:!1},translate:j.emptyFn}),At={type:"boolean"},It=({columnIndex:n,rowIndex:r,style:a})=>{const{checkedIndexes:m,columnNames:b,config:c,disabledCheckedIndexes:F,displayTimezone:_,getRowClassName:W,getRowSelected:S,isItemLoaded:T,lastCheckChangedRowIndex:$,onRowClick:D,onRowDoubleClick:y,properties:O,setCheckedIndexes:H,setLastCheckChangedRowIndex:ee,sortedRenderData:M,sourceData:o,translate:h}=e.useContext(Me),p=b[n],w=p===R?At:O[p],Z=c?c[p]:void 0,ne=e.useCallback(v=>{H&&H(I=>I&&I.includes(v)?I.filter(L=>L!==v):I?[...I,v]:[v])},[H]),ce=T(r),re=e.useCallback(v=>{if(!o||!M||!D||!ce)return;const{rowIndex:I}=v.currentTarget.dataset;if(!I)return;const k=M[parseInt(I,10)];D(o[k._index],k._index,v)},[ce,D,M,o]),C=e.useCallback(v=>{if(!o||!M||!y||!T)return;const{rowIndex:I}=v.currentTarget.dataset;if(!I)return;const k=M[parseInt(I,10)];y(o[k._index],k._index,v)},[T,y,M,o]),A=M?M[r]:void 0,{showTimezones:ie,TdBody:X}=Z||{},se=e.useMemo(()=>_?null:j.timeZone.startsWith("Europe/")?"Asia/Jakarta":"Europe/Amsterdam",[_]),z=e.useMemo(()=>{if(!A||!M)return;let v=p===R?void 0:A[p];if(w?.format&&w.format==="date-time"&&ie!==!1){const k=o?o[A._index]:void 0,L=k?k[p]:void 0,de=L?new Date(L):void 0;de&&se&&(v=`${j.localeFormatInTimeZone(de,se,Le)} (${h(se)})`)}const I=["mig-schema-table__td",`mig-schema-table__td--${r%2?"odd":"even"}`,`mig-schema-table__td--prop-${p}`];switch(o&&S&&S(o[A._index],A._index)&&I.push("mig-schema-table__td--selected"),o&&W&&I.push(W(o[A._index],A._index,M)),w?.type){case"boolean":I.push(`text-${Z?.align||"center"}`);break;case"number":case"integer":I.push(`text-${Z?.align||"end"}`);break;default:Z?.align&&I.push(`text-${Z.align}`)}return{"data-row-index":r,"data-column-index":n,style:a,className:I.join(" "),title:v,onClick:p===R?void 0:re,onDoubleClick:p===R?void 0:C}},[A,M,p,w,ie,r,o,S,W,n,a,re,C,se,h,Z]),V=e.useCallback(v=>{if(!ne||!A)return;const I=parseInt(v.currentTarget.dataset.rowIndex);if(v.shiftKey&&$!==void 0){const k=m?.includes($)?$:void 0;if(k!==void 0&&M){const L=r;for(const de of ge.range(L>k?k+1:L,L>k?L+1:k)){const me=M[de]._index;(!F||!F.includes(me))&&ne(me)}}}else ne(A._index);ee(I),we.current?.focus()},[m,F,$,ne,A,r,ee,M]),we=e.useRef(null);if(!A||!z)return null;if(!T||o&&!o[A._index])return t.jsx("div",{...z,children:"loading"});if(p===R)return t.jsx("div",{...z,onMouseDown:V,children:t.jsx("div",{style:{textAlign:"center"},children:t.jsx("input",{ref:we,type:"checkbox",readOnly:!0,checked:m?.includes(A._index),disabled:F?.includes(A._index)})})});if(X&&o)return t.jsx("div",{...z,children:t.jsx(X,{dataIndex:A._index,rowData:o[A._index],rowIndex:r,...Z?.tdBodyProps})});const G=A[p];return w?.format==="url"&&G?t.jsx("a",{href:G,target:"_blank",rel:"noopener noreferrer",...z,children:G}):t.jsx("div",{...z,children:G})},ut=e.memo(It);function Nt(){const{checkedIndexes:n,disabledCheckedIndexes:r,sortedRenderData:a}=e.useContext(Me);return e.useMemo(()=>{const m=[...a||[]].filter(b=>(n?n.includes(b._index):!0)||(r?!r.includes(b._index):!0));return n?.length!==0&&m.length===n?.length},[n,r,a])}function ht(n,r,a){return!!(n&&a?.isSortable!==!1&&(r||a?.renderData||a?.sort))}function ft(){const{setCustomColumnWidths:n,settingsStorageKey:r}=e.useContext(Me);return e.useCallback(a=>{r&&localStorage.setItem(`${r}.columnWidths`,JSON.stringify(Array.from(a))),n(a)},[n,r])}const St=({index:n,style:r})=>{const{checkedIndexes:a,columnNames:m,columnWidths:b,config:c,disabledCheckedIndexes:F,dropTargetIndex:_,isColumnFilterable:W,isSortable:S,setCheckedIndexes:T,properties:$,required:D,setCustomColumnNames:y,setDropTargetIndex:O,setFilterSortColumn:H,setMenuConfig:ee,settingsStorageKey:M,tableDataState:o,sortedRenderData:h,translate:p,displayTimezone:w}=e.useContext(Me),[Z,ne]=e.useState(!1),ce=n===_,re=ft(),C=m[n],A=C===R?{type:"boolean"}:$[C],ie=o.sortColumn===C?o.sortAsc:void 0,X=c?c[C]:void 0;let se=W&&(A||X?.FilterMenu)&&X?.isFilterable!==!1?xe.AVAILABLE:xe.UNAVAILABLE;o.columnFilterMap&&o.columnFilterMap[C]!==void 0&&(se=xe.ACTIVE);const z=ht(S,A,X),V=["mig-schema-table__th",`mig-schema-table__th--filter-${se}`,`mig-schema-table__th--prop-${C}`];V.push(z?"mig-schema-table__th--sortable":"mig-schema-table__th--unsortable"),ie!==void 0&&V.push("mig-schema-table__th--sorted"),Z&&V.push("mig-schema-table__th--dragging"),ce&&V.push("mig-schema-table__th--drop-target");const{format:we}=A||{},{align:G,defaultSortDesc:v,showTimezones:I=!w,title:k}=X||{},L=e.useCallback(()=>{if(z){if(ie===void 0){H(C,!v);return}H(C,!ie)}},[z,v,C,H,ie]),de=D.includes(C),me=e.useCallback(Q=>{const be=Q.currentTarget;ee(ve=>{if(ve?.propName!==C)return{propConfig:X,propIsRequired:de,propName:C,referenceElement:be}})},[X,de,C,ee]),ye=e.useMemo(()=>k!==void 0?k:we==="date-time"&&I?`${p(C)} (${p(w||j.timeZone)})`:p(C),[k,we,I,p,C,w]),oe=e.useCallback((Q,be)=>{if(!m||!b)return;const ve=m.indexOf(Q),P=[...m];P.splice(ve,1);const x=P.indexOf(be);P.splice(x+1,0,Q),y(P);const _e=[...b],pe=_e[ve];_e.splice(ve,1),_e.splice(x+1,0,pe),re(new Uint16Array(_e)),M&&localStorage.setItem(`${M}.columnNames`,JSON.stringify(P))},[m,b,re,M,y]),Ae=e.useCallback(Q=>{oe&&(ne(!0),Q.dataTransfer.effectAllowed="move",Q.dataTransfer.dropEffect="move",Q.dataTransfer.setData("text/plain",C))},[oe,C]),je=e.useCallback(()=>{oe&&(ne(!1),O(-1))},[oe,O]),Xe=e.useCallback(Q=>{oe&&(Q.preventDefault(),O(n))},[n,oe,O]),Ye=e.useCallback(Q=>{if(O(-1),!oe||!C)return;const be=Q.dataTransfer.getData("text/plain");!be||be===C||oe(be,C)},[oe,C,O]),Ie=Nt(),Ke=e.useCallback(()=>{!T||!h||T(Ie?[]:h.map(Q=>Q._index).filter(Q=>!F?.includes(Q)))},[T,h,Ie,F]);if(C===R)return t.jsx("div",{style:r,className:V.join(" "),children:t.jsx("div",{style:{width:"100%",textAlign:"center"},title:`${a?.length||0} selected`,children:t.jsx("input",{type:"checkbox",name:"selectAll",checked:Ie,onChange:Ke})})});switch(A?.type){case"boolean":V.push(`text-${G||"center"}`,`justify-content-${G||"center"}`);break;case"integer":case"number":V.push(`text-${G||"end"}`,`justify-content-${G||"end"}`);break;default:G&&V.push(`text-${G}`)}let U=X?.hoverTitle;return!U&&typeof ye=="string"&&(U=ye),t.jsxs("div",{className:V.join(" "),style:r,title:U,draggable:!0,onDragStart:Ae,onDragEnd:je,onDragOver:Xe,onDrop:Ye,children:[t.jsxs("div",{className:"mig-schema-table__th__label-body",style:{lineHeight:"44px"},onClick:L,children:[t.jsx("span",{className:"mig-schema-table__th__label-body-text",children:ye}),ie===void 0?null:t.jsx("span",{className:"mig-schema-table__th__sort-icon",children:ie?"↓":"↑"})]}),z||se!==xe.UNAVAILABLE?t.jsx("button",{className:"mig-schema-table__th__trigger-el",onClick:me,children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#404040",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"6 9 12 15 18 9"})})}):null]})},mt=e.memo(St),Ot={[fe.GT]:">",[fe.LT]:"<",[fe.EQ]:"="},$t=e.memo(({columnFilterValue:n,onChange:r,onInputKeyDown:a,propIsRequired:m,propName:b,propSchema:c,translate:F})=>{const{displayTimezone:_}=e.useContext(Me),{type:W,format:S,minimum:T,maximum:$}=c||{},D=n,y=S==="date-time";let O,H,ee,M;switch(W){case"number":case"integer":return O=D||{},H=(o,h,p)=>{const w={...O,[o]:h.value===""?void 0:parseInt(h.value)},Z=Object.values(w).find(ne=>isFinite(ne));r(Z!==void 0&&(T===void 0||Z>=T)?w:void 0,p)},t.jsxs("ol",{className:"mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component",children:[m?null:t.jsxs("li",{style:{padding:8},children:[t.jsxs("label",{className:"d-flex",children:[t.jsx("input",{type:"checkbox",style:{marginRight:14},checked:!!O.filterEmpty,onChange:()=>{const{filterEmpty:o,...h}=O;o||(h.filterEmpty=!0),r(Object.keys(h).length?h:void 0,!0)}}),"Hide empty values"]}),t.jsx("hr",{})]}),Object.keys(fe).map(o=>{const h=O[o];return t.jsxs("li",{children:[t.jsx("label",{style:{width:40,paddingLeft:16},children:Ot[o]}),t.jsx("input",{className:"form-control",style:{width:120},type:"number",value:h!==void 0?h:"","data-prop-name":b,onChange:p=>{H(o,p.currentTarget,!1)},onBlur:p=>{H(o,p.currentTarget,!0)},onKeyDown:a,min:T,max:$})]},o)})]});case"boolean":return ee=["✓","✕"],m||ee.push("?"),M=D?"✓":"✕",D===null&&(M="?"),D===void 0&&(M=""),t.jsx("ol",{className:"mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component",children:t.jsx("li",{children:t.jsxs("select",{autoFocus:!0,className:"form-select",value:M,"data-prop-name":b,onChange:o=>{switch(o.currentTarget.value){case"✓":r(!0,!0);break;case"✕":r(!1,!0);break;case"?":r(null,!0);break;default:r(void 0,!0)}},children:[t.jsx("option",{value:"",children:"All"},"all"),ee.map(o=>t.jsx("option",{value:o,children:o},`column-filter-select-${o}`))]})})});case"string":if(c?.enum)return t.jsx("ol",{className:"mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component",children:t.jsx("li",{children:t.jsxs("select",{autoFocus:!0,className:"form-select",value:D,"data-prop-name":b,onChange:o=>{r(o.currentTarget.value||void 0,!0)},children:[t.jsx("option",{value:"",children:"All"},"all"),c.enum.map(o=>t.jsx("option",{value:o,children:F(o)},`column-filter-select-${o}`))]})})});if(y||S==="date"){const o=y?Le:He,h=n||{from:void 0,to:void 0,filterEmpty:void 0};return t.jsxs("ol",{className:"mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component",children:[m?null:t.jsxs("li",{style:{padding:8},children:[t.jsxs("label",{className:"d-flex",children:[t.jsx("input",{type:"checkbox",checked:!!h.filterEmpty,onChange:()=>{const{filterEmpty:p,...w}=h;p||(w.filterEmpty=!0),r(Object.keys(w).length?w:void 0,!0)}}),"Hide empty values"]}),t.jsx("hr",{})]}),t.jsxs("li",{style:{padding:8},children:[t.jsx("label",{style:{width:120,paddingLeft:4},children:"After"}),t.jsx(ot,{dateFormat:o,"data-prop-name":b,locale:it.nl,selected:h.from?new Fe.TZDate(h.from).withTimeZone(_||j.timeZone):null,onChange:p=>{if(!p&&!h.to){r(void 0,!0);return}if(h.to&&p&&p>h.to)return;const w=p?Fe.TZDate.tz(_||j.timeZone,p):void 0;r({...n,from:w},!0)},placeholderText:o,isClearable:!0,selectsStart:!0,showTimeSelect:y,showTimeInput:y,showMonthDropdown:!0,showYearDropdown:!0,timeIntervals:15,shouldCloseOnSelect:!y})]}),t.jsxs("li",{style:{padding:8},children:[t.jsx("label",{style:{width:120,paddingLeft:4},children:"Before"}),t.jsx(ot,{id:"filter-date",dateFormat:o,"data-prop-name":b,locale:it.nl,selectsEnd:!0,selected:h.to?new Fe.TZDate(h.to).withTimeZone(_||j.timeZone):null,showMonthDropdown:!0,showYearDropdown:!0,onChange:p=>{if(!p&&!h.from){r(void 0,!0);return}const w=p?y?Fe.TZDate.tz(_||j.timeZone,p):Ve.endOfDay(p):void 0;h.from&&w&&w<h.from||r({...n,to:w},!0)},placeholderText:o,isClearable:!0,startDate:h.from,endDate:h.to,showTimeInput:y,showTimeSelect:y,timeIntervals:15,shouldCloseOnSelect:!y})]})]})}default:return t.jsx("ol",{className:"mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component",children:t.jsx("li",{children:t.jsx("input",{autoFocus:!0,type:"search",className:"form-control",placeholder:`Search ${b}`,"aria-label":`Search ${b}`,value:D||"","data-prop-name":b,onChange:o=>{r(o.currentTarget.value||void 0,!1)},onKeyDown:a,onBlur:o=>{r(o.currentTarget.value||void 0,!0)}})})})}}),Ft=({isSortable:n,isFilterable:r,onChange:a,onClose:m,onInputKeyDown:b,propConfig:c,propIsRequired:F,propName:_,propSchema:W,referenceElement:S,setFilterSortColumn:T,translate:$,value:D})=>{const y=We.useFloating({placement:"bottom-start",elements:{reference:S},middleware:[We.flip()]}),O=We.useFloating({placement:"right-start",middleware:[We.flip()]});e.useEffect(()=>{const h=p=>{if(!y.elements.floating)return;let w=p.target;for(;w&&y.elements.floating;){if(w===y.elements.floating||w===O.elements.floating)return;w=w.parentNode===window.document?null:w.parentNode}m(p)};return window.addEventListener("click",h,{capture:!0}),()=>{window.removeEventListener("click",h,{capture:!0})}},[y.elements.floating,m,O.elements.floating]);const H=c?.FilterMenu||$t,ee=e.useCallback(h=>{T(_,!0),m(h)},[m,_,T]),M=e.useCallback(h=>{T(_,!1),m(h)},[m,_,T]),o=e.useCallback(()=>{a(void 0,!0)},[a]);return!n&&!r?null:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"mig-schema-table mig-schema-table__th-menu",ref:y.refs.setFloating,style:y.floatingStyles,children:t.jsxs("ol",{className:"mig-schema-table-menu",children:[n?t.jsxs("li",{onClick:ee,style:{padding:8},children:[t.jsx("span",{className:"mig-schema-table__th-menu__icon",children:"↓"})," ",$("sortAscending")]}):null,n?t.jsxs("li",{onClick:M,style:{padding:8},children:[t.jsx("span",{className:"mig-schema-table__th-menu__icon",children:"↑"})," ",$("sortDescending")]}):null,r?t.jsxs("li",{style:{padding:8},onMouseOver:h=>{O.refs.setReference(h.currentTarget)},children:[t.jsx("span",{className:"mig-schema-table__th-menu__icon",children:t.jsx("input",{type:"checkbox",id:"mig-schema-table__th-menu__filters",checked:D!==void 0,disabled:D===void 0,onChange:o})}),t.jsx("label",{htmlFor:"mig-schema-table__th-menu__filters",children:$("filters")}),t.jsx("div",{className:"mig-schema-table__th-menu__sub-menu-indicator"})]}):null]})}),O.elements.reference?t.jsx("div",{className:"mig-schema-table mig-schema-table__th-menu__sub-menu",ref:O.refs.setFloating,style:O.floatingStyles,children:t.jsx(H,{columnFilterValue:D,onChange:a,onInputKeyDown:b,propIsRequired:F,propName:_,propSchema:W,translate:$})}):null]})},Wt=e.memo(Ft),jt=({columnWidths:n,resizeColumnIndex:r,setResizeColumnIndex:a,tableBodyHeight:m})=>{const[b,c]=e.useState(0),F=ft(),_=e.useCallback($=>{const D=n.map((y,O)=>O===r?Math.max(y+$,Ge):y);F(D)},[n,r,F]);let W=0;const S=e.useCallback($=>{a(parseInt($.currentTarget.dataset.columnIndex)),c($.clientX)},[a]),T=e.useCallback($=>{_($.clientX-b),c(0),a(-1)},[b,_,a]);return t.jsx("div",{children:[...n].map(($,D)=>{W+=$;const y=["mig-schema-table__column_resizer"];return D===r&&y.push("mig-schema-table__column_resizer--dragged"),t.jsx("div",{style:{left:W-dt,bottom:m},className:y.join(" "),draggable:"true","data-column-index":D,onDragStart:S,onDragEnd:T},D)})})},bt=n=>{const[r,a]=e.useState({width:0,height:0}),m=e.useMemo(()=>ge.debounce(a,100),[]);return e.useEffect(()=>{if(!n)return;const b=new ResizeObserver(c=>{for(const F of c){const{blockSize:_,inlineSize:W}=F.borderBoxSize[0];m(S=>W&&_&&(S.width!==W||S.height!==_)?{width:W,height:_}:S)}});return b.observe(n),()=>{b.disconnect()}},[m,n]),r},Bt=()=>new Promise((n,r)=>{if(window.ExcelJS){n(window.ExcelJS);return}const a=document.createElement("script");a.src="https://cdnjs.cloudflare.com/ajax/libs/exceljs/4.4.0/exceljs.bare.min.js",a.onload=()=>{n(window.ExcelJS)},a.onerror=()=>{r(new Error("Failed to load ExcelJS library"))},document.head.appendChild(a)}),Qt=async n=>{const{Workbook:r}=await Bt(),a=new r,m=a.addWorksheet("Data");n.length&&(m.addRow(ge.difference(Object.keys(n[0]),["_index","SELECT_ALL_COLUMN_NAME"])),m.getRow(1).font={bold:!0},m.addRows(n.map(b=>{const{_index:c,SELECT_ALL_COLUMN_NAME:F,..._}=b;return Object.values(_)})),a.xlsx.writeBuffer().then(b=>{const c=new Blob([b],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});Et.saveAs(c,"export.xlsx")}).catch(b=>{console.error("Error generating Excel file:",b)}))},pt=new Date("1000-01-01 00:00:00Z"),zt=new Intl.NumberFormat("nl-NL"),Ut=new Intl.NumberFormat("nl-NL",{style:"currency",currency:"EUR"});function qt(n,r){const{TdBody:a,sortByValue:m}=r||{};if(m!==void 0)return m;if(!n)return!1;const{format:b,type:c}=n;return b?.startsWith("date")||c==="boolean"||c==="integer"||c==="number"||!!a}const Zt=({CustomElement:n,CustomSearchInput:r,Heading:a=Pe.VariableSizeList,autoRender:m,checkedIndexes:b,config:c,customElementProps:F,data:_,defaultColumnFilters:W,defaultSortAsc:S=!1,defaultSortColumn:T,disabledCheckedIndexes:$,displayTimezone:D,enableAutoFocus:y=!0,enableRowCounter:O=!0,getRowClassName:H,getRowSelected:ee,getSearchQueryFilterResult:M,infiniteLoaderRef:o,isColumnFilterable:h=!0,isExportable:p=!0,isResizable:w=!0,isSearchable:Z=!0,isSortable:ne=!0,itemCount:ce,loadMoreItems:re,maxHeight:C,onRowClick:A,onRowDoubleClick:ie,onSearchEnter:X,onTableDataStateChange:se,rowHeight:z=36,schema:V,searchPlaceholder:we,setCheckedIndexes:G,settingsStorageKey:v,style:I,translate:k=lt,useFilterStateHash:L,variableSizeGridRef:de,width:me})=>{const[ye,oe]=e.useState(),[Ae,je]=e.useState(),[Xe,Ye]=e.useState(-1),[Ie,Ke]=e.useState(-1),[U,Q]=e.useState(),[be,ve]=e.useState(),P=_ instanceof Function,[x,_e]=e.useState(P?void 0:_),[pe,Re]=e.useState(),[i,Ee]=e.useState({searchQuery:"",columnFilterMap:W||{},sortColumn:T,sortAsc:S}),[q,Jt]=e.useState(L?j.parseLocationHash(window.location.hash):null);e.useEffect(()=>{P||_e(_)},[_,P]),e.useEffect(()=>{!P||x!==void 0||_(q&&Object.keys(q).length!==0?{...q,columnFilterMap:q.columnFilterMap||{}}:i).then(_e)},[_,P,q,x,i]),e.useEffect(()=>{pe||Re(i)},[i,pe]),e.useEffect(()=>{if(!L)return;const s=()=>{Jt(j.parseLocationHash(window.location.hash))};return window.addEventListener("hashchange",s),()=>{window.removeEventListener("hashchange",s)}},[L]),e.useEffect(()=>{if(!L)return;const{columnFilterMap:s,searchQuery:d,sortAsc:u,sortColumn:l}=q||{},f={searchQuery:d||"",columnFilterMap:s||W||{},sortAsc:u===void 0?S:u,sortColumn:l===void 0?T:l};Ee(N=>ge.isEqual(f,N)?N:f)},[q,L,W,S,T]),e.useEffect(()=>{se&&se(i)},[se,i]);const gt=e.useRef(null),_t=e.useRef(null),Be=bt(gt.current),Ct=bt(_t.current),Ne=e.useMemo(()=>me||Math.floor(Be.width||0),[Be.width,me]),Se=e.useMemo(()=>!ge.isEqual(i,pe)&&P,[i,pe,P]),{properties:le,required:Ht}=e.useMemo(()=>({properties:{},required:[],...V}),[V]),Qe=v?localStorage.getItem(`${v}.columnNames`):null,ze=v?localStorage.getItem(`${v}.columnWidths`):null,te=e.useMemo(()=>{if(ye)return ye;const s=Qe?JSON.parse(Qe):void 0;let d=Object.keys(le);if(G&&d.unshift(R),c){Object.keys(c).forEach(l=>{d.includes(l)||d.push(l)});const u=Object.entries(c).reduce((l,[f,N])=>(N.hidden&&l.push(f),l),[]);d=d.filter(l=>!u.includes(l)).sort((l,f)=>{let N=c[l]?c[l].order:void 0;N===void 0&&(N=Object.keys(le).findIndex(K=>K===l));let g=c[f]?c[f].order:void 0;return g===void 0&&(g=Object.keys(le).findIndex(K=>K===f)),f===R||l===R?0:N===-1?1:g===-1?-1:N-g})}return s?.length===d.length?s:d},[c,ye,G,le,Qe]),Ue=e.useMemo(()=>x&&te?x.map((s,d)=>te.reduce((u,l)=>{const f=le[l],N=c?c[l]:void 0;if(N?.renderData)return u[l]=N.renderData(s,d),u;if(!f||l===R)return u[l]="",u;const g=s?s[l]:"";switch(f.type){case"array":return u[l]=f.items?.type==="string"&&g?g.map(K=>k(K)).join(", "):JSON.stringify(g),u;case"boolean":return u[l]=g===void 0?"?":g?"✓":"✕",u;case"number":case"integer":return g===void 0?(u[l]="",u):(u[l]=f.format==="currency"?Ut.format(g):zt.format(g),u);case"string":if(f.format==="date"&&g)return u[l]=["2999-12-31","1970-01-01"].includes(g)?"-":Je(new Date(g),N?.dateFormat||He),u;if(f.format==="date-time"&&g)return u[l]=D?j.localeFormatInTimeZone(new Date(g),D,Le):Je(new Date(g),N?.dateFormat||Le),u;if(f.enum)return u[l]=g?k(g):"",u;default:return u[l]=g?`${g}`:"",u}},{_index:d})):void 0,[x,te,le,c,k,D]),Te=te?te.length:0,{dynamicWidthColumnCount:et,fixedWidthColumnsWidth:tt}=e.useMemo(()=>{let s=0,d=0;return(te||[]).forEach(u=>{if(u===R){s+=at;return}const l=c?c[u]:void 0;l?.width?s+=l.width:d+=1},0),{dynamicWidthColumnCount:d,fixedWidthColumnsWidth:s}},[te,c]),ae=e.useMemo(()=>{if(Ae)return new Uint16Array(Ae);const s=ze?new Uint16Array(JSON.parse(ze)):void 0,d=Math.max(Math.floor((Ne-tt)/et),Ge);let u=(Ne-tt)%et;const l=new Uint16Array(te.map(f=>{if(f===R)return at;const N=c?c[f]:void 0;return N?.width?N?.width:u?(u-=1,d+1):d}));return s?.length===l.length?s:l},[te,c,Ae,et,tt,ze,Ne]),qe=e.useCallback(s=>ae?ae[s]:1,[ae]),Oe=e.useMemo(()=>{if(!Ue||!h&&!Z||P)return Ue;const{searchQuery:s}=i,d=s.toLowerCase()||"",u=l=>x&&M?M(x[l._index],s):!(te&&!te.find(f=>`${l[f]}`.toLowerCase().includes(d)));return Ue.filter(l=>{let f=u(l);return!f||!i.columnFilterMap?!1:(Object.entries(i.columnFilterMap).forEach(([N,g])=>{if(!f||g===void 0)return;const K=c?c[N]:void 0;if(x&&K?.filter){f=K.filter(x[l._index],g);return}const he=le[N],B=x[l._index]?.[N];switch(he?.type){case"boolean":case"number":case"integer":if(g&&typeof g=="object"){g.filterEmpty&&B===void 0&&(f=!1);for(const J of Object.keys(fe)){const ke=g[J];if(f&&ge.isFinite(ke))switch(J){case fe.EQ:B!==ke&&(f=!1);break;case fe.GT:B<=ke&&(f=!1);break;case fe.LT:B>=ke&&(f=!1);break}}}else{if(B===void 0&&g===null)return!0;f=B===g}break;case"string":if(typeof g=="object"&&(he.format==="date"||he.format==="date-time")){const{from:J,to:ke,filterEmpty:vt}=g;if(!B)f=!vt;else{const Ze=B?new Date(B):void 0;(vt===!1||J&&(!Ze||Ze<J)||ke&&(!Ze||Ze>ke))&&(f=!1)}return}default:if(he?.enum){f=B===g;return}f=`${l[N]}`.toLowerCase().includes(`${g}`.toLowerCase())}}),f)})},[Ue,h,Z,P,i,M,te,c,x,le]),Y=e.useMemo(()=>{const{sortAsc:s,sortColumn:d}=i;if(!d||!Oe||!x||P)return Oe;const u=le[d],l=c?c[d]:void 0,f=l?.sort;if(f)return Oe.sort((K,he)=>{const B=x[K._index],J=x[he._index];return B?J?f(B,J,s===void 0?S:s):-1:1});const N=u&&u.format?.startsWith("date"),g=qt(u,l);return Oe.sort((K,he)=>{let B=g&&x[K._index]?x[K._index][d]:`${K[d]}`.toLowerCase(),J=g&&x[he._index]?x[he._index][d]:`${he[d]}`.toLowerCase();return g&&N&&(B=new Date(B),isNaN(B.getTime())&&(B=pt),J=new Date(J),isNaN(J.getTime())&&(J=pt)),B===J?0:B?J?(B<J?1:-1)*(s?-1:1):s?1:-1:s?-1:1})},[c,S,Oe,P,le,x,i]),wt=e.useCallback(s=>{const d={...i.columnFilterMap};delete d[s],Ee({...i,columnFilterMap:d})},[i]),nt=e.useCallback((s,d)=>{if(L){window.location.hash=j.serializeLocationHash({...q,sortColumn:s,sortAsc:d});return}Ee({...i,sortColumn:s,sortAsc:d})},[i,q,L]),Gt=e.useCallback(s=>{Ee({...i,searchQuery:s.currentTarget.value})},[i]),De=e.useCallback(()=>{Re(i),_e(void 0)},[i]);e.useEffect(()=>{if(!m||!q||!pe||!L)return;const s=Object.keys(q);let d=!1;for(const u of s){const l=q[u],f=pe[u];if(typeof l=="string"&&l!==f){d=!0;break}if(typeof l=="object"&&!ge.isEqual(l,f)){d=!0;break}}d&&De()},[m,q,pe,De,L]);const yt=e.useCallback(s=>{s.key==="Enter"&&(Q(void 0),Se&&De(),X&&s.currentTarget.className==="mig-schema-table__search"&&X(i.searchQuery||""))},[Se,i.searchQuery,X,De]),rt=e.useCallback(()=>z,[z]),ue=e.useMemo(()=>ge.sum(ae),[ae]),$e=e.useMemo(()=>Y?Y.length:0,[Y]),Ce=e.useMemo(()=>{const s=z*$e;let d;if(C&&(d=C==="100%"?Be.height:C,!d))return 0;const u=d?d-Ct.height-ct:0;return u&&u<s?u:s},[z,$e,C,Ct,Be.height]),Xt=e.useCallback(s=>{Q(void 0),s.preventDefault(),s.stopPropagation()},[]),Yt=e.useCallback((s,d)=>{if(!U)return;if(L&&d!==!1){window.location.hash=j.serializeLocationHash({...q,columnFilterMap:{...i.columnFilterMap,[U.propName]:s}});return}if(s===void 0){wt(U.propName);return}const u={...i.columnFilterMap,[U.propName]:s};Ee({...i,columnFilterMap:u})},[wt,i,q,U,L]),Kt=e.useCallback(()=>{const s={searchQuery:"",columnFilterMap:{},sortColumn:T,sortAsc:S};L&&(window.location.hash=j.serializeLocationHash(s)),Re(s),Ee(s)},[L,S,T]),Rt=e.useCallback(()=>{const s=q?.searchQuery||"";L&&(i.searchQuery||s)&&i.searchQuery!==s&&(window.location.hash=j.serializeLocationHash({...q,searchQuery:i.searchQuery}))},[q,i.searchQuery,L]),en=e.useCallback(async s=>{s.preventDefault(),s.stopPropagation(),Y&&await Qt(Y)},[Y]),tn=e.useCallback(()=>{v&&(localStorage.removeItem(`${v}.columnNames`),localStorage.removeItem(`${v}.columnWidths`),oe(void 0),je(void 0))},[v]),st=e.useCallback(s=>{if(!Y||!x||!re||!ce)return!0;const d=Y[s];return d&&x[d._index]!==void 0},[ce,re,Y,x]),nn=e.useMemo(()=>Ce?!(x&&!Se)&&!re?t.jsx("div",{style:{width:ue,height:Math.max(50,Ce),border:"1px solid #BBB",textAlign:"center",display:"flex",backgroundColor:"#CCC",alignItems:"center",justifyContent:"center"},children:Se?t.jsx("button",{onClick:De,className:"btn border",children:"Refresh data"}):t.jsx("div",{children:"⌛ Loading..."})}):re&&ce?t.jsx(Mt,{ref:o,isItemLoaded:st,itemCount:ce,loadMoreItems:re,children:({onItemsRendered:d,ref:u})=>t.jsx(Pe.VariableSizeGrid,{className:"mig-schema-table__tbody",estimatedRowHeight:z,height:Ce,width:ue,columnWidth:qe,rowHeight:rt,columnCount:Te,rowCount:$e,ref:u,onItemsRendered:({overscanRowStartIndex:l,overscanRowStopIndex:f,visibleRowStartIndex:N,visibleRowStopIndex:g})=>d({overscanStartIndex:l,overscanStopIndex:f,visibleStartIndex:N,visibleStopIndex:g}),children:ut},`tbody_${Ce}_${ue}_${i.sortColumn}_${i.sortAsc}_${i.searchQuery}_${Te}_${ae.join(" ")}`)}):t.jsx(Pe.VariableSizeGrid,{className:"mig-schema-table__tbody",estimatedRowHeight:z,height:Ce,width:ue,columnWidth:qe,rowHeight:rt,columnCount:Te,rowCount:$e,ref:de,children:ut},`tbody_${Ce}_${ue}_${i.sortColumn}_${i.sortAsc}_${i.searchQuery}_${Te}_${ae.join(" ")}`):null,[Te,ae,qe,rt,o,Se,st,ce,re,De,$e,z,ue,i.searchQuery,i.sortAsc,i.sortColumn,x,Ce,de]),rn=e.useMemo(()=>({...I,width:me?Math.min(ue,Ne):void 0,height:C==="100%"?"100%":void 0,maxHeight:C==="100%"?"100%":void 0}),[C,ue,I,Ne,me]),sn=r||"input";return t.jsx(Me.Provider,{value:{checkedIndexes:b,columnNames:te,columnWidths:ae,config:c,disabledCheckedIndexes:$,displayTimezone:D,dropTargetIndex:Ie,getRowClassName:H,getRowSelected:ee,isColumnFilterable:h,isItemLoaded:st,isSortable:ne,lastCheckChangedRowIndex:be,onRowClick:A,onRowDoubleClick:ie,properties:le,required:Ht,setCheckedIndexes:G,setCustomColumnNames:oe,setCustomColumnWidths:je,setDropTargetIndex:Ke,setFilterSortColumn:nt,setLastCheckChangedRowIndex:ve,setMenuConfig:Q,settingsStorageKey:v,sortedRenderData:Y,sourceData:x,tableDataState:i,translate:k||lt},children:t.jsxs("div",{className:`mig-schema-table${A?" mig-schema-table--clickable-rows":""}`,ref:gt,style:rn,role:"table",children:[t.jsxs("div",{className:"mig-schema-table__action-container",ref:_t,children:[t.jsx("div",{children:Z?t.jsx(sn,{className:"mig-schema-table__search",type:"search",name:"search",autoComplete:"off",placeholder:we||k("search..."),value:i.searchQuery,onChange:Gt,onKeyDown:yt,autoFocus:y,onBlur:Rt}):null}),n?t.jsx(n,{...F,renderData:Y}):t.jsx("div",{className:"mig-schema-table__custom_element_placeholder"}),O&&Array.isArray(_)?t.jsx("span",{className:"mig-schema-table__row_counter",children:k("showingFilteredCountOfTotalCount",Y?.length||0,_.length)}):null,p?t.jsx("button",{onClick:en,style:{marginLeft:8},disabled:!Y?.length,children:k("exportData")}):null,Z||h?t.jsx("button",{onClick:Kt,style:{marginLeft:8},disabled:i.columnFilterMap&&i.searchQuery?Object.keys(i.columnFilterMap).length+i.searchQuery.length===0:!1,children:k("clearFilters")}):null,v?t.jsx("button",{onClick:tn,style:{marginLeft:8},disabled:!Qe&&!ze,children:k("clearSettings")}):null]}),t.jsxs("div",{className:"mig-schema-table__column_resize_container",children:[t.jsx(a,{height:ct,itemCount:Te,itemSize:qe,layout:"horizontal",width:ue,sortAsc:i.sortAsc,setFilterSortColumn:nt,sortColumn:i.sortColumn,sortedRenderData:Y,className:"mig-schema-table__th-row",children:mt},`thead_${ue}_${i.sortColumn}_${i.sortAsc}_${i.searchQuery}_${ae.join(" ")}`),nn,w?t.jsx(jt,{columnWidths:ae,resizeColumnIndex:Xe,setResizeColumnIndex:Ye,tableBodyHeight:Ce}):null]}),x&&x.length===0?t.jsx("div",{className:"mig-schema-table__no_data",children:"No data found"}):null,U?kt.createPortal(t.jsx(Wt,{isFilterable:h&&U.propConfig?.isFilterable!==!1,isSortable:ht(ne,V.properties[U.propName],U.propConfig),onChange:Yt,onClose:Xt,onInputKeyDown:yt,propConfig:U.propConfig,propIsRequired:U.propIsRequired,propName:U.propName,propSchema:V.properties[U.propName],referenceElement:U.referenceElement,setFilterSortColumn:nt,translate:k,value:i.columnFilterMap?i.columnFilterMap[U.propName]:null}),document.body):null]})})},Pt=e.memo(Zt),Vt=e.memo(({refresh:n,period:r=60})=>{const[a,m]=e.useState(new Date),[b,c]=e.useState(new Date),F=e.useCallback(()=>{c(new Date),n()},[n]),_=e.useMemo(()=>Ve.differenceInSeconds(a,b),[a,b]);e.useEffect(()=>{_>r&&F()},[_,a,b,r,F]),e.useEffect(()=>{const T=setInterval(()=>{m(new Date)},1e3);return()=>{clearInterval(T)}},[]);const W=r-_;return t.jsxs("div",{className:"mx-auto",title:`Refresh ${W>0?`in ${W} seconds`:"NOW"}`,children:["Last update ",Je(b,"HH:mm")]})});E.DEFAULT_DATE_FORMAT=He,E.DEFAULT_DATE_TIME_FORMAT=Le,E.EColumnFilterStatus=xe,E.MINIMUM_COLUMN_WIDTH=Ge,E.RESIZER_WIDTH=dt,E.Refresher=Vt,E.SchemaTable=Pt,E.Th=mt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mig-schema-table",
3
- "version": "5.0.8",
3
+ "version": "5.0.10",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -28,7 +28,7 @@
28
28
  "@floating-ui/react-dom": "^2.1.6",
29
29
  "date-fns": "^4.1.0",
30
30
  "file-saver": "^2.0.5",
31
- "lodash": "^4.17.21",
31
+ "lodash": "^4.17.23",
32
32
  "mig-data-tools": "^1.0.10",
33
33
  "react-datepicker": "^8.9.0",
34
34
  "react-window": "^1.8.10",
@@ -45,29 +45,29 @@
45
45
  "@storybook/react": "^8.1.2",
46
46
  "@storybook/test": "^8.1.2",
47
47
  "@testing-library/jest-dom": "^6.4.5",
48
- "@testing-library/react": "^15.0.7",
48
+ "@testing-library/react": "^16.1.0",
49
49
  "@types/file-saver": "^2.0.7",
50
50
  "@types/jest": "^29.5.12",
51
51
  "@types/lodash": "^4.17.4",
52
- "@types/react": "^18.2.66",
53
- "@types/react-dom": "^18.2.22",
52
+ "@types/react": "^19.0.0",
53
+ "@types/react-dom": "^19.0.0",
54
54
  "@types/react-window": "^1.8.8",
55
55
  "@types/react-window-infinite-loader": "^1.0.9",
56
56
  "@vitejs/plugin-react-swc": "^4.2.2",
57
57
  "eslint": "^9.39.1",
58
- "eslint-plugin-react-hooks": "^7.0.1",
58
+ "eslint-plugin-react-hooks": "^5.0.0",
59
59
  "eslint-plugin-react-refresh": "^0.4.24",
60
60
  "openapi3-ts": "^4.3.1",
61
61
  "prettier": "^3.2.5",
62
62
  "sass": "^1.77.2",
63
- "typescript": "^5.8.2",
63
+ "typescript": "^5.9.3",
64
64
  "typescript-eslint": "^8.46.4",
65
65
  "vite": "^7.2.2",
66
66
  "vite-plugin-dts": "^4.5.4"
67
67
  },
68
68
  "peerDependencies": {
69
- "react": "^18.2.0",
70
- "react-dom": "^18.2.0"
69
+ "react": ">=18.2.0",
70
+ "react-dom": ">=18.2.0"
71
71
  },
72
72
  "repository": {
73
73
  "type": "git",