@espresso-lab/mantine-data-table 2.2.1 → 2.2.2
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/DataTable/CreateModal.d.ts +2 -1
- package/dist/DataTable/DeleteModal.d.ts +2 -1
- package/dist/DataTable/UpdateModal.d.ts +2 -1
- package/dist/Hooks/useApi.d.ts +3 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +291 -312
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
2
|
import t, { Fragment as n, createContext as r, createElement as i, useCallback as a, useContext as o, useEffect as s, useLayoutEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
3
3
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
4
|
-
import { Accordion as h, ActionIcon as g, Alert as _, Box as v, Button as y, Center as b, Checkbox as x, Collapse as S, Divider as C, Flex as w, Group as T, Indicator as E, Loader as D, Menu as O, MenuDropdown as k, MenuItem as A, MenuTarget as j, Modal as M, NumberInput as N, Pagination as P, Popover as F, PopoverDropdown as ee, PopoverTarget as I, ScrollArea as L, Select as R, Skeleton as te, Stack as z, Stepper as ne, Table as re, TableTd as ie, TableTfoot as ae, TableTh as oe, TableThead as se, TableTr as ce, Tabs as le, Text as B, TextInput as ue, Textarea as de, Title as fe, createSafeContext as pe, parseThemeColor as me, rem as
|
|
5
|
-
import { DateInput as
|
|
6
|
-
import { useForm as
|
|
7
|
-
import { IconCaretDownFilled as
|
|
8
|
-
import { useClickOutside as
|
|
4
|
+
import { Accordion as h, ActionIcon as g, Alert as _, Box as v, Button as y, Center as b, Checkbox as x, Collapse as S, Divider as C, Flex as w, Group as T, Indicator as E, Loader as D, Menu as O, MenuDropdown as k, MenuItem as A, MenuTarget as j, Modal as M, NumberInput as N, Pagination as P, Popover as F, PopoverDropdown as ee, PopoverTarget as I, ScrollArea as L, Select as R, Skeleton as te, Stack as z, Stepper as ne, Table as re, TableTd as ie, TableTfoot as ae, TableTh as oe, TableThead as se, TableTr as ce, Tabs as le, Text as B, TextInput as ue, Textarea as de, Title as fe, createSafeContext as pe, parseThemeColor as me, rem as he, useDirection as ge, useMantineTheme as _e } from "@mantine/core";
|
|
5
|
+
import { DateInput as ve } from "@mantine/dates";
|
|
6
|
+
import { useForm as ye } from "@mantine/form";
|
|
7
|
+
import { IconCaretDownFilled as be, IconChevronRight as xe, IconDotsVertical as Se, IconFilter as Ce, IconInfoCircle as we, IconPencil as Te, IconRefresh as Ee, IconSortAscending as De, IconSortDescending as Oe, IconTrash as ke } from "@tabler/icons-react";
|
|
8
|
+
import { useClickOutside as Ae, useDisclosure as je, useLocalStorage as V, useMediaQuery as Me, useMergedRef as Ne, useTimeout as Pe } from "@mantine/hooks";
|
|
9
9
|
//#region node_modules/@tanstack/query-core/build/modern/subscribable.js
|
|
10
|
-
var
|
|
10
|
+
var Fe = class {
|
|
11
11
|
constructor() {
|
|
12
12
|
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
13
13
|
}
|
|
@@ -21,7 +21,7 @@ var U = class {
|
|
|
21
21
|
}
|
|
22
22
|
onSubscribe() {}
|
|
23
23
|
onUnsubscribe() {}
|
|
24
|
-
},
|
|
24
|
+
}, Ie = new class extends Fe {
|
|
25
25
|
#e;
|
|
26
26
|
#t;
|
|
27
27
|
#n;
|
|
@@ -58,13 +58,13 @@ var U = class {
|
|
|
58
58
|
isFocused() {
|
|
59
59
|
return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
|
|
60
60
|
}
|
|
61
|
-
}(),
|
|
61
|
+
}(), Le = {
|
|
62
62
|
setTimeout: (e, t) => setTimeout(e, t),
|
|
63
63
|
clearTimeout: (e) => clearTimeout(e),
|
|
64
64
|
setInterval: (e, t) => setInterval(e, t),
|
|
65
65
|
clearInterval: (e) => clearInterval(e)
|
|
66
|
-
},
|
|
67
|
-
#e =
|
|
66
|
+
}, Re = new class {
|
|
67
|
+
#e = Le;
|
|
68
68
|
#t = !1;
|
|
69
69
|
setTimeoutProvider(e) {
|
|
70
70
|
process.env.NODE_ENV !== "production" && this.#t && e !== this.#e && console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.", {
|
|
@@ -85,87 +85,87 @@ var U = class {
|
|
|
85
85
|
this.#e.clearInterval(e);
|
|
86
86
|
}
|
|
87
87
|
}();
|
|
88
|
-
function
|
|
88
|
+
function ze(e) {
|
|
89
89
|
setTimeout(e, 0);
|
|
90
90
|
}
|
|
91
91
|
//#endregion
|
|
92
92
|
//#region node_modules/@tanstack/query-core/build/modern/utils.js
|
|
93
|
-
var
|
|
94
|
-
function
|
|
95
|
-
function
|
|
93
|
+
var Be = typeof window > "u" || "Deno" in globalThis;
|
|
94
|
+
function Ve() {}
|
|
95
|
+
function He(e) {
|
|
96
96
|
return typeof e == "number" && e >= 0 && e !== Infinity;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function Ue(e, t) {
|
|
99
99
|
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function H(e, t) {
|
|
102
102
|
return typeof e == "function" ? e(t) : e;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function U(e, t) {
|
|
105
105
|
return typeof e == "function" ? e(t) : e;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
return JSON.stringify(e, (e, t) =>
|
|
107
|
+
function We(e) {
|
|
108
|
+
return JSON.stringify(e, (e, t) => Je(t) ? Object.keys(t).sort().reduce((e, n) => (e[n] = t[n], e), {}) : t);
|
|
109
109
|
}
|
|
110
|
-
var
|
|
111
|
-
function
|
|
110
|
+
var Ge = Object.prototype.hasOwnProperty;
|
|
111
|
+
function Ke(e, t, n = 0) {
|
|
112
112
|
if (e === t) return e;
|
|
113
113
|
if (n > 500) return t;
|
|
114
|
-
let r =
|
|
115
|
-
if (!r && !(
|
|
114
|
+
let r = qe(e) && qe(t);
|
|
115
|
+
if (!r && !(Je(e) && Je(t))) return t;
|
|
116
116
|
let i = (r ? e : Object.keys(e)).length, a = r ? t : Object.keys(t), o = a.length, s = r ? Array(o) : {}, c = 0;
|
|
117
117
|
for (let l = 0; l < o; l++) {
|
|
118
118
|
let o = r ? l : a[l], u = e[o], d = t[o];
|
|
119
119
|
if (u === d) {
|
|
120
|
-
s[o] = u, (r ? l < i :
|
|
120
|
+
s[o] = u, (r ? l < i : Ge.call(e, o)) && c++;
|
|
121
121
|
continue;
|
|
122
122
|
}
|
|
123
123
|
if (u === null || d === null || typeof u != "object" || typeof d != "object") {
|
|
124
124
|
s[o] = d;
|
|
125
125
|
continue;
|
|
126
126
|
}
|
|
127
|
-
let f =
|
|
127
|
+
let f = Ke(u, d, n + 1);
|
|
128
128
|
s[o] = f, f === u && c++;
|
|
129
129
|
}
|
|
130
130
|
return i === o && c === i ? e : s;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function W(e, t) {
|
|
133
133
|
if (!t || Object.keys(e).length !== Object.keys(t).length) return !1;
|
|
134
134
|
for (let n in e) if (e[n] !== t[n]) return !1;
|
|
135
135
|
return !0;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function qe(e) {
|
|
138
138
|
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
if (!
|
|
140
|
+
function Je(e) {
|
|
141
|
+
if (!Ye(e)) return !1;
|
|
142
142
|
let t = e.constructor;
|
|
143
143
|
if (t === void 0) return !0;
|
|
144
144
|
let n = t.prototype;
|
|
145
|
-
return !(!
|
|
145
|
+
return !(!Ye(n) || !n.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function Ye(e) {
|
|
148
148
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function Xe(e, t, n) {
|
|
151
151
|
if (typeof n.structuralSharing == "function") return n.structuralSharing(e, t);
|
|
152
152
|
if (n.structuralSharing !== !1) {
|
|
153
153
|
if (process.env.NODE_ENV !== "production") try {
|
|
154
|
-
return
|
|
154
|
+
return Ke(e, t);
|
|
155
155
|
} catch (e) {
|
|
156
156
|
throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${e}`), e;
|
|
157
157
|
}
|
|
158
|
-
return
|
|
158
|
+
return Ke(e, t);
|
|
159
159
|
}
|
|
160
160
|
return t;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function G(e, t) {
|
|
163
163
|
return typeof e == "function" ? e(...t) : !!e;
|
|
164
164
|
}
|
|
165
165
|
//#endregion
|
|
166
166
|
//#region node_modules/@tanstack/query-core/build/modern/environmentManager.js
|
|
167
167
|
var Ze = /* @__PURE__ */ (() => {
|
|
168
|
-
let e = () =>
|
|
168
|
+
let e = () => Be;
|
|
169
169
|
return {
|
|
170
170
|
isServer() {
|
|
171
171
|
return e();
|
|
@@ -199,7 +199,7 @@ function Qe() {
|
|
|
199
199
|
}
|
|
200
200
|
//#endregion
|
|
201
201
|
//#region node_modules/@tanstack/query-core/build/modern/notifyManager.js
|
|
202
|
-
var $e =
|
|
202
|
+
var $e = ze;
|
|
203
203
|
function et() {
|
|
204
204
|
let e = [], t = 0, n = (e) => {
|
|
205
205
|
e();
|
|
@@ -247,7 +247,7 @@ function et() {
|
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
|
-
var tt = et(), nt = new class extends
|
|
250
|
+
var tt = et(), nt = new class extends Fe {
|
|
251
251
|
#e = !0;
|
|
252
252
|
#t;
|
|
253
253
|
#n;
|
|
@@ -299,7 +299,7 @@ function it(e, t) {
|
|
|
299
299
|
}
|
|
300
300
|
//#endregion
|
|
301
301
|
//#region node_modules/@tanstack/query-core/build/modern/queryObserver.js
|
|
302
|
-
var at = class extends
|
|
302
|
+
var at = class extends Fe {
|
|
303
303
|
constructor(e, t) {
|
|
304
304
|
super(), this.options = t, this.#e = e, this.#s = null, this.#o = Qe(), this.bindMethods(), this.setOptions(t);
|
|
305
305
|
}
|
|
@@ -338,16 +338,16 @@ var at = class extends U {
|
|
|
338
338
|
}
|
|
339
339
|
setOptions(e) {
|
|
340
340
|
let t = this.options, n = this.#t;
|
|
341
|
-
if (this.options = this.#e.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof
|
|
342
|
-
this.#S(), this.#t.setOptions(this.options), t._defaulted && !
|
|
341
|
+
if (this.options = this.#e.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof U(this.options.enabled, this.#t) != "boolean") throw Error("Expected enabled to be a boolean or a callback that returns a boolean");
|
|
342
|
+
this.#S(), this.#t.setOptions(this.options), t._defaulted && !W(this.options, t) && this.#e.getQueryCache().notify({
|
|
343
343
|
type: "observerOptionsUpdated",
|
|
344
344
|
query: this.#t,
|
|
345
345
|
observer: this
|
|
346
346
|
});
|
|
347
347
|
let r = this.hasListeners();
|
|
348
|
-
r && lt(this.#t, n, this.options, t) && this.#h(), this.updateResult(), r && (this.#t !== n ||
|
|
348
|
+
r && lt(this.#t, n, this.options, t) && this.#h(), this.updateResult(), r && (this.#t !== n || U(this.options.enabled, this.#t) !== U(t.enabled, this.#t) || H(this.options.staleTime, this.#t) !== H(t.staleTime, this.#t)) && this.#g();
|
|
349
349
|
let i = this.#_();
|
|
350
|
-
r && (this.#t !== n ||
|
|
350
|
+
r && (this.#t !== n || U(this.options.enabled, this.#t) !== U(t.enabled, this.#t) || i !== this.#p) && this.#v(i);
|
|
351
351
|
}
|
|
352
352
|
getOptimisticResult(e) {
|
|
353
353
|
let t = this.#e.getQueryCache().build(this.#e, e), n = this.createResult(t, e);
|
|
@@ -381,14 +381,14 @@ var at = class extends U {
|
|
|
381
381
|
#h(e) {
|
|
382
382
|
this.#S();
|
|
383
383
|
let t = this.#t.fetch(this.options, e);
|
|
384
|
-
return e?.throwOnError || (t = t.catch(
|
|
384
|
+
return e?.throwOnError || (t = t.catch(Ve)), t;
|
|
385
385
|
}
|
|
386
386
|
#g() {
|
|
387
387
|
this.#b();
|
|
388
|
-
let e =
|
|
389
|
-
if (Ze.isServer() || this.#r.isStale || !
|
|
390
|
-
let t =
|
|
391
|
-
this.#d =
|
|
388
|
+
let e = H(this.options.staleTime, this.#t);
|
|
389
|
+
if (Ze.isServer() || this.#r.isStale || !He(e)) return;
|
|
390
|
+
let t = Ue(this.#r.dataUpdatedAt, e) + 1;
|
|
391
|
+
this.#d = Re.setTimeout(() => {
|
|
392
392
|
this.#r.isStale || this.updateResult();
|
|
393
393
|
}, t);
|
|
394
394
|
}
|
|
@@ -396,18 +396,18 @@ var at = class extends U {
|
|
|
396
396
|
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
|
|
397
397
|
}
|
|
398
398
|
#v(e) {
|
|
399
|
-
this.#x(), this.#p = e, !(Ze.isServer() ||
|
|
400
|
-
(this.options.refetchIntervalInBackground ||
|
|
399
|
+
this.#x(), this.#p = e, !(Ze.isServer() || U(this.options.enabled, this.#t) === !1 || !He(this.#p) || this.#p === 0) && (this.#f = Re.setInterval(() => {
|
|
400
|
+
(this.options.refetchIntervalInBackground || Ie.isFocused()) && this.#h();
|
|
401
401
|
}, this.#p));
|
|
402
402
|
}
|
|
403
403
|
#y() {
|
|
404
404
|
this.#g(), this.#v(this.#_());
|
|
405
405
|
}
|
|
406
406
|
#b() {
|
|
407
|
-
this.#d !== void 0 && (
|
|
407
|
+
this.#d !== void 0 && (Re.clearTimeout(this.#d), this.#d = void 0);
|
|
408
408
|
}
|
|
409
409
|
#x() {
|
|
410
|
-
this.#f !== void 0 && (
|
|
410
|
+
this.#f !== void 0 && (Re.clearInterval(this.#f), this.#f = void 0);
|
|
411
411
|
}
|
|
412
412
|
createResult(e, t) {
|
|
413
413
|
let n = this.#t, r = this.options, i = this.#r, a = this.#i, o = this.#a, s = e === n ? this.#n : e.state, { state: c } = e, l = { ...c }, u = !1, d;
|
|
@@ -423,11 +423,11 @@ var at = class extends U {
|
|
|
423
423
|
let h = !1;
|
|
424
424
|
if (t.placeholderData !== void 0 && d === void 0 && m === "pending") {
|
|
425
425
|
let e;
|
|
426
|
-
i?.isPlaceholderData && t.placeholderData === o?.placeholderData ? (e = i.data, h = !0) : e = typeof t.placeholderData == "function" ? t.placeholderData(this.#u?.state.data, this.#u) : t.placeholderData, e !== void 0 && (m = "success", d =
|
|
426
|
+
i?.isPlaceholderData && t.placeholderData === o?.placeholderData ? (e = i.data, h = !0) : e = typeof t.placeholderData == "function" ? t.placeholderData(this.#u?.state.data, this.#u) : t.placeholderData, e !== void 0 && (m = "success", d = Xe(i?.data, e, t), u = !0);
|
|
427
427
|
}
|
|
428
428
|
if (t.select && d !== void 0 && !h) if (i && d === a?.data && t.select === this.#c) d = this.#l;
|
|
429
429
|
else try {
|
|
430
|
-
this.#c = t.select, d = t.select(d), d =
|
|
430
|
+
this.#c = t.select, d = t.select(d), d = Xe(i?.data, d, t), this.#l = d, this.#s = null;
|
|
431
431
|
} catch (e) {
|
|
432
432
|
this.#s = e;
|
|
433
433
|
}
|
|
@@ -458,7 +458,7 @@ var at = class extends U {
|
|
|
458
458
|
isStale: ut(e, t),
|
|
459
459
|
refetch: this.refetch,
|
|
460
460
|
promise: this.#o,
|
|
461
|
-
isEnabled:
|
|
461
|
+
isEnabled: U(t.enabled, e) !== !1
|
|
462
462
|
};
|
|
463
463
|
if (this.options.experimental_prefetchInRender) {
|
|
464
464
|
let t = x.data !== void 0, r = x.status === "error" && !t, i = (e) => {
|
|
@@ -482,7 +482,7 @@ var at = class extends U {
|
|
|
482
482
|
}
|
|
483
483
|
updateResult() {
|
|
484
484
|
let e = this.#r, t = this.createResult(this.#t, this.options);
|
|
485
|
-
this.#i = this.#t.state, this.#a = this.options, this.#i.data !== void 0 && (this.#u = this.#t), !
|
|
485
|
+
this.#i = this.#t.state, this.#a = this.options, this.#i.data !== void 0 && (this.#u = this.#t), !W(t, e) && (this.#r = t, this.#C({ listeners: (() => {
|
|
486
486
|
if (!e) return !0;
|
|
487
487
|
let { notifyOnChangeProps: t } = this.options, n = typeof t == "function" ? t() : t;
|
|
488
488
|
if (n === "all" || !n && !this.#m.size) return !0;
|
|
@@ -514,26 +514,26 @@ var at = class extends U {
|
|
|
514
514
|
}
|
|
515
515
|
};
|
|
516
516
|
function ot(e, t) {
|
|
517
|
-
return
|
|
517
|
+
return U(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && U(t.retryOnMount, e) === !1);
|
|
518
518
|
}
|
|
519
519
|
function st(e, t) {
|
|
520
520
|
return ot(e, t) || e.state.data !== void 0 && ct(e, t, t.refetchOnMount);
|
|
521
521
|
}
|
|
522
522
|
function ct(e, t, n) {
|
|
523
|
-
if (
|
|
523
|
+
if (U(t.enabled, e) !== !1 && H(t.staleTime, e) !== "static") {
|
|
524
524
|
let r = typeof n == "function" ? n(e) : n;
|
|
525
525
|
return r === "always" || r !== !1 && ut(e, t);
|
|
526
526
|
}
|
|
527
527
|
return !1;
|
|
528
528
|
}
|
|
529
529
|
function lt(e, t, n, r) {
|
|
530
|
-
return (e !== t ||
|
|
530
|
+
return (e !== t || U(r.enabled, e) === !1) && (!n.suspense || e.state.status !== "error") && ut(e, n);
|
|
531
531
|
}
|
|
532
532
|
function ut(e, t) {
|
|
533
|
-
return
|
|
533
|
+
return U(t.enabled, e) !== !1 && e.isStaleByTime(H(t.staleTime, e));
|
|
534
534
|
}
|
|
535
535
|
function dt(e, t) {
|
|
536
|
-
return !
|
|
536
|
+
return !W(e.getCurrentResult(), t);
|
|
537
537
|
}
|
|
538
538
|
//#endregion
|
|
539
539
|
//#region node_modules/@tanstack/query-core/build/modern/mutation.js
|
|
@@ -552,7 +552,7 @@ function K() {
|
|
|
552
552
|
}
|
|
553
553
|
//#endregion
|
|
554
554
|
//#region node_modules/@tanstack/query-core/build/modern/mutationObserver.js
|
|
555
|
-
var ft = class extends
|
|
555
|
+
var ft = class extends Fe {
|
|
556
556
|
#e;
|
|
557
557
|
#t = void 0;
|
|
558
558
|
#n;
|
|
@@ -565,11 +565,11 @@ var ft = class extends U {
|
|
|
565
565
|
}
|
|
566
566
|
setOptions(e) {
|
|
567
567
|
let t = this.options;
|
|
568
|
-
this.options = this.#e.defaultMutationOptions(e),
|
|
568
|
+
this.options = this.#e.defaultMutationOptions(e), W(this.options, t) || this.#e.getMutationCache().notify({
|
|
569
569
|
type: "observerOptionsUpdated",
|
|
570
570
|
mutation: this.#n,
|
|
571
571
|
observer: this
|
|
572
|
-
}), t?.mutationKey && this.options.mutationKey &&
|
|
572
|
+
}), t?.mutationKey && this.options.mutationKey && We(t.mutationKey) !== We(this.options.mutationKey) ? this.reset() : this.#n?.state.status === "pending" && this.#n.setOptions(this.options);
|
|
573
573
|
}
|
|
574
574
|
onUnsubscribe() {
|
|
575
575
|
this.hasListeners() || this.#n?.removeObserver(this);
|
|
@@ -662,13 +662,13 @@ function _t() {
|
|
|
662
662
|
};
|
|
663
663
|
}
|
|
664
664
|
var vt = e.createContext(_t()), yt = () => e.useContext(vt), bt = (e, t, n) => {
|
|
665
|
-
let r = n?.state.error && typeof e.throwOnError == "function" ?
|
|
665
|
+
let r = n?.state.error && typeof e.throwOnError == "function" ? G(e.throwOnError, [n.state.error, n]) : e.throwOnError;
|
|
666
666
|
(e.suspense || e.experimental_prefetchInRender || r) && (t.isReset() || (e.retryOnMount = !1));
|
|
667
667
|
}, xt = (t) => {
|
|
668
668
|
e.useEffect(() => {
|
|
669
669
|
t.clearReset();
|
|
670
670
|
}, [t]);
|
|
671
|
-
}, St = ({ result: e, errorResetBoundary: t, throwOnError: n, query: r, suspense: i }) => e.isError && !t.isReset() && !e.isFetching && r && (i && e.data === void 0 ||
|
|
671
|
+
}, St = ({ result: e, errorResetBoundary: t, throwOnError: n, query: r, suspense: i }) => e.isError && !t.isReset() && !e.isFetching && r && (i && e.data === void 0 || G(n, [e.error, r])), Ct = (e) => {
|
|
672
672
|
if (e.suspense) {
|
|
673
673
|
let t = 1e3, n = (e) => e === "static" ? e : Math.max(e ?? t, t), r = e.staleTime;
|
|
674
674
|
e.staleTime = typeof r == "function" ? (...e) => n(r(...e)) : n(r), typeof e.gcTime == "number" && (e.gcTime = Math.max(e.gcTime, t));
|
|
@@ -688,7 +688,7 @@ function Dt(t, n, r) {
|
|
|
688
688
|
s._optimisticResults = i ? "isRestoring" : l ? "optimistic" : void 0, Ct(s), bt(s, a, c), xt(a);
|
|
689
689
|
let u = !o.getQueryCache().get(s.queryHash), [d] = e.useState(() => new n(o, s)), f = d.getOptimisticResult(s), p = !i && l;
|
|
690
690
|
if (e.useSyncExternalStore(e.useCallback((e) => {
|
|
691
|
-
let t = p ? d.subscribe(tt.batchCalls(e)) :
|
|
691
|
+
let t = p ? d.subscribe(tt.batchCalls(e)) : Ve;
|
|
692
692
|
return d.updateResult(), t;
|
|
693
693
|
}, [d, p]), () => d.getCurrentResult(), () => d.getCurrentResult()), e.useEffect(() => {
|
|
694
694
|
d.setOptions(s);
|
|
@@ -700,7 +700,7 @@ function Dt(t, n, r) {
|
|
|
700
700
|
query: c,
|
|
701
701
|
suspense: s.suspense
|
|
702
702
|
})) throw f.error;
|
|
703
|
-
return o.getDefaultOptions().queries?._experimental_afterQuery?.(s, f), s.experimental_prefetchInRender && !Ze.isServer() && wt(f, i) && (u ? Et(s, d, a) : c?.promise)?.catch(
|
|
703
|
+
return o.getDefaultOptions().queries?._experimental_afterQuery?.(s, f), s.experimental_prefetchInRender && !Ze.isServer() && wt(f, i) && (u ? Et(s, d, a) : c?.promise)?.catch(Ve).finally(() => {
|
|
704
704
|
d.updateResult();
|
|
705
705
|
}), s.notifyOnChangeProps ? f : d.trackResult(f);
|
|
706
706
|
}
|
|
@@ -717,9 +717,9 @@ function kt(t, n) {
|
|
|
717
717
|
i.setOptions(t);
|
|
718
718
|
}, [i, t]);
|
|
719
719
|
let a = e.useSyncExternalStore(e.useCallback((e) => i.subscribe(tt.batchCalls(e)), [i]), () => i.getCurrentResult(), () => i.getCurrentResult()), o = e.useCallback((e, t) => {
|
|
720
|
-
i.mutate(e, t).catch(
|
|
720
|
+
i.mutate(e, t).catch(Ve);
|
|
721
721
|
}, [i]);
|
|
722
|
-
if (a.error &&
|
|
722
|
+
if (a.error && G(i.options.throwOnError, [a.error])) throw a.error;
|
|
723
723
|
return {
|
|
724
724
|
...a,
|
|
725
725
|
mutate: o,
|
|
@@ -761,20 +761,7 @@ var Nt = class extends Error {
|
|
|
761
761
|
function Pt(e) {
|
|
762
762
|
return e instanceof Nt ? e.violations : void 0;
|
|
763
763
|
}
|
|
764
|
-
function
|
|
765
|
-
if (typeof e == "string") try {
|
|
766
|
-
let t = JSON.parse(e);
|
|
767
|
-
return {
|
|
768
|
-
message: t.message || e,
|
|
769
|
-
code: t.code,
|
|
770
|
-
details: t.details
|
|
771
|
-
};
|
|
772
|
-
} catch {
|
|
773
|
-
return { message: e };
|
|
774
|
-
}
|
|
775
|
-
return e instanceof Error ? { message: e.message } : { message: "Unbekannter Fehler" };
|
|
776
|
-
}
|
|
777
|
-
async function It(e, t) {
|
|
764
|
+
async function Y(e, t) {
|
|
778
765
|
let n = await fetch(e, t);
|
|
779
766
|
if (n.status >= 400) {
|
|
780
767
|
let e = await n.text();
|
|
@@ -793,93 +780,90 @@ async function It(e, t) {
|
|
|
793
780
|
}
|
|
794
781
|
return n;
|
|
795
782
|
}
|
|
796
|
-
var
|
|
797
|
-
async function
|
|
798
|
-
return (await
|
|
783
|
+
var Ft = (e) => e.map((e) => e.toString());
|
|
784
|
+
async function It(e, t) {
|
|
785
|
+
return (await Y(e, {
|
|
799
786
|
method: "GET",
|
|
800
787
|
headers: await t()
|
|
801
788
|
})).json();
|
|
802
789
|
}
|
|
803
|
-
async function
|
|
804
|
-
return (await
|
|
790
|
+
async function Lt(e, t, n) {
|
|
791
|
+
return (await Y(`${e}/${t}`, {
|
|
805
792
|
method: "GET",
|
|
806
793
|
headers: await n()
|
|
807
794
|
})).json();
|
|
808
795
|
}
|
|
809
|
-
async function
|
|
810
|
-
await
|
|
796
|
+
async function Rt(e, t, n) {
|
|
797
|
+
await Y(`${e}/${t}`, {
|
|
811
798
|
method: "DELETE",
|
|
812
799
|
headers: await n()
|
|
813
800
|
});
|
|
814
801
|
}
|
|
815
|
-
async function
|
|
816
|
-
let r = await
|
|
802
|
+
async function zt(e, t, n) {
|
|
803
|
+
let r = await Y(e, {
|
|
817
804
|
method: "POST",
|
|
818
805
|
headers: await n(),
|
|
819
806
|
body: JSON.stringify(t)
|
|
820
807
|
});
|
|
821
808
|
return r.status === 204 ? t : r.json();
|
|
822
809
|
}
|
|
823
|
-
async function
|
|
824
|
-
let i = await
|
|
810
|
+
async function Bt(e, t, n, r) {
|
|
811
|
+
let i = await Y(t, {
|
|
825
812
|
method: e,
|
|
826
813
|
headers: await n(),
|
|
827
814
|
body: r ? JSON.stringify(r) : void 0
|
|
828
815
|
});
|
|
829
816
|
if (i.status !== 204) return i.json();
|
|
830
817
|
}
|
|
831
|
-
async function
|
|
832
|
-
let r = await
|
|
818
|
+
async function Vt(e, t, n) {
|
|
819
|
+
let r = await Y(`${e}/${t.id}`, {
|
|
833
820
|
method: "PUT",
|
|
834
821
|
headers: await n(),
|
|
835
822
|
body: JSON.stringify(t)
|
|
836
823
|
});
|
|
837
824
|
return r.status === 204 ? t : r.json();
|
|
838
825
|
}
|
|
839
|
-
function
|
|
826
|
+
function Ht(e, t, n) {
|
|
840
827
|
let { baseUrl: r, getHeaders: i } = J();
|
|
841
828
|
return Ot({
|
|
842
|
-
queryKey: [...
|
|
843
|
-
queryFn: () =>
|
|
829
|
+
queryKey: [...Ft(t), String(n?.toString())],
|
|
830
|
+
queryFn: () => Lt(`${r}${e}`, n, i),
|
|
844
831
|
enabled: !!n
|
|
845
832
|
});
|
|
846
833
|
}
|
|
847
|
-
function
|
|
834
|
+
function Ut(e, t, n = !0) {
|
|
848
835
|
let { baseUrl: r, getHeaders: i } = J();
|
|
849
836
|
return Ot({
|
|
850
|
-
queryKey:
|
|
851
|
-
queryFn: () =>
|
|
837
|
+
queryKey: Ft(t),
|
|
838
|
+
queryFn: () => It(`${r}${e}`, i),
|
|
852
839
|
enabled: n
|
|
853
840
|
});
|
|
854
841
|
}
|
|
855
|
-
function
|
|
856
|
-
|
|
842
|
+
function Wt(e, t, n) {
|
|
843
|
+
return Promise.all([e.invalidateQueries({ queryKey: Ft(t) }), ...(n ?? []).map((t) => e.invalidateQueries({ queryKey: t }))]);
|
|
844
|
+
}
|
|
845
|
+
function Gt(e, t, n) {
|
|
846
|
+
let { baseUrl: r, queryClient: i, getHeaders: a } = J();
|
|
857
847
|
return kt({
|
|
858
|
-
mutationKey:
|
|
859
|
-
mutationFn: (t) =>
|
|
860
|
-
onSettled()
|
|
861
|
-
return r.invalidateQueries({ queryKey: Y(t) });
|
|
862
|
-
}
|
|
848
|
+
mutationKey: Ft(t),
|
|
849
|
+
mutationFn: (t) => zt(`${r}${e}`, t, a),
|
|
850
|
+
onSettled: () => Wt(i, t, n)
|
|
863
851
|
});
|
|
864
852
|
}
|
|
865
|
-
function Kt(e, t) {
|
|
866
|
-
let { baseUrl:
|
|
853
|
+
function Kt(e, t, n) {
|
|
854
|
+
let { baseUrl: r, queryClient: i, getHeaders: a } = J();
|
|
867
855
|
return kt({
|
|
868
|
-
mutationKey:
|
|
869
|
-
mutationFn: (t) =>
|
|
870
|
-
onSettled()
|
|
871
|
-
return r.invalidateQueries({ queryKey: Y(t) });
|
|
872
|
-
}
|
|
856
|
+
mutationKey: Ft(t),
|
|
857
|
+
mutationFn: (t) => Vt(`${r}${e}`, t, a),
|
|
858
|
+
onSettled: () => Wt(i, t, n)
|
|
873
859
|
});
|
|
874
860
|
}
|
|
875
|
-
function qt(e, t) {
|
|
876
|
-
let { baseUrl:
|
|
861
|
+
function qt(e, t, n) {
|
|
862
|
+
let { baseUrl: r, queryClient: i, getHeaders: a } = J();
|
|
877
863
|
return kt({
|
|
878
|
-
mutationKey:
|
|
879
|
-
mutationFn: (t) =>
|
|
880
|
-
onSettled()
|
|
881
|
-
return r.invalidateQueries({ queryKey: Y(t) });
|
|
882
|
-
}
|
|
864
|
+
mutationKey: Ft(t),
|
|
865
|
+
mutationFn: (t) => Rt(`${r}${e}`, t, a),
|
|
866
|
+
onSettled: () => Wt(i, t, n)
|
|
883
867
|
});
|
|
884
868
|
}
|
|
885
869
|
//#endregion
|
|
@@ -914,7 +898,7 @@ function tn(e, t) {
|
|
|
914
898
|
return r.length > 0 ? r.map((e) => e.message).join(", ") : void 0;
|
|
915
899
|
}
|
|
916
900
|
function nn({ fields: e, steps: t, record: r, recordId: i, submitting: a, error: o, onPersist: c, onClose: l }) {
|
|
917
|
-
let [u, h] = d(0), [g, v] = d(!1), b =
|
|
901
|
+
let [u, h] = d(0), [g, v] = d(!1), b = ye({
|
|
918
902
|
mode: "uncontrolled",
|
|
919
903
|
initialValues: Yt(e),
|
|
920
904
|
validate: Xt(e)
|
|
@@ -939,7 +923,7 @@ function nn({ fields: e, steps: t, record: r, recordId: i, submitting: a, error:
|
|
|
939
923
|
required: n,
|
|
940
924
|
...r
|
|
941
925
|
}, b.key(e.id));
|
|
942
|
-
case "date": return /* @__PURE__ */ p(
|
|
926
|
+
case "date": return /* @__PURE__ */ p(ve, {
|
|
943
927
|
valueFormat: "DD.MM.YYYY",
|
|
944
928
|
clearable: !0,
|
|
945
929
|
label: e.column.title,
|
|
@@ -1020,22 +1004,22 @@ function nn({ fields: e, steps: t, record: r, recordId: i, submitting: a, error:
|
|
|
1020
1004
|
}
|
|
1021
1005
|
//#endregion
|
|
1022
1006
|
//#region src/DataTable/CreateModal.tsx
|
|
1023
|
-
function rn({ fields: e, onClose: t, queryKey: n,
|
|
1024
|
-
let [
|
|
1007
|
+
function rn({ fields: e, onClose: t, queryKey: n, connectedQueryKeys: r, apiPath: i, steps: a, onCreated: o }) {
|
|
1008
|
+
let [s, c] = d(), { mutateAsync: l, isPending: u, error: f } = Gt(i, n, r), { mutateAsync: m, isPending: h, error: g } = Kt(i, n, r);
|
|
1025
1009
|
return /* @__PURE__ */ p(nn, {
|
|
1026
1010
|
fields: e,
|
|
1027
|
-
steps:
|
|
1028
|
-
recordId:
|
|
1029
|
-
submitting:
|
|
1030
|
-
error:
|
|
1011
|
+
steps: a,
|
|
1012
|
+
recordId: s,
|
|
1013
|
+
submitting: u || h,
|
|
1014
|
+
error: f ?? g,
|
|
1031
1015
|
onPersist: async (e) => {
|
|
1032
|
-
if (
|
|
1016
|
+
if (s != null) await m({
|
|
1033
1017
|
...e,
|
|
1034
|
-
id:
|
|
1018
|
+
id: s
|
|
1035
1019
|
});
|
|
1036
1020
|
else {
|
|
1037
|
-
let t = await
|
|
1038
|
-
|
|
1021
|
+
let t = await l(e);
|
|
1022
|
+
c(t.id), o?.(t.id);
|
|
1039
1023
|
}
|
|
1040
1024
|
},
|
|
1041
1025
|
onClose: t
|
|
@@ -1180,7 +1164,7 @@ function hn({ key: e, columns: t = [], getInitialValueInEffect: n = !0 }) {
|
|
|
1180
1164
|
defaultPinned: e.pinned,
|
|
1181
1165
|
pinnable: !!e.pinnable,
|
|
1182
1166
|
pinned: e.pinned
|
|
1183
|
-
})), [t]), [i, a] =
|
|
1167
|
+
})), [t]), [i, a] = V({
|
|
1184
1168
|
key: e ? `${e}-columns-pinning` : "",
|
|
1185
1169
|
defaultValue: e ? r : void 0,
|
|
1186
1170
|
getInitialValueInEffect: n
|
|
@@ -1228,7 +1212,7 @@ function hn({ key: e, columns: t = [], getInitialValueInEffect: n = !0 }) {
|
|
|
1228
1212
|
};
|
|
1229
1213
|
}
|
|
1230
1214
|
function gn({ key: e, columns: t = [], getInitialValueInEffect: n = !0 }) {
|
|
1231
|
-
let r = l(() => t ? t.map((e) => e.accessor) : [], [t]), [i, a] =
|
|
1215
|
+
let r = l(() => t ? t.map((e) => e.accessor) : [], [t]), [i, a] = V({
|
|
1232
1216
|
key: e ? `${e}-columns-order` : "",
|
|
1233
1217
|
defaultValue: e ? r : void 0,
|
|
1234
1218
|
getInitialValueInEffect: n
|
|
@@ -1271,7 +1255,7 @@ function gn({ key: e, columns: t = [], getInitialValueInEffect: n = !0 }) {
|
|
|
1271
1255
|
};
|
|
1272
1256
|
}
|
|
1273
1257
|
function _n({ key: e, columns: t = [], getInitialValueInEffect: n = !0, headerRef: r }) {
|
|
1274
|
-
let i = l(() => t.some((e) => e.resizable && !e.hidden && e.accessor !== "__selection__"), [t]), o = a(() => t.filter((e) => e.accessor !== "__selection__").map((e) => ({ [e.accessor]: e.width ?? "auto" })), [t]), [c, f] =
|
|
1258
|
+
let i = l(() => t.some((e) => e.resizable && !e.hidden && e.accessor !== "__selection__"), [t]), o = a(() => t.filter((e) => e.accessor !== "__selection__").map((e) => ({ [e.accessor]: e.width ?? "auto" })), [t]), [c, f] = V({
|
|
1275
1259
|
key: e ? `${e}-columns-width` : "",
|
|
1276
1260
|
defaultValue: e ? o() : void 0,
|
|
1277
1261
|
getInitialValueInEffect: n
|
|
@@ -1365,7 +1349,7 @@ function vn({ key: e, columns: t = [], getInitialValueInEffect: n = !0 }) {
|
|
|
1365
1349
|
defaultToggle: e.defaultToggle || !0,
|
|
1366
1350
|
toggleable: e.toggleable,
|
|
1367
1351
|
toggled: e.defaultToggle === void 0 ? !0 : e.defaultToggle
|
|
1368
|
-
})), [t]), [i, a] =
|
|
1352
|
+
})), [t]), [i, a] = V({
|
|
1369
1353
|
key: e ? `${e}-columns-toggle` : "",
|
|
1370
1354
|
defaultValue: e ? r : void 0,
|
|
1371
1355
|
getInitialValueInEffect: n
|
|
@@ -1572,7 +1556,7 @@ function On({ scrollCallbacks: e, withRowBorders: t }) {
|
|
|
1572
1556
|
Q(r.current, "--mantine-datatable-footer-position", i ? "relative" : "sticky"), Q(r.current, "--mantine-datatable-footer-bottom", i ? `${e}px` : "0");
|
|
1573
1557
|
}
|
|
1574
1558
|
function c() {
|
|
1575
|
-
f.current.withRowBorders && t.height < n.height ? Q(r.current, Tn, `${
|
|
1559
|
+
f.current.withRowBorders && t.height < n.height ? Q(r.current, Tn, `${he("1px")} solid var(--mantine-datatable-border-color)`) : Q(r.current, Tn, "unset");
|
|
1576
1560
|
}
|
|
1577
1561
|
h.current = c;
|
|
1578
1562
|
function l() {
|
|
@@ -1733,12 +1717,12 @@ function Nn(e, t, { getInitialValueInEffect: n } = { getInitialValueInEffect: !0
|
|
|
1733
1717
|
}, [e]), r;
|
|
1734
1718
|
}
|
|
1735
1719
|
function Pn(e) {
|
|
1736
|
-
let t =
|
|
1720
|
+
let t = _e();
|
|
1737
1721
|
return Nn(l(() => e.map((e) => (typeof e == "function" ? e(t) : e) ?? ""), [e, t]), l(() => e.map(() => !0), [e]));
|
|
1738
1722
|
}
|
|
1739
1723
|
function Fn(e) {
|
|
1740
|
-
let t =
|
|
1741
|
-
return
|
|
1724
|
+
let t = _e();
|
|
1725
|
+
return Me((typeof e == "function" ? e(t) : e) || "", !0);
|
|
1742
1726
|
}
|
|
1743
1727
|
function In(e) {
|
|
1744
1728
|
let t = e.replace(/([a-z\d])([A-Z]+)/g, "$1 $2").replace(/\W|_/g, " ").trim().toLowerCase();
|
|
@@ -1812,7 +1796,7 @@ function Gn({ rowExpansion: e, records: t, idAccessor: n }) {
|
|
|
1812
1796
|
}
|
|
1813
1797
|
}
|
|
1814
1798
|
function Kn(e, t) {
|
|
1815
|
-
let [n, r] = d(e), [i, a] = d(e), o =
|
|
1799
|
+
let [n, r] = d(e), [i, a] = d(e), o = Pe(() => r(!0), 0), c = Pe(() => a(!1), t || 200);
|
|
1816
1800
|
return s(() => {
|
|
1817
1801
|
e ? (c.clear(), a(!0), o.start()) : (o.clear(), r(!1), c.start());
|
|
1818
1802
|
}, [
|
|
@@ -1960,7 +1944,7 @@ function or() {
|
|
|
1960
1944
|
});
|
|
1961
1945
|
}
|
|
1962
1946
|
function sr({ children: e, isActive: t, filterPopoverProps: n, filterPopoverDisableClickOutside: r }) {
|
|
1963
|
-
let [i, { close: a, toggle: o }] =
|
|
1947
|
+
let [i, { close: a, toggle: o }] = je(!1), s = t ? or : ar, c = Ae(a);
|
|
1964
1948
|
return r && (c = void 0), m(F, {
|
|
1965
1949
|
withArrow: !0,
|
|
1966
1950
|
shadow: "md",
|
|
@@ -2145,7 +2129,7 @@ var pr = 50, mr = (e) => {
|
|
|
2145
2129
|
let { accessor: t, columnRef: n } = e, [r, i] = d(!1), o = u(0), s = u({
|
|
2146
2130
|
current: 0,
|
|
2147
2131
|
next: 0
|
|
2148
|
-
}), { dir: c } =
|
|
2132
|
+
}), { dir: c } = ge(), l = c === "rtl", { setMultipleColumnWidths: f, beginResize: m, endResize: h } = un(), g = a((e) => {
|
|
2149
2133
|
if (e.preventDefault(), e.stopPropagation(), !n.current) return;
|
|
2150
2134
|
let r = n.current, a = r.nextElementSibling;
|
|
2151
2135
|
for (; a;) {
|
|
@@ -2567,11 +2551,11 @@ function Cr() {
|
|
|
2567
2551
|
});
|
|
2568
2552
|
}
|
|
2569
2553
|
var wr = {
|
|
2570
|
-
xs:
|
|
2571
|
-
sm:
|
|
2572
|
-
md:
|
|
2573
|
-
lg:
|
|
2574
|
-
xl:
|
|
2554
|
+
xs: he(22),
|
|
2555
|
+
sm: he(26),
|
|
2556
|
+
md: he(32),
|
|
2557
|
+
lg: he(38),
|
|
2558
|
+
xl: he(44)
|
|
2575
2559
|
};
|
|
2576
2560
|
function Tr({ size: e, label: t, values: n, value: r, activeTextColor: i, activeBackgroundColor: a, onChange: o }) {
|
|
2577
2561
|
return m(T, {
|
|
@@ -2627,7 +2611,7 @@ function Er({ className: e, style: t, fetching: n, page: r, onPageChange: i, pag
|
|
|
2627
2611
|
totalRecords: g
|
|
2628
2612
|
});
|
|
2629
2613
|
} else O = n ? u : d;
|
|
2630
|
-
let k = g && _ ? Math.max(1, Math.ceil(g / _)) : 1, A = g ? (r - 1) * (_ ?? 0) + 1 : void 0, j = g ? (A ?? 1) + (S ?? 0) - 1 : void 0, M = !Fn(({ breakpoints: e }) => `(min-width: ${typeof w == "number" ? `${
|
|
2614
|
+
let k = g && _ ? Math.max(1, Math.ceil(g / _)) : 1, A = g ? (r - 1) * (_ ?? 0) + 1 : void 0, j = g ? (A ?? 1) + (S ?? 0) - 1 : void 0, M = !Fn(({ breakpoints: e }) => `(min-width: ${typeof w == "number" ? `${he(w)}rem` : e[w] || w})`), N = {
|
|
2631
2615
|
Text: (e) => p(B, {
|
|
2632
2616
|
component: "div",
|
|
2633
2617
|
className: "mantine-datatable-pagination-text",
|
|
@@ -2915,14 +2899,14 @@ function Mr({ leftShadowBehind: e, rightShadowBehind: t, onScrollPositionChange:
|
|
|
2915
2899
|
]
|
|
2916
2900
|
});
|
|
2917
2901
|
}
|
|
2918
|
-
function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, height: r = "100%", minHeight: i, maxHeight: o, shadow: d, verticalAlign: f = "center", fetching: h, columns: g, storeColumnsKey: _, groups: y, pinFirstColumn: b, pinLastColumn: x, defaultColumnProps: S, defaultColumnRender: C, idAccessor: w = "id", records: T, selectionTrigger: E = "checkbox", selectedRecords: D, onSelectedRecordsChange: O, selectionColumnClassName: k, selectionColumnStyle: A, isRecordSelectable: j, selectionCheckboxProps: M, allRecordsSelectionCheckboxProps: N = { "aria-label": "Select all records" }, getRecordSelectionCheckboxProps: P = (e, t) => ({ "aria-label": `Select record ${t + 1}` }), sortStatus: F, sortIcons: ee, onSortStatusChange: I, horizontalSpacing: L, page: R, onPageChange: te, totalRecords: z, recordsPerPage: ne, onRecordsPerPageChange: ie, recordsPerPageOptions: ae, recordsPerPageLabel: oe = "Records per page", paginationWithEdges: se, paginationWithControls: ce, paginationActiveTextColor: le, paginationActiveBackgroundColor: B, paginationSize: ue = "sm", paginationText: de = ({ from: e, to: t, totalRecords: n }) => `${e} - ${t} / ${n}`, paginationWrapBreakpoint: fe = "sm", getPaginationControlProps: pe = (e) => e === "previous" ? { "aria-label": "Previous page" } : e === "next" ? { "aria-label": "Next page" } : {}, getPaginationItemProps: me, renderPagination:
|
|
2902
|
+
function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, height: r = "100%", minHeight: i, maxHeight: o, shadow: d, verticalAlign: f = "center", fetching: h, columns: g, storeColumnsKey: _, groups: y, pinFirstColumn: b, pinLastColumn: x, defaultColumnProps: S, defaultColumnRender: C, idAccessor: w = "id", records: T, selectionTrigger: E = "checkbox", selectedRecords: D, onSelectedRecordsChange: O, selectionColumnClassName: k, selectionColumnStyle: A, isRecordSelectable: j, selectionCheckboxProps: M, allRecordsSelectionCheckboxProps: N = { "aria-label": "Select all records" }, getRecordSelectionCheckboxProps: P = (e, t) => ({ "aria-label": `Select record ${t + 1}` }), sortStatus: F, sortIcons: ee, onSortStatusChange: I, horizontalSpacing: L, page: R, onPageChange: te, totalRecords: z, recordsPerPage: ne, onRecordsPerPageChange: ie, recordsPerPageOptions: ae, recordsPerPageLabel: oe = "Records per page", paginationWithEdges: se, paginationWithControls: ce, paginationActiveTextColor: le, paginationActiveBackgroundColor: B, paginationSize: ue = "sm", paginationText: de = ({ from: e, to: t, totalRecords: n }) => `${e} - ${t} / ${n}`, paginationWrapBreakpoint: fe = "sm", getPaginationControlProps: pe = (e) => e === "previous" ? { "aria-label": "Previous page" } : e === "next" ? { "aria-label": "Next page" } : {}, getPaginationItemProps: me, renderPagination: he, loaderBackgroundBlur: ge, customLoader: _e, loaderSize: ve, loaderType: ye, loaderColor: be, loadingText: xe = "...", emptyState: Se, noRecordsText: Ce = "No records", noRecordsIcon: we, highlightOnHover: Te, striped: Ee, noHeader: De, onRowClick: Oe, onRowDoubleClick: ke, onRowContextMenu: Ae, onCellClick: je, onCellDoubleClick: V, onCellContextMenu: Me, onScroll: Pe, onScrollToTop: Fe, onScrollToBottom: Ie, onScrollToLeft: Le, onScrollToRight: Re, c: ze, backgroundColor: Be, borderColor: Ve, rowBorderColor: He, stripedColor: Ue, highlightOnHoverColor: H, rowColor: U, rowBackgroundColor: We, rowExpansion: Ge, rowClassName: Ke, rowStyle: W, customRowAttributes: qe, scrollViewportRef: Je, scrollAreaProps: Ye, tableRef: Xe, bodyRef: G, m: Ze, my: Qe, mx: $e, mt: et, mb: tt, ml: nt, mr: rt, className: it, classNames: at, style: ot, styles: st, rowFactory: ct, tableWrapper: lt, ...ut }) {
|
|
2919
2903
|
let dt = l(() => y ? Vn(y) : g, [g, y]), { refs: K, onScroll: ft } = On({
|
|
2920
2904
|
scrollCallbacks: {
|
|
2921
|
-
onScroll:
|
|
2922
|
-
onScrollToTop:
|
|
2923
|
-
onScrollToBottom:
|
|
2924
|
-
onScrollToLeft:
|
|
2925
|
-
onScrollToRight:
|
|
2905
|
+
onScroll: Pe,
|
|
2906
|
+
onScrollToTop: Fe,
|
|
2907
|
+
onScrollToBottom: Ie,
|
|
2908
|
+
onScrollToLeft: Le,
|
|
2909
|
+
onScrollToRight: Re
|
|
2926
2910
|
},
|
|
2927
2911
|
withRowBorders: ut.withRowBorders
|
|
2928
2912
|
}), q = yn({
|
|
@@ -2930,8 +2914,8 @@ function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, hei
|
|
|
2930
2914
|
columns: dt,
|
|
2931
2915
|
headerRef: K.header,
|
|
2932
2916
|
scrollViewportRef: K.scrollViewport
|
|
2933
|
-
}), pt = q.effectiveColumns, mt =
|
|
2934
|
-
rowExpansion:
|
|
2917
|
+
}), pt = q.effectiveColumns, mt = Ne(K.table, Xe), ht = Ne(K.scrollViewport, Je), gt = u(null), _t = Ne(gt, G), vt = Gn({
|
|
2918
|
+
rowExpansion: Ge,
|
|
2935
2919
|
records: T,
|
|
2936
2920
|
idAccessor: w
|
|
2937
2921
|
}), { pinnedMap: yt, hasLeftPinned: bt, hasRightPinned: xt } = kn({
|
|
@@ -2974,7 +2958,7 @@ function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, hei
|
|
|
2974
2958
|
Mt,
|
|
2975
2959
|
jt,
|
|
2976
2960
|
D
|
|
2977
|
-
]), { lastSelectionChangeIndex:
|
|
2961
|
+
]), { lastSelectionChangeIndex: Y, setLastSelectionChangeIndex: Ft } = An(Dt), It = Ot && !bt, Lt = {
|
|
2978
2962
|
m: Ze,
|
|
2979
2963
|
my: Qe,
|
|
2980
2964
|
mx: $e,
|
|
@@ -2994,12 +2978,12 @@ function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, hei
|
|
|
2994
2978
|
(e) => ({
|
|
2995
2979
|
...on({
|
|
2996
2980
|
theme: e,
|
|
2997
|
-
c:
|
|
2998
|
-
backgroundColor:
|
|
2999
|
-
borderColor:
|
|
3000
|
-
rowBorderColor:
|
|
3001
|
-
stripedColor:
|
|
3002
|
-
highlightOnHoverColor:
|
|
2981
|
+
c: ze,
|
|
2982
|
+
backgroundColor: Be,
|
|
2983
|
+
borderColor: Ve,
|
|
2984
|
+
rowBorderColor: He,
|
|
2985
|
+
stripedColor: Ue,
|
|
2986
|
+
highlightOnHoverColor: H
|
|
3003
2987
|
}),
|
|
3004
2988
|
borderRadius: e.radius[t] || t,
|
|
3005
2989
|
boxShadow: e.shadows[d] || d,
|
|
@@ -3017,7 +3001,7 @@ function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, hei
|
|
|
3017
3001
|
leftShadowBehind: Ot || bt,
|
|
3018
3002
|
rightShadowBehind: xt,
|
|
3019
3003
|
onScrollPositionChange: ft,
|
|
3020
|
-
scrollAreaProps:
|
|
3004
|
+
scrollAreaProps: Ye,
|
|
3021
3005
|
children: p(Rt, { children: m(re, {
|
|
3022
3006
|
ref: mt,
|
|
3023
3007
|
horizontalSpacing: L,
|
|
@@ -3035,11 +3019,11 @@ function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, hei
|
|
|
3035
3019
|
...q.isLocked ? { tableLayout: "fixed" } : null,
|
|
3036
3020
|
...q.tableWidth == null ? null : { width: `${q.tableWidth}px` }
|
|
3037
3021
|
},
|
|
3038
|
-
"data-striped": Et &&
|
|
3039
|
-
"data-highlight-on-hover":
|
|
3022
|
+
"data-striped": Et && Ee || void 0,
|
|
3023
|
+
"data-highlight-on-hover": Te || void 0,
|
|
3040
3024
|
...ut,
|
|
3041
3025
|
children: [
|
|
3042
|
-
|
|
3026
|
+
De ? null : p(dn, {
|
|
3043
3027
|
...q,
|
|
3044
3028
|
pinnedMap: yt,
|
|
3045
3029
|
children: p(xr, {
|
|
@@ -3063,7 +3047,7 @@ function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, hei
|
|
|
3063
3047
|
...M,
|
|
3064
3048
|
...N
|
|
3065
3049
|
},
|
|
3066
|
-
selectorCellShadowVisible:
|
|
3050
|
+
selectorCellShadowVisible: It,
|
|
3067
3051
|
selectionColumnClassName: k,
|
|
3068
3052
|
selectionColumnStyle: A,
|
|
3069
3053
|
withColumnBorders: ut.withColumnBorders
|
|
@@ -3074,11 +3058,11 @@ function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, hei
|
|
|
3074
3058
|
children: Et ? T.map((e, t) => {
|
|
3075
3059
|
let n = $(e, w), r = kt?.includes(n) || !1, i;
|
|
3076
3060
|
return O && D && (i = (i) => {
|
|
3077
|
-
if (i.nativeEvent.shiftKey &&
|
|
3078
|
-
let e = T.filter(t >
|
|
3061
|
+
if (i.nativeEvent.shiftKey && Y !== null) {
|
|
3062
|
+
let e = T.filter(t > Y ? (e, n) => n >= Y && n <= t && (j ? j(e, n) : !0) : (e, n) => n >= t && n <= Y && (j ? j(e, n) : !0));
|
|
3079
3063
|
O(r ? Ln(D, e, (e) => $(e, w)) : Rn([...D, ...e], (e) => $(e, w)));
|
|
3080
3064
|
} else O(r ? D.filter((e) => $(e, w) !== n) : Rn([...D, e], (e) => $(e, w)));
|
|
3081
|
-
|
|
3065
|
+
Ft(t);
|
|
3082
3066
|
}), p(Ar, {
|
|
3083
3067
|
record: e,
|
|
3084
3068
|
index: t,
|
|
@@ -3093,19 +3077,19 @@ function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, hei
|
|
|
3093
3077
|
isRecordSelectable: j,
|
|
3094
3078
|
selectionCheckboxProps: M,
|
|
3095
3079
|
getSelectionCheckboxProps: P,
|
|
3096
|
-
onClick:
|
|
3097
|
-
onDoubleClick:
|
|
3098
|
-
onCellClick:
|
|
3099
|
-
onCellDoubleClick:
|
|
3100
|
-
onContextMenu:
|
|
3101
|
-
onCellContextMenu:
|
|
3080
|
+
onClick: Oe,
|
|
3081
|
+
onDoubleClick: ke,
|
|
3082
|
+
onCellClick: je,
|
|
3083
|
+
onCellDoubleClick: V,
|
|
3084
|
+
onContextMenu: Ae,
|
|
3085
|
+
onCellContextMenu: Me,
|
|
3102
3086
|
expansion: vt,
|
|
3103
|
-
color:
|
|
3104
|
-
backgroundColor:
|
|
3105
|
-
className:
|
|
3106
|
-
style:
|
|
3107
|
-
customAttributes:
|
|
3108
|
-
selectorCellShadowVisible:
|
|
3087
|
+
color: U,
|
|
3088
|
+
backgroundColor: We,
|
|
3089
|
+
className: Ke,
|
|
3090
|
+
style: W,
|
|
3091
|
+
customAttributes: qe,
|
|
3092
|
+
selectorCellShadowVisible: It,
|
|
3109
3093
|
selectionColumnClassName: k,
|
|
3110
3094
|
selectionColumnStyle: A,
|
|
3111
3095
|
idAccessor: w,
|
|
@@ -3121,7 +3105,7 @@ function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, hei
|
|
|
3121
3105
|
defaultColumnProps: S,
|
|
3122
3106
|
pinnedMap: yt,
|
|
3123
3107
|
selectionVisible: Ot,
|
|
3124
|
-
selectorCellShadowVisible:
|
|
3108
|
+
selectorCellShadowVisible: It
|
|
3125
3109
|
})
|
|
3126
3110
|
]
|
|
3127
3111
|
}) })
|
|
@@ -3147,24 +3131,24 @@ function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, hei
|
|
|
3147
3131
|
paginationWrapBreakpoint: fe,
|
|
3148
3132
|
getPaginationControlProps: pe,
|
|
3149
3133
|
getPaginationItemProps: me,
|
|
3150
|
-
noRecordsText:
|
|
3151
|
-
loadingText:
|
|
3134
|
+
noRecordsText: Ce,
|
|
3135
|
+
loadingText: xe,
|
|
3152
3136
|
recordsLength: Et,
|
|
3153
|
-
renderPagination:
|
|
3137
|
+
renderPagination: he
|
|
3154
3138
|
}),
|
|
3155
3139
|
p(Sr, {
|
|
3156
3140
|
fetching: h,
|
|
3157
|
-
backgroundBlur:
|
|
3158
|
-
customContent:
|
|
3159
|
-
size:
|
|
3160
|
-
type:
|
|
3161
|
-
color:
|
|
3141
|
+
backgroundBlur: ge,
|
|
3142
|
+
customContent: _e,
|
|
3143
|
+
size: ve,
|
|
3144
|
+
type: ye,
|
|
3145
|
+
color: be
|
|
3162
3146
|
}),
|
|
3163
3147
|
p(mn, {
|
|
3164
|
-
icon:
|
|
3165
|
-
text:
|
|
3148
|
+
icon: we,
|
|
3149
|
+
text: Ce,
|
|
3166
3150
|
active: !h && !Et,
|
|
3167
|
-
children:
|
|
3151
|
+
children: Se
|
|
3168
3152
|
})
|
|
3169
3153
|
]
|
|
3170
3154
|
})
|
|
@@ -3172,9 +3156,9 @@ function Nr({ withTableBorder: e, borderRadius: t, textSelectionDisabled: n, hei
|
|
|
3172
3156
|
}
|
|
3173
3157
|
//#endregion
|
|
3174
3158
|
//#region src/DataTable/UpdateModal.tsx
|
|
3175
|
-
function Pr({ fields: e, onClose: t, queryKey: n,
|
|
3176
|
-
let { data:
|
|
3177
|
-
return
|
|
3159
|
+
function Pr({ fields: e, onClose: t, queryKey: n, connectedQueryKeys: r, apiPath: i, id: a, steps: o }) {
|
|
3160
|
+
let { data: s, isLoading: c } = Ht(i, n, a), { mutateAsync: l, isPending: u, error: d } = Kt(i, n, r);
|
|
3161
|
+
return c || !s ? /* @__PURE__ */ m(z, {
|
|
3178
3162
|
gap: "md",
|
|
3179
3163
|
children: [
|
|
3180
3164
|
/* @__PURE__ */ p(te, { height: 40 }),
|
|
@@ -3193,15 +3177,15 @@ function Pr({ fields: e, onClose: t, queryKey: n, apiPath: r, id: i, steps: a })
|
|
|
3193
3177
|
]
|
|
3194
3178
|
}) : /* @__PURE__ */ p(nn, {
|
|
3195
3179
|
fields: e,
|
|
3196
|
-
steps:
|
|
3197
|
-
record:
|
|
3198
|
-
recordId:
|
|
3199
|
-
submitting:
|
|
3200
|
-
error:
|
|
3180
|
+
steps: o,
|
|
3181
|
+
record: s,
|
|
3182
|
+
recordId: a,
|
|
3183
|
+
submitting: u,
|
|
3184
|
+
error: d,
|
|
3201
3185
|
onPersist: async (e) => {
|
|
3202
|
-
await
|
|
3186
|
+
await l({
|
|
3203
3187
|
...e,
|
|
3204
|
-
id:
|
|
3188
|
+
id: a
|
|
3205
3189
|
});
|
|
3206
3190
|
},
|
|
3207
3191
|
onClose: t
|
|
@@ -3209,35 +3193,35 @@ function Pr({ fields: e, onClose: t, queryKey: n, apiPath: r, id: i, steps: a })
|
|
|
3209
3193
|
}
|
|
3210
3194
|
//#endregion
|
|
3211
3195
|
//#region src/DataTable/DeleteModal.tsx
|
|
3212
|
-
function Fr({ queryKey: e,
|
|
3213
|
-
let { mutateAsync:
|
|
3196
|
+
function Fr({ queryKey: e, connectedQueryKeys: t, apiPath: n, onClose: r, selectedRecords: i, confirmMessage: a }) {
|
|
3197
|
+
let { mutateAsync: o, isError: c, error: l, isPending: u } = qt(n, e, t), [h, g] = d(i), [v, b] = d(!1), x = v || u;
|
|
3214
3198
|
return s(() => {
|
|
3215
|
-
|
|
3216
|
-
}, [
|
|
3217
|
-
|
|
3199
|
+
h.length || r();
|
|
3200
|
+
}, [r, h]), h.length ? /* @__PURE__ */ m(f, { children: [
|
|
3201
|
+
c && l.message && /* @__PURE__ */ p(_, {
|
|
3218
3202
|
variant: "outline",
|
|
3219
3203
|
color: "red",
|
|
3220
|
-
title:
|
|
3221
|
-
children:
|
|
3204
|
+
title: l.name,
|
|
3205
|
+
children: l.message
|
|
3222
3206
|
}),
|
|
3223
|
-
/* @__PURE__ */ p(B, { children:
|
|
3207
|
+
/* @__PURE__ */ p(B, { children: a ? a(h) : h.length === 1 ? `Soll ${h.length} Eintrag wirklich gelöscht werden?` : `Sollen ${h.length} Einträge wirklich gelöscht werden?` }),
|
|
3224
3208
|
/* @__PURE__ */ m(T, {
|
|
3225
3209
|
mt: "md",
|
|
3226
3210
|
justify: "end",
|
|
3227
3211
|
children: [/* @__PURE__ */ p(y, {
|
|
3228
|
-
onClick:
|
|
3212
|
+
onClick: r,
|
|
3229
3213
|
variant: "outline",
|
|
3230
|
-
disabled:
|
|
3214
|
+
disabled: x,
|
|
3231
3215
|
children: "Abbrechen"
|
|
3232
3216
|
}), /* @__PURE__ */ p(y, {
|
|
3233
3217
|
color: "red",
|
|
3234
|
-
loading:
|
|
3218
|
+
loading: x,
|
|
3235
3219
|
onClick: async () => {
|
|
3236
|
-
|
|
3220
|
+
b(!0);
|
|
3237
3221
|
try {
|
|
3238
|
-
await Promise.all(
|
|
3222
|
+
await Promise.all(h.map((e) => o(e.id))), g([]);
|
|
3239
3223
|
} finally {
|
|
3240
|
-
|
|
3224
|
+
b(!1);
|
|
3241
3225
|
}
|
|
3242
3226
|
},
|
|
3243
3227
|
children: "Löschen"
|
|
@@ -3455,7 +3439,7 @@ function Zr({ records: e, fields: n, onRowClick: r, actions: i, canUpdate: a, ca
|
|
|
3455
3439
|
variant: "filled",
|
|
3456
3440
|
size: "input-sm",
|
|
3457
3441
|
onClick: () => c.onSortChange(c.field, c.direction === "asc" ? "desc" : "asc"),
|
|
3458
|
-
children: c.direction === "asc" ? /* @__PURE__ */ p(
|
|
3442
|
+
children: c.direction === "asc" ? /* @__PURE__ */ p(De, { size: 18 }) : /* @__PURE__ */ p(Oe, { size: 18 })
|
|
3459
3443
|
})] }), D.length > 0 && /* @__PURE__ */ m(F, {
|
|
3460
3444
|
opened: M,
|
|
3461
3445
|
onChange: N,
|
|
@@ -3473,7 +3457,7 @@ function Zr({ records: e, fields: n, onRowClick: r, actions: i, canUpdate: a, ca
|
|
|
3473
3457
|
size: "input-sm",
|
|
3474
3458
|
onClick: () => N((e) => !e),
|
|
3475
3459
|
"aria-label": "Filter",
|
|
3476
|
-
children: /* @__PURE__ */ p(
|
|
3460
|
+
children: /* @__PURE__ */ p(Ce, { size: 18 })
|
|
3477
3461
|
})
|
|
3478
3462
|
}) }), /* @__PURE__ */ p(F.Dropdown, {
|
|
3479
3463
|
p: 0,
|
|
@@ -3539,7 +3523,7 @@ function Zr({ records: e, fields: n, onRowClick: r, actions: i, canUpdate: a, ca
|
|
|
3539
3523
|
color: "gray",
|
|
3540
3524
|
size: "sm",
|
|
3541
3525
|
onClick: (e) => e.stopPropagation(),
|
|
3542
|
-
children: /* @__PURE__ */ p(
|
|
3526
|
+
children: /* @__PURE__ */ p(Se, { size: 16 })
|
|
3543
3527
|
}) }), /* @__PURE__ */ p(O.Dropdown, { children: t.map((t, n) => /* @__PURE__ */ p(O.Item, {
|
|
3544
3528
|
leftSection: t.icon,
|
|
3545
3529
|
onClick: (n) => {
|
|
@@ -3612,23 +3596,15 @@ function $r({ title: e, queryKey: t, connectedQueryKeys: n, apiPath: r, mutation
|
|
|
3612
3596
|
}, B = k?.find((e) => e.value === se), ue = B?.queryParams || {}, de = B?.apiPath ?? r, pe = B?.mutationApiPath ?? a ?? de, me = {
|
|
3613
3597
|
...D,
|
|
3614
3598
|
...ue
|
|
3615
|
-
},
|
|
3616
|
-
s(() => {
|
|
3617
|
-
!ge || !Array.isArray(ge) || n?.forEach((e) => Ee.invalidateQueries({ queryKey: e }));
|
|
3618
|
-
}, [
|
|
3619
|
-
ge,
|
|
3620
|
-
n,
|
|
3621
|
-
Ee
|
|
3622
|
-
]);
|
|
3623
|
-
let De = Kr(Array.isArray(ge) ? ge : [], h), [ke, Ae] = d({
|
|
3599
|
+
}, he = me ? "?" + Object.entries(me).filter(([, e]) => e != null).map(([e, t]) => `${e}=${encodeURIComponent(t ?? "")}`).join("&") : "", ge = se ? [...t, se] : t, { data: _e, isLoading: ve, isError: ye, isRefetching: Se, refetch: Ce } = Ut(de + he, ge), De = Kr(Array.isArray(_e) ? _e : [], h), [Oe, Ae] = d({
|
|
3624
3600
|
columnAccessor: S?.field ?? c[0].id,
|
|
3625
3601
|
direction: S?.direction ?? "desc"
|
|
3626
3602
|
}), je = (e) => {
|
|
3627
3603
|
Ae(e), C && C(String(e.columnAccessor), e.direction);
|
|
3628
|
-
},
|
|
3629
|
-
|
|
3630
|
-
},
|
|
3631
|
-
if (t !==
|
|
3604
|
+
}, V = Br(De, Oe.columnAccessor, Oe.direction), [Me, Ne] = Ir(Qr[1], "mantine-table-page-size"), [Pe, Fe] = d(1), Ie = u ? V.slice((Pe - 1) * Me, Pe * Me) : V, [Le, Re] = d([]), ze = I?.expanded?.recordIds ?? Le, Be = I?.expanded?.onRecordIdsChange ?? Re, Ve = (e) => {
|
|
3605
|
+
ze.includes(e) ? Be(ze.filter((t) => t !== e)) : Be(I?.allowMultiple ? [...ze, e] : [e]);
|
|
3606
|
+
}, He = c.findIndex((e) => e.list && e.column && !e.column.hidden), Ue = I && He >= 0 ? c.map((e, t) => {
|
|
3607
|
+
if (t !== He) return e;
|
|
3632
3608
|
let n = e.column.render;
|
|
3633
3609
|
return {
|
|
3634
3610
|
...e,
|
|
@@ -3642,18 +3618,18 @@ function $r({ title: e, queryKey: t, connectedQueryKeys: n, apiPath: r, mutation
|
|
|
3642
3618
|
component: "span",
|
|
3643
3619
|
"aria-label": "Aufklappen",
|
|
3644
3620
|
onClick: (e) => {
|
|
3645
|
-
e.stopPropagation(),
|
|
3621
|
+
e.stopPropagation(), Ve(t.id);
|
|
3646
3622
|
},
|
|
3647
3623
|
style: {
|
|
3648
3624
|
display: "inline-flex",
|
|
3649
3625
|
flexShrink: 0,
|
|
3650
3626
|
cursor: "pointer"
|
|
3651
3627
|
},
|
|
3652
|
-
children: /* @__PURE__ */ p(
|
|
3628
|
+
children: /* @__PURE__ */ p(xe, {
|
|
3653
3629
|
size: 16,
|
|
3654
3630
|
style: {
|
|
3655
3631
|
color: "var(--mantine-primary-color-filled)",
|
|
3656
|
-
transform:
|
|
3632
|
+
transform: ze.includes(t.id) ? "rotate(90deg)" : void 0,
|
|
3657
3633
|
transition: "transform 200ms ease"
|
|
3658
3634
|
}
|
|
3659
3635
|
})
|
|
@@ -3664,29 +3640,29 @@ function $r({ title: e, queryKey: t, connectedQueryKeys: n, apiPath: r, mutation
|
|
|
3664
3640
|
})
|
|
3665
3641
|
}
|
|
3666
3642
|
};
|
|
3667
|
-
}) : c, [
|
|
3643
|
+
}) : c, [H, U] = d([]);
|
|
3668
3644
|
s(() => {
|
|
3669
|
-
|
|
3645
|
+
U([]);
|
|
3670
3646
|
}, [se]);
|
|
3671
|
-
let [
|
|
3647
|
+
let [We, Ge] = d(!1), [Ke, W] = d(!1), [qe, Je] = d(!1);
|
|
3672
3648
|
s(() => {
|
|
3673
|
-
if (re &&
|
|
3674
|
-
let e =
|
|
3675
|
-
e && (
|
|
3649
|
+
if (re && V.length > 0) {
|
|
3650
|
+
let e = V.find((e) => e.id === re);
|
|
3651
|
+
e && (U([e]), W(!0), ie?.(null));
|
|
3676
3652
|
}
|
|
3677
|
-
}, [re,
|
|
3678
|
-
let Ye = c.some((e) => e.update), Xe = c.some((e) => e.delete),
|
|
3679
|
-
return Ye &&
|
|
3680
|
-
icon: /* @__PURE__ */ p(
|
|
3653
|
+
}, [re, V]);
|
|
3654
|
+
let Ye = c.some((e) => e.update), Xe = c.some((e) => e.delete), G = [];
|
|
3655
|
+
return Ye && G.push({
|
|
3656
|
+
icon: /* @__PURE__ */ p(Te, { size: 14 }),
|
|
3681
3657
|
label: "Bearbeiten",
|
|
3682
3658
|
onClick: (e) => {
|
|
3683
|
-
|
|
3659
|
+
U(e), W(!0);
|
|
3684
3660
|
}
|
|
3685
|
-
}), b &&
|
|
3686
|
-
icon: /* @__PURE__ */ p(
|
|
3661
|
+
}), b && G.push(...b), Xe && G.push({
|
|
3662
|
+
icon: /* @__PURE__ */ p(ke, { size: 14 }),
|
|
3687
3663
|
label: "Löschen",
|
|
3688
3664
|
onClick: (e) => {
|
|
3689
|
-
|
|
3665
|
+
U(e), Je(!0);
|
|
3690
3666
|
}
|
|
3691
3667
|
}), /* @__PURE__ */ m(f, { children: [
|
|
3692
3668
|
/* @__PURE__ */ m(w, {
|
|
@@ -3726,36 +3702,36 @@ function $r({ title: e, queryKey: t, connectedQueryKeys: n, apiPath: r, mutation
|
|
|
3726
3702
|
children: [
|
|
3727
3703
|
ee && /* @__PURE__ */ p(g, {
|
|
3728
3704
|
variant: "subtle",
|
|
3729
|
-
onClick: () =>
|
|
3705
|
+
onClick: () => Ce(),
|
|
3730
3706
|
"aria-label": "Neuladen",
|
|
3731
|
-
children: /* @__PURE__ */ p(
|
|
3707
|
+
children: /* @__PURE__ */ p(Ee, {})
|
|
3732
3708
|
}),
|
|
3733
3709
|
(c.some((e) => e.update) || l) && (() => {
|
|
3734
|
-
let e = c.find((e) => e.update) && (!P ||
|
|
3710
|
+
let e = c.find((e) => e.update) && (!P || H.length > 0 && P(H[0])), t = c.find((e) => e.delete) && (!F || H.length > 0 && F(H[0])), n = (b ?? []).length > 0, r = e || t || n;
|
|
3735
3711
|
return /* @__PURE__ */ p(v, {
|
|
3736
3712
|
...R ? { visibleFrom: "sm" } : {},
|
|
3737
3713
|
children: /* @__PURE__ */ m(O, {
|
|
3738
3714
|
shadow: "md",
|
|
3739
3715
|
children: [/* @__PURE__ */ p(O.Target, { children: /* @__PURE__ */ p(y, {
|
|
3740
3716
|
variant: "outline",
|
|
3741
|
-
rightSection: /* @__PURE__ */ p(
|
|
3742
|
-
disabled: !
|
|
3717
|
+
rightSection: /* @__PURE__ */ p(be, { size: 14 }),
|
|
3718
|
+
disabled: !H.length || !r,
|
|
3743
3719
|
children: "Aktionen"
|
|
3744
3720
|
}) }), /* @__PURE__ */ m(O.Dropdown, { children: [
|
|
3745
3721
|
e && /* @__PURE__ */ p(O.Item, {
|
|
3746
|
-
leftSection: /* @__PURE__ */ p(
|
|
3747
|
-
onClick: () =>
|
|
3748
|
-
disabled:
|
|
3722
|
+
leftSection: /* @__PURE__ */ p(Te, { size: 14 }),
|
|
3723
|
+
onClick: () => W(!0),
|
|
3724
|
+
disabled: H.length !== 1,
|
|
3749
3725
|
children: "Bearbeiten"
|
|
3750
3726
|
}),
|
|
3751
3727
|
(b ?? []).map((e, t) => /* @__PURE__ */ i(O.Item, {
|
|
3752
3728
|
...e.icon && { leftSection: e.icon },
|
|
3753
3729
|
key: `custom_action_${t}`,
|
|
3754
|
-
onClick: () => e.onClick(
|
|
3755
|
-
disabled: e.disabled?.(
|
|
3730
|
+
onClick: () => e.onClick(H),
|
|
3731
|
+
disabled: e.disabled?.(H) ?? !1
|
|
3756
3732
|
}, e.label)),
|
|
3757
3733
|
t && /* @__PURE__ */ p(O.Item, {
|
|
3758
|
-
leftSection: /* @__PURE__ */ p(
|
|
3734
|
+
leftSection: /* @__PURE__ */ p(ke, { size: 14 }),
|
|
3759
3735
|
onClick: () => Je(!0),
|
|
3760
3736
|
color: "red",
|
|
3761
3737
|
children: "Löschen"
|
|
@@ -3765,8 +3741,8 @@ function $r({ title: e, queryKey: t, connectedQueryKeys: n, apiPath: r, mutation
|
|
|
3765
3741
|
});
|
|
3766
3742
|
})(),
|
|
3767
3743
|
c.find((e) => e.create) && /* @__PURE__ */ p(y, {
|
|
3768
|
-
onClick: () =>
|
|
3769
|
-
disabled:
|
|
3744
|
+
onClick: () => Ge(!0),
|
|
3745
|
+
disabled: ve,
|
|
3770
3746
|
children: E ?? "Erstellen"
|
|
3771
3747
|
}),
|
|
3772
3748
|
o
|
|
@@ -3783,15 +3759,15 @@ function $r({ title: e, queryKey: t, connectedQueryKeys: n, apiPath: r, mutation
|
|
|
3783
3759
|
children: e.label
|
|
3784
3760
|
}, e.value)) })
|
|
3785
3761
|
}),
|
|
3786
|
-
|
|
3762
|
+
ye && /* @__PURE__ */ p(_, {
|
|
3787
3763
|
mt: "md",
|
|
3788
3764
|
variant: "light",
|
|
3789
3765
|
color: "red",
|
|
3790
3766
|
title: "Es ist ein Fehler aufgetreten.",
|
|
3791
|
-
icon: /* @__PURE__ */ p(
|
|
3767
|
+
icon: /* @__PURE__ */ p(we, {}),
|
|
3792
3768
|
children: "Bitte versuche es später erneut oder sende eine Nachricht an unseren Support."
|
|
3793
3769
|
}),
|
|
3794
|
-
(
|
|
3770
|
+
(ve || Se) && /* @__PURE__ */ m(z, {
|
|
3795
3771
|
my: "md",
|
|
3796
3772
|
children: [/* @__PURE__ */ p(te, { height: 40 }), [
|
|
3797
3773
|
,
|
|
@@ -3801,26 +3777,26 @@ function $r({ title: e, queryKey: t, connectedQueryKeys: n, apiPath: r, mutation
|
|
|
3801
3777
|
,
|
|
3802
3778
|
].fill(0).map((e, t) => /* @__PURE__ */ p(te, { height: 35 }, `skeleton-${t}`))]
|
|
3803
3779
|
}),
|
|
3804
|
-
!
|
|
3780
|
+
!ve && !Se && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(v, {
|
|
3805
3781
|
...R ? { visibleFrom: "sm" } : {},
|
|
3806
3782
|
children: /* @__PURE__ */ p(Nr, {
|
|
3807
3783
|
my: "md",
|
|
3808
3784
|
striped: !0,
|
|
3809
3785
|
highlightOnHover: !0,
|
|
3810
3786
|
minHeight: 150,
|
|
3811
|
-
fetching:
|
|
3812
|
-
records:
|
|
3813
|
-
sortStatus:
|
|
3787
|
+
fetching: ye,
|
|
3788
|
+
records: Ie,
|
|
3789
|
+
sortStatus: Oe,
|
|
3814
3790
|
onSortStatusChange: je,
|
|
3815
3791
|
...l && {
|
|
3816
|
-
selectedRecords:
|
|
3817
|
-
onSelectedRecordsChange:
|
|
3792
|
+
selectedRecords: H,
|
|
3793
|
+
onSelectedRecordsChange: U
|
|
3818
3794
|
},
|
|
3819
|
-
...u &&
|
|
3820
|
-
totalRecords:
|
|
3795
|
+
...u && Ie.length && {
|
|
3796
|
+
totalRecords: V.length,
|
|
3821
3797
|
recordsPerPage: Me,
|
|
3822
|
-
onPageChange:
|
|
3823
|
-
page:
|
|
3798
|
+
onPageChange: Fe,
|
|
3799
|
+
page: Pe,
|
|
3824
3800
|
recordsPerPageOptions: Qr,
|
|
3825
3801
|
onRecordsPerPageChange: Ne,
|
|
3826
3802
|
recordsPerPageLabel: "Einträge pro Seite"
|
|
@@ -3830,12 +3806,12 @@ function $r({ title: e, queryKey: t, connectedQueryKeys: n, apiPath: r, mutation
|
|
|
3830
3806
|
trigger: L ? "never" : "click",
|
|
3831
3807
|
content: ({ record: e }) => I.content(e, !1),
|
|
3832
3808
|
expanded: {
|
|
3833
|
-
recordIds:
|
|
3834
|
-
onRecordIdsChange:
|
|
3809
|
+
recordIds: ze,
|
|
3810
|
+
onRecordIdsChange: Be
|
|
3835
3811
|
},
|
|
3836
3812
|
...I.expandable && { expandable: ({ record: e }) => I.expandable(e) }
|
|
3837
3813
|
} },
|
|
3838
|
-
columns:
|
|
3814
|
+
columns: Ue.map((e) => e.column),
|
|
3839
3815
|
noRecordsText: "Keine Einträge gefunden",
|
|
3840
3816
|
onRowClick: L,
|
|
3841
3817
|
...L && { style: { cursor: "pointer" } }
|
|
@@ -3843,12 +3819,12 @@ function $r({ title: e, queryKey: t, connectedQueryKeys: n, apiPath: r, mutation
|
|
|
3843
3819
|
}), R && /* @__PURE__ */ p(v, {
|
|
3844
3820
|
hiddenFrom: "sm",
|
|
3845
3821
|
children: /* @__PURE__ */ p(Zr, {
|
|
3846
|
-
records:
|
|
3847
|
-
fields:
|
|
3822
|
+
records: Ie,
|
|
3823
|
+
fields: Ue,
|
|
3848
3824
|
onRowClick: L,
|
|
3849
3825
|
sort: {
|
|
3850
|
-
field: String(
|
|
3851
|
-
direction:
|
|
3826
|
+
field: String(Oe.columnAccessor),
|
|
3827
|
+
direction: Oe.direction,
|
|
3852
3828
|
onSortChange: (e, t) => {
|
|
3853
3829
|
je({
|
|
3854
3830
|
columnAccessor: e,
|
|
@@ -3856,75 +3832,78 @@ function $r({ title: e, queryKey: t, connectedQueryKeys: n, apiPath: r, mutation
|
|
|
3856
3832
|
});
|
|
3857
3833
|
}
|
|
3858
3834
|
},
|
|
3859
|
-
...u &&
|
|
3860
|
-
totalRecords:
|
|
3835
|
+
...u && Ie.length && { pagination: {
|
|
3836
|
+
totalRecords: V.length,
|
|
3861
3837
|
recordsPerPage: Me,
|
|
3862
|
-
page:
|
|
3863
|
-
onPageChange:
|
|
3838
|
+
page: Pe,
|
|
3839
|
+
onPageChange: Fe,
|
|
3864
3840
|
recordsPerPageOptions: Qr,
|
|
3865
3841
|
onRecordsPerPageChange: (e) => {
|
|
3866
|
-
Ne(e),
|
|
3842
|
+
Ne(e), Fe(1);
|
|
3867
3843
|
}
|
|
3868
3844
|
} },
|
|
3869
3845
|
...I && { rowExpansion: {
|
|
3870
3846
|
content: I.content,
|
|
3871
3847
|
expanded: {
|
|
3872
|
-
recordIds:
|
|
3873
|
-
onRecordIdsChange:
|
|
3848
|
+
recordIds: ze,
|
|
3849
|
+
onRecordIdsChange: Be
|
|
3874
3850
|
},
|
|
3875
3851
|
...I.expandable && { expandable: I.expandable }
|
|
3876
3852
|
} },
|
|
3877
|
-
...
|
|
3878
|
-
actions:
|
|
3853
|
+
...G.length > 0 && {
|
|
3854
|
+
actions: G,
|
|
3879
3855
|
canUpdate: P,
|
|
3880
3856
|
canDelete: F
|
|
3881
3857
|
}
|
|
3882
3858
|
})
|
|
3883
3859
|
})] }),
|
|
3884
3860
|
/* @__PURE__ */ p(M, {
|
|
3885
|
-
opened:
|
|
3861
|
+
opened: Ke,
|
|
3886
3862
|
onClose: () => {
|
|
3887
|
-
|
|
3863
|
+
W(!1), U([]);
|
|
3888
3864
|
},
|
|
3889
3865
|
title: e ?? "Bearbeiten",
|
|
3890
|
-
children:
|
|
3866
|
+
children: H.length > 0 && /* @__PURE__ */ p(Pr, {
|
|
3891
3867
|
fields: c.filter((e) => e.update),
|
|
3892
3868
|
queryKey: t,
|
|
3869
|
+
connectedQueryKeys: n,
|
|
3893
3870
|
apiPath: pe,
|
|
3894
|
-
id:
|
|
3871
|
+
id: H[0].id,
|
|
3895
3872
|
onClose: () => {
|
|
3896
|
-
|
|
3873
|
+
W(!1), U([]);
|
|
3897
3874
|
},
|
|
3898
3875
|
steps: x
|
|
3899
3876
|
})
|
|
3900
3877
|
}),
|
|
3901
|
-
|
|
3878
|
+
H.length > 0 && /* @__PURE__ */ p(M, {
|
|
3902
3879
|
opened: qe,
|
|
3903
3880
|
onClose: () => {
|
|
3904
|
-
Je(!1),
|
|
3881
|
+
Je(!1), U([]);
|
|
3905
3882
|
},
|
|
3906
3883
|
title: e ?? "Löschen",
|
|
3907
3884
|
children: /* @__PURE__ */ p(Fr, {
|
|
3908
3885
|
onClose: () => {
|
|
3909
|
-
Je(!1),
|
|
3886
|
+
Je(!1), U([]);
|
|
3910
3887
|
},
|
|
3911
3888
|
queryKey: t,
|
|
3889
|
+
connectedQueryKeys: n,
|
|
3912
3890
|
apiPath: pe,
|
|
3913
|
-
selectedRecords:
|
|
3891
|
+
selectedRecords: H,
|
|
3914
3892
|
confirmMessage: ne
|
|
3915
3893
|
})
|
|
3916
3894
|
}),
|
|
3917
3895
|
/* @__PURE__ */ p(M, {
|
|
3918
|
-
opened:
|
|
3896
|
+
opened: We,
|
|
3919
3897
|
onClose: () => {
|
|
3920
|
-
|
|
3898
|
+
Ge(!1);
|
|
3921
3899
|
},
|
|
3922
3900
|
title: e ?? "Anlegen",
|
|
3923
3901
|
children: /* @__PURE__ */ p(rn, {
|
|
3924
3902
|
queryKey: t,
|
|
3903
|
+
connectedQueryKeys: n,
|
|
3925
3904
|
apiPath: pe,
|
|
3926
3905
|
onClose: () => {
|
|
3927
|
-
|
|
3906
|
+
Ge(!1);
|
|
3928
3907
|
},
|
|
3929
3908
|
fields: c.filter((e) => e.create),
|
|
3930
3909
|
steps: x
|
|
@@ -3951,6 +3930,6 @@ function ei({ mobile: e, columns: t, ...n }) {
|
|
|
3951
3930
|
});
|
|
3952
3931
|
}
|
|
3953
3932
|
//#endregion
|
|
3954
|
-
export { rn as CreateModal, $r as DataTable, Mt as DataTableProvider, Fr as DeleteModal, Jr as FieldCard, Zr as MobileCardList, ei as SubTable, Pr as UpdateModal,
|
|
3933
|
+
export { rn as CreateModal, $r as DataTable, Mt as DataTableProvider, Fr as DeleteModal, Jr as FieldCard, Zr as MobileCardList, ei as SubTable, Pr as UpdateModal, Bt as api, zt as createOne, Rt as deleteOne, It as getAll, Lt as getOne, Br as sortData, Vt as updateOne, Gt as useAddOne, J as useDataTable, qt as useDeleteOne, Ut as useGetAll, Ht as useGetOne, Ir as usePersistentState, Kt as useUpdateOne };
|
|
3955
3934
|
|
|
3956
3935
|
//# sourceMappingURL=index.es.js.map
|