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