@dakataa/crud-react 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/crud-react.js +237 -228
- package/package.json +8 -10
package/dist/crud-react.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var Dt = Object.defineProperty;
|
|
2
2
|
var Lt = (e, t, n) => t in e ? Dt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var ee = (e, t, n) => Lt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { jsx as s, Fragment as
|
|
4
|
+
import { jsx as s, Fragment as k, jsxs as _ } from "react/jsx-runtime";
|
|
5
5
|
import * as Be from "react";
|
|
6
|
-
import S, { memo as W, useContext as jt, useState as $, useEffect as v, forwardRef as ie, useRef as R, useImperativeHandle as je, useReducer as
|
|
7
|
-
import
|
|
6
|
+
import S, { memo as W, useContext as jt, useState as $, useEffect as v, forwardRef as ie, useRef as R, useImperativeHandle as je, useReducer as xt, use as kt, Suspense as Rt } from "react";
|
|
7
|
+
import xe, { convertObjectToURLSearchParams as nt, RequestBodyType as Mt, convertURLSearchParamsToObject as vt, convertFormDataToObject as Ft, Method as It } from "@dakataa/requester";
|
|
8
8
|
import "@dakataa/crud-theme/scss/theme.scss";
|
|
9
9
|
import { generatePath as Vt, UNSAFE_RouteContext as $t, matchPath as Ke, useNavigate as Ut, useParams as Bt, Link as z, useLocation as Kt, useSearchParams as Ht } from "react-router";
|
|
10
10
|
import { createPortal as wt } from "react-dom";
|
|
11
|
-
import Yt from "lottie-web";
|
|
11
|
+
import Yt from "lottie-web/build/player/esm/lottie.min.js";
|
|
12
12
|
import * as He from "@popperjs/core";
|
|
13
|
-
class
|
|
13
|
+
class ke {
|
|
14
14
|
constructor(t = 0, n, r) {
|
|
15
15
|
ee(this, "code");
|
|
16
16
|
ee(this, "detail");
|
|
@@ -18,7 +18,7 @@ class xe {
|
|
|
18
18
|
this.code = t, this.detail = n, this.trace = r;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
class Q extends
|
|
21
|
+
class Q extends ke {
|
|
22
22
|
constructor(n, r, o) {
|
|
23
23
|
super(0, r, o);
|
|
24
24
|
ee(this, "status", 400);
|
|
@@ -29,7 +29,7 @@ class Wt extends Be.Component {
|
|
|
29
29
|
constructor(n) {
|
|
30
30
|
super(n);
|
|
31
31
|
ee(this, "promiseRejectionHandler", (n) => {
|
|
32
|
-
n.reason instanceof
|
|
32
|
+
n.reason instanceof ke && this.setState({
|
|
33
33
|
...this.state,
|
|
34
34
|
hasError: !0,
|
|
35
35
|
error: n.reason
|
|
@@ -63,48 +63,57 @@ class Wt extends Be.Component {
|
|
|
63
63
|
) : this.props.children;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
const qt = W(({ children: e }) => /* @__PURE__ */ s(
|
|
66
|
+
const qt = W(({ children: e }) => /* @__PURE__ */ s(k, { children: e })), zt = W(({ error: e }) => (e ?? (e = new Q(404, "Page not found.")), /* @__PURE__ */ s(qt, { children: /* @__PURE__ */ s("main", { children: /* @__PURE__ */ _("div", { className: "content d-flex flex-column", children: [
|
|
67
67
|
/* @__PURE__ */ s("h1", { className: "display-1", children: e.status || "Error" }),
|
|
68
68
|
/* @__PURE__ */ s("p", { className: "text-secondary", children: e.detail }),
|
|
69
69
|
/* @__PURE__ */ s("br", {}),
|
|
70
70
|
/* @__PURE__ */ s("div", { children: /* @__PURE__ */ s("a", { className: "btn btn-primary", href: "#", children: "Back to home" }) })
|
|
71
|
-
] }) }) }))), Jt = ({ children: e }) => /* @__PURE__ */ s(
|
|
71
|
+
] }) }) }))), Jt = ({ children: e }) => /* @__PURE__ */ s(k, { children: e }), B = W(({ name: e, children: t, data: n, parent: r, render: o }) => (t = S.Children.toArray((o ? o(n, r) : t) || []).map((a) => (S.isValidElement(a) && a.type === Jt && (a = S.cloneElement(a, { children: r })), a)), /* @__PURE__ */ s(k, { children: t }))), V = W(({ name: e, content: t, children: n, data: r }) => {
|
|
72
72
|
const o = S.Children.toArray(t).find((u) => S.isValidElement(u) && u.type === B && u.props.name === e);
|
|
73
73
|
let a = null;
|
|
74
74
|
o && S.isValidElement(o) && (a = S.cloneElement(o, { parent: n, data: r }));
|
|
75
75
|
const c = S.Children.toArray(n).filter((u) => S.isValidElement(u) && u.type !== B);
|
|
76
|
-
return /* @__PURE__ */ s(
|
|
76
|
+
return /* @__PURE__ */ s(k, { children: a || (c.length ? c : n) });
|
|
77
77
|
}), _e = (e) => e.replaceAll(new RegExp("{(.*?)}", "gi"), ":$1"), Y = (e, t) => e ? Vt(_e(e.path), { ...e.defaults || {}, ...t }) : "#", Qt = () => jt($t).matches.pop(), we = "actions", rt = S.createContext(null);
|
|
78
78
|
function Re() {
|
|
79
|
-
const e = S.useContext(rt), t = (
|
|
79
|
+
const e = S.useContext(rt), t = () => {
|
|
80
|
+
if (Array.isArray(e))
|
|
81
|
+
return e;
|
|
82
|
+
}, n = (a, c, u) => {
|
|
83
|
+
var h;
|
|
84
|
+
return (h = t()) == null ? void 0 : h.filter((i) => i.entity === a && i.name === c && (u === void 0 || i.namespace === u)).shift();
|
|
85
|
+
}, r = (a) => {
|
|
80
86
|
var c;
|
|
81
|
-
return (
|
|
82
|
-
|
|
87
|
+
return (c = t()) == null ? void 0 : c.find((u) => {
|
|
88
|
+
var h;
|
|
89
|
+
return ((h = u.route) == null ? void 0 : h.path) && Ke(_e(u.route.path), a);
|
|
90
|
+
});
|
|
91
|
+
};
|
|
83
92
|
return {
|
|
84
|
-
getAction:
|
|
85
|
-
getActionByPath:
|
|
86
|
-
getOnClickActionByPath: (
|
|
87
|
-
const
|
|
88
|
-
var
|
|
89
|
-
const
|
|
90
|
-
if (!
|
|
93
|
+
getAction: n,
|
|
94
|
+
getActionByPath: r,
|
|
95
|
+
getOnClickActionByPath: (a) => {
|
|
96
|
+
const c = () => {
|
|
97
|
+
var i;
|
|
98
|
+
const u = r(a);
|
|
99
|
+
if (!u)
|
|
91
100
|
throw new Q(404, "Page not found.");
|
|
92
|
-
const
|
|
101
|
+
const h = Ke(_e(((i = u.route) == null ? void 0 : i.path) || ""), a);
|
|
93
102
|
return {
|
|
94
|
-
action:
|
|
95
|
-
parameters:
|
|
103
|
+
action: u,
|
|
104
|
+
parameters: h == null ? void 0 : h.params
|
|
96
105
|
};
|
|
97
106
|
};
|
|
98
|
-
return new Promise((
|
|
99
|
-
let
|
|
100
|
-
const
|
|
101
|
-
if (
|
|
107
|
+
return new Promise((u, h) => {
|
|
108
|
+
let i = 0;
|
|
109
|
+
const m = () => {
|
|
110
|
+
if (i > 10)
|
|
102
111
|
throw new Q(500, "Cannot load routes");
|
|
103
112
|
if (e)
|
|
104
|
-
return c(
|
|
105
|
-
setTimeout(
|
|
113
|
+
return u(c());
|
|
114
|
+
setTimeout(m, 200), i++;
|
|
106
115
|
};
|
|
107
|
-
|
|
116
|
+
m();
|
|
108
117
|
});
|
|
109
118
|
}
|
|
110
119
|
};
|
|
@@ -145,15 +154,15 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
145
154
|
onReset: c,
|
|
146
155
|
...u
|
|
147
156
|
}, h) => {
|
|
148
|
-
const
|
|
157
|
+
const i = R(null), m = {
|
|
149
158
|
response: null,
|
|
150
159
|
constraints: {},
|
|
151
160
|
errors: {}
|
|
152
161
|
}, f = {
|
|
153
|
-
getFormData: () => new FormData(
|
|
162
|
+
getFormData: () => new FormData(i.current || void 0),
|
|
154
163
|
setFormData: (d) => {
|
|
155
|
-
var
|
|
156
|
-
[...((
|
|
164
|
+
var p;
|
|
165
|
+
[...((p = i.current) == null ? void 0 : p.elements) || []].forEach((C) => {
|
|
157
166
|
const N = d.get(C.name);
|
|
158
167
|
switch (C.tagName.toLowerCase()) {
|
|
159
168
|
case "select": {
|
|
@@ -175,34 +184,34 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
175
184
|
});
|
|
176
185
|
},
|
|
177
186
|
setErrors: (d) => {
|
|
178
|
-
const [,
|
|
179
|
-
|
|
187
|
+
const [, p] = b;
|
|
188
|
+
p({ action: "errors", payload: d });
|
|
180
189
|
},
|
|
181
190
|
reset: () => {
|
|
182
191
|
var d;
|
|
183
|
-
(d =
|
|
192
|
+
(d = i.current) == null || d.reset();
|
|
184
193
|
},
|
|
185
194
|
submit: () => {
|
|
186
195
|
var d;
|
|
187
|
-
return (d =
|
|
196
|
+
return (d = i.current) == null ? void 0 : d.requestSubmit();
|
|
188
197
|
}
|
|
189
198
|
};
|
|
190
199
|
je(h, () => f), v(() => {
|
|
191
200
|
const d = () => {
|
|
192
201
|
c && c();
|
|
193
|
-
},
|
|
194
|
-
return
|
|
195
|
-
|
|
202
|
+
}, p = i == null ? void 0 : i.current;
|
|
203
|
+
return p == null || p.addEventListener("reset", d), () => {
|
|
204
|
+
p == null || p.removeEventListener("reset", d);
|
|
196
205
|
};
|
|
197
206
|
}, []);
|
|
198
|
-
const
|
|
207
|
+
const l = (d, p) => {
|
|
199
208
|
const C = f.getFormData();
|
|
200
|
-
for (const N of
|
|
209
|
+
for (const N of p)
|
|
201
210
|
if (!N.isValid(C.get(d) || null))
|
|
202
211
|
return { valid: !1, message: N.getMessage() };
|
|
203
212
|
return { valid: !0, message: null };
|
|
204
|
-
}, b =
|
|
205
|
-
const { action: C, payload: N } =
|
|
213
|
+
}, b = xt((d, p) => {
|
|
214
|
+
const { action: C, payload: N } = p;
|
|
206
215
|
switch (C) {
|
|
207
216
|
case "constraints": {
|
|
208
217
|
const { name: A, constraints: P } = N;
|
|
@@ -215,7 +224,7 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
215
224
|
};
|
|
216
225
|
}
|
|
217
226
|
case "validate": {
|
|
218
|
-
const { valid: A, message: P } =
|
|
227
|
+
const { valid: A, message: P } = l(N, d.constraints[N] || []), D = d.errors || {}, y = N;
|
|
219
228
|
return A ? delete D[y] : D[y] = [...D[y] || [], { message: P || "Error" }], Object.keys(D).length ? {
|
|
220
229
|
...d,
|
|
221
230
|
errors: D
|
|
@@ -240,25 +249,25 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
240
249
|
}
|
|
241
250
|
}
|
|
242
251
|
return d;
|
|
243
|
-
},
|
|
252
|
+
}, m), E = (d) => {
|
|
244
253
|
d.preventDefault();
|
|
245
|
-
const [
|
|
254
|
+
const [p, C] = b;
|
|
246
255
|
let N = {};
|
|
247
|
-
for (const [P, D] of Object.entries(
|
|
248
|
-
const { valid: y, message: O } =
|
|
256
|
+
for (const [P, D] of Object.entries(p.constraints)) {
|
|
257
|
+
const { valid: y, message: O } = l(P, D);
|
|
249
258
|
y || (N[P] = [O]);
|
|
250
259
|
}
|
|
251
260
|
if (Object.values(N).length) {
|
|
252
261
|
C({ action: "errors", payload: N });
|
|
253
262
|
return;
|
|
254
263
|
}
|
|
255
|
-
const A = new FormData((
|
|
264
|
+
const A = new FormData((i == null ? void 0 : i.current) || void 0);
|
|
256
265
|
if (o && o(A), a) {
|
|
257
266
|
a(A);
|
|
258
267
|
return;
|
|
259
268
|
}
|
|
260
269
|
};
|
|
261
|
-
return /* @__PURE__ */ s(st.Provider, { value: [b, h,
|
|
270
|
+
return /* @__PURE__ */ s(st.Provider, { value: [b, h, i], children: /* @__PURE__ */ s("form", { id: e, ref: i, onSubmit: E, ...u, children: t }) });
|
|
262
271
|
}), Zt = ({
|
|
263
272
|
view: e,
|
|
264
273
|
constraints: t,
|
|
@@ -269,7 +278,7 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
269
278
|
...c
|
|
270
279
|
}) => {
|
|
271
280
|
t = t || [];
|
|
272
|
-
const [[u, h],
|
|
281
|
+
const [[u, h], i] = Me(), m = R(null), l = !!((u == null ? void 0 : u.errors[e.full_name]) || []).length, b = btoa(encodeURIComponent(e.full_name + JSON.stringify(e.data)));
|
|
273
282
|
v(() => {
|
|
274
283
|
h({
|
|
275
284
|
action: "constraints",
|
|
@@ -282,10 +291,10 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
282
291
|
const E = (d) => {
|
|
283
292
|
h({ action: "validate", payload: e.full_name }), r && r(d);
|
|
284
293
|
};
|
|
285
|
-
return e != null && e.expanded ? /* @__PURE__ */ s(
|
|
286
|
-
(d,
|
|
294
|
+
return e != null && e.expanded ? /* @__PURE__ */ s(k, { children: Object.values(e.choices || []).map(
|
|
295
|
+
(d, p) => {
|
|
287
296
|
var D;
|
|
288
|
-
const C = ve(e.full_name,
|
|
297
|
+
const C = ve(e.full_name, p), N = o ? o(d) : d.value, A = a ? a(d) : d.label || N, P = {
|
|
289
298
|
id: C,
|
|
290
299
|
...(e == null ? void 0 : e.choice_attr) && ((e == null ? void 0 : e.choice_attr) instanceof Function ? e == null ? void 0 : e.choice_attr(d) : e == null ? void 0 : e.choice_attr)
|
|
291
300
|
};
|
|
@@ -297,7 +306,7 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
297
306
|
/* @__PURE__ */ s(
|
|
298
307
|
"input",
|
|
299
308
|
{
|
|
300
|
-
ref:
|
|
309
|
+
ref: m,
|
|
301
310
|
defaultValue: N,
|
|
302
311
|
type: e != null && e.multiple ? "checkbox" : "radio",
|
|
303
312
|
defaultChecked: (D = e == null ? void 0 : e.data) == null ? void 0 : D.includes(N),
|
|
@@ -308,7 +317,7 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
308
317
|
onChange: (y) => {
|
|
309
318
|
var O, M;
|
|
310
319
|
return E({
|
|
311
|
-
value: (e != null && e.multiple ? (O =
|
|
320
|
+
value: (e != null && e.multiple ? (O = i == null ? void 0 : i.current) == null ? void 0 : O.getFormData().getAll(e == null ? void 0 : e.full_name) : (M = i == null ? void 0 : i.current) == null ? void 0 : M.getFormData().get(e == null ? void 0 : e.full_name)) || y.target.value,
|
|
312
321
|
targetValue: y.target.value,
|
|
313
322
|
checked: y.target.checked
|
|
314
323
|
});
|
|
@@ -326,36 +335,36 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
326
335
|
)
|
|
327
336
|
]
|
|
328
337
|
},
|
|
329
|
-
|
|
338
|
+
p
|
|
330
339
|
);
|
|
331
340
|
}
|
|
332
|
-
) }) : /* @__PURE__ */ s(
|
|
341
|
+
) }) : /* @__PURE__ */ s(k, { children: /* @__PURE__ */ _(
|
|
333
342
|
"select",
|
|
334
343
|
{
|
|
335
|
-
ref:
|
|
344
|
+
ref: m,
|
|
336
345
|
name: e.full_name,
|
|
337
346
|
multiple: e.multiple,
|
|
338
|
-
"aria-invalid":
|
|
347
|
+
"aria-invalid": l,
|
|
339
348
|
onChange: (d) => {
|
|
340
|
-
var
|
|
349
|
+
var p, C;
|
|
341
350
|
return E({
|
|
342
|
-
value: (e.multiple ? (
|
|
351
|
+
value: (e.multiple ? (p = i == null ? void 0 : i.current) == null ? void 0 : p.getFormData().getAll(e.full_name) : (C = i == null ? void 0 : i.current) == null ? void 0 : C.getFormData().get(e.full_name)) || d.target.value
|
|
343
352
|
});
|
|
344
353
|
},
|
|
345
|
-
className: [...(n || "").split(" ") || [], "form-control", ...
|
|
354
|
+
className: [...(n || "").split(" ") || [], "form-control", ...l ? ["is-invalid"] : []].join(" "),
|
|
346
355
|
...e.attr && (e.attr instanceof Function ? e.attr() : e.attr),
|
|
347
356
|
defaultValue: e.data,
|
|
348
357
|
children: [
|
|
349
358
|
e.placeholder && /* @__PURE__ */ s("option", { value: "", children: e.placeholder }),
|
|
350
359
|
Object.values(e.choices || []).map(
|
|
351
|
-
(d,
|
|
360
|
+
(d, p) => /* @__PURE__ */ s(
|
|
352
361
|
"option",
|
|
353
362
|
{
|
|
354
363
|
value: d.value || d.label,
|
|
355
364
|
...e.choice_attr && (e.choice_attr instanceof Function ? e.choice_attr(d) : e.choice_attr),
|
|
356
365
|
children: d.label
|
|
357
366
|
},
|
|
358
|
-
|
|
367
|
+
p
|
|
359
368
|
)
|
|
360
369
|
)
|
|
361
370
|
]
|
|
@@ -364,7 +373,7 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
364
373
|
) });
|
|
365
374
|
}, at = ({ name: e, className: t }) => {
|
|
366
375
|
const [[n]] = Me(), r = (n == null ? void 0 : n.errors[e]) || [];
|
|
367
|
-
return r.length ? /* @__PURE__ */ s("div", { className: t, children: r.map((o, a) => /* @__PURE__ */ s("span", { children: o.message }, a)) }) : /* @__PURE__ */ s(
|
|
376
|
+
return r.length ? /* @__PURE__ */ s("div", { className: t, children: r.map((o, a) => /* @__PURE__ */ s("span", { children: o.message }, a)) }) : /* @__PURE__ */ s(k, {});
|
|
368
377
|
}, Ne = (e) => e.toLowerCase().replace(new RegExp("^.{1,1}"), (t) => t.toUpperCase()), Xt = (e) => {
|
|
369
378
|
let t = e.replace(new RegExp("[-_]", "gi"), " ").split(new RegExp("(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])"));
|
|
370
379
|
const n = t.shift(), r = t.pop();
|
|
@@ -427,10 +436,10 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
427
436
|
}
|
|
428
437
|
});
|
|
429
438
|
}, []);
|
|
430
|
-
const h = (
|
|
431
|
-
a({ action: "validate", payload: e.full_name }), r && r(
|
|
432
|
-
},
|
|
433
|
-
return /* @__PURE__ */ s(
|
|
439
|
+
const h = (l) => {
|
|
440
|
+
a({ action: "validate", payload: e.full_name }), r && r(l);
|
|
441
|
+
}, m = ["checkbox", "radio"].includes(e.type) ? "form-check-input" : "form-control", f = btoa(encodeURIComponent(e.full_name + JSON.stringify(e.data)));
|
|
442
|
+
return /* @__PURE__ */ s(k, { children: /* @__PURE__ */ s(
|
|
434
443
|
"input",
|
|
435
444
|
{
|
|
436
445
|
ref: c,
|
|
@@ -439,9 +448,9 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
439
448
|
type: e.type,
|
|
440
449
|
defaultValue: e.data,
|
|
441
450
|
"aria-invalid": !u.length,
|
|
442
|
-
onKeyUp: (
|
|
443
|
-
onChange: (
|
|
444
|
-
className: [
|
|
451
|
+
onKeyUp: (l) => h({ value: l.target.value }),
|
|
452
|
+
onChange: (l) => h({ value: l.target.value }),
|
|
453
|
+
className: [m, ...u.length ? ["is-invalid"] : []].join(" "),
|
|
445
454
|
defaultChecked: e == null ? void 0 : e.checked,
|
|
446
455
|
...e.attr && (e.attr instanceof Function ? e.attr() : e.attr)
|
|
447
456
|
},
|
|
@@ -459,17 +468,17 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
459
468
|
default:
|
|
460
469
|
return /* @__PURE__ */ s(tn, { view: e });
|
|
461
470
|
}
|
|
462
|
-
})() }), Ye = ({ children: e }) => /* @__PURE__ */ s(
|
|
471
|
+
})() }), Ye = ({ children: e }) => /* @__PURE__ */ s(k, { children: e }), G = W(({ namespace: e, view: t, prefix: n, children: r, props: o, data: a }) => {
|
|
463
472
|
t = t.split(/[._]/).map((b) => Ne(b)).join("");
|
|
464
|
-
const c = /* @__PURE__ */ Object.assign({}), u = ["crud", e, n, t].filter((b) => b).join("/") + ".tsx", [h,
|
|
473
|
+
const c = /* @__PURE__ */ Object.assign({}), u = ["crud", e, n, t].filter((b) => b).join("/") + ".tsx", [h, i] = Object.entries(c).filter(([b, E]) => b.endsWith(u)).shift() || [], [m, f] = $(1), l = R(Ye);
|
|
465
474
|
return v(() => {
|
|
466
|
-
if (
|
|
475
|
+
if (i === void 0)
|
|
467
476
|
return () => {
|
|
468
477
|
};
|
|
469
|
-
|
|
470
|
-
|
|
478
|
+
i().then((b) => {
|
|
479
|
+
l.current = b.default, f(m + 1);
|
|
471
480
|
});
|
|
472
|
-
}, []), /* @__PURE__ */ s(
|
|
481
|
+
}, []), /* @__PURE__ */ s(l.current, { ...o, view: t, controller: e, viewName: t, data: a, parent: r, children: (!i || l.current !== Ye) && r });
|
|
473
482
|
}), Fe = W(({ view: e, namespace: t, name: n }) => e && /* @__PURE__ */ s(
|
|
474
483
|
G,
|
|
475
484
|
{
|
|
@@ -480,7 +489,7 @@ const ve = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").rep
|
|
|
480
489
|
children: Object.keys(e.children || []).length ? Object.values(e.children || []).map((r) => /* @__PURE__ */ s(Fe, { namespace: t, view: r }, r.id)) : /* @__PURE__ */ s(nn, { view: e }, e.id)
|
|
481
490
|
},
|
|
482
491
|
e.id
|
|
483
|
-
)), ct = ({ icon: e, rightIcon: t, rightIconProps: n, children: r, preload: o = !1 }) => /* @__PURE__ */ s(
|
|
492
|
+
)), ct = ({ icon: e, rightIcon: t, rightIconProps: n, children: r, preload: o = !1 }) => /* @__PURE__ */ s(k, { children: r && r }), me = ie(({
|
|
484
493
|
children: e,
|
|
485
494
|
preload: t,
|
|
486
495
|
...n
|
|
@@ -491,12 +500,12 @@ function sn() {
|
|
|
491
500
|
const it = ({ entityAction: e, initParameters: t, initQueryParameters: n }) => {
|
|
492
501
|
const { getAction: r } = Re();
|
|
493
502
|
e = r(e.entity, e.name, e.namespace) || e;
|
|
494
|
-
const [o, a] = $(), [c, u] = $(t || null), [h,
|
|
495
|
-
R(null), btoa(encodeURIComponent([e.entity, e.name, e.namespace, ...Object.entries(c || {}).map(([
|
|
496
|
-
const [
|
|
503
|
+
const [o, a] = $(), [c, u] = $(t || null), [h, i] = $(new URLSearchParams(n || {}));
|
|
504
|
+
R(null), btoa(encodeURIComponent([e.entity, e.name, e.namespace, ...Object.entries(c || {}).map(([l, b]) => l + "-" + b), (h instanceof URLSearchParams ? h : nt(h)).toString()].filter((l) => l).join("."))), R({});
|
|
505
|
+
const [m, f] = $(1);
|
|
497
506
|
return v(() => {
|
|
498
|
-
e && ce().get(Y(e.route, c ?? null), h).then((
|
|
499
|
-
switch (
|
|
507
|
+
e && ce().get(Y(e.route, c ?? null), h).then((l) => l.getData().then((b) => {
|
|
508
|
+
switch (l.status) {
|
|
500
509
|
case 201:
|
|
501
510
|
case 200: {
|
|
502
511
|
a(b);
|
|
@@ -508,33 +517,33 @@ const it = ({ entityAction: e, initParameters: t, initQueryParameters: n }) => {
|
|
|
508
517
|
}
|
|
509
518
|
}
|
|
510
519
|
}));
|
|
511
|
-
}, [JSON.stringify(c), h.toString(),
|
|
520
|
+
}, [JSON.stringify(c), h.toString(), m]), {
|
|
512
521
|
results: o,
|
|
513
522
|
setParameters: u,
|
|
514
|
-
setQueryParameters: (
|
|
515
|
-
|
|
523
|
+
setQueryParameters: (l) => {
|
|
524
|
+
i(new URLSearchParams(l));
|
|
516
525
|
},
|
|
517
526
|
refresh: () => {
|
|
518
|
-
f(
|
|
527
|
+
f(m + 1);
|
|
519
528
|
}
|
|
520
529
|
};
|
|
521
|
-
}, Ce = W(({ children: e }) => /* @__PURE__ */ s(
|
|
530
|
+
}, Ce = W(({ children: e }) => /* @__PURE__ */ s(k, { children: e })), on = ie(({ name: e, data: t, action: n, parameters: r, onSuccess: o, onError: a, onLoad: c, children: u, embedded: h = !1 }, i) => {
|
|
522
531
|
var P, D, y, O, M;
|
|
523
|
-
const [
|
|
524
|
-
je(
|
|
525
|
-
getData: () =>
|
|
532
|
+
const [m, f] = $(!1), l = Ut(), b = Y(n.route, r || {}), E = R(null), d = sn(), [p, C] = $();
|
|
533
|
+
je(i, () => ({
|
|
534
|
+
getData: () => p,
|
|
526
535
|
getFormRef: () => E.current
|
|
527
536
|
}));
|
|
528
|
-
const N = (
|
|
537
|
+
const N = (x) => {
|
|
529
538
|
var F, g;
|
|
530
539
|
let L = {
|
|
531
|
-
...(F =
|
|
540
|
+
...(F = x.errors) != null && F.length ? { [x.full_name]: x.errors } : {}
|
|
532
541
|
};
|
|
533
|
-
for (let [, T] of Object.entries((
|
|
542
|
+
for (let [, T] of Object.entries((x == null ? void 0 : x.children) || []))
|
|
534
543
|
T.children && Object.values(T.children).length ? L = { ...L, ...N(T) } : (g = T.errors) != null && g.length && (L[T.full_name] = T.errors);
|
|
535
544
|
return L;
|
|
536
|
-
}, A = (
|
|
537
|
-
f(!0), ce().post(b,
|
|
545
|
+
}, A = (x) => {
|
|
546
|
+
f(!0), ce().post(b, x, Mt.FormData).then((L) => L.getData().then((F) => [200, 201, 400].includes(L.status) ? F : Promise.reject(F))).then((L) => {
|
|
538
547
|
var g;
|
|
539
548
|
C(L);
|
|
540
549
|
const F = N(L.form.modify.view);
|
|
@@ -542,7 +551,7 @@ const it = ({ entityAction: e, initParameters: t, initQueryParameters: n }) => {
|
|
|
542
551
|
(g = E.current) == null || g.setErrors(F);
|
|
543
552
|
return;
|
|
544
553
|
}
|
|
545
|
-
o && o(L), L.redirect && !h &&
|
|
554
|
+
o && o(L), L.redirect && !h && l(Y(L.redirect.route, { ...r || {}, ...L.redirect.parameters }));
|
|
546
555
|
}).catch((L) => {
|
|
547
556
|
a && a(L);
|
|
548
557
|
}).finally(() => {
|
|
@@ -553,20 +562,20 @@ const it = ({ entityAction: e, initParameters: t, initQueryParameters: n }) => {
|
|
|
553
562
|
c && c();
|
|
554
563
|
}, []), t = (d == null ? void 0 : d.results) ?? t, v(() => {
|
|
555
564
|
C(t);
|
|
556
|
-
}, [JSON.stringify(t)]),
|
|
557
|
-
Object.keys((
|
|
558
|
-
/* @__PURE__ */ _(ot, { id: (y = (D = (P =
|
|
559
|
-
((M = (O =
|
|
565
|
+
}, [JSON.stringify(t)]), p && /* @__PURE__ */ _(k, { children: [
|
|
566
|
+
Object.keys((p == null ? void 0 : p.messages) || {}).map((x, L) => /* @__PURE__ */ s("div", { className: ["alert", "alert-" + x].join(" "), children: ((p == null ? void 0 : p.messages[x]) || ["Item was saved successful."]).join(" ") }, "alert-" + x)),
|
|
567
|
+
/* @__PURE__ */ _(ot, { id: (y = (D = (P = p == null ? void 0 : p.form) == null ? void 0 : P.modify) == null ? void 0 : D.view) == null ? void 0 : y.id, ref: E, action: b, method: "POST", onSubmit: A, children: [
|
|
568
|
+
((M = (O = p == null ? void 0 : p.form) == null ? void 0 : O.modify) == null ? void 0 : M.view) !== void 0 && /* @__PURE__ */ _(k, { children: [
|
|
560
569
|
/* @__PURE__ */ s(
|
|
561
570
|
Fe,
|
|
562
571
|
{
|
|
563
572
|
name: e,
|
|
564
573
|
namespace: n.namespace,
|
|
565
|
-
view:
|
|
574
|
+
view: p.form.modify.view
|
|
566
575
|
},
|
|
567
|
-
|
|
576
|
+
p.form.modify.view.id
|
|
568
577
|
),
|
|
569
|
-
/* @__PURE__ */ s(at, { name:
|
|
578
|
+
/* @__PURE__ */ s(at, { name: p.form.modify.view.full_name, className: "alert alert-danger" })
|
|
570
579
|
] }),
|
|
571
580
|
/* @__PURE__ */ s(V, { name: "actions", content: u, data: { formRef: E }, children: /* @__PURE__ */ s(me, { type: "submit", className: "btn btn-primary", children: /* @__PURE__ */ s(Ce, { children: "Save" }) }) })
|
|
572
581
|
] })
|
|
@@ -581,18 +590,18 @@ const it = ({ entityAction: e, initParameters: t, initQueryParameters: n }) => {
|
|
|
581
590
|
onClose: c,
|
|
582
591
|
className: u
|
|
583
592
|
}, h) => {
|
|
584
|
-
const [
|
|
593
|
+
const [i, m] = $(t);
|
|
585
594
|
je(h, () => ({
|
|
586
|
-
toggle: () =>
|
|
587
|
-
open: () =>
|
|
595
|
+
toggle: () => m(!i),
|
|
596
|
+
open: () => m(!0),
|
|
588
597
|
close: () => d(),
|
|
589
|
-
isOpen: () =>
|
|
598
|
+
isOpen: () => i
|
|
590
599
|
})), v(() => {
|
|
591
|
-
|
|
600
|
+
m(t);
|
|
592
601
|
}, [t]);
|
|
593
|
-
const f = (
|
|
602
|
+
const f = (p) => {
|
|
594
603
|
if (o)
|
|
595
|
-
switch (
|
|
604
|
+
switch (p.key) {
|
|
596
605
|
case "Escape": {
|
|
597
606
|
d();
|
|
598
607
|
break;
|
|
@@ -601,50 +610,50 @@ const it = ({ entityAction: e, initParameters: t, initQueryParameters: n }) => {
|
|
|
601
610
|
};
|
|
602
611
|
v(() => {
|
|
603
612
|
var N;
|
|
604
|
-
if (!
|
|
613
|
+
if (!i)
|
|
605
614
|
return;
|
|
606
|
-
const
|
|
615
|
+
const p = () => {
|
|
607
616
|
var A;
|
|
608
|
-
(A =
|
|
617
|
+
(A = l.current) == null || A.addEventListener("animationend", C);
|
|
609
618
|
}, C = () => {
|
|
610
619
|
var A, P, D;
|
|
611
|
-
(A =
|
|
620
|
+
(A = l.current) == null || A.classList.remove(n), (P = l.current) == null || P.removeEventListener("animationstart", p), (D = l.current) == null || D.removeEventListener("animationend", C);
|
|
612
621
|
};
|
|
613
622
|
return setTimeout(() => {
|
|
614
623
|
var A, P;
|
|
615
|
-
(A =
|
|
616
|
-
}, n ? 100 : 0), document.addEventListener("keydown", f), (N =
|
|
624
|
+
(A = l.current) == null || A.classList.add("d-block", "show"), (P = b == null ? void 0 : b.current) == null || P.classList.add("show");
|
|
625
|
+
}, n ? 100 : 0), document.addEventListener("keydown", f), (N = l.current) == null || N.addEventListener("animationstart", p), () => {
|
|
617
626
|
var A, P;
|
|
618
|
-
document.removeEventListener("keydown", f), (A =
|
|
627
|
+
document.removeEventListener("keydown", f), (A = l.current) == null || A.removeEventListener("animationstart", p), (P = l.current) == null || P.removeEventListener("animationend", C);
|
|
619
628
|
};
|
|
620
|
-
}, [
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
}, d = () => new Promise((
|
|
629
|
+
}, [i]);
|
|
630
|
+
const l = R(null), b = R(null), E = () => {
|
|
631
|
+
m(!1), c && c();
|
|
632
|
+
}, d = () => new Promise((p, C) => {
|
|
624
633
|
var A, P;
|
|
625
|
-
if (!
|
|
626
|
-
return
|
|
634
|
+
if (!i)
|
|
635
|
+
return p();
|
|
627
636
|
const N = () => {
|
|
628
637
|
var D;
|
|
629
|
-
(D =
|
|
638
|
+
(D = l == null ? void 0 : l.current) == null || D.classList.remove("show", "d-block"), p(), E();
|
|
630
639
|
};
|
|
631
640
|
if (n) {
|
|
632
641
|
const D = setTimeout(() => {
|
|
633
642
|
N();
|
|
634
643
|
}, n ? 50 : 0);
|
|
635
|
-
(A =
|
|
644
|
+
(A = l.current) == null || A.addEventListener("animationstart", () => {
|
|
636
645
|
var y, O;
|
|
637
|
-
console.log("timeout"), clearTimeout(D), (y =
|
|
638
|
-
}), (P =
|
|
646
|
+
console.log("timeout"), clearTimeout(D), (y = l.current) == null || y.removeEventListener("animationend", N), (O = l.current) == null || O.addEventListener("animationend", N);
|
|
647
|
+
}), (P = l.current) == null || P.classList.add(n, "close");
|
|
639
648
|
} else
|
|
640
649
|
N();
|
|
641
650
|
});
|
|
642
|
-
return
|
|
651
|
+
return i && wt(/* @__PURE__ */ _(k, { children: [
|
|
643
652
|
/* @__PURE__ */ s(
|
|
644
653
|
"div",
|
|
645
654
|
{
|
|
646
|
-
ref:
|
|
647
|
-
className: ["modal", a && "modal-" + a, n && n, u].filter((
|
|
655
|
+
ref: l,
|
|
656
|
+
className: ["modal", a && "modal-" + a, n && n, u].filter((p) => p).join(" "),
|
|
648
657
|
children: /* @__PURE__ */ s("div", { className: "modal-dialog modal-dialog-centered", role: "document", children: /* @__PURE__ */ _("div", { className: "modal-content", children: [
|
|
649
658
|
/* @__PURE__ */ s(V, { name: "header", content: e, data: null, children: /* @__PURE__ */ _("div", { className: "modal-header", children: [
|
|
650
659
|
/* @__PURE__ */ s("h5", { className: "modal-title", id: "exampleModalLabel", children: /* @__PURE__ */ s(V, { name: "title", content: e, data: null, children: "Title" }) }),
|
|
@@ -659,7 +668,7 @@ const it = ({ entityAction: e, initParameters: t, initQueryParameters: n }) => {
|
|
|
659
668
|
"div",
|
|
660
669
|
{
|
|
661
670
|
ref: b,
|
|
662
|
-
className: ["modal-backdrop", "fade", ...n && ["show"]].filter((
|
|
671
|
+
className: ["modal-backdrop", "fade", ...n && ["show"]].filter((p) => p).join(" ")
|
|
663
672
|
}
|
|
664
673
|
)
|
|
665
674
|
] }), document.body);
|
|
@@ -701,14 +710,14 @@ function dt() {
|
|
|
701
710
|
return e;
|
|
702
711
|
}
|
|
703
712
|
function cn(e) {
|
|
704
|
-
var
|
|
713
|
+
var m;
|
|
705
714
|
const [t, n] = $(), r = R(0), o = R(void 0), [a, c] = $(null);
|
|
706
715
|
v(() => {
|
|
707
716
|
r.current += 1;
|
|
708
717
|
}, [t]);
|
|
709
718
|
const u = /* @__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") }), h = (f) => {
|
|
710
719
|
var E, d;
|
|
711
|
-
let
|
|
720
|
+
let l = {
|
|
712
721
|
title: "Are you confirm?",
|
|
713
722
|
icon: 0,
|
|
714
723
|
animation: "scale",
|
|
@@ -724,13 +733,13 @@ function cn(e) {
|
|
|
724
733
|
3: "info.json",
|
|
725
734
|
4: "info.json"
|
|
726
735
|
};
|
|
727
|
-
if (Object.hasOwn(b,
|
|
728
|
-
const
|
|
736
|
+
if (Object.hasOwn(b, l.icon)) {
|
|
737
|
+
const p = b[l.icon], C = Object.keys(u).filter((N) => N.endsWith(p)).pop();
|
|
729
738
|
C && u[C]().then((N) => {
|
|
730
739
|
c(N.default);
|
|
731
740
|
});
|
|
732
741
|
}
|
|
733
|
-
!
|
|
742
|
+
!l.actions && !l.timeoutProgress && (l.actions = {
|
|
734
743
|
cancel: {
|
|
735
744
|
label: "Cancel",
|
|
736
745
|
classList: ["btn-outline-primary"]
|
|
@@ -739,17 +748,17 @@ function cn(e) {
|
|
|
739
748
|
label: "Confirm"
|
|
740
749
|
}
|
|
741
750
|
}), (E = o.current) != null && E.isOpen() ? (d = o.current) == null || d.close().finally(() => {
|
|
742
|
-
n(
|
|
743
|
-
}) : n(
|
|
744
|
-
},
|
|
751
|
+
n(l);
|
|
752
|
+
}) : n(l);
|
|
753
|
+
}, i = (f) => {
|
|
745
754
|
var b;
|
|
746
|
-
const
|
|
755
|
+
const l = {
|
|
747
756
|
[f]: !0,
|
|
748
757
|
isConfirmed: f === "confirm",
|
|
749
758
|
isCancelled: f === "cancel",
|
|
750
759
|
isDenied: f === "deny"
|
|
751
760
|
};
|
|
752
|
-
t != null && t.onResult && t.onResult(
|
|
761
|
+
t != null && t.onResult && t.onResult(l), (b = o.current) == null || b.close().then(() => {
|
|
753
762
|
c(null), n(void 0);
|
|
754
763
|
});
|
|
755
764
|
};
|
|
@@ -761,14 +770,14 @@ function cn(e) {
|
|
|
761
770
|
/* @__PURE__ */ s(B, { name: "content", children: /* @__PURE__ */ _("div", { className: "d-flex flex-column align-items-center", children: [
|
|
762
771
|
a !== null && /* @__PURE__ */ s(an, { className: "modal-alert-icon", animationData: a }),
|
|
763
772
|
/* @__PURE__ */ s("h3", { className: "modal-alert-title", children: t.title }),
|
|
764
|
-
!!((
|
|
773
|
+
!!((m = t.text) != null && m.length) && /* @__PURE__ */ s("p", { className: "modal-alert-text", children: t.text }),
|
|
765
774
|
t.actions && /* @__PURE__ */ s("div", { className: "d-flex justify-content-center align-items-center", children: Object.keys(t.actions).map((f) => {
|
|
766
|
-
var
|
|
775
|
+
var l, b, E;
|
|
767
776
|
return /* @__PURE__ */ s(
|
|
768
777
|
me,
|
|
769
778
|
{
|
|
770
|
-
className: "btn btn-lg mx-2 " + (((
|
|
771
|
-
onClick: () =>
|
|
779
|
+
className: "btn btn-lg mx-2 " + (((l = t.actions) == null ? void 0 : l[f].classList) ?? ["btn-primary"]).join(" "),
|
|
780
|
+
onClick: () => i(f),
|
|
772
781
|
children: ((E = ((b = t.actions) == null ? void 0 : b[f]) ?? null) == null ? void 0 : E.label) || f
|
|
773
782
|
},
|
|
774
783
|
f
|
|
@@ -791,15 +800,15 @@ const ln = ({ action: e, children: t, routeParams: n, results: r }) => {
|
|
|
791
800
|
/* @__PURE__ */ s("main", { children: /* @__PURE__ */ s(V, { name: "content", content: t, data: r }) })
|
|
792
801
|
] });
|
|
793
802
|
}, We = ({ action: e, children: t, onSuccess: n, modal: r, props: o }) => {
|
|
794
|
-
const a = { ...e.parameters || {}, ...Bt() }, c = R(void 0), u = R(void 0), { results: h, setParameters:
|
|
803
|
+
const a = { ...e.parameters || {}, ...Bt() }, c = R(void 0), u = R(void 0), { results: h, setParameters: i } = it({
|
|
795
804
|
entityAction: e.action,
|
|
796
805
|
initParameters: a
|
|
797
|
-
}), { open:
|
|
806
|
+
}), { open: m } = dt();
|
|
798
807
|
return v(() => {
|
|
799
|
-
|
|
808
|
+
i(a);
|
|
800
809
|
}, [JSON.stringify(a)]), v(() => {
|
|
801
|
-
var
|
|
802
|
-
(
|
|
810
|
+
var l;
|
|
811
|
+
(l = u.current) == null || l.open();
|
|
803
812
|
}, [JSON.stringify(h)]), /* @__PURE__ */ _(r ? lt : ln, { ref: u, ...o, action: e, routeParams: a, children: [
|
|
804
813
|
/* @__PURE__ */ s(B, { name: "title", children: /* @__PURE__ */ s(V, { name: "title", content: t, data: h, children: (h == null ? void 0 : h.title) || "Title" }) }),
|
|
805
814
|
/* @__PURE__ */ s(B, { name: "navigation", children: /* @__PURE__ */ s(G, { namespace: e.action.namespace, view: "navigation", prefix: "modify", children: /* @__PURE__ */ _(V, { name: "navigation", content: t, data: h, children: [
|
|
@@ -812,13 +821,13 @@ const ln = ({ action: e, children: t, routeParams: n, results: r }) => {
|
|
|
812
821
|
ref: c,
|
|
813
822
|
data: h,
|
|
814
823
|
action: e.action,
|
|
815
|
-
onSuccess: (
|
|
824
|
+
onSuccess: (l) => {
|
|
816
825
|
var E, d;
|
|
817
826
|
(E = u.current) == null || E.close();
|
|
818
|
-
const b = new CustomEvent("success", { detail:
|
|
819
|
-
n && n(b,
|
|
827
|
+
const b = new CustomEvent("success", { detail: l });
|
|
828
|
+
n && n(b, l), !b.defaultPrevented && m({
|
|
820
829
|
title: "Success",
|
|
821
|
-
text: Object.values(((d =
|
|
830
|
+
text: Object.values(((d = l.messages) == null ? void 0 : d.success) ?? []).join(" ") ?? "Item was saved successful!",
|
|
822
831
|
icon: ae.success,
|
|
823
832
|
actions: {
|
|
824
833
|
close: {
|
|
@@ -827,10 +836,10 @@ const ln = ({ action: e, children: t, routeParams: n, results: r }) => {
|
|
|
827
836
|
}
|
|
828
837
|
});
|
|
829
838
|
},
|
|
830
|
-
onError: (
|
|
831
|
-
|
|
832
|
-
title:
|
|
833
|
-
text:
|
|
839
|
+
onError: (l) => {
|
|
840
|
+
m({
|
|
841
|
+
title: l.status + " " + l.detail,
|
|
842
|
+
text: l.detail,
|
|
834
843
|
icon: ae.denied,
|
|
835
844
|
actions: {
|
|
836
845
|
close: {
|
|
@@ -853,8 +862,8 @@ const ln = ({ action: e, children: t, routeParams: n, results: r }) => {
|
|
|
853
862
|
type: "submit",
|
|
854
863
|
className: "btn btn-primary",
|
|
855
864
|
onClick: () => {
|
|
856
|
-
var
|
|
857
|
-
return (b = (
|
|
865
|
+
var l, b;
|
|
866
|
+
return (b = (l = c.current) == null ? void 0 : l.getFormRef()) == null ? void 0 : b.submit();
|
|
858
867
|
},
|
|
859
868
|
children: "Submit"
|
|
860
869
|
}
|
|
@@ -1020,13 +1029,13 @@ function Qe(e, t, n, r, o) {
|
|
|
1020
1029
|
if (!d.relatedTarget || d.relatedTarget !== d.delegateTarget && !d.delegateTarget.contains(d.relatedTarget))
|
|
1021
1030
|
return E.call(this, d);
|
|
1022
1031
|
})(c));
|
|
1023
|
-
const h = bt(e),
|
|
1024
|
-
if (
|
|
1025
|
-
|
|
1032
|
+
const h = bt(e), i = h[u] || (h[u] = {}), m = yt(i, c, a ? n : null);
|
|
1033
|
+
if (m) {
|
|
1034
|
+
m.oneOff = m.oneOff && o;
|
|
1026
1035
|
return;
|
|
1027
1036
|
}
|
|
1028
|
-
const f = gt(c, t.replace(En, "")),
|
|
1029
|
-
|
|
1037
|
+
const f = gt(c, t.replace(En, "")), l = a ? On(e, n, c) : An(e, c);
|
|
1038
|
+
l.delegationSelector = a ? n : null, l.callable = c, l.oneOff = o, l.uidEvent = f, i[f] = l, e.addEventListener(u, l, a);
|
|
1030
1039
|
}
|
|
1031
1040
|
function Te(e, t, n, r, o) {
|
|
1032
1041
|
const a = yt(t[n], r, o);
|
|
@@ -1050,29 +1059,29 @@ const I = {
|
|
|
1050
1059
|
off(e, t, n, r) {
|
|
1051
1060
|
if (typeof t != "string" || !e)
|
|
1052
1061
|
return;
|
|
1053
|
-
const [o, a, c] = Et(t, n, r), u = c !== t, h = bt(e),
|
|
1062
|
+
const [o, a, c] = Et(t, n, r), u = c !== t, h = bt(e), i = h[c] || {}, m = t.startsWith(".");
|
|
1054
1063
|
if (typeof a < "u") {
|
|
1055
|
-
if (!Object.keys(
|
|
1064
|
+
if (!Object.keys(i).length)
|
|
1056
1065
|
return;
|
|
1057
1066
|
Te(e, h, c, a, o ? n : null);
|
|
1058
1067
|
return;
|
|
1059
1068
|
}
|
|
1060
|
-
if (
|
|
1069
|
+
if (m)
|
|
1061
1070
|
for (const f of Object.keys(h))
|
|
1062
1071
|
Sn(e, h, f, t.slice(1));
|
|
1063
|
-
for (const [f,
|
|
1072
|
+
for (const [f, l] of Object.entries(i)) {
|
|
1064
1073
|
const b = f.replace(Nn, "");
|
|
1065
|
-
(!u || t.includes(b)) && Te(e, h, c,
|
|
1074
|
+
(!u || t.includes(b)) && Te(e, h, c, l.callable, l.delegationSelector);
|
|
1066
1075
|
}
|
|
1067
1076
|
},
|
|
1068
1077
|
trigger(e, t, n) {
|
|
1069
1078
|
if (typeof t != "string" || !e)
|
|
1070
1079
|
return null;
|
|
1071
1080
|
const r = pt(), o = _t(t), a = t !== o;
|
|
1072
|
-
let c = null, u = !0, h = !0,
|
|
1073
|
-
a && r && (c = r.Event(t, n), r(e).trigger(c), u = !c.isPropagationStopped(), h = !c.isImmediatePropagationStopped(),
|
|
1074
|
-
const
|
|
1075
|
-
return
|
|
1081
|
+
let c = null, u = !0, h = !0, i = !1;
|
|
1082
|
+
a && r && (c = r.Event(t, n), r(e).trigger(c), u = !c.isPropagationStopped(), h = !c.isImmediatePropagationStopped(), i = c.isDefaultPrevented());
|
|
1083
|
+
const m = Ie(new Event(t, { bubbles: u, cancelable: !0 }), n);
|
|
1084
|
+
return i && m.preventDefault(), h && e.dispatchEvent(m), m.defaultPrevented && c && c.preventDefault(), m;
|
|
1076
1085
|
}
|
|
1077
1086
|
};
|
|
1078
1087
|
function Ie(e, t = {}) {
|
|
@@ -1273,7 +1282,7 @@ const ye = (e) => {
|
|
|
1273
1282
|
const t = ye(e);
|
|
1274
1283
|
return t ? U.find(t) : [];
|
|
1275
1284
|
}
|
|
1276
|
-
}, Ze = "dropdown", Ln = "bs.dropdown", Z = `.${Ln}`, Ve = ".data-api", jn = "Escape", Xe = "Tab",
|
|
1285
|
+
}, Ze = "dropdown", Ln = "bs.dropdown", Z = `.${Ln}`, Ve = ".data-api", jn = "Escape", Xe = "Tab", xn = "ArrowUp", et = "ArrowDown", kn = 2, Rn = `hide${Z}`, Mn = `hidden${Z}`, vn = `show${Z}`, Fn = `shown${Z}`, Nt = `click${Z}${Ve}`, Ct = `keydown${Z}${Ve}`, In = `keyup${Z}${Ve}`, te = "show", Vn = "dropup", $n = "dropend", Un = "dropstart", Bn = "dropup-center", Kn = "dropdown-center", q = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)', Hn = `${q}.${te}`, le = ".dropdown-menu", wn = ".navbar", Yn = ".navbar-nav", Wn = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)", qn = ne() ? "top-end" : "top-start", zn = ne() ? "top-start" : "top-end", Jn = ne() ? "bottom-end" : "bottom-start", Qn = ne() ? "bottom-start" : "bottom-end", Gn = ne() ? "left-start" : "right-start", Zn = ne() ? "right-start" : "left-start", Xn = "top", er = "bottom", tr = {
|
|
1277
1286
|
autoClose: !0,
|
|
1278
1287
|
boundary: "clippingParents",
|
|
1279
1288
|
display: "dynamic",
|
|
@@ -1420,7 +1429,7 @@ let X = class ue extends Dn {
|
|
|
1420
1429
|
});
|
|
1421
1430
|
}
|
|
1422
1431
|
static clearMenus(t) {
|
|
1423
|
-
if (t.button ===
|
|
1432
|
+
if (t.button === kn || t.type === "keyup" && t.key !== Xe)
|
|
1424
1433
|
return;
|
|
1425
1434
|
const n = U.find(Hn);
|
|
1426
1435
|
for (const r of n) {
|
|
@@ -1435,7 +1444,7 @@ let X = class ue extends Dn {
|
|
|
1435
1444
|
}
|
|
1436
1445
|
}
|
|
1437
1446
|
static dataApiKeydownHandler(t) {
|
|
1438
|
-
const n = /input|textarea/i.test(t.target.tagName), r = t.key === jn, o = [
|
|
1447
|
+
const n = /input|textarea/i.test(t.target.tagName), r = t.key === jn, o = [xn, et].includes(t.key);
|
|
1439
1448
|
if (!o && !r || n && !r)
|
|
1440
1449
|
return;
|
|
1441
1450
|
t.preventDefault();
|
|
@@ -1455,23 +1464,23 @@ I.on(document, Nt, q, function(e) {
|
|
|
1455
1464
|
e.preventDefault(), X.getOrCreateInstance(this).toggle();
|
|
1456
1465
|
});
|
|
1457
1466
|
gn(X);
|
|
1458
|
-
const fe = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ s(
|
|
1467
|
+
const fe = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ s(k, { children: e }), oe = ({ children: e, ...t }) => /* @__PURE__ */ s("div", { className: "dropdown-menu", children: e }), At = ({ items: e, className: t, children: n, icon: r }) => {
|
|
1459
1468
|
const o = R(null);
|
|
1460
1469
|
v(() => {
|
|
1461
|
-
const
|
|
1470
|
+
const m = new X(o.current);
|
|
1462
1471
|
return () => {
|
|
1463
|
-
|
|
1472
|
+
m.dispose();
|
|
1464
1473
|
};
|
|
1465
1474
|
}, []);
|
|
1466
|
-
const a = S.Children.toArray(n).find((
|
|
1467
|
-
return /* @__PURE__ */ _("div", { className: [...(t || "").split(" "), "dropdown"].filter((
|
|
1468
|
-
/* @__PURE__ */ s(me, { ref: o, "data-bs-toggle": "dropdown", ...
|
|
1475
|
+
const a = S.Children.toArray(n).find((m) => S.isValidElement(m) && m.type === oe), c = S.Children.toArray(n).filter((m) => S.isValidElement(m) && m.type === qe), u = S.Children.toArray(n).find((m) => S.isValidElement(m) && m.type === fe), h = S.Children.toArray(n).filter((m) => !S.isValidElement(m) || m.type !== qe && m.type !== oe && m.type !== fe), i = S.isValidElement(u) ? u.props : {};
|
|
1476
|
+
return /* @__PURE__ */ _("div", { className: [...(t || "").split(" "), "dropdown"].filter((m, f, l) => l.indexOf(m) === f).join(" "), children: [
|
|
1477
|
+
/* @__PURE__ */ s(me, { ref: o, "data-bs-toggle": "dropdown", ...i, className: [...(i.className || "").split(" "), "btn", "dropdown-toggle"].filter((m, f, l) => l.indexOf(m) === f).join(" "), children: i.children ? i.children : h }),
|
|
1469
1478
|
a || /* @__PURE__ */ s(oe, { children: c })
|
|
1470
1479
|
] });
|
|
1471
1480
|
}, rr = ie(({ data: e, columns: t, options: n, onClick: r, onBatchClick: o, routeParams: a, namespace: c }, u) => {
|
|
1472
|
-
var D, y, O, M,
|
|
1481
|
+
var D, y, O, M, x, L, F;
|
|
1473
1482
|
t = (t || ((D = e == null ? void 0 : e.entity) == null ? void 0 : D.columns) || []).filter((g) => g.group !== !1);
|
|
1474
|
-
const [, h] = $(),
|
|
1483
|
+
const [, h] = $(), i = (y = e == null ? void 0 : e.entity) == null ? void 0 : y.primaryColumn, m = Object.values((e == null ? void 0 : e.action) || []), f = m.filter((g) => g.object), l = t.length + (m.length ? 1 : 0), b = ((e == null ? void 0 : e.entity.data.items) || []).map((g) => g[(i == null ? void 0 : i.field) || ""] || 0), E = R([]), d = !!b.length && b.reduce((g, T) => g && E.current.includes(T), !0), p = (x = (M = (O = e == null ? void 0 : e.form) == null ? void 0 : O.batch.view.children) == null ? void 0 : M.method) == null ? void 0 : x.choices, C = !!(p != null && p.length) && i, N = (g, T = !1) => {
|
|
1475
1484
|
T ? E.current.push(g) : E.current = E.current.filter((j) => j !== g), h({});
|
|
1476
1485
|
}, A = (g = !1) => {
|
|
1477
1486
|
E.current = (g ? E.current.concat(b) : E.current.filter((T) => !b.includes(T))).filter((T, j, K) => K.indexOf(T) === j), h({});
|
|
@@ -1488,7 +1497,7 @@ const fe = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ s(x,
|
|
|
1488
1497
|
j.append(`${(Ue = T == null ? void 0 : T.children) == null ? void 0 : Ue.ids.full_name}[]`, re.toString());
|
|
1489
1498
|
}), j.append(((H = T == null ? void 0 : T.children) == null ? void 0 : H.method.full_name) || "method", g), o(g, E.current, j);
|
|
1490
1499
|
};
|
|
1491
|
-
return /* @__PURE__ */ _(
|
|
1500
|
+
return /* @__PURE__ */ _(k, { children: [
|
|
1492
1501
|
C && /* @__PURE__ */ _("div", { className: "btn-group btn-group-sm mb-2", children: [
|
|
1493
1502
|
/* @__PURE__ */ s("label", { className: "btn btn-light", children: /* @__PURE__ */ s(
|
|
1494
1503
|
"input",
|
|
@@ -1528,7 +1537,7 @@ const fe = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ s(x,
|
|
|
1528
1537
|
}
|
|
1529
1538
|
)
|
|
1530
1539
|
] }, T)),
|
|
1531
|
-
|
|
1540
|
+
i && f.length > 0 && /* @__PURE__ */ s("th", { className: "text-end", children: "Actions" })
|
|
1532
1541
|
] }) }),
|
|
1533
1542
|
/* @__PURE__ */ s("tbody", { children: e && (e.entity.data.items.length ? e.entity.data.items.map(
|
|
1534
1543
|
(g, T) => /* @__PURE__ */ _("tr", { children: [
|
|
@@ -1539,19 +1548,19 @@ const fe = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ s(x,
|
|
|
1539
1548
|
K === 0 && C && /* @__PURE__ */ s(
|
|
1540
1549
|
"input",
|
|
1541
1550
|
{
|
|
1542
|
-
checked: E.current.includes(g[
|
|
1551
|
+
checked: E.current.includes(g[i == null ? void 0 : i.field]),
|
|
1543
1552
|
className: "me-2",
|
|
1544
1553
|
type: "checkbox",
|
|
1545
1554
|
name: e.form.batch.view.full_name,
|
|
1546
|
-
value: g[
|
|
1547
|
-
onChange: (re) => N(g[
|
|
1555
|
+
value: g[i == null ? void 0 : i.field],
|
|
1556
|
+
onChange: (re) => N(g[i == null ? void 0 : i.field], re.target.checked)
|
|
1548
1557
|
}
|
|
1549
1558
|
),
|
|
1550
1559
|
/* @__PURE__ */ s(G, { namespace: c || "unknown", data: g, prefix: "list", view: j.field, children: g[j.field] !== void 0 && (g[j.field] instanceof Object ? g[j.field] instanceof Array ? g[j.field].join(", ") : JSON.stringify(g[j.field]) : (H = g[j.field]) == null ? void 0 : H.toString()) })
|
|
1551
1560
|
] }, K);
|
|
1552
1561
|
}
|
|
1553
1562
|
),
|
|
1554
|
-
|
|
1563
|
+
i && f.length > 0 && /* @__PURE__ */ s("td", { className: "text-end text-nowrap", children: f.map((j, K) => {
|
|
1555
1564
|
var H;
|
|
1556
1565
|
return /* @__PURE__ */ s(
|
|
1557
1566
|
z,
|
|
@@ -1560,13 +1569,13 @@ const fe = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ s(x,
|
|
|
1560
1569
|
action: j,
|
|
1561
1570
|
parameters: {
|
|
1562
1571
|
...a || {},
|
|
1563
|
-
id: g[
|
|
1572
|
+
id: g[i == null ? void 0 : i.field]
|
|
1564
1573
|
}
|
|
1565
1574
|
}, re),
|
|
1566
1575
|
className: ["btn", "btn-sm", "mb-1", "ms-1", (((H = j.route) == null ? void 0 : H.methods) ?? []).includes("DELETE") ? "btn-outline-danger" : "btn-outline-secondary"].join(" "),
|
|
1567
1576
|
to: Y(j.route, {
|
|
1568
1577
|
...a || {},
|
|
1569
|
-
id: g[
|
|
1578
|
+
id: g[i.field]
|
|
1570
1579
|
}),
|
|
1571
1580
|
children: j.title
|
|
1572
1581
|
},
|
|
@@ -1574,7 +1583,7 @@ const fe = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ s(x,
|
|
|
1574
1583
|
);
|
|
1575
1584
|
}) })
|
|
1576
1585
|
] }, T)
|
|
1577
|
-
) : /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s("td", { colSpan:
|
|
1586
|
+
) : /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s("td", { colSpan: l, children: "Not results found." }) })) })
|
|
1578
1587
|
] })
|
|
1579
1588
|
] });
|
|
1580
1589
|
}), se = ({ route: e, page: t, active: n = !1, title: r, children: o }) => {
|
|
@@ -1594,7 +1603,7 @@ const fe = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ s(x,
|
|
|
1594
1603
|
/* @__PURE__ */ _("small", { className: "mb-2", children: [
|
|
1595
1604
|
e.totalResults,
|
|
1596
1605
|
" Results",
|
|
1597
|
-
a && /* @__PURE__ */ _(
|
|
1606
|
+
a && /* @__PURE__ */ _(k, { children: [
|
|
1598
1607
|
" - Page ",
|
|
1599
1608
|
r,
|
|
1600
1609
|
" of ",
|
|
@@ -1603,12 +1612,12 @@ const fe = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ s(x,
|
|
|
1603
1612
|
] }),
|
|
1604
1613
|
a && /* @__PURE__ */ s("nav", { "aria-label": "Page navigation", className: "m-auto text-center d-inline", children: /* @__PURE__ */ _("ul", { className: "pagination pagination-sm", children: [
|
|
1605
1614
|
r > 1 && /* @__PURE__ */ s(se, { page: r - 1, title: "Go to First Page", children: "«" }),
|
|
1606
|
-
e.links[0] !== 1 && /* @__PURE__ */ _(
|
|
1615
|
+
e.links[0] !== 1 && /* @__PURE__ */ _(k, { children: [
|
|
1607
1616
|
/* @__PURE__ */ s(se, { page: 1, active: r === 1, children: 1 }, 1),
|
|
1608
1617
|
/* @__PURE__ */ s("div", { className: "page-item", children: /* @__PURE__ */ s("a", { className: "page-link", children: "..." }) })
|
|
1609
1618
|
] }),
|
|
1610
1619
|
(o || []).map((c, u) => /* @__PURE__ */ s(se, { page: c, active: c === r }, u)),
|
|
1611
|
-
[...e.links].reverse()[0] !== n && /* @__PURE__ */ _(
|
|
1620
|
+
[...e.links].reverse()[0] !== n && /* @__PURE__ */ _(k, { children: [
|
|
1612
1621
|
/* @__PURE__ */ s("div", { className: "page-item", children: /* @__PURE__ */ s("a", { className: "page-link", children: "..." }) }),
|
|
1613
1622
|
/* @__PURE__ */ s(
|
|
1614
1623
|
se,
|
|
@@ -1682,28 +1691,28 @@ function ir(e) {
|
|
|
1682
1691
|
}
|
|
1683
1692
|
const lr = W(({ action: e, embedded: t = !1 }) => {
|
|
1684
1693
|
var N, A, P, D;
|
|
1685
|
-
const n = Kt(), [r, o] = Ht(), a = R(void 0), c = R(vt(r)), u = R(null), { openModal: h } = cr(), { open:
|
|
1686
|
-
if (!
|
|
1694
|
+
const n = Kt(), [r, o] = Ht(), a = R(void 0), c = R(vt(r)), u = R(null), { openModal: h } = cr(), { open: i } = dt(), m = e.action.entity;
|
|
1695
|
+
if (!m)
|
|
1687
1696
|
throw new Error("Invalid Entity");
|
|
1688
|
-
const { results: f, refresh:
|
|
1689
|
-
y == null || y.forEach((
|
|
1697
|
+
const { results: f, refresh: l, setQueryParameters: b } = it({ entityAction: e.action, initParameters: e.parameters, initQueryParameters: c.current }), E = Object.values((f == null ? void 0 : f.action) ?? []).filter((y) => !y.object && y.name !== e.action.name), d = (y) => {
|
|
1698
|
+
y == null || y.forEach((x) => {
|
|
1690
1699
|
var L, F;
|
|
1691
|
-
(F = (L = c.current) == null ? void 0 : L.filter) == null || delete F[
|
|
1700
|
+
(F = (L = c.current) == null ? void 0 : L.filter) == null || delete F[x];
|
|
1692
1701
|
});
|
|
1693
1702
|
const O = {
|
|
1694
1703
|
...c.current && c.current,
|
|
1695
1704
|
...a.current && { sort: a.current }
|
|
1696
1705
|
}, M = nt(De(O));
|
|
1697
1706
|
t ? b(M) : o(M);
|
|
1698
|
-
},
|
|
1699
|
-
console.log("method", O, M),
|
|
1707
|
+
}, p = (y, O, M) => {
|
|
1708
|
+
console.log("method", O, M), i({
|
|
1700
1709
|
title: "Are you sure?",
|
|
1701
1710
|
icon: ae.confirm,
|
|
1702
|
-
onResult: (
|
|
1703
|
-
|
|
1711
|
+
onResult: (x) => {
|
|
1712
|
+
x.isConfirmed && ce().post(Y(e.action.route, e.parameters), M).catch((L) => {
|
|
1704
1713
|
console.log("error", L);
|
|
1705
1714
|
}).finally(() => {
|
|
1706
|
-
console.log("done"),
|
|
1715
|
+
console.log("done"), l();
|
|
1707
1716
|
});
|
|
1708
1717
|
}
|
|
1709
1718
|
});
|
|
@@ -1718,17 +1727,17 @@ const lr = W(({ action: e, embedded: t = !1 }) => {
|
|
|
1718
1727
|
break;
|
|
1719
1728
|
}
|
|
1720
1729
|
case "delete": {
|
|
1721
|
-
O == null || O.preventDefault(),
|
|
1730
|
+
O == null || O.preventDefault(), i({
|
|
1722
1731
|
title: "Are you sure?",
|
|
1723
1732
|
icon: ae.confirm,
|
|
1724
1733
|
onResult: (M) => {
|
|
1725
1734
|
M.isConfirmed && ce().fetch({
|
|
1726
1735
|
url: Y(y.action.route, { ...e.parameters, ...y.parameters }),
|
|
1727
1736
|
method: It.DELETE
|
|
1728
|
-
}).catch((
|
|
1729
|
-
console.log("error",
|
|
1737
|
+
}).catch((x) => {
|
|
1738
|
+
console.log("error", x);
|
|
1730
1739
|
}).finally(() => {
|
|
1731
|
-
|
|
1740
|
+
l();
|
|
1732
1741
|
});
|
|
1733
1742
|
}
|
|
1734
1743
|
});
|
|
@@ -1739,7 +1748,7 @@ const lr = W(({ action: e, embedded: t = !1 }) => {
|
|
|
1739
1748
|
action: y,
|
|
1740
1749
|
props: {
|
|
1741
1750
|
onClose: () => {
|
|
1742
|
-
|
|
1751
|
+
l();
|
|
1743
1752
|
}
|
|
1744
1753
|
}
|
|
1745
1754
|
}));
|
|
@@ -1750,7 +1759,7 @@ const lr = W(({ action: e, embedded: t = !1 }) => {
|
|
|
1750
1759
|
};
|
|
1751
1760
|
return v(() => {
|
|
1752
1761
|
b(r);
|
|
1753
|
-
}, [n]), /* @__PURE__ */ s(
|
|
1762
|
+
}, [n]), /* @__PURE__ */ s(k, { children: /* @__PURE__ */ _("section", { className: "list", children: [
|
|
1754
1763
|
/* @__PURE__ */ _("header", { className: "content-header d-md-flex mb-3 justify-content-between align-items-center", children: [
|
|
1755
1764
|
/* @__PURE__ */ s("h2", { children: f == null ? void 0 : f.title }),
|
|
1756
1765
|
/* @__PURE__ */ _("div", { className: "d-flex align-items-center", children: [
|
|
@@ -1773,14 +1782,14 @@ const lr = W(({ action: e, embedded: t = !1 }) => {
|
|
|
1773
1782
|
/* @__PURE__ */ s(oe, { children: /* @__PURE__ */ s("div", { className: "filter", children: /* @__PURE__ */ _(
|
|
1774
1783
|
ot,
|
|
1775
1784
|
{
|
|
1776
|
-
id: "filter_" + ve(
|
|
1785
|
+
id: "filter_" + ve(m),
|
|
1777
1786
|
ref: u,
|
|
1778
1787
|
onSubmit: (y) => C({
|
|
1779
1788
|
action: {
|
|
1780
1789
|
name: "filter",
|
|
1781
1790
|
object: !1,
|
|
1782
1791
|
namespace: e.action.namespace,
|
|
1783
|
-
entity:
|
|
1792
|
+
entity: m
|
|
1784
1793
|
},
|
|
1785
1794
|
parameters: Ft(y)
|
|
1786
1795
|
}),
|
|
@@ -1789,7 +1798,7 @@ const lr = W(({ action: e, embedded: t = !1 }) => {
|
|
|
1789
1798
|
name: "filter",
|
|
1790
1799
|
object: !1,
|
|
1791
1800
|
namespace: e.action.namespace,
|
|
1792
|
-
entity:
|
|
1801
|
+
entity: m
|
|
1793
1802
|
}
|
|
1794
1803
|
}),
|
|
1795
1804
|
children: [
|
|
@@ -1813,7 +1822,7 @@ const lr = W(({ action: e, embedded: t = !1 }) => {
|
|
|
1813
1822
|
{
|
|
1814
1823
|
data: f,
|
|
1815
1824
|
onClick: C,
|
|
1816
|
-
onBatchClick:
|
|
1825
|
+
onBatchClick: p,
|
|
1817
1826
|
namespace: e.action.namespace,
|
|
1818
1827
|
routeParams: e.parameters
|
|
1819
1828
|
}
|
|
@@ -1845,7 +1854,7 @@ const lr = W(({ action: e, embedded: t = !1 }) => {
|
|
|
1845
1854
|
}, Tt = ({ view: e, namespace: t, props: n }) => /* @__PURE__ */ s(G, { namespace: t, view: e, props: n, children: /* @__PURE__ */ s(dr, { view: e, props: n }) }, t + e), fr = ({ path: e }) => {
|
|
1846
1855
|
const t = Qt();
|
|
1847
1856
|
e ?? (e = document.location.pathname.replace(new RegExp("^" + (t == null ? void 0 : t.pathnameBase) + "(/)?"), "/"));
|
|
1848
|
-
const { getOnClickActionByPath: n } = Re(), r =
|
|
1857
|
+
const { getOnClickActionByPath: n } = Re(), r = kt(n(e));
|
|
1849
1858
|
if (!r)
|
|
1850
1859
|
throw new Q(404, "Missing Route");
|
|
1851
1860
|
return /* @__PURE__ */ s(
|
|
@@ -1859,16 +1868,16 @@ const lr = W(({ action: e, embedded: t = !1 }) => {
|
|
|
1859
1868
|
};
|
|
1860
1869
|
let Ee;
|
|
1861
1870
|
const $e = "dakataa_crud", Nr = (e) => {
|
|
1862
|
-
|
|
1871
|
+
xe.namespace[$e] = {
|
|
1863
1872
|
baseURL: e,
|
|
1864
1873
|
headers: {
|
|
1865
1874
|
Accept: "application/json"
|
|
1866
1875
|
}
|
|
1867
1876
|
};
|
|
1868
|
-
}, ce = () => (Ee || (Ee = new
|
|
1869
|
-
if (!
|
|
1870
|
-
throw new
|
|
1871
|
-
return /* @__PURE__ */ s(St, { children: /* @__PURE__ */ s(Wt, { fallback: /* @__PURE__ */ s(zt, {}), children: /* @__PURE__ */ s(Rt, { fallback: /* @__PURE__ */ s(
|
|
1877
|
+
}, ce = () => (Ee || (Ee = new xe({}, $e)), Ee), Cr = () => {
|
|
1878
|
+
if (!xe.namespace[$e])
|
|
1879
|
+
throw new ke(500, "Invalid Configuration.");
|
|
1880
|
+
return /* @__PURE__ */ s(St, { children: /* @__PURE__ */ s(Wt, { fallback: /* @__PURE__ */ s(zt, {}), children: /* @__PURE__ */ s(Rt, { fallback: /* @__PURE__ */ s(k, { children: "Loading" }), children: /* @__PURE__ */ s(fr, {}) }) }) });
|
|
1872
1881
|
};
|
|
1873
1882
|
export {
|
|
1874
1883
|
cn as AlertProvider,
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dakataa/crud-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Dakataa CRUD React",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/crud-react.js",
|
|
8
|
+
"module": "dist/crud-react.js",
|
|
8
9
|
"types": "dist/main.d.ts",
|
|
9
10
|
"files": [
|
|
10
11
|
"dist"
|
|
@@ -50,18 +51,14 @@
|
|
|
50
51
|
"last 1 safari version"
|
|
51
52
|
]
|
|
52
53
|
},
|
|
53
|
-
"dependencies": {
|
|
54
|
-
"@dakataa/crud-theme": "^1.0.1",
|
|
55
|
-
"@fortawesome/fontawesome-common-types": "^6.7.2",
|
|
56
|
-
"@popperjs/core": "^2.11.8"
|
|
57
|
-
},
|
|
58
54
|
"peerDependencies": {
|
|
55
|
+
"@dakataa/crud-theme": "^1.0.1",
|
|
56
|
+
"@dakataa/requester": "^1.0.4",
|
|
57
|
+
"@popperjs/core": "^2.11.8",
|
|
58
|
+
"lottie-web": "^5.12.2",
|
|
59
59
|
"react": "^19.0.0",
|
|
60
60
|
"react-dom": "^19.0.0",
|
|
61
|
-
"react-router": "^7.3.0"
|
|
62
|
-
"lottie-web": "^5.12.2",
|
|
63
|
-
"dotenv": "^16.4.5",
|
|
64
|
-
"@dakataa/requester": "^1.0.4"
|
|
61
|
+
"react-router": "^7.3.0"
|
|
65
62
|
},
|
|
66
63
|
"devDependencies": {
|
|
67
64
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -73,6 +70,7 @@
|
|
|
73
70
|
"@types/react-dom": "^19.0.4",
|
|
74
71
|
"@vitejs/plugin-react": "^4.3.4",
|
|
75
72
|
"babel-plugin-transform-imports": "^2.0.0",
|
|
73
|
+
"dotenv": "^16.4.5",
|
|
76
74
|
"path": "^0.12.7",
|
|
77
75
|
"sass": "^1.81.0",
|
|
78
76
|
"source-map-explorer": "^2.5.3",
|