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