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