mig-schema-table 5.0.6 → 5.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mig-schema-table.es.js +273 -268
- package/dist/mig-schema-table.umd.js +1 -1
- package/package.json +1 -1
|
@@ -25,8 +25,8 @@ const tt = (n, o) => (
|
|
|
25
25
|
};
|
|
26
26
|
function ft(n, ...o) {
|
|
27
27
|
let u = Kt[n] || Vt(n);
|
|
28
|
-
return o.forEach((
|
|
29
|
-
u = u.replace(`{${
|
|
28
|
+
return o.forEach((p, f) => {
|
|
29
|
+
u = u.replace(`{${f}}`, `${p}`);
|
|
30
30
|
}), u;
|
|
31
31
|
}
|
|
32
32
|
const K = "SELECT_ALL_COLUMN_NAME", bt = 40, vt = "dd MMM yyyy", Je = "dd MMM yyyy HH:mm", kt = 25, gt = 50, en = 3;
|
|
@@ -58,24 +58,24 @@ const Me = Ft.createContext({
|
|
|
58
58
|
translate: ve
|
|
59
59
|
}), tn = { type: "boolean" }, nn = ({ columnIndex: n, rowIndex: o, style: u }) => {
|
|
60
60
|
const {
|
|
61
|
-
checkedIndexes:
|
|
62
|
-
columnNames:
|
|
61
|
+
checkedIndexes: p,
|
|
62
|
+
columnNames: f,
|
|
63
63
|
config: l,
|
|
64
|
-
disabledCheckedIndexes:
|
|
64
|
+
disabledCheckedIndexes: $,
|
|
65
65
|
displayTimezone: _,
|
|
66
|
-
getRowClassName:
|
|
66
|
+
getRowClassName: O,
|
|
67
67
|
getRowSelected: W,
|
|
68
68
|
isItemLoaded: T,
|
|
69
|
-
lastCheckChangedRowIndex:
|
|
69
|
+
lastCheckChangedRowIndex: I,
|
|
70
70
|
onRowClick: M,
|
|
71
71
|
onRowDoubleClick: y,
|
|
72
|
-
properties:
|
|
72
|
+
properties: S,
|
|
73
73
|
setCheckedIndexes: q,
|
|
74
74
|
setLastCheckChangedRowIndex: ee,
|
|
75
75
|
sortedRenderData: D,
|
|
76
76
|
sourceData: s,
|
|
77
77
|
translate: m
|
|
78
|
-
} = e.useContext(Me),
|
|
78
|
+
} = e.useContext(Me), b = f[n], w = b === K ? tn : S[b], U = l ? l[b] : void 0, te = e.useCallback(
|
|
79
79
|
(v) => {
|
|
80
80
|
q && q((A) => A && A.includes(v) ? A.filter((E) => E !== v) : A ? [...A, v] : [v]);
|
|
81
81
|
},
|
|
@@ -105,9 +105,9 @@ const Me = Ft.createContext({
|
|
|
105
105
|
), L = D ? D[o] : void 0, { showTimezones: se, TdBody: G } = U || {}, re = e.useMemo(() => _ ? null : Te.startsWith("Europe/") ? "Asia/Jakarta" : "Europe/Amsterdam", [_]), B = e.useMemo(() => {
|
|
106
106
|
if (!L || !D)
|
|
107
107
|
return;
|
|
108
|
-
let v =
|
|
108
|
+
let v = b === K ? void 0 : L[b];
|
|
109
109
|
if (w?.format && w.format === "date-time" && se !== !1) {
|
|
110
|
-
const k = s ? s[L._index] : void 0, E = k ? k[
|
|
110
|
+
const k = s ? s[L._index] : void 0, E = k ? k[b] : void 0, ce = E ? new Date(E) : void 0;
|
|
111
111
|
ce && re && (v = `${yt(
|
|
112
112
|
ce,
|
|
113
113
|
re,
|
|
@@ -117,10 +117,10 @@ const Me = Ft.createContext({
|
|
|
117
117
|
const A = [
|
|
118
118
|
"mig-schema-table__td",
|
|
119
119
|
`mig-schema-table__td--${o % 2 ? "odd" : "even"}`,
|
|
120
|
-
`mig-schema-table__td--prop-${
|
|
120
|
+
`mig-schema-table__td--prop-${b}`
|
|
121
121
|
];
|
|
122
|
-
switch (s && W && W(s[L._index], L._index) && A.push("mig-schema-table__td--selected"), s &&
|
|
123
|
-
|
|
122
|
+
switch (s && W && W(s[L._index], L._index) && A.push("mig-schema-table__td--selected"), s && O && A.push(
|
|
123
|
+
O(s[L._index], L._index, D)
|
|
124
124
|
), w?.type) {
|
|
125
125
|
case "boolean":
|
|
126
126
|
A.push(`text-${U?.align || "center"}`);
|
|
@@ -138,19 +138,19 @@ const Me = Ft.createContext({
|
|
|
138
138
|
style: u,
|
|
139
139
|
className: A.join(" "),
|
|
140
140
|
title: v,
|
|
141
|
-
onClick:
|
|
142
|
-
onDoubleClick:
|
|
141
|
+
onClick: b === K ? void 0 : ne,
|
|
142
|
+
onDoubleClick: b === K ? void 0 : C
|
|
143
143
|
};
|
|
144
144
|
}, [
|
|
145
145
|
L,
|
|
146
146
|
D,
|
|
147
|
-
|
|
147
|
+
b,
|
|
148
148
|
w,
|
|
149
149
|
se,
|
|
150
150
|
o,
|
|
151
151
|
s,
|
|
152
152
|
W,
|
|
153
|
-
|
|
153
|
+
O,
|
|
154
154
|
n,
|
|
155
155
|
u,
|
|
156
156
|
ne,
|
|
@@ -163,8 +163,8 @@ const Me = Ft.createContext({
|
|
|
163
163
|
if (!te || !L)
|
|
164
164
|
return;
|
|
165
165
|
const A = parseInt(v.currentTarget.dataset.rowIndex);
|
|
166
|
-
if (v.shiftKey &&
|
|
167
|
-
const k =
|
|
166
|
+
if (v.shiftKey && I !== void 0) {
|
|
167
|
+
const k = p?.includes(I) ? I : void 0;
|
|
168
168
|
if (k !== void 0 && D) {
|
|
169
169
|
const E = o;
|
|
170
170
|
for (const ce of Pt(
|
|
@@ -172,7 +172,7 @@ const Me = Ft.createContext({
|
|
|
172
172
|
E > k ? E + 1 : k
|
|
173
173
|
)) {
|
|
174
174
|
const me = D[ce]._index;
|
|
175
|
-
(
|
|
175
|
+
(!$ || !$.includes(me)) && te(me);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
} else
|
|
@@ -180,9 +180,9 @@ const Me = Ft.createContext({
|
|
|
180
180
|
ee(A), _e.current?.focus();
|
|
181
181
|
},
|
|
182
182
|
[
|
|
183
|
-
|
|
184
|
-
I,
|
|
183
|
+
p,
|
|
185
184
|
$,
|
|
185
|
+
I,
|
|
186
186
|
te,
|
|
187
187
|
L,
|
|
188
188
|
o,
|
|
@@ -194,15 +194,15 @@ const Me = Ft.createContext({
|
|
|
194
194
|
return null;
|
|
195
195
|
if (!T || s && !s[L._index])
|
|
196
196
|
return /* @__PURE__ */ t("div", { ...B, children: "loading" });
|
|
197
|
-
if (
|
|
197
|
+
if (b === K)
|
|
198
198
|
return /* @__PURE__ */ t("div", { ...B, onMouseDown: V, children: /* @__PURE__ */ t("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ t(
|
|
199
199
|
"input",
|
|
200
200
|
{
|
|
201
201
|
ref: _e,
|
|
202
202
|
type: "checkbox",
|
|
203
203
|
readOnly: !0,
|
|
204
|
-
checked:
|
|
205
|
-
disabled:
|
|
204
|
+
checked: p?.includes(L._index),
|
|
205
|
+
disabled: $?.includes(L._index)
|
|
206
206
|
}
|
|
207
207
|
) }) });
|
|
208
208
|
if (G && s)
|
|
@@ -215,7 +215,7 @@ const Me = Ft.createContext({
|
|
|
215
215
|
...U?.tdBodyProps
|
|
216
216
|
}
|
|
217
217
|
) });
|
|
218
|
-
const Z = L[
|
|
218
|
+
const Z = L[b];
|
|
219
219
|
return w?.format === "url" && Z ? /* @__PURE__ */ t(
|
|
220
220
|
"a",
|
|
221
221
|
{
|
|
@@ -230,10 +230,10 @@ const Me = Ft.createContext({
|
|
|
230
230
|
function rn() {
|
|
231
231
|
const { checkedIndexes: n, disabledCheckedIndexes: o, sortedRenderData: u } = e.useContext(Me);
|
|
232
232
|
return e.useMemo(() => {
|
|
233
|
-
const
|
|
234
|
-
(
|
|
233
|
+
const p = [...u || []].filter(
|
|
234
|
+
(f) => (n ? n.includes(f._index) : !0) || (o ? !o.includes(f._index) : !0)
|
|
235
235
|
);
|
|
236
|
-
return n?.length !== 0 &&
|
|
236
|
+
return n?.length !== 0 && p.length === n?.length;
|
|
237
237
|
}, [n, o, u]);
|
|
238
238
|
}
|
|
239
239
|
function xt(n, o, u) {
|
|
@@ -254,27 +254,27 @@ function Dt() {
|
|
|
254
254
|
const on = ({ index: n, style: o }) => {
|
|
255
255
|
const {
|
|
256
256
|
checkedIndexes: u,
|
|
257
|
-
columnNames:
|
|
258
|
-
columnWidths:
|
|
257
|
+
columnNames: p,
|
|
258
|
+
columnWidths: f,
|
|
259
259
|
config: l,
|
|
260
|
-
disabledCheckedIndexes:
|
|
260
|
+
disabledCheckedIndexes: $,
|
|
261
261
|
dropTargetIndex: _,
|
|
262
|
-
isColumnFilterable:
|
|
262
|
+
isColumnFilterable: O,
|
|
263
263
|
isSortable: W,
|
|
264
264
|
setCheckedIndexes: T,
|
|
265
|
-
properties:
|
|
265
|
+
properties: I,
|
|
266
266
|
required: M,
|
|
267
267
|
setCustomColumnNames: y,
|
|
268
|
-
setDropTargetIndex:
|
|
268
|
+
setDropTargetIndex: S,
|
|
269
269
|
setFilterSortColumn: q,
|
|
270
270
|
setMenuConfig: ee,
|
|
271
271
|
settingsStorageKey: D,
|
|
272
272
|
tableDataState: s,
|
|
273
273
|
sortedRenderData: m,
|
|
274
|
-
translate:
|
|
274
|
+
translate: b,
|
|
275
275
|
displayTimezone: w
|
|
276
|
-
} = e.useContext(Me), [U, te] = e.useState(!1), le = n === _, ne = Dt(), C =
|
|
277
|
-
let re =
|
|
276
|
+
} = e.useContext(Me), [U, te] = e.useState(!1), le = n === _, ne = Dt(), C = p[n], L = C === K ? { type: "boolean" } : I[C], se = s.sortColumn === C ? s.sortAsc : void 0, G = l ? l[C] : void 0;
|
|
277
|
+
let re = O && (L || G?.FilterMenu) && G?.isFilterable !== !1 ? $e.AVAILABLE : $e.UNAVAILABLE;
|
|
278
278
|
s.columnFilterMap && s.columnFilterMap[C] !== void 0 && (re = $e.ACTIVE);
|
|
279
279
|
const B = xt(
|
|
280
280
|
W,
|
|
@@ -321,23 +321,23 @@ const on = ({ index: n, style: o }) => {
|
|
|
321
321
|
});
|
|
322
322
|
},
|
|
323
323
|
[G, ce, C, ee]
|
|
324
|
-
), Ce = e.useMemo(() => k !== void 0 ? k : _e === "date-time" && A ? `${
|
|
324
|
+
), Ce = e.useMemo(() => k !== void 0 ? k : _e === "date-time" && A ? `${b(C)} (${b(w || Te)})` : b(C), [k, _e, A, b, C, w]), oe = e.useCallback(
|
|
325
325
|
(j, he) => {
|
|
326
|
-
if (!
|
|
326
|
+
if (!p || !f)
|
|
327
327
|
return;
|
|
328
|
-
const we =
|
|
328
|
+
const we = p.indexOf(j), J = [...p];
|
|
329
329
|
J.splice(we, 1);
|
|
330
330
|
const x = J.indexOf(he);
|
|
331
331
|
J.splice(x + 1, 0, j), y(J);
|
|
332
|
-
const ge = [...
|
|
332
|
+
const ge = [...f], fe = ge[we];
|
|
333
333
|
ge.splice(we, 1), ge.splice(x + 1, 0, fe), ne(new Uint16Array(ge)), D && localStorage.setItem(
|
|
334
334
|
`${D}.columnNames`,
|
|
335
335
|
JSON.stringify(J)
|
|
336
336
|
);
|
|
337
337
|
},
|
|
338
338
|
[
|
|
339
|
-
g,
|
|
340
339
|
p,
|
|
340
|
+
f,
|
|
341
341
|
ne,
|
|
342
342
|
D,
|
|
343
343
|
y
|
|
@@ -348,29 +348,29 @@ const on = ({ index: n, style: o }) => {
|
|
|
348
348
|
},
|
|
349
349
|
[oe, C]
|
|
350
350
|
), Oe = e.useCallback(() => {
|
|
351
|
-
oe && (te(!1),
|
|
352
|
-
}, [oe,
|
|
351
|
+
oe && (te(!1), S(-1));
|
|
352
|
+
}, [oe, S]), Ve = e.useCallback(
|
|
353
353
|
(j) => {
|
|
354
|
-
oe && (j.preventDefault(),
|
|
354
|
+
oe && (j.preventDefault(), S(n));
|
|
355
355
|
},
|
|
356
|
-
[n, oe,
|
|
356
|
+
[n, oe, S]
|
|
357
357
|
), Pe = e.useCallback(
|
|
358
358
|
(j) => {
|
|
359
|
-
if (
|
|
359
|
+
if (S(-1), !oe || !C)
|
|
360
360
|
return;
|
|
361
361
|
const he = j.dataTransfer.getData("text/plain");
|
|
362
362
|
!he || he === C || oe(he, C);
|
|
363
363
|
},
|
|
364
|
-
[oe, C,
|
|
364
|
+
[oe, C, S]
|
|
365
365
|
), Le = rn(), Ze = e.useCallback(() => {
|
|
366
366
|
!T || !m || T(
|
|
367
|
-
Le ? [] : m.map((j) => j._index).filter((j) =>
|
|
367
|
+
Le ? [] : m.map((j) => j._index).filter((j) => !$?.includes(j))
|
|
368
368
|
);
|
|
369
369
|
}, [
|
|
370
370
|
T,
|
|
371
371
|
m,
|
|
372
372
|
Le,
|
|
373
|
-
|
|
373
|
+
$
|
|
374
374
|
]);
|
|
375
375
|
if (C === K)
|
|
376
376
|
return /* @__PURE__ */ t("div", { style: o, className: V.join(" "), children: /* @__PURE__ */ t(
|
|
@@ -468,38 +468,38 @@ const on = ({ index: n, style: o }) => {
|
|
|
468
468
|
columnFilterValue: n,
|
|
469
469
|
onChange: o,
|
|
470
470
|
onInputKeyDown: u,
|
|
471
|
-
propIsRequired:
|
|
472
|
-
propName:
|
|
471
|
+
propIsRequired: p,
|
|
472
|
+
propName: f,
|
|
473
473
|
propSchema: l,
|
|
474
|
-
translate:
|
|
474
|
+
translate: $
|
|
475
475
|
}) => {
|
|
476
|
-
const { displayTimezone: _ } = e.useContext(Me), { type:
|
|
477
|
-
switch (
|
|
476
|
+
const { displayTimezone: _ } = e.useContext(Me), { type: O, format: W, minimum: T, maximum: I } = l || {}, M = n, y = W === "date-time";
|
|
477
|
+
switch (O) {
|
|
478
478
|
case "number":
|
|
479
479
|
case "integer":
|
|
480
|
-
const
|
|
480
|
+
const S = M || {}, q = (s, m, b) => {
|
|
481
481
|
const w = {
|
|
482
|
-
...
|
|
482
|
+
...S,
|
|
483
483
|
[s]: m.value === "" ? void 0 : parseInt(m.value)
|
|
484
484
|
}, U = Object.values(w).find(
|
|
485
485
|
(te) => isFinite(te)
|
|
486
486
|
);
|
|
487
487
|
o(
|
|
488
488
|
U !== void 0 && (T === void 0 || U >= T) ? w : void 0,
|
|
489
|
-
|
|
489
|
+
b
|
|
490
490
|
);
|
|
491
491
|
};
|
|
492
492
|
return /* @__PURE__ */ R("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: [
|
|
493
|
-
|
|
493
|
+
p ? null : /* @__PURE__ */ R("li", { style: { padding: 8 }, children: [
|
|
494
494
|
/* @__PURE__ */ R("label", { className: "d-flex", children: [
|
|
495
495
|
/* @__PURE__ */ t(
|
|
496
496
|
"input",
|
|
497
497
|
{
|
|
498
498
|
type: "checkbox",
|
|
499
499
|
style: { marginRight: 14 },
|
|
500
|
-
checked: !!
|
|
500
|
+
checked: !!S.filterEmpty,
|
|
501
501
|
onChange: () => {
|
|
502
|
-
const { filterEmpty: s, ...m } =
|
|
502
|
+
const { filterEmpty: s, ...m } = S;
|
|
503
503
|
s || (m.filterEmpty = !0), o(
|
|
504
504
|
Object.keys(m).length ? m : void 0,
|
|
505
505
|
!0
|
|
@@ -512,7 +512,7 @@ const on = ({ index: n, style: o }) => {
|
|
|
512
512
|
/* @__PURE__ */ t("hr", {})
|
|
513
513
|
] }),
|
|
514
514
|
Object.keys(be).map((s) => {
|
|
515
|
-
const m =
|
|
515
|
+
const m = S[s];
|
|
516
516
|
return /* @__PURE__ */ R("li", { children: [
|
|
517
517
|
/* @__PURE__ */ t("label", { style: { width: 40, paddingLeft: 16 }, children: an[s] }),
|
|
518
518
|
/* @__PURE__ */ t(
|
|
@@ -522,24 +522,24 @@ const on = ({ index: n, style: o }) => {
|
|
|
522
522
|
style: { width: 120 },
|
|
523
523
|
type: "number",
|
|
524
524
|
value: m !== void 0 ? m : "",
|
|
525
|
-
"data-prop-name":
|
|
526
|
-
onChange: (
|
|
525
|
+
"data-prop-name": f,
|
|
526
|
+
onChange: (b) => {
|
|
527
527
|
q(
|
|
528
528
|
s,
|
|
529
|
-
|
|
529
|
+
b.currentTarget,
|
|
530
530
|
!1
|
|
531
531
|
);
|
|
532
532
|
},
|
|
533
|
-
onBlur: (
|
|
533
|
+
onBlur: (b) => {
|
|
534
534
|
q(
|
|
535
535
|
s,
|
|
536
|
-
|
|
536
|
+
b.currentTarget,
|
|
537
537
|
!0
|
|
538
538
|
);
|
|
539
539
|
},
|
|
540
540
|
onKeyDown: u,
|
|
541
541
|
min: T,
|
|
542
|
-
max:
|
|
542
|
+
max: I
|
|
543
543
|
}
|
|
544
544
|
)
|
|
545
545
|
] }, s);
|
|
@@ -547,7 +547,7 @@ const on = ({ index: n, style: o }) => {
|
|
|
547
547
|
] });
|
|
548
548
|
case "boolean":
|
|
549
549
|
const ee = ["✓", "✕"];
|
|
550
|
-
|
|
550
|
+
p || ee.push("?");
|
|
551
551
|
let D = M ? "✓" : "✕";
|
|
552
552
|
return 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__ */ R(
|
|
553
553
|
"select",
|
|
@@ -555,7 +555,7 @@ const on = ({ index: n, style: o }) => {
|
|
|
555
555
|
autoFocus: !0,
|
|
556
556
|
className: "form-select",
|
|
557
557
|
value: D,
|
|
558
|
-
"data-prop-name":
|
|
558
|
+
"data-prop-name": f,
|
|
559
559
|
onChange: (s) => {
|
|
560
560
|
switch (s.currentTarget.value) {
|
|
561
561
|
case "✓":
|
|
@@ -593,7 +593,7 @@ const on = ({ index: n, style: o }) => {
|
|
|
593
593
|
autoFocus: !0,
|
|
594
594
|
className: "form-select",
|
|
595
595
|
value: M,
|
|
596
|
-
"data-prop-name":
|
|
596
|
+
"data-prop-name": f,
|
|
597
597
|
onChange: (s) => {
|
|
598
598
|
o(s.currentTarget.value || void 0, !0);
|
|
599
599
|
},
|
|
@@ -603,7 +603,7 @@ const on = ({ index: n, style: o }) => {
|
|
|
603
603
|
"option",
|
|
604
604
|
{
|
|
605
605
|
value: s,
|
|
606
|
-
children:
|
|
606
|
+
children: $(s)
|
|
607
607
|
},
|
|
608
608
|
`column-filter-select-${s}`
|
|
609
609
|
))
|
|
@@ -617,7 +617,7 @@ const on = ({ index: n, style: o }) => {
|
|
|
617
617
|
filterEmpty: void 0
|
|
618
618
|
};
|
|
619
619
|
return /* @__PURE__ */ R("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: [
|
|
620
|
-
|
|
620
|
+
p ? null : /* @__PURE__ */ R("li", { style: { padding: 8 }, children: [
|
|
621
621
|
/* @__PURE__ */ R("label", { className: "d-flex", children: [
|
|
622
622
|
/* @__PURE__ */ t(
|
|
623
623
|
"input",
|
|
@@ -625,8 +625,8 @@ const on = ({ index: n, style: o }) => {
|
|
|
625
625
|
type: "checkbox",
|
|
626
626
|
checked: !!m.filterEmpty,
|
|
627
627
|
onChange: () => {
|
|
628
|
-
const { filterEmpty:
|
|
629
|
-
|
|
628
|
+
const { filterEmpty: b, ...w } = m;
|
|
629
|
+
b || (w.filterEmpty = !0), o(
|
|
630
630
|
Object.keys(w).length ? w : void 0,
|
|
631
631
|
!0
|
|
632
632
|
);
|
|
@@ -643,19 +643,19 @@ const on = ({ index: n, style: o }) => {
|
|
|
643
643
|
ut,
|
|
644
644
|
{
|
|
645
645
|
dateFormat: s,
|
|
646
|
-
"data-prop-name":
|
|
646
|
+
"data-prop-name": f,
|
|
647
647
|
locale: dt,
|
|
648
648
|
selected: m.from ? new Ue(m.from).withTimeZone(
|
|
649
649
|
_ || Te
|
|
650
650
|
) : null,
|
|
651
|
-
onChange: (
|
|
652
|
-
if (!
|
|
651
|
+
onChange: (b) => {
|
|
652
|
+
if (!b && !m.to) {
|
|
653
653
|
o(void 0, !0);
|
|
654
654
|
return;
|
|
655
655
|
}
|
|
656
|
-
if (m.to &&
|
|
656
|
+
if (m.to && b && b > m.to)
|
|
657
657
|
return;
|
|
658
|
-
const w =
|
|
658
|
+
const w = b ? Ue.tz(_ || Te, b) : void 0;
|
|
659
659
|
o(
|
|
660
660
|
{
|
|
661
661
|
...n,
|
|
@@ -683,7 +683,7 @@ const on = ({ index: n, style: o }) => {
|
|
|
683
683
|
{
|
|
684
684
|
id: "filter-date",
|
|
685
685
|
dateFormat: s,
|
|
686
|
-
"data-prop-name":
|
|
686
|
+
"data-prop-name": f,
|
|
687
687
|
locale: dt,
|
|
688
688
|
selectsEnd: !0,
|
|
689
689
|
selected: m.to ? new Ue(m.to).withTimeZone(
|
|
@@ -691,12 +691,12 @@ const on = ({ index: n, style: o }) => {
|
|
|
691
691
|
) : null,
|
|
692
692
|
showMonthDropdown: !0,
|
|
693
693
|
showYearDropdown: !0,
|
|
694
|
-
onChange: (
|
|
695
|
-
if (!
|
|
694
|
+
onChange: (b) => {
|
|
695
|
+
if (!b && !m.from) {
|
|
696
696
|
o(void 0, !0);
|
|
697
697
|
return;
|
|
698
698
|
}
|
|
699
|
-
const w =
|
|
699
|
+
const w = b ? y ? Ue.tz(_ || Te, b) : zt(b) : void 0;
|
|
700
700
|
m.from && w && w < m.from || o(
|
|
701
701
|
{
|
|
702
702
|
...n,
|
|
@@ -726,10 +726,10 @@ const on = ({ index: n, style: o }) => {
|
|
|
726
726
|
autoFocus: !0,
|
|
727
727
|
type: "search",
|
|
728
728
|
className: "form-control",
|
|
729
|
-
placeholder: `Search ${
|
|
730
|
-
"aria-label": `Search ${
|
|
729
|
+
placeholder: `Search ${f}`,
|
|
730
|
+
"aria-label": `Search ${f}`,
|
|
731
731
|
value: M || "",
|
|
732
|
-
"data-prop-name":
|
|
732
|
+
"data-prop-name": f,
|
|
733
733
|
onChange: (s) => {
|
|
734
734
|
o(s.currentTarget.value || void 0, !1);
|
|
735
735
|
},
|
|
@@ -745,15 +745,15 @@ const on = ({ index: n, style: o }) => {
|
|
|
745
745
|
isSortable: n,
|
|
746
746
|
isFilterable: o,
|
|
747
747
|
onChange: u,
|
|
748
|
-
onClose:
|
|
749
|
-
onInputKeyDown:
|
|
748
|
+
onClose: p,
|
|
749
|
+
onInputKeyDown: f,
|
|
750
750
|
propConfig: l,
|
|
751
|
-
propIsRequired:
|
|
751
|
+
propIsRequired: $,
|
|
752
752
|
propName: _,
|
|
753
|
-
propSchema:
|
|
753
|
+
propSchema: O,
|
|
754
754
|
referenceElement: W,
|
|
755
755
|
setFilterSortColumn: T,
|
|
756
|
-
translate:
|
|
756
|
+
translate: I,
|
|
757
757
|
value: M
|
|
758
758
|
}) => {
|
|
759
759
|
const y = mt({
|
|
@@ -762,40 +762,40 @@ const on = ({ index: n, style: o }) => {
|
|
|
762
762
|
reference: W
|
|
763
763
|
},
|
|
764
764
|
middleware: [ht()]
|
|
765
|
-
}),
|
|
765
|
+
}), S = mt({
|
|
766
766
|
placement: "right-start",
|
|
767
767
|
middleware: [ht()]
|
|
768
768
|
});
|
|
769
769
|
e.useEffect(() => {
|
|
770
|
-
const m = (
|
|
770
|
+
const m = (b) => {
|
|
771
771
|
if (!y.elements.floating)
|
|
772
772
|
return;
|
|
773
|
-
let w =
|
|
773
|
+
let w = b.target;
|
|
774
774
|
for (; w && y.elements.floating; ) {
|
|
775
|
-
if (w === y.elements.floating || w ===
|
|
775
|
+
if (w === y.elements.floating || w === S.elements.floating)
|
|
776
776
|
return;
|
|
777
777
|
w = w.parentNode === window.document ? null : w.parentNode;
|
|
778
778
|
}
|
|
779
|
-
|
|
779
|
+
p(b);
|
|
780
780
|
};
|
|
781
781
|
return window.addEventListener("click", m, { capture: !0 }), () => {
|
|
782
782
|
window.removeEventListener("click", m, { capture: !0 });
|
|
783
783
|
};
|
|
784
784
|
}, [
|
|
785
785
|
y.elements.floating,
|
|
786
|
-
|
|
787
|
-
|
|
786
|
+
p,
|
|
787
|
+
S.elements.floating
|
|
788
788
|
]);
|
|
789
789
|
const q = l?.FilterMenu || ln, ee = e.useCallback(
|
|
790
790
|
(m) => {
|
|
791
|
-
T(_, !0),
|
|
791
|
+
T(_, !0), p(m);
|
|
792
792
|
},
|
|
793
|
-
[
|
|
793
|
+
[p, _, T]
|
|
794
794
|
), D = e.useCallback(
|
|
795
795
|
(m) => {
|
|
796
|
-
T(_, !1),
|
|
796
|
+
T(_, !1), p(m);
|
|
797
797
|
},
|
|
798
|
-
[
|
|
798
|
+
[p, _, T]
|
|
799
799
|
), s = e.useCallback(() => {
|
|
800
800
|
u(void 0, !0);
|
|
801
801
|
}, [u]);
|
|
@@ -810,19 +810,19 @@ const on = ({ index: n, style: o }) => {
|
|
|
810
810
|
n ? /* @__PURE__ */ R("li", { onClick: ee, style: { padding: 8 }, children: [
|
|
811
811
|
/* @__PURE__ */ t("span", { className: "mig-schema-table__th-menu__icon", children: "↓" }),
|
|
812
812
|
" ",
|
|
813
|
-
|
|
813
|
+
I("sortAscending")
|
|
814
814
|
] }) : null,
|
|
815
815
|
n ? /* @__PURE__ */ R("li", { onClick: D, style: { padding: 8 }, children: [
|
|
816
816
|
/* @__PURE__ */ t("span", { className: "mig-schema-table__th-menu__icon", children: "↑" }),
|
|
817
817
|
" ",
|
|
818
|
-
|
|
818
|
+
I("sortDescending")
|
|
819
819
|
] }) : null,
|
|
820
820
|
o ? /* @__PURE__ */ R(
|
|
821
821
|
"li",
|
|
822
822
|
{
|
|
823
823
|
style: { padding: 8 },
|
|
824
824
|
onMouseOver: (m) => {
|
|
825
|
-
|
|
825
|
+
S.refs.setReference(m.currentTarget);
|
|
826
826
|
},
|
|
827
827
|
children: [
|
|
828
828
|
/* @__PURE__ */ t("span", { className: "mig-schema-table__th-menu__icon", children: /* @__PURE__ */ t(
|
|
@@ -835,7 +835,7 @@ const on = ({ index: n, style: o }) => {
|
|
|
835
835
|
onChange: s
|
|
836
836
|
}
|
|
837
837
|
) }),
|
|
838
|
-
/* @__PURE__ */ t("label", { htmlFor: "mig-schema-table__th-menu__filters", children:
|
|
838
|
+
/* @__PURE__ */ t("label", { htmlFor: "mig-schema-table__th-menu__filters", children: I("filters") }),
|
|
839
839
|
/* @__PURE__ */ t("div", { className: "mig-schema-table__th-menu__sub-menu-indicator" })
|
|
840
840
|
]
|
|
841
841
|
}
|
|
@@ -843,22 +843,22 @@ const on = ({ index: n, style: o }) => {
|
|
|
843
843
|
] })
|
|
844
844
|
}
|
|
845
845
|
),
|
|
846
|
-
|
|
846
|
+
S.elements.reference ? /* @__PURE__ */ t(
|
|
847
847
|
"div",
|
|
848
848
|
{
|
|
849
849
|
className: "mig-schema-table mig-schema-table__th-menu__sub-menu",
|
|
850
|
-
ref:
|
|
851
|
-
style:
|
|
850
|
+
ref: S.refs.setFloating,
|
|
851
|
+
style: S.floatingStyles,
|
|
852
852
|
children: /* @__PURE__ */ t(
|
|
853
853
|
q,
|
|
854
854
|
{
|
|
855
855
|
columnFilterValue: M,
|
|
856
856
|
onChange: u,
|
|
857
|
-
onInputKeyDown:
|
|
858
|
-
propIsRequired:
|
|
857
|
+
onInputKeyDown: f,
|
|
858
|
+
propIsRequired: $,
|
|
859
859
|
propName: _,
|
|
860
|
-
propSchema:
|
|
861
|
-
translate:
|
|
860
|
+
propSchema: O,
|
|
861
|
+
translate: I
|
|
862
862
|
}
|
|
863
863
|
)
|
|
864
864
|
}
|
|
@@ -868,36 +868,36 @@ const on = ({ index: n, style: o }) => {
|
|
|
868
868
|
columnWidths: n,
|
|
869
869
|
resizeColumnIndex: o,
|
|
870
870
|
setResizeColumnIndex: u,
|
|
871
|
-
tableBodyHeight:
|
|
871
|
+
tableBodyHeight: p
|
|
872
872
|
}) => {
|
|
873
|
-
const [
|
|
874
|
-
(
|
|
873
|
+
const [f, l] = e.useState(0), $ = Dt(), _ = e.useCallback(
|
|
874
|
+
(I) => {
|
|
875
875
|
const M = n.map(
|
|
876
|
-
(y,
|
|
876
|
+
(y, S) => S === o ? Math.max(y + I, kt) : y
|
|
877
877
|
);
|
|
878
|
-
|
|
878
|
+
$(M);
|
|
879
879
|
},
|
|
880
|
-
[n, o,
|
|
880
|
+
[n, o, $]
|
|
881
881
|
);
|
|
882
|
-
let
|
|
882
|
+
let O = 0;
|
|
883
883
|
const W = e.useCallback(
|
|
884
|
-
(
|
|
885
|
-
u(parseInt(
|
|
884
|
+
(I) => {
|
|
885
|
+
u(parseInt(I.currentTarget.dataset.columnIndex)), l(I.clientX);
|
|
886
886
|
},
|
|
887
887
|
[u]
|
|
888
888
|
), T = e.useCallback(
|
|
889
|
-
(
|
|
890
|
-
_(
|
|
889
|
+
(I) => {
|
|
890
|
+
_(I.clientX - f), l(0), u(-1);
|
|
891
891
|
},
|
|
892
|
-
[
|
|
892
|
+
[f, _, u]
|
|
893
893
|
);
|
|
894
|
-
return /* @__PURE__ */ t("div", { children: [...n].map((
|
|
895
|
-
|
|
894
|
+
return /* @__PURE__ */ t("div", { children: [...n].map((I, M) => {
|
|
895
|
+
O += I;
|
|
896
896
|
const y = ["mig-schema-table__column_resizer"];
|
|
897
897
|
return M === o && y.push("mig-schema-table__column_resizer--dragged"), /* @__PURE__ */ t(
|
|
898
898
|
"div",
|
|
899
899
|
{
|
|
900
|
-
style: { left:
|
|
900
|
+
style: { left: O - en, bottom: p },
|
|
901
901
|
className: y.join(" "),
|
|
902
902
|
draggable: "true",
|
|
903
903
|
"data-column-index": M,
|
|
@@ -908,23 +908,23 @@ const on = ({ index: n, style: o }) => {
|
|
|
908
908
|
);
|
|
909
909
|
}) });
|
|
910
910
|
}, _t = (n) => {
|
|
911
|
-
const [o, u] = e.useState({ width: 0, height: 0 }),
|
|
911
|
+
const [o, u] = e.useState({ width: 0, height: 0 }), p = e.useMemo(
|
|
912
912
|
() => Zt(u, 100),
|
|
913
913
|
[]
|
|
914
914
|
);
|
|
915
915
|
return e.useEffect(() => {
|
|
916
916
|
if (!n)
|
|
917
917
|
return;
|
|
918
|
-
const
|
|
919
|
-
for (const
|
|
920
|
-
const { blockSize: _, inlineSize:
|
|
921
|
-
|
|
918
|
+
const f = new ResizeObserver((l) => {
|
|
919
|
+
for (const $ of l) {
|
|
920
|
+
const { blockSize: _, inlineSize: O } = $.borderBoxSize[0];
|
|
921
|
+
O && _ && p({ width: O, height: _ });
|
|
922
922
|
}
|
|
923
923
|
});
|
|
924
|
-
return
|
|
925
|
-
|
|
924
|
+
return f.observe(n), () => {
|
|
925
|
+
f.disconnect();
|
|
926
926
|
};
|
|
927
|
-
}, [
|
|
927
|
+
}, [p, n]), o;
|
|
928
928
|
}, mn = () => new Promise((n, o) => {
|
|
929
929
|
if (window.ExcelJS) {
|
|
930
930
|
n(window.ExcelJS);
|
|
@@ -937,60 +937,60 @@ const on = ({ index: n, style: o }) => {
|
|
|
937
937
|
o(new Error("Failed to load ExcelJS library"));
|
|
938
938
|
}, document.head.appendChild(u);
|
|
939
939
|
}), hn = async (n) => {
|
|
940
|
-
const o = await mn(),
|
|
940
|
+
const { Workbook: o } = await mn(), u = new o(), p = u.addWorksheet("Data");
|
|
941
941
|
n.length && (p.addRow(
|
|
942
942
|
qt(Object.keys(n[0]), [
|
|
943
943
|
"_index",
|
|
944
944
|
"SELECT_ALL_COLUMN_NAME"
|
|
945
945
|
])
|
|
946
946
|
), p.getRow(1).font = { bold: !0 }, p.addRows(
|
|
947
|
-
n.map((
|
|
948
|
-
const { _index:
|
|
949
|
-
return Object.values(
|
|
947
|
+
n.map((f) => {
|
|
948
|
+
const { _index: l, SELECT_ALL_COLUMN_NAME: $, ..._ } = f;
|
|
949
|
+
return Object.values(_);
|
|
950
950
|
})
|
|
951
|
-
),
|
|
952
|
-
const
|
|
951
|
+
), u.xlsx.writeBuffer().then((f) => {
|
|
952
|
+
const l = new Blob([f], {
|
|
953
953
|
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
954
954
|
});
|
|
955
|
-
Yt(
|
|
956
|
-
}).catch((
|
|
957
|
-
console.error("Error generating Excel file:",
|
|
955
|
+
Yt(l, "export.xlsx");
|
|
956
|
+
}).catch((f) => {
|
|
957
|
+
console.error("Error generating Excel file:", f);
|
|
958
958
|
}));
|
|
959
959
|
}, Ct = /* @__PURE__ */ new Date("1000-01-01 00:00:00Z"), fn = new Intl.NumberFormat("nl-NL"), bn = new Intl.NumberFormat("nl-NL", {
|
|
960
960
|
style: "currency",
|
|
961
961
|
currency: "EUR"
|
|
962
962
|
});
|
|
963
963
|
function gn(n, o) {
|
|
964
|
-
const { TdBody: u, sortByValue:
|
|
965
|
-
if (
|
|
966
|
-
return
|
|
964
|
+
const { TdBody: u, sortByValue: p } = o || {};
|
|
965
|
+
if (p !== void 0)
|
|
966
|
+
return p;
|
|
967
967
|
if (!n)
|
|
968
968
|
return !1;
|
|
969
|
-
const { format:
|
|
970
|
-
return
|
|
969
|
+
const { format: f, type: l } = n;
|
|
970
|
+
return f?.startsWith("date") || l === "boolean" || l === "integer" || l === "number" || !!u;
|
|
971
971
|
}
|
|
972
972
|
const pn = ({
|
|
973
973
|
CustomElement: n,
|
|
974
974
|
CustomSearchInput: o,
|
|
975
975
|
Heading: u = Bt,
|
|
976
|
-
autoRender:
|
|
977
|
-
checkedIndexes:
|
|
976
|
+
autoRender: p,
|
|
977
|
+
checkedIndexes: f,
|
|
978
978
|
config: l,
|
|
979
|
-
customElementProps:
|
|
979
|
+
customElementProps: $,
|
|
980
980
|
data: _,
|
|
981
|
-
defaultColumnFilters:
|
|
981
|
+
defaultColumnFilters: O,
|
|
982
982
|
defaultSortAsc: W = !1,
|
|
983
983
|
defaultSortColumn: T,
|
|
984
|
-
disabledCheckedIndexes:
|
|
984
|
+
disabledCheckedIndexes: I,
|
|
985
985
|
displayTimezone: M,
|
|
986
986
|
enableAutoFocus: y = !0,
|
|
987
|
-
enableRowCounter:
|
|
987
|
+
enableRowCounter: S = !0,
|
|
988
988
|
getRowClassName: q,
|
|
989
989
|
getRowSelected: ee,
|
|
990
990
|
getSearchQueryFilterResult: D,
|
|
991
991
|
infiniteLoaderRef: s,
|
|
992
992
|
isColumnFilterable: m = !0,
|
|
993
|
-
isExportable:
|
|
993
|
+
isExportable: b = !0,
|
|
994
994
|
isResizable: w = !0,
|
|
995
995
|
isSearchable: U = !0,
|
|
996
996
|
isSortable: te = !0,
|
|
@@ -1016,7 +1016,7 @@ const pn = ({
|
|
|
1016
1016
|
J ? void 0 : _
|
|
1017
1017
|
), [fe, qe] = e.useState(), [a, ke] = e.useState({
|
|
1018
1018
|
searchQuery: "",
|
|
1019
|
-
columnFilterMap:
|
|
1019
|
+
columnFilterMap: O || {},
|
|
1020
1020
|
sortColumn: T,
|
|
1021
1021
|
sortAsc: W
|
|
1022
1022
|
}), [z, Tt] = e.useState(
|
|
@@ -1045,10 +1045,10 @@ const pn = ({
|
|
|
1045
1045
|
}, [E]), e.useEffect(() => {
|
|
1046
1046
|
if (!E)
|
|
1047
1047
|
return;
|
|
1048
|
-
const { columnFilterMap: r, searchQuery:
|
|
1049
|
-
searchQuery:
|
|
1050
|
-
columnFilterMap: r ||
|
|
1051
|
-
sortAsc:
|
|
1048
|
+
const { columnFilterMap: r, searchQuery: c, sortAsc: d, sortColumn: i } = z || {}, h = {
|
|
1049
|
+
searchQuery: c || "",
|
|
1050
|
+
columnFilterMap: r || O || {},
|
|
1051
|
+
sortAsc: d === void 0 ? W : d,
|
|
1052
1052
|
sortColumn: i === void 0 ? T : i
|
|
1053
1053
|
};
|
|
1054
1054
|
ke(
|
|
@@ -1057,7 +1057,7 @@ const pn = ({
|
|
|
1057
1057
|
}, [
|
|
1058
1058
|
z,
|
|
1059
1059
|
E,
|
|
1060
|
-
|
|
1060
|
+
O,
|
|
1061
1061
|
W,
|
|
1062
1062
|
T
|
|
1063
1063
|
]), e.useEffect(() => {
|
|
@@ -1079,27 +1079,27 @@ const pn = ({
|
|
|
1079
1079
|
if (Ce)
|
|
1080
1080
|
return Ce;
|
|
1081
1081
|
const r = We ? JSON.parse(We) : void 0;
|
|
1082
|
-
let
|
|
1083
|
-
if (Z &&
|
|
1082
|
+
let c = Object.keys(ae);
|
|
1083
|
+
if (Z && c.unshift(K), l) {
|
|
1084
1084
|
Object.keys(l).forEach((i) => {
|
|
1085
|
-
|
|
1085
|
+
c.includes(i) || c.push(i);
|
|
1086
1086
|
});
|
|
1087
|
-
const
|
|
1087
|
+
const d = Object.entries(l).reduce(
|
|
1088
1088
|
(i, [h, N]) => (N.hidden && i.push(h), i),
|
|
1089
1089
|
[]
|
|
1090
1090
|
);
|
|
1091
|
-
|
|
1091
|
+
c = c.filter((i) => !d.includes(i)).sort((i, h) => {
|
|
1092
1092
|
let N = l[i] ? l[i].order : void 0;
|
|
1093
1093
|
N === void 0 && (N = Object.keys(ae).findIndex(
|
|
1094
1094
|
(H) => H === i
|
|
1095
1095
|
));
|
|
1096
|
-
let
|
|
1097
|
-
return
|
|
1096
|
+
let g = l[h] ? l[h].order : void 0;
|
|
1097
|
+
return g === void 0 && (g = Object.keys(ae).findIndex(
|
|
1098
1098
|
(H) => H === h
|
|
1099
|
-
)), h === K || i === K ? 0 : N === -1 ? 1 :
|
|
1099
|
+
)), h === K || i === K ? 0 : N === -1 ? 1 : g === -1 ? -1 : N - g;
|
|
1100
1100
|
});
|
|
1101
1101
|
}
|
|
1102
|
-
return r?.length ===
|
|
1102
|
+
return r?.length === c.length ? r : c;
|
|
1103
1103
|
}, [
|
|
1104
1104
|
l,
|
|
1105
1105
|
Ce,
|
|
@@ -1108,77 +1108,77 @@ const pn = ({
|
|
|
1108
1108
|
We
|
|
1109
1109
|
]), je = e.useMemo(
|
|
1110
1110
|
() => x && Y ? x.map(
|
|
1111
|
-
(r,
|
|
1112
|
-
(
|
|
1111
|
+
(r, c) => Y.reduce(
|
|
1112
|
+
(d, i) => {
|
|
1113
1113
|
const h = ae[i], N = l ? l[i] : void 0;
|
|
1114
1114
|
if (N?.renderData)
|
|
1115
|
-
return
|
|
1115
|
+
return d[i] = N.renderData(r, c), d;
|
|
1116
1116
|
if (!h || i === K)
|
|
1117
|
-
return
|
|
1118
|
-
const
|
|
1117
|
+
return d[i] = "", d;
|
|
1118
|
+
const g = r ? r[i] : "";
|
|
1119
1119
|
switch (h.type) {
|
|
1120
1120
|
case "array":
|
|
1121
|
-
return
|
|
1121
|
+
return d[i] = h.items?.type === "string" && g ? g.map((H) => k(H)).join(", ") : JSON.stringify(g), d;
|
|
1122
1122
|
case "boolean":
|
|
1123
|
-
return
|
|
1123
|
+
return d[i] = g === void 0 ? "?" : g ? "✓" : "✕", d;
|
|
1124
1124
|
case "number":
|
|
1125
1125
|
case "integer":
|
|
1126
|
-
return
|
|
1126
|
+
return g === void 0 ? (d[i] = "", d) : (d[i] = h.format === "currency" ? bn.format(g) : fn.format(g), d);
|
|
1127
1127
|
// @ts-expect-error investigate
|
|
1128
1128
|
case "string":
|
|
1129
|
-
if (h.format === "date" &&
|
|
1130
|
-
return
|
|
1131
|
-
|
|
1129
|
+
if (h.format === "date" && g)
|
|
1130
|
+
return d[i] = ["2999-12-31", "1970-01-01"].includes(
|
|
1131
|
+
g
|
|
1132
1132
|
) ? "-" : tt(
|
|
1133
|
-
new Date(
|
|
1133
|
+
new Date(g),
|
|
1134
1134
|
N?.dateFormat || vt
|
|
1135
|
-
),
|
|
1136
|
-
if (h.format === "date-time" &&
|
|
1137
|
-
return
|
|
1138
|
-
new Date(
|
|
1135
|
+
), d;
|
|
1136
|
+
if (h.format === "date-time" && g)
|
|
1137
|
+
return d[i] = M ? yt(
|
|
1138
|
+
new Date(g),
|
|
1139
1139
|
M,
|
|
1140
1140
|
Je
|
|
1141
1141
|
) : tt(
|
|
1142
|
-
new Date(
|
|
1142
|
+
new Date(g),
|
|
1143
1143
|
N?.dateFormat || Je
|
|
1144
|
-
),
|
|
1144
|
+
), d;
|
|
1145
1145
|
if (h.enum)
|
|
1146
|
-
return
|
|
1146
|
+
return d[i] = g ? k(g) : "", d;
|
|
1147
1147
|
// fallthrough
|
|
1148
1148
|
default:
|
|
1149
|
-
return
|
|
1149
|
+
return d[i] = g ? `${g}` : "", d;
|
|
1150
1150
|
}
|
|
1151
1151
|
},
|
|
1152
|
-
{ _index:
|
|
1152
|
+
{ _index: c }
|
|
1153
1153
|
)
|
|
1154
1154
|
) : void 0,
|
|
1155
1155
|
[x, Y, ae, l, k, M]
|
|
1156
1156
|
), xe = Y ? Y.length : 0, { dynamicWidthColumnCount: Ge, fixedWidthColumnsWidth: Xe } = e.useMemo(() => {
|
|
1157
|
-
let r = 0,
|
|
1158
|
-
return (Y || []).forEach((
|
|
1159
|
-
if (
|
|
1157
|
+
let r = 0, c = 0;
|
|
1158
|
+
return (Y || []).forEach((d) => {
|
|
1159
|
+
if (d === K) {
|
|
1160
1160
|
r += bt;
|
|
1161
1161
|
return;
|
|
1162
1162
|
}
|
|
1163
|
-
const i = l ? l[
|
|
1164
|
-
i?.width ? r += i.width :
|
|
1165
|
-
}, 0), { dynamicWidthColumnCount:
|
|
1163
|
+
const i = l ? l[d] : void 0;
|
|
1164
|
+
i?.width ? r += i.width : c += 1;
|
|
1165
|
+
}, 0), { dynamicWidthColumnCount: c, fixedWidthColumnsWidth: r };
|
|
1166
1166
|
}, [Y, l]), ie = e.useMemo(() => {
|
|
1167
1167
|
if (Ee)
|
|
1168
1168
|
return new Uint16Array(Ee);
|
|
1169
|
-
const r = Fe ? new Uint16Array(JSON.parse(Fe)) : void 0,
|
|
1169
|
+
const r = Fe ? new Uint16Array(JSON.parse(Fe)) : void 0, c = Math.max(
|
|
1170
1170
|
Math.floor(
|
|
1171
1171
|
(Ae - Xe) / Ge
|
|
1172
1172
|
),
|
|
1173
1173
|
kt
|
|
1174
1174
|
);
|
|
1175
|
-
let
|
|
1175
|
+
let d = (Ae - Xe) % Ge;
|
|
1176
1176
|
const i = new Uint16Array(
|
|
1177
1177
|
Y.map((h) => {
|
|
1178
1178
|
if (h === K)
|
|
1179
1179
|
return bt;
|
|
1180
1180
|
const N = l ? l[h] : void 0;
|
|
1181
|
-
return N?.width ? N?.width :
|
|
1181
|
+
return N?.width ? N?.width : d ? (d -= 1, c + 1) : c;
|
|
1182
1182
|
})
|
|
1183
1183
|
);
|
|
1184
1184
|
return r?.length === i.length ? r : i;
|
|
@@ -1196,20 +1196,20 @@ const pn = ({
|
|
|
1196
1196
|
), Ie = e.useMemo(() => {
|
|
1197
1197
|
if (!je || !m && !U || J)
|
|
1198
1198
|
return je;
|
|
1199
|
-
const { searchQuery: r } = a,
|
|
1200
|
-
(h) => `${i[h]}`.toLowerCase().includes(
|
|
1199
|
+
const { searchQuery: r } = a, c = r.toLowerCase() || "", d = (i) => x && D ? D(x[i._index], r) : !(Y && !Y.find(
|
|
1200
|
+
(h) => `${i[h]}`.toLowerCase().includes(c)
|
|
1201
1201
|
));
|
|
1202
1202
|
return je.filter((i) => {
|
|
1203
|
-
let h =
|
|
1203
|
+
let h = d(i);
|
|
1204
1204
|
return !h || !a.columnFilterMap ? !1 : (Object.entries(a.columnFilterMap).forEach(
|
|
1205
|
-
([N,
|
|
1206
|
-
if (!h ||
|
|
1205
|
+
([N, g]) => {
|
|
1206
|
+
if (!h || g === void 0)
|
|
1207
1207
|
return;
|
|
1208
1208
|
const H = l ? l[N] : void 0;
|
|
1209
1209
|
if (x && H?.filter) {
|
|
1210
1210
|
h = H.filter(
|
|
1211
1211
|
x[i._index],
|
|
1212
|
-
|
|
1212
|
+
g
|
|
1213
1213
|
);
|
|
1214
1214
|
return;
|
|
1215
1215
|
}
|
|
@@ -1218,12 +1218,12 @@ const pn = ({
|
|
|
1218
1218
|
case "boolean":
|
|
1219
1219
|
case "number":
|
|
1220
1220
|
case "integer":
|
|
1221
|
-
if (
|
|
1222
|
-
|
|
1221
|
+
if (g && typeof g == "object") {
|
|
1222
|
+
g.filterEmpty && F === void 0 && (h = !1);
|
|
1223
1223
|
for (const P of Object.keys(
|
|
1224
1224
|
be
|
|
1225
1225
|
)) {
|
|
1226
|
-
const ye =
|
|
1226
|
+
const ye = g[P];
|
|
1227
1227
|
if (h && Gt(ye))
|
|
1228
1228
|
switch (P) {
|
|
1229
1229
|
case be.EQ:
|
|
@@ -1238,15 +1238,15 @@ const pn = ({
|
|
|
1238
1238
|
}
|
|
1239
1239
|
}
|
|
1240
1240
|
} else {
|
|
1241
|
-
if (F === void 0 &&
|
|
1241
|
+
if (F === void 0 && g === null)
|
|
1242
1242
|
return !0;
|
|
1243
|
-
h = F ===
|
|
1243
|
+
h = F === g;
|
|
1244
1244
|
}
|
|
1245
1245
|
break;
|
|
1246
1246
|
// @ts-expect-error investigate
|
|
1247
1247
|
case "string":
|
|
1248
|
-
if (typeof
|
|
1249
|
-
const { from: P, to: ye, filterEmpty: it } =
|
|
1248
|
+
if (typeof g == "object" && (de.format === "date" || de.format === "date-time")) {
|
|
1249
|
+
const { from: P, to: ye, filterEmpty: it } = g;
|
|
1250
1250
|
if (!F)
|
|
1251
1251
|
h = !it;
|
|
1252
1252
|
else {
|
|
@@ -1258,10 +1258,10 @@ const pn = ({
|
|
|
1258
1258
|
// fall through
|
|
1259
1259
|
default:
|
|
1260
1260
|
if (de?.enum) {
|
|
1261
|
-
h = F ===
|
|
1261
|
+
h = F === g;
|
|
1262
1262
|
return;
|
|
1263
1263
|
}
|
|
1264
|
-
h = `${i[N]}`.toLowerCase().includes(`${
|
|
1264
|
+
h = `${i[N]}`.toLowerCase().includes(`${g}`.toLowerCase());
|
|
1265
1265
|
}
|
|
1266
1266
|
}
|
|
1267
1267
|
), h);
|
|
@@ -1278,10 +1278,10 @@ const pn = ({
|
|
|
1278
1278
|
x,
|
|
1279
1279
|
ae
|
|
1280
1280
|
]), X = e.useMemo(() => {
|
|
1281
|
-
const { sortAsc: r, sortColumn:
|
|
1282
|
-
if (!
|
|
1281
|
+
const { sortAsc: r, sortColumn: c } = a;
|
|
1282
|
+
if (!c || !Ie || !x || J)
|
|
1283
1283
|
return Ie;
|
|
1284
|
-
const
|
|
1284
|
+
const d = ae[c], i = l ? l[c] : void 0, h = i?.sort;
|
|
1285
1285
|
if (h)
|
|
1286
1286
|
return Ie.sort((H, de) => {
|
|
1287
1287
|
const F = x[H._index], P = x[de._index];
|
|
@@ -1291,10 +1291,10 @@ const pn = ({
|
|
|
1291
1291
|
r === void 0 ? W : r
|
|
1292
1292
|
) : -1 : 1;
|
|
1293
1293
|
});
|
|
1294
|
-
const N =
|
|
1294
|
+
const N = d && d.format?.startsWith("date"), g = gn(d, i);
|
|
1295
1295
|
return Ie.sort((H, de) => {
|
|
1296
|
-
let F =
|
|
1297
|
-
return
|
|
1296
|
+
let F = g && x[H._index] ? x[H._index][c] : `${H[c]}`.toLowerCase(), P = g && x[de._index] ? x[de._index][c] : `${de[c]}`.toLowerCase();
|
|
1297
|
+
return g && N && (F = new Date(F), isNaN(F.getTime()) && (F = Ct), P = new Date(P), isNaN(P.getTime()) && (P = Ct)), F === P ? 0 : F ? P ? (F < P ? 1 : -1) * (r ? -1 : 1) : r ? 1 : -1 : r ? -1 : 1;
|
|
1298
1298
|
});
|
|
1299
1299
|
}, [
|
|
1300
1300
|
l,
|
|
@@ -1306,24 +1306,24 @@ const pn = ({
|
|
|
1306
1306
|
a
|
|
1307
1307
|
]), st = e.useCallback(
|
|
1308
1308
|
(r) => {
|
|
1309
|
-
const
|
|
1310
|
-
delete
|
|
1309
|
+
const c = { ...a.columnFilterMap };
|
|
1310
|
+
delete c[r], ke({
|
|
1311
1311
|
...a,
|
|
1312
|
-
columnFilterMap:
|
|
1312
|
+
columnFilterMap: c
|
|
1313
1313
|
});
|
|
1314
1314
|
},
|
|
1315
1315
|
[a]
|
|
1316
1316
|
), He = e.useCallback(
|
|
1317
|
-
(r,
|
|
1317
|
+
(r, c) => {
|
|
1318
1318
|
if (E) {
|
|
1319
1319
|
window.location.hash = ze({
|
|
1320
1320
|
...z,
|
|
1321
1321
|
sortColumn: r,
|
|
1322
|
-
sortAsc:
|
|
1322
|
+
sortAsc: c
|
|
1323
1323
|
});
|
|
1324
1324
|
return;
|
|
1325
1325
|
}
|
|
1326
|
-
ke({ ...a, sortColumn: r, sortAsc:
|
|
1326
|
+
ke({ ...a, sortColumn: r, sortAsc: c });
|
|
1327
1327
|
},
|
|
1328
1328
|
[a, z, E]
|
|
1329
1329
|
), Et = e.useCallback(
|
|
@@ -1338,24 +1338,24 @@ const pn = ({
|
|
|
1338
1338
|
qe(a), ge(void 0);
|
|
1339
1339
|
}, [a]);
|
|
1340
1340
|
e.useEffect(() => {
|
|
1341
|
-
if (!
|
|
1341
|
+
if (!p || !z || !fe || !E)
|
|
1342
1342
|
return;
|
|
1343
1343
|
const r = Object.keys(z);
|
|
1344
|
-
let
|
|
1345
|
-
for (const
|
|
1346
|
-
const i = z[
|
|
1344
|
+
let c = !1;
|
|
1345
|
+
for (const d of r) {
|
|
1346
|
+
const i = z[d], h = fe[d];
|
|
1347
1347
|
if (typeof i == "string" && i !== h) {
|
|
1348
|
-
|
|
1348
|
+
c = !0;
|
|
1349
1349
|
break;
|
|
1350
1350
|
}
|
|
1351
1351
|
if (typeof i == "object" && !et(i, h)) {
|
|
1352
|
-
|
|
1352
|
+
c = !0;
|
|
1353
1353
|
break;
|
|
1354
1354
|
}
|
|
1355
1355
|
}
|
|
1356
|
-
|
|
1356
|
+
c && De();
|
|
1357
1357
|
}, [
|
|
1358
|
-
|
|
1358
|
+
p,
|
|
1359
1359
|
z,
|
|
1360
1360
|
fe,
|
|
1361
1361
|
De,
|
|
@@ -1371,11 +1371,11 @@ const pn = ({
|
|
|
1371
1371
|
[X]
|
|
1372
1372
|
), pe = e.useMemo(() => {
|
|
1373
1373
|
const r = B * Se;
|
|
1374
|
-
let
|
|
1375
|
-
if (C && (
|
|
1374
|
+
let c;
|
|
1375
|
+
if (C && (c = C === "100%" ? Re.height : C, !c))
|
|
1376
1376
|
return 0;
|
|
1377
|
-
const
|
|
1378
|
-
return
|
|
1377
|
+
const d = c ? c - ot.height - gt : 0;
|
|
1378
|
+
return d && d < r ? d : r;
|
|
1379
1379
|
}, [
|
|
1380
1380
|
B,
|
|
1381
1381
|
Se,
|
|
@@ -1388,10 +1388,10 @@ const pn = ({
|
|
|
1388
1388
|
},
|
|
1389
1389
|
[]
|
|
1390
1390
|
), At = e.useCallback(
|
|
1391
|
-
(r,
|
|
1391
|
+
(r, c) => {
|
|
1392
1392
|
if (!Q)
|
|
1393
1393
|
return;
|
|
1394
|
-
if (E &&
|
|
1394
|
+
if (E && c !== !1) {
|
|
1395
1395
|
window.location.hash = ze({
|
|
1396
1396
|
...z,
|
|
1397
1397
|
columnFilterMap: {
|
|
@@ -1405,13 +1405,13 @@ const pn = ({
|
|
|
1405
1405
|
st(Q.propName);
|
|
1406
1406
|
return;
|
|
1407
1407
|
}
|
|
1408
|
-
const
|
|
1408
|
+
const d = {
|
|
1409
1409
|
...a.columnFilterMap,
|
|
1410
1410
|
[Q.propName]: r
|
|
1411
1411
|
};
|
|
1412
1412
|
ke({
|
|
1413
1413
|
...a,
|
|
1414
|
-
columnFilterMap:
|
|
1414
|
+
columnFilterMap: d
|
|
1415
1415
|
});
|
|
1416
1416
|
},
|
|
1417
1417
|
[
|
|
@@ -1445,7 +1445,12 @@ const pn = ({
|
|
|
1445
1445
|
), $t = e.useCallback(() => {
|
|
1446
1446
|
v && (localStorage.removeItem(`${v}.columnNames`), localStorage.removeItem(`${v}.columnWidths`), oe(void 0), Oe(void 0));
|
|
1447
1447
|
}, [v]), Ke = e.useCallback(
|
|
1448
|
-
(r) =>
|
|
1448
|
+
(r) => {
|
|
1449
|
+
if (!X || !x || !ne || !le)
|
|
1450
|
+
return !0;
|
|
1451
|
+
const c = X[r];
|
|
1452
|
+
return c && x[c._index] !== void 0;
|
|
1453
|
+
},
|
|
1449
1454
|
[le, ne, X, x]
|
|
1450
1455
|
), Ot = e.useMemo(() => pe ? !(x && !Ne) && !ne ? /* @__PURE__ */ t(
|
|
1451
1456
|
"div",
|
|
@@ -1469,7 +1474,7 @@ const pn = ({
|
|
|
1469
1474
|
isItemLoaded: Ke,
|
|
1470
1475
|
itemCount: le,
|
|
1471
1476
|
loadMoreItems: ne,
|
|
1472
|
-
children: ({ onItemsRendered:
|
|
1477
|
+
children: ({ onItemsRendered: c, ref: d }) => /* @__PURE__ */ t(
|
|
1473
1478
|
lt,
|
|
1474
1479
|
{
|
|
1475
1480
|
className: "mig-schema-table__tbody",
|
|
@@ -1480,17 +1485,17 @@ const pn = ({
|
|
|
1480
1485
|
rowHeight: Ye,
|
|
1481
1486
|
columnCount: xe,
|
|
1482
1487
|
rowCount: Se,
|
|
1483
|
-
ref:
|
|
1488
|
+
ref: d,
|
|
1484
1489
|
onItemsRendered: ({
|
|
1485
1490
|
overscanRowStartIndex: i,
|
|
1486
1491
|
overscanRowStopIndex: h,
|
|
1487
1492
|
visibleRowStartIndex: N,
|
|
1488
|
-
visibleRowStopIndex:
|
|
1489
|
-
}) =>
|
|
1493
|
+
visibleRowStopIndex: g
|
|
1494
|
+
}) => c({
|
|
1490
1495
|
overscanStartIndex: i,
|
|
1491
1496
|
overscanStopIndex: h,
|
|
1492
1497
|
visibleStartIndex: N,
|
|
1493
|
-
visibleStopIndex:
|
|
1498
|
+
visibleStopIndex: g
|
|
1494
1499
|
}),
|
|
1495
1500
|
children: pt
|
|
1496
1501
|
},
|
|
@@ -1549,11 +1554,11 @@ const pn = ({
|
|
|
1549
1554
|
Me.Provider,
|
|
1550
1555
|
{
|
|
1551
1556
|
value: {
|
|
1552
|
-
checkedIndexes:
|
|
1557
|
+
checkedIndexes: f,
|
|
1553
1558
|
columnNames: Y,
|
|
1554
1559
|
columnWidths: ie,
|
|
1555
1560
|
config: l,
|
|
1556
|
-
disabledCheckedIndexes:
|
|
1561
|
+
disabledCheckedIndexes: I,
|
|
1557
1562
|
displayTimezone: M,
|
|
1558
1563
|
dropTargetIndex: Le,
|
|
1559
1564
|
getRowClassName: q,
|
|
@@ -1611,16 +1616,16 @@ const pn = ({
|
|
|
1611
1616
|
n ? /* @__PURE__ */ t(
|
|
1612
1617
|
n,
|
|
1613
1618
|
{
|
|
1614
|
-
|
|
1619
|
+
...$,
|
|
1615
1620
|
renderData: X
|
|
1616
1621
|
}
|
|
1617
1622
|
) : /* @__PURE__ */ t("div", { className: "mig-schema-table__custom_element_placeholder" }),
|
|
1618
|
-
|
|
1623
|
+
S && Array.isArray(_) ? /* @__PURE__ */ t("span", { className: "mig-schema-table__row_counter", children: k(
|
|
1619
1624
|
"showingFilteredCountOfTotalCount",
|
|
1620
1625
|
X?.length || 0,
|
|
1621
1626
|
_.length
|
|
1622
1627
|
) }) : null,
|
|
1623
|
-
|
|
1628
|
+
b ? /* @__PURE__ */ t(
|
|
1624
1629
|
"button",
|
|
1625
1630
|
{
|
|
1626
1631
|
onClick: St,
|
|
@@ -1712,31 +1717,31 @@ const pn = ({
|
|
|
1712
1717
|
}
|
|
1713
1718
|
);
|
|
1714
1719
|
}, In = e.memo(pn), Sn = e.memo(({ refresh: n, period: o = 60 }) => {
|
|
1715
|
-
const [u,
|
|
1720
|
+
const [u, p] = e.useState(/* @__PURE__ */ new Date()), [f, l] = e.useState(/* @__PURE__ */ new Date()), $ = e.useCallback(() => {
|
|
1716
1721
|
l(/* @__PURE__ */ new Date()), n();
|
|
1717
1722
|
}, [n]), _ = e.useMemo(
|
|
1718
|
-
() => Ut(u,
|
|
1719
|
-
[u,
|
|
1723
|
+
() => Ut(u, f),
|
|
1724
|
+
[u, f]
|
|
1720
1725
|
);
|
|
1721
1726
|
e.useEffect(() => {
|
|
1722
|
-
_ > o &&
|
|
1723
|
-
}, [_, u,
|
|
1727
|
+
_ > o && $();
|
|
1728
|
+
}, [_, u, f, o, $]), e.useEffect(() => {
|
|
1724
1729
|
const T = setInterval(() => {
|
|
1725
|
-
|
|
1730
|
+
p(/* @__PURE__ */ new Date());
|
|
1726
1731
|
}, 1e3);
|
|
1727
1732
|
return () => {
|
|
1728
1733
|
clearInterval(T);
|
|
1729
1734
|
};
|
|
1730
1735
|
}, []);
|
|
1731
|
-
const
|
|
1736
|
+
const O = o - _;
|
|
1732
1737
|
return /* @__PURE__ */ R(
|
|
1733
1738
|
"div",
|
|
1734
1739
|
{
|
|
1735
1740
|
className: "mx-auto",
|
|
1736
|
-
title: `Refresh ${
|
|
1741
|
+
title: `Refresh ${O > 0 ? `in ${O} seconds` : "NOW"}`,
|
|
1737
1742
|
children: [
|
|
1738
1743
|
"Last update ",
|
|
1739
|
-
tt(
|
|
1744
|
+
tt(f, "HH:mm")
|
|
1740
1745
|
]
|
|
1741
1746
|
}
|
|
1742
1747
|
);
|