@dakataa/crud-react 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +567 -96
- package/dist/crud-react.js +903 -828
- package/dist/main.d.ts +70 -68
- package/package.json +1 -1
package/dist/crud-react.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as r, jsxs as C, Fragment as A } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
import v, { useState as R, memo as
|
|
2
|
+
import G, { convertObjectToURLSearchParams as Sn, convertURLSearchParamsToObject as ht, convertFormDataToObject as $e, Method as qe, InterceptEvent as we, RequestBodyType as pt } from "@dakataa/requester";
|
|
3
|
+
import * as ce from "react";
|
|
4
|
+
import v, { useState as R, memo as ue, useEffect as N, useRef as O, useImperativeHandle as fe, useReducer as z, useId as _e, useCallback as kn, Fragment as ke, forwardRef as He, createElement as tt, Children as Dn, createRef as Rn } from "react";
|
|
5
5
|
import { createPortal as Tn } from "react-dom";
|
|
6
6
|
import In from "lottie-web/build/player/esm/lottie.min.js";
|
|
7
|
-
import * as
|
|
7
|
+
import * as nt from "@popperjs/core";
|
|
8
8
|
class gt {
|
|
9
9
|
code;
|
|
10
10
|
detail;
|
|
@@ -13,21 +13,21 @@ class gt {
|
|
|
13
13
|
this.code = t, this.detail = n, this.trace = o;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
class
|
|
16
|
+
class Ke extends gt {
|
|
17
17
|
status = 400;
|
|
18
18
|
constructor(t, n, o) {
|
|
19
19
|
super(0, n, o), this.status = t;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
const bt =
|
|
22
|
+
const bt = ce.createContext(void 0);
|
|
23
23
|
function yt() {
|
|
24
|
-
return
|
|
24
|
+
return ce.useContext(bt);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function Fn({ ...e }) {
|
|
27
27
|
const [t, n] = R(!1);
|
|
28
28
|
return /* @__PURE__ */ r(bt.Provider, { value: { defaultPrevented: t, setPreventDefault: n }, children: e.children });
|
|
29
29
|
}
|
|
30
|
-
class
|
|
30
|
+
class jn extends ce.Component {
|
|
31
31
|
constructor(t) {
|
|
32
32
|
super(t), this.state = {
|
|
33
33
|
hasError: !1,
|
|
@@ -48,7 +48,7 @@ class Fn extends ae.Component {
|
|
|
48
48
|
window.removeEventListener("unhandledrejection", this.promiseRejectionHandler);
|
|
49
49
|
}
|
|
50
50
|
static getDerivedStateFromError(t) {
|
|
51
|
-
return t instanceof Error && (t = new
|
|
51
|
+
return t instanceof Error && (t = new Ke(0, t.message)), {
|
|
52
52
|
hasError: !0,
|
|
53
53
|
error: t
|
|
54
54
|
};
|
|
@@ -60,7 +60,7 @@ class Fn extends ae.Component {
|
|
|
60
60
|
this.state.error?.detail !== n.error?.detail && this.state.hasError && !this.props.defaultPrevented && this.props.fallback instanceof Function && this.props.fallback(this.state.error);
|
|
61
61
|
}
|
|
62
62
|
render() {
|
|
63
|
-
return this.state.hasError && !this.props.defaultPrevented && this.props.fallback &&
|
|
63
|
+
return this.state.hasError && !this.props.defaultPrevented && this.props.fallback && ce.isValidElement(this.props.fallback) ? ce.cloneElement(
|
|
64
64
|
this.props.fallback,
|
|
65
65
|
{
|
|
66
66
|
error: this.state.error,
|
|
@@ -71,11 +71,11 @@ class Fn extends ae.Component {
|
|
|
71
71
|
}
|
|
72
72
|
const Mn = ({ children: e, ...t }) => {
|
|
73
73
|
const n = yt();
|
|
74
|
-
return /* @__PURE__ */ r(
|
|
74
|
+
return /* @__PURE__ */ r(jn, { ...t, defaultPrevented: n?.defaultPrevented || !1, children: e });
|
|
75
75
|
}, vt = ({ children: e, ...t }) => {
|
|
76
76
|
const n = yt();
|
|
77
|
-
return /* @__PURE__ */ r(
|
|
78
|
-
}, Et =
|
|
77
|
+
return /* @__PURE__ */ r(Fn, { children: /* @__PURE__ */ r(Mn, { ...t, parentErrorBoundaryContext: n, children: e }) });
|
|
78
|
+
}, Et = ue(({ children: e }) => /* @__PURE__ */ r("div", { className: "crud", children: e })), Un = ue(({ error: e }) => /* @__PURE__ */ r(Et, { children: /* @__PURE__ */ r("main", { children: /* @__PURE__ */ C("div", { className: "content d-flex flex-column", children: [
|
|
79
79
|
/* @__PURE__ */ r("h1", { className: "display-1", children: e?.status || e.name || "Error" }),
|
|
80
80
|
/* @__PURE__ */ r("p", { className: "text-secondary", children: e?.detail || "Unknown Error" }),
|
|
81
81
|
/* @__PURE__ */ r("br", {}),
|
|
@@ -86,11 +86,11 @@ const _t = v.createContext({
|
|
|
86
86
|
env: "prod"
|
|
87
87
|
/* PROD */
|
|
88
88
|
});
|
|
89
|
-
function
|
|
89
|
+
function te() {
|
|
90
90
|
return v.useContext(_t);
|
|
91
91
|
}
|
|
92
92
|
function Vn({ config: e, ...t }) {
|
|
93
|
-
const n =
|
|
93
|
+
const n = te();
|
|
94
94
|
return /* @__PURE__ */ r(_t.Provider, { value: {
|
|
95
95
|
...n || {},
|
|
96
96
|
...e
|
|
@@ -106,52 +106,52 @@ window.history.replaceState = new Proxy(window.history.replaceState, {
|
|
|
106
106
|
e.apply(t, n), window.dispatchEvent(new Event("replacestate"));
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
-
const
|
|
110
|
-
function
|
|
109
|
+
const rt = "actions", xt = v.createContext(void 0);
|
|
110
|
+
function M() {
|
|
111
111
|
const e = v.useContext(xt);
|
|
112
112
|
if (!e)
|
|
113
113
|
throw new Error("UseActions must be used in ActionProvider");
|
|
114
|
-
const t =
|
|
114
|
+
const t = te(), { actions: n, location: o } = e, s = (d, g, h) => n?.filter((x) => x.entity === d && x.name === g && (h === void 0 || x.namespace === h)).shift(), i = (d) => {
|
|
115
115
|
if (n)
|
|
116
|
-
return n.find((g) => g.route?.path &&
|
|
116
|
+
return n.find((g) => g.route?.path && y(g.route.path, d)) ?? null;
|
|
117
117
|
}, a = (d) => {
|
|
118
118
|
const g = i(d);
|
|
119
119
|
if (!g)
|
|
120
120
|
return g;
|
|
121
|
-
const h =
|
|
121
|
+
const h = y(g.route?.path || "", d);
|
|
122
122
|
return {
|
|
123
123
|
action: g,
|
|
124
124
|
parameters: h?.params,
|
|
125
125
|
query: h?.query
|
|
126
126
|
};
|
|
127
|
-
}, c = (d) => d.replaceAll(new RegExp("{(.*?)}", "gi"), ":$1"),
|
|
127
|
+
}, c = (d) => d.replaceAll(new RegExp("{(.*?)}", "gi"), ":$1"), f = (d, g, h) => l(c(d), g, h), u = (d, g, h) => d ? f(d.path, { ...d.defaults || {}, ...g }, h) : "#", p = (d) => {
|
|
128
128
|
const g = s(d.action.entity, d.action.name, d.action.namespace);
|
|
129
|
-
return
|
|
130
|
-
},
|
|
129
|
+
return u(g?.route, d.parameters, d.query);
|
|
130
|
+
}, m = (d, g, h) => u(d, g, h), b = (d) => (t.link?.prefix && (d = "/" + t.link.prefix.replaceAll(new RegExp("^/|/$", "g"), "") + d), d), E = (d) => (t.link?.prefix && (d = d.replace(new RegExp("^/" + t.link.prefix.replace(new RegExp("^/"), "") + "(/)?"), "/")), d), _ = (d, g) => {
|
|
131
131
|
try {
|
|
132
132
|
g ? history.replaceState(null, "", d) : history.pushState(null, "", d);
|
|
133
133
|
} catch {
|
|
134
134
|
window.location.assign(d);
|
|
135
135
|
}
|
|
136
|
-
},
|
|
136
|
+
}, y = (d, g) => {
|
|
137
137
|
const h = new URL(g, o.origin), x = E(h.pathname), P = "^" + d.replace(new RegExp("/[{:](\\w+)}?", "g"), "[/]?(?<$1>[^/]+)?").replace("*", ".*") + "$";
|
|
138
138
|
if (!new RegExp(P, "giu").test(x))
|
|
139
139
|
return null;
|
|
140
|
-
const
|
|
140
|
+
const L = x.matchAll(new RegExp(P, "giu"))?.next().value?.groups, I = ht(h.searchParams);
|
|
141
141
|
return {
|
|
142
142
|
pathname: x,
|
|
143
|
-
params:
|
|
144
|
-
query:
|
|
143
|
+
params: L,
|
|
144
|
+
query: I,
|
|
145
145
|
pattern: d
|
|
146
146
|
};
|
|
147
147
|
}, l = (d, g, h) => {
|
|
148
|
-
const x = d.replaceAll(new RegExp("[{:](\\w+)}?", "g"), (
|
|
149
|
-
const
|
|
150
|
-
return
|
|
148
|
+
const x = d.replaceAll(new RegExp("[{:](\\w+)}?", "g"), (S, L) => {
|
|
149
|
+
const I = g?.[L];
|
|
150
|
+
return I !== void 0 && delete g?.[L], I ?? "";
|
|
151
151
|
}).replace(new RegExp("/$", "g"), ""), P = new URL(x, o.origin);
|
|
152
|
-
return Sn(h || {}).entries().forEach(([
|
|
153
|
-
P.searchParams.set(
|
|
154
|
-
}),
|
|
152
|
+
return Sn(h || {}).entries().forEach(([S, L]) => {
|
|
153
|
+
P.searchParams.set(S, L);
|
|
154
|
+
}), b(P.pathname + P.search);
|
|
155
155
|
};
|
|
156
156
|
return {
|
|
157
157
|
getAction: s,
|
|
@@ -160,21 +160,21 @@ function j() {
|
|
|
160
160
|
navigate: _,
|
|
161
161
|
actions: n,
|
|
162
162
|
location: o,
|
|
163
|
-
matchPath:
|
|
164
|
-
generateRoute:
|
|
165
|
-
generateRoutePath:
|
|
163
|
+
matchPath: y,
|
|
164
|
+
generateRoute: u,
|
|
165
|
+
generateRoutePath: f,
|
|
166
166
|
crudToReactPathPattern: c,
|
|
167
167
|
generateActionLink: p,
|
|
168
|
-
generateLink:
|
|
168
|
+
generateLink: m,
|
|
169
169
|
generatePath: l,
|
|
170
|
-
internalToExternalPath:
|
|
170
|
+
internalToExternalPath: b,
|
|
171
171
|
externalToInternalPath: E
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
174
|
function Nt(e) {
|
|
175
175
|
let t = null;
|
|
176
176
|
try {
|
|
177
|
-
const a = sessionStorage.getItem(
|
|
177
|
+
const a = sessionStorage.getItem(rt);
|
|
178
178
|
t = JSON.parse(atob(a || ""));
|
|
179
179
|
} catch {
|
|
180
180
|
}
|
|
@@ -187,8 +187,8 @@ function Nt(e) {
|
|
|
187
187
|
window.removeEventListener("pushstate", a), window.removeEventListener("replacestate", a), window.removeEventListener("popstate", a);
|
|
188
188
|
};
|
|
189
189
|
}, []), N(() => {
|
|
190
|
-
t ||
|
|
191
|
-
a === 200 && (sessionStorage.setItem(
|
|
190
|
+
t || de().get({ url: "/_crud/actions" }).then(({ status: a, data: c }) => {
|
|
191
|
+
a === 200 && (sessionStorage.setItem(rt, btoa(JSON.stringify(c))), o(c));
|
|
192
192
|
}).catch((a) => {
|
|
193
193
|
console.log("error", a);
|
|
194
194
|
}).finally(() => {
|
|
@@ -199,7 +199,7 @@ function Nt(e) {
|
|
|
199
199
|
setLocation: i
|
|
200
200
|
}, children: e.children });
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function Io(e) {
|
|
203
203
|
return (t) => /* @__PURE__ */ r(Nt, { children: /* @__PURE__ */ r(e, { ...t }) });
|
|
204
204
|
}
|
|
205
205
|
var w = /* @__PURE__ */ ((e) => (e.Form = "form", e.Input = "input", e.Money = "money", e.Hidden = "hidden", e.Number = "number", e.Text = "text", e.Tel = "tel", e.Checkbox = "checkbox", e.Radio = "radio", e.Integer = "integer", e.Password = "password", e.Email = "email", e.Choice = "choice", e.Enum = "enum", e.Entity = "entity", e.Collection = "collection", e.Repeated = "repeated", e.Datetime = "datetime", e.Date = "date", e.Time = "time", e.Currency = "currency", e.Language = "language", e.Birthday = "birthday", e))(w || {});
|
|
@@ -210,7 +210,7 @@ function me() {
|
|
|
210
210
|
throw new Error("useForm must be used in Form");
|
|
211
211
|
return e;
|
|
212
212
|
}
|
|
213
|
-
const
|
|
213
|
+
const xe = (e, t = null) => (e?.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").replace(/([a-zA-Z])(?=[A-Z])/g, "$1_") + (t ?? "")).toLowerCase(), At = ({
|
|
214
214
|
id: e,
|
|
215
215
|
children: t,
|
|
216
216
|
data: n,
|
|
@@ -218,35 +218,43 @@ const _e = (e, t = null) => (e?.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").re
|
|
|
218
218
|
onBeforeSubmit: s,
|
|
219
219
|
onSubmit: i,
|
|
220
220
|
onReset: a,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
ref: c,
|
|
222
|
+
...f
|
|
223
|
+
}) => {
|
|
224
|
+
const u = O(null), p = {
|
|
224
225
|
response: null,
|
|
225
226
|
constraints: {},
|
|
226
227
|
errors: {}
|
|
227
|
-
},
|
|
228
|
-
const g =
|
|
228
|
+
}, m = (l, d) => {
|
|
229
|
+
const g = u.current?.elements.namedItem(l);
|
|
229
230
|
if (!g) {
|
|
230
231
|
console.warn("Cannot Set Value on missing Form Element with name: " + l);
|
|
231
232
|
return;
|
|
232
233
|
}
|
|
233
|
-
|
|
234
|
+
let h = [];
|
|
235
|
+
if (g instanceof RadioNodeList)
|
|
236
|
+
h = [...g];
|
|
237
|
+
else if (g instanceof HTMLInputElement || g instanceof HTMLSelectElement)
|
|
238
|
+
h = [g];
|
|
239
|
+
else
|
|
234
240
|
throw new Error("Cannot Set Value on missing Form Element with name: " + l);
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
241
|
+
h.forEach((x) => {
|
|
242
|
+
switch (x.type) {
|
|
243
|
+
case w.Checkbox:
|
|
244
|
+
case w.Radio: {
|
|
245
|
+
d !== null && !(d instanceof Array) && (d = [d]), x.checked = d?.includes(x.value) ?? !1;
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
default:
|
|
249
|
+
if (d instanceof Array)
|
|
250
|
+
throw new Error("Invalid Value");
|
|
251
|
+
x.value = d || "";
|
|
240
252
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
g.value = d || "";
|
|
245
|
-
}
|
|
246
|
-
}, y = {
|
|
247
|
-
getFormData: () => new FormData(m.current || void 0),
|
|
253
|
+
});
|
|
254
|
+
}, b = {
|
|
255
|
+
getFormData: () => new FormData(u.current || void 0),
|
|
248
256
|
setFormData: (l) => {
|
|
249
|
-
[...
|
|
257
|
+
[...u.current?.elements || []].forEach((d) => {
|
|
250
258
|
const g = l.get(d.name);
|
|
251
259
|
switch (d.tagName.toLowerCase()) {
|
|
252
260
|
case "select": {
|
|
@@ -267,38 +275,38 @@ const _e = (e, t = null) => (e?.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").re
|
|
|
267
275
|
}
|
|
268
276
|
});
|
|
269
277
|
},
|
|
270
|
-
setValue:
|
|
278
|
+
setValue: m,
|
|
271
279
|
setValues: (l) => {
|
|
272
|
-
Object.keys(l).map((d) =>
|
|
280
|
+
Object.keys(l).map((d) => m(d, l[d]));
|
|
273
281
|
},
|
|
274
282
|
setErrors: (l) => {
|
|
275
283
|
const [, d] = _;
|
|
276
284
|
d({ action: "errors", payload: l });
|
|
277
285
|
},
|
|
278
286
|
reset: () => {
|
|
279
|
-
|
|
287
|
+
u.current?.reset();
|
|
280
288
|
},
|
|
281
289
|
success: () => {
|
|
282
290
|
const [, l] = _;
|
|
283
291
|
l({ action: "success", payload: !0 });
|
|
284
292
|
},
|
|
285
|
-
submit: () =>
|
|
293
|
+
submit: () => u.current?.requestSubmit()
|
|
286
294
|
};
|
|
287
|
-
|
|
295
|
+
fe(c, () => b), N(() => {
|
|
288
296
|
const l = () => {
|
|
289
297
|
a && a();
|
|
290
|
-
}, d =
|
|
298
|
+
}, d = u?.current;
|
|
291
299
|
return d?.addEventListener("reset", l), () => {
|
|
292
300
|
d?.removeEventListener("reset", l);
|
|
293
301
|
};
|
|
294
302
|
}, []);
|
|
295
303
|
const E = (l, d) => {
|
|
296
|
-
const g =
|
|
304
|
+
const g = b.getFormData();
|
|
297
305
|
for (const h of d)
|
|
298
306
|
if (!h.isValid(g.get(l) || null))
|
|
299
307
|
return { valid: !1, message: h.getMessage() };
|
|
300
308
|
return { valid: !0, message: null };
|
|
301
|
-
}, _ =
|
|
309
|
+
}, _ = z((l, d) => {
|
|
302
310
|
const { action: g, payload: h } = d;
|
|
303
311
|
switch (g) {
|
|
304
312
|
case "constraints": {
|
|
@@ -312,10 +320,10 @@ const _e = (e, t = null) => (e?.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").re
|
|
|
312
320
|
};
|
|
313
321
|
}
|
|
314
322
|
case "validate": {
|
|
315
|
-
const { valid: x, message: P } = E(h, l.constraints[h] || []),
|
|
316
|
-
return x ? delete
|
|
323
|
+
const { valid: x, message: P } = E(h, l.constraints[h] || []), D = l.errors || {}, S = h;
|
|
324
|
+
return x ? delete D[S] : D[S] = [...D[S] || [], { message: P || "Error" }], Object.keys(D).length ? {
|
|
317
325
|
...l,
|
|
318
|
-
errors:
|
|
326
|
+
errors: D
|
|
319
327
|
} : l;
|
|
320
328
|
}
|
|
321
329
|
case "response":
|
|
@@ -342,26 +350,26 @@ const _e = (e, t = null) => (e?.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").re
|
|
|
342
350
|
};
|
|
343
351
|
}
|
|
344
352
|
return l;
|
|
345
|
-
}, p),
|
|
353
|
+
}, p), y = (l) => {
|
|
346
354
|
l.preventDefault();
|
|
347
355
|
const [d, g] = _;
|
|
348
356
|
let h = {};
|
|
349
|
-
for (const [P,
|
|
350
|
-
const { valid:
|
|
351
|
-
|
|
357
|
+
for (const [P, D] of Object.entries(d.constraints)) {
|
|
358
|
+
const { valid: S, message: L } = E(P, D);
|
|
359
|
+
S || (h[P] = [L]);
|
|
352
360
|
}
|
|
353
361
|
if (Object.values(h).length) {
|
|
354
362
|
g({ action: "errors", payload: h });
|
|
355
363
|
return;
|
|
356
364
|
}
|
|
357
|
-
const x = new FormData(
|
|
365
|
+
const x = new FormData(u?.current || void 0);
|
|
358
366
|
if (s && s(x), i) {
|
|
359
367
|
i(x);
|
|
360
368
|
return;
|
|
361
369
|
}
|
|
362
370
|
};
|
|
363
|
-
return /* @__PURE__ */ r(wt.Provider, { value: [_,
|
|
364
|
-
}
|
|
371
|
+
return /* @__PURE__ */ r(wt.Provider, { value: [_, c, u], children: /* @__PURE__ */ r("form", { id: e, ref: u, onSubmit: y, ...f, children: t }) });
|
|
372
|
+
}, Pt = ({
|
|
365
373
|
icon: e,
|
|
366
374
|
preloader: t,
|
|
367
375
|
rightIcon: n,
|
|
@@ -372,14 +380,14 @@ const _e = (e, t = null) => (e?.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").re
|
|
|
372
380
|
o,
|
|
373
381
|
n
|
|
374
382
|
] }), Lt = v.createContext(void 0), Ot = () => v.useContext(Lt), St = v.createContext(void 0), Bn = () => v.useContext(St), $n = ({ loader: e, children: t }) => {
|
|
375
|
-
const n =
|
|
383
|
+
const n = _e();
|
|
376
384
|
return /* @__PURE__ */ r(St.Provider, { value: e || n, children: t });
|
|
377
385
|
}, qn = ({ children: e }) => {
|
|
378
|
-
const [t, n] =
|
|
379
|
-
const [c,
|
|
386
|
+
const [t, n] = z((i, a) => {
|
|
387
|
+
const [c, f] = a;
|
|
380
388
|
return {
|
|
381
389
|
...i,
|
|
382
|
-
[c]:
|
|
390
|
+
[c]: f
|
|
383
391
|
};
|
|
384
392
|
}, {}), o = (i) => {
|
|
385
393
|
n([i, !0]);
|
|
@@ -392,15 +400,40 @@ const _e = (e, t = null) => (e?.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").re
|
|
|
392
400
|
stopLoading: s,
|
|
393
401
|
isLoading: (i) => t[i] ?? !1
|
|
394
402
|
}, children: e });
|
|
395
|
-
},
|
|
403
|
+
}, he = ({
|
|
396
404
|
children: e,
|
|
397
405
|
type: t,
|
|
398
406
|
form: n,
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
})
|
|
407
|
+
preload: o,
|
|
408
|
+
autoDisableOnInvalid: s,
|
|
409
|
+
ref: i,
|
|
410
|
+
...a
|
|
411
|
+
}) => {
|
|
412
|
+
const { isLoading: c } = Ot() || {}, f = Bn() || n || "form", u = i || O(null), [p, m] = R(s || !1);
|
|
413
|
+
return o = o || t === "submit" && c?.(f), N(() => {
|
|
414
|
+
if (!s)
|
|
415
|
+
return;
|
|
416
|
+
const b = u.current?.closest("form"), E = u.current?.closest("fieldset, form"), _ = () => {
|
|
417
|
+
u.current && m(!b?.checkValidity() || !1);
|
|
418
|
+
}, y = "input, select, textarea", l = new MutationObserver((d) => {
|
|
419
|
+
d.forEach((g) => {
|
|
420
|
+
[...g.addedNodes, ...g.removedNodes, g.target].forEach((h) => {
|
|
421
|
+
h instanceof Element && (h.matches(y) || h.querySelector(y)) && _();
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
return E?.addEventListener("input", _), b && l.observe(b, {
|
|
426
|
+
childList: !0,
|
|
427
|
+
subtree: !0,
|
|
428
|
+
attributes: !0,
|
|
429
|
+
attributeFilter: ["hidden", "style", "class"]
|
|
430
|
+
}), setTimeout(_, 150), () => {
|
|
431
|
+
l.disconnect(), E?.removeEventListener("input", _);
|
|
432
|
+
};
|
|
433
|
+
}, []), N(() => {
|
|
434
|
+
u.current && (u.current.disabled = o || p);
|
|
435
|
+
}, [o]), /* @__PURE__ */ r("button", { form: n, type: t, disabled: p, ...a, ref: u, children: /* @__PURE__ */ r(Pt, { preload: o, ...a, children: e }) });
|
|
436
|
+
}, kt = v.createContext("");
|
|
404
437
|
function Dt() {
|
|
405
438
|
return v.useContext(kt);
|
|
406
439
|
}
|
|
@@ -409,7 +442,7 @@ function Hn({ namespace: e, ...t }) {
|
|
|
409
442
|
}
|
|
410
443
|
const Rt = v.createContext(void 0);
|
|
411
444
|
function Kn({ children: e }) {
|
|
412
|
-
const [t, n] =
|
|
445
|
+
const [t, n] = z((o, { key: s, context: i }) => (o = { ...o }, i ? o[s] = i : delete o[s], o), {});
|
|
413
446
|
return /* @__PURE__ */ r(Rt.Provider, { value: {
|
|
414
447
|
set: (o, s) => n({ key: o, context: s }),
|
|
415
448
|
get: (o) => t[o] || null,
|
|
@@ -425,14 +458,14 @@ function Gn() {
|
|
|
425
458
|
return e;
|
|
426
459
|
}
|
|
427
460
|
const Tt = v.createContext(void 0);
|
|
428
|
-
function
|
|
461
|
+
function ne() {
|
|
429
462
|
const e = v.useContext(Tt);
|
|
430
463
|
if (!e)
|
|
431
464
|
throw new Error("UseCurrentAction must be used in CurrentActionProvider");
|
|
432
465
|
return e;
|
|
433
466
|
}
|
|
434
467
|
function It({ action: e, name: t, ref: n, ...o }) {
|
|
435
|
-
const { getAction: s } =
|
|
468
|
+
const { getAction: s } = M(), { set: i, unset: a } = Gn();
|
|
436
469
|
t ??= [e.action.entity, e.action.name, e.action.namespace].join("-");
|
|
437
470
|
const c = s(e.action.entity, e.action.name, e.action.namespace);
|
|
438
471
|
if (!c)
|
|
@@ -441,38 +474,42 @@ function It({ action: e, name: t, ref: n, ...o }) {
|
|
|
441
474
|
...e,
|
|
442
475
|
action: c
|
|
443
476
|
};
|
|
444
|
-
const
|
|
477
|
+
const f = () => {
|
|
445
478
|
p(Date.now());
|
|
446
479
|
};
|
|
447
|
-
|
|
448
|
-
refresh:
|
|
480
|
+
fe(n, () => ({
|
|
481
|
+
refresh: f
|
|
449
482
|
}), []);
|
|
450
|
-
const [
|
|
451
|
-
action:
|
|
452
|
-
setAction:
|
|
453
|
-
refresh:
|
|
483
|
+
const [u, p] = R(1), [m, b] = R(e), E = {
|
|
484
|
+
action: m,
|
|
485
|
+
setAction: b,
|
|
486
|
+
refresh: f
|
|
454
487
|
};
|
|
455
488
|
return N(() => {
|
|
456
|
-
|
|
457
|
-
}, [
|
|
458
|
-
|
|
489
|
+
b({ ...e, query: { ...e.query, _ts: u } });
|
|
490
|
+
}, [u]), N(() => {
|
|
491
|
+
b(e);
|
|
459
492
|
}, [JSON.stringify(e)]), N(() => (i(t, E), () => {
|
|
460
493
|
a(t);
|
|
461
|
-
}), []), /* @__PURE__ */ r(Tt.Provider, { value: E, children: /* @__PURE__ */ r(Hn, { namespace:
|
|
494
|
+
}), []), /* @__PURE__ */ r(Tt.Provider, { value: E, children: /* @__PURE__ */ r(Hn, { namespace: m.action.namespace || "", children: o.children }) });
|
|
462
495
|
}
|
|
463
|
-
const
|
|
464
|
-
if (!
|
|
496
|
+
const Fo = ({ path: e, preloader: t }) => {
|
|
497
|
+
if (!G.namespace[et])
|
|
465
498
|
throw new gt(500, "Invalid Configuration.");
|
|
466
|
-
const { link: n } =
|
|
499
|
+
const { link: n } = te(), { getOnClickActionByPath: o, actions: s } = M(), [i, a] = R(void 0), c = i ? [
|
|
500
|
+
i.action.entity,
|
|
501
|
+
i.action.namespace,
|
|
502
|
+
i.action.name
|
|
503
|
+
].filter((f) => f).join("-") : Date.now().toString();
|
|
467
504
|
return e ??= n?.path ?? location.pathname + location.search, n?.prefix && (e = e.replace(new RegExp("^/" + n.prefix.replace(new RegExp("^/"), "") + "(/)?"), "/")), N(() => {
|
|
468
505
|
a(o(e));
|
|
469
506
|
}, [e, JSON.stringify(s)]), N(() => {
|
|
470
507
|
if (i === null)
|
|
471
|
-
throw new
|
|
472
|
-
}, [i]), i === void 0 ? t ?? /* @__PURE__ */ r(A, { children: "Loading" }) : i === null ? null : /* @__PURE__ */ r(It, { action: i, children: /* @__PURE__ */ r(
|
|
473
|
-
},
|
|
474
|
-
function
|
|
475
|
-
return v.useContext(
|
|
508
|
+
throw new Ke(404, "Not Found");
|
|
509
|
+
}, [i]), i === void 0 ? t ?? /* @__PURE__ */ r(A, { children: "Loading" }) : i === null ? null : /* @__PURE__ */ r(It, { action: i, children: /* @__PURE__ */ r(jt, { children: /* @__PURE__ */ r(xn, { view: i.action.name }) }) }, c);
|
|
510
|
+
}, Ft = v.createContext(null);
|
|
511
|
+
function re() {
|
|
512
|
+
return v.useContext(Ft);
|
|
476
513
|
}
|
|
477
514
|
const Yn = ({
|
|
478
515
|
path: e,
|
|
@@ -481,44 +518,44 @@ const Yn = ({
|
|
|
481
518
|
bodyType: o,
|
|
482
519
|
loadOnInit: s = !0
|
|
483
520
|
}) => {
|
|
484
|
-
const i =
|
|
521
|
+
const i = O(s), { navigate: a, externalToInternalPath: c, internalToExternalPath: f } = M(), [u, p] = R(), m = O(null), [b, E] = R(1), _ = JSON.stringify(n instanceof FormData ? $e(n) : n);
|
|
485
522
|
e = c(e);
|
|
486
|
-
const
|
|
523
|
+
const y = kn(() => {
|
|
487
524
|
if (!i.current) {
|
|
488
525
|
i.current = !0;
|
|
489
526
|
return;
|
|
490
527
|
}
|
|
491
|
-
return
|
|
528
|
+
return m.current = new AbortController(), de().fetch({
|
|
492
529
|
url: e,
|
|
493
|
-
method: t ||
|
|
530
|
+
method: t || qe.GET,
|
|
494
531
|
body: n,
|
|
495
|
-
signal:
|
|
532
|
+
signal: m.current?.signal
|
|
496
533
|
}).then(({ data: d, response: g }) => {
|
|
497
|
-
if (g.redirected &&
|
|
498
|
-
const h =
|
|
534
|
+
if (g.redirected && g.status === 200) {
|
|
535
|
+
const h = f(new URL(g.url).pathname);
|
|
499
536
|
a(h);
|
|
500
537
|
return;
|
|
501
538
|
}
|
|
502
539
|
if (p({ data: d, response: g }), [401, 403, 404, 500].includes(g.status))
|
|
503
|
-
throw new
|
|
540
|
+
throw new Ke(g.status, g.statusText || "Error", d);
|
|
504
541
|
}).finally(() => {
|
|
505
542
|
}), () => {
|
|
506
543
|
i.current = s;
|
|
507
544
|
};
|
|
508
|
-
}, [
|
|
545
|
+
}, [b, e, _, o, t]);
|
|
509
546
|
N(() => () => {
|
|
510
547
|
l(), i.current = s;
|
|
511
548
|
}, []), N(() => {
|
|
512
|
-
|
|
513
|
-
}, [
|
|
549
|
+
y();
|
|
550
|
+
}, [b, e, _, o, t]);
|
|
514
551
|
const l = () => {
|
|
515
|
-
|
|
552
|
+
m.current?.abort("canceled"), m.current = null;
|
|
516
553
|
};
|
|
517
554
|
return {
|
|
518
555
|
url: e,
|
|
519
|
-
status:
|
|
520
|
-
results:
|
|
521
|
-
response:
|
|
556
|
+
status: u?.response.status || 0,
|
|
557
|
+
results: u?.data,
|
|
558
|
+
response: u?.response,
|
|
522
559
|
refresh: () => {
|
|
523
560
|
E(Date.now());
|
|
524
561
|
},
|
|
@@ -528,42 +565,42 @@ const Yn = ({
|
|
|
528
565
|
action: e,
|
|
529
566
|
loadOnInit: t = !0
|
|
530
567
|
}) => {
|
|
531
|
-
const { generateActionLink: n } =
|
|
568
|
+
const { generateActionLink: n } = M(), o = n(e);
|
|
532
569
|
return Yn({ path: o, method: e.method, body: e.body, bodyType: e.bodyType, loadOnInit: t });
|
|
533
|
-
},
|
|
534
|
-
const { action: n } =
|
|
570
|
+
}, jt = ({ suspense: e, children: t }) => {
|
|
571
|
+
const { action: n } = ne(), { generateActionLink: o } = M(), s = re(), i = o(n);
|
|
535
572
|
if (s?.url === i)
|
|
536
573
|
return t;
|
|
537
574
|
const a = Wn({
|
|
538
575
|
action: n
|
|
539
576
|
});
|
|
540
|
-
return e ??= /* @__PURE__ */ r(A, { children: "Data Loading" }), /* @__PURE__ */ r(
|
|
577
|
+
return e ??= /* @__PURE__ */ r(A, { children: "Data Loading" }), /* @__PURE__ */ r(Ft.Provider, { value: a, children: e && !a?.results ? e : t });
|
|
541
578
|
};
|
|
542
579
|
function Mt(e) {
|
|
543
|
-
return (t) => /* @__PURE__ */ r(
|
|
580
|
+
return (t) => /* @__PURE__ */ r(jt, { children: /* @__PURE__ */ r(e, { ...t }) });
|
|
544
581
|
}
|
|
545
582
|
const jo = (e) => {
|
|
546
583
|
const t = new RegExp("(?<=.)[^@\\n](?=[^@\\n]*?@)|(?:(?<=@.)|(?!^)\\G(?=[^@\\n]*$)).(?=.*[^@\\n]\\.)", "i");
|
|
547
584
|
return e.replace(t, "*");
|
|
548
|
-
},
|
|
585
|
+
}, De = (e) => e.replace(new RegExp("^.{1,1}"), (t) => t.toUpperCase()), zn = (e) => {
|
|
549
586
|
let t = e?.replace(new RegExp("[-_]", "gi"), " ").split(new RegExp("(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])"));
|
|
550
587
|
if (!t?.length)
|
|
551
588
|
return null;
|
|
552
589
|
const n = t.shift(), o = t.pop();
|
|
553
|
-
return t = t.map((s) => s.toLowerCase()), n && t.unshift(
|
|
590
|
+
return t = t.map((s) => s.toLowerCase()), n && t.unshift(De(n)), o && t.push(De(o)), t.join(" ");
|
|
554
591
|
}, Jn = ({ children: e }) => /* @__PURE__ */ r(A, { children: e }), Ut = v.createContext(void 0);
|
|
555
592
|
function Qn() {
|
|
556
593
|
return v.useContext(Ut);
|
|
557
594
|
}
|
|
558
|
-
const
|
|
559
|
-
const { templates: a } =
|
|
560
|
-
n ??= Dt(), e instanceof Array || (e = [e]), e = e.map((
|
|
561
|
-
const
|
|
562
|
-
...e.map((
|
|
563
|
-
...e.map((
|
|
564
|
-
], [
|
|
565
|
-
if (
|
|
566
|
-
return
|
|
595
|
+
const j = ue(({ view: e, prefix: t, namespace: n, children: o, props: s, data: i }) => {
|
|
596
|
+
const { templates: a } = te(), c = Qn(), [f, u] = R(1), p = O(Jn);
|
|
597
|
+
n ??= Dt(), e instanceof Array || (e = [e]), e = e.map((y) => y.split(/[._]/).filter((l) => l).map((l) => De(l)).join(""));
|
|
598
|
+
const m = [
|
|
599
|
+
...e.map((y) => ["crud", n, t, y].filter((l) => l).join("/") + ".tsx"),
|
|
600
|
+
...e.map((y) => ["crud", "general", t, y].filter((l) => l).join("/") + ".tsx")
|
|
601
|
+
], [b, E, _] = m.reduce((y, l) => {
|
|
602
|
+
if (y)
|
|
603
|
+
return y;
|
|
567
604
|
const [, d] = Object.entries(a ?? {}).filter(([h]) => h.endsWith(l)).shift() || [], g = c?.template === l && c?.isImported;
|
|
568
605
|
return d !== void 0 ? [l, g, d] : null;
|
|
569
606
|
}, null) || [!1, void 0];
|
|
@@ -572,22 +609,22 @@ const U = X(({ view: e, prefix: t, namespace: n, children: o, props: s, data: i
|
|
|
572
609
|
if (_ === void 0)
|
|
573
610
|
return () => {
|
|
574
611
|
};
|
|
575
|
-
_().then((
|
|
576
|
-
p.current =
|
|
612
|
+
_().then((y) => {
|
|
613
|
+
p.current = y.default, u(f + 1);
|
|
577
614
|
});
|
|
578
615
|
}
|
|
579
|
-
}, []), E || !
|
|
580
|
-
template:
|
|
616
|
+
}, []), E || !b ? o : /* @__PURE__ */ r(Ut.Provider, { value: {
|
|
617
|
+
template: b,
|
|
581
618
|
parent: o,
|
|
582
619
|
data: i,
|
|
583
620
|
view: e,
|
|
584
621
|
namespace: n,
|
|
585
622
|
isImported: !!_
|
|
586
623
|
}, children: /* @__PURE__ */ r(p.current, { ...s }) });
|
|
587
|
-
}),
|
|
624
|
+
}), k = ({ children: e, domain: t, properties: n, ...o }) => typeof e != "string" ? null : (n ??= {}, Object.keys(n).forEach((s) => {
|
|
588
625
|
e = e?.replaceAll(new RegExp(":" + s, "g"), n[s]?.toString() || "");
|
|
589
626
|
}), e = e?.replaceAll(new RegExp(":w+", "g"), ""), /* @__PURE__ */ r(
|
|
590
|
-
|
|
627
|
+
j,
|
|
591
628
|
{
|
|
592
629
|
view: "Translation",
|
|
593
630
|
props: { ...o, domain: t, properties: n },
|
|
@@ -600,19 +637,20 @@ function Zn() {
|
|
|
600
637
|
function Xn({ id: e, view: t, children: n }) {
|
|
601
638
|
return /* @__PURE__ */ r(Vt.Provider, { value: { id: e, view: t }, children: n });
|
|
602
639
|
}
|
|
603
|
-
const
|
|
640
|
+
const Mo = ({
|
|
604
641
|
name: e,
|
|
605
|
-
|
|
642
|
+
options: t,
|
|
643
|
+
optional: n
|
|
606
644
|
// Stop throwing error when Form View is missing.
|
|
607
645
|
}) => {
|
|
608
|
-
const { form:
|
|
609
|
-
if (!
|
|
610
|
-
if (
|
|
646
|
+
const { form: o } = B(), i = { ...e ? o?.children?.[e] : o, ...t || {} };
|
|
647
|
+
if (!i?.type) {
|
|
648
|
+
if (n)
|
|
611
649
|
return null;
|
|
612
650
|
throw new Error("Missing Provided Form View to Form Group" + (e ? ": " + e : ""));
|
|
613
651
|
}
|
|
614
|
-
return /* @__PURE__ */ r(
|
|
615
|
-
}, Bt = v.createContext(void 0), $t = () => v.useContext(Bt),
|
|
652
|
+
return /* @__PURE__ */ r(oe, { view: i, children: /* @__PURE__ */ r(pe, {}) });
|
|
653
|
+
}, Bt = v.createContext(void 0), $t = () => v.useContext(Bt), Uo = ({ children: e, ...t }) => /* @__PURE__ */ r(Bt.Provider, { value: t, children: e }), Re = ({
|
|
616
654
|
view: e,
|
|
617
655
|
className: t
|
|
618
656
|
}) => {
|
|
@@ -621,16 +659,16 @@ const Fo = ({
|
|
|
621
659
|
"label",
|
|
622
660
|
{
|
|
623
661
|
className: t ?? "form-check-label",
|
|
624
|
-
htmlFor: e.id ||
|
|
662
|
+
htmlFor: e.id || xe(e.full_name || ""),
|
|
625
663
|
...e.label_attr && (e.label_attr instanceof Function ? e.label_attr() : e.label_attr),
|
|
626
|
-
children: /* @__PURE__ */ r(
|
|
664
|
+
children: /* @__PURE__ */ r(k, { children: o })
|
|
627
665
|
}
|
|
628
666
|
) : /* @__PURE__ */ r(
|
|
629
667
|
"label",
|
|
630
668
|
{
|
|
631
669
|
className: t ?? "form-label",
|
|
632
670
|
...e.label_attr && (e.label_attr instanceof Function ? e.label_attr() : e.label_attr),
|
|
633
|
-
children: /* @__PURE__ */ r(
|
|
671
|
+
children: /* @__PURE__ */ r(k, { children: o })
|
|
634
672
|
}
|
|
635
673
|
) });
|
|
636
674
|
}, er = ({
|
|
@@ -654,48 +692,48 @@ const Fo = ({
|
|
|
654
692
|
{
|
|
655
693
|
value: t.value || n,
|
|
656
694
|
...t.attr && (t.attr instanceof Function ? t.attr(t) : t.attr),
|
|
657
|
-
children: /* @__PURE__ */ r(
|
|
695
|
+
children: /* @__PURE__ */ r(k, { children: n })
|
|
658
696
|
}
|
|
659
697
|
);
|
|
660
|
-
}, tr = ({ view: e, group: t }) => /* @__PURE__ */ r("optgroup", { label: t.label, children: Object.values(t.choices).map((n, o) => /* @__PURE__ */ r(qt, { view: e, choice: n }, o)) }),
|
|
698
|
+
}, tr = ({ view: e, group: t }) => /* @__PURE__ */ r("optgroup", { label: t.label, children: Object.values(t.choices).map((n, o) => /* @__PURE__ */ r(qt, { view: e, choice: n }, o)) }), Te = ({
|
|
661
699
|
view: e,
|
|
662
700
|
choice: t,
|
|
663
701
|
choiceValueTransform: n,
|
|
664
702
|
choiceLabelTransform: o
|
|
665
703
|
}) => {
|
|
666
|
-
const s = e.full_name, i = n ? n(t) : t.value, a = o ? o(t) : t.label
|
|
704
|
+
const s = e.full_name, i = n ? n(t) : t.value, a = o ? o(t) : t.label, c = xe(s || "", i), f = {
|
|
667
705
|
...(e.label_attr instanceof Function ? e.label_attr() : e.label_attr) || {}
|
|
668
|
-
},
|
|
706
|
+
}, u = {
|
|
669
707
|
id: c,
|
|
670
708
|
...(e.choice_attr instanceof Function ? e.choice_attr(e) : e.choice_attr) || {}
|
|
671
|
-
}, p = e.checked instanceof Function ? e.checked(i) : e.checked;
|
|
709
|
+
}, p = e.checked instanceof Function ? e.checked(i) : e.checked, m = e?.data, b = m instanceof Array ? m.includes(i) : m == i;
|
|
672
710
|
return /* @__PURE__ */ C(A, { children: [
|
|
673
711
|
/* @__PURE__ */ r(
|
|
674
712
|
"input",
|
|
675
713
|
{
|
|
676
714
|
defaultValue: i,
|
|
677
715
|
type: e?.multiple ? "checkbox" : "radio",
|
|
678
|
-
defaultChecked:
|
|
716
|
+
defaultChecked: p || b,
|
|
679
717
|
name: (s || "") + (e?.multiple ? "[]" : ""),
|
|
680
718
|
id: c,
|
|
681
719
|
className: "form-check-input",
|
|
682
|
-
|
|
683
|
-
|
|
720
|
+
checked: p,
|
|
721
|
+
...u
|
|
684
722
|
}
|
|
685
723
|
),
|
|
686
|
-
/* @__PURE__ */ r(
|
|
724
|
+
a?.length > 0 && /* @__PURE__ */ r(
|
|
687
725
|
"label",
|
|
688
726
|
{
|
|
689
|
-
htmlFor:
|
|
727
|
+
htmlFor: u.id,
|
|
690
728
|
className: "form-check-label",
|
|
691
|
-
...
|
|
692
|
-
children: /* @__PURE__ */ r(
|
|
729
|
+
...f,
|
|
730
|
+
children: /* @__PURE__ */ r(k, { children: a })
|
|
693
731
|
}
|
|
694
732
|
)
|
|
695
733
|
] });
|
|
696
734
|
}, nr = ({ view: e, group: t, ...n }) => /* @__PURE__ */ C("div", { className: "form-group", children: [
|
|
697
735
|
/* @__PURE__ */ r("label", { className: "form-label", children: t.label }),
|
|
698
|
-
Object.values(t.choices).map((o, s) => /* @__PURE__ */ r(
|
|
736
|
+
Object.values(t.choices).map((o, s) => /* @__PURE__ */ r(Te, { view: e, choice: o, ...n }, s))
|
|
699
737
|
] }), rr = ({
|
|
700
738
|
view: e,
|
|
701
739
|
constraints: t,
|
|
@@ -705,15 +743,15 @@ const Fo = ({
|
|
|
705
743
|
choiceLabelTransform: i
|
|
706
744
|
}) => {
|
|
707
745
|
t = t || [];
|
|
708
|
-
const a = e.full_name, [[c,
|
|
746
|
+
const a = e.full_name, [[c, f], u] = me(), m = !!(c?.errors[a || ""] || []).length, b = {
|
|
709
747
|
...(e.attr instanceof Function ? e.attr() : e.attr) || {}
|
|
710
748
|
}, E = btoa(encodeURIComponent(e.full_name + JSON.stringify(e.data))), _ = [
|
|
711
|
-
...(
|
|
749
|
+
...(b.class || "").split(" ") || [],
|
|
712
750
|
...(n || "").split(" ") || [],
|
|
713
|
-
...
|
|
751
|
+
...m ? ["is-invalid"] : []
|
|
714
752
|
];
|
|
715
753
|
N(() => {
|
|
716
|
-
|
|
754
|
+
f({
|
|
717
755
|
action: "constraints",
|
|
718
756
|
payload: {
|
|
719
757
|
name: e.full_name,
|
|
@@ -721,19 +759,19 @@ const Fo = ({
|
|
|
721
759
|
}
|
|
722
760
|
});
|
|
723
761
|
}, []);
|
|
724
|
-
const
|
|
725
|
-
|
|
762
|
+
const y = (l) => {
|
|
763
|
+
f({ action: "validate", payload: e.full_name }), o && o(l);
|
|
726
764
|
};
|
|
727
765
|
return e?.expanded ? /* @__PURE__ */ C(A, { children: [
|
|
728
766
|
typeof e.placeholder == "string" && /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(
|
|
729
|
-
|
|
767
|
+
Te,
|
|
730
768
|
{
|
|
731
769
|
view: e,
|
|
732
770
|
choice: { label: e.placeholder, value: null }
|
|
733
771
|
}
|
|
734
772
|
) }),
|
|
735
773
|
Object.values(e.choices || []).map(
|
|
736
|
-
(l, d) => /* @__PURE__ */ r(
|
|
774
|
+
(l, d) => /* @__PURE__ */ r(ke, { children: l.choices !== void 0 ? /* @__PURE__ */ r(
|
|
737
775
|
nr,
|
|
738
776
|
{
|
|
739
777
|
view: e,
|
|
@@ -741,8 +779,8 @@ const Fo = ({
|
|
|
741
779
|
choiceLabelTransform: i,
|
|
742
780
|
choiceValueTransform: s
|
|
743
781
|
}
|
|
744
|
-
) : /* @__PURE__ */ r("div", { className: "form-check", ...
|
|
745
|
-
|
|
782
|
+
) : /* @__PURE__ */ r("div", { className: "form-check", ...b, children: /* @__PURE__ */ r(
|
|
783
|
+
Te,
|
|
746
784
|
{
|
|
747
785
|
view: e,
|
|
748
786
|
choice: l,
|
|
@@ -756,16 +794,16 @@ const Fo = ({
|
|
|
756
794
|
{
|
|
757
795
|
name: a,
|
|
758
796
|
multiple: e.multiple,
|
|
759
|
-
"aria-invalid":
|
|
760
|
-
onChange: (l) =>
|
|
761
|
-
value: (e.multiple ?
|
|
797
|
+
"aria-invalid": m,
|
|
798
|
+
onChange: (l) => y({
|
|
799
|
+
value: (e.multiple ? u?.current?.getFormData().getAll(a) : u?.current?.getFormData().get(a)) || l.target.value
|
|
762
800
|
}),
|
|
763
801
|
className: [..._, "form-select"].join(" "),
|
|
764
802
|
...e.attr && (e.attr instanceof Function ? e.attr() : e.attr),
|
|
765
803
|
defaultValue: e.data,
|
|
766
804
|
children: [
|
|
767
|
-
e.placeholder && /* @__PURE__ */ r("option", { value: "", children: /* @__PURE__ */ r(
|
|
768
|
-
Object.values(e.choices || []).map((l, d) => /* @__PURE__ */ r(
|
|
805
|
+
e.placeholder && /* @__PURE__ */ r("option", { value: "", children: /* @__PURE__ */ r(k, { children: e.placeholder }) }),
|
|
806
|
+
Object.values(e.choices || []).map((l, d) => /* @__PURE__ */ r(ke, { children: l.choices !== void 0 ? /* @__PURE__ */ r(tr, { view: e, group: l }) : /* @__PURE__ */ r(qt, { view: e, choice: l }) }, d))
|
|
769
807
|
]
|
|
770
808
|
},
|
|
771
809
|
E
|
|
@@ -786,29 +824,29 @@ const Fo = ({
|
|
|
786
824
|
}
|
|
787
825
|
});
|
|
788
826
|
}, []);
|
|
789
|
-
const
|
|
827
|
+
const f = (l) => {
|
|
790
828
|
a({ action: "validate", payload: s }), n && n(l);
|
|
791
|
-
}, p = ["checkbox", "radio"].includes(e.type) ? "form-check-input" : "form-control",
|
|
792
|
-
let _ = e.type,
|
|
829
|
+
}, p = ["checkbox", "radio"].includes(e.type) ? "form-check-input" : "form-control", m = btoa(encodeURIComponent(s + JSON.stringify(e.data))), b = (e.attr instanceof Function ? e.attr() : e.attr) || {}, E = $t();
|
|
830
|
+
let _ = e.type, y = e.data;
|
|
793
831
|
if ([w.Date, w.Birthday, w.Datetime].includes(_)) {
|
|
794
|
-
const l =
|
|
832
|
+
const l = y?.date ? new Date(y.date) : null;
|
|
795
833
|
if (l) {
|
|
796
834
|
const d = l.getTimezoneOffset() * 6e4;
|
|
797
|
-
|
|
835
|
+
y = new Date(l.getTime() - d).toISOString().split("T").shift();
|
|
798
836
|
}
|
|
799
837
|
_ = _ === w.Datetime ? "datetime-local" : "date";
|
|
800
838
|
}
|
|
801
|
-
return /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(
|
|
839
|
+
return e.required && (b.required = "required"), /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(
|
|
802
840
|
"input",
|
|
803
841
|
{
|
|
804
842
|
ref: o,
|
|
805
843
|
id: e.id,
|
|
806
844
|
name: s,
|
|
807
845
|
type: _,
|
|
808
|
-
defaultValue:
|
|
846
|
+
defaultValue: y,
|
|
809
847
|
"aria-invalid": !c.length,
|
|
810
848
|
onInput: (l) => {
|
|
811
|
-
|
|
849
|
+
b.onChange instanceof Function && b.onChange(l), !l.defaultPrevented && f({ value: l.target.value });
|
|
812
850
|
},
|
|
813
851
|
className: E?.className || [
|
|
814
852
|
p,
|
|
@@ -818,10 +856,10 @@ const Fo = ({
|
|
|
818
856
|
].filter((l) => l).join(" "),
|
|
819
857
|
defaultChecked: e?.checked,
|
|
820
858
|
placeholder: E?.placeholder || e?.placeholder || void 0,
|
|
821
|
-
...
|
|
822
|
-
...
|
|
859
|
+
...b,
|
|
860
|
+
...b.inputmode === "decimal" && { step: "any" }
|
|
823
861
|
},
|
|
824
|
-
|
|
862
|
+
m
|
|
825
863
|
) });
|
|
826
864
|
}, Ht = v.createContext({
|
|
827
865
|
requests: []
|
|
@@ -830,57 +868,57 @@ function sr(e) {
|
|
|
830
868
|
const t = v.useContext(Ht);
|
|
831
869
|
if (t === void 0)
|
|
832
870
|
throw new Error("UseLoaderIndicator must be within DataLoaderIndicatorProvider");
|
|
833
|
-
const { requests: n } = t, { matchPath: o, getActionByPath: s, generateActionLink: i } =
|
|
871
|
+
const { requests: n } = t, { matchPath: o, getActionByPath: s, generateActionLink: i } = M();
|
|
834
872
|
let a = null;
|
|
835
873
|
if (e) {
|
|
836
|
-
const
|
|
837
|
-
if (
|
|
838
|
-
const
|
|
839
|
-
a = i({ action:
|
|
874
|
+
const f = s(e?.toString() ?? "");
|
|
875
|
+
if (f) {
|
|
876
|
+
const u = ht(new URL(e, location.origin).searchParams), { params: p } = o(f.route?.path || "", e) ?? { params: void 0 };
|
|
877
|
+
a = i({ action: f, parameters: p, query: u });
|
|
840
878
|
}
|
|
841
879
|
}
|
|
842
880
|
return {
|
|
843
|
-
isLoading: a ? !!n.filter((
|
|
881
|
+
isLoading: a ? !!n.filter((f) => f.url === a).length : !1
|
|
844
882
|
};
|
|
845
883
|
}
|
|
846
884
|
function ir({ ...e }) {
|
|
847
|
-
const [t, n] =
|
|
848
|
-
const { action: i, requestId: a, url: c } = s,
|
|
885
|
+
const [t, n] = z((o, s) => {
|
|
886
|
+
const { action: i, requestId: a, url: c } = s, f = new URL(c), u = f.toString().replace(f.origin, "");
|
|
849
887
|
switch (o = { requests: o.requests.filter((p) => p.requestId !== a) }, i) {
|
|
850
888
|
case "cancel":
|
|
851
889
|
case "complete":
|
|
852
890
|
break;
|
|
853
891
|
default:
|
|
854
|
-
o.requests.push({ url:
|
|
892
|
+
o.requests.push({ url: u, requestId: a }), o = { requests: o.requests };
|
|
855
893
|
}
|
|
856
894
|
return o;
|
|
857
895
|
}, { requests: [] });
|
|
858
896
|
return N(() => {
|
|
859
|
-
const o =
|
|
897
|
+
const o = G.on(we.PRE_REQUEST, (a, c, f) => {
|
|
860
898
|
n({ action: "load", requestId: a, url: c.toString() });
|
|
861
|
-
}), s =
|
|
862
|
-
n({ action: "complete", requestId: a, url:
|
|
863
|
-
}), i =
|
|
864
|
-
n({ action: "cancel", requestId: a, url:
|
|
899
|
+
}), s = G.on(we.POST_RESPONSE, (a, c, f, u) => {
|
|
900
|
+
n({ action: "complete", requestId: a, url: f.toString() });
|
|
901
|
+
}), i = G.on(we.ERROR, (a, c, f, u) => {
|
|
902
|
+
n({ action: "cancel", requestId: a, url: f.toString() });
|
|
865
903
|
});
|
|
866
904
|
return () => {
|
|
867
|
-
|
|
905
|
+
G.off(o).off(s).off(i);
|
|
868
906
|
};
|
|
869
907
|
}, []), /* @__PURE__ */ r(Ht.Provider, { value: t, children: e.children });
|
|
870
908
|
}
|
|
871
|
-
const
|
|
872
|
-
const { navigate: s } =
|
|
873
|
-
if (
|
|
874
|
-
|
|
909
|
+
const U = ({ to: e, children: t, onClick: n, ...o }) => {
|
|
910
|
+
const { navigate: s } = M(), i = O(null), [a, c] = R(!1), { isLoading: f } = sr(e?.toString()), u = (m) => {
|
|
911
|
+
if (f) {
|
|
912
|
+
m.preventDefault(), m.stopPropagation();
|
|
875
913
|
return;
|
|
876
914
|
}
|
|
877
|
-
c(!0), n && n(
|
|
915
|
+
c(!0), n && n(m), !m.defaultPrevented && e && (m.preventDefault(), s(e.toString()));
|
|
878
916
|
};
|
|
879
917
|
return N(() => {
|
|
880
|
-
a && (
|
|
881
|
-
}, [
|
|
882
|
-
i?.current?.removeEventListener("click",
|
|
883
|
-
}), [e, n]), /* @__PURE__ */ r("a", { ref: i, href: e, ...o, children: /* @__PURE__ */ r(Pt, { preload: a &&
|
|
918
|
+
a && (f || c(!1));
|
|
919
|
+
}, [f]), N(() => (i?.current?.addEventListener("click", u), () => {
|
|
920
|
+
i?.current?.removeEventListener("click", u);
|
|
921
|
+
}), [e, n]), /* @__PURE__ */ r("a", { ref: i, href: e, ...o, children: /* @__PURE__ */ r(Pt, { preload: a && f, ...o, children: t }) });
|
|
884
922
|
}, Kt = v.createContext(void 0), Gt = () => {
|
|
885
923
|
const e = v.useContext(Kt);
|
|
886
924
|
if (!e)
|
|
@@ -889,13 +927,13 @@ const M = ({ to: e, children: t, onClick: n, ...o }) => {
|
|
|
889
927
|
}, ar = ({
|
|
890
928
|
view: e
|
|
891
929
|
}) => {
|
|
892
|
-
const t = Object.keys(e.children || []), [n, o] =
|
|
893
|
-
const { action:
|
|
894
|
-
switch (
|
|
930
|
+
const t = Object.keys(e.children || []), [n, o] = z((c, f) => {
|
|
931
|
+
const { action: u, value: p } = f;
|
|
932
|
+
switch (u) {
|
|
895
933
|
case "delete": {
|
|
896
934
|
if (p && typeof p != "string")
|
|
897
935
|
throw new Error("Invalid value. Should be a string.");
|
|
898
|
-
c = [...c.filter((
|
|
936
|
+
c = [...c.filter((m) => m !== p)];
|
|
899
937
|
break;
|
|
900
938
|
}
|
|
901
939
|
case "set": {
|
|
@@ -907,8 +945,8 @@ const M = ({ to: e, children: t, onClick: n, ...o }) => {
|
|
|
907
945
|
default: {
|
|
908
946
|
if (p && typeof p != "string")
|
|
909
947
|
throw new Error("Invalid value. Should be a string.");
|
|
910
|
-
const
|
|
911
|
-
c = [...c,
|
|
948
|
+
const m = Math.floor(Math.random() * Date.now());
|
|
949
|
+
c = [...c, m.toString()];
|
|
912
950
|
}
|
|
913
951
|
}
|
|
914
952
|
return c;
|
|
@@ -923,14 +961,14 @@ const M = ({ to: e, children: t, onClick: n, ...o }) => {
|
|
|
923
961
|
items: n,
|
|
924
962
|
isPrototype: s
|
|
925
963
|
}, children: /* @__PURE__ */ C(
|
|
926
|
-
|
|
964
|
+
j,
|
|
927
965
|
{
|
|
928
966
|
prefix: "modify/form",
|
|
929
967
|
view: [...e.block_prefixes || [], e.name + ".collection"],
|
|
930
968
|
children: [
|
|
931
969
|
/* @__PURE__ */ r(cr, {}),
|
|
932
970
|
s && /* @__PURE__ */ r(
|
|
933
|
-
|
|
971
|
+
U,
|
|
934
972
|
{
|
|
935
973
|
onClick: () => i(),
|
|
936
974
|
className: "btn btn-outline-primary btn-sm",
|
|
@@ -944,10 +982,10 @@ const M = ({ to: e, children: t, onClick: n, ...o }) => {
|
|
|
944
982
|
}, cr = () => {
|
|
945
983
|
const { items: e } = Gt(), { form: t } = B(), n = !!t.prototype, o = (s, i) => {
|
|
946
984
|
if (s.prototype_name) {
|
|
947
|
-
const a = s.full_name?.replace("__name__", s.prototype_name || "") || "", c = (s.id ||
|
|
948
|
-
s.full_name = a, s.id = c, s.label = s.label?.replace("__name__label__",
|
|
949
|
-
const
|
|
950
|
-
|
|
985
|
+
const a = s.full_name?.replace("__name__", s.prototype_name || "") || "", c = (s.id || xe(a)).replace("__name__", s.prototype_name || ""), f = s.label?.replace("__name__label__", i.toString()) || "";
|
|
986
|
+
s.full_name = a, s.id = c, s.label = s.label?.replace("__name__label__", f), Object.keys(s.children || {}).map((u, p) => {
|
|
987
|
+
const m = s.children?.[u];
|
|
988
|
+
m !== void 0 && (m.prototype_name || (m.prototype_name = s.prototype_name, o(m, p)));
|
|
951
989
|
}, {});
|
|
952
990
|
}
|
|
953
991
|
};
|
|
@@ -955,33 +993,33 @@ const M = ({ to: e, children: t, onClick: n, ...o }) => {
|
|
|
955
993
|
const a = JSON.parse(JSON.stringify(t.children?.[s] ?? (t.prototype || t)));
|
|
956
994
|
return a ? (t.children?.[s] === void 0 && (a.prototype_name = s), o(a, i), /* @__PURE__ */ r(lr, { index: i, view: a, isPrototype: n })) : null;
|
|
957
995
|
}) });
|
|
958
|
-
}, Yt = v.createContext(void 0),
|
|
996
|
+
}, Yt = v.createContext(void 0), Vo = () => {
|
|
959
997
|
const e = v.useContext(Yt);
|
|
960
998
|
if (!e)
|
|
961
999
|
throw new Error("UseCollectionItem must be used within a CollectionItem");
|
|
962
1000
|
return e;
|
|
963
1001
|
}, lr = ({ view: e, index: t, isPrototype: n }) => {
|
|
964
1002
|
const { removeItem: o } = Gt(), { form: s } = Qt() || { form: e }, i = e.prototype_name || e.name || "";
|
|
965
|
-
return /* @__PURE__ */ r(
|
|
966
|
-
|
|
1003
|
+
return /* @__PURE__ */ r(oe, { view: e, allowDuplicates: n, children: /* @__PURE__ */ r(Yt.Provider, { value: { index: t, removeItem: () => o(i) }, children: /* @__PURE__ */ r(
|
|
1004
|
+
j,
|
|
967
1005
|
{
|
|
968
1006
|
prefix: "modify/form",
|
|
969
1007
|
view: [...e.block_prefixes || [], s.name + ".item"],
|
|
970
1008
|
children: /* @__PURE__ */ C("div", { className: "mb-3", children: [
|
|
971
1009
|
/* @__PURE__ */ r(zt, { view: e }),
|
|
972
1010
|
n && /* @__PURE__ */ r(
|
|
973
|
-
|
|
1011
|
+
U,
|
|
974
1012
|
{
|
|
975
1013
|
to: "#",
|
|
976
1014
|
onClick: () => o(i),
|
|
977
1015
|
className: "btn btn-outline-danger btn-sm",
|
|
978
|
-
children: /* @__PURE__ */ r(
|
|
1016
|
+
children: /* @__PURE__ */ r(k, { children: "Delete" })
|
|
979
1017
|
}
|
|
980
1018
|
)
|
|
981
1019
|
] })
|
|
982
1020
|
}
|
|
983
1021
|
) }) });
|
|
984
|
-
},
|
|
1022
|
+
}, dr = ({ view: e, ref: t }) => {
|
|
985
1023
|
switch (e.type) {
|
|
986
1024
|
case w.Entity:
|
|
987
1025
|
case w.Choice:
|
|
@@ -1017,14 +1055,22 @@ const M = ({ to: e, children: t, onClick: n, ...o }) => {
|
|
|
1017
1055
|
const { form: o } = B(), s = e ? o.children?.[e] : o;
|
|
1018
1056
|
if (!s)
|
|
1019
1057
|
throw new Error("Missing Form View for FormField" + (e ? ": " + e : ""));
|
|
1020
|
-
const i = { ...s, ...t || {} };
|
|
1021
|
-
return
|
|
1058
|
+
const i = { ...s, ...t || {} }, a = [(i.name || "form") + "Field", ...i.block_prefixes || []];
|
|
1059
|
+
return /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(oe, { view: i, children: /* @__PURE__ */ r(
|
|
1060
|
+
j,
|
|
1061
|
+
{
|
|
1062
|
+
view: a,
|
|
1063
|
+
prefix: "modify/form",
|
|
1064
|
+
data: s,
|
|
1065
|
+
children: /* @__PURE__ */ r(dr, { view: i, ref: n })
|
|
1066
|
+
}
|
|
1067
|
+
) }) });
|
|
1022
1068
|
}, Wt = ({ name: e, className: t }) => {
|
|
1023
1069
|
const [[n]] = me() || {};
|
|
1024
1070
|
e = e instanceof Array ? e : [e];
|
|
1025
1071
|
const o = [].concat(...e.map((s) => n?.errors[s] || []));
|
|
1026
|
-
return o.length ? /* @__PURE__ */ r("div", { className: t, children: /* @__PURE__ */ r("ul", { className: "mb-0", children: o.map((s, i) => /* @__PURE__ */ r("li", { children: s.message }, i)) }) }) : null;
|
|
1027
|
-
},
|
|
1072
|
+
return o.length ? /* @__PURE__ */ r("div", { className: t, children: /* @__PURE__ */ r("ul", { className: "mb-0", children: o.map((s, i) => /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(k, { children: s.message }) }, i)) }) }) : null;
|
|
1073
|
+
}, ur = ({ name: e, className: t }) => {
|
|
1028
1074
|
const { form: n, getRootViewContext: o } = B(), s = e ? (e instanceof Array ? e : [e]).map((i) => {
|
|
1029
1075
|
const a = i ? n.children?.[i] : n;
|
|
1030
1076
|
if (!a)
|
|
@@ -1049,62 +1095,62 @@ const M = ({ to: e, children: t, onClick: n, ...o }) => {
|
|
|
1049
1095
|
className: [...t?.split(" ") || [s ? "form-check" : "mb-3"]].filter((i) => i).join(" "),
|
|
1050
1096
|
...e.attr && (e.attr instanceof Function ? e.attr() : e.attr),
|
|
1051
1097
|
children: [
|
|
1052
|
-
!s && /* @__PURE__ */ r(
|
|
1098
|
+
!s && /* @__PURE__ */ r(Re, { view: e }),
|
|
1053
1099
|
/* @__PURE__ */ r(ot, { size: n }),
|
|
1054
|
-
s && /* @__PURE__ */ r(
|
|
1055
|
-
/* @__PURE__ */ r(
|
|
1100
|
+
s && /* @__PURE__ */ r(Re, { view: e }),
|
|
1101
|
+
/* @__PURE__ */ r(ur, { className: "invalid-feedback" }),
|
|
1056
1102
|
/* @__PURE__ */ r(er, {})
|
|
1057
1103
|
]
|
|
1058
1104
|
}
|
|
1059
1105
|
) });
|
|
1060
|
-
}, pe =
|
|
1061
|
-
const e =
|
|
1106
|
+
}, pe = () => {
|
|
1107
|
+
const e = _e(), { form: t } = B(), n = [(t.name || "form") + "Group", ...t.block_prefixes || []].map((o) => o + "_group");
|
|
1062
1108
|
return /* @__PURE__ */ r(Xn, { id: e, view: t, children: /* @__PURE__ */ r(
|
|
1063
|
-
|
|
1109
|
+
j,
|
|
1064
1110
|
{
|
|
1065
|
-
view:
|
|
1111
|
+
view: n,
|
|
1066
1112
|
prefix: "modify/form",
|
|
1067
1113
|
data: t,
|
|
1068
|
-
children: [w.Form, w.Repeated].includes(t?.type) ? Object.values(t.children || []).map((
|
|
1114
|
+
children: [w.Form, w.Repeated].includes(t?.type) ? Object.values(t.children || []).map((o, s) => /* @__PURE__ */ r(ke, { children: /* @__PURE__ */ r(oe, { view: o, children: /* @__PURE__ */ r(pe, {}) }, s) }, s)) : /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(zt, { view: t }) })
|
|
1069
1115
|
}
|
|
1070
1116
|
) });
|
|
1071
|
-
}
|
|
1117
|
+
}, fr = () => /* @__PURE__ */ r(pe, {}), mr = ({ className: e }) => {
|
|
1072
1118
|
const [[t]] = me() || {}, { getRootViewContext: n, getParentViewContext: o, getElements: s } = B(), a = (() => {
|
|
1073
|
-
let
|
|
1074
|
-
for (;
|
|
1075
|
-
|
|
1076
|
-
...
|
|
1077
|
-
...Object.keys(
|
|
1078
|
-
],
|
|
1079
|
-
return
|
|
1080
|
-
})(), c = Object.keys(t?.errors || []).filter((
|
|
1119
|
+
let f = Object.keys(s?.() || []), u = o?.() || null;
|
|
1120
|
+
for (; u !== null; )
|
|
1121
|
+
f = [
|
|
1122
|
+
...f,
|
|
1123
|
+
...Object.keys(u.getElements?.() || [])
|
|
1124
|
+
], u = u.getParentViewContext();
|
|
1125
|
+
return f;
|
|
1126
|
+
})(), c = Object.keys(t?.errors || []).filter((f) => a.includes(f)).filter((f) => !n().getRenderedErrors().includes(f));
|
|
1081
1127
|
return /* @__PURE__ */ r(Wt, { name: c, className: e });
|
|
1082
|
-
},
|
|
1083
|
-
const e = v.useContext(
|
|
1128
|
+
}, Ie = v.createContext(void 0), Ge = () => {
|
|
1129
|
+
const e = v.useContext(Ie);
|
|
1084
1130
|
if (!e)
|
|
1085
1131
|
throw new Error("UseTemplate must be used inside Template");
|
|
1086
1132
|
return e;
|
|
1087
|
-
},
|
|
1088
|
-
const n = v.useContext(
|
|
1133
|
+
}, hr = ({ name: e, children: t }) => {
|
|
1134
|
+
const n = v.useContext(Ie), [o, s] = z((i, a) => {
|
|
1089
1135
|
if (a.template && a.template !== e)
|
|
1090
1136
|
return n?.dispatch(a), i;
|
|
1091
|
-
const c = i[a.block] || [],
|
|
1137
|
+
const c = i[a.block] || [], f = a.element || null;
|
|
1092
1138
|
if (a.action === "set") {
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1139
|
+
const u = c.find((p) => p.id === a.id);
|
|
1140
|
+
u ? u.element = f : c.push({
|
|
1095
1141
|
id: a.id,
|
|
1096
|
-
element:
|
|
1142
|
+
element: f
|
|
1097
1143
|
});
|
|
1098
1144
|
} else
|
|
1099
|
-
c.filter((
|
|
1100
|
-
|
|
1145
|
+
c.filter((u) => u.id === a.id).forEach((u) => {
|
|
1146
|
+
u.element = null;
|
|
1101
1147
|
});
|
|
1102
1148
|
return {
|
|
1103
1149
|
...i,
|
|
1104
1150
|
[a.block]: c
|
|
1105
1151
|
};
|
|
1106
1152
|
}, {});
|
|
1107
|
-
return /* @__PURE__ */ r(
|
|
1153
|
+
return /* @__PURE__ */ r(Ie.Provider, { value: {
|
|
1108
1154
|
name: e,
|
|
1109
1155
|
blocks: o,
|
|
1110
1156
|
getBlock: (i, a) => a && a !== e ? n?.getBlock(i, a) : [...o[i] || []].pop()?.element,
|
|
@@ -1112,10 +1158,10 @@ const M = ({ to: e, children: t, onClick: n, ...o }) => {
|
|
|
1112
1158
|
dispatch: s
|
|
1113
1159
|
}, children: t });
|
|
1114
1160
|
}, Jt = v.createContext(void 0), T = ({ name: e, template: t, children: n }) => {
|
|
1115
|
-
const { getBlock: o } =
|
|
1161
|
+
const { getBlock: o } = Ge(), s = o(e, t);
|
|
1116
1162
|
return /* @__PURE__ */ r(Jt.Provider, { value: { name: e, children: n }, children: s === void 0 ? n : s });
|
|
1117
1163
|
}, H = ({ name: e, template: t, children: n }) => {
|
|
1118
|
-
const o =
|
|
1164
|
+
const o = _e(), { dispatch: s } = Ge(), i = () => {
|
|
1119
1165
|
s({
|
|
1120
1166
|
id: o,
|
|
1121
1167
|
action: "unset",
|
|
@@ -1134,161 +1180,169 @@ const M = ({ to: e, children: t, onClick: n, ...o }) => {
|
|
|
1134
1180
|
}), [n]), N(() => () => {
|
|
1135
1181
|
i();
|
|
1136
1182
|
}, []), null;
|
|
1137
|
-
},
|
|
1138
|
-
const { name: e, children: t } = v.useContext(Jt) || {}, { name: n, getParent: o } =
|
|
1183
|
+
}, Bo = () => {
|
|
1184
|
+
const { name: e, children: t } = v.useContext(Jt) || {}, { name: n, getParent: o } = Ge();
|
|
1139
1185
|
return (e ? o(e) : null) || t || null;
|
|
1140
1186
|
};
|
|
1141
|
-
function
|
|
1142
|
-
return (n) => /* @__PURE__ */ C(
|
|
1187
|
+
function Ne(e, t) {
|
|
1188
|
+
return (n) => /* @__PURE__ */ C(hr, { name: t.name, children: [
|
|
1143
1189
|
/* @__PURE__ */ r(e, { ...n }),
|
|
1144
1190
|
n.children
|
|
1145
1191
|
] });
|
|
1146
1192
|
}
|
|
1147
|
-
const
|
|
1193
|
+
const Ye = v.createContext(void 0), oe = ({ view: e, allowDuplicates: t, children: n }) => {
|
|
1148
1194
|
const o = Qt(), {
|
|
1149
1195
|
form: s,
|
|
1150
1196
|
getParentViewContext: i,
|
|
1151
1197
|
getElements: a,
|
|
1152
1198
|
allowDuplicates: c,
|
|
1153
|
-
unsetRendered:
|
|
1154
|
-
} = o || {},
|
|
1199
|
+
unsetRendered: f
|
|
1200
|
+
} = o || {}, u = O(a?.() || {}), p = O([]), [, m] = me(), b = Zn(), E = (l, d) => {
|
|
1155
1201
|
const g = l ? l.split(".").reduce((h, x) => h?.children?.[x] || null, e) : e;
|
|
1156
|
-
g && (g.data = d,
|
|
1157
|
-
},
|
|
1202
|
+
g && (g.data = d, m.current?.setValue(g.full_name, d));
|
|
1203
|
+
}, y = {
|
|
1158
1204
|
form: e,
|
|
1159
1205
|
setRendered: (l, d) => {
|
|
1160
|
-
l.full_name &&
|
|
1206
|
+
l.full_name && u.current[l.full_name] === void 0 && (u.current[l.full_name] = d);
|
|
1161
1207
|
},
|
|
1162
1208
|
unsetRendered: (l, d) => {
|
|
1163
|
-
l.full_name &&
|
|
1209
|
+
l.full_name && u.current[l.full_name] === d && delete u.current[l.full_name], f?.(l, d);
|
|
1164
1210
|
},
|
|
1165
|
-
canRender: (l, d) => t ? !0 :
|
|
1211
|
+
canRender: (l, d) => t ? !0 : b?.view.full_name === l.full_name || o?.form.full_name === l.full_name || Object.values(u.current).includes(d),
|
|
1166
1212
|
setValue: E,
|
|
1167
1213
|
setValues: (l) => {
|
|
1168
1214
|
Object.keys(l).map((d) => E(d, l[d]));
|
|
1169
1215
|
},
|
|
1170
|
-
getElements: () =>
|
|
1216
|
+
getElements: () => u.current,
|
|
1171
1217
|
allowDuplicates: t,
|
|
1172
1218
|
getParentViewContext: () => o || null,
|
|
1173
|
-
getRootViewContext: () => o?.getRootViewContext() || o ||
|
|
1219
|
+
getRootViewContext: () => o?.getRootViewContext() || o || y,
|
|
1174
1220
|
setRenderedError: (l) => {
|
|
1175
1221
|
p.current.includes(l) || p.current.push(l);
|
|
1176
1222
|
},
|
|
1177
1223
|
isRenderedError: (l) => p.current.includes(l),
|
|
1178
1224
|
getRenderedErrors: () => p.current
|
|
1179
1225
|
};
|
|
1180
|
-
return /* @__PURE__ */ r(
|
|
1226
|
+
return /* @__PURE__ */ r(Ye.Provider, { value: y, children: /* @__PURE__ */ r(pr, { children: n }) });
|
|
1181
1227
|
}, pr = ({ children: e }) => {
|
|
1182
|
-
const t =
|
|
1228
|
+
const t = _e(), [n, o] = R(null), { form: s, unsetRendered: i, setRendered: a, canRender: c } = B();
|
|
1183
1229
|
return N(() => (a?.(s, t), o(t), () => {
|
|
1184
1230
|
i?.(s, t), o(null);
|
|
1185
1231
|
}), []), !n || !c?.(s, n) ? /* @__PURE__ */ r(A, {}) : /* @__PURE__ */ r(A, { children: e });
|
|
1186
1232
|
};
|
|
1187
1233
|
function B() {
|
|
1188
|
-
const e = v.useContext(
|
|
1234
|
+
const e = v.useContext(Ye);
|
|
1189
1235
|
if (!e)
|
|
1190
1236
|
throw new Error("UseFormView must be used within a FormViewProvider.");
|
|
1191
1237
|
return e;
|
|
1192
1238
|
}
|
|
1193
1239
|
function Qt() {
|
|
1194
|
-
return v.useContext(
|
|
1240
|
+
return v.useContext(Ye);
|
|
1195
1241
|
}
|
|
1196
|
-
const
|
|
1197
|
-
const { navigate: i, generateLink: a, generateActionLink: c } =
|
|
1198
|
-
|
|
1199
|
-
getFormRef: () =>
|
|
1242
|
+
const gr = Ne(He(({ onSuccess: e, onError: t, onLoad: n, embedded: o = !1 }, s) => {
|
|
1243
|
+
const { navigate: i, generateLink: a, generateActionLink: c } = M(), { action: f, setAction: u, refresh: p } = ne(), m = c(f), [b, E] = R(null), _ = O(void 0), y = re(), { startLoading: l, stopLoading: d } = Ot() || {}, g = O(null), [h, x] = R(null);
|
|
1244
|
+
fe(s, () => ({
|
|
1245
|
+
getFormRef: () => _.current
|
|
1200
1246
|
}));
|
|
1201
|
-
const
|
|
1202
|
-
let
|
|
1203
|
-
const
|
|
1204
|
-
return { ...
|
|
1247
|
+
const P = (L) => {
|
|
1248
|
+
let I = (L.errors || []).reduce((K, Z) => {
|
|
1249
|
+
const ie = Z.origin || L.full_name || "";
|
|
1250
|
+
return { ...K, [ie]: [...K[ie] || [], Z] };
|
|
1205
1251
|
}, {});
|
|
1206
|
-
for (let [,
|
|
1207
|
-
|
|
1208
|
-
return
|
|
1209
|
-
},
|
|
1210
|
-
|
|
1252
|
+
for (let [, K] of Object.entries(L?.children || []))
|
|
1253
|
+
I = { ...I, ...P(K) };
|
|
1254
|
+
return I;
|
|
1255
|
+
}, D = (L) => {
|
|
1256
|
+
l?.(S?.full_name || "form"), g.current = setTimeout(() => d?.(S?.full_name || "form"), 250), L.append("_ts", Date.now().toString()), x(L);
|
|
1211
1257
|
};
|
|
1212
1258
|
N(() => {
|
|
1213
|
-
|
|
1214
|
-
...
|
|
1215
|
-
method:
|
|
1216
|
-
body:
|
|
1217
|
-
bodyType:
|
|
1259
|
+
h && (g.current && clearTimeout(g.current), u({
|
|
1260
|
+
...f,
|
|
1261
|
+
method: qe.POST,
|
|
1262
|
+
body: h,
|
|
1263
|
+
bodyType: pt.FormData
|
|
1218
1264
|
}));
|
|
1219
|
-
}, [
|
|
1265
|
+
}, [h ? JSON.stringify($e(h)) : null]), N(() => {
|
|
1220
1266
|
n && n();
|
|
1221
1267
|
}, []), N(() => {
|
|
1222
|
-
const
|
|
1223
|
-
if (!
|
|
1268
|
+
const L = y?.results?.form?.modify?.view;
|
|
1269
|
+
if (!L)
|
|
1270
|
+
return;
|
|
1271
|
+
const I = y.results, K = P(L);
|
|
1272
|
+
if (E(I), d?.(L?.full_name || "form"), _.current?.setErrors(K), !L.submitted || y?.status !== 200 || Object.entries(K).length)
|
|
1224
1273
|
return;
|
|
1225
|
-
|
|
1226
|
-
|
|
1274
|
+
if (!h) {
|
|
1275
|
+
p();
|
|
1227
1276
|
return;
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1277
|
+
}
|
|
1278
|
+
_.current?.success();
|
|
1279
|
+
const Z = () => {
|
|
1280
|
+
I.redirect && !o && i(a(I.redirect.route, { ...f.parameters || {}, ...I.redirect.parameters }), !0);
|
|
1231
1281
|
};
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1282
|
+
if (e) {
|
|
1283
|
+
const ie = e(I);
|
|
1284
|
+
ie instanceof Promise ? ie.then(() => Z()) : Z();
|
|
1285
|
+
} else
|
|
1286
|
+
Z();
|
|
1287
|
+
}, [y?.results]);
|
|
1288
|
+
const S = b?.form?.modify?.view;
|
|
1289
|
+
if (S)
|
|
1290
|
+
return /* @__PURE__ */ r($n, { loader: S.full_name, children: /* @__PURE__ */ r(
|
|
1237
1291
|
At,
|
|
1238
1292
|
{
|
|
1239
|
-
ref:
|
|
1240
|
-
id:
|
|
1241
|
-
name:
|
|
1242
|
-
action:
|
|
1293
|
+
ref: _,
|
|
1294
|
+
id: S.id || "form",
|
|
1295
|
+
name: S.name || "form",
|
|
1296
|
+
action: m,
|
|
1243
1297
|
method: "POST",
|
|
1244
|
-
onSubmit:
|
|
1245
|
-
children: /* @__PURE__ */ r(
|
|
1246
|
-
|
|
1298
|
+
onSubmit: D,
|
|
1299
|
+
children: /* @__PURE__ */ r(oe, { view: S, children: /* @__PURE__ */ r(T, { name: "content", children: /* @__PURE__ */ C(
|
|
1300
|
+
j,
|
|
1247
1301
|
{
|
|
1248
|
-
view:
|
|
1302
|
+
view: S.name || "form",
|
|
1249
1303
|
prefix: "modify/form",
|
|
1250
|
-
data:
|
|
1304
|
+
data: S,
|
|
1251
1305
|
children: [
|
|
1252
|
-
/* @__PURE__ */ r(T, { name: "messages", children: Object.keys(
|
|
1306
|
+
/* @__PURE__ */ r(T, { name: "messages", children: Object.keys(b?.messages || {}).map((L, I) => /* @__PURE__ */ r(
|
|
1253
1307
|
"div",
|
|
1254
1308
|
{
|
|
1255
|
-
className: ["alert", "alert-" +
|
|
1256
|
-
children: (
|
|
1309
|
+
className: ["alert", "alert-" + L].join(" "),
|
|
1310
|
+
children: (b?.messages[L] || ["Item was saved successful."]).join(" ")
|
|
1257
1311
|
},
|
|
1258
|
-
"alert-" +
|
|
1312
|
+
"alert-" + L
|
|
1259
1313
|
)) }),
|
|
1260
1314
|
/* @__PURE__ */ r(mr, { className: "alert alert-danger" }),
|
|
1261
|
-
/* @__PURE__ */ r(
|
|
1262
|
-
/* @__PURE__ */ r(T, { name: "actions", children: /* @__PURE__ */ r(
|
|
1315
|
+
/* @__PURE__ */ r(fr, {}),
|
|
1316
|
+
/* @__PURE__ */ r(T, { name: "actions", children: /* @__PURE__ */ r(he, { type: "submit", className: "btn btn-primary", children: /* @__PURE__ */ r(k, { children: "Save" }) }) })
|
|
1263
1317
|
]
|
|
1264
1318
|
},
|
|
1265
|
-
|
|
1319
|
+
S.id || "form"
|
|
1266
1320
|
) }) })
|
|
1267
1321
|
}
|
|
1268
1322
|
) });
|
|
1269
|
-
}), { name: "form" }), Zt =
|
|
1323
|
+
}), { name: "form" }), Zt = Ne(He(({
|
|
1270
1324
|
children: e,
|
|
1271
1325
|
...t
|
|
1272
1326
|
}, n) => {
|
|
1273
|
-
const { closeModal: o, modal: s } =
|
|
1327
|
+
const { closeModal: o, modal: s } = Xe(), {
|
|
1274
1328
|
open: i = !0,
|
|
1275
1329
|
animation: a = "fade",
|
|
1276
1330
|
backdrop: c = !0,
|
|
1277
|
-
keyboard:
|
|
1278
|
-
size:
|
|
1331
|
+
keyboard: f = !0,
|
|
1332
|
+
size: u,
|
|
1279
1333
|
onClose: p,
|
|
1280
|
-
className:
|
|
1281
|
-
} = { ...t, ...s?.props || {} }, [
|
|
1282
|
-
|
|
1283
|
-
toggle: () => E(!
|
|
1334
|
+
className: m
|
|
1335
|
+
} = { ...t, ...s?.props || {} }, [b, E] = R(i);
|
|
1336
|
+
fe(n, () => ({
|
|
1337
|
+
toggle: () => E(!b),
|
|
1284
1338
|
open: () => E(!0),
|
|
1285
1339
|
close: () => g(),
|
|
1286
|
-
isOpen: () =>
|
|
1340
|
+
isOpen: () => b
|
|
1287
1341
|
})), N(() => {
|
|
1288
1342
|
E(i);
|
|
1289
1343
|
}, [i]);
|
|
1290
1344
|
const _ = (h) => {
|
|
1291
|
-
if (
|
|
1345
|
+
if (f)
|
|
1292
1346
|
switch (h.key) {
|
|
1293
1347
|
case "Escape": {
|
|
1294
1348
|
g();
|
|
@@ -1297,45 +1351,45 @@ const hr = xe(de(({ onSuccess: e, onError: t, onLoad: n, embedded: o = !1 }, s)
|
|
|
1297
1351
|
}
|
|
1298
1352
|
};
|
|
1299
1353
|
N(() => {
|
|
1300
|
-
if (!
|
|
1354
|
+
if (!b)
|
|
1301
1355
|
return;
|
|
1302
1356
|
const h = () => {
|
|
1303
|
-
|
|
1357
|
+
y.current?.addEventListener("animationend", x);
|
|
1304
1358
|
}, x = () => {
|
|
1305
|
-
|
|
1359
|
+
y.current?.classList.remove(a), y.current?.removeEventListener("animationstart", h), y.current?.removeEventListener("animationend", x);
|
|
1306
1360
|
};
|
|
1307
1361
|
return setTimeout(() => {
|
|
1308
|
-
|
|
1309
|
-
}, a ? 100 : 0), document.addEventListener("keydown", _),
|
|
1310
|
-
document.removeEventListener("keydown", _),
|
|
1362
|
+
y.current?.classList.add("d-block", "show"), l?.current?.classList.add("show");
|
|
1363
|
+
}, a ? 100 : 0), document.addEventListener("keydown", _), y.current?.addEventListener("animationstart", h), () => {
|
|
1364
|
+
document.removeEventListener("keydown", _), y.current?.removeEventListener("animationstart", h), y.current?.removeEventListener("animationend", x);
|
|
1311
1365
|
};
|
|
1312
|
-
}, [
|
|
1313
|
-
const
|
|
1366
|
+
}, [b]);
|
|
1367
|
+
const y = O(null), l = O(null), d = () => {
|
|
1314
1368
|
E(!1), o?.();
|
|
1315
1369
|
}, g = () => new Promise((h, x) => {
|
|
1316
|
-
if (!
|
|
1370
|
+
if (!b)
|
|
1317
1371
|
return h();
|
|
1318
1372
|
const P = () => {
|
|
1319
|
-
|
|
1373
|
+
y?.current?.classList.remove("show", "d-block"), h(), d();
|
|
1320
1374
|
};
|
|
1321
1375
|
if (a) {
|
|
1322
|
-
const
|
|
1376
|
+
const D = setTimeout(() => {
|
|
1323
1377
|
P();
|
|
1324
1378
|
}, a ? 50 : 0);
|
|
1325
|
-
|
|
1326
|
-
clearTimeout(
|
|
1327
|
-
}),
|
|
1379
|
+
y.current?.addEventListener("animationstart", () => {
|
|
1380
|
+
clearTimeout(D), y.current?.removeEventListener("animationend", P), y.current?.addEventListener("animationend", P);
|
|
1381
|
+
}), y.current?.classList.add(a, "close");
|
|
1328
1382
|
} else
|
|
1329
1383
|
P();
|
|
1330
1384
|
});
|
|
1331
1385
|
return N(() => () => {
|
|
1332
1386
|
p && p();
|
|
1333
|
-
}, []),
|
|
1387
|
+
}, []), b && Tn(/* @__PURE__ */ C(A, { children: [
|
|
1334
1388
|
/* @__PURE__ */ r(
|
|
1335
1389
|
"div",
|
|
1336
1390
|
{
|
|
1337
|
-
ref:
|
|
1338
|
-
className: ["modal",
|
|
1391
|
+
ref: y,
|
|
1392
|
+
className: ["modal", u && "modal-" + u, a && a, m].filter((h) => h).join(" "),
|
|
1339
1393
|
children: /* @__PURE__ */ r("div", { className: "modal-dialog modal-dialog-centered", role: "document", children: /* @__PURE__ */ C("div", { className: "modal-content", children: [
|
|
1340
1394
|
/* @__PURE__ */ r(T, { name: "header", children: /* @__PURE__ */ C("div", { className: "modal-header", children: [
|
|
1341
1395
|
/* @__PURE__ */ r("h5", { className: "modal-title", id: "exampleModalLabel", children: /* @__PURE__ */ r(T, { name: "title", children: "Title" }) }),
|
|
@@ -1355,7 +1409,7 @@ const hr = xe(de(({ onSuccess: e, onError: t, onLoad: n, embedded: o = !1 }, s)
|
|
|
1355
1409
|
}
|
|
1356
1410
|
)
|
|
1357
1411
|
] }), document.body);
|
|
1358
|
-
}), { name: "modal" }),
|
|
1412
|
+
}), { name: "modal" }), br = ({
|
|
1359
1413
|
animationData: e,
|
|
1360
1414
|
path: t,
|
|
1361
1415
|
options: n,
|
|
@@ -1364,50 +1418,55 @@ const hr = xe(de(({ onSuccess: e, onError: t, onLoad: n, embedded: o = !1 }, s)
|
|
|
1364
1418
|
className: i,
|
|
1365
1419
|
...a
|
|
1366
1420
|
}) => {
|
|
1367
|
-
const c =
|
|
1421
|
+
const c = O(null);
|
|
1368
1422
|
return N(() => {
|
|
1369
1423
|
if (!c.current)
|
|
1370
1424
|
return;
|
|
1371
|
-
const u = In.loadAnimation({
|
|
1425
|
+
const f = n?.autoplay !== void 0 ? n?.autoplay : !0, u = In.loadAnimation({
|
|
1372
1426
|
renderer: "svg",
|
|
1373
1427
|
loop: !1,
|
|
1374
|
-
autoplay: !0,
|
|
1375
1428
|
rendererSettings: {
|
|
1376
1429
|
preserveAspectRatio: "xMidYMid meet"
|
|
1377
1430
|
},
|
|
1378
1431
|
animationData: e,
|
|
1379
1432
|
path: t,
|
|
1380
1433
|
container: c.current,
|
|
1381
|
-
...n || {}
|
|
1434
|
+
...n || {},
|
|
1435
|
+
autoplay: !1
|
|
1382
1436
|
});
|
|
1383
|
-
|
|
1384
|
-
|
|
1437
|
+
let p = null;
|
|
1438
|
+
return f && (p = new IntersectionObserver((m) => {
|
|
1439
|
+
m.forEach((b) => {
|
|
1440
|
+
b.isIntersecting && u.play();
|
|
1441
|
+
});
|
|
1442
|
+
}), p.observe(c.current)), () => {
|
|
1443
|
+
p?.disconnect(), u.destroy();
|
|
1385
1444
|
};
|
|
1386
1445
|
}, []), /* @__PURE__ */ r("div", { className: i, ref: c, style: { width: o, height: s } });
|
|
1387
1446
|
}, Xt = v.createContext(void 0);
|
|
1388
|
-
var
|
|
1389
|
-
function
|
|
1447
|
+
var ee = /* @__PURE__ */ ((e) => (e[e.success = 0] = "success", e[e.denied = 1] = "denied", e[e.warning = 2] = "warning", e[e.info = 3] = "info", e[e.confirm = 4] = "confirm", e))(ee || {});
|
|
1448
|
+
function We() {
|
|
1390
1449
|
const e = v.useContext(Xt);
|
|
1391
1450
|
if (e === void 0)
|
|
1392
1451
|
throw new Error("UseAlert must be within AlertProvider");
|
|
1393
1452
|
return e;
|
|
1394
1453
|
}
|
|
1395
1454
|
function en({ children: e }) {
|
|
1396
|
-
const [t, n] = R(), o =
|
|
1455
|
+
const [t, n] = R(), o = O(0), s = O(void 0), [i, a] = R(null);
|
|
1397
1456
|
N(() => {
|
|
1398
1457
|
o.current += 1;
|
|
1399
1458
|
}, [t]);
|
|
1400
|
-
const c = /* @__PURE__ */ Object.assign({ "/src/assets/images/alert/denied.json": () => import("./denied-CgoMpaA7.js"), "/src/assets/images/alert/info.json": () => import("./info-D-NzIEYs.js"), "/src/assets/images/alert/success.json": () => import("./success-Bu_BJcf1.js"), "/src/assets/images/alert/warning.json": () => import("./warning-B1nr7TsB.js") }),
|
|
1459
|
+
const c = /* @__PURE__ */ Object.assign({ "/src/assets/images/alert/denied.json": () => import("./denied-CgoMpaA7.js"), "/src/assets/images/alert/info.json": () => import("./info-D-NzIEYs.js"), "/src/assets/images/alert/success.json": () => import("./success-Bu_BJcf1.js"), "/src/assets/images/alert/warning.json": () => import("./warning-B1nr7TsB.js") }), f = () => {
|
|
1401
1460
|
a(null), n(void 0);
|
|
1402
|
-
},
|
|
1403
|
-
let
|
|
1461
|
+
}, u = (m) => {
|
|
1462
|
+
let b = {
|
|
1404
1463
|
title: "Are you confirm?",
|
|
1405
1464
|
icon: 3,
|
|
1406
1465
|
animation: "scale",
|
|
1407
1466
|
size: "auto",
|
|
1408
1467
|
allowClose: !1,
|
|
1409
1468
|
timeoutProgress: !1,
|
|
1410
|
-
...
|
|
1469
|
+
...m || {}
|
|
1411
1470
|
};
|
|
1412
1471
|
const E = {
|
|
1413
1472
|
0: "success.json",
|
|
@@ -1416,13 +1475,13 @@ function en({ children: e }) {
|
|
|
1416
1475
|
3: "info.json",
|
|
1417
1476
|
4: "info.json"
|
|
1418
1477
|
};
|
|
1419
|
-
if (Object.hasOwn(E,
|
|
1420
|
-
const _ = E[
|
|
1421
|
-
|
|
1478
|
+
if (Object.hasOwn(E, b.icon)) {
|
|
1479
|
+
const _ = E[b.icon], y = Object.keys(c).filter((l) => l.endsWith(_)).pop();
|
|
1480
|
+
y && c[y]().then((l) => {
|
|
1422
1481
|
a(l.default);
|
|
1423
1482
|
});
|
|
1424
1483
|
}
|
|
1425
|
-
!
|
|
1484
|
+
!b.actions && !b.timeoutProgress ? b.actions = {
|
|
1426
1485
|
cancel: {
|
|
1427
1486
|
label: "Cancel",
|
|
1428
1487
|
classList: ["btn-outline-primary"]
|
|
@@ -1431,20 +1490,20 @@ function en({ children: e }) {
|
|
|
1431
1490
|
label: "Confirm"
|
|
1432
1491
|
}
|
|
1433
1492
|
} : setTimeout(() => {
|
|
1434
|
-
s.current?.close().finally(
|
|
1435
|
-
},
|
|
1436
|
-
n(
|
|
1437
|
-
}) : n(
|
|
1438
|
-
}, p = (
|
|
1439
|
-
const
|
|
1440
|
-
[
|
|
1441
|
-
isConfirmed:
|
|
1442
|
-
isCancelled:
|
|
1443
|
-
isDenied:
|
|
1493
|
+
s.current?.close().finally(f);
|
|
1494
|
+
}, b.timeout || 1e3), s.current?.isOpen() ? s.current?.close().finally(() => {
|
|
1495
|
+
n(b);
|
|
1496
|
+
}) : n(b);
|
|
1497
|
+
}, p = (m) => {
|
|
1498
|
+
const b = {
|
|
1499
|
+
[m]: !0,
|
|
1500
|
+
isConfirmed: m === "confirm",
|
|
1501
|
+
isCancelled: m === "cancel",
|
|
1502
|
+
isDenied: m === "deny"
|
|
1444
1503
|
};
|
|
1445
|
-
t?.onResult && t.onResult(
|
|
1504
|
+
t?.onResult && t.onResult(b), s.current?.close().then(f);
|
|
1446
1505
|
};
|
|
1447
|
-
return /* @__PURE__ */ C(Xt.Provider, { value: { open:
|
|
1506
|
+
return /* @__PURE__ */ C(Xt.Provider, { value: { open: u }, children: [
|
|
1448
1507
|
t && /* @__PURE__ */ C(
|
|
1449
1508
|
Zt,
|
|
1450
1509
|
{
|
|
@@ -1457,17 +1516,17 @@ function en({ children: e }) {
|
|
|
1457
1516
|
/* @__PURE__ */ r(H, { name: "header" }),
|
|
1458
1517
|
/* @__PURE__ */ r(H, { name: "footer" }),
|
|
1459
1518
|
/* @__PURE__ */ r(H, { name: "content", children: /* @__PURE__ */ C("div", { className: "d-flex flex-column align-items-center", children: [
|
|
1460
|
-
i !== null && /* @__PURE__ */ r(
|
|
1519
|
+
i !== null && /* @__PURE__ */ r(br, { className: "modal-alert-icon", animationData: i }),
|
|
1461
1520
|
/* @__PURE__ */ r("h3", { className: "modal-alert-title", children: t.title }),
|
|
1462
1521
|
!!t.text?.length && /* @__PURE__ */ r("p", { className: "modal-alert-text", children: t.text }),
|
|
1463
|
-
t.actions && /* @__PURE__ */ r("div", { className: "d-flex justify-content-center align-items-center", children: Object.keys(t.actions).map((
|
|
1464
|
-
|
|
1522
|
+
t.actions && /* @__PURE__ */ r("div", { className: "d-flex justify-content-center align-items-center", children: Object.keys(t.actions).map((m) => /* @__PURE__ */ r(
|
|
1523
|
+
he,
|
|
1465
1524
|
{
|
|
1466
|
-
className: "btn btn-lg mx-2 " + (t.actions?.[
|
|
1467
|
-
onClick: () => p(
|
|
1468
|
-
children: (t.actions?.[
|
|
1525
|
+
className: "btn btn-lg mx-2 " + (t.actions?.[m].classList ?? ["btn-primary"]).join(" "),
|
|
1526
|
+
onClick: () => p(m),
|
|
1527
|
+
children: (t.actions?.[m] ?? null)?.label || m
|
|
1469
1528
|
},
|
|
1470
|
-
|
|
1529
|
+
m
|
|
1471
1530
|
)) })
|
|
1472
1531
|
] }) })
|
|
1473
1532
|
]
|
|
@@ -1477,15 +1536,15 @@ function en({ children: e }) {
|
|
|
1477
1536
|
e
|
|
1478
1537
|
] });
|
|
1479
1538
|
}
|
|
1480
|
-
function
|
|
1539
|
+
function $o(e) {
|
|
1481
1540
|
return (t) => /* @__PURE__ */ r(en, { children: /* @__PURE__ */ r(e, { ...t }) });
|
|
1482
1541
|
}
|
|
1483
|
-
const
|
|
1484
|
-
const { action: t } =
|
|
1542
|
+
const yr = Ne(({ children: e }) => {
|
|
1543
|
+
const { action: t } = ne(), { getAction: n, generateLink: o } = M(), s = n(t.action.entity, "list", t.action.namespace);
|
|
1485
1544
|
return /* @__PURE__ */ C("section", { className: "edit", children: [
|
|
1486
1545
|
/* @__PURE__ */ C("header", { children: [
|
|
1487
1546
|
/* @__PURE__ */ C("h2", { className: "title", children: [
|
|
1488
|
-
s && /* @__PURE__ */ r(
|
|
1547
|
+
s && /* @__PURE__ */ r(U, { to: o(s.route, t.parameters), children: "←" }),
|
|
1489
1548
|
/* @__PURE__ */ r(T, { name: "title" })
|
|
1490
1549
|
] }),
|
|
1491
1550
|
/* @__PURE__ */ r("nav", { children: /* @__PURE__ */ r(T, { name: "navigation" }) })
|
|
@@ -1496,38 +1555,38 @@ const br = xe(({ children: e }) => {
|
|
|
1496
1555
|
] })
|
|
1497
1556
|
] });
|
|
1498
1557
|
}, { name: "modify" }), st = Mt(({ template: e, children: t, onSuccess: n, modal: o }) => {
|
|
1499
|
-
const { open: s } =
|
|
1558
|
+
const { open: s } = We(), { closeModal: i } = Xe(), a = re(), c = o ? Zt : e || yr;
|
|
1500
1559
|
if (a)
|
|
1501
1560
|
return /* @__PURE__ */ C(c, { children: [
|
|
1502
|
-
/* @__PURE__ */ r(H, { name: "title", children: /* @__PURE__ */ r(
|
|
1503
|
-
/* @__PURE__ */ r(H, { name: "navigation", children: /* @__PURE__ */ r(
|
|
1504
|
-
/* @__PURE__ */ r(H, { name: "content", children: /* @__PURE__ */ r(
|
|
1505
|
-
|
|
1561
|
+
/* @__PURE__ */ r(H, { name: "title", children: /* @__PURE__ */ r(k, { children: a?.results?.title || "Title" }) }),
|
|
1562
|
+
/* @__PURE__ */ r(H, { name: "navigation", children: /* @__PURE__ */ r(j, { view: "navigation", prefix: "modify" }) }),
|
|
1563
|
+
/* @__PURE__ */ r(H, { name: "content", children: /* @__PURE__ */ r(j, { view: "content", prefix: "modify", children: /* @__PURE__ */ r(
|
|
1564
|
+
gr,
|
|
1506
1565
|
{
|
|
1507
|
-
onSuccess: (
|
|
1566
|
+
onSuccess: (f) => new Promise((u, p) => {
|
|
1508
1567
|
i();
|
|
1509
|
-
const
|
|
1510
|
-
if (n && n(
|
|
1568
|
+
const m = new CustomEvent("success", { detail: f, cancelable: !0 });
|
|
1569
|
+
if (n && n(m, f), m.defaultPrevented)
|
|
1511
1570
|
return p();
|
|
1512
1571
|
s({
|
|
1513
1572
|
title: "Success",
|
|
1514
|
-
text: Object.values(
|
|
1515
|
-
icon:
|
|
1573
|
+
text: Object.values(f.messages?.success ?? []).join(" ") ?? "Item was saved successful!",
|
|
1574
|
+
icon: ee.success,
|
|
1516
1575
|
actions: {
|
|
1517
1576
|
close: {
|
|
1518
1577
|
label: "OK"
|
|
1519
1578
|
}
|
|
1520
1579
|
},
|
|
1521
1580
|
onResult: () => {
|
|
1522
|
-
|
|
1581
|
+
u();
|
|
1523
1582
|
}
|
|
1524
1583
|
});
|
|
1525
1584
|
}),
|
|
1526
|
-
onError: (
|
|
1585
|
+
onError: (f) => {
|
|
1527
1586
|
s({
|
|
1528
|
-
title:
|
|
1529
|
-
text:
|
|
1530
|
-
icon:
|
|
1587
|
+
title: f.status + " " + f.detail,
|
|
1588
|
+
text: f.detail,
|
|
1589
|
+
icon: ee.denied,
|
|
1531
1590
|
actions: {
|
|
1532
1591
|
close: {
|
|
1533
1592
|
label: "OK"
|
|
@@ -1542,24 +1601,24 @@ const br = xe(({ children: e }) => {
|
|
|
1542
1601
|
}
|
|
1543
1602
|
) }) }),
|
|
1544
1603
|
/* @__PURE__ */ r(H, { name: "actions", children: /* @__PURE__ */ r(
|
|
1545
|
-
|
|
1604
|
+
he,
|
|
1546
1605
|
{
|
|
1547
1606
|
type: "submit",
|
|
1548
1607
|
className: "btn btn-primary",
|
|
1549
1608
|
form: a?.results?.form?.modify?.view.full_name || "modify",
|
|
1550
|
-
children: /* @__PURE__ */ r(
|
|
1609
|
+
children: /* @__PURE__ */ r(k, { children: "Submit" })
|
|
1551
1610
|
}
|
|
1552
1611
|
) }),
|
|
1553
1612
|
t
|
|
1554
1613
|
] });
|
|
1555
1614
|
});
|
|
1556
|
-
var
|
|
1615
|
+
var ze = /* @__PURE__ */ ((e) => (e.List = "list", e.Object = "object", e.Internal = "internal", e))(ze || {});
|
|
1557
1616
|
const tn = v.createContext(void 0);
|
|
1558
1617
|
function $() {
|
|
1559
1618
|
const e = v.useContext(tn);
|
|
1560
1619
|
if (e === void 0)
|
|
1561
1620
|
throw new Error("UseList must be within ListProvider");
|
|
1562
|
-
const { data: t, onClick: n } = e, o = t?.entity?.primaryColumn, s = (t?.entity?.columns || []).filter((
|
|
1621
|
+
const { data: t, onClick: n } = e, o = t?.entity?.primaryColumn, s = (t?.entity?.columns || []).filter((u) => u.visible).filter((u) => u.group !== !1), i = Object.values(t?.action || []), a = i.filter((u) => u.visibility === ze.Object), c = s.length + (i.length ? 1 : 0), f = t?.entity?.data.items ?? [];
|
|
1563
1622
|
return {
|
|
1564
1623
|
data: t,
|
|
1565
1624
|
columns: s,
|
|
@@ -1567,16 +1626,16 @@ function $() {
|
|
|
1567
1626
|
objectActions: a,
|
|
1568
1627
|
columnsTotal: c,
|
|
1569
1628
|
primaryColumn: o,
|
|
1570
|
-
items:
|
|
1629
|
+
items: f,
|
|
1571
1630
|
onClick: n
|
|
1572
1631
|
};
|
|
1573
1632
|
}
|
|
1574
|
-
function
|
|
1575
|
-
const { results: o } =
|
|
1633
|
+
function vr({ data: e, onClick: t, ...n }) {
|
|
1634
|
+
const { results: o } = re() || {};
|
|
1576
1635
|
return e ??= o, /* @__PURE__ */ r(tn.Provider, { value: { data: e, onClick: t }, children: n.children });
|
|
1577
1636
|
}
|
|
1578
1637
|
const nn = v.createContext(void 0);
|
|
1579
|
-
function
|
|
1638
|
+
function ge() {
|
|
1580
1639
|
const e = v.useContext(nn);
|
|
1581
1640
|
if (e === void 0)
|
|
1582
1641
|
throw new Error("UseListItem must be within ListItemProvider");
|
|
@@ -1591,31 +1650,31 @@ function rn({ index: e, ...t }) {
|
|
|
1591
1650
|
return /* @__PURE__ */ r(nn.Provider, { value: { index: e }, children: t.children });
|
|
1592
1651
|
}
|
|
1593
1652
|
const on = ({ column: e, namespace: t }) => {
|
|
1594
|
-
const { data: n } =
|
|
1595
|
-
return n && /* @__PURE__ */ r(
|
|
1653
|
+
const { data: n } = ge();
|
|
1654
|
+
return n && /* @__PURE__ */ r(j, { namespace: t, data: n, prefix: "list", view: e.field, children: n[e.field] !== void 0 && (n[e.field] instanceof Object ? n[e.field] instanceof Array ? n[e.field].join(", ") : JSON.stringify(n[e.field]) : /* @__PURE__ */ r(k, { children: n[e.field]?.toString() })) });
|
|
1596
1655
|
}, sn = v.createContext(void 0);
|
|
1597
1656
|
function an() {
|
|
1598
1657
|
return v.useContext(sn);
|
|
1599
1658
|
}
|
|
1600
|
-
function
|
|
1601
|
-
const { data: n, items: o, primaryColumn: s } = $(), i =
|
|
1659
|
+
function Er({ onClick: e, ...t }) {
|
|
1660
|
+
const { data: n, items: o, primaryColumn: s } = $(), i = O([]), a = o.map((l) => l[s?.field || ""] || 0), c = !!a.length && a.reduce((l, d) => l && i.current.includes(d), !0), f = n?.form?.batch?.view?.children?.method?.choices?.reduce((l, d) => {
|
|
1602
1661
|
const g = d.label instanceof Function ? d.label(d) : d.label, h = d.value instanceof Function ? d.value() : d.value?.toString();
|
|
1603
1662
|
return { ...l, [h]: g };
|
|
1604
|
-
}, {}),
|
|
1663
|
+
}, {}), u = !!Object.keys(f || {}).length && s, [, p] = R(), m = (l, d = !1) => {
|
|
1605
1664
|
const g = a[l];
|
|
1606
1665
|
d ? i.current.push(g) : i.current = i.current.filter((h) => h !== g), p({});
|
|
1607
|
-
},
|
|
1666
|
+
}, b = (l = !1) => {
|
|
1608
1667
|
i.current = (l ? i.current.concat(a) : i.current.filter((d) => !a.includes(d))).filter((d, g, h) => h.indexOf(d) === g), p({});
|
|
1609
1668
|
}, E = () => {
|
|
1610
1669
|
i.current = [], p({});
|
|
1611
1670
|
}, _ = (l) => {
|
|
1612
1671
|
const d = a[l];
|
|
1613
1672
|
return i.current.includes(d);
|
|
1614
|
-
},
|
|
1673
|
+
}, y = (l) => new Promise((d, g) => {
|
|
1615
1674
|
if (!i)
|
|
1616
1675
|
return g();
|
|
1617
1676
|
const h = n?.form.batch.view;
|
|
1618
|
-
if (!
|
|
1677
|
+
if (!u || !i.current?.length)
|
|
1619
1678
|
return g();
|
|
1620
1679
|
const x = new FormData();
|
|
1621
1680
|
i.current.forEach((P) => {
|
|
@@ -1628,12 +1687,12 @@ function vr({ onClick: e, ...t }) {
|
|
|
1628
1687
|
sn.Provider,
|
|
1629
1688
|
{
|
|
1630
1689
|
value: {
|
|
1631
|
-
actions:
|
|
1632
|
-
toggle:
|
|
1633
|
-
toggleAll:
|
|
1690
|
+
actions: f,
|
|
1691
|
+
toggle: m,
|
|
1692
|
+
toggleAll: b,
|
|
1634
1693
|
isSelected: _,
|
|
1635
1694
|
isSelectedAll: c,
|
|
1636
|
-
executeAction:
|
|
1695
|
+
executeAction: y,
|
|
1637
1696
|
selected: i.current,
|
|
1638
1697
|
clear: E
|
|
1639
1698
|
},
|
|
@@ -1642,7 +1701,7 @@ function vr({ onClick: e, ...t }) {
|
|
|
1642
1701
|
);
|
|
1643
1702
|
}
|
|
1644
1703
|
const cn = ({ className: e }) => {
|
|
1645
|
-
const { index: t } =
|
|
1704
|
+
const { index: t } = ge(), n = an();
|
|
1646
1705
|
if (!n)
|
|
1647
1706
|
return /* @__PURE__ */ r(A, {});
|
|
1648
1707
|
const { actions: o, toggle: s, isSelected: i } = n;
|
|
@@ -1656,44 +1715,44 @@ const cn = ({ className: e }) => {
|
|
|
1656
1715
|
onChange: (a) => s(t, a.target.checked)
|
|
1657
1716
|
}
|
|
1658
1717
|
) });
|
|
1659
|
-
}, ln = ({ column: e, namespace: t }) => /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(
|
|
1660
|
-
const { generateActionLink: o } =
|
|
1718
|
+
}, ln = ({ column: e, namespace: t }) => /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(j, { namespace: t, data: e, prefix: "list", view: e.field + ".label", children: /* @__PURE__ */ r(k, { children: e.label }) }) }), dn = ({ children: e, action: t, className: n }) => {
|
|
1719
|
+
const { generateActionLink: o } = M(), { onClick: s } = $();
|
|
1661
1720
|
return /* @__PURE__ */ r(
|
|
1662
|
-
|
|
1721
|
+
U,
|
|
1663
1722
|
{
|
|
1664
1723
|
onClick: (i) => {
|
|
1665
1724
|
s && s(t, i);
|
|
1666
1725
|
},
|
|
1667
1726
|
className: n,
|
|
1668
1727
|
to: o(t),
|
|
1669
|
-
children: e ?? /* @__PURE__ */ r(
|
|
1728
|
+
children: e ?? /* @__PURE__ */ r(k, { children: t.action.title ?? t.action.name })
|
|
1670
1729
|
}
|
|
1671
1730
|
);
|
|
1672
|
-
},
|
|
1673
|
-
const { results: o } =
|
|
1731
|
+
}, Cr = ({ permission: e, children: t, id: n }) => {
|
|
1732
|
+
const { results: o } = re() || {}, { id: s } = n ? { id: n } : ge();
|
|
1674
1733
|
if (!(e && !Object.values(o?.entity.acl[e] || []).map((i) => i.toString()).includes(s.toString())))
|
|
1675
1734
|
return /* @__PURE__ */ r(A, { children: t });
|
|
1676
|
-
},
|
|
1677
|
-
const { id: n } =
|
|
1678
|
-
return /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(
|
|
1735
|
+
}, _r = ({ action: e, ...t }) => {
|
|
1736
|
+
const { id: n } = ge();
|
|
1737
|
+
return /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(Cr, { permission: e.action.permission, children: /* @__PURE__ */ r(dn, { ...t, action: { ...e, parameters: { ...e.parameters, id: n } } }) }) });
|
|
1679
1738
|
}, un = ({ namespace: e, routeParams: t }) => {
|
|
1680
|
-
const { objectActions: n } = $(), { data: o } =
|
|
1681
|
-
return o && /* @__PURE__ */ r(
|
|
1682
|
-
|
|
1739
|
+
const { objectActions: n } = $(), { data: o } = ge();
|
|
1740
|
+
return o && /* @__PURE__ */ r(j, { namespace: e, data: o, prefix: "list", view: "object.actions", children: n.map((s, i) => /* @__PURE__ */ r(
|
|
1741
|
+
_r,
|
|
1683
1742
|
{
|
|
1684
1743
|
action: { action: s, parameters: t },
|
|
1685
1744
|
className: ["btn", "btn-sm", "mb-1", "ms-1", (s.route?.methods ?? []).includes("DELETE") ? "btn-outline-danger" : "btn-outline-secondary"].join(" ")
|
|
1686
1745
|
},
|
|
1687
1746
|
i
|
|
1688
1747
|
)) });
|
|
1689
|
-
},
|
|
1748
|
+
}, xr = ({
|
|
1690
1749
|
routeParams: e,
|
|
1691
1750
|
namespace: t,
|
|
1692
1751
|
options: n,
|
|
1693
1752
|
tableOptions: o,
|
|
1694
1753
|
...s
|
|
1695
1754
|
}) => {
|
|
1696
|
-
const { columns: i, primaryColumn: a, objectActions: c, columnsTotal:
|
|
1755
|
+
const { columns: i, primaryColumn: a, objectActions: c, columnsTotal: f, items: u, data: p, onClick: m } = $(), { action: b } = ne(), { options: E } = te(), _ = {
|
|
1697
1756
|
className: "table-responsive",
|
|
1698
1757
|
...s,
|
|
1699
1758
|
...E?.GridView || {}
|
|
@@ -1704,51 +1763,51 @@ const cn = ({ className: e }) => {
|
|
|
1704
1763
|
...o || {}
|
|
1705
1764
|
}, /* @__PURE__ */ r("div", { ..._, children: /* @__PURE__ */ C("table", { ...o, children: [
|
|
1706
1765
|
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ C("tr", { children: [
|
|
1707
|
-
i.map((
|
|
1708
|
-
|
|
1766
|
+
i.map((y, l) => /* @__PURE__ */ tt("th", { ...y?.view?.header?.attr || {}, key: l }, /* @__PURE__ */ r(ln, { column: y, namespace: t }), y.sortable && p?.sort?.[y.field] !== void 0 && /* @__PURE__ */ r(
|
|
1767
|
+
U,
|
|
1709
1768
|
{
|
|
1710
|
-
onClick: (d) =>
|
|
1711
|
-
...
|
|
1769
|
+
onClick: (d) => m && m({
|
|
1770
|
+
...b,
|
|
1712
1771
|
query: {
|
|
1713
|
-
...
|
|
1714
|
-
sort: { [
|
|
1772
|
+
...b.query,
|
|
1773
|
+
sort: { [y.field]: p?.sort[y.field] ? p?.sort[y.field] === "ASC" ? "DESC" : "" : "ASC" }
|
|
1715
1774
|
}
|
|
1716
1775
|
}, d),
|
|
1717
1776
|
className: "btn btn-sm",
|
|
1718
1777
|
to: "#",
|
|
1719
|
-
children: p.sort[
|
|
1778
|
+
children: p.sort[y.field] ? p.sort[y.field] === "ASC" ? "⇑" : "⇓" : "⇅"
|
|
1720
1779
|
}
|
|
1721
1780
|
))),
|
|
1722
|
-
a && c.length > 0 && /* @__PURE__ */ r("th", { className: "text-end", children: /* @__PURE__ */ r(
|
|
1781
|
+
a && c.length > 0 && /* @__PURE__ */ r("th", { className: "text-end", children: /* @__PURE__ */ r(k, { children: "Actions" }) })
|
|
1723
1782
|
] }) }),
|
|
1724
|
-
/* @__PURE__ */ r("tbody", { children:
|
|
1783
|
+
/* @__PURE__ */ r("tbody", { children: u.length ? u.map((y, l) => /* @__PURE__ */ r(rn, { index: l, children: /* @__PURE__ */ C("tr", { children: [
|
|
1725
1784
|
i?.map(
|
|
1726
1785
|
(d, g) => {
|
|
1727
1786
|
const h = n?.columns?.[d.field];
|
|
1728
1787
|
return d = {
|
|
1729
1788
|
...d,
|
|
1730
1789
|
...h instanceof Function ? h(p?.entity?.data.items[l]) : n?.columns?.[d.field]
|
|
1731
|
-
}, /* @__PURE__ */
|
|
1790
|
+
}, /* @__PURE__ */ tt("td", { ...d?.view?.content?.attr || {}, key: g }, g === 0 && /* @__PURE__ */ r(cn, { className: "me-2" }), /* @__PURE__ */ r(on, { column: d, namespace: t }));
|
|
1732
1791
|
}
|
|
1733
1792
|
),
|
|
1734
1793
|
a && c.length > 0 && /* @__PURE__ */ r("td", { className: "text-end text-nowrap", children: /* @__PURE__ */ r(un, { routeParams: e, namespace: t }) })
|
|
1735
|
-
] }) }, l)) : /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan:
|
|
1794
|
+
] }) }, l)) : /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan: f, children: /* @__PURE__ */ r(k, { children: "Not results found." }) }) }) })
|
|
1736
1795
|
] }) });
|
|
1737
|
-
},
|
|
1738
|
-
const { generateActionLink: s } =
|
|
1796
|
+
}, ae = ({ page: e, active: t = !1, title: n, children: o }) => {
|
|
1797
|
+
const { generateActionLink: s } = M(), { onClick: i } = $(), { action: a } = ne(), c = {
|
|
1739
1798
|
...a,
|
|
1740
1799
|
query: {
|
|
1741
1800
|
...a.query || {},
|
|
1742
1801
|
page: e.toString()
|
|
1743
1802
|
}
|
|
1744
|
-
},
|
|
1803
|
+
}, f = s(c);
|
|
1745
1804
|
return /* @__PURE__ */ r("li", { className: `page-item ${t ? "active" : ""}`, children: /* @__PURE__ */ r(
|
|
1746
|
-
|
|
1805
|
+
U,
|
|
1747
1806
|
{
|
|
1748
|
-
to:
|
|
1807
|
+
to: f.toString(),
|
|
1749
1808
|
...i && {
|
|
1750
|
-
onClick: (
|
|
1751
|
-
i(c,
|
|
1809
|
+
onClick: (u) => {
|
|
1810
|
+
i(c, u);
|
|
1752
1811
|
}
|
|
1753
1812
|
},
|
|
1754
1813
|
className: "page-link",
|
|
@@ -1756,7 +1815,7 @@ const cn = ({ className: e }) => {
|
|
|
1756
1815
|
children: o || e
|
|
1757
1816
|
}
|
|
1758
1817
|
) });
|
|
1759
|
-
},
|
|
1818
|
+
}, Nr = () => {
|
|
1760
1819
|
const { data: e } = $(), t = e?.entity?.data.meta, n = 1, o = t?.totalPages || 0, s = t?.page || n, i = t?.links, a = !!t?.totalPages;
|
|
1761
1820
|
return a && /* @__PURE__ */ C("div", { className: "d-flex flex-column justiry-content-center", children: [
|
|
1762
1821
|
/* @__PURE__ */ C("small", { className: "mb-2", children: [
|
|
@@ -1770,16 +1829,16 @@ const cn = ({ className: e }) => {
|
|
|
1770
1829
|
] })
|
|
1771
1830
|
] }),
|
|
1772
1831
|
a && /* @__PURE__ */ r("nav", { "aria-label": "Page navigation", className: "m-auto text-center d-inline", children: /* @__PURE__ */ C("ul", { className: "pagination pagination-sm", children: [
|
|
1773
|
-
s > n && /* @__PURE__ */ r(
|
|
1832
|
+
s > n && /* @__PURE__ */ r(ae, { page: s - 1, title: "Go to First Page", children: "«" }),
|
|
1774
1833
|
t.links[0] !== n && /* @__PURE__ */ C(A, { children: [
|
|
1775
|
-
/* @__PURE__ */ r(
|
|
1834
|
+
/* @__PURE__ */ r(ae, { page: 1, active: n === s }, 1),
|
|
1776
1835
|
/* @__PURE__ */ r("div", { className: "page-item", children: /* @__PURE__ */ r("a", { className: "page-link", children: "..." }) })
|
|
1777
1836
|
] }),
|
|
1778
|
-
(i || []).map((c,
|
|
1837
|
+
(i || []).map((c, f) => /* @__PURE__ */ r(ae, { page: c, active: c === s }, c)),
|
|
1779
1838
|
[...t.links].reverse()[0] !== o && /* @__PURE__ */ C(A, { children: [
|
|
1780
1839
|
/* @__PURE__ */ r("div", { className: "page-item", children: /* @__PURE__ */ r("a", { className: "page-link", children: "..." }) }),
|
|
1781
1840
|
/* @__PURE__ */ r(
|
|
1782
|
-
|
|
1841
|
+
ae,
|
|
1783
1842
|
{
|
|
1784
1843
|
page: o,
|
|
1785
1844
|
active: o === s
|
|
@@ -1787,10 +1846,10 @@ const cn = ({ className: e }) => {
|
|
|
1787
1846
|
o
|
|
1788
1847
|
)
|
|
1789
1848
|
] }),
|
|
1790
|
-
s < o && /* @__PURE__ */ r(
|
|
1849
|
+
s < o && /* @__PURE__ */ r(ae, { page: t.totalPages, title: "Go to Last Page", children: "»" }, "last")
|
|
1791
1850
|
] }) })
|
|
1792
1851
|
] });
|
|
1793
|
-
}, q = /* @__PURE__ */ new Map(),
|
|
1852
|
+
}, q = /* @__PURE__ */ new Map(), Ae = {
|
|
1794
1853
|
set(e, t, n) {
|
|
1795
1854
|
q.has(e) || q.set(e, /* @__PURE__ */ new Map());
|
|
1796
1855
|
const o = q.get(e);
|
|
@@ -1809,16 +1868,16 @@ const cn = ({ className: e }) => {
|
|
|
1809
1868
|
const n = q.get(e);
|
|
1810
1869
|
n.delete(t), n.size === 0 && q.delete(e);
|
|
1811
1870
|
}
|
|
1812
|
-
},
|
|
1871
|
+
}, wr = 1e3, Fe = "transitionend", fn = (e) => (e && window.CSS && window.CSS.escape && (e = e.replace(/#([^\s"#']+)/g, (t, n) => `#${CSS.escape(n)}`)), e), Ar = (e) => e == null ? `${e}` : Object.prototype.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(), Pr = (e) => {
|
|
1813
1872
|
if (!e)
|
|
1814
1873
|
return 0;
|
|
1815
1874
|
let { transitionDuration: t, transitionDelay: n } = window.getComputedStyle(e);
|
|
1816
1875
|
const o = Number.parseFloat(t), s = Number.parseFloat(n);
|
|
1817
|
-
return !o && !s ? 0 : (t = t.split(",")[0], n = n.split(",")[0], (Number.parseFloat(t) + Number.parseFloat(n)) *
|
|
1818
|
-
},
|
|
1819
|
-
e.dispatchEvent(new Event(
|
|
1820
|
-
},
|
|
1821
|
-
if (!
|
|
1876
|
+
return !o && !s ? 0 : (t = t.split(",")[0], n = n.split(",")[0], (Number.parseFloat(t) + Number.parseFloat(n)) * wr);
|
|
1877
|
+
}, Lr = (e) => {
|
|
1878
|
+
e.dispatchEvent(new Event(Fe));
|
|
1879
|
+
}, W = (e) => !e || typeof e != "object" ? !1 : (typeof e.jquery < "u" && (e = e[0]), typeof e.nodeType < "u"), je = (e) => W(e) ? e.jquery ? e[0] : e : typeof e == "string" && e.length > 0 ? document.querySelector(fn(e)) : null, mn = (e) => {
|
|
1880
|
+
if (!W(e) || e.getClientRects().length === 0)
|
|
1822
1881
|
return !1;
|
|
1823
1882
|
const t = getComputedStyle(e).getPropertyValue("visibility") === "visible", n = e.closest("details:not([open])");
|
|
1824
1883
|
if (!n)
|
|
@@ -1829,43 +1888,43 @@ const cn = ({ className: e }) => {
|
|
|
1829
1888
|
return !1;
|
|
1830
1889
|
}
|
|
1831
1890
|
return t;
|
|
1832
|
-
},
|
|
1833
|
-
},
|
|
1834
|
-
document.readyState === "loading" ? (
|
|
1835
|
-
for (const t of
|
|
1891
|
+
}, Me = (e) => !e || e.nodeType !== Node.ELEMENT_NODE || e.classList.contains("disabled") ? !0 : typeof e.disabled < "u" ? e.disabled : e.hasAttribute("disabled") && e.getAttribute("disabled") !== "false", it = () => {
|
|
1892
|
+
}, hn = () => window.jQuery && !document.body.hasAttribute("data-bs-no-jquery") ? window.jQuery : null, Pe = [], Or = (e) => {
|
|
1893
|
+
document.readyState === "loading" ? (Pe.length || document.addEventListener("DOMContentLoaded", () => {
|
|
1894
|
+
for (const t of Pe)
|
|
1836
1895
|
t();
|
|
1837
|
-
}),
|
|
1838
|
-
},
|
|
1839
|
-
|
|
1840
|
-
const t =
|
|
1896
|
+
}), Pe.push(e)) : e();
|
|
1897
|
+
}, se = () => document.documentElement.dir === "rtl", Sr = (e) => {
|
|
1898
|
+
Or(() => {
|
|
1899
|
+
const t = hn();
|
|
1841
1900
|
if (t) {
|
|
1842
1901
|
const n = e.NAME, o = t.fn[n];
|
|
1843
1902
|
t.fn[n] = e.jQueryInterface, t.fn[n].Constructor = e, t.fn[n].noConflict = () => (t.fn[n] = o, e.jQueryInterface);
|
|
1844
1903
|
}
|
|
1845
1904
|
});
|
|
1846
|
-
},
|
|
1905
|
+
}, Ue = (e, t = [], n = e) => typeof e == "function" ? e.call(...t) : n, kr = (e, t, n = !0) => {
|
|
1847
1906
|
if (!n) {
|
|
1848
|
-
|
|
1907
|
+
Ue(e);
|
|
1849
1908
|
return;
|
|
1850
1909
|
}
|
|
1851
|
-
const s =
|
|
1910
|
+
const s = Pr(t) + 5;
|
|
1852
1911
|
let i = !1;
|
|
1853
1912
|
const a = ({ target: c }) => {
|
|
1854
|
-
c === t && (i = !0, t.removeEventListener(
|
|
1913
|
+
c === t && (i = !0, t.removeEventListener(Fe, a), Ue(e));
|
|
1855
1914
|
};
|
|
1856
|
-
t.addEventListener(
|
|
1857
|
-
i ||
|
|
1915
|
+
t.addEventListener(Fe, a), setTimeout(() => {
|
|
1916
|
+
i || Lr(t);
|
|
1858
1917
|
}, s);
|
|
1859
|
-
},
|
|
1918
|
+
}, Dr = (e, t, n, o) => {
|
|
1860
1919
|
const s = e.length;
|
|
1861
1920
|
let i = e.indexOf(t);
|
|
1862
1921
|
return i === -1 ? !n && o ? e[s - 1] : e[0] : (i += n ? 1 : -1, o && (i = (i + s) % s), e[Math.max(0, Math.min(i, s - 1))]);
|
|
1863
|
-
},
|
|
1922
|
+
}, Rr = /[^.]*(?=\..*)\.|.*/, Tr = /\..*/, Ir = /::\d+$/, Le = {};
|
|
1864
1923
|
let at = 1;
|
|
1865
|
-
const
|
|
1924
|
+
const pn = {
|
|
1866
1925
|
mouseenter: "mouseover",
|
|
1867
1926
|
mouseleave: "mouseout"
|
|
1868
|
-
},
|
|
1927
|
+
}, Fr = /* @__PURE__ */ new Set([
|
|
1869
1928
|
"click",
|
|
1870
1929
|
"dblclick",
|
|
1871
1930
|
"mouseup",
|
|
@@ -1918,20 +1977,20 @@ function gn(e, t) {
|
|
|
1918
1977
|
}
|
|
1919
1978
|
function bn(e) {
|
|
1920
1979
|
const t = gn(e);
|
|
1921
|
-
return e.uidEvent = t,
|
|
1980
|
+
return e.uidEvent = t, Le[t] = Le[t] || {}, Le[t];
|
|
1922
1981
|
}
|
|
1923
1982
|
function jr(e, t) {
|
|
1924
1983
|
return function n(o) {
|
|
1925
|
-
return
|
|
1984
|
+
return Je(o, { delegateTarget: e }), n.oneOff && F.off(e, o.type, t), t.apply(e, [o]);
|
|
1926
1985
|
};
|
|
1927
1986
|
}
|
|
1928
|
-
function
|
|
1987
|
+
function Mr(e, t, n) {
|
|
1929
1988
|
return function o(s) {
|
|
1930
1989
|
const i = e.querySelectorAll(t);
|
|
1931
1990
|
for (let { target: a } = s; a && a !== this; a = a.parentNode)
|
|
1932
1991
|
for (const c of i)
|
|
1933
1992
|
if (c === a)
|
|
1934
|
-
return
|
|
1993
|
+
return Je(s, { delegateTarget: a }), o.oneOff && F.off(e, s.type, t, n), n.apply(a, [s]);
|
|
1935
1994
|
};
|
|
1936
1995
|
}
|
|
1937
1996
|
function yn(e, t, n = null) {
|
|
@@ -1940,37 +1999,37 @@ function yn(e, t, n = null) {
|
|
|
1940
1999
|
function vn(e, t, n) {
|
|
1941
2000
|
const o = typeof t == "string", s = o ? n : t || n;
|
|
1942
2001
|
let i = En(e);
|
|
1943
|
-
return
|
|
2002
|
+
return Fr.has(i) || (i = e), [o, s, i];
|
|
1944
2003
|
}
|
|
1945
2004
|
function ct(e, t, n, o, s) {
|
|
1946
2005
|
if (typeof t != "string" || !e)
|
|
1947
2006
|
return;
|
|
1948
2007
|
let [i, a, c] = vn(t, n, o);
|
|
1949
|
-
t in
|
|
1950
|
-
if (!
|
|
1951
|
-
return _.call(this,
|
|
2008
|
+
t in pn && (a = ((_) => function(y) {
|
|
2009
|
+
if (!y.relatedTarget || y.relatedTarget !== y.delegateTarget && !y.delegateTarget.contains(y.relatedTarget))
|
|
2010
|
+
return _.call(this, y);
|
|
1952
2011
|
})(a));
|
|
1953
|
-
const
|
|
2012
|
+
const f = bn(e), u = f[c] || (f[c] = {}), p = yn(u, a, i ? n : null);
|
|
1954
2013
|
if (p) {
|
|
1955
2014
|
p.oneOff = p.oneOff && s;
|
|
1956
2015
|
return;
|
|
1957
2016
|
}
|
|
1958
|
-
const
|
|
1959
|
-
|
|
2017
|
+
const m = gn(a, t.replace(Rr, "")), b = i ? Mr(e, n, a) : jr(e, a);
|
|
2018
|
+
b.delegationSelector = i ? n : null, b.callable = a, b.oneOff = s, b.uidEvent = m, u[m] = b, e.addEventListener(c, b, i);
|
|
1960
2019
|
}
|
|
1961
|
-
function
|
|
2020
|
+
function Ve(e, t, n, o, s) {
|
|
1962
2021
|
const i = yn(t[n], o, s);
|
|
1963
2022
|
i && (e.removeEventListener(n, i, !!s), delete t[n][i.uidEvent]);
|
|
1964
2023
|
}
|
|
1965
|
-
function
|
|
2024
|
+
function Ur(e, t, n, o) {
|
|
1966
2025
|
const s = t[n] || {};
|
|
1967
2026
|
for (const [i, a] of Object.entries(s))
|
|
1968
|
-
i.includes(o) &&
|
|
2027
|
+
i.includes(o) && Ve(e, t, n, a.callable, a.delegationSelector);
|
|
1969
2028
|
}
|
|
1970
2029
|
function En(e) {
|
|
1971
|
-
return e = e.replace(
|
|
2030
|
+
return e = e.replace(Tr, ""), pn[e] || e;
|
|
1972
2031
|
}
|
|
1973
|
-
const
|
|
2032
|
+
const F = {
|
|
1974
2033
|
on(e, t, n, o) {
|
|
1975
2034
|
ct(e, t, n, o, !1);
|
|
1976
2035
|
},
|
|
@@ -1980,32 +2039,32 @@ const I = {
|
|
|
1980
2039
|
off(e, t, n, o) {
|
|
1981
2040
|
if (typeof t != "string" || !e)
|
|
1982
2041
|
return;
|
|
1983
|
-
const [s, i, a] = vn(t, n, o), c = a !== t,
|
|
2042
|
+
const [s, i, a] = vn(t, n, o), c = a !== t, f = bn(e), u = f[a] || {}, p = t.startsWith(".");
|
|
1984
2043
|
if (typeof i < "u") {
|
|
1985
|
-
if (!Object.keys(
|
|
2044
|
+
if (!Object.keys(u).length)
|
|
1986
2045
|
return;
|
|
1987
|
-
|
|
2046
|
+
Ve(e, f, a, i, s ? n : null);
|
|
1988
2047
|
return;
|
|
1989
2048
|
}
|
|
1990
2049
|
if (p)
|
|
1991
|
-
for (const
|
|
1992
|
-
|
|
1993
|
-
for (const [
|
|
1994
|
-
const E =
|
|
1995
|
-
(!c || t.includes(E)) &&
|
|
2050
|
+
for (const m of Object.keys(f))
|
|
2051
|
+
Ur(e, f, m, t.slice(1));
|
|
2052
|
+
for (const [m, b] of Object.entries(u)) {
|
|
2053
|
+
const E = m.replace(Ir, "");
|
|
2054
|
+
(!c || t.includes(E)) && Ve(e, f, a, b.callable, b.delegationSelector);
|
|
1996
2055
|
}
|
|
1997
2056
|
},
|
|
1998
2057
|
trigger(e, t, n) {
|
|
1999
2058
|
if (typeof t != "string" || !e)
|
|
2000
2059
|
return null;
|
|
2001
|
-
const o =
|
|
2002
|
-
let a = null, c = !0,
|
|
2003
|
-
i && o && (a = o.Event(t, n), o(e).trigger(a), c = !a.isPropagationStopped(),
|
|
2004
|
-
const p =
|
|
2005
|
-
return
|
|
2060
|
+
const o = hn(), s = En(t), i = t !== s;
|
|
2061
|
+
let a = null, c = !0, f = !0, u = !1;
|
|
2062
|
+
i && o && (a = o.Event(t, n), o(e).trigger(a), c = !a.isPropagationStopped(), f = !a.isImmediatePropagationStopped(), u = a.isDefaultPrevented());
|
|
2063
|
+
const p = Je(new Event(t, { bubbles: c, cancelable: !0 }), n);
|
|
2064
|
+
return u && p.preventDefault(), f && e.dispatchEvent(p), p.defaultPrevented && a && a.preventDefault(), p;
|
|
2006
2065
|
}
|
|
2007
2066
|
};
|
|
2008
|
-
function
|
|
2067
|
+
function Je(e, t = {}) {
|
|
2009
2068
|
for (const [n, o] of Object.entries(t))
|
|
2010
2069
|
try {
|
|
2011
2070
|
e[n] = o;
|
|
@@ -2036,15 +2095,15 @@ function lt(e) {
|
|
|
2036
2095
|
return e;
|
|
2037
2096
|
}
|
|
2038
2097
|
}
|
|
2039
|
-
function
|
|
2098
|
+
function Oe(e) {
|
|
2040
2099
|
return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
|
|
2041
2100
|
}
|
|
2042
|
-
const
|
|
2101
|
+
const Ee = {
|
|
2043
2102
|
setDataAttribute(e, t, n) {
|
|
2044
|
-
e.setAttribute(`data-bs-${
|
|
2103
|
+
e.setAttribute(`data-bs-${Oe(t)}`, n);
|
|
2045
2104
|
},
|
|
2046
2105
|
removeDataAttribute(e, t) {
|
|
2047
|
-
e.removeAttribute(`data-bs-${
|
|
2106
|
+
e.removeAttribute(`data-bs-${Oe(t)}`);
|
|
2048
2107
|
},
|
|
2049
2108
|
getDataAttributes(e) {
|
|
2050
2109
|
if (!e)
|
|
@@ -2057,10 +2116,10 @@ const ve = {
|
|
|
2057
2116
|
return t;
|
|
2058
2117
|
},
|
|
2059
2118
|
getDataAttribute(e, t) {
|
|
2060
|
-
return lt(e.getAttribute(`data-bs-${
|
|
2119
|
+
return lt(e.getAttribute(`data-bs-${Oe(t)}`));
|
|
2061
2120
|
}
|
|
2062
2121
|
};
|
|
2063
|
-
class
|
|
2122
|
+
class Vr {
|
|
2064
2123
|
// Getters
|
|
2065
2124
|
static get Default() {
|
|
2066
2125
|
return {};
|
|
@@ -2078,17 +2137,17 @@ class Ur {
|
|
|
2078
2137
|
return t;
|
|
2079
2138
|
}
|
|
2080
2139
|
_mergeConfigObj(t, n) {
|
|
2081
|
-
const o =
|
|
2140
|
+
const o = W(n) ? Ee.getDataAttribute(n, "config") : {};
|
|
2082
2141
|
return {
|
|
2083
2142
|
...this.constructor.Default,
|
|
2084
2143
|
...typeof o == "object" ? o : {},
|
|
2085
|
-
...
|
|
2144
|
+
...W(n) ? Ee.getDataAttributes(n) : {},
|
|
2086
2145
|
...typeof t == "object" ? t : {}
|
|
2087
2146
|
};
|
|
2088
2147
|
}
|
|
2089
2148
|
_typeCheckConfig(t, n = this.constructor.DefaultType) {
|
|
2090
2149
|
for (const [o, s] of Object.entries(n)) {
|
|
2091
|
-
const i = t[o], a =
|
|
2150
|
+
const i = t[o], a = W(i) ? "element" : Ar(i);
|
|
2092
2151
|
if (!new RegExp(s).test(a))
|
|
2093
2152
|
throw new TypeError(
|
|
2094
2153
|
`${this.constructor.NAME.toUpperCase()}: Option "${o}" provided type "${a}" but expected type "${s}".`
|
|
@@ -2096,33 +2155,33 @@ class Ur {
|
|
|
2096
2155
|
}
|
|
2097
2156
|
}
|
|
2098
2157
|
}
|
|
2099
|
-
const
|
|
2100
|
-
class
|
|
2158
|
+
const Br = "5.3.8";
|
|
2159
|
+
class $r extends Vr {
|
|
2101
2160
|
constructor(t, n) {
|
|
2102
|
-
super(), t = je(t), t && (this._element = t, this._config = this._getConfig(n),
|
|
2161
|
+
super(), t = je(t), t && (this._element = t, this._config = this._getConfig(n), Ae.set(this._element, this.constructor.DATA_KEY, this));
|
|
2103
2162
|
}
|
|
2104
2163
|
// Public
|
|
2105
2164
|
dispose() {
|
|
2106
|
-
|
|
2165
|
+
Ae.remove(this._element, this.constructor.DATA_KEY), F.off(this._element, this.constructor.EVENT_KEY);
|
|
2107
2166
|
for (const t of Object.getOwnPropertyNames(this))
|
|
2108
2167
|
this[t] = null;
|
|
2109
2168
|
}
|
|
2110
2169
|
// Private
|
|
2111
2170
|
_queueCallback(t, n, o = !0) {
|
|
2112
|
-
|
|
2171
|
+
kr(t, n, o);
|
|
2113
2172
|
}
|
|
2114
2173
|
_getConfig(t) {
|
|
2115
2174
|
return t = this._mergeConfigObj(t, this._element), t = this._configAfterMerge(t), this._typeCheckConfig(t), t;
|
|
2116
2175
|
}
|
|
2117
2176
|
// Static
|
|
2118
2177
|
static getInstance(t) {
|
|
2119
|
-
return
|
|
2178
|
+
return Ae.get(je(t), this.DATA_KEY);
|
|
2120
2179
|
}
|
|
2121
2180
|
static getOrCreateInstance(t, n = {}) {
|
|
2122
2181
|
return this.getInstance(t) || new this(t, typeof n == "object" ? n : null);
|
|
2123
2182
|
}
|
|
2124
2183
|
static get VERSION() {
|
|
2125
|
-
return
|
|
2184
|
+
return Br;
|
|
2126
2185
|
}
|
|
2127
2186
|
static get DATA_KEY() {
|
|
2128
2187
|
return `bs.${this.NAME}`;
|
|
@@ -2134,7 +2193,7 @@ class Br extends Ur {
|
|
|
2134
2193
|
return `${t}${this.EVENT_KEY}`;
|
|
2135
2194
|
}
|
|
2136
2195
|
}
|
|
2137
|
-
const
|
|
2196
|
+
const Se = (e) => {
|
|
2138
2197
|
let t = e.getAttribute("data-bs-target");
|
|
2139
2198
|
if (!t || t === "#") {
|
|
2140
2199
|
let n = e.getAttribute("href");
|
|
@@ -2142,7 +2201,7 @@ const Oe = (e) => {
|
|
|
2142
2201
|
return null;
|
|
2143
2202
|
n.includes("#") && !n.startsWith("#") && (n = `#${n.split("#")[1]}`), t = n && n !== "#" ? n.trim() : null;
|
|
2144
2203
|
}
|
|
2145
|
-
return t ? t.split(",").map((n) =>
|
|
2204
|
+
return t ? t.split(",").map((n) => fn(n)).join(",") : null;
|
|
2146
2205
|
}, V = {
|
|
2147
2206
|
find(e, t = document.documentElement) {
|
|
2148
2207
|
return [].concat(...Element.prototype.querySelectorAll.call(t, e));
|
|
@@ -2190,28 +2249,28 @@ const Oe = (e) => {
|
|
|
2190
2249
|
"[tabindex]",
|
|
2191
2250
|
'[contenteditable="true"]'
|
|
2192
2251
|
].map((n) => `${n}:not([tabindex^="-"])`).join(",");
|
|
2193
|
-
return this.find(t, e).filter((n) => !
|
|
2252
|
+
return this.find(t, e).filter((n) => !Me(n) && mn(n));
|
|
2194
2253
|
},
|
|
2195
2254
|
getSelectorFromElement(e) {
|
|
2196
|
-
const t =
|
|
2255
|
+
const t = Se(e);
|
|
2197
2256
|
return t && V.findOne(t) ? t : null;
|
|
2198
2257
|
},
|
|
2199
2258
|
getElementFromSelector(e) {
|
|
2200
|
-
const t =
|
|
2259
|
+
const t = Se(e);
|
|
2201
2260
|
return t ? V.findOne(t) : null;
|
|
2202
2261
|
},
|
|
2203
2262
|
getMultipleElementsFromSelector(e) {
|
|
2204
|
-
const t =
|
|
2263
|
+
const t = Se(e);
|
|
2205
2264
|
return t ? V.find(t) : [];
|
|
2206
2265
|
}
|
|
2207
|
-
}, dt = "dropdown",
|
|
2266
|
+
}, dt = "dropdown", qr = "bs.dropdown", J = `.${qr}`, Qe = ".data-api", Hr = "Escape", ut = "Tab", Kr = "ArrowUp", ft = "ArrowDown", Gr = 2, Yr = `hide${J}`, Wr = `hidden${J}`, zr = `show${J}`, Jr = `shown${J}`, Cn = `click${J}${Qe}`, _n = `keydown${J}${Qe}`, Qr = `keyup${J}${Qe}`, X = "show", Zr = "dropup", Xr = "dropend", eo = "dropstart", to = "dropup-center", no = "dropdown-center", Y = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)', ro = `${Y}.${X}`, be = ".dropdown-menu", oo = ".navbar", so = ".navbar-nav", io = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)", ao = se() ? "top-end" : "top-start", co = se() ? "top-start" : "top-end", lo = se() ? "bottom-end" : "bottom-start", uo = se() ? "bottom-start" : "bottom-end", fo = se() ? "left-start" : "right-start", mo = se() ? "right-start" : "left-start", ho = "top", po = "bottom", go = {
|
|
2208
2267
|
autoClose: !0,
|
|
2209
2268
|
boundary: "clippingParents",
|
|
2210
2269
|
display: "dynamic",
|
|
2211
2270
|
offset: [0, 2],
|
|
2212
2271
|
popperConfig: null,
|
|
2213
2272
|
reference: "toggle"
|
|
2214
|
-
},
|
|
2273
|
+
}, bo = {
|
|
2215
2274
|
autoClose: "(boolean|string)",
|
|
2216
2275
|
boundary: "(string|element)",
|
|
2217
2276
|
display: "string",
|
|
@@ -2219,16 +2278,16 @@ const Oe = (e) => {
|
|
|
2219
2278
|
popperConfig: "(null|object|function)",
|
|
2220
2279
|
reference: "(string|element|object)"
|
|
2221
2280
|
};
|
|
2222
|
-
let
|
|
2281
|
+
let Q = class ye extends $r {
|
|
2223
2282
|
constructor(t, n) {
|
|
2224
|
-
super(t, n), this._popper = null, this._parent = this._element.parentNode, this._menu = V.next(this._element,
|
|
2283
|
+
super(t, n), this._popper = null, this._parent = this._element.parentNode, this._menu = V.next(this._element, be)[0] || V.prev(this._element, be)[0] || V.findOne(be, this._parent), this._inNavbar = this._detectNavbar();
|
|
2225
2284
|
}
|
|
2226
2285
|
// Getters
|
|
2227
2286
|
static get Default() {
|
|
2228
|
-
return
|
|
2287
|
+
return go;
|
|
2229
2288
|
}
|
|
2230
2289
|
static get DefaultType() {
|
|
2231
|
-
return
|
|
2290
|
+
return bo;
|
|
2232
2291
|
}
|
|
2233
2292
|
static get NAME() {
|
|
2234
2293
|
return dt;
|
|
@@ -2238,20 +2297,20 @@ let J = class be extends Br {
|
|
|
2238
2297
|
return this._isShown() ? this.hide() : this.show();
|
|
2239
2298
|
}
|
|
2240
2299
|
show() {
|
|
2241
|
-
if (
|
|
2300
|
+
if (Me(this._element) || this._isShown())
|
|
2242
2301
|
return;
|
|
2243
2302
|
const t = {
|
|
2244
2303
|
relatedTarget: this._element
|
|
2245
2304
|
};
|
|
2246
|
-
if (!
|
|
2247
|
-
if (this._createPopper(), "ontouchstart" in document.documentElement && !this._parent.closest(
|
|
2305
|
+
if (!F.trigger(this._element, zr, t).defaultPrevented) {
|
|
2306
|
+
if (this._createPopper(), "ontouchstart" in document.documentElement && !this._parent.closest(so))
|
|
2248
2307
|
for (const o of [].concat(...document.body.children))
|
|
2249
|
-
|
|
2250
|
-
this._element.focus(), this._element.setAttribute("aria-expanded", !0), this._menu.classList.add(
|
|
2308
|
+
F.on(o, "mouseover", it);
|
|
2309
|
+
this._element.focus(), this._element.setAttribute("aria-expanded", !0), this._menu.classList.add(X), this._element.classList.add(X), F.trigger(this._element, Jr, t);
|
|
2251
2310
|
}
|
|
2252
2311
|
}
|
|
2253
2312
|
hide() {
|
|
2254
|
-
if (
|
|
2313
|
+
if (Me(this._element) || !this._isShown())
|
|
2255
2314
|
return;
|
|
2256
2315
|
const t = {
|
|
2257
2316
|
relatedTarget: this._element
|
|
@@ -2266,44 +2325,44 @@ let J = class be extends Br {
|
|
|
2266
2325
|
}
|
|
2267
2326
|
// Private
|
|
2268
2327
|
_completeHide(t) {
|
|
2269
|
-
if (!
|
|
2328
|
+
if (!F.trigger(this._element, Yr, t).defaultPrevented) {
|
|
2270
2329
|
if ("ontouchstart" in document.documentElement)
|
|
2271
2330
|
for (const o of [].concat(...document.body.children))
|
|
2272
|
-
|
|
2273
|
-
this._popper && this._popper.destroy(), this._menu.classList.remove(
|
|
2331
|
+
F.off(o, "mouseover", it);
|
|
2332
|
+
this._popper && this._popper.destroy(), this._menu.classList.remove(X), this._element.classList.remove(X), this._element.setAttribute("aria-expanded", "false"), Ee.removeDataAttribute(this._menu, "popper"), F.trigger(this._element, Wr, t);
|
|
2274
2333
|
}
|
|
2275
2334
|
}
|
|
2276
2335
|
_getConfig(t) {
|
|
2277
|
-
if (t = super._getConfig(t), typeof t.reference == "object" && !
|
|
2336
|
+
if (t = super._getConfig(t), typeof t.reference == "object" && !W(t.reference) && typeof t.reference.getBoundingClientRect != "function")
|
|
2278
2337
|
throw new TypeError(`${dt.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
|
|
2279
2338
|
return t;
|
|
2280
2339
|
}
|
|
2281
2340
|
_createPopper() {
|
|
2282
|
-
if (typeof
|
|
2341
|
+
if (typeof nt > "u")
|
|
2283
2342
|
throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org/docs/v2/)");
|
|
2284
2343
|
let t = this._element;
|
|
2285
|
-
this._config.reference === "parent" ? t = this._parent :
|
|
2344
|
+
this._config.reference === "parent" ? t = this._parent : W(this._config.reference) ? t = je(this._config.reference) : typeof this._config.reference == "object" && (t = this._config.reference);
|
|
2286
2345
|
const n = this._getPopperConfig();
|
|
2287
|
-
this._popper =
|
|
2346
|
+
this._popper = nt.createPopper(t, this._menu, n);
|
|
2288
2347
|
}
|
|
2289
2348
|
_isShown() {
|
|
2290
|
-
return this._menu.classList.contains(
|
|
2349
|
+
return this._menu.classList.contains(X);
|
|
2291
2350
|
}
|
|
2292
2351
|
_getPlacement() {
|
|
2293
2352
|
const t = this._parent;
|
|
2294
|
-
if (t.classList.contains(Zr))
|
|
2295
|
-
return uo;
|
|
2296
2353
|
if (t.classList.contains(Xr))
|
|
2297
|
-
return mo;
|
|
2298
|
-
if (t.classList.contains(eo))
|
|
2299
2354
|
return fo;
|
|
2355
|
+
if (t.classList.contains(eo))
|
|
2356
|
+
return mo;
|
|
2300
2357
|
if (t.classList.contains(to))
|
|
2358
|
+
return ho;
|
|
2359
|
+
if (t.classList.contains(no))
|
|
2301
2360
|
return po;
|
|
2302
2361
|
const n = getComputedStyle(this._menu).getPropertyValue("--bs-position").trim() === "end";
|
|
2303
|
-
return t.classList.contains(
|
|
2362
|
+
return t.classList.contains(Zr) ? n ? co : ao : n ? uo : lo;
|
|
2304
2363
|
}
|
|
2305
2364
|
_detectNavbar() {
|
|
2306
|
-
return this._element.closest(
|
|
2365
|
+
return this._element.closest(oo) !== null;
|
|
2307
2366
|
}
|
|
2308
2367
|
_getOffset() {
|
|
2309
2368
|
const { offset: t } = this._config;
|
|
@@ -2327,22 +2386,22 @@ let J = class be extends Br {
|
|
|
2327
2386
|
}
|
|
2328
2387
|
]
|
|
2329
2388
|
};
|
|
2330
|
-
return (this._inNavbar || this._config.display === "static") && (
|
|
2389
|
+
return (this._inNavbar || this._config.display === "static") && (Ee.setDataAttribute(this._menu, "popper", "static"), t.modifiers = [{
|
|
2331
2390
|
name: "applyStyles",
|
|
2332
2391
|
enabled: !1
|
|
2333
2392
|
}]), {
|
|
2334
2393
|
...t,
|
|
2335
|
-
...
|
|
2394
|
+
...Ue(this._config.popperConfig, [void 0, t])
|
|
2336
2395
|
};
|
|
2337
2396
|
}
|
|
2338
2397
|
_selectMenuItem({ key: t, target: n }) {
|
|
2339
|
-
const o = V.find(
|
|
2340
|
-
o.length &&
|
|
2398
|
+
const o = V.find(io, this._menu).filter((s) => mn(s));
|
|
2399
|
+
o.length && Dr(o, n, t === ft, !o.includes(n)).focus();
|
|
2341
2400
|
}
|
|
2342
2401
|
// Static
|
|
2343
2402
|
static jQueryInterface(t) {
|
|
2344
2403
|
return this.each(function() {
|
|
2345
|
-
const n =
|
|
2404
|
+
const n = ye.getOrCreateInstance(this, t);
|
|
2346
2405
|
if (typeof t == "string") {
|
|
2347
2406
|
if (typeof n[t] > "u")
|
|
2348
2407
|
throw new TypeError(`No method named "${t}"`);
|
|
@@ -2351,11 +2410,11 @@ let J = class be extends Br {
|
|
|
2351
2410
|
});
|
|
2352
2411
|
}
|
|
2353
2412
|
static clearMenus(t) {
|
|
2354
|
-
if (t.button ===
|
|
2413
|
+
if (t.button === Gr || t.type === "keyup" && t.key !== ut)
|
|
2355
2414
|
return;
|
|
2356
|
-
const n = V.find(
|
|
2415
|
+
const n = V.find(ro);
|
|
2357
2416
|
for (const o of n) {
|
|
2358
|
-
const s =
|
|
2417
|
+
const s = ye.getInstance(o);
|
|
2359
2418
|
if (!s || s._config.autoClose === !1)
|
|
2360
2419
|
continue;
|
|
2361
2420
|
const i = t.composedPath(), a = i.includes(s._menu);
|
|
@@ -2366,11 +2425,11 @@ let J = class be extends Br {
|
|
|
2366
2425
|
}
|
|
2367
2426
|
}
|
|
2368
2427
|
static dataApiKeydownHandler(t) {
|
|
2369
|
-
const n = /input|textarea/i.test(t.target.tagName), o = t.key ===
|
|
2428
|
+
const n = /input|textarea/i.test(t.target.tagName), o = t.key === Hr, s = [Kr, ft].includes(t.key);
|
|
2370
2429
|
if (!s && !o || n && !o)
|
|
2371
2430
|
return;
|
|
2372
2431
|
t.preventDefault();
|
|
2373
|
-
const i = this.matches(
|
|
2432
|
+
const i = this.matches(Y) ? this : V.prev(this, Y)[0] || V.next(this, Y)[0] || V.findOne(Y, t.delegateTarget.parentNode), a = ye.getOrCreateInstance(i);
|
|
2374
2433
|
if (s) {
|
|
2375
2434
|
t.stopPropagation(), a.show(), a._selectMenuItem(t);
|
|
2376
2435
|
return;
|
|
@@ -2378,37 +2437,37 @@ let J = class be extends Br {
|
|
|
2378
2437
|
a._isShown() && (t.stopPropagation(), a.hide(), i.focus());
|
|
2379
2438
|
}
|
|
2380
2439
|
};
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
e.preventDefault(),
|
|
2440
|
+
F.on(document, _n, Y, Q.dataApiKeydownHandler);
|
|
2441
|
+
F.on(document, _n, be, Q.dataApiKeydownHandler);
|
|
2442
|
+
F.on(document, Cn, Q.clearMenus);
|
|
2443
|
+
F.on(document, Qr, Q.clearMenus);
|
|
2444
|
+
F.on(document, Cn, Y, function(e) {
|
|
2445
|
+
e.preventDefault(), Q.getOrCreateInstance(this).toggle();
|
|
2387
2446
|
});
|
|
2388
|
-
|
|
2389
|
-
const
|
|
2390
|
-
const s =
|
|
2447
|
+
Sr(Q);
|
|
2448
|
+
const Ce = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ r(A, { children: e }), le = ({ children: e, ...t }) => /* @__PURE__ */ r("div", { className: "dropdown-menu", children: e }), Ze = ({ className: e, children: t, autoClose: n, icon: o }) => {
|
|
2449
|
+
const s = O(null);
|
|
2391
2450
|
N(() => {
|
|
2392
|
-
const p = new
|
|
2451
|
+
const p = new Q(s.current, {
|
|
2393
2452
|
autoClose: n ?? !0
|
|
2394
2453
|
});
|
|
2395
2454
|
return () => {
|
|
2396
2455
|
p.dispose();
|
|
2397
2456
|
};
|
|
2398
2457
|
}, []);
|
|
2399
|
-
const i = v.Children.toArray(t).find((p) => v.isValidElement(p) && p.type ===
|
|
2400
|
-
return /* @__PURE__ */ C("div", { className: [...(e || "").split(" "), "dropdown"].filter((p,
|
|
2401
|
-
/* @__PURE__ */ r(
|
|
2402
|
-
i || /* @__PURE__ */ r(
|
|
2458
|
+
const i = v.Children.toArray(t).find((p) => v.isValidElement(p) && p.type === le), a = v.Children.toArray(t).filter((p) => v.isValidElement(p) && p.type === U), c = v.Children.toArray(t).find((p) => v.isValidElement(p) && p.type === Ce), f = v.Children.toArray(t).filter((p) => !v.isValidElement(p) || p.type !== U && p.type !== le && p.type !== Ce), u = v.isValidElement(c) ? c.props : {};
|
|
2459
|
+
return /* @__PURE__ */ C("div", { className: [...(e || "").split(" "), "dropdown"].filter((p, m, b) => b.indexOf(p) === m).join(" "), children: [
|
|
2460
|
+
/* @__PURE__ */ r(he, { ref: s, "data-bs-toggle": "dropdown", ...u, className: [...(u.className || "").split(" ")].filter((p, m, b) => b.indexOf(p) === m).join(" "), children: u.children ? u.children : f }),
|
|
2461
|
+
i || /* @__PURE__ */ r(le, { children: a })
|
|
2403
2462
|
] });
|
|
2404
|
-
},
|
|
2463
|
+
}, Be = (e, t = !0) => (Object.entries(e).map(([n, o]) => (t && o instanceof Object && (o = Be(o)), [n, o])).filter(([, n]) => n instanceof Object ? !Object.keys(n).length : ["", null, void 0].includes(n)).forEach(([n]) => {
|
|
2405
2464
|
delete e[n];
|
|
2406
|
-
}), e),
|
|
2465
|
+
}), e), yo = ({ formView: e, onClick: t }) => {
|
|
2407
2466
|
const n = (s) => {
|
|
2408
2467
|
if (s.choices !== void 0) {
|
|
2409
2468
|
const i = s.choices?.reduce((a, c) => [...a, ...c.choices || [c]], []).reduce((a, c) => {
|
|
2410
|
-
const
|
|
2411
|
-
return { ...a, [
|
|
2469
|
+
const f = c.value instanceof Function ? c.value(c) : c.value, u = c.label instanceof Function ? c.label(c) : c.label;
|
|
2470
|
+
return { ...a, [f]: u };
|
|
2412
2471
|
}, {});
|
|
2413
2472
|
return s.choices ? Object.values(s.data instanceof Object ? s.data : [s.data]).map((a) => i[a] ?? a).join(", ") : s.data;
|
|
2414
2473
|
} else if (s.checked !== void 0)
|
|
@@ -2416,13 +2475,13 @@ const Ee = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ r(A,
|
|
|
2416
2475
|
return s.data;
|
|
2417
2476
|
}, o = Object.values(e.children || []).filter((s) => s.data !== null);
|
|
2418
2477
|
return !!o.length && /* @__PURE__ */ r("div", { className: "filters d-flex mb-sm overflow-auto", children: o.filter((s) => s.data !== null).map((s, i) => /* @__PURE__ */ C("div", { className: "filters-item d-flex text-nowrap flex-column me-2 mb-2", children: [
|
|
2419
|
-
/* @__PURE__ */ r("small", { className: "mb-2", children: /* @__PURE__ */ r(
|
|
2478
|
+
/* @__PURE__ */ r("small", { className: "mb-2", children: /* @__PURE__ */ r(k, { children: s.label }) }),
|
|
2420
2479
|
/* @__PURE__ */ C("div", { className: "btn btn-sm btn-primary me-1 mb-1", children: [
|
|
2421
|
-
/* @__PURE__ */ r(
|
|
2480
|
+
/* @__PURE__ */ r(k, { children: n(s) }),
|
|
2422
2481
|
t && /* @__PURE__ */ r("span", { onClick: () => t(s.name), className: "ms-2", children: "×" })
|
|
2423
2482
|
] })
|
|
2424
2483
|
] }, i)) });
|
|
2425
|
-
},
|
|
2484
|
+
}, vo = () => {
|
|
2426
2485
|
const { actions: e, isSelectedAll: t, toggleAll: n, selected: o, executeAction: s, clear: i } = an() || {};
|
|
2427
2486
|
return e && /* @__PURE__ */ C("div", { className: "btn-group btn-group-sm mb-2", children: [
|
|
2428
2487
|
/* @__PURE__ */ r("label", { className: "btn btn-light", children: /* @__PURE__ */ r(
|
|
@@ -2433,10 +2492,10 @@ const Ee = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ r(A,
|
|
|
2433
2492
|
type: "checkbox"
|
|
2434
2493
|
}
|
|
2435
2494
|
) }),
|
|
2436
|
-
!!o?.length && /* @__PURE__ */ C(
|
|
2437
|
-
/* @__PURE__ */ r(
|
|
2438
|
-
/* @__PURE__ */ r(
|
|
2439
|
-
|
|
2495
|
+
!!o?.length && /* @__PURE__ */ C(Ze, { className: "btn btn-sm btn-light", children: [
|
|
2496
|
+
/* @__PURE__ */ r(Ce, { disabled: !o?.length, className: "bg-transparent border-0", children: !!o?.length && /* @__PURE__ */ r(k, { properties: { number: o?.length }, children: ":number selected" }) }),
|
|
2497
|
+
/* @__PURE__ */ r(le, { children: Object.keys(e).map((a) => /* @__PURE__ */ r(
|
|
2498
|
+
U,
|
|
2440
2499
|
{
|
|
2441
2500
|
to: "#",
|
|
2442
2501
|
onClick: () => s?.(a),
|
|
@@ -2448,51 +2507,51 @@ const Ee = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ r(A,
|
|
|
2448
2507
|
] }),
|
|
2449
2508
|
!!o?.length && /* @__PURE__ */ r("button", { title: "Clear selection", onClick: i, className: "btn btn-light", children: "×" })
|
|
2450
2509
|
] });
|
|
2451
|
-
},
|
|
2452
|
-
const { action: s, setAction: i } =
|
|
2453
|
-
if (!
|
|
2510
|
+
}, Eo = Mt(Ne(({ embedded: e = !1, title: t, className: n, onAction: o }) => {
|
|
2511
|
+
const { action: s, setAction: i } = ne(), { generateActionLink: a, location: c, navigate: f } = M(), u = O(null), { openModal: p } = Xe(), { open: m } = We(), b = s.action.entity;
|
|
2512
|
+
if (!b)
|
|
2454
2513
|
throw new Error("Invalid Entity");
|
|
2455
|
-
const { results: E, refresh: _ } =
|
|
2514
|
+
const { results: E, refresh: _ } = re() || {}, y = Object.values(E?.action ?? []).filter((h) => h.visibility === ze.List && h.name !== s.action.name), l = ({ newAction: h, excludeFilterParameters: x }) => {
|
|
2456
2515
|
const P = { ...h ?? s };
|
|
2457
|
-
if (x?.forEach((
|
|
2458
|
-
delete P.query?.filter?.[
|
|
2516
|
+
if (x?.forEach((D) => {
|
|
2517
|
+
delete P.query?.filter?.[D];
|
|
2459
2518
|
}), e)
|
|
2460
2519
|
i(P);
|
|
2461
2520
|
else {
|
|
2462
|
-
const
|
|
2463
|
-
|
|
2521
|
+
const D = a(P);
|
|
2522
|
+
f(D);
|
|
2464
2523
|
}
|
|
2465
|
-
}, d = (h, x, P) => new Promise((
|
|
2466
|
-
|
|
2524
|
+
}, d = (h, x, P) => new Promise((D, S) => {
|
|
2525
|
+
m({
|
|
2467
2526
|
title: "Are you sure?",
|
|
2468
|
-
icon:
|
|
2469
|
-
onResult: (
|
|
2470
|
-
|
|
2527
|
+
icon: ee.confirm,
|
|
2528
|
+
onResult: (L) => {
|
|
2529
|
+
L.isConfirmed ? de().post({
|
|
2471
2530
|
url: a(s),
|
|
2472
2531
|
body: P,
|
|
2473
|
-
bodyType:
|
|
2474
|
-
}).catch((
|
|
2475
|
-
|
|
2532
|
+
bodyType: pt.FormData
|
|
2533
|
+
}).catch((I) => {
|
|
2534
|
+
S();
|
|
2476
2535
|
}).finally(() => {
|
|
2477
|
-
_?.(),
|
|
2478
|
-
}) :
|
|
2536
|
+
_?.(), D();
|
|
2537
|
+
}) : S();
|
|
2479
2538
|
}
|
|
2480
2539
|
});
|
|
2481
2540
|
}), g = (h, x) => {
|
|
2482
2541
|
if (!o?.(h, x)) {
|
|
2483
|
-
switch (x?.preventDefault(), h.parameters = { ...h.parameters || {}, ...s.parameters || {} }, h.parameters =
|
|
2542
|
+
switch (x?.preventDefault(), h.parameters = { ...h.parameters || {}, ...s.parameters || {} }, h.parameters = Be(h.parameters), Object.keys(h.parameters).length || (h.parameters = void 0), h.query !== void 0 && (Object.keys(h.query).length || (h.query = void 0)), h.action.name) {
|
|
2484
2543
|
case "list":
|
|
2485
2544
|
return l({ newAction: h });
|
|
2486
2545
|
case "delete": {
|
|
2487
|
-
|
|
2546
|
+
m({
|
|
2488
2547
|
title: "Are you sure?",
|
|
2489
|
-
icon:
|
|
2548
|
+
icon: ee.confirm,
|
|
2490
2549
|
onResult: (P) => {
|
|
2491
|
-
P.isConfirmed &&
|
|
2550
|
+
P.isConfirmed && de().fetch({
|
|
2492
2551
|
url: a(h),
|
|
2493
|
-
method:
|
|
2494
|
-
}).catch((
|
|
2495
|
-
console.log("error",
|
|
2552
|
+
method: qe.DELETE
|
|
2553
|
+
}).catch((D) => {
|
|
2554
|
+
console.log("error", D);
|
|
2496
2555
|
}).finally(() => {
|
|
2497
2556
|
_?.();
|
|
2498
2557
|
});
|
|
@@ -2516,74 +2575,89 @@ const Ee = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ r(A,
|
|
|
2516
2575
|
l({ newAction: h });
|
|
2517
2576
|
}
|
|
2518
2577
|
};
|
|
2519
|
-
return /* @__PURE__ */ r(
|
|
2520
|
-
/* @__PURE__ */ r(T, { name: "header", children: /* @__PURE__ */ C(
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
{
|
|
2526
|
-
|
|
2527
|
-
className: "btn btn-
|
|
2528
|
-
|
|
2529
|
-
x
|
|
2530
|
-
)) }) }),
|
|
2531
|
-
E?.form?.filter?.view && /* @__PURE__ */ C("div", { className: "btn-group btn-group-sm", children: [
|
|
2532
|
-
/* @__PURE__ */ C(Je, { autoClose: "outside", children: [
|
|
2533
|
-
/* @__PURE__ */ r(Ee, { className: "btn btn-sm dropdown-toggle btn-outline-dark", children: /* @__PURE__ */ r(D, { children: "Filter" }) }),
|
|
2534
|
-
/* @__PURE__ */ r(ce, { children: /* @__PURE__ */ r("div", { className: "filter", children: /* @__PURE__ */ C(
|
|
2535
|
-
At,
|
|
2578
|
+
return /* @__PURE__ */ r(vr, { data: E, onClick: g, children: /* @__PURE__ */ C("section", { className: n || "list", children: [
|
|
2579
|
+
/* @__PURE__ */ r(T, { name: "header", children: /* @__PURE__ */ C(
|
|
2580
|
+
"header",
|
|
2581
|
+
{
|
|
2582
|
+
className: "content-header d-flex flex-column flex-md-row gap-3 mb-3 justify-content-between align-items-md-center",
|
|
2583
|
+
children: [
|
|
2584
|
+
/* @__PURE__ */ r(T, { name: "title", children: t !== !1 && (v.isValidElement(t) ? t : /* @__PURE__ */ r("h2", { children: /* @__PURE__ */ r(k, { children: t ?? E?.title }) })) }),
|
|
2585
|
+
/* @__PURE__ */ C("div", { className: "d-flex align-items-center", children: [
|
|
2586
|
+
/* @__PURE__ */ r(T, { name: "actions", children: !!y.length && /* @__PURE__ */ r("div", { className: "btn-group btn-group-sm me-2", children: y.map((h, x) => /* @__PURE__ */ r(
|
|
2587
|
+
dn,
|
|
2536
2588
|
{
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2589
|
+
action: { ...s, action: h },
|
|
2590
|
+
className: "btn btn-outline-secondary"
|
|
2591
|
+
},
|
|
2592
|
+
x
|
|
2593
|
+
)) }) }),
|
|
2594
|
+
E?.form?.filter?.view && /* @__PURE__ */ r(T, { name: "filter", children: /* @__PURE__ */ C("div", { className: "btn-group btn-group-sm", children: [
|
|
2595
|
+
/* @__PURE__ */ C(Ze, { autoClose: "outside", children: [
|
|
2596
|
+
/* @__PURE__ */ r(Ce, { className: "btn btn-sm dropdown-toggle btn-outline-dark", children: /* @__PURE__ */ r(k, { children: "Filter" }) }),
|
|
2597
|
+
/* @__PURE__ */ r(le, { children: /* @__PURE__ */ r("div", { className: "filter", children: /* @__PURE__ */ C(
|
|
2598
|
+
At,
|
|
2599
|
+
{
|
|
2600
|
+
id: "filter_" + xe(b),
|
|
2601
|
+
ref: u,
|
|
2602
|
+
onSubmit: (h) => g({
|
|
2603
|
+
...s,
|
|
2604
|
+
query: Be($e(h))
|
|
2605
|
+
}),
|
|
2606
|
+
onReset: () => g({
|
|
2607
|
+
...s,
|
|
2608
|
+
query: void 0
|
|
2609
|
+
}),
|
|
2610
|
+
children: [
|
|
2611
|
+
E?.form?.filter && /* @__PURE__ */ r(oe, { view: E.form.filter.view, children: /* @__PURE__ */ r(pe, {}) }),
|
|
2612
|
+
/* @__PURE__ */ C("div", { className: "d-flex gap-2", children: [
|
|
2613
|
+
/* @__PURE__ */ r("button", { className: "btn btn-primary", type: "submit", children: /* @__PURE__ */ r(k, { children: "Apply Filters" }) }),
|
|
2614
|
+
/* @__PURE__ */ r("button", { className: "btn", type: "reset", children: /* @__PURE__ */ r(k, { children: "Clear" }) })
|
|
2615
|
+
] })
|
|
2616
|
+
]
|
|
2617
|
+
}
|
|
2618
|
+
) }) })
|
|
2619
|
+
] }),
|
|
2620
|
+
c.searchParams.has("filter") && /* @__PURE__ */ r(he, { onClick: () => {
|
|
2621
|
+
u.current?.reset();
|
|
2622
|
+
}, className: "btn btn-outline-dark", children: "x" })
|
|
2623
|
+
] }) })
|
|
2624
|
+
] })
|
|
2625
|
+
]
|
|
2626
|
+
}
|
|
2627
|
+
) }),
|
|
2628
|
+
/* @__PURE__ */ C(Er, { onClick: d, children: [
|
|
2629
|
+
E?.form?.filter?.view && /* @__PURE__ */ r(
|
|
2630
|
+
yo,
|
|
2631
|
+
{
|
|
2632
|
+
formView: E.form.filter.view,
|
|
2633
|
+
onClick: (h) => l({ excludeFilterParameters: [h] })
|
|
2634
|
+
}
|
|
2635
|
+
),
|
|
2636
|
+
/* @__PURE__ */ r(vo, {}),
|
|
2563
2637
|
/* @__PURE__ */ C(T, { name: "content", children: [
|
|
2564
|
-
/* @__PURE__ */ r(
|
|
2565
|
-
|
|
2638
|
+
/* @__PURE__ */ r(j, { prefix: "list", view: "content", data: E, children: /* @__PURE__ */ r(
|
|
2639
|
+
xr,
|
|
2566
2640
|
{
|
|
2567
2641
|
routeParams: s.parameters
|
|
2568
2642
|
}
|
|
2569
2643
|
) }, "list"),
|
|
2570
|
-
/* @__PURE__ */ r(
|
|
2644
|
+
/* @__PURE__ */ r(Nr, {})
|
|
2571
2645
|
] })
|
|
2572
2646
|
] })
|
|
2573
2647
|
] }) });
|
|
2574
|
-
}, { name: "list" })),
|
|
2648
|
+
}, { name: "list" })), Co = ({ view: e }) => /* @__PURE__ */ C(A, { children: [
|
|
2575
2649
|
'View "',
|
|
2576
2650
|
e,
|
|
2577
2651
|
'" Not found.'
|
|
2578
|
-
] }),
|
|
2652
|
+
] }), _o = ({ view: e, props: t }) => {
|
|
2579
2653
|
const n = {
|
|
2580
2654
|
add: st,
|
|
2581
2655
|
edit: st,
|
|
2582
|
-
list:
|
|
2656
|
+
list: Eo
|
|
2583
2657
|
}, o = Dt();
|
|
2584
|
-
return /* @__PURE__ */ r(
|
|
2585
|
-
}, xn = ({ view: e, namespace: t, props: n }) => /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(
|
|
2586
|
-
function
|
|
2658
|
+
return /* @__PURE__ */ r(j, { view: e, props: t, children: n[e] !== void 0 ? v.createElement(n[e], t) : /* @__PURE__ */ r(Co, { view: e }) }, o + e);
|
|
2659
|
+
}, xn = ({ view: e, namespace: t, props: n }) => /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(_o, { view: e, props: n }) }), Nn = v.createContext({});
|
|
2660
|
+
function Xe() {
|
|
2587
2661
|
const { modal: e, setModal: t } = v.useContext(Nn);
|
|
2588
2662
|
return {
|
|
2589
2663
|
modal: e,
|
|
@@ -2595,32 +2669,32 @@ function Qe() {
|
|
|
2595
2669
|
}
|
|
2596
2670
|
};
|
|
2597
2671
|
}
|
|
2598
|
-
function
|
|
2599
|
-
const [t, n] =
|
|
2600
|
-
const
|
|
2601
|
-
return p ?
|
|
2602
|
-
}, []), o = t[t.length - 1] ?? null, { open: s } =
|
|
2672
|
+
function xo(e) {
|
|
2673
|
+
const [t, n] = z((u, p) => {
|
|
2674
|
+
const m = [...u];
|
|
2675
|
+
return p ? m.push(p) : m.pop(), m;
|
|
2676
|
+
}, []), o = t[t.length - 1] ?? null, { open: s } = We(), i = O(0);
|
|
2603
2677
|
N(() => {
|
|
2604
2678
|
i.current += 1;
|
|
2605
2679
|
}, [o]);
|
|
2606
2680
|
const a = {
|
|
2607
2681
|
...o?.props || {}
|
|
2608
|
-
}, c = (
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
].filter((p) => p).join("-") : Date.now().toString(),
|
|
2682
|
+
}, c = (u) => u ? [
|
|
2683
|
+
u.action.action.entity,
|
|
2684
|
+
u.action.action.namespace,
|
|
2685
|
+
u.action.action.name
|
|
2686
|
+
].filter((p) => p).join("-") : Date.now().toString(), f = c(o);
|
|
2613
2687
|
return /* @__PURE__ */ C(Nn.Provider, { value: {
|
|
2614
2688
|
modal: o,
|
|
2615
|
-
setModal: (
|
|
2616
|
-
|
|
2689
|
+
setModal: (u) => {
|
|
2690
|
+
f !== c(u) && n(u);
|
|
2617
2691
|
}
|
|
2618
2692
|
}, children: [
|
|
2619
2693
|
e.children,
|
|
2620
|
-
o && /* @__PURE__ */ r(vt, { preventDefault: !0, fallback: (
|
|
2694
|
+
o && /* @__PURE__ */ r(vt, { preventDefault: !0, fallback: (u) => {
|
|
2621
2695
|
n(null), s({
|
|
2622
|
-
title:
|
|
2623
|
-
icon:
|
|
2696
|
+
title: u?.detail ?? "Unknown Error",
|
|
2697
|
+
icon: ee.denied,
|
|
2624
2698
|
actions: {
|
|
2625
2699
|
close: {
|
|
2626
2700
|
label: "OK"
|
|
@@ -2636,17 +2710,17 @@ function _o(e) {
|
|
|
2636
2710
|
props: a
|
|
2637
2711
|
}
|
|
2638
2712
|
}
|
|
2639
|
-
) },
|
|
2713
|
+
) }, f) })
|
|
2640
2714
|
] });
|
|
2641
2715
|
}
|
|
2642
|
-
const
|
|
2643
|
-
let
|
|
2644
|
-
const wn = {},
|
|
2645
|
-
|
|
2646
|
-
},
|
|
2716
|
+
const No = ({ children: e, config: t }) => /* @__PURE__ */ r(Vn, { config: t, children: /* @__PURE__ */ r(ir, { children: /* @__PURE__ */ r(qn, { children: /* @__PURE__ */ r(en, { children: /* @__PURE__ */ r(xo, { children: e }) }) }) }) });
|
|
2717
|
+
let ve = null;
|
|
2718
|
+
const wn = {}, et = "dakataa_crud", qo = ({ connection: e, templates: t }) => {
|
|
2719
|
+
G.namespace[et] = e, wn.templates = t, ve = null;
|
|
2720
|
+
}, de = () => (ve || (ve = G.instance({ namespace: et })), ve), Ho = ({ children: e, config: t, errorFallback: n }) => {
|
|
2647
2721
|
const o = Object.assign(wn.templates ?? {}, t?.templates ?? {});
|
|
2648
|
-
return /* @__PURE__ */ r(Nt, { children: /* @__PURE__ */ r(Kn, { children: /* @__PURE__ */ r(vt, { fallback: n ?? /* @__PURE__ */ r(Un, {}), children: /* @__PURE__ */ r(
|
|
2649
|
-
},
|
|
2722
|
+
return /* @__PURE__ */ r(Nt, { children: /* @__PURE__ */ r(Kn, { children: /* @__PURE__ */ r(vt, { fallback: n ?? /* @__PURE__ */ r(Un, {}), children: /* @__PURE__ */ r(No, { config: { ...t || { env: Ct.DEV }, templates: o }, children: e }) }) }) });
|
|
2723
|
+
}, wo = ({ namespace: e }) => {
|
|
2650
2724
|
const { columns: t } = $();
|
|
2651
2725
|
return /* @__PURE__ */ r("div", { className: "card mb-3", children: /* @__PURE__ */ r("div", { className: "card-body", children: /* @__PURE__ */ C("div", { className: "d-flex flex-row gap-3 align-items-start", children: [
|
|
2652
2726
|
/* @__PURE__ */ r(cn, {}),
|
|
@@ -2659,74 +2733,74 @@ const wn = {}, Ze = "dakataa_crud", $o = ({ connection: e, templates: t }) => {
|
|
|
2659
2733
|
] }, o)) }),
|
|
2660
2734
|
/* @__PURE__ */ r("div", { className: "ms-auto", children: /* @__PURE__ */ r(un, { namespace: e }) })
|
|
2661
2735
|
] }) }) });
|
|
2662
|
-
},
|
|
2736
|
+
}, Ko = ({ itemView: e, emptyView: t, namespace: n }) => {
|
|
2663
2737
|
const { items: o, primaryColumn: s, data: i } = $();
|
|
2664
2738
|
return !!i && (o.length ? o.map((a, c) => /* @__PURE__ */ r(rn, { index: c, children: /* @__PURE__ */ r(
|
|
2665
|
-
|
|
2739
|
+
j,
|
|
2666
2740
|
{
|
|
2667
2741
|
namespace: n,
|
|
2668
2742
|
prefix: "list",
|
|
2669
2743
|
view: "listItem",
|
|
2670
|
-
children: e || /* @__PURE__ */ r(
|
|
2744
|
+
children: e || /* @__PURE__ */ r(wo, { namespace: n })
|
|
2671
2745
|
},
|
|
2672
2746
|
i?.entity?.data.items[c][s?.field ?? ""]
|
|
2673
|
-
) }, c)) : t === void 0 ? /* @__PURE__ */ r(
|
|
2674
|
-
},
|
|
2747
|
+
) }, c)) : t === void 0 ? /* @__PURE__ */ r(k, { children: "No results found." }) : t);
|
|
2748
|
+
}, Go = ({ name: e }) => {
|
|
2675
2749
|
const { form: t } = B(), n = e ? t.children?.[e] : t;
|
|
2676
2750
|
if (!n)
|
|
2677
2751
|
throw new Error("Missing Form View for FormLabel" + (e ? ": " + e : ""));
|
|
2678
|
-
return /* @__PURE__ */ r(
|
|
2679
|
-
},
|
|
2680
|
-
const s = v.Children.toArray(t).find((c) => v.isValidElement(c) && c.type ===
|
|
2752
|
+
return /* @__PURE__ */ r(Re, { view: n });
|
|
2753
|
+
}, Ao = ({ children: e }) => /* @__PURE__ */ r(A, { children: e }), mt = ue(({ name: e, children: t, parent: n, render: o }) => (t = v.Children.toArray((o ? o(n) : t) || []).map((s) => (v.isValidElement(s) && s.type === Ao && (s = v.cloneElement(s, { children: n })), s)), /* @__PURE__ */ r(A, { children: t }))), Yo = ue(({ name: e, content: t, children: n, data: o }) => {
|
|
2754
|
+
const s = v.Children.toArray(t).find((c) => v.isValidElement(c) && c.type === mt && c.props.name === e);
|
|
2681
2755
|
let i = null;
|
|
2682
2756
|
s && v.isValidElement(s) && (i = v.cloneElement(s, { parent: n, data: o }));
|
|
2683
|
-
const a = v.Children.toArray(n).filter((c) => v.isValidElement(c) && c.type !==
|
|
2757
|
+
const a = v.Children.toArray(n).filter((c) => v.isValidElement(c) && c.type !== mt);
|
|
2684
2758
|
return /* @__PURE__ */ r(A, { children: i || (a.length ? a : n) });
|
|
2685
|
-
}), An = v.createContext(null), Pn = ({ item: e }) => /* @__PURE__ */ r(An.Provider, { value: e, children: e.parent?.parent ? /* @__PURE__ */ r(Pn, { item: e.parent }) : e.parent?.element ? e.parent.element : e.element }),
|
|
2686
|
-
const t = (c,
|
|
2687
|
-
const
|
|
2759
|
+
}), An = v.createContext(null), Pn = ({ item: e }) => /* @__PURE__ */ r(An.Provider, { value: e, children: e.parent?.parent ? /* @__PURE__ */ r(Pn, { item: e.parent }) : e.parent?.element ? e.parent.element : e.element }), Wo = () => v.useContext(An)?.element || "Empty", zo = ({ children: e }) => {
|
|
2760
|
+
const t = (c, f) => Dn.toArray(c).reduce((u, p) => {
|
|
2761
|
+
const m = p.props, b = (y) => y?.replace(/\/$/, ""), E = [f?.path, m?.path].filter((y) => y).map((y) => b(y)).join("/"), _ = t(m.children, { path: E, element: m.element });
|
|
2688
2762
|
return [
|
|
2689
|
-
...
|
|
2763
|
+
...u,
|
|
2690
2764
|
..._.length ? _ : [{
|
|
2691
2765
|
path: "/" + E,
|
|
2692
|
-
element:
|
|
2693
|
-
parent:
|
|
2766
|
+
element: m?.element,
|
|
2767
|
+
parent: f
|
|
2694
2768
|
}]
|
|
2695
2769
|
];
|
|
2696
|
-
}, []), n =
|
|
2770
|
+
}, []), n = O(null);
|
|
2697
2771
|
n.current === null && (n.current = t(e));
|
|
2698
|
-
const { matchPath: o } =
|
|
2772
|
+
const { matchPath: o } = M(), s = n.current.filter((c) => c.path && o(c.path, document.location.href)).shift(), [, i] = R(document.location.href), a = () => {
|
|
2699
2773
|
i(document.location.href);
|
|
2700
2774
|
};
|
|
2701
2775
|
if (N(() => (a(), window.addEventListener("locationchange", a), () => {
|
|
2702
2776
|
window.removeEventListener("locationchange", a);
|
|
2703
2777
|
}), []), !!s)
|
|
2704
2778
|
return /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(Pn, { item: s }) });
|
|
2705
|
-
},
|
|
2706
|
-
const n = !!e.items?.length, { location: o, generateRoute: s } =
|
|
2779
|
+
}, Jo = (e) => null, Ln = v.createContext(null), Po = () => v.useContext(Ln), Lo = ({ item: e, open: t = !1 }) => {
|
|
2780
|
+
const n = !!e.items?.length, { location: o, generateRoute: s } = M(), i = o.pathname.replace(/(.*?)\/?$/i, "$1"), a = s(e.route), c = i.includes(a, 0), [f, u] = v.useState(c), p = Po(), m = O(null), b = O(null), E = "collapse", _ = "collapsing", y = {
|
|
2707
2781
|
toggle: (g) => {
|
|
2708
|
-
|
|
2782
|
+
u(g !== void 0 ? g : !f);
|
|
2709
2783
|
}
|
|
2710
2784
|
}, l = () => {
|
|
2711
|
-
|
|
2785
|
+
m.current?.classList.remove(_), m.current?.classList.add(E), m.current?.classList.toggle("show", f), m.current?.style.removeProperty("height");
|
|
2712
2786
|
}, d = () => {
|
|
2713
|
-
|
|
2787
|
+
b.current && (clearTimeout(b.current), b.current = null);
|
|
2714
2788
|
};
|
|
2715
|
-
return N(() => (
|
|
2716
|
-
|
|
2717
|
-
}, 10),
|
|
2718
|
-
d(),
|
|
2719
|
-
}), [
|
|
2720
|
-
t !==
|
|
2721
|
-
}, [t]), /* @__PURE__ */ r(Ln.Provider, { value:
|
|
2789
|
+
return N(() => (f && p && p.toggle(!0), m.current?.addEventListener("animationstart", d), m.current?.addEventListener("transitionstart", d), m.current?.addEventListener("animationend", l), m.current?.addEventListener("transitionend", l), m.current?.style.setProperty("height", (f ? 0 : m.current?.scrollHeight) + "px"), m.current?.classList.remove("show"), m.current?.classList.remove(E), m.current?.classList.add(_), setTimeout(() => {
|
|
2790
|
+
m.current?.style.setProperty("height", (f ? m.current?.scrollHeight : 0) + "px");
|
|
2791
|
+
}, 10), b.current = setTimeout(l, 50), () => {
|
|
2792
|
+
d(), m.current?.removeEventListener("animationstart", d), m.current?.removeEventListener("transitionstart", d), m.current?.removeEventListener("animationend", l), m.current?.removeEventListener("transitionend", l);
|
|
2793
|
+
}), [f]), N(() => {
|
|
2794
|
+
t !== f && u(t);
|
|
2795
|
+
}, [t]), /* @__PURE__ */ r(Ln.Provider, { value: y, children: /* @__PURE__ */ C("nav", { className: ["item", ...f || c ? ["active"] : []].join(" "), children: [
|
|
2722
2796
|
/* @__PURE__ */ C(
|
|
2723
|
-
|
|
2797
|
+
U,
|
|
2724
2798
|
{
|
|
2725
2799
|
to: n ? "#" : s(e.route),
|
|
2726
2800
|
...e.icon && { icon: e.icon },
|
|
2727
2801
|
...n && {
|
|
2728
2802
|
onClick: () => {
|
|
2729
|
-
|
|
2803
|
+
u(!f);
|
|
2730
2804
|
}
|
|
2731
2805
|
},
|
|
2732
2806
|
children: [
|
|
@@ -2735,35 +2809,35 @@ const wn = {}, Ze = "dakataa_crud", $o = ({ connection: e, templates: t }) => {
|
|
|
2735
2809
|
]
|
|
2736
2810
|
}
|
|
2737
2811
|
),
|
|
2738
|
-
n && !!e.items?.length && /* @__PURE__ */ r("nav", { ref:
|
|
2812
|
+
n && !!e.items?.length && /* @__PURE__ */ r("nav", { ref: m, className: E, children: /* @__PURE__ */ r(On, { items: e.items }) })
|
|
2739
2813
|
] }) });
|
|
2740
2814
|
}, On = ({ items: e }) => e.map(
|
|
2741
2815
|
(t) => {
|
|
2742
2816
|
const n = [parent, t.title].filter((o) => o).join("-").toLowerCase();
|
|
2743
|
-
return /* @__PURE__ */ r(
|
|
2817
|
+
return /* @__PURE__ */ r(Lo, { item: t }, n);
|
|
2744
2818
|
}
|
|
2745
|
-
),
|
|
2746
|
-
const s =
|
|
2819
|
+
), Oo = He(({ items: e, className: t, open: n = !1 }, o) => {
|
|
2820
|
+
const s = O(null), [i, a] = v.useState(n);
|
|
2747
2821
|
o = o || Rn();
|
|
2748
2822
|
const c = {
|
|
2749
|
-
toggle: (
|
|
2750
|
-
a(
|
|
2823
|
+
toggle: (f) => {
|
|
2824
|
+
a(f !== void 0 ? f : !i);
|
|
2751
2825
|
}
|
|
2752
2826
|
};
|
|
2753
|
-
return
|
|
2827
|
+
return fe(o, () => c), N(() => {
|
|
2754
2828
|
document.body.classList.toggle("toggle-nav", i);
|
|
2755
|
-
const
|
|
2756
|
-
s.current?.contains(
|
|
2829
|
+
const f = (u) => {
|
|
2830
|
+
s.current?.contains(u.target) || (a(!1), document.body.removeEventListener("click", f));
|
|
2757
2831
|
};
|
|
2758
2832
|
if (i)
|
|
2759
|
-
return document.body.addEventListener("click",
|
|
2760
|
-
document.body.removeEventListener("click",
|
|
2833
|
+
return document.body.addEventListener("click", f), () => {
|
|
2834
|
+
document.body.removeEventListener("click", f);
|
|
2761
2835
|
};
|
|
2762
2836
|
}, [i]), /* @__PURE__ */ r("nav", { ref: s, children: /* @__PURE__ */ r(On, { items: e }) });
|
|
2763
|
-
}),
|
|
2764
|
-
const n =
|
|
2837
|
+
}), Qo = ({ children: e, ...t }) => {
|
|
2838
|
+
const n = O(null), [o, s] = R([]);
|
|
2765
2839
|
return N(() => {
|
|
2766
|
-
|
|
2840
|
+
de().get({
|
|
2767
2841
|
url: "/_crud/navigation"
|
|
2768
2842
|
}).then(({ status: i, data: a }) => {
|
|
2769
2843
|
i === 200 && s(a);
|
|
@@ -2771,20 +2845,20 @@ const wn = {}, Ze = "dakataa_crud", $o = ({ connection: e, templates: t }) => {
|
|
|
2771
2845
|
}, []), /* @__PURE__ */ C(Et, { children: [
|
|
2772
2846
|
/* @__PURE__ */ r("header", { children: /* @__PURE__ */ C("div", { className: "wrap", children: [
|
|
2773
2847
|
/* @__PURE__ */ r("button", { onClick: (i) => n.current?.toggle(), className: "btn btn-mobile", children: /* @__PURE__ */ r("i", {}) }),
|
|
2774
|
-
/* @__PURE__ */ r("nav", { className: "first-nav", children: /* @__PURE__ */ r(
|
|
2775
|
-
/* @__PURE__ */ r("nav", { className: "second-nav", children: /* @__PURE__ */ C(
|
|
2848
|
+
/* @__PURE__ */ r("nav", { className: "first-nav", children: /* @__PURE__ */ r(U, { className: "logo", to: "/", children: "Admin" }) }),
|
|
2849
|
+
/* @__PURE__ */ r("nav", { className: "second-nav", children: /* @__PURE__ */ C(Ze, { className: "user", children: [
|
|
2776
2850
|
/* @__PURE__ */ r("span", { className: "initials", children: "YL" }),
|
|
2777
|
-
/* @__PURE__ */ r(
|
|
2778
|
-
/* @__PURE__ */ r(
|
|
2851
|
+
/* @__PURE__ */ r(U, { to: "#", children: "Yordan Lazarov" }),
|
|
2852
|
+
/* @__PURE__ */ r(U, { to: "#", children: "Logout" })
|
|
2779
2853
|
] }) })
|
|
2780
2854
|
] }) }),
|
|
2781
2855
|
/* @__PURE__ */ C("main", { children: [
|
|
2782
|
-
!!o.length && /* @__PURE__ */ r("div", { className: "navigation d-print-none", children: /* @__PURE__ */ r(
|
|
2856
|
+
!!o.length && /* @__PURE__ */ r("div", { className: "navigation d-print-none", children: /* @__PURE__ */ r(Oo, { ref: n, items: o }) }),
|
|
2783
2857
|
/* @__PURE__ */ r("div", { className: "content", children: e })
|
|
2784
2858
|
] })
|
|
2785
2859
|
] });
|
|
2786
|
-
},
|
|
2787
|
-
const s = Intl.NumberFormat().resolvedOptions().locale, { currency: i, locale: a } =
|
|
2860
|
+
}, Zo = ({ currency: e, locale: t, children: n, precision: o = 2 }) => {
|
|
2861
|
+
const s = Intl.NumberFormat().resolvedOptions().locale, { currency: i, locale: a } = te();
|
|
2788
2862
|
e ??= i ?? "EUR", t ??= a ?? s;
|
|
2789
2863
|
const c = Number(n);
|
|
2790
2864
|
return /* @__PURE__ */ r(A, { children: !isNaN(c) && c.toLocaleString(t, { style: "currency", currency: e, minimumFractionDigits: o }) });
|
|
@@ -2792,100 +2866,101 @@ const wn = {}, Ze = "dakataa_crud", $o = ({ connection: e, templates: t }) => {
|
|
|
2792
2866
|
export {
|
|
2793
2867
|
dn as Action,
|
|
2794
2868
|
Nt as ActionProvider,
|
|
2795
|
-
|
|
2869
|
+
ee as AlertIcon,
|
|
2796
2870
|
en as AlertProvider,
|
|
2797
|
-
|
|
2871
|
+
Ne as AsTemplate,
|
|
2798
2872
|
Wt as BaseFormFieldError,
|
|
2799
2873
|
zt as BaseFormGroup,
|
|
2800
2874
|
er as BaseFormHelp,
|
|
2801
|
-
|
|
2875
|
+
Re as BaseFormLabel,
|
|
2802
2876
|
Et as BaseLayout,
|
|
2803
2877
|
T as Block,
|
|
2804
|
-
|
|
2878
|
+
he as Button,
|
|
2805
2879
|
rr as Choice,
|
|
2806
2880
|
nr as ChoiceGroupOption,
|
|
2807
|
-
|
|
2881
|
+
Te as ChoiceOption,
|
|
2808
2882
|
ar as Collection,
|
|
2809
2883
|
lr as CollectionItem,
|
|
2810
2884
|
cr as CollectionList,
|
|
2811
2885
|
Vn as ConfigProvider,
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2886
|
+
Ho as Crud,
|
|
2887
|
+
qo as CrudConfiguration,
|
|
2888
|
+
gr as CrudForm,
|
|
2889
|
+
Fo as CrudLoader,
|
|
2890
|
+
No as CrudProvider,
|
|
2891
|
+
de as CrudRequester,
|
|
2818
2892
|
It as CurrentActionProvider,
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2893
|
+
jt as DataProvider,
|
|
2894
|
+
Ze as Dropdown,
|
|
2895
|
+
Ce as DropdownButton,
|
|
2896
|
+
le as DropdownContent,
|
|
2897
|
+
j as DynamicView,
|
|
2824
2898
|
Ct as Environment,
|
|
2825
2899
|
vt as ErrorBoundary,
|
|
2826
2900
|
gt as Exception,
|
|
2827
2901
|
H as Extend,
|
|
2828
2902
|
At as Form,
|
|
2829
|
-
|
|
2903
|
+
ur as FormError,
|
|
2830
2904
|
ot as FormField,
|
|
2831
2905
|
pe as FormFieldViewLoader,
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2906
|
+
Mo as FormGroup,
|
|
2907
|
+
Go as FormLabel,
|
|
2908
|
+
fr as FormRest,
|
|
2835
2909
|
mr as FormRestError,
|
|
2836
|
-
|
|
2837
|
-
|
|
2910
|
+
Uo as FormSetting,
|
|
2911
|
+
oe as FormViewProvider,
|
|
2838
2912
|
w as FormViewTypeEnum,
|
|
2839
2913
|
Yn as GetData,
|
|
2840
2914
|
Wn as GetDataByAction,
|
|
2841
|
-
|
|
2842
|
-
|
|
2915
|
+
xr as GridView,
|
|
2916
|
+
Ke as HttpException,
|
|
2843
2917
|
or as Input,
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2918
|
+
Cr as IsListItemActionGranted,
|
|
2919
|
+
_r as ItemAction,
|
|
2920
|
+
U as Link,
|
|
2921
|
+
Eo as List,
|
|
2922
|
+
wo as ListItem,
|
|
2923
|
+
vr as ListProvider,
|
|
2924
|
+
Ko as ListView,
|
|
2925
|
+
br as LottieAnimation,
|
|
2926
|
+
Qo as MainLayout,
|
|
2852
2927
|
Zt as Modal,
|
|
2853
|
-
|
|
2928
|
+
xo as ModalProvider,
|
|
2854
2929
|
st as Modify,
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2930
|
+
Zo as Money,
|
|
2931
|
+
Wo as Outlet,
|
|
2932
|
+
Nr as Paginator,
|
|
2933
|
+
Bo as Parent,
|
|
2934
|
+
Jo as Route,
|
|
2935
|
+
zo as Router,
|
|
2861
2936
|
tr as SelectGroupOption,
|
|
2862
2937
|
qt as SelectOption,
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2938
|
+
hr as Template,
|
|
2939
|
+
Yo as TemplateBlock,
|
|
2940
|
+
mt as TemplateExtend,
|
|
2941
|
+
Ao as TemplateParentBlock,
|
|
2942
|
+
k as Translation,
|
|
2943
|
+
M as UseActions,
|
|
2944
|
+
We as UseAlert,
|
|
2870
2945
|
Gt as UseCollection,
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2946
|
+
Vo as UseCollectionItem,
|
|
2947
|
+
te as UseConfig,
|
|
2948
|
+
ne as UseCurrentAction,
|
|
2874
2949
|
Gn as UseCurrentActionCollection,
|
|
2875
|
-
|
|
2950
|
+
re as UseDataProvider,
|
|
2876
2951
|
Qn as UseDynamicView,
|
|
2877
2952
|
me as UseForm,
|
|
2878
2953
|
$t as UseFormSettings,
|
|
2879
2954
|
B as UseFormView,
|
|
2880
2955
|
$ as UseList,
|
|
2881
|
-
|
|
2882
|
-
|
|
2956
|
+
ge as UseListItem,
|
|
2957
|
+
Xe as UseModal,
|
|
2883
2958
|
xn as ViewLoader,
|
|
2884
|
-
|
|
2885
|
-
|
|
2959
|
+
Io as WithActionProviderContext,
|
|
2960
|
+
$o as WithAlertProvider,
|
|
2886
2961
|
Mt as WithDataProvider,
|
|
2887
|
-
|
|
2962
|
+
De as capitalize,
|
|
2888
2963
|
jo as maskEmail,
|
|
2889
|
-
|
|
2964
|
+
xe as nameToId,
|
|
2890
2965
|
zn as titlize
|
|
2891
2966
|
};
|