mig-schema-table 5.0.15 → 5.0.16
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 +726 -721
- package/dist/mig-schema-table.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,38 +1,44 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as r, jsxs as B, Fragment as Ft } from "react/jsx-runtime";
|
|
2
|
+
import * as Qt from "react";
|
|
3
3
|
import e from "react";
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { VariableSizeGrid as ct, VariableSizeList as
|
|
6
|
-
import { format as
|
|
7
|
-
import { nl as
|
|
8
|
-
import { unCamel as
|
|
9
|
-
import { range as
|
|
4
|
+
import { createPortal as zt } from "react-dom";
|
|
5
|
+
import { VariableSizeGrid as ct, VariableSizeList as Ut } from "react-window";
|
|
6
|
+
import { format as Pt, endOfDay as Jt, differenceInSeconds as Zt } from "date-fns";
|
|
7
|
+
import { nl as Gt } from "date-fns/locale";
|
|
8
|
+
import { unCamel as qt, emptyFn as we, timeZone as Te, localeFormatInTimeZone as kt, parseLocationHash as ut, serializeLocationHash as Ue } from "mig-data-tools";
|
|
9
|
+
import { range as Xt, debounce as Ht, difference as Vt, isEqual as tt, isFinite as Yt, sum as Kt } from "lodash";
|
|
10
10
|
import dt from "react-datepicker";
|
|
11
11
|
import mt from "react-select";
|
|
12
12
|
import { nl as ht } from "date-fns/locale/nl";
|
|
13
13
|
import { TZDate as Pe } from "@date-fns/tz";
|
|
14
|
-
import { useFloating as ft, flip as
|
|
15
|
-
import
|
|
16
|
-
import { saveAs as
|
|
17
|
-
const nt = (t,
|
|
14
|
+
import { useFloating as ft, flip as gt } from "@floating-ui/react-dom";
|
|
15
|
+
import en from "react-window-infinite-loader";
|
|
16
|
+
import { saveAs as tn } from "file-saver";
|
|
17
|
+
const nt = (t, a) => (
|
|
18
18
|
// replace jan. with jan
|
|
19
|
-
|
|
20
|
-
),
|
|
19
|
+
Pt(t, a, { locale: Gt }).replace(".", "")
|
|
20
|
+
), nn = {
|
|
21
21
|
"Europe/Amsterdam": "AMS",
|
|
22
22
|
"Europe/Berlin": "AMS",
|
|
23
23
|
"Asia/Jakarta": "JKT",
|
|
24
24
|
"Asia/Bangkok": "JKT",
|
|
25
25
|
showingFilteredCountOfTotalCount: "Showing {0} of {1}"
|
|
26
26
|
};
|
|
27
|
-
function
|
|
28
|
-
let
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
}),
|
|
27
|
+
function bt(t, ...a) {
|
|
28
|
+
let h = nn[t] || qt(t);
|
|
29
|
+
return a.forEach((b, p) => {
|
|
30
|
+
h = h.replace(`{${p}}`, `${b}`);
|
|
31
|
+
}), h;
|
|
32
32
|
}
|
|
33
|
-
const K = "SELECT_ALL_COLUMN_NAME", pt = 40,
|
|
34
|
-
var
|
|
35
|
-
const
|
|
33
|
+
const K = "SELECT_ALL_COLUMN_NAME", pt = 40, xt = "dd MMM yyyy", Je = "dd MMM yyyy HH:mm", Dt = 25, _t = 50, rn = 3;
|
|
34
|
+
var ge = /* @__PURE__ */ ((t) => (t.GT = "GT", t.LT = "LT", t.EQ = "EQ", t))(ge || {});
|
|
35
|
+
const Ct = /* @__PURE__ */ new Map([
|
|
36
|
+
[!0, "✓"],
|
|
37
|
+
[!1, "✕"],
|
|
38
|
+
[null, "?"]
|
|
39
|
+
]);
|
|
40
|
+
var $e = /* @__PURE__ */ ((t) => (t.UNAVAILABLE = "UNAVAILABLE", t.AVAILABLE = "AVAILABLE", t.ACTIVE = "ACTIVE", t))($e || {});
|
|
41
|
+
const Me = Qt.createContext({
|
|
36
42
|
checkedIndexes: [],
|
|
37
43
|
columnNames: [],
|
|
38
44
|
columnWidths: new Uint16Array(),
|
|
@@ -57,122 +63,122 @@ const Me = Bt.createContext({
|
|
|
57
63
|
sortAsc: !1
|
|
58
64
|
},
|
|
59
65
|
translate: we
|
|
60
|
-
}),
|
|
66
|
+
}), sn = { type: "boolean" }, on = ({ columnIndex: t, rowIndex: a, style: h }) => {
|
|
61
67
|
const {
|
|
62
|
-
checkedIndexes:
|
|
68
|
+
checkedIndexes: b,
|
|
63
69
|
columnNames: p,
|
|
64
|
-
config:
|
|
70
|
+
config: f,
|
|
65
71
|
disabledCheckedIndexes: I,
|
|
66
72
|
displayTimezone: C,
|
|
67
|
-
getRowClassName:
|
|
73
|
+
getRowClassName: W,
|
|
68
74
|
getRowSelected: S,
|
|
69
|
-
isItemLoaded:
|
|
70
|
-
lastCheckChangedRowIndex:
|
|
71
|
-
onRowClick:
|
|
75
|
+
isItemLoaded: M,
|
|
76
|
+
lastCheckChangedRowIndex: R,
|
|
77
|
+
onRowClick: T,
|
|
72
78
|
onRowDoubleClick: w,
|
|
73
79
|
properties: $,
|
|
74
|
-
setCheckedIndexes:
|
|
80
|
+
setCheckedIndexes: q,
|
|
75
81
|
setLastCheckChangedRowIndex: ee,
|
|
76
|
-
sortedRenderData:
|
|
77
|
-
sourceData:
|
|
78
|
-
translate:
|
|
79
|
-
} = e.useContext(Me),
|
|
82
|
+
sortedRenderData: E,
|
|
83
|
+
sourceData: o,
|
|
84
|
+
translate: l
|
|
85
|
+
} = e.useContext(Me), s = p[t], _ = s === K ? sn : $[s], F = f ? f[s] : void 0, te = e.useCallback(
|
|
80
86
|
(v) => {
|
|
81
|
-
|
|
87
|
+
q && q((N) => N && N.includes(v) ? N.filter((D) => D !== v) : N ? [...N, v] : [v]);
|
|
82
88
|
},
|
|
83
|
-
[
|
|
84
|
-
), ce =
|
|
89
|
+
[q]
|
|
90
|
+
), ce = M(a), ne = e.useCallback(
|
|
85
91
|
(v) => {
|
|
86
|
-
if (!
|
|
92
|
+
if (!o || !E || !T || !ce)
|
|
87
93
|
return;
|
|
88
94
|
const { rowIndex: N } = v.currentTarget.dataset;
|
|
89
95
|
if (!N)
|
|
90
96
|
return;
|
|
91
|
-
const k =
|
|
92
|
-
|
|
97
|
+
const k = E[parseInt(N, 10)];
|
|
98
|
+
T(o[k._index], k._index, v);
|
|
93
99
|
},
|
|
94
|
-
[ce,
|
|
100
|
+
[ce, T, E, o]
|
|
95
101
|
), y = e.useCallback(
|
|
96
102
|
(v) => {
|
|
97
|
-
if (!
|
|
103
|
+
if (!o || !E || !w || !M)
|
|
98
104
|
return;
|
|
99
105
|
const { rowIndex: N } = v.currentTarget.dataset;
|
|
100
106
|
if (!N)
|
|
101
107
|
return;
|
|
102
|
-
const k =
|
|
103
|
-
w(
|
|
108
|
+
const k = E[parseInt(N, 10)];
|
|
109
|
+
w(o[k._index], k._index, v);
|
|
104
110
|
},
|
|
105
|
-
[
|
|
106
|
-
), L =
|
|
107
|
-
if (!L || !
|
|
111
|
+
[M, w, E, o]
|
|
112
|
+
), L = E ? E[a] : void 0, { showTimezones: ae, TdBody: H } = F || {}, re = e.useMemo(() => C ? null : Te.startsWith("Europe/") ? "Asia/Jakarta" : "Europe/Amsterdam", [C]), Q = e.useMemo(() => {
|
|
113
|
+
if (!L || !E)
|
|
108
114
|
return;
|
|
109
|
-
let v =
|
|
115
|
+
let v = s === K ? void 0 : L[s];
|
|
110
116
|
if (_?.format && _.format === "date-time" && ae !== !1) {
|
|
111
|
-
const k =
|
|
112
|
-
se && re && (v = `${
|
|
117
|
+
const k = o ? o[L._index] : void 0, D = k ? k[s] : void 0, se = D ? new Date(D) : void 0;
|
|
118
|
+
se && re && (v = `${kt(
|
|
113
119
|
se,
|
|
114
120
|
re,
|
|
115
121
|
Je
|
|
116
|
-
)} (${
|
|
122
|
+
)} (${l(re)})`);
|
|
117
123
|
}
|
|
118
124
|
const N = [
|
|
119
125
|
"mig-schema-table__td",
|
|
120
|
-
`mig-schema-table__td--${
|
|
121
|
-
`mig-schema-table__td--prop-${
|
|
126
|
+
`mig-schema-table__td--${a % 2 ? "odd" : "even"}`,
|
|
127
|
+
`mig-schema-table__td--prop-${s}`
|
|
122
128
|
];
|
|
123
|
-
switch (
|
|
124
|
-
|
|
129
|
+
switch (o && S && S(o[L._index], L._index) && N.push("mig-schema-table__td--selected"), o && W && N.push(
|
|
130
|
+
W(o[L._index], L._index, E)
|
|
125
131
|
), _?.type) {
|
|
126
132
|
case "boolean":
|
|
127
|
-
N.push(`text-${
|
|
133
|
+
N.push(`text-${F?.align || "center"}`);
|
|
128
134
|
break;
|
|
129
135
|
case "number":
|
|
130
136
|
case "integer":
|
|
131
|
-
N.push(`text-${
|
|
137
|
+
N.push(`text-${F?.align || "end"}`);
|
|
132
138
|
break;
|
|
133
139
|
default:
|
|
134
|
-
|
|
140
|
+
F?.align && N.push(`text-${F.align}`);
|
|
135
141
|
}
|
|
136
142
|
return {
|
|
137
|
-
"data-row-index":
|
|
143
|
+
"data-row-index": a,
|
|
138
144
|
"data-column-index": t,
|
|
139
|
-
style:
|
|
145
|
+
style: h,
|
|
140
146
|
className: N.join(" "),
|
|
141
147
|
title: v,
|
|
142
|
-
onClick:
|
|
143
|
-
onDoubleClick:
|
|
148
|
+
onClick: s === K ? void 0 : ne,
|
|
149
|
+
onDoubleClick: s === K ? void 0 : y
|
|
144
150
|
};
|
|
145
151
|
}, [
|
|
146
152
|
L,
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
E,
|
|
154
|
+
s,
|
|
149
155
|
_,
|
|
150
156
|
ae,
|
|
151
|
-
|
|
152
|
-
|
|
157
|
+
a,
|
|
158
|
+
o,
|
|
153
159
|
S,
|
|
154
|
-
|
|
160
|
+
W,
|
|
155
161
|
t,
|
|
156
|
-
|
|
162
|
+
h,
|
|
157
163
|
ne,
|
|
158
164
|
y,
|
|
159
165
|
re,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
]),
|
|
166
|
+
l,
|
|
167
|
+
F
|
|
168
|
+
]), G = e.useCallback(
|
|
163
169
|
(v) => {
|
|
164
170
|
if (!te || !L)
|
|
165
171
|
return;
|
|
166
172
|
const N = parseInt(v.currentTarget.dataset.rowIndex);
|
|
167
|
-
if (v.shiftKey &&
|
|
168
|
-
const k =
|
|
169
|
-
if (k !== void 0 &&
|
|
170
|
-
const
|
|
171
|
-
for (const se of
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
if (v.shiftKey && R !== void 0) {
|
|
174
|
+
const k = b?.includes(R) ? R : void 0;
|
|
175
|
+
if (k !== void 0 && E) {
|
|
176
|
+
const D = a;
|
|
177
|
+
for (const se of Xt(
|
|
178
|
+
D > k ? k + 1 : D,
|
|
179
|
+
D > k ? D + 1 : k
|
|
174
180
|
)) {
|
|
175
|
-
const ve =
|
|
181
|
+
const ve = E[se]._index;
|
|
176
182
|
(!I || !I.includes(ve)) && te(ve);
|
|
177
183
|
}
|
|
178
184
|
}
|
|
@@ -181,166 +187,166 @@ const Me = Bt.createContext({
|
|
|
181
187
|
ee(N), _e.current?.focus();
|
|
182
188
|
},
|
|
183
189
|
[
|
|
184
|
-
|
|
190
|
+
b,
|
|
185
191
|
I,
|
|
186
|
-
|
|
192
|
+
R,
|
|
187
193
|
te,
|
|
188
194
|
L,
|
|
189
|
-
|
|
195
|
+
a,
|
|
190
196
|
ee,
|
|
191
|
-
|
|
197
|
+
E
|
|
192
198
|
]
|
|
193
199
|
), _e = e.useRef(null);
|
|
194
200
|
if (!L || !Q)
|
|
195
201
|
return null;
|
|
196
|
-
if (!
|
|
202
|
+
if (!M || o && !o[L._index])
|
|
197
203
|
return /* @__PURE__ */ r("div", { ...Q, children: "loading" });
|
|
198
|
-
if (
|
|
199
|
-
return /* @__PURE__ */ r("div", { ...Q, onMouseDown:
|
|
204
|
+
if (s === K)
|
|
205
|
+
return /* @__PURE__ */ r("div", { ...Q, onMouseDown: G, children: /* @__PURE__ */ r("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ r(
|
|
200
206
|
"input",
|
|
201
207
|
{
|
|
202
208
|
ref: _e,
|
|
203
209
|
type: "checkbox",
|
|
204
210
|
readOnly: !0,
|
|
205
|
-
checked:
|
|
211
|
+
checked: b?.includes(L._index),
|
|
206
212
|
disabled: I?.includes(L._index)
|
|
207
213
|
}
|
|
208
214
|
) }) });
|
|
209
|
-
if (
|
|
215
|
+
if (H && o)
|
|
210
216
|
return /* @__PURE__ */ r("div", { ...Q, children: /* @__PURE__ */ r(
|
|
211
|
-
|
|
217
|
+
H,
|
|
212
218
|
{
|
|
213
219
|
dataIndex: L._index,
|
|
214
|
-
rowData:
|
|
215
|
-
rowIndex:
|
|
216
|
-
...
|
|
220
|
+
rowData: o[L._index],
|
|
221
|
+
rowIndex: a,
|
|
222
|
+
...F?.tdBodyProps
|
|
217
223
|
}
|
|
218
224
|
) });
|
|
219
|
-
const
|
|
220
|
-
return _?.format === "url" &&
|
|
225
|
+
const X = L[s];
|
|
226
|
+
return _?.format === "url" && X ? /* @__PURE__ */ r(
|
|
221
227
|
"a",
|
|
222
228
|
{
|
|
223
|
-
href:
|
|
229
|
+
href: X,
|
|
224
230
|
target: "_blank",
|
|
225
231
|
rel: "noopener noreferrer",
|
|
226
232
|
...Q,
|
|
227
|
-
children:
|
|
233
|
+
children: X
|
|
228
234
|
}
|
|
229
|
-
) : /* @__PURE__ */ r("div", { ...Q, children:
|
|
230
|
-
},
|
|
231
|
-
function
|
|
232
|
-
const { checkedIndexes: t, disabledCheckedIndexes:
|
|
235
|
+
) : /* @__PURE__ */ r("div", { ...Q, children: X });
|
|
236
|
+
}, yt = e.memo(on);
|
|
237
|
+
function an() {
|
|
238
|
+
const { checkedIndexes: t, disabledCheckedIndexes: a, sortedRenderData: h } = e.useContext(Me);
|
|
233
239
|
return e.useMemo(() => {
|
|
234
|
-
const
|
|
235
|
-
(p) => (t ? t.includes(p._index) : !0) || (
|
|
240
|
+
const b = [...h || []].filter(
|
|
241
|
+
(p) => (t ? t.includes(p._index) : !0) || (a ? !a.includes(p._index) : !0)
|
|
236
242
|
);
|
|
237
|
-
return t?.length !== 0 &&
|
|
238
|
-
}, [t,
|
|
243
|
+
return t?.length !== 0 && b.length === t?.length;
|
|
244
|
+
}, [t, a, h]);
|
|
239
245
|
}
|
|
240
|
-
function
|
|
241
|
-
return !!(t &&
|
|
246
|
+
function Tt(t, a, h) {
|
|
247
|
+
return !!(t && h?.isSortable !== !1 && (a || h?.renderData || h?.sort));
|
|
242
248
|
}
|
|
243
|
-
function
|
|
244
|
-
const { setCustomColumnWidths: t, settingsStorageKey:
|
|
249
|
+
function Mt() {
|
|
250
|
+
const { setCustomColumnWidths: t, settingsStorageKey: a } = e.useContext(Me);
|
|
245
251
|
return e.useCallback(
|
|
246
|
-
(
|
|
247
|
-
|
|
248
|
-
`${
|
|
249
|
-
JSON.stringify(Array.from(
|
|
250
|
-
), t(
|
|
252
|
+
(h) => {
|
|
253
|
+
a && localStorage.setItem(
|
|
254
|
+
`${a}.columnWidths`,
|
|
255
|
+
JSON.stringify(Array.from(h))
|
|
256
|
+
), t(h);
|
|
251
257
|
},
|
|
252
|
-
[t,
|
|
258
|
+
[t, a]
|
|
253
259
|
);
|
|
254
260
|
}
|
|
255
|
-
const
|
|
261
|
+
const ln = ({ index: t, style: a }) => {
|
|
256
262
|
const {
|
|
257
|
-
checkedIndexes:
|
|
258
|
-
columnNames:
|
|
263
|
+
checkedIndexes: h,
|
|
264
|
+
columnNames: b,
|
|
259
265
|
columnWidths: p,
|
|
260
|
-
config:
|
|
266
|
+
config: f,
|
|
261
267
|
disabledCheckedIndexes: I,
|
|
262
268
|
dropTargetIndex: C,
|
|
263
|
-
isColumnFilterable:
|
|
269
|
+
isColumnFilterable: W,
|
|
264
270
|
isSortable: S,
|
|
265
|
-
setCheckedIndexes:
|
|
266
|
-
properties:
|
|
267
|
-
required:
|
|
271
|
+
setCheckedIndexes: M,
|
|
272
|
+
properties: R,
|
|
273
|
+
required: T,
|
|
268
274
|
setCustomColumnNames: w,
|
|
269
275
|
setDropTargetIndex: $,
|
|
270
|
-
setFilterSortColumn:
|
|
276
|
+
setFilterSortColumn: q,
|
|
271
277
|
setMenuConfig: ee,
|
|
272
|
-
settingsStorageKey:
|
|
273
|
-
tableDataState:
|
|
274
|
-
sortedRenderData:
|
|
275
|
-
translate:
|
|
278
|
+
settingsStorageKey: E,
|
|
279
|
+
tableDataState: o,
|
|
280
|
+
sortedRenderData: l,
|
|
281
|
+
translate: s,
|
|
276
282
|
displayTimezone: _
|
|
277
|
-
} = e.useContext(Me), [
|
|
278
|
-
let re =
|
|
279
|
-
|
|
280
|
-
const Q =
|
|
283
|
+
} = e.useContext(Me), [F, te] = e.useState(!1), ce = t === C, ne = Mt(), y = b[t], L = y === K ? { type: "boolean" } : R[y], ae = o.sortColumn === y ? o.sortAsc : void 0, H = f ? f[y] : void 0;
|
|
284
|
+
let re = W && (L || H?.FilterMenu) && H?.isFilterable !== !1 ? $e.AVAILABLE : $e.UNAVAILABLE;
|
|
285
|
+
o.columnFilterMap && o.columnFilterMap[y] !== void 0 && (re = $e.ACTIVE);
|
|
286
|
+
const Q = Tt(
|
|
281
287
|
S,
|
|
282
288
|
L,
|
|
283
|
-
|
|
284
|
-
),
|
|
289
|
+
H
|
|
290
|
+
), G = [
|
|
285
291
|
"mig-schema-table__th",
|
|
286
292
|
`mig-schema-table__th--filter-${re}`,
|
|
287
293
|
`mig-schema-table__th--prop-${y}`
|
|
288
294
|
];
|
|
289
|
-
|
|
295
|
+
G.push(
|
|
290
296
|
Q ? "mig-schema-table__th--sortable" : "mig-schema-table__th--unsortable"
|
|
291
|
-
), ae !== void 0 &&
|
|
297
|
+
), ae !== void 0 && G.push("mig-schema-table__th--sorted"), F && G.push("mig-schema-table__th--dragging"), ce && G.push("mig-schema-table__th--drop-target");
|
|
292
298
|
const { format: _e } = L || {}, {
|
|
293
|
-
align:
|
|
299
|
+
align: X,
|
|
294
300
|
defaultSortDesc: v,
|
|
295
301
|
showTimezones: N = !_,
|
|
296
302
|
title: k
|
|
297
|
-
} =
|
|
303
|
+
} = H || {}, D = e.useCallback(() => {
|
|
298
304
|
if (Q) {
|
|
299
305
|
if (ae === void 0) {
|
|
300
|
-
|
|
306
|
+
q(y, !v);
|
|
301
307
|
return;
|
|
302
308
|
}
|
|
303
|
-
|
|
309
|
+
q(y, !ae);
|
|
304
310
|
}
|
|
305
311
|
}, [
|
|
306
312
|
Q,
|
|
307
313
|
v,
|
|
308
314
|
y,
|
|
309
|
-
|
|
315
|
+
q,
|
|
310
316
|
ae
|
|
311
|
-
]), se =
|
|
317
|
+
]), se = T.includes(y), ve = e.useCallback(
|
|
312
318
|
(j) => {
|
|
313
319
|
const me = j.currentTarget;
|
|
314
320
|
ee((ye) => {
|
|
315
321
|
if (ye?.propName !== y)
|
|
316
322
|
return {
|
|
317
|
-
propConfig:
|
|
323
|
+
propConfig: H,
|
|
318
324
|
propIsRequired: se,
|
|
319
325
|
propName: y,
|
|
320
326
|
referenceElement: me
|
|
321
327
|
};
|
|
322
328
|
});
|
|
323
329
|
},
|
|
324
|
-
[
|
|
325
|
-
), Ce = e.useMemo(() => k !== void 0 ? k : _e === "date-time" && N ? `${
|
|
330
|
+
[H, se, y, ee]
|
|
331
|
+
), Ce = e.useMemo(() => k !== void 0 ? k : _e === "date-time" && N ? `${s(y)} (${s(_ || Te)})` : s(y), [k, _e, N, s, y, _]), oe = e.useCallback(
|
|
326
332
|
(j, me) => {
|
|
327
|
-
if (!
|
|
333
|
+
if (!b || !p)
|
|
328
334
|
return;
|
|
329
|
-
const ye =
|
|
335
|
+
const ye = b.indexOf(j), J = [...b];
|
|
330
336
|
J.splice(ye, 1);
|
|
331
337
|
const x = J.indexOf(me);
|
|
332
338
|
J.splice(x + 1, 0, j), w(J);
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
`${
|
|
339
|
+
const be = [...p], he = be[ye];
|
|
340
|
+
be.splice(ye, 1), be.splice(x + 1, 0, he), ne(new Uint16Array(be)), E && localStorage.setItem(
|
|
341
|
+
`${E}.columnNames`,
|
|
336
342
|
JSON.stringify(J)
|
|
337
343
|
);
|
|
338
344
|
},
|
|
339
345
|
[
|
|
340
|
-
|
|
346
|
+
b,
|
|
341
347
|
p,
|
|
342
348
|
ne,
|
|
343
|
-
|
|
349
|
+
E,
|
|
344
350
|
w
|
|
345
351
|
]
|
|
346
352
|
), Ae = e.useCallback(
|
|
@@ -350,12 +356,12 @@ const an = ({ index: t, style: s }) => {
|
|
|
350
356
|
[oe, y]
|
|
351
357
|
), Oe = e.useCallback(() => {
|
|
352
358
|
oe && (te(!1), $(-1));
|
|
353
|
-
}, [oe, $]),
|
|
359
|
+
}, [oe, $]), Ze = e.useCallback(
|
|
354
360
|
(j) => {
|
|
355
361
|
oe && (j.preventDefault(), $(t));
|
|
356
362
|
},
|
|
357
363
|
[t, oe, $]
|
|
358
|
-
),
|
|
364
|
+
), Ge = e.useCallback(
|
|
359
365
|
(j) => {
|
|
360
366
|
if ($(-1), !oe || !y)
|
|
361
367
|
return;
|
|
@@ -363,72 +369,72 @@ const an = ({ index: t, style: s }) => {
|
|
|
363
369
|
!me || me === y || oe(me, y);
|
|
364
370
|
},
|
|
365
371
|
[oe, y, $]
|
|
366
|
-
), Ee =
|
|
367
|
-
!
|
|
368
|
-
Ee ? [] :
|
|
372
|
+
), Ee = an(), qe = e.useCallback(() => {
|
|
373
|
+
!M || !l || M(
|
|
374
|
+
Ee ? [] : l.map((j) => j._index).filter((j) => !I?.includes(j))
|
|
369
375
|
);
|
|
370
376
|
}, [
|
|
371
|
-
|
|
372
|
-
|
|
377
|
+
M,
|
|
378
|
+
l,
|
|
373
379
|
Ee,
|
|
374
380
|
I
|
|
375
381
|
]);
|
|
376
382
|
if (y === K)
|
|
377
|
-
return /* @__PURE__ */ r("div", { style:
|
|
383
|
+
return /* @__PURE__ */ r("div", { style: a, className: G.join(" "), children: /* @__PURE__ */ r(
|
|
378
384
|
"div",
|
|
379
385
|
{
|
|
380
386
|
style: {
|
|
381
387
|
width: "100%",
|
|
382
388
|
textAlign: "center"
|
|
383
389
|
},
|
|
384
|
-
title: `${
|
|
390
|
+
title: `${h?.length || 0} selected`,
|
|
385
391
|
children: /* @__PURE__ */ r(
|
|
386
392
|
"input",
|
|
387
393
|
{
|
|
388
394
|
type: "checkbox",
|
|
389
395
|
name: "selectAll",
|
|
390
396
|
checked: Ee,
|
|
391
|
-
onChange:
|
|
397
|
+
onChange: qe
|
|
392
398
|
}
|
|
393
399
|
)
|
|
394
400
|
}
|
|
395
401
|
) });
|
|
396
402
|
switch (L?.type) {
|
|
397
403
|
case "boolean":
|
|
398
|
-
|
|
399
|
-
`text-${
|
|
400
|
-
`justify-content-${
|
|
404
|
+
G.push(
|
|
405
|
+
`text-${X || "center"}`,
|
|
406
|
+
`justify-content-${X || "center"}`
|
|
401
407
|
);
|
|
402
408
|
break;
|
|
403
409
|
case "integer":
|
|
404
410
|
case "number":
|
|
405
|
-
|
|
406
|
-
`text-${
|
|
407
|
-
`justify-content-${
|
|
411
|
+
G.push(
|
|
412
|
+
`text-${X || "end"}`,
|
|
413
|
+
`justify-content-${X || "end"}`
|
|
408
414
|
);
|
|
409
415
|
break;
|
|
410
416
|
default:
|
|
411
|
-
|
|
417
|
+
X && G.push(`text-${X}`);
|
|
412
418
|
}
|
|
413
|
-
let z =
|
|
414
|
-
return !z && typeof Ce == "string" && (z = Ce), /* @__PURE__ */
|
|
419
|
+
let z = H?.hoverTitle;
|
|
420
|
+
return !z && typeof Ce == "string" && (z = Ce), /* @__PURE__ */ B(
|
|
415
421
|
"div",
|
|
416
422
|
{
|
|
417
|
-
className:
|
|
418
|
-
style:
|
|
423
|
+
className: G.join(" "),
|
|
424
|
+
style: a,
|
|
419
425
|
title: z,
|
|
420
426
|
draggable: !0,
|
|
421
427
|
onDragStart: Ae,
|
|
422
428
|
onDragEnd: Oe,
|
|
423
|
-
onDragOver:
|
|
424
|
-
onDrop:
|
|
429
|
+
onDragOver: Ze,
|
|
430
|
+
onDrop: Ge,
|
|
425
431
|
children: [
|
|
426
|
-
/* @__PURE__ */
|
|
432
|
+
/* @__PURE__ */ B(
|
|
427
433
|
"div",
|
|
428
434
|
{
|
|
429
435
|
className: "mig-schema-table__th__label-body",
|
|
430
436
|
style: { lineHeight: "44px" },
|
|
431
|
-
onClick:
|
|
437
|
+
onClick: D,
|
|
432
438
|
children: [
|
|
433
439
|
/* @__PURE__ */ r("span", { className: "mig-schema-table__th__label-body-text", children: Ce }),
|
|
434
440
|
ae === void 0 ? null : /* @__PURE__ */ r("span", { className: "mig-schema-table__th__sort-icon", children: ae ? "↓" : "↑" })
|
|
@@ -460,39 +466,39 @@ const an = ({ index: t, style: s }) => {
|
|
|
460
466
|
]
|
|
461
467
|
}
|
|
462
468
|
);
|
|
463
|
-
},
|
|
464
|
-
[
|
|
465
|
-
[
|
|
466
|
-
[
|
|
467
|
-
},
|
|
469
|
+
}, cn = e.memo(ln), un = {
|
|
470
|
+
[ge.GT]: ">",
|
|
471
|
+
[ge.LT]: "<",
|
|
472
|
+
[ge.EQ]: "="
|
|
473
|
+
}, dn = e.memo(
|
|
468
474
|
({
|
|
469
475
|
columnFilterValue: t,
|
|
470
|
-
onChange:
|
|
471
|
-
onInputKeyDown:
|
|
472
|
-
propIsRequired:
|
|
476
|
+
onChange: a,
|
|
477
|
+
onInputKeyDown: h,
|
|
478
|
+
propIsRequired: b,
|
|
473
479
|
propName: p,
|
|
474
|
-
propSchema:
|
|
480
|
+
propSchema: f,
|
|
475
481
|
translate: I
|
|
476
482
|
}) => {
|
|
477
|
-
const { displayTimezone: C } = e.useContext(Me), { type:
|
|
478
|
-
let $,
|
|
479
|
-
switch (
|
|
483
|
+
const { displayTimezone: C } = e.useContext(Me), { type: W, format: S, minimum: M, maximum: R } = f || {}, T = t, w = S === "date-time";
|
|
484
|
+
let $, q;
|
|
485
|
+
switch (W) {
|
|
480
486
|
case "number":
|
|
481
487
|
case "integer":
|
|
482
|
-
return $ =
|
|
488
|
+
return $ = T || {}, q = (o, l, s) => {
|
|
483
489
|
const _ = {
|
|
484
490
|
...$,
|
|
485
|
-
[
|
|
486
|
-
},
|
|
491
|
+
[o]: l.value === "" ? void 0 : parseInt(l.value)
|
|
492
|
+
}, F = Object.values(_).find(
|
|
487
493
|
(te) => isFinite(te)
|
|
488
494
|
);
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
495
|
+
a(
|
|
496
|
+
F !== void 0 && (M === void 0 || F >= M) ? _ : void 0,
|
|
497
|
+
s
|
|
492
498
|
);
|
|
493
|
-
}, /* @__PURE__ */
|
|
494
|
-
|
|
495
|
-
/* @__PURE__ */
|
|
499
|
+
}, /* @__PURE__ */ B("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: [
|
|
500
|
+
b ? null : /* @__PURE__ */ B("li", { style: { padding: 8 }, children: [
|
|
501
|
+
/* @__PURE__ */ B("label", { className: "d-flex", children: [
|
|
496
502
|
/* @__PURE__ */ r(
|
|
497
503
|
"input",
|
|
498
504
|
{
|
|
@@ -500,9 +506,9 @@ const an = ({ index: t, style: s }) => {
|
|
|
500
506
|
style: { marginRight: 14 },
|
|
501
507
|
checked: !!$.filterEmpty,
|
|
502
508
|
onChange: () => {
|
|
503
|
-
const { filterEmpty:
|
|
504
|
-
|
|
505
|
-
Object.keys(
|
|
509
|
+
const { filterEmpty: o, ...l } = $;
|
|
510
|
+
o || (l.filterEmpty = !0), a(
|
|
511
|
+
Object.keys(l).length ? l : void 0,
|
|
506
512
|
!0
|
|
507
513
|
);
|
|
508
514
|
}
|
|
@@ -512,94 +518,83 @@ const an = ({ index: t, style: s }) => {
|
|
|
512
518
|
] }),
|
|
513
519
|
/* @__PURE__ */ r("hr", {})
|
|
514
520
|
] }),
|
|
515
|
-
Object.keys(
|
|
516
|
-
const
|
|
517
|
-
return /* @__PURE__ */
|
|
518
|
-
/* @__PURE__ */ r("label", { style: { width: 40, paddingLeft: 16 }, children:
|
|
521
|
+
Object.keys(ge).map((o) => {
|
|
522
|
+
const l = $[o];
|
|
523
|
+
return /* @__PURE__ */ B("li", { children: [
|
|
524
|
+
/* @__PURE__ */ r("label", { style: { width: 40, paddingLeft: 16 }, children: un[o] }),
|
|
519
525
|
/* @__PURE__ */ r(
|
|
520
526
|
"input",
|
|
521
527
|
{
|
|
522
528
|
className: "form-control",
|
|
523
529
|
style: { width: 120 },
|
|
524
530
|
type: "number",
|
|
525
|
-
value:
|
|
531
|
+
value: l !== void 0 ? l : "",
|
|
526
532
|
"data-prop-name": p,
|
|
527
|
-
onChange: (
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
533
|
+
onChange: (s) => {
|
|
534
|
+
q(
|
|
535
|
+
o,
|
|
536
|
+
s.currentTarget,
|
|
531
537
|
!1
|
|
532
538
|
);
|
|
533
539
|
},
|
|
534
|
-
onBlur: (
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
540
|
+
onBlur: (s) => {
|
|
541
|
+
q(
|
|
542
|
+
o,
|
|
543
|
+
s.currentTarget,
|
|
538
544
|
!0
|
|
539
545
|
);
|
|
540
546
|
},
|
|
541
|
-
onKeyDown:
|
|
542
|
-
min:
|
|
543
|
-
max:
|
|
547
|
+
onKeyDown: h,
|
|
548
|
+
min: M,
|
|
549
|
+
max: R
|
|
544
550
|
}
|
|
545
551
|
)
|
|
546
|
-
] },
|
|
552
|
+
] }, o);
|
|
547
553
|
})
|
|
548
554
|
] });
|
|
549
555
|
case "boolean":
|
|
550
|
-
const ee = [
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
return
|
|
556
|
+
const ee = [!0, !1];
|
|
557
|
+
b || ee.push(null);
|
|
558
|
+
const E = T ? T.map((o) => ({
|
|
559
|
+
value: o,
|
|
560
|
+
label: Ct.get(o)
|
|
561
|
+
})) : null;
|
|
562
|
+
return /* @__PURE__ */ r("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(
|
|
557
563
|
mt,
|
|
558
564
|
{
|
|
559
565
|
autoFocus: !0,
|
|
560
566
|
menuIsOpen: !0,
|
|
561
567
|
isClearable: !0,
|
|
568
|
+
isMulti: !0,
|
|
562
569
|
placeholder: I("All"),
|
|
563
570
|
className: "react-select-container",
|
|
564
571
|
classNamePrefix: "react-select",
|
|
565
|
-
value:
|
|
566
|
-
options: ee
|
|
572
|
+
value: E,
|
|
573
|
+
options: ee.map((o) => ({
|
|
574
|
+
value: o,
|
|
575
|
+
label: Ct.get(o)
|
|
576
|
+
})),
|
|
567
577
|
styles: {
|
|
568
|
-
menu: (
|
|
569
|
-
...
|
|
578
|
+
menu: (o) => ({
|
|
579
|
+
...o,
|
|
570
580
|
marginTop: 0
|
|
571
581
|
})
|
|
572
582
|
},
|
|
573
|
-
onChange: (
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
switch (c.value) {
|
|
579
|
-
case "✓":
|
|
580
|
-
s(!0, !0);
|
|
581
|
-
break;
|
|
582
|
-
case "✕":
|
|
583
|
-
s(!1, !0);
|
|
584
|
-
break;
|
|
585
|
-
case "?":
|
|
586
|
-
s(null, !0);
|
|
587
|
-
break;
|
|
588
|
-
default:
|
|
589
|
-
s(void 0, !0);
|
|
590
|
-
}
|
|
583
|
+
onChange: (o) => {
|
|
584
|
+
const l = o && o.length ? o.map(({ value: s }) => s) : void 0;
|
|
585
|
+
a(l, !0);
|
|
591
586
|
},
|
|
592
|
-
onKeyDown:
|
|
587
|
+
onKeyDown: h
|
|
593
588
|
}
|
|
594
589
|
) }) });
|
|
595
590
|
// @ts-expect-error falls through
|
|
596
591
|
case "string":
|
|
597
|
-
if (
|
|
598
|
-
const
|
|
599
|
-
value:
|
|
600
|
-
label: I(
|
|
601
|
-
})),
|
|
602
|
-
(
|
|
592
|
+
if (f?.enum) {
|
|
593
|
+
const o = f.enum.map((s) => ({
|
|
594
|
+
value: s,
|
|
595
|
+
label: I(s)
|
|
596
|
+
})), l = o.filter(
|
|
597
|
+
(s) => (T || []).includes(s.value)
|
|
603
598
|
);
|
|
604
599
|
return /* @__PURE__ */ r("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(
|
|
605
600
|
mt,
|
|
@@ -609,42 +604,42 @@ const an = ({ index: t, style: s }) => {
|
|
|
609
604
|
menuIsOpen: !0,
|
|
610
605
|
className: "react-select-container",
|
|
611
606
|
classNamePrefix: "react-select",
|
|
612
|
-
value:
|
|
613
|
-
options:
|
|
607
|
+
value: l,
|
|
608
|
+
options: o,
|
|
614
609
|
styles: {
|
|
615
|
-
menu: (
|
|
616
|
-
...
|
|
610
|
+
menu: (s) => ({
|
|
611
|
+
...s,
|
|
617
612
|
marginTop: 0
|
|
618
613
|
})
|
|
619
614
|
},
|
|
620
|
-
onChange: (
|
|
621
|
-
const _ =
|
|
622
|
-
(
|
|
615
|
+
onChange: (s) => {
|
|
616
|
+
const _ = s ? s.map(
|
|
617
|
+
(F) => F.value
|
|
623
618
|
) : [];
|
|
624
|
-
|
|
619
|
+
a(_.length ? _ : void 0, !0);
|
|
625
620
|
},
|
|
626
|
-
onKeyDown:
|
|
621
|
+
onKeyDown: h,
|
|
627
622
|
placeholder: I("Select...")
|
|
628
623
|
}
|
|
629
624
|
) }) });
|
|
630
625
|
}
|
|
631
626
|
if (w || S === "date") {
|
|
632
|
-
const
|
|
627
|
+
const o = w ? Je : xt, l = t || {
|
|
633
628
|
from: void 0,
|
|
634
629
|
to: void 0,
|
|
635
630
|
filterEmpty: void 0
|
|
636
631
|
};
|
|
637
|
-
return /* @__PURE__ */
|
|
638
|
-
|
|
639
|
-
/* @__PURE__ */
|
|
632
|
+
return /* @__PURE__ */ B("ol", { className: "mig-schema-table-menu mig-schema-table__th-menu__filter-menu-component", children: [
|
|
633
|
+
b ? null : /* @__PURE__ */ B("li", { style: { padding: 8 }, children: [
|
|
634
|
+
/* @__PURE__ */ B("label", { className: "d-flex", children: [
|
|
640
635
|
/* @__PURE__ */ r(
|
|
641
636
|
"input",
|
|
642
637
|
{
|
|
643
638
|
type: "checkbox",
|
|
644
|
-
checked: !!
|
|
639
|
+
checked: !!l.filterEmpty,
|
|
645
640
|
onChange: () => {
|
|
646
|
-
const { filterEmpty:
|
|
647
|
-
|
|
641
|
+
const { filterEmpty: s, ..._ } = l;
|
|
642
|
+
s || (_.filterEmpty = !0), a(
|
|
648
643
|
Object.keys(_).length ? _ : void 0,
|
|
649
644
|
!0
|
|
650
645
|
);
|
|
@@ -655,26 +650,26 @@ const an = ({ index: t, style: s }) => {
|
|
|
655
650
|
] }),
|
|
656
651
|
/* @__PURE__ */ r("hr", {})
|
|
657
652
|
] }),
|
|
658
|
-
/* @__PURE__ */
|
|
653
|
+
/* @__PURE__ */ B("li", { style: { padding: 8 }, children: [
|
|
659
654
|
/* @__PURE__ */ r("label", { style: { width: 120, paddingLeft: 4 }, children: "After" }),
|
|
660
655
|
/* @__PURE__ */ r(
|
|
661
656
|
dt,
|
|
662
657
|
{
|
|
663
|
-
dateFormat:
|
|
658
|
+
dateFormat: o,
|
|
664
659
|
"data-prop-name": p,
|
|
665
660
|
locale: ht,
|
|
666
|
-
selected:
|
|
661
|
+
selected: l.from ? new Pe(l.from).withTimeZone(
|
|
667
662
|
C || Te
|
|
668
663
|
) : null,
|
|
669
|
-
onChange: (
|
|
670
|
-
if (!
|
|
671
|
-
|
|
664
|
+
onChange: (s) => {
|
|
665
|
+
if (!s && !l.to) {
|
|
666
|
+
a(void 0, !0);
|
|
672
667
|
return;
|
|
673
668
|
}
|
|
674
|
-
if (
|
|
669
|
+
if (l.to && s && s > l.to)
|
|
675
670
|
return;
|
|
676
|
-
const _ =
|
|
677
|
-
|
|
671
|
+
const _ = s ? Pe.tz(C || Te, s) : void 0;
|
|
672
|
+
a(
|
|
678
673
|
{
|
|
679
674
|
...t,
|
|
680
675
|
from: _
|
|
@@ -682,7 +677,7 @@ const an = ({ index: t, style: s }) => {
|
|
|
682
677
|
!0
|
|
683
678
|
);
|
|
684
679
|
},
|
|
685
|
-
placeholderText:
|
|
680
|
+
placeholderText: o,
|
|
686
681
|
isClearable: !0,
|
|
687
682
|
selectsStart: !0,
|
|
688
683
|
showTimeSelect: w,
|
|
@@ -694,28 +689,28 @@ const an = ({ index: t, style: s }) => {
|
|
|
694
689
|
}
|
|
695
690
|
)
|
|
696
691
|
] }),
|
|
697
|
-
/* @__PURE__ */
|
|
692
|
+
/* @__PURE__ */ B("li", { style: { padding: 8 }, children: [
|
|
698
693
|
/* @__PURE__ */ r("label", { style: { width: 120, paddingLeft: 4 }, children: "Before" }),
|
|
699
694
|
/* @__PURE__ */ r(
|
|
700
695
|
dt,
|
|
701
696
|
{
|
|
702
697
|
id: "filter-date",
|
|
703
|
-
dateFormat:
|
|
698
|
+
dateFormat: o,
|
|
704
699
|
"data-prop-name": p,
|
|
705
700
|
locale: ht,
|
|
706
701
|
selectsEnd: !0,
|
|
707
|
-
selected:
|
|
702
|
+
selected: l.to ? new Pe(l.to).withTimeZone(
|
|
708
703
|
C || Te
|
|
709
704
|
) : null,
|
|
710
705
|
showMonthDropdown: !0,
|
|
711
706
|
showYearDropdown: !0,
|
|
712
|
-
onChange: (
|
|
713
|
-
if (!
|
|
714
|
-
|
|
707
|
+
onChange: (s) => {
|
|
708
|
+
if (!s && !l.from) {
|
|
709
|
+
a(void 0, !0);
|
|
715
710
|
return;
|
|
716
711
|
}
|
|
717
|
-
const _ =
|
|
718
|
-
|
|
712
|
+
const _ = s ? w ? Pe.tz(C || Te, s) : Jt(s) : void 0;
|
|
713
|
+
l.from && _ && _ < l.from || a(
|
|
719
714
|
{
|
|
720
715
|
...t,
|
|
721
716
|
to: _
|
|
@@ -723,10 +718,10 @@ const an = ({ index: t, style: s }) => {
|
|
|
723
718
|
!0
|
|
724
719
|
);
|
|
725
720
|
},
|
|
726
|
-
placeholderText:
|
|
721
|
+
placeholderText: o,
|
|
727
722
|
isClearable: !0,
|
|
728
|
-
startDate:
|
|
729
|
-
endDate:
|
|
723
|
+
startDate: l.from,
|
|
724
|
+
endDate: l.to,
|
|
730
725
|
showTimeInput: w,
|
|
731
726
|
showTimeSelect: w,
|
|
732
727
|
timeIntervals: 15,
|
|
@@ -746,20 +741,20 @@ const an = ({ index: t, style: s }) => {
|
|
|
746
741
|
className: "form-control",
|
|
747
742
|
placeholder: `Search ${p}`,
|
|
748
743
|
"aria-label": `Search ${p}`,
|
|
749
|
-
value: Array.isArray(
|
|
744
|
+
value: Array.isArray(T) ? T.join(", ") : T || "",
|
|
750
745
|
"data-prop-name": p,
|
|
751
|
-
onChange: (
|
|
752
|
-
const
|
|
753
|
-
|
|
754
|
-
(
|
|
746
|
+
onChange: (o) => {
|
|
747
|
+
const l = o.currentTarget.value, s = l ? l.split(",").map((_) => _.trim()) : [];
|
|
748
|
+
a(
|
|
749
|
+
(s.length > 1 ? s : s[0]) || void 0,
|
|
755
750
|
!1
|
|
756
751
|
);
|
|
757
752
|
},
|
|
758
|
-
onKeyDown:
|
|
759
|
-
onBlur: (
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
(
|
|
753
|
+
onKeyDown: h,
|
|
754
|
+
onBlur: (o) => {
|
|
755
|
+
const l = o.currentTarget.value, s = l ? l.split(",").map((_) => _.trim()) : [];
|
|
756
|
+
a(
|
|
757
|
+
(s.length > 1 ? s : s[0]) || void 0,
|
|
763
758
|
!0
|
|
764
759
|
);
|
|
765
760
|
}
|
|
@@ -767,88 +762,88 @@ const an = ({ index: t, style: s }) => {
|
|
|
767
762
|
) }) });
|
|
768
763
|
}
|
|
769
764
|
}
|
|
770
|
-
),
|
|
765
|
+
), mn = ({
|
|
771
766
|
isSortable: t,
|
|
772
|
-
isFilterable:
|
|
773
|
-
onChange:
|
|
774
|
-
onClose:
|
|
767
|
+
isFilterable: a,
|
|
768
|
+
onChange: h,
|
|
769
|
+
onClose: b,
|
|
775
770
|
onInputKeyDown: p,
|
|
776
|
-
propConfig:
|
|
771
|
+
propConfig: f,
|
|
777
772
|
propIsRequired: I,
|
|
778
773
|
propName: C,
|
|
779
|
-
propSchema:
|
|
774
|
+
propSchema: W,
|
|
780
775
|
referenceElement: S,
|
|
781
|
-
setFilterSortColumn:
|
|
782
|
-
translate:
|
|
783
|
-
value:
|
|
776
|
+
setFilterSortColumn: M,
|
|
777
|
+
translate: R,
|
|
778
|
+
value: T
|
|
784
779
|
}) => {
|
|
785
780
|
const w = ft({
|
|
786
781
|
placement: "bottom-start",
|
|
787
782
|
elements: {
|
|
788
783
|
reference: S
|
|
789
784
|
},
|
|
790
|
-
middleware: [
|
|
785
|
+
middleware: [gt()]
|
|
791
786
|
}), $ = ft({
|
|
792
787
|
placement: "right-start",
|
|
793
|
-
middleware: [
|
|
788
|
+
middleware: [gt()]
|
|
794
789
|
});
|
|
795
790
|
e.useEffect(() => {
|
|
796
|
-
const
|
|
791
|
+
const l = (s) => {
|
|
797
792
|
if (!w.elements.floating)
|
|
798
793
|
return;
|
|
799
|
-
let _ =
|
|
794
|
+
let _ = s.target;
|
|
800
795
|
for (; _ && w.elements.floating; ) {
|
|
801
796
|
if (_ === w.elements.floating || _ === $.elements.floating)
|
|
802
797
|
return;
|
|
803
798
|
_ = _.parentNode === window.document ? null : _.parentNode;
|
|
804
799
|
}
|
|
805
|
-
|
|
800
|
+
b(s);
|
|
806
801
|
};
|
|
807
|
-
return window.addEventListener("click",
|
|
808
|
-
window.removeEventListener("click",
|
|
802
|
+
return window.addEventListener("click", l, { capture: !0 }), () => {
|
|
803
|
+
window.removeEventListener("click", l, { capture: !0 });
|
|
809
804
|
};
|
|
810
805
|
}, [
|
|
811
806
|
w.elements.floating,
|
|
812
|
-
|
|
807
|
+
b,
|
|
813
808
|
$.elements.floating
|
|
814
809
|
]);
|
|
815
|
-
const
|
|
816
|
-
(
|
|
817
|
-
|
|
810
|
+
const q = f?.FilterMenu || dn, ee = e.useCallback(
|
|
811
|
+
(l) => {
|
|
812
|
+
M(C, !0), b(l);
|
|
818
813
|
},
|
|
819
|
-
[
|
|
820
|
-
),
|
|
821
|
-
(
|
|
822
|
-
|
|
814
|
+
[b, C, M]
|
|
815
|
+
), E = e.useCallback(
|
|
816
|
+
(l) => {
|
|
817
|
+
M(C, !1), b(l);
|
|
823
818
|
},
|
|
824
|
-
[
|
|
825
|
-
),
|
|
826
|
-
|
|
827
|
-
}, [
|
|
828
|
-
return !t && !
|
|
819
|
+
[b, C, M]
|
|
820
|
+
), o = e.useCallback(() => {
|
|
821
|
+
h(void 0, !0);
|
|
822
|
+
}, [h]);
|
|
823
|
+
return !t && !a ? null : /* @__PURE__ */ B(Ft, { children: [
|
|
829
824
|
/* @__PURE__ */ r(
|
|
830
825
|
"div",
|
|
831
826
|
{
|
|
832
827
|
className: "mig-schema-table mig-schema-table__th-menu",
|
|
833
828
|
ref: w.refs.setFloating,
|
|
834
829
|
style: w.floatingStyles,
|
|
835
|
-
children: /* @__PURE__ */
|
|
836
|
-
t ? /* @__PURE__ */
|
|
830
|
+
children: /* @__PURE__ */ B("ol", { className: "mig-schema-table-menu", children: [
|
|
831
|
+
t ? /* @__PURE__ */ B("li", { onClick: ee, style: { padding: 8 }, children: [
|
|
837
832
|
/* @__PURE__ */ r("span", { className: "mig-schema-table__th-menu__icon", children: "↓" }),
|
|
838
833
|
" ",
|
|
839
|
-
|
|
834
|
+
R("sortAscending")
|
|
840
835
|
] }) : null,
|
|
841
|
-
t ? /* @__PURE__ */
|
|
836
|
+
t ? /* @__PURE__ */ B("li", { onClick: E, style: { padding: 8 }, children: [
|
|
842
837
|
/* @__PURE__ */ r("span", { className: "mig-schema-table__th-menu__icon", children: "↑" }),
|
|
843
838
|
" ",
|
|
844
|
-
|
|
839
|
+
R("sortDescending")
|
|
845
840
|
] }) : null,
|
|
846
|
-
|
|
841
|
+
a ? /* @__PURE__ */ B(
|
|
847
842
|
"li",
|
|
848
843
|
{
|
|
849
844
|
style: { padding: 8 },
|
|
850
|
-
onMouseOver: (
|
|
851
|
-
$.refs.setReference(
|
|
845
|
+
onMouseOver: (l) => {
|
|
846
|
+
$.refs.setReference(l.currentTarget);
|
|
852
847
|
},
|
|
853
848
|
children: [
|
|
854
849
|
/* @__PURE__ */ r("span", { className: "mig-schema-table__th-menu__icon", children: /* @__PURE__ */ r(
|
|
@@ -856,12 +851,12 @@ const an = ({ index: t, style: s }) => {
|
|
|
856
851
|
{
|
|
857
852
|
type: "checkbox",
|
|
858
853
|
id: "mig-schema-table__th-menu__filters",
|
|
859
|
-
checked:
|
|
860
|
-
disabled:
|
|
861
|
-
onChange:
|
|
854
|
+
checked: T !== void 0,
|
|
855
|
+
disabled: T === void 0,
|
|
856
|
+
onChange: o
|
|
862
857
|
}
|
|
863
858
|
) }),
|
|
864
|
-
/* @__PURE__ */ r("label", { htmlFor: "mig-schema-table__th-menu__filters", children:
|
|
859
|
+
/* @__PURE__ */ r("label", { htmlFor: "mig-schema-table__th-menu__filters", children: R("filters") }),
|
|
865
860
|
/* @__PURE__ */ r("div", { className: "mig-schema-table__th-menu__sub-menu-indicator" })
|
|
866
861
|
]
|
|
867
862
|
}
|
|
@@ -876,491 +871,501 @@ const an = ({ index: t, style: s }) => {
|
|
|
876
871
|
ref: $.refs.setFloating,
|
|
877
872
|
style: $.floatingStyles,
|
|
878
873
|
children: /* @__PURE__ */ r(
|
|
879
|
-
|
|
874
|
+
q,
|
|
880
875
|
{
|
|
881
|
-
columnFilterValue:
|
|
882
|
-
onChange:
|
|
876
|
+
columnFilterValue: T,
|
|
877
|
+
onChange: h,
|
|
883
878
|
onInputKeyDown: p,
|
|
884
879
|
propIsRequired: I,
|
|
885
880
|
propName: C,
|
|
886
|
-
propSchema:
|
|
887
|
-
translate:
|
|
881
|
+
propSchema: W,
|
|
882
|
+
translate: R
|
|
888
883
|
}
|
|
889
884
|
)
|
|
890
885
|
}
|
|
891
886
|
) : null
|
|
892
887
|
] });
|
|
893
|
-
},
|
|
888
|
+
}, hn = e.memo(mn), fn = ({
|
|
894
889
|
columnWidths: t,
|
|
895
|
-
resizeColumnIndex:
|
|
896
|
-
setResizeColumnIndex:
|
|
897
|
-
tableBodyHeight:
|
|
890
|
+
resizeColumnIndex: a,
|
|
891
|
+
setResizeColumnIndex: h,
|
|
892
|
+
tableBodyHeight: b
|
|
898
893
|
}) => {
|
|
899
|
-
const [p,
|
|
900
|
-
(
|
|
901
|
-
const
|
|
902
|
-
(w, $) => $ ===
|
|
894
|
+
const [p, f] = e.useState(0), I = Mt(), C = e.useCallback(
|
|
895
|
+
(R) => {
|
|
896
|
+
const T = t.map(
|
|
897
|
+
(w, $) => $ === a ? Math.max(w + R, Dt) : w
|
|
903
898
|
);
|
|
904
|
-
I(
|
|
899
|
+
I(T);
|
|
905
900
|
},
|
|
906
|
-
[t,
|
|
901
|
+
[t, a, I]
|
|
907
902
|
);
|
|
908
|
-
let
|
|
903
|
+
let W = 0;
|
|
909
904
|
const S = e.useCallback(
|
|
910
|
-
(
|
|
911
|
-
|
|
905
|
+
(R) => {
|
|
906
|
+
h(parseInt(R.currentTarget.dataset.columnIndex)), f(R.clientX);
|
|
912
907
|
},
|
|
913
|
-
[
|
|
914
|
-
),
|
|
915
|
-
(
|
|
916
|
-
C(
|
|
908
|
+
[h]
|
|
909
|
+
), M = e.useCallback(
|
|
910
|
+
(R) => {
|
|
911
|
+
C(R.clientX - p), f(0), h(-1);
|
|
917
912
|
},
|
|
918
|
-
[p, C,
|
|
913
|
+
[p, C, h]
|
|
919
914
|
);
|
|
920
|
-
return /* @__PURE__ */ r("div", { children: [...t].map((
|
|
921
|
-
|
|
915
|
+
return /* @__PURE__ */ r("div", { children: [...t].map((R, T) => {
|
|
916
|
+
W += R;
|
|
922
917
|
const w = ["mig-schema-table__column_resizer"];
|
|
923
|
-
return
|
|
918
|
+
return T === a && w.push("mig-schema-table__column_resizer--dragged"), /* @__PURE__ */ r(
|
|
924
919
|
"div",
|
|
925
920
|
{
|
|
926
|
-
style: { left:
|
|
921
|
+
style: { left: W - rn, bottom: b },
|
|
927
922
|
className: w.join(" "),
|
|
928
923
|
draggable: "true",
|
|
929
|
-
"data-column-index":
|
|
924
|
+
"data-column-index": T,
|
|
930
925
|
onDragStart: S,
|
|
931
|
-
onDragEnd:
|
|
926
|
+
onDragEnd: M
|
|
932
927
|
},
|
|
933
|
-
|
|
928
|
+
T
|
|
934
929
|
);
|
|
935
930
|
}) });
|
|
936
|
-
},
|
|
937
|
-
const [
|
|
938
|
-
() =>
|
|
931
|
+
}, wt = (t) => {
|
|
932
|
+
const [a, h] = e.useState({ width: 0, height: 0 }), b = e.useMemo(
|
|
933
|
+
() => Ht(h, 100),
|
|
939
934
|
[]
|
|
940
935
|
);
|
|
941
936
|
return e.useEffect(() => {
|
|
942
937
|
if (!t)
|
|
943
938
|
return;
|
|
944
|
-
const p = new ResizeObserver((
|
|
945
|
-
for (const I of
|
|
946
|
-
const { blockSize: C, inlineSize:
|
|
947
|
-
|
|
948
|
-
(S) =>
|
|
939
|
+
const p = new ResizeObserver((f) => {
|
|
940
|
+
for (const I of f) {
|
|
941
|
+
const { blockSize: C, inlineSize: W } = I.borderBoxSize[0];
|
|
942
|
+
b(
|
|
943
|
+
(S) => W && C && (S.width !== W || S.height !== C) ? { width: W, height: C } : S
|
|
949
944
|
);
|
|
950
945
|
}
|
|
951
946
|
});
|
|
952
947
|
return p.observe(t), () => {
|
|
953
948
|
p.disconnect();
|
|
954
949
|
};
|
|
955
|
-
}, [
|
|
956
|
-
},
|
|
950
|
+
}, [b, t]), a;
|
|
951
|
+
}, gn = () => new Promise((t, a) => {
|
|
957
952
|
if (window.ExcelJS) {
|
|
958
953
|
t(window.ExcelJS);
|
|
959
954
|
return;
|
|
960
955
|
}
|
|
961
|
-
const
|
|
962
|
-
|
|
956
|
+
const h = document.createElement("script");
|
|
957
|
+
h.src = "https://cdnjs.cloudflare.com/ajax/libs/exceljs/4.4.0/exceljs.bare.min.js", h.onload = () => {
|
|
963
958
|
t(window.ExcelJS);
|
|
964
|
-
},
|
|
965
|
-
|
|
966
|
-
}, document.head.appendChild(
|
|
959
|
+
}, h.onerror = () => {
|
|
960
|
+
a(new Error("Failed to load ExcelJS library"));
|
|
961
|
+
}, document.head.appendChild(h);
|
|
967
962
|
}), bn = async (t) => {
|
|
968
|
-
const { Workbook:
|
|
969
|
-
t.length && (
|
|
970
|
-
|
|
963
|
+
const { Workbook: a } = await gn(), h = new a(), b = h.addWorksheet("Data");
|
|
964
|
+
t.length && (b.addRow(
|
|
965
|
+
Vt(Object.keys(t[0]), [
|
|
971
966
|
"_index",
|
|
972
967
|
"SELECT_ALL_COLUMN_NAME"
|
|
973
968
|
])
|
|
974
|
-
),
|
|
969
|
+
), b.getRow(1).font = { bold: !0 }, b.addRows(
|
|
975
970
|
t.map((p) => {
|
|
976
|
-
const { _index:
|
|
971
|
+
const { _index: f, SELECT_ALL_COLUMN_NAME: I, ...C } = p;
|
|
977
972
|
return Object.values(C);
|
|
978
973
|
})
|
|
979
|
-
),
|
|
980
|
-
const
|
|
974
|
+
), h.xlsx.writeBuffer().then((p) => {
|
|
975
|
+
const f = new Blob([p], {
|
|
981
976
|
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
982
977
|
});
|
|
983
|
-
|
|
978
|
+
tn(f, "export.xlsx");
|
|
984
979
|
}).catch((p) => {
|
|
985
980
|
console.error("Error generating Excel file:", p);
|
|
986
981
|
}));
|
|
987
|
-
},
|
|
982
|
+
}, vt = /* @__PURE__ */ new Date("1000-01-01 00:00:00Z"), pn = new Intl.NumberFormat("nl-NL"), _n = new Intl.NumberFormat("nl-NL", {
|
|
988
983
|
style: "currency",
|
|
989
984
|
currency: "EUR"
|
|
990
985
|
});
|
|
991
|
-
function
|
|
992
|
-
const { TdBody:
|
|
993
|
-
if (
|
|
994
|
-
return
|
|
986
|
+
function Cn(t, a) {
|
|
987
|
+
const { TdBody: h, sortByValue: b } = a || {};
|
|
988
|
+
if (b !== void 0)
|
|
989
|
+
return b;
|
|
995
990
|
if (!t)
|
|
996
991
|
return !1;
|
|
997
|
-
const { format: p, type:
|
|
998
|
-
return p?.startsWith("date") ||
|
|
992
|
+
const { format: p, type: f } = t;
|
|
993
|
+
return p?.startsWith("date") || f === "boolean" || f === "integer" || f === "number" || !!h;
|
|
999
994
|
}
|
|
1000
|
-
const
|
|
995
|
+
const yn = ({
|
|
1001
996
|
CustomElement: t,
|
|
1002
|
-
CustomSearchInput:
|
|
1003
|
-
Heading:
|
|
1004
|
-
autoRender:
|
|
997
|
+
CustomSearchInput: a,
|
|
998
|
+
Heading: h = Ut,
|
|
999
|
+
autoRender: b,
|
|
1005
1000
|
checkedIndexes: p,
|
|
1006
|
-
config:
|
|
1001
|
+
config: f,
|
|
1007
1002
|
customElementProps: I,
|
|
1008
1003
|
data: C,
|
|
1009
|
-
defaultColumnFilters:
|
|
1004
|
+
defaultColumnFilters: W,
|
|
1010
1005
|
defaultSortAsc: S = !1,
|
|
1011
|
-
defaultSortColumn:
|
|
1012
|
-
disabledCheckedIndexes:
|
|
1013
|
-
displayTimezone:
|
|
1006
|
+
defaultSortColumn: M,
|
|
1007
|
+
disabledCheckedIndexes: R,
|
|
1008
|
+
displayTimezone: T,
|
|
1014
1009
|
enableAutoFocus: w = !0,
|
|
1015
1010
|
enableRowCounter: $ = !0,
|
|
1016
|
-
getRowClassName:
|
|
1011
|
+
getRowClassName: q,
|
|
1017
1012
|
getRowSelected: ee,
|
|
1018
|
-
getSearchQueryFilterResult:
|
|
1019
|
-
infiniteLoaderRef:
|
|
1020
|
-
isColumnFilterable:
|
|
1021
|
-
isExportable:
|
|
1013
|
+
getSearchQueryFilterResult: E,
|
|
1014
|
+
infiniteLoaderRef: o,
|
|
1015
|
+
isColumnFilterable: l = !0,
|
|
1016
|
+
isExportable: s = !0,
|
|
1022
1017
|
isResizable: _ = !0,
|
|
1023
|
-
isSearchable:
|
|
1018
|
+
isSearchable: F = !0,
|
|
1024
1019
|
isSortable: te = !0,
|
|
1025
1020
|
itemCount: ce,
|
|
1026
1021
|
loadMoreItems: ne,
|
|
1027
1022
|
maxHeight: y,
|
|
1028
1023
|
onRowClick: L,
|
|
1029
1024
|
onRowDoubleClick: ae,
|
|
1030
|
-
onSearchEnter:
|
|
1025
|
+
onSearchEnter: H,
|
|
1031
1026
|
onTableDataStateChange: re,
|
|
1032
1027
|
rowHeight: Q = 36,
|
|
1033
|
-
schema:
|
|
1028
|
+
schema: G,
|
|
1034
1029
|
searchPlaceholder: _e,
|
|
1035
|
-
setCheckedIndexes:
|
|
1030
|
+
setCheckedIndexes: X,
|
|
1036
1031
|
settingsStorageKey: v,
|
|
1037
1032
|
style: N,
|
|
1038
|
-
translate: k =
|
|
1039
|
-
useFilterStateHash:
|
|
1033
|
+
translate: k = bt,
|
|
1034
|
+
useFilterStateHash: D,
|
|
1040
1035
|
width: se
|
|
1041
1036
|
}, ve) => {
|
|
1042
|
-
const [Ce, oe] = e.useState(), [Ae, Oe] = e.useState(), [
|
|
1037
|
+
const [Ce, oe] = e.useState(), [Ae, Oe] = e.useState(), [Ze, Ge] = e.useState(-1), [Ee, qe] = e.useState(-1), [z, j] = e.useState(), [me, ye] = e.useState(), J = C instanceof Function, [x, be] = e.useState(
|
|
1043
1038
|
J ? void 0 : C
|
|
1044
|
-
), [he,
|
|
1039
|
+
), [he, Xe] = e.useState(), [c, ke] = e.useState({
|
|
1045
1040
|
searchQuery: "",
|
|
1046
|
-
columnFilterMap:
|
|
1047
|
-
sortColumn:
|
|
1041
|
+
columnFilterMap: W || {},
|
|
1042
|
+
sortColumn: M,
|
|
1048
1043
|
sortAsc: S
|
|
1049
|
-
}), [U,
|
|
1050
|
-
|
|
1044
|
+
}), [U, At] = e.useState(
|
|
1045
|
+
D ? ut(window.location.hash) : null
|
|
1051
1046
|
);
|
|
1052
1047
|
e.useEffect(() => {
|
|
1053
|
-
J ||
|
|
1048
|
+
J || be(C);
|
|
1054
1049
|
}, [C, J]), e.useEffect(() => {
|
|
1055
1050
|
!J || x !== void 0 || C(
|
|
1056
1051
|
U && Object.keys(U).length !== 0 ? {
|
|
1057
1052
|
...U,
|
|
1058
1053
|
columnFilterMap: U.columnFilterMap || {}
|
|
1059
|
-
} :
|
|
1060
|
-
).then(
|
|
1061
|
-
}, [C, J, U, x,
|
|
1062
|
-
he ||
|
|
1063
|
-
}, [
|
|
1064
|
-
if (!
|
|
1054
|
+
} : c
|
|
1055
|
+
).then(be);
|
|
1056
|
+
}, [C, J, U, x, c]), e.useEffect(() => {
|
|
1057
|
+
he || Xe(c);
|
|
1058
|
+
}, [c, he]), e.useEffect(() => {
|
|
1059
|
+
if (!D)
|
|
1065
1060
|
return;
|
|
1066
1061
|
const n = () => {
|
|
1067
|
-
|
|
1062
|
+
At(ut(window.location.hash));
|
|
1068
1063
|
};
|
|
1069
1064
|
return window.addEventListener("hashchange", n), () => {
|
|
1070
1065
|
window.removeEventListener("hashchange", n);
|
|
1071
1066
|
};
|
|
1072
|
-
}, [
|
|
1073
|
-
if (!
|
|
1067
|
+
}, [D]), e.useEffect(() => {
|
|
1068
|
+
if (!D)
|
|
1074
1069
|
return;
|
|
1075
|
-
const { columnFilterMap: n, searchQuery: u, sortAsc:
|
|
1070
|
+
const { columnFilterMap: n, searchQuery: u, sortAsc: m, sortColumn: i } = U || {}, g = {
|
|
1076
1071
|
searchQuery: u || "",
|
|
1077
|
-
columnFilterMap: n ||
|
|
1078
|
-
sortAsc:
|
|
1079
|
-
sortColumn:
|
|
1072
|
+
columnFilterMap: n || W || {},
|
|
1073
|
+
sortAsc: m === void 0 ? S : m,
|
|
1074
|
+
sortColumn: i === void 0 ? M : i
|
|
1080
1075
|
};
|
|
1081
1076
|
ke(
|
|
1082
|
-
(
|
|
1077
|
+
(A) => tt(g, A) ? A : g
|
|
1083
1078
|
);
|
|
1084
1079
|
}, [
|
|
1085
1080
|
U,
|
|
1086
|
-
|
|
1087
|
-
|
|
1081
|
+
D,
|
|
1082
|
+
W,
|
|
1088
1083
|
S,
|
|
1089
|
-
|
|
1084
|
+
M
|
|
1090
1085
|
]), e.useEffect(() => {
|
|
1091
|
-
re && re(
|
|
1092
|
-
}, [re,
|
|
1093
|
-
const Re = e.useRef(null), rt = e.useRef(null), st = e.useRef(null), We =
|
|
1086
|
+
re && re(c);
|
|
1087
|
+
}, [re, c]);
|
|
1088
|
+
const Re = e.useRef(null), rt = e.useRef(null), st = e.useRef(null), We = wt(rt.current), ot = wt(
|
|
1094
1089
|
st.current
|
|
1095
1090
|
), Le = e.useMemo(
|
|
1096
1091
|
() => se || Math.floor(We.width || 0),
|
|
1097
1092
|
[We.width, se]
|
|
1098
|
-
), Ne = e.useMemo(() => !tt(
|
|
1093
|
+
), Ne = e.useMemo(() => !tt(c, he) && J, [c, he, J]), { properties: ie, required: Et } = e.useMemo(
|
|
1099
1094
|
() => ({
|
|
1100
1095
|
properties: {},
|
|
1101
1096
|
required: [],
|
|
1102
|
-
...
|
|
1097
|
+
...G
|
|
1103
1098
|
}),
|
|
1104
|
-
[
|
|
1105
|
-
), je = v ? localStorage.getItem(`${v}.columnNames`) : null,
|
|
1099
|
+
[G]
|
|
1100
|
+
), je = v ? localStorage.getItem(`${v}.columnNames`) : null, Be = v ? localStorage.getItem(`${v}.columnWidths`) : null, Y = e.useMemo(() => {
|
|
1106
1101
|
if (Ce)
|
|
1107
1102
|
return Ce;
|
|
1108
1103
|
const n = je ? JSON.parse(je) : void 0;
|
|
1109
1104
|
let u = Object.keys(ie);
|
|
1110
|
-
if (
|
|
1111
|
-
Object.keys(
|
|
1112
|
-
u.includes(
|
|
1105
|
+
if (X && u.unshift(K), f) {
|
|
1106
|
+
Object.keys(f).forEach((i) => {
|
|
1107
|
+
u.includes(i) || u.push(i);
|
|
1113
1108
|
});
|
|
1114
|
-
const
|
|
1115
|
-
(
|
|
1109
|
+
const m = Object.entries(f).reduce(
|
|
1110
|
+
(i, [g, A]) => (A.hidden && i.push(g), i),
|
|
1116
1111
|
[]
|
|
1117
1112
|
);
|
|
1118
|
-
u = u.filter((
|
|
1119
|
-
let
|
|
1120
|
-
|
|
1121
|
-
(
|
|
1113
|
+
u = u.filter((i) => !m.includes(i)).sort((i, g) => {
|
|
1114
|
+
let A = f[i] ? f[i].order : void 0;
|
|
1115
|
+
A === void 0 && (A = Object.keys(ie).findIndex(
|
|
1116
|
+
(V) => V === i
|
|
1122
1117
|
));
|
|
1123
|
-
let
|
|
1124
|
-
return
|
|
1125
|
-
(
|
|
1126
|
-
)),
|
|
1118
|
+
let d = f[g] ? f[g].order : void 0;
|
|
1119
|
+
return d === void 0 && (d = Object.keys(ie).findIndex(
|
|
1120
|
+
(V) => V === g
|
|
1121
|
+
)), g === K || i === K ? 0 : A === -1 ? 1 : d === -1 ? -1 : A - d;
|
|
1127
1122
|
});
|
|
1128
1123
|
}
|
|
1129
1124
|
return n?.length === u.length ? n : u;
|
|
1130
1125
|
}, [
|
|
1131
|
-
|
|
1126
|
+
f,
|
|
1132
1127
|
Ce,
|
|
1133
|
-
|
|
1128
|
+
X,
|
|
1134
1129
|
ie,
|
|
1135
1130
|
je
|
|
1136
|
-
]),
|
|
1131
|
+
]), Fe = e.useMemo(
|
|
1137
1132
|
() => x && Y ? x.map(
|
|
1138
1133
|
(n, u) => Y.reduce(
|
|
1139
|
-
(
|
|
1140
|
-
const
|
|
1141
|
-
if (
|
|
1142
|
-
return
|
|
1143
|
-
if (!
|
|
1144
|
-
return
|
|
1145
|
-
const
|
|
1146
|
-
switch (
|
|
1134
|
+
(m, i) => {
|
|
1135
|
+
const g = ie[i], A = f ? f[i] : void 0;
|
|
1136
|
+
if (A?.renderData)
|
|
1137
|
+
return m[i] = A.renderData(n, u), m;
|
|
1138
|
+
if (!g || i === K)
|
|
1139
|
+
return m[i] = "", m;
|
|
1140
|
+
const d = n ? n[i] : "";
|
|
1141
|
+
switch (g.type) {
|
|
1147
1142
|
case "array":
|
|
1148
|
-
return
|
|
1143
|
+
return m[i] = g.items?.type === "string" && d ? d.map((V) => k(V)).join(", ") : JSON.stringify(d), m;
|
|
1149
1144
|
case "boolean":
|
|
1150
|
-
return
|
|
1145
|
+
return m[i] = d === void 0 ? "?" : d ? "✓" : "✕", m;
|
|
1151
1146
|
case "number":
|
|
1152
1147
|
case "integer":
|
|
1153
|
-
return
|
|
1148
|
+
return d === void 0 ? (m[i] = "", m) : (m[i] = g.format === "currency" ? _n.format(d) : pn.format(d), m);
|
|
1154
1149
|
// @ts-expect-error investigate
|
|
1155
1150
|
case "string":
|
|
1156
|
-
if (
|
|
1157
|
-
return
|
|
1158
|
-
|
|
1151
|
+
if (g.format === "date" && d)
|
|
1152
|
+
return m[i] = ["2999-12-31", "1970-01-01"].includes(
|
|
1153
|
+
d
|
|
1159
1154
|
) ? "-" : nt(
|
|
1160
|
-
new Date(
|
|
1161
|
-
|
|
1162
|
-
),
|
|
1163
|
-
if (
|
|
1164
|
-
return
|
|
1165
|
-
new Date(
|
|
1166
|
-
|
|
1155
|
+
new Date(d),
|
|
1156
|
+
A?.dateFormat || xt
|
|
1157
|
+
), m;
|
|
1158
|
+
if (g.format === "date-time" && d)
|
|
1159
|
+
return m[i] = T ? kt(
|
|
1160
|
+
new Date(d),
|
|
1161
|
+
T,
|
|
1167
1162
|
Je
|
|
1168
1163
|
) : nt(
|
|
1169
|
-
new Date(
|
|
1170
|
-
|
|
1171
|
-
),
|
|
1172
|
-
if (
|
|
1173
|
-
return
|
|
1164
|
+
new Date(d),
|
|
1165
|
+
A?.dateFormat || Je
|
|
1166
|
+
), m;
|
|
1167
|
+
if (g.enum)
|
|
1168
|
+
return m[i] = d ? k(d) : "", m;
|
|
1174
1169
|
// fallthrough
|
|
1175
1170
|
default:
|
|
1176
|
-
return
|
|
1171
|
+
return m[i] = d ? `${d}` : "", m;
|
|
1177
1172
|
}
|
|
1178
1173
|
},
|
|
1179
1174
|
{ _index: u }
|
|
1180
1175
|
)
|
|
1181
1176
|
) : void 0,
|
|
1182
|
-
[x, Y, ie,
|
|
1183
|
-
), xe = Y ? Y.length : 0, { dynamicWidthColumnCount:
|
|
1177
|
+
[x, Y, ie, f, k, T]
|
|
1178
|
+
), xe = Y ? Y.length : 0, { dynamicWidthColumnCount: He, fixedWidthColumnsWidth: Ve } = e.useMemo(() => {
|
|
1184
1179
|
let n = 0, u = 0;
|
|
1185
|
-
return (Y || []).forEach((
|
|
1186
|
-
if (
|
|
1180
|
+
return (Y || []).forEach((m) => {
|
|
1181
|
+
if (m === K) {
|
|
1187
1182
|
n += pt;
|
|
1188
1183
|
return;
|
|
1189
1184
|
}
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1185
|
+
const i = f ? f[m] : void 0;
|
|
1186
|
+
i?.width ? n += i.width : u += 1;
|
|
1192
1187
|
}, 0), { dynamicWidthColumnCount: u, fixedWidthColumnsWidth: n };
|
|
1193
|
-
}, [Y,
|
|
1188
|
+
}, [Y, f]), le = e.useMemo(() => {
|
|
1194
1189
|
if (Ae)
|
|
1195
1190
|
return new Uint16Array(Ae);
|
|
1196
|
-
const n =
|
|
1191
|
+
const n = Be ? new Uint16Array(JSON.parse(Be)) : void 0, u = Math.max(
|
|
1197
1192
|
Math.floor(
|
|
1198
|
-
(Le -
|
|
1193
|
+
(Le - Ve) / He
|
|
1199
1194
|
),
|
|
1200
|
-
|
|
1195
|
+
Dt
|
|
1201
1196
|
);
|
|
1202
|
-
let
|
|
1203
|
-
const
|
|
1204
|
-
Y.map((
|
|
1205
|
-
if (
|
|
1197
|
+
let m = (Le - Ve) % He;
|
|
1198
|
+
const i = new Uint16Array(
|
|
1199
|
+
Y.map((g) => {
|
|
1200
|
+
if (g === K)
|
|
1206
1201
|
return pt;
|
|
1207
|
-
const
|
|
1208
|
-
return
|
|
1202
|
+
const A = f ? f[g] : void 0;
|
|
1203
|
+
return A?.width ? A?.width : m ? (m -= 1, u + 1) : u;
|
|
1209
1204
|
})
|
|
1210
1205
|
);
|
|
1211
|
-
return n?.length ===
|
|
1206
|
+
return n?.length === i.length ? n : i;
|
|
1212
1207
|
}, [
|
|
1213
1208
|
Y,
|
|
1214
|
-
|
|
1209
|
+
f,
|
|
1215
1210
|
Ae,
|
|
1216
|
-
Xe,
|
|
1217
1211
|
He,
|
|
1218
|
-
|
|
1212
|
+
Ve,
|
|
1213
|
+
Be,
|
|
1219
1214
|
Le
|
|
1220
1215
|
]), Qe = e.useCallback(
|
|
1221
1216
|
(n) => le ? le[n] : 1,
|
|
1222
1217
|
[le]
|
|
1223
1218
|
), Ie = e.useMemo(() => {
|
|
1224
|
-
if (!
|
|
1225
|
-
return
|
|
1226
|
-
const { searchQuery: n } =
|
|
1227
|
-
(
|
|
1219
|
+
if (!Fe || !l && !F || J)
|
|
1220
|
+
return Fe;
|
|
1221
|
+
const { searchQuery: n } = c, u = n.toLowerCase() || "", m = (i) => x && E ? E(x[i._index], n) : !(Y && !Y.find(
|
|
1222
|
+
(g) => `${i[g]}`.toLowerCase().includes(u)
|
|
1228
1223
|
));
|
|
1229
|
-
return
|
|
1230
|
-
let
|
|
1231
|
-
return !
|
|
1232
|
-
([
|
|
1233
|
-
if (!
|
|
1224
|
+
return Fe.filter((i) => {
|
|
1225
|
+
let g = m(i);
|
|
1226
|
+
return !g || !c.columnFilterMap ? !1 : (Object.entries(c.columnFilterMap).forEach(
|
|
1227
|
+
([A, d]) => {
|
|
1228
|
+
if (!g || d === void 0)
|
|
1234
1229
|
return;
|
|
1235
|
-
const
|
|
1236
|
-
if (x &&
|
|
1237
|
-
|
|
1238
|
-
x[
|
|
1239
|
-
|
|
1230
|
+
const V = f ? f[A] : void 0;
|
|
1231
|
+
if (x && V?.filter) {
|
|
1232
|
+
g = V.filter(
|
|
1233
|
+
x[i._index],
|
|
1234
|
+
d
|
|
1240
1235
|
);
|
|
1241
1236
|
return;
|
|
1242
1237
|
}
|
|
1243
|
-
const de = ie[
|
|
1238
|
+
const de = ie[A], O = x[i._index]?.[A];
|
|
1244
1239
|
switch (de?.type) {
|
|
1245
1240
|
case "boolean":
|
|
1241
|
+
if (d === void 0)
|
|
1242
|
+
return;
|
|
1243
|
+
if (Array.isArray(d) && d.length) {
|
|
1244
|
+
d.includes(
|
|
1245
|
+
O === void 0 ? null : O
|
|
1246
|
+
) || (g = !1);
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
g = O === d;
|
|
1250
|
+
break;
|
|
1246
1251
|
case "number":
|
|
1247
1252
|
case "integer":
|
|
1248
|
-
if (
|
|
1249
|
-
|
|
1253
|
+
if (d && typeof d == "object") {
|
|
1254
|
+
d.filterEmpty && O === void 0 && (g = !1);
|
|
1250
1255
|
for (const P of Object.keys(
|
|
1251
|
-
|
|
1256
|
+
ge
|
|
1252
1257
|
)) {
|
|
1253
|
-
const fe =
|
|
1254
|
-
if (
|
|
1258
|
+
const fe = d[P];
|
|
1259
|
+
if (g && Yt(fe))
|
|
1255
1260
|
switch (P) {
|
|
1256
|
-
case
|
|
1257
|
-
|
|
1261
|
+
case ge.EQ:
|
|
1262
|
+
O !== fe && (g = !1);
|
|
1258
1263
|
break;
|
|
1259
|
-
case
|
|
1260
|
-
|
|
1264
|
+
case ge.GT:
|
|
1265
|
+
O <= fe && (g = !1);
|
|
1261
1266
|
break;
|
|
1262
|
-
case
|
|
1263
|
-
|
|
1267
|
+
case ge.LT:
|
|
1268
|
+
O >= fe && (g = !1);
|
|
1264
1269
|
break;
|
|
1265
1270
|
}
|
|
1266
1271
|
}
|
|
1267
1272
|
} else {
|
|
1268
|
-
if (
|
|
1273
|
+
if (O === void 0 && d === null)
|
|
1269
1274
|
return !0;
|
|
1270
|
-
|
|
1275
|
+
g = O === d;
|
|
1271
1276
|
}
|
|
1272
1277
|
break;
|
|
1273
1278
|
// @ts-expect-error investigate
|
|
1274
1279
|
case "string":
|
|
1275
|
-
if (typeof
|
|
1276
|
-
const { from: P, to: fe, filterEmpty: lt } =
|
|
1277
|
-
if (!
|
|
1278
|
-
|
|
1280
|
+
if (typeof d == "object" && !Array.isArray(d) && (de.format === "date" || de.format === "date-time")) {
|
|
1281
|
+
const { from: P, to: fe, filterEmpty: lt } = d;
|
|
1282
|
+
if (!O)
|
|
1283
|
+
g = !lt;
|
|
1279
1284
|
else {
|
|
1280
|
-
const ze =
|
|
1281
|
-
(lt === !1 || P && (!ze || ze < P) || fe && (!ze || ze > fe)) && (
|
|
1285
|
+
const ze = O ? new Date(O) : void 0;
|
|
1286
|
+
(lt === !1 || P && (!ze || ze < P) || fe && (!ze || ze > fe)) && (g = !1);
|
|
1282
1287
|
}
|
|
1283
1288
|
return;
|
|
1284
1289
|
}
|
|
1285
1290
|
// fall through
|
|
1286
1291
|
default:
|
|
1287
1292
|
if (de?.enum) {
|
|
1288
|
-
Array.isArray(
|
|
1293
|
+
Array.isArray(d) ? g = d.includes(O) : g = O === d;
|
|
1289
1294
|
return;
|
|
1290
1295
|
}
|
|
1291
|
-
if (Array.isArray(
|
|
1292
|
-
const P = `${
|
|
1293
|
-
|
|
1296
|
+
if (Array.isArray(d)) {
|
|
1297
|
+
const P = `${i[A]}`.toLowerCase();
|
|
1298
|
+
g = d.some(
|
|
1294
1299
|
(fe) => P.includes(`${fe}`.toLowerCase())
|
|
1295
1300
|
);
|
|
1296
1301
|
} else
|
|
1297
|
-
|
|
1302
|
+
g = `${i[A]}`.toLowerCase().includes(`${d}`.toLowerCase());
|
|
1298
1303
|
}
|
|
1299
1304
|
}
|
|
1300
|
-
),
|
|
1305
|
+
), g);
|
|
1301
1306
|
});
|
|
1302
1307
|
}, [
|
|
1303
|
-
|
|
1304
|
-
i,
|
|
1305
|
-
B,
|
|
1306
|
-
J,
|
|
1308
|
+
Fe,
|
|
1307
1309
|
l,
|
|
1308
|
-
|
|
1310
|
+
F,
|
|
1311
|
+
J,
|
|
1312
|
+
c,
|
|
1313
|
+
E,
|
|
1309
1314
|
Y,
|
|
1310
|
-
|
|
1315
|
+
f,
|
|
1311
1316
|
x,
|
|
1312
1317
|
ie
|
|
1313
|
-
]),
|
|
1314
|
-
const { sortAsc: n, sortColumn: u } =
|
|
1318
|
+
]), Z = e.useMemo(() => {
|
|
1319
|
+
const { sortAsc: n, sortColumn: u } = c;
|
|
1315
1320
|
if (!u || !Ie || !x || J)
|
|
1316
1321
|
return Ie;
|
|
1317
|
-
const
|
|
1318
|
-
if (
|
|
1319
|
-
return Ie.sort((
|
|
1320
|
-
const
|
|
1321
|
-
return
|
|
1322
|
-
|
|
1322
|
+
const m = ie[u], i = f ? f[u] : void 0, g = i?.sort;
|
|
1323
|
+
if (g)
|
|
1324
|
+
return Ie.sort((V, de) => {
|
|
1325
|
+
const O = x[V._index], P = x[de._index];
|
|
1326
|
+
return O ? P ? g(
|
|
1327
|
+
O,
|
|
1323
1328
|
P,
|
|
1324
1329
|
n === void 0 ? S : n
|
|
1325
1330
|
) : -1 : 1;
|
|
1326
1331
|
});
|
|
1327
|
-
const
|
|
1328
|
-
return Ie.sort((
|
|
1329
|
-
let
|
|
1330
|
-
return
|
|
1332
|
+
const A = m && m.format?.startsWith("date"), d = Cn(m, i);
|
|
1333
|
+
return Ie.sort((V, de) => {
|
|
1334
|
+
let O = d && x[V._index] ? x[V._index][u] : `${V[u]}`.toLowerCase(), P = d && x[de._index] ? x[de._index][u] : `${de[u]}`.toLowerCase();
|
|
1335
|
+
return d && A && (O = new Date(O), isNaN(O.getTime()) && (O = vt), P = new Date(P), isNaN(P.getTime()) && (P = vt)), O === P ? 0 : O ? P ? (O < P ? 1 : -1) * (n ? -1 : 1) : n ? 1 : -1 : n ? -1 : 1;
|
|
1331
1336
|
});
|
|
1332
1337
|
}, [
|
|
1333
|
-
|
|
1338
|
+
f,
|
|
1334
1339
|
S,
|
|
1335
1340
|
Ie,
|
|
1336
1341
|
J,
|
|
1337
1342
|
ie,
|
|
1338
1343
|
x,
|
|
1339
|
-
|
|
1344
|
+
c
|
|
1340
1345
|
]);
|
|
1341
1346
|
e.useImperativeHandle(
|
|
1342
1347
|
ve,
|
|
1343
1348
|
() => ({
|
|
1344
|
-
getFilteredSortedData: () =>
|
|
1349
|
+
getFilteredSortedData: () => Z,
|
|
1345
1350
|
scrollToIndex: (n) => {
|
|
1346
|
-
const u = Re?.current,
|
|
1347
|
-
u &&
|
|
1351
|
+
const u = Re?.current, m = Z?.findIndex((i) => i._index === n) || -1;
|
|
1352
|
+
u && m >= 0 && u.scrollToItem({ rowIndex: m });
|
|
1348
1353
|
}
|
|
1349
1354
|
}),
|
|
1350
|
-
[
|
|
1355
|
+
[Z, Re]
|
|
1351
1356
|
);
|
|
1352
1357
|
const at = e.useCallback(
|
|
1353
1358
|
(n) => {
|
|
1354
|
-
const u = { ...
|
|
1359
|
+
const u = { ...c.columnFilterMap };
|
|
1355
1360
|
delete u[n], ke({
|
|
1356
|
-
...
|
|
1361
|
+
...c,
|
|
1357
1362
|
columnFilterMap: u
|
|
1358
1363
|
});
|
|
1359
1364
|
},
|
|
1360
|
-
[
|
|
1365
|
+
[c]
|
|
1361
1366
|
), Ye = e.useCallback(
|
|
1362
1367
|
(n, u) => {
|
|
1363
|
-
if (
|
|
1368
|
+
if (D) {
|
|
1364
1369
|
window.location.hash = Ue({
|
|
1365
1370
|
...U,
|
|
1366
1371
|
sortColumn: n,
|
|
@@ -1368,85 +1373,85 @@ const Cn = ({
|
|
|
1368
1373
|
});
|
|
1369
1374
|
return;
|
|
1370
1375
|
}
|
|
1371
|
-
ke({ ...
|
|
1376
|
+
ke({ ...c, sortColumn: n, sortAsc: u });
|
|
1372
1377
|
},
|
|
1373
|
-
[
|
|
1374
|
-
),
|
|
1378
|
+
[c, U, D]
|
|
1379
|
+
), Lt = e.useCallback(
|
|
1375
1380
|
(n) => {
|
|
1376
1381
|
ke({
|
|
1377
|
-
...
|
|
1382
|
+
...c,
|
|
1378
1383
|
searchQuery: n.currentTarget.value
|
|
1379
1384
|
});
|
|
1380
1385
|
},
|
|
1381
|
-
[
|
|
1386
|
+
[c]
|
|
1382
1387
|
), De = e.useCallback(() => {
|
|
1383
|
-
|
|
1384
|
-
}, [
|
|
1388
|
+
Xe(c), be(void 0);
|
|
1389
|
+
}, [c]);
|
|
1385
1390
|
e.useEffect(() => {
|
|
1386
|
-
if (!
|
|
1391
|
+
if (!b || !U || !he || !D)
|
|
1387
1392
|
return;
|
|
1388
1393
|
const n = Object.keys(U);
|
|
1389
1394
|
let u = !1;
|
|
1390
|
-
for (const
|
|
1391
|
-
const
|
|
1392
|
-
if (typeof
|
|
1395
|
+
for (const m of n) {
|
|
1396
|
+
const i = U[m], g = he[m];
|
|
1397
|
+
if (typeof i == "string" && i !== g) {
|
|
1393
1398
|
u = !0;
|
|
1394
1399
|
break;
|
|
1395
1400
|
}
|
|
1396
|
-
if (typeof
|
|
1401
|
+
if (typeof i == "object" && !tt(i, g)) {
|
|
1397
1402
|
u = !0;
|
|
1398
1403
|
break;
|
|
1399
1404
|
}
|
|
1400
1405
|
}
|
|
1401
1406
|
u && De();
|
|
1402
1407
|
}, [
|
|
1403
|
-
|
|
1408
|
+
b,
|
|
1404
1409
|
U,
|
|
1405
1410
|
he,
|
|
1406
1411
|
De,
|
|
1407
|
-
|
|
1412
|
+
D
|
|
1408
1413
|
]);
|
|
1409
1414
|
const it = e.useCallback(
|
|
1410
1415
|
(n) => {
|
|
1411
|
-
n.key === "Enter" && (j(void 0), Ne && !
|
|
1416
|
+
n.key === "Enter" && (j(void 0), Ne && !D && De(), H && n.currentTarget.className === "mig-schema-table__search" && H(c.searchQuery || ""));
|
|
1412
1417
|
},
|
|
1413
1418
|
[
|
|
1414
1419
|
Ne,
|
|
1415
|
-
|
|
1416
|
-
|
|
1420
|
+
c.searchQuery,
|
|
1421
|
+
H,
|
|
1417
1422
|
De,
|
|
1418
|
-
|
|
1423
|
+
D
|
|
1419
1424
|
]
|
|
1420
|
-
), Ke = e.useCallback(() => Q, [Q]), ue = e.useMemo(() =>
|
|
1421
|
-
() =>
|
|
1422
|
-
[
|
|
1425
|
+
), Ke = e.useCallback(() => Q, [Q]), ue = e.useMemo(() => Kt(le), [le]), Se = e.useMemo(
|
|
1426
|
+
() => Z ? Z.length : 0,
|
|
1427
|
+
[Z]
|
|
1423
1428
|
), pe = e.useMemo(() => {
|
|
1424
1429
|
const n = Q * Se;
|
|
1425
1430
|
let u;
|
|
1426
1431
|
if (y && (u = y === "100%" ? We.height : y, !u))
|
|
1427
1432
|
return 0;
|
|
1428
|
-
const
|
|
1429
|
-
return
|
|
1433
|
+
const m = u ? u - ot.height - _t : 0;
|
|
1434
|
+
return m && m < n ? m : n;
|
|
1430
1435
|
}, [
|
|
1431
1436
|
Q,
|
|
1432
1437
|
Se,
|
|
1433
1438
|
y,
|
|
1434
1439
|
ot,
|
|
1435
1440
|
We.height
|
|
1436
|
-
]),
|
|
1441
|
+
]), Nt = e.useCallback(
|
|
1437
1442
|
(n) => {
|
|
1438
1443
|
j(void 0), n.preventDefault(), n.stopPropagation();
|
|
1439
1444
|
},
|
|
1440
1445
|
[]
|
|
1441
|
-
),
|
|
1446
|
+
), It = e.useCallback(
|
|
1442
1447
|
(n, u) => {
|
|
1443
1448
|
if (!z)
|
|
1444
1449
|
return;
|
|
1445
|
-
if (
|
|
1450
|
+
if (D && u !== !1) {
|
|
1446
1451
|
window.location.hash = Ue({
|
|
1447
1452
|
...U,
|
|
1448
1453
|
columnFilterMap: {
|
|
1449
|
-
...
|
|
1454
|
+
...c.columnFilterMap,
|
|
1450
1455
|
[z.propName]: n
|
|
1451
1456
|
}
|
|
1452
1457
|
});
|
|
@@ -1456,54 +1461,54 @@ const Cn = ({
|
|
|
1456
1461
|
at(z.propName);
|
|
1457
1462
|
return;
|
|
1458
1463
|
}
|
|
1459
|
-
const
|
|
1460
|
-
...
|
|
1464
|
+
const m = {
|
|
1465
|
+
...c.columnFilterMap,
|
|
1461
1466
|
[z.propName]: n
|
|
1462
1467
|
};
|
|
1463
1468
|
ke({
|
|
1464
|
-
...
|
|
1465
|
-
columnFilterMap:
|
|
1469
|
+
...c,
|
|
1470
|
+
columnFilterMap: m
|
|
1466
1471
|
});
|
|
1467
1472
|
},
|
|
1468
1473
|
[
|
|
1469
1474
|
at,
|
|
1470
|
-
|
|
1475
|
+
c,
|
|
1471
1476
|
U,
|
|
1472
1477
|
z,
|
|
1473
|
-
|
|
1478
|
+
D
|
|
1474
1479
|
]
|
|
1475
|
-
),
|
|
1480
|
+
), St = e.useCallback(() => {
|
|
1476
1481
|
const n = {
|
|
1477
1482
|
searchQuery: "",
|
|
1478
1483
|
columnFilterMap: {},
|
|
1479
1484
|
// Clear button should clear _ALL_ filters, do _NOT_ revert to defaultColumnFilters
|
|
1480
|
-
sortColumn:
|
|
1485
|
+
sortColumn: M,
|
|
1481
1486
|
sortAsc: S
|
|
1482
1487
|
};
|
|
1483
|
-
|
|
1484
|
-
}, [
|
|
1488
|
+
D && (window.location.hash = Ue(n)), Xe(n), ke(n);
|
|
1489
|
+
}, [D, S, M]), $t = e.useCallback(() => {
|
|
1485
1490
|
const n = U?.searchQuery || "";
|
|
1486
|
-
|
|
1487
|
-
(
|
|
1491
|
+
D && // prevent hash change for undefined vs empty string compare
|
|
1492
|
+
(c.searchQuery || n) && c.searchQuery !== n && (window.location.hash = Ue({
|
|
1488
1493
|
...U,
|
|
1489
|
-
searchQuery:
|
|
1494
|
+
searchQuery: c.searchQuery
|
|
1490
1495
|
}));
|
|
1491
|
-
}, [U,
|
|
1496
|
+
}, [U, c.searchQuery, D]), Ot = e.useCallback(
|
|
1492
1497
|
async (n) => {
|
|
1493
|
-
n.preventDefault(), n.stopPropagation(),
|
|
1498
|
+
n.preventDefault(), n.stopPropagation(), Z && await bn(Z);
|
|
1494
1499
|
},
|
|
1495
|
-
[
|
|
1496
|
-
),
|
|
1500
|
+
[Z]
|
|
1501
|
+
), Rt = e.useCallback(() => {
|
|
1497
1502
|
v && (localStorage.removeItem(`${v}.columnNames`), localStorage.removeItem(`${v}.columnWidths`), oe(void 0), Oe(void 0));
|
|
1498
1503
|
}, [v]), et = e.useCallback(
|
|
1499
1504
|
(n) => {
|
|
1500
|
-
if (!
|
|
1505
|
+
if (!Z || !x || !ne || !ce)
|
|
1501
1506
|
return !0;
|
|
1502
|
-
const u =
|
|
1507
|
+
const u = Z[n];
|
|
1503
1508
|
return u && x[u._index] !== void 0;
|
|
1504
1509
|
},
|
|
1505
|
-
[ce, ne,
|
|
1506
|
-
),
|
|
1510
|
+
[ce, ne, Z, x]
|
|
1511
|
+
), Wt = e.useMemo(() => pe ? !(x && !Ne) && !ne ? /* @__PURE__ */ r(
|
|
1507
1512
|
"div",
|
|
1508
1513
|
{
|
|
1509
1514
|
style: {
|
|
@@ -1519,13 +1524,13 @@ const Cn = ({
|
|
|
1519
1524
|
children: Ne ? /* @__PURE__ */ r("button", { onClick: De, className: "btn border", children: "Refresh data" }) : /* @__PURE__ */ r("div", { children: "⌛ Loading..." })
|
|
1520
1525
|
}
|
|
1521
1526
|
) : ne && ce ? /* @__PURE__ */ r(
|
|
1522
|
-
|
|
1527
|
+
en,
|
|
1523
1528
|
{
|
|
1524
|
-
ref:
|
|
1529
|
+
ref: o,
|
|
1525
1530
|
isItemLoaded: et,
|
|
1526
1531
|
itemCount: ce,
|
|
1527
1532
|
loadMoreItems: ne,
|
|
1528
|
-
children: ({ onItemsRendered: u, ref:
|
|
1533
|
+
children: ({ onItemsRendered: u, ref: m }) => /* @__PURE__ */ r(
|
|
1529
1534
|
ct,
|
|
1530
1535
|
{
|
|
1531
1536
|
className: "mig-schema-table__tbody",
|
|
@@ -1536,21 +1541,21 @@ const Cn = ({
|
|
|
1536
1541
|
rowHeight: Ke,
|
|
1537
1542
|
columnCount: xe,
|
|
1538
1543
|
rowCount: Se,
|
|
1539
|
-
ref:
|
|
1544
|
+
ref: m,
|
|
1540
1545
|
onItemsRendered: ({
|
|
1541
|
-
overscanRowStartIndex:
|
|
1542
|
-
overscanRowStopIndex:
|
|
1543
|
-
visibleRowStartIndex:
|
|
1544
|
-
visibleRowStopIndex:
|
|
1546
|
+
overscanRowStartIndex: i,
|
|
1547
|
+
overscanRowStopIndex: g,
|
|
1548
|
+
visibleRowStartIndex: A,
|
|
1549
|
+
visibleRowStopIndex: d
|
|
1545
1550
|
}) => u({
|
|
1546
|
-
overscanStartIndex:
|
|
1547
|
-
overscanStopIndex:
|
|
1548
|
-
visibleStartIndex:
|
|
1549
|
-
visibleStopIndex:
|
|
1551
|
+
overscanStartIndex: i,
|
|
1552
|
+
overscanStopIndex: g,
|
|
1553
|
+
visibleStartIndex: A,
|
|
1554
|
+
visibleStopIndex: d
|
|
1550
1555
|
}),
|
|
1551
|
-
children:
|
|
1556
|
+
children: yt
|
|
1552
1557
|
},
|
|
1553
|
-
`tbody_${pe}_${ue}_${
|
|
1558
|
+
`tbody_${pe}_${ue}_${c.sortColumn}_${c.sortAsc}_${c.searchQuery}_${xe}_${le.join(
|
|
1554
1559
|
" "
|
|
1555
1560
|
)}`
|
|
1556
1561
|
)
|
|
@@ -1567,9 +1572,9 @@ const Cn = ({
|
|
|
1567
1572
|
columnCount: xe,
|
|
1568
1573
|
rowCount: Se,
|
|
1569
1574
|
ref: Re,
|
|
1570
|
-
children:
|
|
1575
|
+
children: yt
|
|
1571
1576
|
},
|
|
1572
|
-
`tbody_${pe}_${ue}_${
|
|
1577
|
+
`tbody_${pe}_${ue}_${c.sortColumn}_${c.sortAsc}_${c.searchQuery}_${xe}_${le.join(
|
|
1573
1578
|
" "
|
|
1574
1579
|
)}`
|
|
1575
1580
|
) : null, [
|
|
@@ -1577,7 +1582,7 @@ const Cn = ({
|
|
|
1577
1582
|
le,
|
|
1578
1583
|
Qe,
|
|
1579
1584
|
Ke,
|
|
1580
|
-
|
|
1585
|
+
o,
|
|
1581
1586
|
Ne,
|
|
1582
1587
|
et,
|
|
1583
1588
|
ce,
|
|
@@ -1586,13 +1591,13 @@ const Cn = ({
|
|
|
1586
1591
|
Se,
|
|
1587
1592
|
Q,
|
|
1588
1593
|
ue,
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1594
|
+
c.searchQuery,
|
|
1595
|
+
c.sortAsc,
|
|
1596
|
+
c.sortColumn,
|
|
1592
1597
|
x,
|
|
1593
1598
|
pe,
|
|
1594
1599
|
Re
|
|
1595
|
-
]),
|
|
1600
|
+
]), jt = e.useMemo(
|
|
1596
1601
|
() => ({
|
|
1597
1602
|
...N,
|
|
1598
1603
|
width: se ? Math.min(ue, Le) : void 0,
|
|
@@ -1600,7 +1605,7 @@ const Cn = ({
|
|
|
1600
1605
|
maxHeight: y === "100%" ? "100%" : void 0
|
|
1601
1606
|
}),
|
|
1602
1607
|
[y, ue, N, Le, se]
|
|
1603
|
-
),
|
|
1608
|
+
), Bt = a || "input";
|
|
1604
1609
|
return /* @__PURE__ */ r(
|
|
1605
1610
|
Me.Provider,
|
|
1606
1611
|
{
|
|
@@ -1608,157 +1613,157 @@ const Cn = ({
|
|
|
1608
1613
|
checkedIndexes: p,
|
|
1609
1614
|
columnNames: Y,
|
|
1610
1615
|
columnWidths: le,
|
|
1611
|
-
config:
|
|
1612
|
-
disabledCheckedIndexes:
|
|
1613
|
-
displayTimezone:
|
|
1616
|
+
config: f,
|
|
1617
|
+
disabledCheckedIndexes: R,
|
|
1618
|
+
displayTimezone: T,
|
|
1614
1619
|
dropTargetIndex: Ee,
|
|
1615
|
-
getRowClassName:
|
|
1620
|
+
getRowClassName: q,
|
|
1616
1621
|
getRowSelected: ee,
|
|
1617
|
-
isColumnFilterable:
|
|
1622
|
+
isColumnFilterable: l,
|
|
1618
1623
|
isItemLoaded: et,
|
|
1619
1624
|
isSortable: te,
|
|
1620
1625
|
lastCheckChangedRowIndex: me,
|
|
1621
1626
|
onRowClick: L,
|
|
1622
1627
|
onRowDoubleClick: ae,
|
|
1623
1628
|
properties: ie,
|
|
1624
|
-
required:
|
|
1625
|
-
setCheckedIndexes:
|
|
1629
|
+
required: Et,
|
|
1630
|
+
setCheckedIndexes: X,
|
|
1626
1631
|
setCustomColumnNames: oe,
|
|
1627
1632
|
setCustomColumnWidths: Oe,
|
|
1628
|
-
setDropTargetIndex:
|
|
1633
|
+
setDropTargetIndex: qe,
|
|
1629
1634
|
setFilterSortColumn: Ye,
|
|
1630
1635
|
setLastCheckChangedRowIndex: ye,
|
|
1631
1636
|
setMenuConfig: j,
|
|
1632
1637
|
settingsStorageKey: v,
|
|
1633
|
-
sortedRenderData:
|
|
1638
|
+
sortedRenderData: Z,
|
|
1634
1639
|
sourceData: x,
|
|
1635
|
-
tableDataState:
|
|
1636
|
-
translate: k ||
|
|
1640
|
+
tableDataState: c,
|
|
1641
|
+
translate: k || bt
|
|
1637
1642
|
},
|
|
1638
|
-
children: /* @__PURE__ */
|
|
1643
|
+
children: /* @__PURE__ */ B(
|
|
1639
1644
|
"div",
|
|
1640
1645
|
{
|
|
1641
1646
|
className: `mig-schema-table${L ? " mig-schema-table--clickable-rows" : ""}`,
|
|
1642
1647
|
ref: rt,
|
|
1643
|
-
style:
|
|
1648
|
+
style: jt,
|
|
1644
1649
|
role: "table",
|
|
1645
1650
|
children: [
|
|
1646
|
-
/* @__PURE__ */
|
|
1651
|
+
/* @__PURE__ */ B(
|
|
1647
1652
|
"div",
|
|
1648
1653
|
{
|
|
1649
1654
|
className: "mig-schema-table__action-container",
|
|
1650
1655
|
ref: st,
|
|
1651
1656
|
children: [
|
|
1652
|
-
/* @__PURE__ */ r("div", { children:
|
|
1653
|
-
|
|
1657
|
+
/* @__PURE__ */ r("div", { children: F ? /* @__PURE__ */ r(
|
|
1658
|
+
Bt,
|
|
1654
1659
|
{
|
|
1655
1660
|
className: "mig-schema-table__search",
|
|
1656
1661
|
type: "search",
|
|
1657
1662
|
name: "search",
|
|
1658
1663
|
autoComplete: "off",
|
|
1659
1664
|
placeholder: _e || k("search..."),
|
|
1660
|
-
value:
|
|
1661
|
-
onChange:
|
|
1665
|
+
value: c.searchQuery,
|
|
1666
|
+
onChange: Lt,
|
|
1662
1667
|
onKeyDown: it,
|
|
1663
1668
|
autoFocus: w,
|
|
1664
|
-
onBlur:
|
|
1669
|
+
onBlur: $t
|
|
1665
1670
|
}
|
|
1666
1671
|
) : null }),
|
|
1667
1672
|
t ? /* @__PURE__ */ r(
|
|
1668
1673
|
t,
|
|
1669
1674
|
{
|
|
1670
1675
|
...I,
|
|
1671
|
-
renderData:
|
|
1676
|
+
renderData: Z
|
|
1672
1677
|
}
|
|
1673
1678
|
) : /* @__PURE__ */ r("div", { className: "mig-schema-table__custom_element_placeholder" }),
|
|
1674
1679
|
$ && Array.isArray(C) ? /* @__PURE__ */ r("span", { className: "mig-schema-table__row_counter", children: k(
|
|
1675
1680
|
"showingFilteredCountOfTotalCount",
|
|
1676
|
-
|
|
1681
|
+
Z?.length || 0,
|
|
1677
1682
|
C.length
|
|
1678
1683
|
) }) : null,
|
|
1679
|
-
|
|
1684
|
+
s ? /* @__PURE__ */ r(
|
|
1680
1685
|
"button",
|
|
1681
1686
|
{
|
|
1682
|
-
onClick:
|
|
1687
|
+
onClick: Ot,
|
|
1683
1688
|
style: { marginLeft: 8 },
|
|
1684
|
-
disabled: !
|
|
1689
|
+
disabled: !Z?.length,
|
|
1685
1690
|
children: k("exportData")
|
|
1686
1691
|
}
|
|
1687
1692
|
) : null,
|
|
1688
|
-
|
|
1693
|
+
F || l ? /* @__PURE__ */ r(
|
|
1689
1694
|
"button",
|
|
1690
1695
|
{
|
|
1691
|
-
onClick:
|
|
1696
|
+
onClick: St,
|
|
1692
1697
|
style: { marginLeft: 8 },
|
|
1693
|
-
disabled:
|
|
1698
|
+
disabled: c.columnFilterMap && c.searchQuery ? Object.keys(c.columnFilterMap).length + c.searchQuery.length === 0 : !1,
|
|
1694
1699
|
children: k("clearFilters")
|
|
1695
1700
|
}
|
|
1696
1701
|
) : null,
|
|
1697
1702
|
v ? /* @__PURE__ */ r(
|
|
1698
1703
|
"button",
|
|
1699
1704
|
{
|
|
1700
|
-
onClick:
|
|
1705
|
+
onClick: Rt,
|
|
1701
1706
|
style: { marginLeft: 8 },
|
|
1702
|
-
disabled: !je && !
|
|
1707
|
+
disabled: !je && !Be,
|
|
1703
1708
|
children: k("clearSettings")
|
|
1704
1709
|
}
|
|
1705
1710
|
) : null
|
|
1706
1711
|
]
|
|
1707
1712
|
}
|
|
1708
1713
|
),
|
|
1709
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ B("div", { className: "mig-schema-table__column_resize_container", children: [
|
|
1710
1715
|
/* @__PURE__ */ r(
|
|
1711
|
-
|
|
1716
|
+
h,
|
|
1712
1717
|
{
|
|
1713
1718
|
height: _t,
|
|
1714
1719
|
itemCount: xe,
|
|
1715
1720
|
itemSize: Qe,
|
|
1716
1721
|
layout: "horizontal",
|
|
1717
1722
|
width: ue,
|
|
1718
|
-
sortAsc:
|
|
1723
|
+
sortAsc: c.sortAsc,
|
|
1719
1724
|
setFilterSortColumn: Ye,
|
|
1720
|
-
sortColumn:
|
|
1721
|
-
sortedRenderData:
|
|
1725
|
+
sortColumn: c.sortColumn,
|
|
1726
|
+
sortedRenderData: Z,
|
|
1722
1727
|
className: "mig-schema-table__th-row",
|
|
1723
|
-
children:
|
|
1728
|
+
children: cn
|
|
1724
1729
|
},
|
|
1725
|
-
`thead_${ue}_${
|
|
1730
|
+
`thead_${ue}_${c.sortColumn}_${c.sortAsc}_${c.searchQuery}_${le.join(
|
|
1726
1731
|
" "
|
|
1727
1732
|
)}`
|
|
1728
1733
|
),
|
|
1729
|
-
|
|
1734
|
+
Wt,
|
|
1730
1735
|
_ ? /* @__PURE__ */ r(
|
|
1731
|
-
|
|
1736
|
+
fn,
|
|
1732
1737
|
{
|
|
1733
1738
|
columnWidths: le,
|
|
1734
|
-
resizeColumnIndex:
|
|
1735
|
-
setResizeColumnIndex:
|
|
1739
|
+
resizeColumnIndex: Ze,
|
|
1740
|
+
setResizeColumnIndex: Ge,
|
|
1736
1741
|
tableBodyHeight: pe
|
|
1737
1742
|
}
|
|
1738
1743
|
) : null
|
|
1739
1744
|
] }),
|
|
1740
1745
|
x && x.length === 0 ? /* @__PURE__ */ r("div", { className: "mig-schema-table__no_data", children: "No data found" }) : null,
|
|
1741
|
-
z ?
|
|
1746
|
+
z ? zt(
|
|
1742
1747
|
/* @__PURE__ */ r(
|
|
1743
|
-
|
|
1748
|
+
hn,
|
|
1744
1749
|
{
|
|
1745
|
-
isFilterable:
|
|
1746
|
-
isSortable:
|
|
1750
|
+
isFilterable: l && z.propConfig?.isFilterable !== !1,
|
|
1751
|
+
isSortable: Tt(
|
|
1747
1752
|
te,
|
|
1748
|
-
|
|
1753
|
+
G.properties[z.propName],
|
|
1749
1754
|
z.propConfig
|
|
1750
1755
|
),
|
|
1751
|
-
onChange:
|
|
1752
|
-
onClose:
|
|
1756
|
+
onChange: It,
|
|
1757
|
+
onClose: Nt,
|
|
1753
1758
|
onInputKeyDown: it,
|
|
1754
1759
|
propConfig: z.propConfig,
|
|
1755
1760
|
propIsRequired: z.propIsRequired,
|
|
1756
1761
|
propName: z.propName,
|
|
1757
|
-
propSchema:
|
|
1762
|
+
propSchema: G.properties[z.propName],
|
|
1758
1763
|
referenceElement: z.referenceElement,
|
|
1759
1764
|
setFilterSortColumn: Ye,
|
|
1760
1765
|
translate: k,
|
|
1761
|
-
value:
|
|
1766
|
+
value: c.columnFilterMap ? c.columnFilterMap[z.propName] : null
|
|
1762
1767
|
}
|
|
1763
1768
|
),
|
|
1764
1769
|
document.body
|
|
@@ -1768,29 +1773,29 @@ const Cn = ({
|
|
|
1768
1773
|
)
|
|
1769
1774
|
}
|
|
1770
1775
|
);
|
|
1771
|
-
},
|
|
1772
|
-
const [
|
|
1773
|
-
|
|
1776
|
+
}, wn = e.forwardRef(yn), Wn = e.memo(wn), jn = e.memo(({ refresh: t, period: a = 60 }) => {
|
|
1777
|
+
const [h, b] = e.useState(/* @__PURE__ */ new Date()), [p, f] = e.useState(/* @__PURE__ */ new Date()), I = e.useCallback(() => {
|
|
1778
|
+
f(/* @__PURE__ */ new Date()), t();
|
|
1774
1779
|
}, [t]), C = e.useMemo(
|
|
1775
|
-
() =>
|
|
1776
|
-
[
|
|
1780
|
+
() => Zt(h, p),
|
|
1781
|
+
[h, p]
|
|
1777
1782
|
);
|
|
1778
1783
|
e.useEffect(() => {
|
|
1779
|
-
C >
|
|
1780
|
-
}, [C,
|
|
1781
|
-
const
|
|
1782
|
-
|
|
1784
|
+
C > a && I();
|
|
1785
|
+
}, [C, h, p, a, I]), e.useEffect(() => {
|
|
1786
|
+
const M = setInterval(() => {
|
|
1787
|
+
b(/* @__PURE__ */ new Date());
|
|
1783
1788
|
}, 1e3);
|
|
1784
1789
|
return () => {
|
|
1785
|
-
clearInterval(
|
|
1790
|
+
clearInterval(M);
|
|
1786
1791
|
};
|
|
1787
1792
|
}, []);
|
|
1788
|
-
const
|
|
1789
|
-
return /* @__PURE__ */
|
|
1793
|
+
const W = a - C;
|
|
1794
|
+
return /* @__PURE__ */ B(
|
|
1790
1795
|
"div",
|
|
1791
1796
|
{
|
|
1792
1797
|
className: "mx-auto",
|
|
1793
|
-
title: `Refresh ${
|
|
1798
|
+
title: `Refresh ${W > 0 ? `in ${W} seconds` : "NOW"}`,
|
|
1794
1799
|
children: [
|
|
1795
1800
|
"Last update ",
|
|
1796
1801
|
nt(p, "HH:mm")
|
|
@@ -1799,12 +1804,12 @@ const Cn = ({
|
|
|
1799
1804
|
);
|
|
1800
1805
|
});
|
|
1801
1806
|
export {
|
|
1802
|
-
|
|
1807
|
+
xt as DEFAULT_DATE_FORMAT,
|
|
1803
1808
|
Je as DEFAULT_DATE_TIME_FORMAT,
|
|
1804
1809
|
$e as EColumnFilterStatus,
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
+
Dt as MINIMUM_COLUMN_WIDTH,
|
|
1811
|
+
rn as RESIZER_WIDTH,
|
|
1812
|
+
jn as Refresher,
|
|
1813
|
+
Wn as SchemaTable,
|
|
1814
|
+
cn as Th
|
|
1810
1815
|
};
|