@dakataa/crud-react 2.0.0 → 2.1.0
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/CHANGELOG.md +25 -0
- package/README.md +43 -0
- package/dist/Crud.d.ts +2 -2
- package/dist/component/BaseButtonContent.d.ts +2 -2
- package/dist/component/Button.d.ts +2 -2
- package/dist/component/Dropdown.d.ts +4 -4
- package/dist/component/Empty.d.ts +2 -2
- package/dist/component/Link.d.ts +1 -1
- package/dist/component/LottieAnimation.d.ts +1 -1
- package/dist/component/Modal.d.ts +3 -3
- package/dist/component/Money.d.ts +1 -1
- package/dist/component/Preloader.d.ts +4 -4
- package/dist/component/crud/ActionLink.d.ts +1 -1
- package/dist/component/crud/CrudLoader.d.ts +3 -3
- package/dist/component/crud/DynamicView.d.ts +1 -1
- package/dist/component/crud/FiltersView.d.ts +2 -1
- package/dist/component/crud/GridView.d.ts +2 -2
- package/dist/component/crud/IsListItemActionGranted.d.ts +1 -1
- package/dist/component/crud/ItemAction.d.ts +2 -2
- package/dist/component/crud/ItemActions.d.ts +2 -1
- package/dist/component/crud/ItemLabel.d.ts +2 -1
- package/dist/component/crud/ItemValue.d.ts +2 -1
- package/dist/component/crud/ListItem.d.ts +2 -1
- package/dist/component/crud/ListView.d.ts +2 -2
- package/dist/component/crud/Modify.d.ts +1 -1
- package/dist/component/crud/Paginator.d.ts +2 -1
- package/dist/component/crud/ViewLoader.d.ts +2 -1
- package/dist/component/crud/batch/BatchActionSelector.d.ts +2 -1
- package/dist/component/crud/batch/BatchActionsContext.d.ts +2 -2
- package/dist/component/crud/batch/BatchItemSelector.d.ts +2 -1
- package/dist/component/crud/form/Form.d.ts +1 -1
- package/dist/component/crud/form/FormError.d.ts +1 -1
- package/dist/component/crud/form/FormField.d.ts +1 -1
- package/dist/component/crud/form/FormGroup.d.ts +3 -3
- package/dist/component/crud/form/FormGroupViewLoader.d.ts +1 -1
- package/dist/component/crud/form/FormLabel.d.ts +1 -1
- package/dist/component/crud/form/FormRest.d.ts +1 -1
- package/dist/component/crud/form/FormRestError.d.ts +1 -1
- package/dist/component/error/ErrorBoundary.d.ts +2 -2
- package/dist/component/form/Choice.d.ts +4 -4
- package/dist/component/form/Collection.d.ts +2 -2
- package/dist/component/form/Form.d.ts +1 -1
- package/dist/component/form/FormAlert.d.ts +1 -1
- package/dist/component/form/FormFieldError.d.ts +1 -1
- package/dist/component/form/FormGroup.d.ts +1 -1
- package/dist/component/form/FormSetting.d.ts +2 -2
- package/dist/component/router/Route.d.ts +2 -1
- package/dist/component/templating/Template.d.ts +2 -2
- package/dist/component/templating/TemplateBlock.d.ts +1 -1
- package/dist/component/templating/TemplateParentBlock.d.ts +2 -2
- package/dist/context/ActionContext.d.ts +2 -2
- package/dist/context/AlertContext.d.ts +2 -2
- package/dist/context/ConfigContext.d.ts +2 -2
- package/dist/context/CrudProvider.d.ts +2 -2
- package/dist/context/GetData.d.ts +2 -2
- package/dist/context/ListContext.d.ts +2 -2
- package/dist/context/ListItemContext.d.ts +2 -2
- package/dist/context/LoaderContext.d.ts +2 -2
- package/dist/context/ModalContext.d.ts +2 -2
- package/dist/context/ModalScopeContext.d.ts +5 -0
- package/dist/context/NamespaceContext.d.ts +2 -2
- package/dist/crud-react.js +1159 -1170
- package/dist/layout/default/Base.d.ts +1 -1
- package/dist/layout/default/Error.d.ts +1 -1
- package/dist/layout/default/Main.d.ts +2 -1
- package/dist/main.d.ts +1 -0
- package/dist/type/ViewType.d.ts +2 -0
- package/package.json +1 -1
- /package/dist/{denied-Emsz18Y8.js → denied-Cg2igDWh.js} +0 -0
- /package/dist/{info-C897Uj_w.js → info-Dfyx45FU.js} +0 -0
- /package/dist/{success-YbPKEx5j.js → success-B5xn1-UX.js} +0 -0
- /package/dist/{warning-DJITKJj5.js → warning-BaaC-X6i.js} +0 -0
package/dist/crud-react.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
|
-
import t, { Children as n,
|
|
3
|
-
import
|
|
2
|
+
import t, { Children as n, createContext as r, createElement as i, createRef as a, forwardRef as o, memo as s, useCallback as c, useContext as l, useEffect as u, useId as d, useImperativeHandle as f, useLayoutEffect as p, useMemo as m, useReducer as h, useRef as g, useState as _, useSyncExternalStore as v } from "react";
|
|
3
|
+
import y, { InterceptEvent as b, Method as ee, RequestBodyType as te, convertFormDataToObject as x, convertObjectToURLSearchParams as S, convertURLSearchParamsToObject as C } from "@dakataa/requester";
|
|
4
4
|
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import
|
|
7
|
-
import * as
|
|
5
|
+
import { createPortal as ne } from "react-dom";
|
|
6
|
+
import re from "lottie-web";
|
|
7
|
+
import * as ie from "@popperjs/core";
|
|
8
8
|
//#region src/component/error/Exception.tsx
|
|
9
|
-
var
|
|
9
|
+
var D = class {
|
|
10
10
|
detail;
|
|
11
11
|
code;
|
|
12
12
|
trace;
|
|
@@ -14,7 +14,7 @@ var O = class {
|
|
|
14
14
|
constructor(e = 0, t, n, r) {
|
|
15
15
|
this.code = e, this.detail = t, this.trace = n, this.name = r;
|
|
16
16
|
}
|
|
17
|
-
},
|
|
17
|
+
}, ae = {
|
|
18
18
|
400: {
|
|
19
19
|
group: 400,
|
|
20
20
|
name: "Bad Request",
|
|
@@ -215,15 +215,15 @@ var O = class {
|
|
|
215
215
|
name: "Network Authentication Required",
|
|
216
216
|
description: "The client needs to authenticate to gain network access."
|
|
217
217
|
}
|
|
218
|
-
},
|
|
218
|
+
}, oe = class extends D {
|
|
219
219
|
status = 400;
|
|
220
220
|
constructor(e, t, n, r) {
|
|
221
|
-
super(0, t ||
|
|
221
|
+
super(0, t || ae[e]?.description || "Unknown error", n, r || ae[e]?.name || void 0), this.status = e;
|
|
222
222
|
}
|
|
223
|
-
},
|
|
223
|
+
}, se = s(({ children: e }) => /* @__PURE__ */ T("div", {
|
|
224
224
|
className: "crud",
|
|
225
225
|
children: e
|
|
226
|
-
})),
|
|
226
|
+
})), ce = s(({ error: e, resetErrorBoundary: t, homePath: n = "/" }) => /* @__PURE__ */ T(se, { children: /* @__PURE__ */ T("main", { children: /* @__PURE__ */ E("div", {
|
|
227
227
|
className: "content d-flex flex-column",
|
|
228
228
|
children: [
|
|
229
229
|
/* @__PURE__ */ T("h1", {
|
|
@@ -241,47 +241,43 @@ var O = class {
|
|
|
241
241
|
onClick: (e) => {
|
|
242
242
|
e.preventDefault();
|
|
243
243
|
let r = new URL(n, window.location.href);
|
|
244
|
-
|
|
245
|
-
t?.();
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
window.history.pushState(null, "", n);
|
|
244
|
+
r.pathname === window.location.pathname && r.search === window.location.search ? t?.() : window.history.pushState(null, "", n);
|
|
249
245
|
},
|
|
250
246
|
children: "Back to home"
|
|
251
247
|
}) })
|
|
252
248
|
]
|
|
253
|
-
}) }) })),
|
|
249
|
+
}) }) })), le = {
|
|
254
250
|
hasError: !1,
|
|
255
251
|
error: null
|
|
256
|
-
},
|
|
257
|
-
if (e instanceof
|
|
258
|
-
if (e instanceof Error) return new
|
|
252
|
+
}, ue = (e, t) => !e || !t ? !1 : e.length !== t.length || e.some((e, n) => !Object.is(e, t[n])), de = (e) => {
|
|
253
|
+
if (e instanceof D) return e;
|
|
254
|
+
if (e instanceof Error) return new D(0, e.message || "Unknown Error", void 0, e.name);
|
|
259
255
|
if (typeof e == "object" && e) {
|
|
260
256
|
let t = e, n = typeof t.detail == "string" ? t.detail : "Unknown Error", r = typeof t.name == "string" ? t.name : void 0;
|
|
261
|
-
return typeof t.status == "number" ? new
|
|
257
|
+
return typeof t.status == "number" ? new oe(t.status, n, t.trace, r) : new D(t.code, n, t.trace, r);
|
|
262
258
|
}
|
|
263
|
-
return new
|
|
264
|
-
},
|
|
265
|
-
function
|
|
266
|
-
return e.useContext(
|
|
259
|
+
return new D(0, "Unknown Error");
|
|
260
|
+
}, fe = e.createContext(!1);
|
|
261
|
+
function pe() {
|
|
262
|
+
return e.useContext(fe);
|
|
267
263
|
}
|
|
268
|
-
function
|
|
269
|
-
return /* @__PURE__ */ T(
|
|
264
|
+
function me({ ...e }) {
|
|
265
|
+
return /* @__PURE__ */ T(fe.Provider, {
|
|
270
266
|
value: !0,
|
|
271
267
|
children: e.children
|
|
272
268
|
});
|
|
273
269
|
}
|
|
274
|
-
var
|
|
270
|
+
var he = class extends e.Component {
|
|
275
271
|
constructor(e) {
|
|
276
|
-
super(e), this.state =
|
|
272
|
+
super(e), this.state = le;
|
|
277
273
|
}
|
|
278
274
|
resetErrorBoundary = () => {
|
|
279
|
-
this.setState(
|
|
275
|
+
this.setState(le);
|
|
280
276
|
};
|
|
281
277
|
promiseRejectionHandler = (e) => {
|
|
282
|
-
e.type
|
|
278
|
+
(e.type !== "unhandledrejection" || e.reason !== void 0 && typeof e.reason != "string") && this.setState({
|
|
283
279
|
hasError: !0,
|
|
284
|
-
error:
|
|
280
|
+
error: de(e.reason)
|
|
285
281
|
});
|
|
286
282
|
};
|
|
287
283
|
componentDidMount() {
|
|
@@ -293,18 +289,14 @@ var de = class extends e.Component {
|
|
|
293
289
|
static getDerivedStateFromError(e) {
|
|
294
290
|
return {
|
|
295
291
|
hasError: !0,
|
|
296
|
-
error:
|
|
292
|
+
error: de(e)
|
|
297
293
|
};
|
|
298
294
|
}
|
|
299
295
|
componentDidCatch(e, t) {
|
|
300
296
|
console.log("error", e);
|
|
301
297
|
}
|
|
302
298
|
componentDidUpdate(e, t, n) {
|
|
303
|
-
|
|
304
|
-
this.resetErrorBoundary();
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
this.state.error?.detail !== t.error?.detail && this.state.hasError && this.props.fallback instanceof Function && this.props.fallback(this.state.error);
|
|
299
|
+
this.state.hasError && ue(e.resetKeys, this.props.resetKeys) ? this.resetErrorBoundary() : this.state.error?.detail !== t.error?.detail && this.state.hasError && this.props.fallback instanceof Function && this.props.fallback(this.state.error);
|
|
308
300
|
}
|
|
309
301
|
render() {
|
|
310
302
|
return this.state.hasError ? e.isValidElement(this.props.fallback) ? e.cloneElement(this.props.fallback, {
|
|
@@ -312,23 +304,23 @@ var de = class extends e.Component {
|
|
|
312
304
|
resetErrorBoundary: this.resetErrorBoundary
|
|
313
305
|
}) : null : this.props.children;
|
|
314
306
|
}
|
|
315
|
-
},
|
|
316
|
-
let r =
|
|
317
|
-
return /* @__PURE__ */ T(
|
|
307
|
+
}, ge = ({ children: e, fallback: t = /* @__PURE__ */ T(ce, {}), ...n }) => {
|
|
308
|
+
let r = pe();
|
|
309
|
+
return /* @__PURE__ */ T(me, { children: /* @__PURE__ */ T(he, {
|
|
318
310
|
...n,
|
|
319
311
|
fallback: t,
|
|
320
312
|
handleUnhandledRejections: !r,
|
|
321
313
|
children: e
|
|
322
314
|
}) });
|
|
323
|
-
},
|
|
315
|
+
}, _e = /* @__PURE__ */ function(e) {
|
|
324
316
|
return e.PROD = "prod", e.DEV = "dev", e.TEST = "test", e;
|
|
325
|
-
}({}),
|
|
326
|
-
function
|
|
327
|
-
return t.useContext(
|
|
317
|
+
}({}), ve = t.createContext({ env: "prod" });
|
|
318
|
+
function O() {
|
|
319
|
+
return t.useContext(ve);
|
|
328
320
|
}
|
|
329
|
-
function
|
|
330
|
-
let n =
|
|
331
|
-
return /* @__PURE__ */ T(
|
|
321
|
+
function ye({ config: e, ...t }) {
|
|
322
|
+
let n = O();
|
|
323
|
+
return /* @__PURE__ */ T(ve.Provider, {
|
|
332
324
|
value: {
|
|
333
325
|
...n || {},
|
|
334
326
|
...e
|
|
@@ -338,14 +330,14 @@ function he({ config: e, ...t }) {
|
|
|
338
330
|
}
|
|
339
331
|
//#endregion
|
|
340
332
|
//#region src/helper/PathUtils.ts
|
|
341
|
-
var
|
|
342
|
-
let t = (e ?? "").replace(
|
|
333
|
+
var be = /^\/+/, xe = /\/+$/, Se = (e) => {
|
|
334
|
+
let t = (e ?? "").replace(be, "").replace(xe, "");
|
|
343
335
|
return t ? `/${t}` : "";
|
|
344
|
-
},
|
|
345
|
-
let n =
|
|
346
|
-
return n ? n + (e ? `/${e.replace(
|
|
347
|
-
},
|
|
348
|
-
let n =
|
|
336
|
+
}, Ce = (e, t) => {
|
|
337
|
+
let n = Se(t);
|
|
338
|
+
return n ? n + (e ? `/${e.replace(be, "")}` : "") : e;
|
|
339
|
+
}, we = (e, t) => {
|
|
340
|
+
let n = Se(t);
|
|
349
341
|
if (!n || !e.startsWith(n)) return e;
|
|
350
342
|
let r = e.slice(n.length);
|
|
351
343
|
return r ? r.startsWith("/") ? r : r.startsWith("?") || r.startsWith("#") ? "/" + r : e : "/";
|
|
@@ -355,11 +347,11 @@ window.history.pushState = new Proxy(window.history.pushState, { apply: (e, t, n
|
|
|
355
347
|
} }), window.history.replaceState = new Proxy(window.history.replaceState, { apply: (e, t, n) => {
|
|
356
348
|
e.apply(t, n), window.dispatchEvent(new Event("replacestate"));
|
|
357
349
|
} });
|
|
358
|
-
var
|
|
359
|
-
function
|
|
360
|
-
let n = t.useContext(
|
|
350
|
+
var Te = "actions", Ee = /{(.*?)}/gi, De = /\/[{:](\w+)}?/g, Oe = /[{:](\w+)}?/g, ke = /\/$/g, Ae = t.createContext(void 0);
|
|
351
|
+
function k(e = !0) {
|
|
352
|
+
let n = t.useContext(Ae);
|
|
361
353
|
if (!n && e) throw Error("UseActions must be used in ActionProvider");
|
|
362
|
-
let r =
|
|
354
|
+
let r = O(), { actions: i, location: a } = n || {
|
|
363
355
|
location: new URL(document.location.href),
|
|
364
356
|
actions: null
|
|
365
357
|
}, o = (e, t, n) => i?.filter((r) => r.entity === e && r.name === t && (n === void 0 || r.namespace === n)).shift(), s = (e) => {
|
|
@@ -373,17 +365,20 @@ function j(e = !0) {
|
|
|
373
365
|
parameters: n?.params,
|
|
374
366
|
query: n?.query
|
|
375
367
|
};
|
|
376
|
-
}, l = (e) => e.replaceAll(
|
|
368
|
+
}, l = (e) => e.replaceAll(Ee, ":$1"), u = (e, t, n, r) => v(l(e), t, n, r), d = (e, t, n, r) => e ? u(e.path, {
|
|
377
369
|
...e.defaults || {},
|
|
378
370
|
...t
|
|
379
|
-
}, n, r) : "#", f = (e) =>
|
|
371
|
+
}, n, r) : "#", f = (e) => {
|
|
372
|
+
let t = o(e.action.entity, e.action.name, e.action.namespace);
|
|
373
|
+
return d(t?.route, e.parameters, e.query, e.hash);
|
|
374
|
+
}, p = (e, t, n) => d(e, t, n), m = (e) => Ce(e, r.link?.prefix), h = (e) => we(e, r.link?.prefix), g = (e, t) => {
|
|
380
375
|
try {
|
|
381
376
|
t ? history.replaceState(null, "", e) : history.pushState(null, "", e);
|
|
382
377
|
} catch {
|
|
383
378
|
window.location.assign(e);
|
|
384
379
|
}
|
|
385
380
|
}, _ = (e, t) => {
|
|
386
|
-
let n = new URL(t, a.origin), r = h(n.pathname), i = "^" + e.replace(
|
|
381
|
+
let n = new URL(t, a.origin), r = h(n.pathname), i = "^" + e.replace(De, "[/]?(?<$1>[^/]+)?").replace("*", ".*") + "$";
|
|
387
382
|
return new RegExp(i, "giu").test(r) ? {
|
|
388
383
|
pathname: r,
|
|
389
384
|
params: r.matchAll(new RegExp(i, "giu"))?.next().value?.groups,
|
|
@@ -391,10 +386,10 @@ function j(e = !0) {
|
|
|
391
386
|
pattern: e
|
|
392
387
|
} : null;
|
|
393
388
|
}, v = (e, t, n, r) => {
|
|
394
|
-
let i = e.replaceAll(
|
|
389
|
+
let i = e.replaceAll(Oe, (e, n) => {
|
|
395
390
|
let r = t?.[n];
|
|
396
391
|
return r !== void 0 && delete t?.[n], r ?? "";
|
|
397
|
-
}).replace(
|
|
392
|
+
}).replace(ke, ""), o = new URL(i, a.origin);
|
|
398
393
|
return S(n || {}).entries().forEach(([e, t]) => {
|
|
399
394
|
o.searchParams.set(e, t);
|
|
400
395
|
}), r && (o.hash = r), m(o.pathname + o.search + o.hash);
|
|
@@ -417,114 +412,114 @@ function j(e = !0) {
|
|
|
417
412
|
externalToInternalPath: h
|
|
418
413
|
};
|
|
419
414
|
}
|
|
420
|
-
function
|
|
421
|
-
let [t, n] =
|
|
415
|
+
function je(e) {
|
|
416
|
+
let [t, n] = _(() => {
|
|
422
417
|
try {
|
|
423
|
-
let e = sessionStorage.getItem(
|
|
418
|
+
let e = sessionStorage.getItem(Te);
|
|
424
419
|
if (!e) return null;
|
|
425
420
|
let t = Uint8Array.from(atob(e), (e) => e.charCodeAt(0));
|
|
426
421
|
return JSON.parse(new TextDecoder().decode(t));
|
|
427
422
|
} catch {
|
|
428
423
|
return null;
|
|
429
424
|
}
|
|
430
|
-
}), [r, i] =
|
|
431
|
-
|
|
425
|
+
}), [r, i] = _(new URL(document.location.href));
|
|
426
|
+
u(() => {
|
|
432
427
|
let e = (() => {
|
|
433
428
|
i(new URL(document.location.href));
|
|
434
429
|
});
|
|
435
430
|
return window.addEventListener("pushstate", e), window.addEventListener("replacestate", e), window.addEventListener("popstate", e), () => {
|
|
436
431
|
window.removeEventListener("pushstate", e), window.removeEventListener("replacestate", e), window.removeEventListener("popstate", e);
|
|
437
432
|
};
|
|
438
|
-
}, []),
|
|
439
|
-
|
|
433
|
+
}, []), u(() => {
|
|
434
|
+
xa().get({ url: "/_crud/actions" }).then(({ status: e, data: t }) => {
|
|
440
435
|
if (e === 200) {
|
|
441
436
|
n(t);
|
|
442
437
|
try {
|
|
443
438
|
let e = new TextEncoder().encode(JSON.stringify(t)), n = btoa(Array.from(e, (e) => String.fromCharCode(e)).join(""));
|
|
444
|
-
sessionStorage.setItem(
|
|
439
|
+
sessionStorage.setItem(Te, n);
|
|
445
440
|
} catch {}
|
|
446
441
|
}
|
|
447
442
|
}).catch((e) => {
|
|
448
443
|
console.log("error", e);
|
|
449
444
|
}).finally(() => {});
|
|
450
445
|
}, []);
|
|
451
|
-
let a =
|
|
446
|
+
let a = m(() => ({
|
|
452
447
|
actions: t,
|
|
453
448
|
location: r,
|
|
454
449
|
setLocation: i
|
|
455
450
|
}), [t, r]);
|
|
456
|
-
return /* @__PURE__ */ T(
|
|
451
|
+
return /* @__PURE__ */ T(Ae.Provider, {
|
|
457
452
|
value: a,
|
|
458
453
|
children: e.children
|
|
459
454
|
});
|
|
460
455
|
}
|
|
461
|
-
function
|
|
462
|
-
return (t) => /* @__PURE__ */ T(
|
|
456
|
+
function Me(e) {
|
|
457
|
+
return (t) => /* @__PURE__ */ T(je, { children: /* @__PURE__ */ T(e, { ...t }) });
|
|
463
458
|
}
|
|
464
459
|
//#endregion
|
|
465
460
|
//#region src/type/FormViewType.tsx
|
|
466
|
-
var
|
|
461
|
+
var A = /* @__PURE__ */ function(e) {
|
|
467
462
|
return e.Form = "form", e.Input = "input", e.Money = "money", e.Hidden = "hidden", e.Number = "number", e.Text = "text", e.Textarea = "textarea", 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;
|
|
468
463
|
}({});
|
|
469
464
|
//#endregion
|
|
470
465
|
//#region src/component/form/formChoices.ts
|
|
471
|
-
function
|
|
466
|
+
function j(e) {
|
|
472
467
|
let t = typeof e.value == "function" ? e.value(e) : e.value;
|
|
473
468
|
return String(t ?? "");
|
|
474
469
|
}
|
|
475
|
-
function
|
|
470
|
+
function Ne(e) {
|
|
476
471
|
return e == null ? [] : Array.isArray(e) ? e : [e];
|
|
477
472
|
}
|
|
478
|
-
function
|
|
473
|
+
function Pe(e) {
|
|
479
474
|
return e == null || e === "" ? [] : Array.isArray(e) ? e : [e];
|
|
480
475
|
}
|
|
481
476
|
//#endregion
|
|
482
477
|
//#region src/component/form/formView.ts
|
|
483
|
-
var
|
|
478
|
+
var Fe = /* @__PURE__ */ new WeakSet(), Ie = (e) => Fe.has(e), Le = (e) => (Fe.add(e), e), M = (e) => e.replace(/\[\]$/, ""), Re = (e) => {
|
|
484
479
|
let t = e.full_name || "";
|
|
485
480
|
return e.multiple && e.expanded && !t.endsWith("[]") ? t + "[]" : t;
|
|
486
|
-
},
|
|
487
|
-
function
|
|
481
|
+
}, N = (e) => e == null ? "" : String(e);
|
|
482
|
+
function P(e, t) {
|
|
488
483
|
return e === t ? !0 : !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((e, n) => e === t[n]);
|
|
489
484
|
}
|
|
490
|
-
var
|
|
491
|
-
function
|
|
492
|
-
if (
|
|
493
|
-
let t =
|
|
494
|
-
return n = e.checked instanceof Function ? e.checked(t) : e.checked === void 0 ? Array.isArray(e.data) ? e.data.map(
|
|
485
|
+
var F = (e) => Array.isArray(e) ? e : e == null ? [] : [e], ze = (e) => ["checkbox", "radio"].includes(e.type), Be = (e) => N(e.value ?? "1");
|
|
486
|
+
function Ve(e, t) {
|
|
487
|
+
if (ze(e)) {
|
|
488
|
+
let t = Be(e), n;
|
|
489
|
+
return n = e.checked instanceof Function ? e.checked(t) : e.checked === void 0 ? Array.isArray(e.data) ? e.data.map(N).includes(t) : e.type === "radio" ? N(e.data) === t : !!e.data : e.checked, e.multiple ? n ? [t] : [] : n ? t : null;
|
|
495
490
|
}
|
|
496
491
|
if (e.expanded && e.checked instanceof Function) {
|
|
497
492
|
let n = Object.values(e.choices || []).flatMap((e) => "choices" in e ? Object.values(e.choices) : [e]).flatMap((n) => {
|
|
498
|
-
let r = t ?
|
|
493
|
+
let r = t ? N(t(n)) : j(n);
|
|
499
494
|
return e.checked instanceof Function && e.checked(r) ? [r] : [];
|
|
500
495
|
});
|
|
501
496
|
return e.multiple ? n : n.length ? n[0] : null;
|
|
502
497
|
}
|
|
503
498
|
let n = e.value ?? e.data;
|
|
504
|
-
if (e.multiple) return
|
|
499
|
+
if (e.multiple) return Pe(Array.isArray(n) ? n.map(N) : N(n));
|
|
505
500
|
if ([
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
501
|
+
A.Date,
|
|
502
|
+
A.Birthday,
|
|
503
|
+
A.Datetime,
|
|
504
|
+
A.Time
|
|
510
505
|
].includes(e.type) && n?.date) {
|
|
511
506
|
let t = new Date(n.date);
|
|
512
507
|
if (Number.isNaN(t.getTime())) return "";
|
|
513
508
|
let r = (/* @__PURE__ */ new Date(t.getTime() - t.getTimezoneOffset() * 6e4)).toISOString();
|
|
514
|
-
return e.type ===
|
|
509
|
+
return e.type === A.Datetime ? r.slice(0, 16) : e.type === A.Time ? r.slice(11, 16) : r.slice(0, 10);
|
|
515
510
|
}
|
|
516
511
|
if (!e.expanded && e.choices && !e.placeholder && (n == null || n === "")) {
|
|
517
|
-
let t = Object.values(e.choices).flatMap((e) => "choices" in e ? Object.values(e.choices) : [e]).find((e) => !
|
|
518
|
-
if (t) return t.value == null ?
|
|
512
|
+
let t = Object.values(e.choices).flatMap((e) => "choices" in e ? Object.values(e.choices) : [e]).find((e) => !I(e, "attr")?.disabled);
|
|
513
|
+
if (t) return t.value == null ? N(I(t, "label")) : j(t);
|
|
519
514
|
}
|
|
520
|
-
return
|
|
515
|
+
return N(n);
|
|
521
516
|
}
|
|
522
|
-
function
|
|
517
|
+
function He(e, t = Ve) {
|
|
523
518
|
let n = {
|
|
524
519
|
values: {},
|
|
525
520
|
collections: {}
|
|
526
521
|
}, r = (e) => {
|
|
527
|
-
e.type ===
|
|
522
|
+
e.type === A.Collection && e.full_name && (n.collections[M(e.full_name)] = Object.keys(e.children || {}));
|
|
528
523
|
let i = e.children && Object.keys(e.children).length > 0, a = [
|
|
529
524
|
"form",
|
|
530
525
|
"repeated",
|
|
@@ -532,13 +527,13 @@ function Re(e, t = Le) {
|
|
|
532
527
|
].includes(e.type);
|
|
533
528
|
if (i || a) Object.values(e.children || {}).forEach(r);
|
|
534
529
|
else if (e.full_name) {
|
|
535
|
-
let r =
|
|
536
|
-
|
|
530
|
+
let r = M(e.full_name), i = t(e);
|
|
531
|
+
ze(e) && Array.isArray(i) ? n.values[r] = [.../* @__PURE__ */ new Set([...F(n.values[r]), ...i])] : (i !== null || !(r in n.values)) && (n.values[r] = i);
|
|
537
532
|
}
|
|
538
533
|
};
|
|
539
534
|
return r(e), n;
|
|
540
535
|
}
|
|
541
|
-
function
|
|
536
|
+
function Ue(e, t, n, r) {
|
|
542
537
|
let i = t.prototype_name || "__name__", a = `${t.full_name}[${i}]`, o = `${t.full_name}[${n}]`, s = (e) => {
|
|
543
538
|
let t = {
|
|
544
539
|
...e,
|
|
@@ -554,16 +549,16 @@ function ze(e, t, n, r) {
|
|
|
554
549
|
prototype_name: n
|
|
555
550
|
};
|
|
556
551
|
}
|
|
557
|
-
function
|
|
552
|
+
function We(e) {
|
|
558
553
|
let t = {}, n = (e) => {
|
|
559
554
|
(e.errors || []).forEach((n) => {
|
|
560
|
-
let r =
|
|
555
|
+
let r = M(n.origin || e.full_name || "");
|
|
561
556
|
(t[r] ||= []).push(n);
|
|
562
557
|
}), Object.values(e.children || {}).forEach(n);
|
|
563
558
|
};
|
|
564
559
|
return n(e), t;
|
|
565
560
|
}
|
|
566
|
-
var
|
|
561
|
+
var Ge = {
|
|
567
562
|
"accept-charset": "acceptCharset",
|
|
568
563
|
accesskey: "accessKey",
|
|
569
564
|
autocapitalize: "autoCapitalize",
|
|
@@ -590,30 +585,30 @@ var Ve = {
|
|
|
590
585
|
spellcheck: "spellCheck",
|
|
591
586
|
tabindex: "tabIndex"
|
|
592
587
|
};
|
|
593
|
-
function
|
|
588
|
+
function I(e, t) {
|
|
594
589
|
let n = e[t];
|
|
595
590
|
return typeof n == "function" ? n.call(e, e) : n;
|
|
596
591
|
}
|
|
597
|
-
function
|
|
592
|
+
function Ke(e) {
|
|
598
593
|
return Object.fromEntries(Object.entries(e).map(([t, n]) => {
|
|
599
|
-
let r = Object.hasOwn(
|
|
594
|
+
let r = Object.hasOwn(Ge, t) ? Ge[t] : t;
|
|
600
595
|
return [r, Object.hasOwn(e, r) ? e[r] : n];
|
|
601
596
|
}));
|
|
602
597
|
}
|
|
603
|
-
function
|
|
598
|
+
function qe(e) {
|
|
604
599
|
let { value: t, defaultValue: n, checked: r, defaultChecked: i, name: a, selected: o, ...s } = e;
|
|
605
|
-
return
|
|
600
|
+
return Ke(s);
|
|
606
601
|
}
|
|
607
|
-
var
|
|
608
|
-
function
|
|
609
|
-
if (t === "multiple") return
|
|
602
|
+
var Je = /* @__PURE__ */ new WeakMap(), Ye = [], Xe = [], L = (e) => Array.isArray(e) ? [...e] : e;
|
|
603
|
+
function Ze(e, t) {
|
|
604
|
+
if (t === "multiple") return Pe(e);
|
|
610
605
|
if (Array.isArray(e)) {
|
|
611
606
|
let n = t === "scalar" ? "" : null;
|
|
612
607
|
return e[0] ?? n;
|
|
613
608
|
}
|
|
614
609
|
return e;
|
|
615
610
|
}
|
|
616
|
-
var
|
|
611
|
+
var Qe = class {
|
|
617
612
|
nativeDirty = /* @__PURE__ */ new Set();
|
|
618
613
|
values = /* @__PURE__ */ new Map();
|
|
619
614
|
kinds = /* @__PURE__ */ new Map();
|
|
@@ -652,8 +647,8 @@ var Je = class {
|
|
|
652
647
|
this.stateListeners.delete(e);
|
|
653
648
|
});
|
|
654
649
|
getState = () => this.state;
|
|
655
|
-
subscribeField = (e, t) => this.subscribe(this.listeners,
|
|
656
|
-
subscribeCollection = (e, t) => this.subscribe(this.collectionListeners,
|
|
650
|
+
subscribeField = (e, t) => this.subscribe(this.listeners, M(e), t);
|
|
651
|
+
subscribeCollection = (e, t) => this.subscribe(this.collectionListeners, M(e), t);
|
|
657
652
|
subscribe(e, t, n) {
|
|
658
653
|
let r = e.get(t) || /* @__PURE__ */ new Set();
|
|
659
654
|
return e.set(t, r), r.add(n), () => {
|
|
@@ -663,28 +658,28 @@ var Je = class {
|
|
|
663
658
|
notifyField(e) {
|
|
664
659
|
this.snapshots.delete(e), this.listeners.get(e)?.forEach((e) => e());
|
|
665
660
|
}
|
|
666
|
-
getField = (e) => (e =
|
|
661
|
+
getField = (e) => (e = M(e), this.snapshots.has(e) || this.snapshots.set(e, {
|
|
667
662
|
value: this.values.get(e),
|
|
668
|
-
errors: this.state.errors[e] ||
|
|
669
|
-
dirty: this.nativeDirty.has(e) || !
|
|
663
|
+
errors: this.state.errors[e] || Ye,
|
|
664
|
+
dirty: this.nativeDirty.has(e) || !P(this.values.get(e), this.defaults.get(e))
|
|
670
665
|
}), this.snapshots.get(e));
|
|
671
666
|
getErrors(e) {
|
|
672
|
-
let t = JSON.stringify(e), n = e.flatMap((e) => this.state.errors[
|
|
667
|
+
let t = JSON.stringify(e), n = e.flatMap((e) => this.state.errors[M(e)] || []), r = this.errorSnapshots.get(t);
|
|
673
668
|
return r && JSON.stringify(r) === JSON.stringify(n) ? r : (this.errorSnapshots.set(t, n), n);
|
|
674
669
|
}
|
|
675
|
-
getValue = (e) => this.values.get(
|
|
670
|
+
getValue = (e) => this.values.get(M(e));
|
|
676
671
|
getNames = () => [...this.values.keys()];
|
|
677
672
|
getInitialValue = (e) => {
|
|
678
|
-
let t = this.initializers.get(
|
|
679
|
-
return t ? t(e) :
|
|
673
|
+
let t = this.initializers.get(M(e.full_name || ""));
|
|
674
|
+
return t ? t(e) : Ve(e);
|
|
680
675
|
};
|
|
681
|
-
getKind = (e) => this.kinds.get(
|
|
682
|
-
isRegistered = (e) => !!this.registrations.get(
|
|
676
|
+
getKind = (e) => this.kinds.get(M(e));
|
|
677
|
+
isRegistered = (e) => !!this.registrations.get(M(e))?.size;
|
|
683
678
|
initialize(e, t) {
|
|
684
|
-
this.defaults.has(e) || this.defaults.set(e,
|
|
679
|
+
this.defaults.has(e) || this.defaults.set(e, L(t)), !this.values.has(e) && !this.isDeleted(e) && (this.values.set(e, L(t)), this.notifyField(e));
|
|
685
680
|
}
|
|
686
681
|
isActiveValue(e) {
|
|
687
|
-
return e =
|
|
682
|
+
return e = M(e), ![...this.deletedPrefixes].some((t) => e === t || e.startsWith(t + "[")) && [...this.collections].every(([t, n]) => {
|
|
688
683
|
if (!e.startsWith(t + "[")) return !0;
|
|
689
684
|
let r = e.slice(t.length + 1).split("]")[0];
|
|
690
685
|
return n.includes(r);
|
|
@@ -694,24 +689,24 @@ var Je = class {
|
|
|
694
689
|
return !this.isActiveValue(e);
|
|
695
690
|
}
|
|
696
691
|
registerField(e, t, n, r, i, a = !1, o = !1, s) {
|
|
697
|
-
e =
|
|
692
|
+
e = M(e);
|
|
698
693
|
let c = this.kinds.get(e);
|
|
699
|
-
if (c && c !== n && (this.values.has(e) && this.values.set(e,
|
|
700
|
-
let n =
|
|
701
|
-
this.defaults.set(e,
|
|
694
|
+
if (c && c !== n && (this.values.has(e) && this.values.set(e, Ze(this.values.get(e), n)), this.defaults.has(e) && this.defaults.set(e, Ze(this.defaults.get(e), n)), this.notifyField(e)), this.kinds.set(e, n), this.initializers.get(e) !== s && (s ? this.initializers.set(e, s) : this.initializers.delete(e), this.defaults.has(e) && !this.localDefaults.has(e))) {
|
|
695
|
+
let n = P(this.values.get(e), this.defaults.get(e));
|
|
696
|
+
this.defaults.set(e, L(t)), n && this.values.set(e, L(t)), this.notifyField(e);
|
|
702
697
|
}
|
|
703
698
|
if (a && !this.overriddenDefaults.has(e)) {
|
|
704
|
-
this.overriddenDefaults.add(e), this.localDefaults.set(e,
|
|
705
|
-
let n =
|
|
706
|
-
this.defaults.set(e,
|
|
699
|
+
this.overriddenDefaults.add(e), this.localDefaults.set(e, L(t));
|
|
700
|
+
let n = P(this.values.get(e), this.defaults.get(e));
|
|
701
|
+
this.defaults.set(e, L(t)), n && this.values.set(e, L(t)), this.notifyField(e);
|
|
707
702
|
}
|
|
708
703
|
if (this.initialize(e, t), o && !this.versions.has(e)) {
|
|
709
704
|
let r = this.defaults.get(e), i = t ?? r;
|
|
710
705
|
if (n === "multiple") {
|
|
711
706
|
let e = Array.isArray(r) ? r : [], n = Array.isArray(t) ? t : [];
|
|
712
|
-
i = [
|
|
707
|
+
i = [.../* @__PURE__ */ new Set([...e, ...n])];
|
|
713
708
|
}
|
|
714
|
-
i !== void 0 && !
|
|
709
|
+
i !== void 0 && !P(r, i) && (this.defaults.set(e, L(i)), this.values.set(e, L(i)), this.notifyField(e));
|
|
715
710
|
}
|
|
716
711
|
let l = this.registrations.get(e) || /* @__PURE__ */ new Map();
|
|
717
712
|
return l.set(i, { constraints: r }), this.registrations.set(e, l), this.refreshConstraints(e), () => {
|
|
@@ -728,30 +723,30 @@ var Je = class {
|
|
|
728
723
|
});
|
|
729
724
|
}
|
|
730
725
|
setValue = (e, t) => {
|
|
731
|
-
if (e =
|
|
732
|
-
|
|
726
|
+
if (e = M(e), Array.isArray(t) && this.getKind(e) === "scalar") throw Error("Cannot assign multiple values to a single-value form element.");
|
|
727
|
+
P(this.values.get(e), t) || (this.values.set(e, L(t)), this.versions.set(e, ++this.revision), this.notifyField(e), this.state.success && this.updateState({
|
|
733
728
|
...this.state,
|
|
734
729
|
success: !1
|
|
735
730
|
}));
|
|
736
731
|
};
|
|
737
732
|
change = (e, t) => {
|
|
738
|
-
this.setValue(e, t), e =
|
|
733
|
+
this.setValue(e, t), e = M(e), this.serverErrors[e] && (delete this.serverErrors[e], this.refreshErrors()), this.validate(e);
|
|
739
734
|
};
|
|
740
735
|
changeNative = (e, t) => {
|
|
741
|
-
e =
|
|
736
|
+
e = M(e), this.nativeDirty.add(e), this.versions.set(e, ++this.revision), this.notifyField(e), this.serverErrors[e] && (delete this.serverErrors[e], this.refreshErrors()), this.state.success && this.updateState({
|
|
742
737
|
...this.state,
|
|
743
738
|
success: !1
|
|
744
739
|
}), this.validate(e, t);
|
|
745
740
|
};
|
|
746
|
-
validate = (e, t = this.values.get(
|
|
747
|
-
e =
|
|
741
|
+
validate = (e, t = this.values.get(M(e)) ?? null) => {
|
|
742
|
+
e = M(e);
|
|
748
743
|
let n = this.state.constraints[e]?.find((e) => !e.isValid(t));
|
|
749
744
|
return n ? this.clientErrors[e] = [{ message: n.getMessage() }] : delete this.clientErrors[e], this.refreshErrors(), !n;
|
|
750
745
|
};
|
|
751
746
|
validateAll = (e, t) => Object.keys(this.state.constraints).filter(e).map((e) => t ? this.validate(e, t(e)) : this.validate(e)).every(Boolean);
|
|
752
747
|
setErrors = (e, t, n = !1) => {
|
|
753
748
|
this.serverErrors = {}, Object.entries(e).forEach(([e, n]) => {
|
|
754
|
-
e =
|
|
749
|
+
e = M(e), !(t && (this.versions.get(e) || 0) > t.revision) && (this.serverErrors[e] = [...this.serverErrors[e] || [], ...n]);
|
|
755
750
|
}), this.clientErrors = Object.fromEntries(Object.entries(this.clientErrors).filter(([e]) => {
|
|
756
751
|
let r = t && (this.versions.get(e) || 0) > t.revision, i = n && this.getField(e).dirty;
|
|
757
752
|
return r || i;
|
|
@@ -762,7 +757,7 @@ var Je = class {
|
|
|
762
757
|
Object.entries(this.clientErrors).forEach(([t, n]) => {
|
|
763
758
|
e[t] = [...e[t] || [], ...n];
|
|
764
759
|
});
|
|
765
|
-
let t = [
|
|
760
|
+
let t = [.../* @__PURE__ */ new Set([...Object.keys(this.state.errors), ...Object.keys(e)])].filter((t) => JSON.stringify(this.state.errors[t]) !== JSON.stringify(e[t]));
|
|
766
761
|
t.length && (this.state = {
|
|
767
762
|
...this.state,
|
|
768
763
|
errors: e
|
|
@@ -784,15 +779,15 @@ var Je = class {
|
|
|
784
779
|
submitting: e
|
|
785
780
|
});
|
|
786
781
|
};
|
|
787
|
-
getCollection = (e) => this.collections.get(
|
|
782
|
+
getCollection = (e) => this.collections.get(M(e)) || Xe;
|
|
788
783
|
initializeCollection(e, t) {
|
|
789
|
-
e =
|
|
784
|
+
e = M(e), this.collectionDefaults.has(e) || this.collectionDefaults.set(e, [...t]), this.collections.has(e) || (this.collections.set(e, [...t]), this.collectionListeners.get(e)?.forEach((e) => e()));
|
|
790
785
|
}
|
|
791
786
|
addItem(e, t) {
|
|
792
|
-
e =
|
|
787
|
+
e = M(e), this.collections.set(e, [...this.getCollection(e), t]), this.collectionVersions.set(e, ++this.revision), this.collectionListeners.get(e)?.forEach((e) => e());
|
|
793
788
|
}
|
|
794
789
|
removeItem(e, t) {
|
|
795
|
-
e =
|
|
790
|
+
e = M(e);
|
|
796
791
|
let n = `${e}[${t}]`;
|
|
797
792
|
this.deletedPrefixes.add(n), this.collections.set(e, this.getCollection(e).filter((e) => e !== t)), this.collectionVersions.set(e, ++this.revision), [...this.values.keys()].filter((e) => e === n || e.startsWith(n + "[")).forEach((e) => {
|
|
798
793
|
this.values.delete(e), this.versions.set(e, this.revision), delete this.serverErrors[e], delete this.clientErrors[e], this.notifyField(e);
|
|
@@ -801,13 +796,13 @@ var Je = class {
|
|
|
801
796
|
}), this.refreshErrors(), this.collectionListeners.get(e)?.forEach((e) => e());
|
|
802
797
|
}
|
|
803
798
|
snapshot = (e = this.getNames(), t = [...this.collections.keys()]) => {
|
|
804
|
-
let n = Object.fromEntries([...this.values].map(([e, t]) => [e,
|
|
799
|
+
let n = Object.fromEntries([...this.values].map(([e, t]) => [e, L(t)])), r = Object.fromEntries([...this.collections].map(([e, t]) => [e, [...t]]));
|
|
805
800
|
return {
|
|
806
801
|
revision: this.revision,
|
|
807
802
|
values: n,
|
|
808
803
|
collections: r,
|
|
809
|
-
fields: [...new Set(e.map(
|
|
810
|
-
collectionNames: [...new Set(t.map(
|
|
804
|
+
fields: [...new Set(e.map(M))],
|
|
805
|
+
collectionNames: [...new Set(t.map(M))]
|
|
811
806
|
};
|
|
812
807
|
};
|
|
813
808
|
shouldAcceptIncoming(e, t, n, r, i) {
|
|
@@ -815,18 +810,18 @@ var Je = class {
|
|
|
815
810
|
}
|
|
816
811
|
reconcile(e, t = "refresh", n) {
|
|
817
812
|
Object.entries(e.collections).forEach(([e, r]) => {
|
|
818
|
-
let i = this.collectionDefaults.get(e), a = this.collections.get(e), o =
|
|
819
|
-
(!i || t !== "invalid") && this.collectionDefaults.set(e, [...r]), (!a || l) && (
|
|
813
|
+
let i = this.collectionDefaults.get(e), a = this.collections.get(e), o = P(a, i), s = this.collectionVersions.get(e) || 0, c = n?.collectionNames.includes(e) ?? !0, l = this.shouldAcceptIncoming(t, o, s, c, n);
|
|
814
|
+
(!i || t !== "invalid") && this.collectionDefaults.set(e, [...r]), (!a || l) && (P(a, r) || (this.collections.set(e, [...r]), this.collectionListeners.get(e)?.forEach((e) => e())), l && [...this.deletedPrefixes].filter((t) => t.startsWith(e + "[")).forEach((e) => this.deletedPrefixes.delete(e)));
|
|
820
815
|
}), Object.entries(e.values).forEach(([e, r]) => {
|
|
821
816
|
let i = n?.fields.includes(e) ?? !0;
|
|
822
817
|
t === "saved" && i && this.localDefaults.delete(e);
|
|
823
|
-
let a = this.localDefaults.has(e) ? this.localDefaults.get(e) : r, o =
|
|
824
|
-
(!this.defaults.has(e) || t !== "invalid") && this.defaults.set(e,
|
|
818
|
+
let a = this.localDefaults.has(e) ? this.localDefaults.get(e) : r, o = P(this.values.get(e), this.defaults.get(e)), s = this.versions.get(e) || 0, c = this.shouldAcceptIncoming(t, o, s, i, n);
|
|
819
|
+
(!this.defaults.has(e) || t !== "invalid") && this.defaults.set(e, L(a)), (!this.values.has(e) || c) && !this.isDeleted(e) && (this.values.set(e, L(a)), t === "saved" && c && this.nativeDirty.delete(e)), this.notifyField(e);
|
|
825
820
|
});
|
|
826
821
|
}
|
|
827
822
|
reset = () => {
|
|
828
|
-
let e = new Set([...this.values.keys(), ...this.defaults.keys()]), t = new Set([...this.collections.keys(), ...this.collectionDefaults.keys()]);
|
|
829
|
-
this.deletedPrefixes.clear(), this.nativeDirty.clear(), ++this.revision, this.collections = new Map([...this.collectionDefaults].map(([e, t]) => [e, [...t]])), [...this.collections.keys()].filter((e) => !this.isActiveValue(e)).forEach((e) => this.collections.delete(e)), this.values = new Map([...this.defaults].filter(([e]) => this.isActiveValue(e)).map(([e, t]) => [e,
|
|
823
|
+
let e = /* @__PURE__ */ new Set([...this.values.keys(), ...this.defaults.keys()]), t = /* @__PURE__ */ new Set([...this.collections.keys(), ...this.collectionDefaults.keys()]);
|
|
824
|
+
this.deletedPrefixes.clear(), this.nativeDirty.clear(), ++this.revision, this.collections = new Map([...this.collectionDefaults].map(([e, t]) => [e, [...t]])), [...this.collections.keys()].filter((e) => !this.isActiveValue(e)).forEach((e) => this.collections.delete(e)), this.values = new Map([...this.defaults].filter(([e]) => this.isActiveValue(e)).map(([e, t]) => [e, L(t)])), e.forEach((e) => {
|
|
830
825
|
this.versions.set(e, this.revision), this.notifyField(e);
|
|
831
826
|
}), t.forEach((e) => {
|
|
832
827
|
this.collectionVersions.set(e, this.revision), this.collectionListeners.get(e)?.forEach((e) => e());
|
|
@@ -854,37 +849,37 @@ var Je = class {
|
|
|
854
849
|
};
|
|
855
850
|
}
|
|
856
851
|
registerError(e, t) {
|
|
857
|
-
e =
|
|
852
|
+
e = M(e);
|
|
858
853
|
let n = this.errorViews.get(e) || /* @__PURE__ */ new Set();
|
|
859
854
|
return n.add(t), this.errorViews.set(e, n), this.notifyRendering(), () => {
|
|
860
855
|
n.delete(t), n.size || this.errorViews.delete(e), this.notifyRendering();
|
|
861
856
|
};
|
|
862
857
|
}
|
|
863
|
-
},
|
|
864
|
-
function
|
|
858
|
+
}, $e = (e) => e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
|
|
859
|
+
function et(e) {
|
|
865
860
|
return e instanceof HTMLInputElement ? ["checkbox", "radio"].includes(e.type) : e instanceof HTMLSelectElement && e.multiple;
|
|
866
861
|
}
|
|
867
|
-
function
|
|
862
|
+
function tt(e) {
|
|
868
863
|
return e.multiple ? Array.from(e.files || []) : e.files?.[0] ?? null;
|
|
869
864
|
}
|
|
870
|
-
function
|
|
871
|
-
return e.multiple ? "multiple" :
|
|
865
|
+
function nt(e) {
|
|
866
|
+
return e.multiple ? "multiple" : ze(e) || e.expanded ? "selection" : "scalar";
|
|
872
867
|
}
|
|
873
|
-
var
|
|
874
|
-
function
|
|
875
|
-
let e = t.useContext(
|
|
868
|
+
var rt = [], it = t.createContext(void 0);
|
|
869
|
+
function R() {
|
|
870
|
+
let e = t.useContext(it);
|
|
876
871
|
if (!e) throw Error("UseForm must be used within a Form.");
|
|
877
872
|
return e;
|
|
878
873
|
}
|
|
879
|
-
function
|
|
880
|
-
let { store: e } =
|
|
881
|
-
return
|
|
874
|
+
function at() {
|
|
875
|
+
let { store: e } = R();
|
|
876
|
+
return v(e.subscribeState, e.getState, e.getState);
|
|
882
877
|
}
|
|
883
|
-
function
|
|
884
|
-
return
|
|
878
|
+
function ot(e) {
|
|
879
|
+
return st([e])[0];
|
|
885
880
|
}
|
|
886
|
-
function
|
|
887
|
-
let { store: t } =
|
|
881
|
+
function st(e) {
|
|
882
|
+
let { store: t } = R(), n = e.map((e) => M((typeof e == "string" ? e : e?.full_name) || "")), r = JSON.stringify(n), i = m(() => {
|
|
888
883
|
let e = [...new Set(n.filter(Boolean))], r;
|
|
889
884
|
return {
|
|
890
885
|
subscribe: (n) => {
|
|
@@ -895,117 +890,119 @@ function rt(e) {
|
|
|
895
890
|
},
|
|
896
891
|
getSnapshot: () => {
|
|
897
892
|
let e = n.map((e) => e ? t.getValue(e) : void 0), i = r;
|
|
898
|
-
return i && e.every((e, t) =>
|
|
893
|
+
return i && e.every((e, t) => P(e, i[t])) ? i : (r = e, r);
|
|
899
894
|
}
|
|
900
895
|
};
|
|
901
|
-
}, [t,
|
|
902
|
-
return
|
|
896
|
+
}, [t, r]);
|
|
897
|
+
return v(i.subscribe, i.getSnapshot, i.getSnapshot);
|
|
903
898
|
}
|
|
904
|
-
function
|
|
905
|
-
let t =
|
|
906
|
-
return
|
|
899
|
+
function ct({ onStateChange: e }) {
|
|
900
|
+
let t = at(), n = g(null);
|
|
901
|
+
return u(() => {
|
|
907
902
|
n.current !== t && (n.current = t, e(t));
|
|
908
903
|
}, [t, e]), null;
|
|
909
904
|
}
|
|
910
|
-
function
|
|
911
|
-
let { store: r } =
|
|
912
|
-
|
|
913
|
-
if (i) return r.registerField(i, o,
|
|
905
|
+
function lt(e, t = rt, n) {
|
|
906
|
+
let { store: r } = R(), i = M(e.full_name || ""), a = g(Symbol("field")), o = m(() => n ? n(e) : Ve(e), [e, n]), s = nt(e), l = c((e) => r.subscribeField(i, e), [r, i]), u = c(() => r.getField(i), [r, i]), d = v(l, u, u);
|
|
907
|
+
p(() => {
|
|
908
|
+
if (i) return r.registerField(i, o, s, t, a.current, Ie(e), ze(e), n);
|
|
914
909
|
}, [
|
|
915
910
|
r,
|
|
916
911
|
i,
|
|
917
|
-
|
|
912
|
+
s,
|
|
918
913
|
t,
|
|
919
914
|
n
|
|
920
915
|
]);
|
|
921
|
-
let
|
|
916
|
+
let f = c((e) => {
|
|
922
917
|
let t = r.getValue(i), n = typeof e == "function" ? e(t === void 0 ? o : t) : e;
|
|
923
918
|
return r.change(i, n), n;
|
|
924
919
|
}, [
|
|
925
920
|
r,
|
|
926
921
|
i,
|
|
927
922
|
o
|
|
928
|
-
]),
|
|
923
|
+
]), h = c((e) => r.changeNative(i, e), [r, i]);
|
|
929
924
|
return {
|
|
930
|
-
...
|
|
931
|
-
value:
|
|
932
|
-
name:
|
|
933
|
-
change:
|
|
934
|
-
changeNative:
|
|
925
|
+
...d,
|
|
926
|
+
value: d.value === void 0 ? o : d.value,
|
|
927
|
+
name: Re(e),
|
|
928
|
+
change: f,
|
|
929
|
+
changeNative: h
|
|
935
930
|
};
|
|
936
931
|
}
|
|
937
|
-
function
|
|
938
|
-
let { store: t } =
|
|
939
|
-
return
|
|
932
|
+
function ut(e) {
|
|
933
|
+
let { store: t } = R(), n = JSON.stringify(e), r = c(() => t.getErrors(e), [t, n]);
|
|
934
|
+
return v(t.subscribeState, r, r);
|
|
940
935
|
}
|
|
941
|
-
function
|
|
942
|
-
let { store: n } =
|
|
943
|
-
return
|
|
936
|
+
function dt(e, t) {
|
|
937
|
+
let { store: n } = R(), r = c((t) => n.subscribeCollection(e, t), [n, e]), i = c(() => n.getCollection(e), [n, e]), a = v(r, i, i);
|
|
938
|
+
return p(() => n.initializeCollection(e, t), [n, e]), {
|
|
944
939
|
items: a,
|
|
945
940
|
add: (t) => n.addItem(e, t),
|
|
946
941
|
remove: (t) => n.removeItem(e, t)
|
|
947
942
|
};
|
|
948
943
|
}
|
|
949
|
-
var
|
|
950
|
-
function
|
|
951
|
-
if (!(e instanceof HTMLInputElement && e.type === "file"))
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
e.
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
if (
|
|
971
|
-
|
|
972
|
-
|
|
944
|
+
var ft = (e, t = null) => (e.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").replace(/([a-zA-Z])(?=[A-Z])/g, "$1_") + (t ?? "")).toLowerCase();
|
|
945
|
+
function pt(e, t) {
|
|
946
|
+
if (!(e instanceof HTMLInputElement && e.type === "file")) {
|
|
947
|
+
if (e instanceof HTMLInputElement && ["checkbox", "radio"].includes(e.type)) e.checked = !(!Je.get(e)?.emptyPlaceholder || t !== null && t !== "") || F(t).includes(e.value);
|
|
948
|
+
else if (e instanceof HTMLSelectElement && e.multiple) {
|
|
949
|
+
let n = F(t);
|
|
950
|
+
Array.from(e.options).forEach((e) => {
|
|
951
|
+
e.selected = n.includes(e.value);
|
|
952
|
+
});
|
|
953
|
+
} else {
|
|
954
|
+
if (Array.isArray(t)) throw Error("Cannot assign multiple values to a single-value form element.");
|
|
955
|
+
e.value = t ?? "";
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
var mt = ({ id: e, children: t, onBeforeSubmit: n, onSubmit: r, onReset: i, onStateChange: a, ref: o, ...s }) => {
|
|
960
|
+
let c = g(null), l = g(null), [d] = _(() => new Qe()), p = m(() => ({
|
|
961
|
+
store: d,
|
|
962
|
+
apiRef: l,
|
|
963
|
+
elementRef: c
|
|
964
|
+
}), [d]), h = () => Array.from(c.current?.elements || []).filter($e), v = () => h().forEach((e) => {
|
|
965
|
+
if (!d.isRegistered(e.name)) return;
|
|
966
|
+
let t = d.getValue(e.name);
|
|
967
|
+
if (t !== void 0 && (pt(e, t), e instanceof HTMLInputElement)) {
|
|
968
|
+
let n = Je.get(e);
|
|
969
|
+
n && (e.required = n.override ?? (n.required && (!n.multiple || F(t).length === 0)));
|
|
973
970
|
}
|
|
974
971
|
}), y = (e) => {
|
|
975
972
|
v();
|
|
976
|
-
let t =
|
|
977
|
-
return Array.from(t.keys()).filter((e) => !
|
|
973
|
+
let t = c.current ? new FormData(c.current, e) : new FormData();
|
|
974
|
+
return Array.from(t.keys()).filter((e) => !d.isActiveValue(e)).forEach((e) => t.delete(e)), t;
|
|
978
975
|
}, b = (e, t) => {
|
|
979
|
-
let n =
|
|
976
|
+
let n = h().filter((t) => M(t.name) === M(e)), r = n.some((e) => !et(e));
|
|
980
977
|
if (Array.isArray(t) && r) throw Error("Cannot assign multiple values to a single-value form element.");
|
|
981
|
-
|
|
982
|
-
},
|
|
978
|
+
d.setValue(e, t), n.forEach((e) => pt(e, t)), v();
|
|
979
|
+
}, ee = {
|
|
983
980
|
getFormData: y,
|
|
984
981
|
setFormData: (e) => {
|
|
985
|
-
new Set([
|
|
986
|
-
...
|
|
987
|
-
...
|
|
988
|
-
...Array.from(e.keys()).map(
|
|
989
|
-
]).forEach((t) => {
|
|
990
|
-
let n =
|
|
982
|
+
(/* @__PURE__ */ new Set([
|
|
983
|
+
...d.getNames(),
|
|
984
|
+
...h().map((e) => M(e.name)),
|
|
985
|
+
...Array.from(e.keys()).map(M)
|
|
986
|
+
])).forEach((t) => {
|
|
987
|
+
let n = h().filter((e) => M(e.name) === t);
|
|
991
988
|
if (n.some((e) => e instanceof HTMLInputElement && e.type === "file")) return;
|
|
992
|
-
let r = [...e.getAll(t), ...e.getAll(t + "[]")].filter((e) => typeof e == "string"), i =
|
|
989
|
+
let r = [...e.getAll(t), ...e.getAll(t + "[]")].filter((e) => typeof e == "string"), i = d.getKind(t) === "multiple" || Array.isArray(d.getValue(t)) || n.some((e) => e instanceof HTMLSelectElement && e.multiple) || d.getKind(t) === void 0 && n.some((e) => e instanceof HTMLInputElement && e.type === "checkbox"), a = d.getKind(t) === "selection" || n.some((e) => e instanceof HTMLInputElement && ["checkbox", "radio"].includes(e.type)), o = r[0] ?? "";
|
|
993
990
|
i ? o = r : a && (o = r[0] ?? null), b(t, o);
|
|
994
991
|
});
|
|
995
992
|
},
|
|
996
993
|
setValue: b,
|
|
997
994
|
setValues: (e) => Object.entries(e).forEach(([e, t]) => b(e, t)),
|
|
998
|
-
setErrors:
|
|
999
|
-
reset: () =>
|
|
1000
|
-
success: () =>
|
|
995
|
+
setErrors: d.setErrors,
|
|
996
|
+
reset: () => c.current?.reset(),
|
|
997
|
+
success: () => d.setSuccess(!0),
|
|
1001
998
|
submit: () => {
|
|
1002
999
|
v();
|
|
1003
|
-
let e =
|
|
1000
|
+
let e = h().filter((e) => !e.disabled && !d.isActiveValue(e.name));
|
|
1004
1001
|
e.forEach((e) => {
|
|
1005
1002
|
e.disabled = !0;
|
|
1006
1003
|
});
|
|
1007
1004
|
try {
|
|
1008
|
-
|
|
1005
|
+
c.current?.requestSubmit();
|
|
1009
1006
|
} finally {
|
|
1010
1007
|
e.forEach((e) => {
|
|
1011
1008
|
e.disabled = !1;
|
|
@@ -1013,54 +1010,54 @@ var ut = ({ id: e, children: t, onBeforeSubmit: n, onSubmit: r, onReset: i, onSt
|
|
|
1013
1010
|
}
|
|
1014
1011
|
}
|
|
1015
1012
|
};
|
|
1016
|
-
return
|
|
1017
|
-
let e =
|
|
1018
|
-
e.preventDefault(),
|
|
1013
|
+
return l.current = ee, f(o, () => ee), u(() => {
|
|
1014
|
+
let e = c.current, t = (e) => {
|
|
1015
|
+
e.preventDefault(), d.reset(), h().forEach((e) => {
|
|
1019
1016
|
e instanceof HTMLInputElement ? e.type === "file" ? e.value = "" : ["checkbox", "radio"].includes(e.type) ? e.checked = e.defaultChecked : e.value = e.defaultValue : e instanceof HTMLTextAreaElement ? e.value = e.defaultValue : Array.from(e.options).forEach((e) => {
|
|
1020
1017
|
e.selected = e.defaultSelected;
|
|
1021
1018
|
});
|
|
1022
1019
|
}), v(), i?.();
|
|
1023
1020
|
};
|
|
1024
1021
|
return e?.addEventListener("reset", t), () => e?.removeEventListener("reset", t);
|
|
1025
|
-
}, [
|
|
1026
|
-
value:
|
|
1027
|
-
children: [a && /* @__PURE__ */ T(
|
|
1022
|
+
}, [d, i]), /* @__PURE__ */ E(it.Provider, {
|
|
1023
|
+
value: p,
|
|
1024
|
+
children: [a && /* @__PURE__ */ T(ct, { onStateChange: a }), /* @__PURE__ */ T("form", {
|
|
1028
1025
|
id: e,
|
|
1029
|
-
ref:
|
|
1026
|
+
ref: c,
|
|
1030
1027
|
onSubmit: (e) => {
|
|
1031
1028
|
e.preventDefault();
|
|
1032
|
-
let t = (e) =>
|
|
1033
|
-
if (!
|
|
1034
|
-
let t =
|
|
1035
|
-
return t ?
|
|
1029
|
+
let t = (e) => d.isActiveValue(e) && h().some((t) => M(t.name) === e && !t.matches(":disabled"));
|
|
1030
|
+
if (!d.validateAll(t, (e) => {
|
|
1031
|
+
let t = h().find((t) => t instanceof HTMLInputElement && t.type === "file" && M(t.name) === e);
|
|
1032
|
+
return t ? tt(t) : d.getValue(e) ?? null;
|
|
1036
1033
|
})) return;
|
|
1037
|
-
let i = y(e.nativeEvent.submitter), a =
|
|
1038
|
-
n?.(i), r && (
|
|
1034
|
+
let i = y(e.nativeEvent.submitter), a = h().filter((e) => e.name && t(M(e.name))).map((e) => e.name), o = Array.from(c.current?.querySelectorAll("[data-form-collection]") || []).filter((e) => !e.matches(":disabled")).map((e) => e.dataset.formCollection || ""), s = d.snapshot(a, o);
|
|
1035
|
+
n?.(i), r && (d.setSubmitting(!0), r(i, s, p));
|
|
1039
1036
|
},
|
|
1040
1037
|
...s,
|
|
1041
1038
|
children: t
|
|
1042
1039
|
})]
|
|
1043
1040
|
});
|
|
1044
|
-
},
|
|
1041
|
+
}, ht = ({ icon: e, preloader: t, rightIcon: n, children: r, preload: i = !1 }) => /* @__PURE__ */ E(w, { children: [
|
|
1045
1042
|
i && t,
|
|
1046
1043
|
e,
|
|
1047
1044
|
r,
|
|
1048
1045
|
n
|
|
1049
|
-
] }),
|
|
1050
|
-
let n =
|
|
1051
|
-
return /* @__PURE__ */ T(
|
|
1046
|
+
] }), gt = t.createContext(void 0), _t = () => t.useContext(gt), vt = t.createContext(void 0), yt = () => t.useContext(vt), bt = ({ loader: e, children: t }) => {
|
|
1047
|
+
let n = d();
|
|
1048
|
+
return /* @__PURE__ */ T(vt.Provider, {
|
|
1052
1049
|
value: e || n,
|
|
1053
1050
|
children: t
|
|
1054
1051
|
});
|
|
1055
|
-
},
|
|
1056
|
-
let [t, n] =
|
|
1052
|
+
}, xt = ({ children: e }) => {
|
|
1053
|
+
let [t, n] = h((e, t) => {
|
|
1057
1054
|
let [n, r] = t;
|
|
1058
1055
|
return {
|
|
1059
1056
|
...e,
|
|
1060
1057
|
[n]: r
|
|
1061
1058
|
};
|
|
1062
1059
|
}, {});
|
|
1063
|
-
return /* @__PURE__ */ T(
|
|
1060
|
+
return /* @__PURE__ */ T(gt.Provider, {
|
|
1064
1061
|
value: {
|
|
1065
1062
|
loaders: t,
|
|
1066
1063
|
startLoading: (e) => {
|
|
@@ -1073,16 +1070,16 @@ var ut = ({ id: e, children: t, onBeforeSubmit: n, onSubmit: r, onReset: i, onSt
|
|
|
1073
1070
|
},
|
|
1074
1071
|
children: e
|
|
1075
1072
|
});
|
|
1076
|
-
},
|
|
1077
|
-
let { isLoading: s } =
|
|
1078
|
-
return r ||=
|
|
1079
|
-
if (!i || !
|
|
1073
|
+
}, St = ({ children: e, type: t, form: n, preload: r, autoDisableOnInvalid: i, ref: a, ...o }) => {
|
|
1074
|
+
let { isLoading: s } = _t() || {}, c = yt() || n || "form", l = g(null), d = a ?? l, [f, p] = _(i || !1), m = t && t === "submit", [h, v] = _();
|
|
1075
|
+
return r ||= m && s?.(c), u(() => {
|
|
1076
|
+
if (!i || !m) {
|
|
1080
1077
|
p(!1);
|
|
1081
1078
|
return;
|
|
1082
1079
|
}
|
|
1083
|
-
if (!
|
|
1084
|
-
let e = d.current?.closest("fieldset") ||
|
|
1085
|
-
d.current && p(!
|
|
1080
|
+
if (!h) return;
|
|
1081
|
+
let e = d.current?.closest("fieldset") || h, t = () => {
|
|
1082
|
+
d.current && p(!h.matches(":valid"));
|
|
1086
1083
|
}, n = "input, select, textarea", r = new MutationObserver((e) => {
|
|
1087
1084
|
e.forEach((e) => {
|
|
1088
1085
|
[
|
|
@@ -1094,7 +1091,7 @@ var ut = ({ id: e, children: t, onBeforeSubmit: n, onSubmit: r, onReset: i, onSt
|
|
|
1094
1091
|
});
|
|
1095
1092
|
});
|
|
1096
1093
|
});
|
|
1097
|
-
return e.addEventListener("input", t), r.observe(
|
|
1094
|
+
return e.addEventListener("input", t), r.observe(h, {
|
|
1098
1095
|
childList: !0,
|
|
1099
1096
|
subtree: !0,
|
|
1100
1097
|
attributes: !0,
|
|
@@ -1110,11 +1107,11 @@ var ut = ({ id: e, children: t, onBeforeSubmit: n, onSubmit: r, onReset: i, onSt
|
|
|
1110
1107
|
r.disconnect(), e.removeEventListener("input", t);
|
|
1111
1108
|
};
|
|
1112
1109
|
}, [
|
|
1113
|
-
|
|
1110
|
+
h,
|
|
1114
1111
|
i,
|
|
1115
|
-
|
|
1116
|
-
]),
|
|
1117
|
-
if (!i || !
|
|
1112
|
+
m
|
|
1113
|
+
]), u(() => {
|
|
1114
|
+
if (!i || !m || !d.current) return;
|
|
1118
1115
|
let e = d.current.form ?? d.current.closest("form");
|
|
1119
1116
|
if (e) {
|
|
1120
1117
|
v(e);
|
|
@@ -1132,7 +1129,7 @@ var ut = ({ id: e, children: t, onBeforeSubmit: n, onSubmit: r, onReset: i, onSt
|
|
|
1132
1129
|
};
|
|
1133
1130
|
}, [
|
|
1134
1131
|
n,
|
|
1135
|
-
|
|
1132
|
+
m,
|
|
1136
1133
|
i
|
|
1137
1134
|
]), /* @__PURE__ */ T("button", {
|
|
1138
1135
|
...o,
|
|
@@ -1140,28 +1137,28 @@ var ut = ({ id: e, children: t, onBeforeSubmit: n, onSubmit: r, onReset: i, onSt
|
|
|
1140
1137
|
type: t,
|
|
1141
1138
|
disabled: o.disabled ?? !!(r || f),
|
|
1142
1139
|
ref: d,
|
|
1143
|
-
children: /* @__PURE__ */ T(
|
|
1140
|
+
children: /* @__PURE__ */ T(ht, {
|
|
1144
1141
|
preload: r,
|
|
1145
1142
|
...o,
|
|
1146
1143
|
children: e
|
|
1147
1144
|
})
|
|
1148
1145
|
});
|
|
1149
|
-
},
|
|
1150
|
-
function
|
|
1151
|
-
return t.useContext(
|
|
1146
|
+
}, Ct = t.createContext("");
|
|
1147
|
+
function wt() {
|
|
1148
|
+
return t.useContext(Ct);
|
|
1152
1149
|
}
|
|
1153
|
-
function
|
|
1154
|
-
return /* @__PURE__ */ T(
|
|
1150
|
+
function Tt({ namespace: e, ...t }) {
|
|
1151
|
+
return /* @__PURE__ */ T(Ct.Provider, {
|
|
1155
1152
|
value: e,
|
|
1156
1153
|
children: t.children
|
|
1157
1154
|
});
|
|
1158
1155
|
}
|
|
1159
1156
|
//#endregion
|
|
1160
1157
|
//#region src/component/crud/CrudLoader.tsx
|
|
1161
|
-
var
|
|
1162
|
-
function
|
|
1163
|
-
let [t, n] =
|
|
1164
|
-
return /* @__PURE__ */ T(
|
|
1158
|
+
var Et = t.createContext(void 0);
|
|
1159
|
+
function Dt({ children: e }) {
|
|
1160
|
+
let [t, n] = h((e, { key: t, context: n }) => (e = { ...e }, n ? e[t] = n : delete e[t], e), {});
|
|
1161
|
+
return /* @__PURE__ */ T(Et.Provider, {
|
|
1165
1162
|
value: {
|
|
1166
1163
|
set: (e, t) => n({
|
|
1167
1164
|
key: e,
|
|
@@ -1175,19 +1172,19 @@ function Ct({ children: e }) {
|
|
|
1175
1172
|
children: e
|
|
1176
1173
|
});
|
|
1177
1174
|
}
|
|
1178
|
-
function
|
|
1179
|
-
let e = t.useContext(
|
|
1175
|
+
function Ot() {
|
|
1176
|
+
let e = t.useContext(Et);
|
|
1180
1177
|
if (!e) throw Error("UseCurrentActionCollection must be used in CurrentActionCollectionProvider");
|
|
1181
1178
|
return e;
|
|
1182
1179
|
}
|
|
1183
|
-
var
|
|
1184
|
-
function
|
|
1185
|
-
let e = t.useContext(
|
|
1180
|
+
var kt = t.createContext(void 0);
|
|
1181
|
+
function z() {
|
|
1182
|
+
let e = t.useContext(kt);
|
|
1186
1183
|
if (!e) throw Error("UseCurrentActionRequest must be used in CurrentActionRequestProvider");
|
|
1187
1184
|
return e;
|
|
1188
1185
|
}
|
|
1189
|
-
function
|
|
1190
|
-
let { getAction: i } =
|
|
1186
|
+
function At({ actionRequest: e, name: t, ref: n, ...r }) {
|
|
1187
|
+
let { getAction: i } = k(), { set: a, unset: o } = Ot();
|
|
1191
1188
|
t ??= [
|
|
1192
1189
|
e.action.entity,
|
|
1193
1190
|
e.action.name,
|
|
@@ -1199,8 +1196,8 @@ function Et({ actionRequest: e, name: t, ref: n, ...r }) {
|
|
|
1199
1196
|
...e,
|
|
1200
1197
|
action: s
|
|
1201
1198
|
};
|
|
1202
|
-
let [
|
|
1203
|
-
|
|
1199
|
+
let [c, l] = _(e), d = JSON.stringify(e), p = g(d), m = () => {
|
|
1200
|
+
l((e) => ({
|
|
1204
1201
|
...e,
|
|
1205
1202
|
query: {
|
|
1206
1203
|
...e.query,
|
|
@@ -1208,67 +1205,67 @@ function Et({ actionRequest: e, name: t, ref: n, ...r }) {
|
|
|
1208
1205
|
}
|
|
1209
1206
|
}));
|
|
1210
1207
|
};
|
|
1211
|
-
|
|
1212
|
-
let
|
|
1213
|
-
actionRequest:
|
|
1214
|
-
setActionRequest:
|
|
1215
|
-
refresh:
|
|
1208
|
+
f(n, () => ({ refresh: m }), []);
|
|
1209
|
+
let h = {
|
|
1210
|
+
actionRequest: c,
|
|
1211
|
+
setActionRequest: l,
|
|
1212
|
+
refresh: m
|
|
1216
1213
|
};
|
|
1217
|
-
return
|
|
1218
|
-
p.current !==
|
|
1219
|
-
}, [
|
|
1214
|
+
return u(() => {
|
|
1215
|
+
p.current !== d && (p.current = d, l(e));
|
|
1216
|
+
}, [d]), u(() => (a(t, h), () => {
|
|
1220
1217
|
o(t);
|
|
1221
|
-
}), []), /* @__PURE__ */ T(
|
|
1222
|
-
value:
|
|
1223
|
-
children: /* @__PURE__ */ T(
|
|
1224
|
-
namespace:
|
|
1218
|
+
}), []), /* @__PURE__ */ T(kt.Provider, {
|
|
1219
|
+
value: h,
|
|
1220
|
+
children: /* @__PURE__ */ T(Tt, {
|
|
1221
|
+
namespace: c.action.namespace || "",
|
|
1225
1222
|
children: r.children
|
|
1226
1223
|
})
|
|
1227
1224
|
});
|
|
1228
1225
|
}
|
|
1229
|
-
var
|
|
1230
|
-
if (!
|
|
1231
|
-
let { link: n } =
|
|
1226
|
+
var jt = ({ path: e, preloader: t }) => {
|
|
1227
|
+
if (!y.namespace.dakataa_crud) throw new D(500, "Invalid Configuration.");
|
|
1228
|
+
let { link: n } = O(), { getActionRequestByPath: r, externalToInternalPath: i, actions: a } = k(), [o, s] = _(void 0), c = o ? [
|
|
1232
1229
|
o.action.entity,
|
|
1233
1230
|
o.action.namespace,
|
|
1234
1231
|
o.action.name
|
|
1235
1232
|
].filter((e) => e).join("-") : Date.now().toString();
|
|
1236
|
-
return e ??= n?.path ?? location.pathname + location.search, e = i(e),
|
|
1233
|
+
return e ??= n?.path ?? location.pathname + location.search, e = i(e), u(() => {
|
|
1237
1234
|
s(r(e));
|
|
1238
|
-
}, [e, JSON.stringify(a)]),
|
|
1239
|
-
if (o === null) throw new
|
|
1240
|
-
}, [o]), o === void 0 ? t ?? /* @__PURE__ */ T(w, { children: "Loading" }) : o === null ? null : /* @__PURE__ */ T(
|
|
1235
|
+
}, [e, JSON.stringify(a)]), u(() => {
|
|
1236
|
+
if (o === null) throw new oe(404);
|
|
1237
|
+
}, [o]), o === void 0 ? t ?? /* @__PURE__ */ T(w, { children: "Loading" }) : o === null ? null : /* @__PURE__ */ T(At, {
|
|
1241
1238
|
actionRequest: o,
|
|
1242
|
-
children: /* @__PURE__ */ T(
|
|
1243
|
-
},
|
|
1244
|
-
},
|
|
1245
|
-
function
|
|
1246
|
-
return t.useContext(
|
|
1247
|
-
}
|
|
1248
|
-
var
|
|
1249
|
-
let
|
|
1239
|
+
children: /* @__PURE__ */ T(Rt, { children: /* @__PURE__ */ T(fa, { view: o.action.name }) })
|
|
1240
|
+
}, c);
|
|
1241
|
+
}, Mt = t.createContext(null), Nt = /* @__PURE__ */ new WeakMap(), Pt = 0, Ft = (e) => JSON.stringify(e instanceof FormData ? Array.from(e.entries()) : e, (e, t) => t instanceof Blob ? (Nt.has(t) || Nt.set(t, ++Pt), { fileId: Nt.get(t) }) : t);
|
|
1242
|
+
function B() {
|
|
1243
|
+
return t.useContext(Mt);
|
|
1244
|
+
}
|
|
1245
|
+
var It = ({ path: e, method: t, body: n, bodyType: r, loadOnInit: i = !0, onError: a, throwOnError: o = !0 }) => {
|
|
1246
|
+
let s = g(i), l = g(a), d = g(/* @__PURE__ */ new Set()), { navigate: f, externalToInternalPath: p, internalToExternalPath: m } = k(!1), [h, v] = _(), y = g(null), [b, te] = _(0), x = Ft(n);
|
|
1250
1247
|
e = p(e);
|
|
1251
|
-
let
|
|
1252
|
-
|
|
1253
|
-
}, []),
|
|
1248
|
+
let S = c(() => {
|
|
1249
|
+
y.current?.abort("canceled"), y.current = null;
|
|
1250
|
+
}, []), C = c((e) => (d.current.add(e), () => {
|
|
1254
1251
|
d.current.delete(e);
|
|
1255
1252
|
}), []);
|
|
1256
|
-
return
|
|
1257
|
-
|
|
1258
|
-
}, []),
|
|
1259
|
-
|
|
1260
|
-
}, [a]),
|
|
1261
|
-
if (!
|
|
1262
|
-
|
|
1253
|
+
return u(() => () => {
|
|
1254
|
+
s.current = i;
|
|
1255
|
+
}, []), u(() => {
|
|
1256
|
+
l.current = a;
|
|
1257
|
+
}, [a]), u(() => {
|
|
1258
|
+
if (!s.current) {
|
|
1259
|
+
s.current = !0;
|
|
1263
1260
|
return;
|
|
1264
1261
|
}
|
|
1265
|
-
|
|
1262
|
+
S();
|
|
1266
1263
|
let i = new AbortController();
|
|
1267
|
-
|
|
1268
|
-
let a =
|
|
1269
|
-
return
|
|
1264
|
+
y.current = i;
|
|
1265
|
+
let a = l.current;
|
|
1266
|
+
return xa().fetch({
|
|
1270
1267
|
url: e,
|
|
1271
|
-
method: t ||
|
|
1268
|
+
method: t || ee.GET,
|
|
1272
1269
|
body: n,
|
|
1273
1270
|
bodyType: r,
|
|
1274
1271
|
signal: i.signal
|
|
@@ -1278,14 +1275,14 @@ var Mt = ({ path: e, method: t, body: n, bodyType: r, loadOnInit: i = !0, onErro
|
|
|
1278
1275
|
if (n.redirected && r === 200) {
|
|
1279
1276
|
let t = new URL(n.url), r = t.pathname + t.search + t.hash;
|
|
1280
1277
|
if (r !== e) {
|
|
1281
|
-
f(
|
|
1278
|
+
f(m(r));
|
|
1282
1279
|
return;
|
|
1283
1280
|
}
|
|
1284
1281
|
}
|
|
1285
|
-
let a = t?.form?.modify?.view || t?.form?.filter?.view, o = r === 400 && a && Object.keys(
|
|
1282
|
+
let a = t?.form?.modify?.view || t?.form?.filter?.view, o = r === 400 && a && Object.keys(We(a)).length > 0;
|
|
1286
1283
|
if ([400, 500].includes(r) && !o) {
|
|
1287
1284
|
let e = typeof t?.detail == "string" ? t.detail : n.statusText, r = Array.isArray(t?.trace) ? t.trace : void 0;
|
|
1288
|
-
throw new
|
|
1285
|
+
throw new oe(n.status, e, r);
|
|
1289
1286
|
}
|
|
1290
1287
|
v({
|
|
1291
1288
|
data: t,
|
|
@@ -1293,39 +1290,36 @@ var Mt = ({ path: e, method: t, body: n, bodyType: r, loadOnInit: i = !0, onErro
|
|
|
1293
1290
|
});
|
|
1294
1291
|
}).catch((e) => {
|
|
1295
1292
|
if (!i.signal.aborted && ![...d.current].reverse().some((t) => t(e))) {
|
|
1296
|
-
if (a)
|
|
1297
|
-
|
|
1298
|
-
return;
|
|
1299
|
-
}
|
|
1300
|
-
if (o) throw e;
|
|
1293
|
+
if (a) a(e);
|
|
1294
|
+
else if (o) throw e;
|
|
1301
1295
|
}
|
|
1302
1296
|
}).finally(() => {
|
|
1303
|
-
|
|
1297
|
+
y.current === i && (y.current = null);
|
|
1304
1298
|
}), () => {
|
|
1305
|
-
i.abort("canceled"),
|
|
1299
|
+
i.abort("canceled"), y.current === i && (y.current = null);
|
|
1306
1300
|
};
|
|
1307
1301
|
}, [
|
|
1308
|
-
|
|
1302
|
+
b,
|
|
1309
1303
|
e,
|
|
1310
|
-
|
|
1304
|
+
x,
|
|
1311
1305
|
r,
|
|
1312
1306
|
t,
|
|
1313
|
-
|
|
1307
|
+
S,
|
|
1314
1308
|
o
|
|
1315
1309
|
]), {
|
|
1316
1310
|
url: e,
|
|
1317
|
-
status:
|
|
1318
|
-
results:
|
|
1319
|
-
response:
|
|
1311
|
+
status: h?.response.status || 0,
|
|
1312
|
+
results: h?.data,
|
|
1313
|
+
response: h?.response,
|
|
1320
1314
|
refresh: () => {
|
|
1321
|
-
|
|
1315
|
+
te((e) => e + 1);
|
|
1322
1316
|
},
|
|
1323
|
-
cancel:
|
|
1324
|
-
registerErrorHandler:
|
|
1317
|
+
cancel: S,
|
|
1318
|
+
registerErrorHandler: C
|
|
1325
1319
|
};
|
|
1326
|
-
},
|
|
1327
|
-
let { generateActionLink: i } =
|
|
1328
|
-
return
|
|
1320
|
+
}, Lt = ({ actionRequest: e, loadOnInit: t = !0, onError: n, throwOnError: r = !0 }) => {
|
|
1321
|
+
let { generateActionLink: i } = k();
|
|
1322
|
+
return It({
|
|
1329
1323
|
path: i(e),
|
|
1330
1324
|
method: e.method,
|
|
1331
1325
|
body: e.body,
|
|
@@ -1334,34 +1328,34 @@ var Mt = ({ path: e, method: t, body: n, bodyType: r, loadOnInit: i = !0, onErro
|
|
|
1334
1328
|
onError: n,
|
|
1335
1329
|
throwOnError: r
|
|
1336
1330
|
});
|
|
1337
|
-
},
|
|
1338
|
-
let { actionRequest: n } =
|
|
1339
|
-
return a?.url === o ? t : /* @__PURE__ */ T(
|
|
1331
|
+
}, Rt = ({ suspense: e, children: t }) => {
|
|
1332
|
+
let { actionRequest: n } = z(), { generateActionLink: r, externalToInternalPath: i } = k(), a = B(), o = i(r(n));
|
|
1333
|
+
return a?.url === o ? t : /* @__PURE__ */ T(zt, {
|
|
1340
1334
|
actionRequest: n,
|
|
1341
1335
|
suspense: e,
|
|
1342
1336
|
children: t
|
|
1343
1337
|
});
|
|
1344
|
-
},
|
|
1345
|
-
let r =
|
|
1346
|
-
return t ??= /* @__PURE__ */ T(w, { children: "Data Loading" }), /* @__PURE__ */ T(
|
|
1338
|
+
}, zt = ({ actionRequest: e, suspense: t, children: n }) => {
|
|
1339
|
+
let r = Lt({ actionRequest: e });
|
|
1340
|
+
return t ??= /* @__PURE__ */ T(w, { children: "Data Loading" }), /* @__PURE__ */ T(Bt, {
|
|
1347
1341
|
data: r,
|
|
1348
1342
|
children: t && !r?.response ? t : n
|
|
1349
1343
|
});
|
|
1350
|
-
},
|
|
1344
|
+
}, Bt = ({ data: e, children: t }) => /* @__PURE__ */ T(Mt.Provider, {
|
|
1351
1345
|
value: e,
|
|
1352
1346
|
children: t
|
|
1353
1347
|
});
|
|
1354
|
-
function
|
|
1355
|
-
return (t) => /* @__PURE__ */ T(
|
|
1348
|
+
function Vt(e) {
|
|
1349
|
+
return (t) => /* @__PURE__ */ T(Rt, { children: /* @__PURE__ */ T(e, { ...t }) });
|
|
1356
1350
|
}
|
|
1357
1351
|
//#endregion
|
|
1358
1352
|
//#region src/component/Translation.tsx
|
|
1359
|
-
var
|
|
1360
|
-
function
|
|
1361
|
-
return
|
|
1353
|
+
var Ht = (e) => e;
|
|
1354
|
+
function V() {
|
|
1355
|
+
return O().translate ?? Ht;
|
|
1362
1356
|
}
|
|
1363
|
-
var
|
|
1364
|
-
let { translate: a } =
|
|
1357
|
+
var H = ({ children: e, translationKey: n, domain: r, properties: i = {} }) => {
|
|
1358
|
+
let { translate: a } = O();
|
|
1365
1359
|
if (!a) return e ?? n;
|
|
1366
1360
|
let o = t.Children.toArray(e), s = n ?? (o.length > 0 && o.every((e) => typeof e == "string" || typeof e == "number") ? o.join("") : void 0);
|
|
1367
1361
|
if (s !== void 0) {
|
|
@@ -1372,18 +1366,18 @@ var W = ({ children: e, translationKey: n, domain: r, properties: i = {} }) => {
|
|
|
1372
1366
|
return t === s ? e ?? t : t;
|
|
1373
1367
|
}
|
|
1374
1368
|
return e;
|
|
1375
|
-
},
|
|
1369
|
+
}, Ut = (e) => e.replace(/(?<=.)[^@\n](?=[^@\n]*?@)|(?:(?<=@.)|(?!^)\G(?=[^@\n]*$)).(?=.*[^@\n]\.)/i, "*"), Wt = (e) => e.replace(/* @__PURE__ */ RegExp("^.{1,1}"), (e) => e.toUpperCase()), Gt = (e) => {
|
|
1376
1370
|
let t = e?.replace(/* @__PURE__ */ RegExp("[-_]", "gi"), " ").split(/* @__PURE__ */ RegExp("(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])"));
|
|
1377
1371
|
if (!t?.length) return null;
|
|
1378
1372
|
let n = t.shift(), r = t.pop();
|
|
1379
|
-
return t = t.map((e) => e.toLowerCase()), n && t.unshift(
|
|
1380
|
-
},
|
|
1381
|
-
function
|
|
1382
|
-
return t.useContext(
|
|
1383
|
-
}
|
|
1384
|
-
var
|
|
1385
|
-
let { templates: o } =
|
|
1386
|
-
n ??= d, e instanceof Array || (e = [e]), e = e.map((e) => e.split(/[._]/).filter((e) => e).map((e) =>
|
|
1373
|
+
return t = t.map((e) => e.toLowerCase()), n && t.unshift(Wt(n)), r && t.push(Wt(r)), t.join(" ");
|
|
1374
|
+
}, Kt = ({ children: e }) => /* @__PURE__ */ T(w, { children: e }), qt = t.createContext(void 0);
|
|
1375
|
+
function Jt() {
|
|
1376
|
+
return t.useContext(qt);
|
|
1377
|
+
}
|
|
1378
|
+
var U = s(({ view: e, prefix: t, namespace: n, children: r, props: i, data: a }) => {
|
|
1379
|
+
let { templates: o } = O(), s = Jt(), [c, l] = _(null), d = wt();
|
|
1380
|
+
n ??= d, e instanceof Array || (e = [e]), e = e.map((e) => e.split(/[._]/).filter((e) => e).map((e) => Wt(e)).join(""));
|
|
1387
1381
|
let [f, p, m] = [...e.map((e) => [
|
|
1388
1382
|
"crud",
|
|
1389
1383
|
n,
|
|
@@ -1403,16 +1397,16 @@ var G = o(({ view: e, prefix: t, namespace: n, children: r, props: i, data: a })
|
|
|
1403
1397
|
n
|
|
1404
1398
|
];
|
|
1405
1399
|
}, null) || [!1, void 0];
|
|
1406
|
-
if (
|
|
1400
|
+
if (u(() => {
|
|
1407
1401
|
if (p || !f || m === void 0) return;
|
|
1408
1402
|
let e = !0;
|
|
1409
1403
|
return m().then((t) => {
|
|
1410
|
-
e &&
|
|
1404
|
+
e && l({
|
|
1411
1405
|
path: f,
|
|
1412
1406
|
component: t.default
|
|
1413
1407
|
});
|
|
1414
1408
|
}, (t) => {
|
|
1415
|
-
e &&
|
|
1409
|
+
e && l({
|
|
1416
1410
|
path: f,
|
|
1417
1411
|
error: t
|
|
1418
1412
|
});
|
|
@@ -1424,9 +1418,9 @@ var G = o(({ view: e, prefix: t, namespace: n, children: r, props: i, data: a })
|
|
|
1424
1418
|
m,
|
|
1425
1419
|
p
|
|
1426
1420
|
]), p || !f) return r;
|
|
1427
|
-
if (
|
|
1428
|
-
let
|
|
1429
|
-
return /* @__PURE__ */ T(
|
|
1421
|
+
if (c && c.path === f && "error" in c) throw c.error;
|
|
1422
|
+
let h = c && c.path === f && "component" in c ? c.component : Kt;
|
|
1423
|
+
return /* @__PURE__ */ T(qt.Provider, {
|
|
1430
1424
|
value: {
|
|
1431
1425
|
template: f,
|
|
1432
1426
|
parent: r,
|
|
@@ -1435,100 +1429,103 @@ var G = o(({ view: e, prefix: t, namespace: n, children: r, props: i, data: a })
|
|
|
1435
1429
|
namespace: n,
|
|
1436
1430
|
isImported: !!m
|
|
1437
1431
|
},
|
|
1438
|
-
children: /* @__PURE__ */ T(
|
|
1432
|
+
children: /* @__PURE__ */ T(h, { ...i })
|
|
1439
1433
|
});
|
|
1440
|
-
}),
|
|
1441
|
-
function
|
|
1442
|
-
return t.useContext(
|
|
1434
|
+
}), Yt = t.createContext(void 0);
|
|
1435
|
+
function Xt() {
|
|
1436
|
+
return t.useContext(Yt);
|
|
1443
1437
|
}
|
|
1444
|
-
function
|
|
1445
|
-
return /* @__PURE__ */ T(
|
|
1438
|
+
function Zt({ view: e, children: t }) {
|
|
1439
|
+
return /* @__PURE__ */ T(Yt.Provider, {
|
|
1446
1440
|
value: { view: e },
|
|
1447
1441
|
children: t
|
|
1448
1442
|
});
|
|
1449
1443
|
}
|
|
1450
|
-
var
|
|
1451
|
-
let { form: r } =
|
|
1444
|
+
var Qt = ({ name: e, options: t, optional: n = !1 }) => {
|
|
1445
|
+
let { form: r } = J(), i = e ? r?.children?.[e] : r, a = {
|
|
1452
1446
|
...i,
|
|
1453
1447
|
...t || {}
|
|
1454
1448
|
};
|
|
1455
|
-
if (i && (
|
|
1449
|
+
if (i && (Ie(i) || t && [
|
|
1456
1450
|
"data",
|
|
1457
1451
|
"value",
|
|
1458
1452
|
"checked"
|
|
1459
|
-
].some((e) => e in t)) &&
|
|
1453
|
+
].some((e) => e in t)) && Le(a), !a?.type) {
|
|
1460
1454
|
if (n) return null;
|
|
1461
1455
|
throw Error("Missing Provided Form View to Form Group" + (e ? ": " + e : ""));
|
|
1462
1456
|
}
|
|
1463
|
-
return /* @__PURE__ */ T(
|
|
1457
|
+
return /* @__PURE__ */ T(q, {
|
|
1464
1458
|
view: a,
|
|
1465
|
-
children: /* @__PURE__ */ T(
|
|
1459
|
+
children: /* @__PURE__ */ T(kn, {})
|
|
1466
1460
|
});
|
|
1467
|
-
},
|
|
1461
|
+
}, $t = t.createContext(void 0), en = () => t.useContext($t), tn = ({ children: e, ...t }) => /* @__PURE__ */ T($t.Provider, {
|
|
1468
1462
|
value: t,
|
|
1469
1463
|
children: e
|
|
1470
|
-
}),
|
|
1471
|
-
let n =
|
|
1472
|
-
return /* @__PURE__ */ T(w, { children:
|
|
1464
|
+
}), nn = ({ view: e, className: t }) => {
|
|
1465
|
+
let n = en(), r = V(), i = I(e, "label_attr") || {}, a = n?.label || e.label || Gt(e.name || "") || "", o = ["checkbox", "radio"].includes(e.type || "input");
|
|
1466
|
+
return /* @__PURE__ */ T(w, { children: o ? /* @__PURE__ */ T("label", {
|
|
1473
1467
|
className: t ?? "form-check-label",
|
|
1474
|
-
htmlFor: e.id ||
|
|
1475
|
-
...
|
|
1468
|
+
htmlFor: e.id || ft(e.full_name || ""),
|
|
1469
|
+
...Ke(i),
|
|
1476
1470
|
title: typeof i.title == "string" ? r(i.title) : i.title,
|
|
1477
1471
|
"aria-label": typeof i["aria-label"] == "string" ? r(i["aria-label"]) : i["aria-label"],
|
|
1478
1472
|
"aria-description": typeof i["aria-description"] == "string" ? r(i["aria-description"]) : i["aria-description"],
|
|
1479
|
-
children: /* @__PURE__ */ T(
|
|
1473
|
+
children: /* @__PURE__ */ T(H, { children: a })
|
|
1480
1474
|
}) : /* @__PURE__ */ T("label", {
|
|
1481
1475
|
className: t ?? "form-label",
|
|
1482
|
-
...
|
|
1476
|
+
...Ke(i),
|
|
1483
1477
|
title: typeof i.title == "string" ? r(i.title) : i.title,
|
|
1484
1478
|
"aria-label": typeof i["aria-label"] == "string" ? r(i["aria-label"]) : i["aria-label"],
|
|
1485
1479
|
"aria-description": typeof i["aria-description"] == "string" ? r(i["aria-description"]) : i["aria-description"],
|
|
1486
|
-
children: /* @__PURE__ */ T(
|
|
1480
|
+
children: /* @__PURE__ */ T(H, { children: a })
|
|
1487
1481
|
}) });
|
|
1488
|
-
},
|
|
1489
|
-
let { form: t } =
|
|
1482
|
+
}, rn = ({ name: e }) => {
|
|
1483
|
+
let { form: t } = J(), n = V(), r = e ? t.children?.[e] : t;
|
|
1490
1484
|
if (!r) throw Error("Missing Form View for FormField" + (e ? ": " + e : ""));
|
|
1491
|
-
let i =
|
|
1485
|
+
let i = I(r, "help_attr") || {};
|
|
1492
1486
|
return /* @__PURE__ */ T(w, { children: r.help && /* @__PURE__ */ T("div", {
|
|
1493
1487
|
className: "form-text",
|
|
1494
|
-
...
|
|
1488
|
+
...Ke(i),
|
|
1495
1489
|
title: typeof i.title == "string" ? n(i.title) : i.title,
|
|
1496
1490
|
"aria-label": typeof i["aria-label"] == "string" ? n(i["aria-label"]) : i["aria-label"],
|
|
1497
1491
|
"aria-description": typeof i["aria-description"] == "string" ? n(i["aria-description"]) : i["aria-description"],
|
|
1498
|
-
children: /* @__PURE__ */ T(
|
|
1492
|
+
children: /* @__PURE__ */ T(H, { children: r.help })
|
|
1499
1493
|
}) });
|
|
1500
1494
|
};
|
|
1501
1495
|
//#endregion
|
|
1502
1496
|
//#region src/component/form/Choice.tsx
|
|
1503
|
-
function
|
|
1504
|
-
let r =
|
|
1505
|
-
return
|
|
1497
|
+
function an(e, t, n) {
|
|
1498
|
+
let r = c((e) => Ve(e, n), [n]);
|
|
1499
|
+
return lt(e, t, e.expanded && n ? r : void 0);
|
|
1506
1500
|
}
|
|
1507
|
-
var
|
|
1508
|
-
let t =
|
|
1501
|
+
var on = ({ choice: e }) => {
|
|
1502
|
+
let t = V(), n = I(e, "attr") || {}, r = I(e, "label");
|
|
1509
1503
|
return /* @__PURE__ */ T("option", {
|
|
1510
|
-
...
|
|
1511
|
-
value: e.value == null ?
|
|
1504
|
+
...qe(n),
|
|
1505
|
+
value: e.value == null ? N(r) : j(e),
|
|
1512
1506
|
title: typeof n.title == "string" ? t(n.title) : n.title,
|
|
1513
|
-
children: /* @__PURE__ */ T(
|
|
1507
|
+
children: /* @__PURE__ */ T(H, { children: r })
|
|
1514
1508
|
});
|
|
1515
|
-
},
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1509
|
+
}, sn = ({ view: e, group: t }) => {
|
|
1510
|
+
let n = V();
|
|
1511
|
+
return /* @__PURE__ */ T("optgroup", {
|
|
1512
|
+
label: n(t.label),
|
|
1513
|
+
children: Object.values(t.choices).map((t, n) => /* @__PURE__ */ T(on, {
|
|
1514
|
+
view: e,
|
|
1515
|
+
choice: t
|
|
1516
|
+
}, t.value == null ? n : j(t)))
|
|
1517
|
+
});
|
|
1518
|
+
}, cn = ({ view: e, choice: t, constraints: n, onChange: r, choiceValueTransform: i, choiceLabelTransform: a }) => {
|
|
1519
|
+
let o = an(e, n, i), s = V(), c = i ? N(i(t)) : j(t), l;
|
|
1520
|
+
l = a ? a(t) : I(t, "label");
|
|
1521
|
+
let u = I(e, "label_attr") || {}, d = I(e, "attr") || {}, f = {
|
|
1522
|
+
...I(t, "attr"),
|
|
1523
|
+
...I(e, "choice_attr")
|
|
1524
|
+
}, p = Object.hasOwn(f, "className") ? f.className : f.class, m = Object.hasOwn(u, "className") ? u.className : u.class, h = f.id ?? ft(e.full_name || "", c);
|
|
1528
1525
|
return /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("input", {
|
|
1529
|
-
...
|
|
1526
|
+
...qe(f),
|
|
1530
1527
|
ref: (t) => {
|
|
1531
|
-
t &&
|
|
1528
|
+
t && Je.set(t, {
|
|
1532
1529
|
required: !!e.required,
|
|
1533
1530
|
multiple: !!e.multiple,
|
|
1534
1531
|
override: f.required == null ? void 0 : !!f.required,
|
|
@@ -1538,17 +1535,17 @@ var tn = ({ choice: e }) => {
|
|
|
1538
1535
|
id: h,
|
|
1539
1536
|
value: c,
|
|
1540
1537
|
type: e.multiple ? "checkbox" : "radio",
|
|
1541
|
-
name:
|
|
1542
|
-
checked: !e.multiple && c === "" ? o.value == null || o.value === "" :
|
|
1538
|
+
name: Re(e),
|
|
1539
|
+
checked: !e.multiple && c === "" ? o.value == null || o.value === "" : F(o.value).includes(c),
|
|
1543
1540
|
disabled: f.disabled ?? e.disabled,
|
|
1544
|
-
required: f.required ?? (e.required && (!e.multiple ||
|
|
1541
|
+
required: f.required ?? (e.required && (!e.multiple || F(o.value).length === 0)),
|
|
1545
1542
|
"aria-invalid": !!o.errors.length,
|
|
1546
1543
|
className: p ?? ["form-check-input", o.errors.length ? "is-invalid" : null].filter(Boolean).join(" "),
|
|
1547
1544
|
onChange: (t) => {
|
|
1548
1545
|
if (d.onChange instanceof Function && d.onChange(t), f.onChange instanceof Function && f.onChange(t), t.defaultPrevented) return;
|
|
1549
1546
|
let n = o.change((n) => {
|
|
1550
1547
|
if (!e.multiple) return c;
|
|
1551
|
-
let r =
|
|
1548
|
+
let r = F(n);
|
|
1552
1549
|
return t.target.checked ? [...r, c] : r.filter((e) => e !== c);
|
|
1553
1550
|
});
|
|
1554
1551
|
r?.({
|
|
@@ -1561,54 +1558,54 @@ var tn = ({ choice: e }) => {
|
|
|
1561
1558
|
"aria-label": typeof f["aria-label"] == "string" ? s(f["aria-label"]) : f["aria-label"],
|
|
1562
1559
|
"aria-description": typeof f["aria-description"] == "string" ? s(f["aria-description"]) : f["aria-description"]
|
|
1563
1560
|
}), l != null && l !== "" && /* @__PURE__ */ T("label", {
|
|
1564
|
-
...
|
|
1561
|
+
...Ke(u),
|
|
1565
1562
|
htmlFor: h,
|
|
1566
1563
|
className: m ?? "form-check-label",
|
|
1567
1564
|
"aria-label": typeof u["aria-label"] == "string" ? s(u["aria-label"]) : u["aria-label"],
|
|
1568
1565
|
"aria-description": typeof u["aria-description"] == "string" ? s(u["aria-description"]) : u["aria-description"],
|
|
1569
1566
|
title: typeof u.title == "string" ? s(u.title) : u.title,
|
|
1570
|
-
children: /* @__PURE__ */ T(
|
|
1567
|
+
children: /* @__PURE__ */ T(H, { children: l })
|
|
1571
1568
|
})] });
|
|
1572
|
-
},
|
|
1569
|
+
}, ln = ({ view: e, group: t, ...n }) => /* @__PURE__ */ E("div", {
|
|
1573
1570
|
className: "form-group",
|
|
1574
1571
|
children: [/* @__PURE__ */ T("label", {
|
|
1575
1572
|
className: "form-label",
|
|
1576
|
-
children: /* @__PURE__ */ T(
|
|
1577
|
-
}), Object.values(t.choices).map((t, r) => /* @__PURE__ */ T(
|
|
1573
|
+
children: /* @__PURE__ */ T(H, { children: t.label })
|
|
1574
|
+
}), Object.values(t.choices).map((t, r) => /* @__PURE__ */ T(cn, {
|
|
1578
1575
|
view: e,
|
|
1579
1576
|
choice: t,
|
|
1580
1577
|
...n
|
|
1581
|
-
}, t.value == null ? r :
|
|
1582
|
-
}),
|
|
1583
|
-
let s =
|
|
1578
|
+
}, t.value == null ? r : j(t)))]
|
|
1579
|
+
}), un = ({ view: e, constraints: t, className: n, onChange: r, choiceValueTransform: i, choiceLabelTransform: a, ref: o }) => {
|
|
1580
|
+
let s = an(e, t, i), c = V(), l = I(e, "attr") || {}, u = Object.hasOwn(l, "className") ? l.className : l.class, { onChange: d, ...f } = l, p = {
|
|
1584
1581
|
view: e,
|
|
1585
1582
|
constraints: t,
|
|
1586
1583
|
onChange: r,
|
|
1587
1584
|
choiceValueTransform: i,
|
|
1588
1585
|
choiceLabelTransform: a
|
|
1589
1586
|
};
|
|
1590
|
-
if (e.expanded) return /* @__PURE__ */ E(w, { children: [typeof e.placeholder == "string" && /* @__PURE__ */ T(
|
|
1587
|
+
if (e.expanded) return /* @__PURE__ */ E(w, { children: [typeof e.placeholder == "string" && /* @__PURE__ */ T(cn, {
|
|
1591
1588
|
...p,
|
|
1592
1589
|
choice: {
|
|
1593
1590
|
label: e.placeholder,
|
|
1594
1591
|
value: null
|
|
1595
1592
|
}
|
|
1596
|
-
}), Object.values(e.choices || []).map((e, t) => "choices" in e ? /* @__PURE__ */ T(
|
|
1593
|
+
}), Object.values(e.choices || []).map((e, t) => "choices" in e ? /* @__PURE__ */ T(ln, {
|
|
1597
1594
|
...p,
|
|
1598
1595
|
group: e
|
|
1599
1596
|
}, e.label) : /* @__PURE__ */ T("div", {
|
|
1600
1597
|
className: "form-check",
|
|
1601
|
-
...
|
|
1602
|
-
children: /* @__PURE__ */ T(
|
|
1598
|
+
...Ke(f),
|
|
1599
|
+
children: /* @__PURE__ */ T(cn, {
|
|
1603
1600
|
...p,
|
|
1604
1601
|
choice: e
|
|
1605
1602
|
})
|
|
1606
|
-
}, e.value == null ? t :
|
|
1607
|
-
let m = Object.values(e.choices || []).flatMap((e) => "choices" in e ? Object.values(e.choices) : [e]).map((e) => e.value == null ?
|
|
1603
|
+
}, e.value == null ? t : j(e)))] });
|
|
1604
|
+
let m = Object.values(e.choices || []).flatMap((e) => "choices" in e ? Object.values(e.choices) : [e]).map((e) => e.value == null ? N(I(e, "label")) : j(e));
|
|
1608
1605
|
e.placeholder && m.push("");
|
|
1609
|
-
let h =
|
|
1610
|
-
return g = e.multiple ?
|
|
1611
|
-
...
|
|
1606
|
+
let h = F(s.value).filter((e) => !m.includes(e)), g;
|
|
1607
|
+
return g = e.multiple ? F(s.value) : Array.isArray(s.value) ? s.value[0] ?? "" : s.value ?? "", /* @__PURE__ */ E("select", {
|
|
1608
|
+
...qe(l),
|
|
1612
1609
|
ref: o,
|
|
1613
1610
|
id: e.id ?? l.id,
|
|
1614
1611
|
name: e.full_name,
|
|
@@ -1639,20 +1636,20 @@ var tn = ({ choice: e }) => {
|
|
|
1639
1636
|
}, e)),
|
|
1640
1637
|
e.placeholder && /* @__PURE__ */ T("option", {
|
|
1641
1638
|
value: "",
|
|
1642
|
-
children: /* @__PURE__ */ T(
|
|
1639
|
+
children: /* @__PURE__ */ T(H, { children: e.placeholder })
|
|
1643
1640
|
}),
|
|
1644
|
-
Object.values(e.choices || []).map((t, n) => "choices" in t ? /* @__PURE__ */ T(
|
|
1641
|
+
Object.values(e.choices || []).map((t, n) => "choices" in t ? /* @__PURE__ */ T(sn, {
|
|
1645
1642
|
view: e,
|
|
1646
1643
|
group: t
|
|
1647
|
-
}, t.label) : /* @__PURE__ */ T(
|
|
1644
|
+
}, t.label) : /* @__PURE__ */ T(on, {
|
|
1648
1645
|
view: e,
|
|
1649
1646
|
choice: t
|
|
1650
|
-
}, t.value == null ? n :
|
|
1647
|
+
}, t.value == null ? n : j(t)))
|
|
1651
1648
|
]
|
|
1652
1649
|
});
|
|
1653
|
-
},
|
|
1654
|
-
let i =
|
|
1655
|
-
[
|
|
1650
|
+
}, dn = ({ view: e, constraints: t, onChange: n, ref: r }) => {
|
|
1651
|
+
let i = lt(e, t), a = V(), o = en(), s = I(e, "attr") || {}, c = ze(e), l = Be(e), u = "placeholder" in s ? s.placeholder : o?.placeholder || e.placeholder, d = s.type ?? e.type;
|
|
1652
|
+
[A.Date, A.Birthday].includes(d) && (d = "date"), d === A.Datetime && (d = "datetime-local");
|
|
1656
1653
|
let f = (Object.hasOwn(s, "className") ? s.className : s.class) ?? o?.className ?? [
|
|
1657
1654
|
c ? "form-check-input" : "form-control",
|
|
1658
1655
|
o?.size ? "form-control-" + o.size : null,
|
|
@@ -1660,7 +1657,7 @@ var tn = ({ choice: e }) => {
|
|
|
1660
1657
|
i.errors.length ? "is-invalid" : null
|
|
1661
1658
|
].filter(Boolean).join(" ");
|
|
1662
1659
|
return /* @__PURE__ */ T("input", {
|
|
1663
|
-
...
|
|
1660
|
+
...qe(s),
|
|
1664
1661
|
ref: r,
|
|
1665
1662
|
id: e.id ?? s.id,
|
|
1666
1663
|
name: e.full_name,
|
|
@@ -1670,7 +1667,7 @@ var tn = ({ choice: e }) => {
|
|
|
1670
1667
|
"aria-invalid": !!i.errors.length,
|
|
1671
1668
|
className: f,
|
|
1672
1669
|
...d !== "file" && { value: c ? l : i.value ?? "" },
|
|
1673
|
-
...c && { checked:
|
|
1670
|
+
...c && { checked: F(i.value).includes(l) },
|
|
1674
1671
|
onChange: (t) => {
|
|
1675
1672
|
if (s.onChange instanceof Function && s.onChange(t), t.defaultPrevented) return;
|
|
1676
1673
|
if (d === "file") {
|
|
@@ -1680,7 +1677,7 @@ var tn = ({ choice: e }) => {
|
|
|
1680
1677
|
let r = i.change((n) => {
|
|
1681
1678
|
if (!c) return t.target.value;
|
|
1682
1679
|
if (!e.multiple) return t.target.checked ? l : null;
|
|
1683
|
-
let r =
|
|
1680
|
+
let r = F(n);
|
|
1684
1681
|
return t.target.checked ? [...r, l] : r.filter((e) => e !== l);
|
|
1685
1682
|
});
|
|
1686
1683
|
n?.({
|
|
@@ -1697,11 +1694,11 @@ var tn = ({ choice: e }) => {
|
|
|
1697
1694
|
"aria-description": typeof s["aria-description"] == "string" ? a(s["aria-description"]) : s["aria-description"],
|
|
1698
1695
|
...(Object.hasOwn(s, "inputMode") ? s.inputMode : s.inputmode) === "decimal" && { step: "any" }
|
|
1699
1696
|
});
|
|
1700
|
-
},
|
|
1701
|
-
function
|
|
1702
|
-
let n = t.useContext(
|
|
1697
|
+
}, fn = t.createContext({ requests: [] });
|
|
1698
|
+
function pn(e) {
|
|
1699
|
+
let n = t.useContext(fn);
|
|
1703
1700
|
if (n === void 0) throw Error("UseLoaderIndicator must be within DataLoaderIndicatorProvider");
|
|
1704
|
-
let { requests: r } = n, { matchPath: i, getActionByPath: a, generateActionLink: o } =
|
|
1701
|
+
let { requests: r } = n, { matchPath: i, getActionByPath: a, generateActionLink: o } = k(), s = null;
|
|
1705
1702
|
if (e) {
|
|
1706
1703
|
let t = a(e?.toString() ?? "");
|
|
1707
1704
|
if (t) {
|
|
@@ -1715,8 +1712,8 @@ function ln(e) {
|
|
|
1715
1712
|
}
|
|
1716
1713
|
return { isLoading: s ? !!r.filter((e) => e.url === s).length : !1 };
|
|
1717
1714
|
}
|
|
1718
|
-
function
|
|
1719
|
-
let [t, n] =
|
|
1715
|
+
function mn({ ...e }) {
|
|
1716
|
+
let [t, n] = h((e, t) => {
|
|
1720
1717
|
let { action: n, requestId: r, url: i } = t, a = new URL(i), o = a.toString().replace(a.origin, "");
|
|
1721
1718
|
switch (e = { requests: e.requests.filter((e) => e.requestId !== r) }, n) {
|
|
1722
1719
|
case "cancel":
|
|
@@ -1728,20 +1725,20 @@ function un({ ...e }) {
|
|
|
1728
1725
|
}
|
|
1729
1726
|
return e;
|
|
1730
1727
|
}, { requests: [] });
|
|
1731
|
-
return
|
|
1732
|
-
let e =
|
|
1728
|
+
return u(() => {
|
|
1729
|
+
let e = y.on(b.PRE_REQUEST, (e, t, r) => {
|
|
1733
1730
|
n({
|
|
1734
1731
|
action: "load",
|
|
1735
1732
|
requestId: e,
|
|
1736
1733
|
url: t.toString()
|
|
1737
1734
|
});
|
|
1738
|
-
}), t =
|
|
1735
|
+
}), t = y.on(b.POST_RESPONSE, (e, t, r, i) => {
|
|
1739
1736
|
n({
|
|
1740
1737
|
action: "complete",
|
|
1741
1738
|
requestId: e,
|
|
1742
1739
|
url: r.toString()
|
|
1743
1740
|
});
|
|
1744
|
-
}), r =
|
|
1741
|
+
}), r = y.on(b.ERROR, (e, t, r, i) => {
|
|
1745
1742
|
n({
|
|
1746
1743
|
action: "cancel",
|
|
1747
1744
|
requestId: e,
|
|
@@ -1749,50 +1746,46 @@ function un({ ...e }) {
|
|
|
1749
1746
|
});
|
|
1750
1747
|
});
|
|
1751
1748
|
return () => {
|
|
1752
|
-
|
|
1749
|
+
y.off(e).off(t).off(r);
|
|
1753
1750
|
};
|
|
1754
|
-
}, []), /* @__PURE__ */ T(
|
|
1751
|
+
}, []), /* @__PURE__ */ T(fn.Provider, {
|
|
1755
1752
|
value: t,
|
|
1756
1753
|
children: e.children
|
|
1757
1754
|
});
|
|
1758
1755
|
}
|
|
1759
1756
|
//#endregion
|
|
1760
1757
|
//#region src/component/Link.tsx
|
|
1761
|
-
var
|
|
1762
|
-
let { navigate: i } =
|
|
1763
|
-
|
|
1764
|
-
t.preventDefault(), t.stopPropagation();
|
|
1765
|
-
return;
|
|
1766
|
-
}
|
|
1767
|
-
s(!0), n && n(t), !t.defaultPrevented && e && (t.preventDefault(), i(e.toString()));
|
|
1758
|
+
var W = ({ to: e, children: t, onClick: n, ...r }) => {
|
|
1759
|
+
let { navigate: i } = k(), a = g(null), [o, s] = _(!1), { isLoading: c } = pn(e?.toString()), l = (t) => {
|
|
1760
|
+
c ? (t.preventDefault(), t.stopPropagation()) : (s(!0), n && n(t), !t.defaultPrevented && e && (t.preventDefault(), i(e.toString())));
|
|
1768
1761
|
};
|
|
1769
|
-
|
|
1770
|
-
o && (
|
|
1771
|
-
}, [
|
|
1762
|
+
u(() => {
|
|
1763
|
+
o && (c || s(!1));
|
|
1764
|
+
}, [c]), u(() => {
|
|
1772
1765
|
let e = a.current;
|
|
1773
|
-
return e?.addEventListener("click",
|
|
1774
|
-
e?.removeEventListener("click",
|
|
1766
|
+
return e?.addEventListener("click", l), () => {
|
|
1767
|
+
e?.removeEventListener("click", l);
|
|
1775
1768
|
};
|
|
1776
1769
|
}, [e, n]);
|
|
1777
|
-
let d = o &&
|
|
1770
|
+
let d = o && c;
|
|
1778
1771
|
return /* @__PURE__ */ T("a", {
|
|
1779
1772
|
ref: a,
|
|
1780
1773
|
href: e,
|
|
1781
1774
|
...r,
|
|
1782
1775
|
...d && { "data-preload": !0 },
|
|
1783
|
-
children: /* @__PURE__ */ T(
|
|
1776
|
+
children: /* @__PURE__ */ T(ht, {
|
|
1784
1777
|
preload: d,
|
|
1785
1778
|
...r,
|
|
1786
1779
|
children: t
|
|
1787
1780
|
})
|
|
1788
1781
|
});
|
|
1789
|
-
},
|
|
1790
|
-
let e = t.useContext(
|
|
1782
|
+
}, hn = 0, gn = t.createContext(void 0), _n = () => {
|
|
1783
|
+
let e = t.useContext(gn);
|
|
1791
1784
|
if (!e) throw Error("UseCollection must be used within a Collection");
|
|
1792
1785
|
return e;
|
|
1793
|
-
},
|
|
1794
|
-
let t =
|
|
1795
|
-
return /* @__PURE__ */ E(
|
|
1786
|
+
}, vn = ({ view: e }) => {
|
|
1787
|
+
let t = dt(e.full_name || "", Object.keys(e.children || {})), n = t.items, r = !!e.prototype, i = () => t.add(globalThis.crypto?.randomUUID?.() ?? `${Date.now()}_${hn++}`);
|
|
1788
|
+
return /* @__PURE__ */ E(gn.Provider, {
|
|
1796
1789
|
value: {
|
|
1797
1790
|
addItem: i,
|
|
1798
1791
|
removeItem: (e) => t.remove(e),
|
|
@@ -1802,60 +1795,60 @@ var K = ({ to: e, children: t, onClick: n, ...r }) => {
|
|
|
1802
1795
|
children: [/* @__PURE__ */ T("input", {
|
|
1803
1796
|
type: "hidden",
|
|
1804
1797
|
"data-form-collection": e.full_name
|
|
1805
|
-
}), /* @__PURE__ */ E(
|
|
1798
|
+
}), /* @__PURE__ */ E(U, {
|
|
1806
1799
|
prefix: "modify/form",
|
|
1807
1800
|
view: [...e.block_prefixes || [], e.name + ".collection"],
|
|
1808
|
-
children: [/* @__PURE__ */ T(
|
|
1801
|
+
children: [/* @__PURE__ */ T(yn, {}), r && /* @__PURE__ */ T(W, {
|
|
1809
1802
|
onClick: () => i(),
|
|
1810
1803
|
className: "btn btn-outline-primary btn-sm",
|
|
1811
1804
|
children: "+ Add"
|
|
1812
1805
|
})]
|
|
1813
1806
|
}, e.full_name)]
|
|
1814
1807
|
});
|
|
1815
|
-
},
|
|
1816
|
-
let { items: e } =
|
|
1808
|
+
}, yn = () => {
|
|
1809
|
+
let { items: e } = _n(), { form: t } = J(), n = !!t.prototype, r = m(() => e.map((e, n) => t.children?.[e] || (t.prototype ? Ue(t.prototype, t, e, n) : null)), [t, e]);
|
|
1817
1810
|
return /* @__PURE__ */ T(w, { children: e.map((e, t) => {
|
|
1818
1811
|
let i = r[t];
|
|
1819
|
-
return i ? /* @__PURE__ */ T(
|
|
1812
|
+
return i ? /* @__PURE__ */ T(Sn, {
|
|
1820
1813
|
name: e,
|
|
1821
1814
|
index: t,
|
|
1822
1815
|
view: i,
|
|
1823
1816
|
isPrototype: n
|
|
1824
1817
|
}, e) : null;
|
|
1825
1818
|
}) });
|
|
1826
|
-
},
|
|
1827
|
-
let e = t.useContext(
|
|
1819
|
+
}, bn = t.createContext(void 0), xn = () => {
|
|
1820
|
+
let e = t.useContext(bn);
|
|
1828
1821
|
if (!e) throw Error("UseCollectionItem must be used within a CollectionItem");
|
|
1829
1822
|
return e;
|
|
1830
|
-
},
|
|
1831
|
-
let { removeItem: i } =
|
|
1832
|
-
return /* @__PURE__ */ T(
|
|
1823
|
+
}, Sn = ({ view: e, name: t, index: n, isPrototype: r }) => {
|
|
1824
|
+
let { removeItem: i } = _n(), { form: a } = Wn() || { form: e }, o = t || e.prototype_name || e.name || "";
|
|
1825
|
+
return /* @__PURE__ */ T(q, {
|
|
1833
1826
|
view: e,
|
|
1834
1827
|
allowDuplicates: r,
|
|
1835
|
-
children: /* @__PURE__ */ T(
|
|
1828
|
+
children: /* @__PURE__ */ T(bn.Provider, {
|
|
1836
1829
|
value: {
|
|
1837
1830
|
index: n,
|
|
1838
1831
|
removeItem: () => i(o)
|
|
1839
1832
|
},
|
|
1840
|
-
children: /* @__PURE__ */ T(
|
|
1833
|
+
children: /* @__PURE__ */ T(U, {
|
|
1841
1834
|
prefix: "modify/form",
|
|
1842
1835
|
view: [...e.block_prefixes || [], a.name + ".item"],
|
|
1843
1836
|
children: /* @__PURE__ */ E("div", {
|
|
1844
1837
|
className: "mb-3",
|
|
1845
|
-
children: [/* @__PURE__ */ T(
|
|
1838
|
+
children: [/* @__PURE__ */ T(On, { view: e }), r && /* @__PURE__ */ T(W, {
|
|
1846
1839
|
to: "#",
|
|
1847
1840
|
onClick: () => i(o),
|
|
1848
1841
|
className: "btn btn-outline-danger btn-sm",
|
|
1849
|
-
children: /* @__PURE__ */ T(
|
|
1842
|
+
children: /* @__PURE__ */ T(H, { children: "Delete" })
|
|
1850
1843
|
})]
|
|
1851
1844
|
})
|
|
1852
1845
|
})
|
|
1853
1846
|
})
|
|
1854
1847
|
});
|
|
1855
|
-
},
|
|
1856
|
-
let i =
|
|
1848
|
+
}, Cn = ({ view: e, constraints: t, onChange: n, ref: r }) => {
|
|
1849
|
+
let i = lt(e, t), a = V(), o = en(), s = I(e, "attr") || {}, c = Object.hasOwn(s, "className") ? s.className : s.class, l = "placeholder" in s ? s.placeholder : o?.placeholder || e.placeholder;
|
|
1857
1850
|
return /* @__PURE__ */ T("textarea", {
|
|
1858
|
-
...
|
|
1851
|
+
...qe(s),
|
|
1859
1852
|
ref: r,
|
|
1860
1853
|
id: e.id ?? s.id,
|
|
1861
1854
|
name: e.full_name,
|
|
@@ -1877,45 +1870,45 @@ var K = ({ to: e, children: t, onClick: n, ...r }) => {
|
|
|
1877
1870
|
"aria-label": typeof s["aria-label"] == "string" ? a(s["aria-label"]) : s["aria-label"],
|
|
1878
1871
|
"aria-description": typeof s["aria-description"] == "string" ? a(s["aria-description"]) : s["aria-description"]
|
|
1879
1872
|
});
|
|
1880
|
-
},
|
|
1873
|
+
}, wn = ({ view: e, ref: t }) => {
|
|
1881
1874
|
switch (e.type) {
|
|
1882
|
-
case
|
|
1883
|
-
case
|
|
1884
|
-
case
|
|
1885
|
-
case
|
|
1886
|
-
case
|
|
1875
|
+
case A.Entity:
|
|
1876
|
+
case A.Choice:
|
|
1877
|
+
case A.Currency:
|
|
1878
|
+
case A.Language:
|
|
1879
|
+
case A.Enum: return /* @__PURE__ */ T(un, {
|
|
1887
1880
|
view: e,
|
|
1888
1881
|
ref: t
|
|
1889
1882
|
});
|
|
1890
|
-
case
|
|
1891
|
-
case
|
|
1883
|
+
case A.Collection: return /* @__PURE__ */ T(vn, { view: e });
|
|
1884
|
+
case A.Textarea: return /* @__PURE__ */ T(Cn, {
|
|
1892
1885
|
view: e,
|
|
1893
1886
|
ref: t
|
|
1894
1887
|
});
|
|
1895
|
-
case
|
|
1896
|
-
case
|
|
1897
|
-
case
|
|
1898
|
-
case
|
|
1899
|
-
case
|
|
1900
|
-
case
|
|
1901
|
-
case
|
|
1902
|
-
case
|
|
1903
|
-
case
|
|
1904
|
-
case
|
|
1905
|
-
case
|
|
1906
|
-
case
|
|
1907
|
-
case
|
|
1908
|
-
case
|
|
1909
|
-
case
|
|
1888
|
+
case A.Hidden:
|
|
1889
|
+
case A.Input:
|
|
1890
|
+
case A.Money:
|
|
1891
|
+
case A.Text:
|
|
1892
|
+
case A.Tel:
|
|
1893
|
+
case A.Checkbox:
|
|
1894
|
+
case A.Radio:
|
|
1895
|
+
case A.Integer:
|
|
1896
|
+
case A.Number:
|
|
1897
|
+
case A.Password:
|
|
1898
|
+
case A.Datetime:
|
|
1899
|
+
case A.Date:
|
|
1900
|
+
case A.Birthday:
|
|
1901
|
+
case A.Time:
|
|
1902
|
+
case A.Email: return /* @__PURE__ */ T(dn, {
|
|
1910
1903
|
view: e,
|
|
1911
1904
|
ref: t
|
|
1912
1905
|
});
|
|
1913
|
-
case
|
|
1914
|
-
case
|
|
1906
|
+
case A.Repeated:
|
|
1907
|
+
case A.Form: return /* @__PURE__ */ T(kn, {});
|
|
1915
1908
|
default: throw Error("Invalid view type: " + e.type);
|
|
1916
1909
|
}
|
|
1917
|
-
},
|
|
1918
|
-
let { form: i } =
|
|
1910
|
+
}, Tn = ({ name: e, options: t, optional: n = !1, ref: r }) => {
|
|
1911
|
+
let { form: i } = J(), a = e ? i.children?.[e] : i;
|
|
1919
1912
|
if (!a) {
|
|
1920
1913
|
if (n) return null;
|
|
1921
1914
|
throw Error("Missing Form View for FormField" + (e ? ": " + e : ""));
|
|
@@ -1924,47 +1917,49 @@ var K = ({ to: e, children: t, onClick: n, ...r }) => {
|
|
|
1924
1917
|
...a,
|
|
1925
1918
|
...t || {}
|
|
1926
1919
|
};
|
|
1927
|
-
|
|
1920
|
+
(Ie(a) || t && [
|
|
1928
1921
|
"data",
|
|
1929
1922
|
"value",
|
|
1930
1923
|
"checked"
|
|
1931
|
-
].some((e) => e in t)) &&
|
|
1924
|
+
].some((e) => e in t)) && Le(o);
|
|
1925
|
+
let s = [(o.name || "form") + "Field", ...o.block_prefixes || []];
|
|
1926
|
+
return /* @__PURE__ */ T(q, {
|
|
1932
1927
|
view: o,
|
|
1933
|
-
children: /* @__PURE__ */ T(
|
|
1934
|
-
view:
|
|
1928
|
+
children: /* @__PURE__ */ T(U, {
|
|
1929
|
+
view: s,
|
|
1935
1930
|
prefix: "modify/form",
|
|
1936
1931
|
data: o,
|
|
1937
|
-
children: /* @__PURE__ */ T(
|
|
1932
|
+
children: /* @__PURE__ */ T(wn, {
|
|
1938
1933
|
view: o,
|
|
1939
1934
|
ref: r
|
|
1940
1935
|
})
|
|
1941
1936
|
})
|
|
1942
1937
|
});
|
|
1943
|
-
},
|
|
1938
|
+
}, En = ({ name: e, ...t }) => {
|
|
1944
1939
|
e = e instanceof Array ? e : [e];
|
|
1945
|
-
let n =
|
|
1940
|
+
let n = ut(e);
|
|
1946
1941
|
return n.length ? /* @__PURE__ */ T("div", {
|
|
1947
1942
|
...t,
|
|
1948
1943
|
children: /* @__PURE__ */ T("ul", {
|
|
1949
1944
|
className: "mb-0",
|
|
1950
|
-
children: n.map((e, t) => /* @__PURE__ */ T("li", { children: /* @__PURE__ */ T(
|
|
1945
|
+
children: n.map((e, t) => /* @__PURE__ */ T("li", { children: /* @__PURE__ */ T(H, { children: e.message }) }, t))
|
|
1951
1946
|
})
|
|
1952
1947
|
}) : null;
|
|
1953
|
-
},
|
|
1954
|
-
let { form: n } =
|
|
1948
|
+
}, Dn = ({ name: e, ...t }) => {
|
|
1949
|
+
let { form: n } = J(), { store: r } = R(), i = g(Symbol("error")), a = e ? (e instanceof Array ? e : [e]).map((e) => {
|
|
1955
1950
|
let t = e ? n.children?.[e] : n;
|
|
1956
1951
|
if (!t) throw Error("Missing Form View for FormError: " + (e || ""));
|
|
1957
1952
|
return t;
|
|
1958
|
-
}) : [n], o = a.map((e) => e.full_name || "").filter(Boolean);
|
|
1959
|
-
return
|
|
1953
|
+
}) : [n], o = a.map((e) => e.full_name || "").filter(Boolean), s = JSON.stringify(o);
|
|
1954
|
+
return u(() => {
|
|
1960
1955
|
let e = o.map((e) => r.registerError(e, i.current));
|
|
1961
1956
|
return () => e.forEach((e) => e());
|
|
1962
|
-
}, [r,
|
|
1957
|
+
}, [r, s]), /* @__PURE__ */ T(En, {
|
|
1963
1958
|
name: a.map((e) => e.full_name || ""),
|
|
1964
1959
|
...t
|
|
1965
1960
|
});
|
|
1966
|
-
},
|
|
1967
|
-
let i = [
|
|
1961
|
+
}, On = ({ view: e, className: t, size: n, type: r }) => {
|
|
1962
|
+
let i = [A.Checkbox, A.Radio].includes(e.type);
|
|
1968
1963
|
e = {
|
|
1969
1964
|
...e,
|
|
1970
1965
|
type: r || e.type
|
|
@@ -1974,45 +1969,45 @@ var K = ({ to: e, children: t, onClick: n, ...r }) => {
|
|
|
1974
1969
|
...i ? ["form-check"] : [],
|
|
1975
1970
|
...t?.split(" ") || []
|
|
1976
1971
|
].filter((e) => e);
|
|
1977
|
-
return /* @__PURE__ */ T(w, { children: e.type ===
|
|
1972
|
+
return /* @__PURE__ */ T(w, { children: e.type === A.Hidden ? /* @__PURE__ */ T(Tn, { options: r ? { type: r } : void 0 }) : /* @__PURE__ */ E("div", {
|
|
1978
1973
|
className: a.join(" "),
|
|
1979
1974
|
children: [
|
|
1980
|
-
!i && /* @__PURE__ */ T(
|
|
1981
|
-
/* @__PURE__ */ T(
|
|
1975
|
+
!i && /* @__PURE__ */ T(nn, { view: e }),
|
|
1976
|
+
/* @__PURE__ */ T(Tn, {
|
|
1982
1977
|
size: n,
|
|
1983
1978
|
options: r ? { type: r } : void 0
|
|
1984
1979
|
}),
|
|
1985
|
-
i && /* @__PURE__ */ T(
|
|
1986
|
-
/* @__PURE__ */ T(
|
|
1987
|
-
/* @__PURE__ */ T(
|
|
1980
|
+
i && /* @__PURE__ */ T(nn, { view: e }),
|
|
1981
|
+
/* @__PURE__ */ T(Dn, { className: "invalid-feedback" }),
|
|
1982
|
+
/* @__PURE__ */ T(rn, {})
|
|
1988
1983
|
]
|
|
1989
1984
|
}) });
|
|
1990
|
-
},
|
|
1991
|
-
let { form: e } =
|
|
1992
|
-
return /* @__PURE__ */ T(
|
|
1985
|
+
}, kn = () => {
|
|
1986
|
+
let { form: e } = J(), t = [(e.name || "form") + "Group", ...e.block_prefixes || []].map((e) => e + "_group");
|
|
1987
|
+
return /* @__PURE__ */ T(Zt, {
|
|
1993
1988
|
view: e,
|
|
1994
|
-
children: /* @__PURE__ */ T(
|
|
1995
|
-
view:
|
|
1989
|
+
children: /* @__PURE__ */ T(U, {
|
|
1990
|
+
view: t,
|
|
1996
1991
|
prefix: "modify/form",
|
|
1997
1992
|
data: e,
|
|
1998
|
-
children: [
|
|
1993
|
+
children: [A.Form, A.Repeated].includes(e?.type) ? Object.entries(e.children || {}).map(([e, t]) => /* @__PURE__ */ T(q, {
|
|
1999
1994
|
view: t,
|
|
2000
|
-
children: /* @__PURE__ */ T(
|
|
2001
|
-
}, t.full_name || e)) : /* @__PURE__ */ T(
|
|
1995
|
+
children: /* @__PURE__ */ T(kn, {})
|
|
1996
|
+
}, t.full_name || e)) : /* @__PURE__ */ T(On, { view: e })
|
|
2002
1997
|
})
|
|
2003
1998
|
});
|
|
2004
|
-
},
|
|
2005
|
-
let t =
|
|
2006
|
-
return /* @__PURE__ */ T(
|
|
2007
|
-
name:
|
|
1999
|
+
}, An = () => /* @__PURE__ */ T(kn, {}), jn = ({ className: e }) => {
|
|
2000
|
+
let t = at(), { store: n } = R(), r = v(n.subscribeRendering, n.getRendering, n.getRendering), i = Object.keys(t.errors).filter((e) => !r.errors.includes(e));
|
|
2001
|
+
return /* @__PURE__ */ T(En, {
|
|
2002
|
+
name: i,
|
|
2008
2003
|
className: e
|
|
2009
2004
|
});
|
|
2010
|
-
},
|
|
2011
|
-
let e = t.useContext(
|
|
2005
|
+
}, Mn = t.createContext(void 0), Nn = () => {
|
|
2006
|
+
let e = t.useContext(Mn);
|
|
2012
2007
|
if (!e) throw Error("UseTemplate must be used inside Template");
|
|
2013
2008
|
return e;
|
|
2014
|
-
},
|
|
2015
|
-
let r = t.useContext(
|
|
2009
|
+
}, Pn = ({ name: e, children: n }) => {
|
|
2010
|
+
let r = t.useContext(Mn), [i, a] = h((t, n) => {
|
|
2016
2011
|
if (n.template && n.template !== e) return r?.dispatch(n), t;
|
|
2017
2012
|
let i = t[n.block] || [], a = n.element || null;
|
|
2018
2013
|
if (n.action === "set") {
|
|
@@ -2029,7 +2024,7 @@ var K = ({ to: e, children: t, onClick: n, ...r }) => {
|
|
|
2029
2024
|
[n.block]: i
|
|
2030
2025
|
};
|
|
2031
2026
|
}, {});
|
|
2032
|
-
return /* @__PURE__ */ T(
|
|
2027
|
+
return /* @__PURE__ */ T(Mn.Provider, {
|
|
2033
2028
|
value: {
|
|
2034
2029
|
name: e,
|
|
2035
2030
|
blocks: i,
|
|
@@ -2039,17 +2034,17 @@ var K = ({ to: e, children: t, onClick: n, ...r }) => {
|
|
|
2039
2034
|
},
|
|
2040
2035
|
children: n
|
|
2041
2036
|
});
|
|
2042
|
-
},
|
|
2043
|
-
let { getBlock: r } =
|
|
2044
|
-
return /* @__PURE__ */ T(
|
|
2037
|
+
}, Fn = t.createContext(void 0), G = ({ name: e, template: t, children: n }) => {
|
|
2038
|
+
let { getBlock: r } = Nn(), i = r(e, t);
|
|
2039
|
+
return /* @__PURE__ */ T(Fn.Provider, {
|
|
2045
2040
|
value: {
|
|
2046
2041
|
name: e,
|
|
2047
2042
|
children: n
|
|
2048
2043
|
},
|
|
2049
2044
|
children: i === void 0 ? n : i
|
|
2050
2045
|
});
|
|
2051
|
-
},
|
|
2052
|
-
let r =
|
|
2046
|
+
}, K = ({ name: e, template: t, children: n }) => {
|
|
2047
|
+
let r = d(), { dispatch: i } = Nn(), a = () => {
|
|
2053
2048
|
i({
|
|
2054
2049
|
id: r,
|
|
2055
2050
|
action: "unset",
|
|
@@ -2057,7 +2052,7 @@ var K = ({ to: e, children: t, onClick: n, ...r }) => {
|
|
|
2057
2052
|
block: e
|
|
2058
2053
|
});
|
|
2059
2054
|
};
|
|
2060
|
-
return
|
|
2055
|
+
return u(() => (i({
|
|
2061
2056
|
id: r,
|
|
2062
2057
|
action: "set",
|
|
2063
2058
|
block: e,
|
|
@@ -2065,38 +2060,38 @@ var K = ({ to: e, children: t, onClick: n, ...r }) => {
|
|
|
2065
2060
|
element: n
|
|
2066
2061
|
}), () => {
|
|
2067
2062
|
a();
|
|
2068
|
-
}), [n]),
|
|
2063
|
+
}), [n]), u(() => () => {
|
|
2069
2064
|
a();
|
|
2070
2065
|
}, []), null;
|
|
2071
|
-
},
|
|
2072
|
-
let { name: e, children: n } = t.useContext(
|
|
2066
|
+
}, In = () => {
|
|
2067
|
+
let { name: e, children: n } = t.useContext(Fn) || {}, { name: r, getParent: i } = Nn();
|
|
2073
2068
|
return (e ? i(e) : null) || n || null;
|
|
2074
2069
|
};
|
|
2075
|
-
function
|
|
2076
|
-
return (n) => /* @__PURE__ */ E(
|
|
2070
|
+
function Ln(e, t) {
|
|
2071
|
+
return (n) => /* @__PURE__ */ E(Pn, {
|
|
2077
2072
|
name: t.name,
|
|
2078
2073
|
children: [/* @__PURE__ */ T(e, { ...n }), n.children]
|
|
2079
2074
|
});
|
|
2080
2075
|
}
|
|
2081
2076
|
//#endregion
|
|
2082
2077
|
//#region src/component/form/formSession.ts
|
|
2083
|
-
var
|
|
2084
|
-
function
|
|
2078
|
+
var Rn = (e = {}) => Object.entries(e).sort(([e], [t]) => e.localeCompare(t));
|
|
2079
|
+
function zn(e, t = !1) {
|
|
2085
2080
|
let n = [
|
|
2086
2081
|
e.action.namespace,
|
|
2087
2082
|
e.action.entity,
|
|
2088
2083
|
e.action.name,
|
|
2089
|
-
|
|
2084
|
+
Rn(e.parameters)
|
|
2090
2085
|
];
|
|
2091
2086
|
if (t) {
|
|
2092
|
-
let t =
|
|
2087
|
+
let t = Rn(e.query).filter(([e]) => e !== "_ts");
|
|
2093
2088
|
n.push(t);
|
|
2094
2089
|
}
|
|
2095
2090
|
return JSON.stringify(n);
|
|
2096
2091
|
}
|
|
2097
2092
|
//#endregion
|
|
2098
2093
|
//#region src/component/crud/form/FormRequestError.tsx
|
|
2099
|
-
function
|
|
2094
|
+
function Bn(e) {
|
|
2100
2095
|
let t = 0, n = "Request failed.", r;
|
|
2101
2096
|
return e instanceof Error ? n = e.message : typeof e == "string" && (n = e), e && typeof e == "object" && ("status" in e && typeof e.status == "number" && (t = e.status), "detail" in e && typeof e.detail == "string" && (n = e.detail), "trace" in e && Array.isArray(e.trace) && (r = e.trace)), {
|
|
2102
2097
|
status: t,
|
|
@@ -2104,9 +2099,9 @@ function In(e) {
|
|
|
2104
2099
|
trace: r
|
|
2105
2100
|
};
|
|
2106
2101
|
}
|
|
2107
|
-
function
|
|
2108
|
-
let { store: i } =
|
|
2109
|
-
return
|
|
2102
|
+
function Vn({ session: e, pending: t, loader: n, onError: r }) {
|
|
2103
|
+
let { store: i } = R(), a = B()?.registerErrorHandler, { stopLoading: o } = _t() || {};
|
|
2104
|
+
return u(() => a?.((a) => t.current?.session === e && (t.current = null, i.setSubmitting(!1), o?.(n), r ? r(Bn(a)) !== !1 : !1)), [
|
|
2110
2105
|
a,
|
|
2111
2106
|
t,
|
|
2112
2107
|
e,
|
|
@@ -2118,10 +2113,10 @@ function Ln({ session: e, pending: t, loader: n, onError: r }) {
|
|
|
2118
2113
|
}
|
|
2119
2114
|
//#endregion
|
|
2120
2115
|
//#region src/component/crud/form/Form.tsx
|
|
2121
|
-
var
|
|
2122
|
-
let a =
|
|
2123
|
-
|
|
2124
|
-
l && (o.reconcile(
|
|
2116
|
+
var Hn = t.createContext(void 0), q = ({ view: e, allowDuplicates: t, children: n, syncMode: r = "refresh", submission: i }) => {
|
|
2117
|
+
let a = Wn(), { store: o, apiRef: s } = R(), c = Xt(), l = !a;
|
|
2118
|
+
p(() => {
|
|
2119
|
+
l && (o.reconcile(He(e, o.getInitialValue), r, i), o.setErrors(We(e), i, !0), o.setSubmitting(!1));
|
|
2125
2120
|
}, [
|
|
2126
2121
|
o,
|
|
2127
2122
|
l,
|
|
@@ -2136,148 +2131,147 @@ var Rn = t.createContext(void 0), zn = ({ view: e, allowDuplicates: t, children:
|
|
|
2136
2131
|
r = e.full_name + n;
|
|
2137
2132
|
}
|
|
2138
2133
|
r && s.current?.setValue(r, n);
|
|
2139
|
-
},
|
|
2134
|
+
}, d = {
|
|
2140
2135
|
form: e,
|
|
2141
2136
|
setValue: u,
|
|
2142
2137
|
setValues: (e) => Object.entries(e).forEach(([e, t]) => u(e, t)),
|
|
2143
2138
|
allowDuplicates: t
|
|
2144
2139
|
};
|
|
2145
|
-
return /* @__PURE__ */ T(
|
|
2146
|
-
value:
|
|
2147
|
-
children: /* @__PURE__ */ T(
|
|
2140
|
+
return /* @__PURE__ */ T(Hn.Provider, {
|
|
2141
|
+
value: d,
|
|
2142
|
+
children: /* @__PURE__ */ T(Un, {
|
|
2148
2143
|
view: e,
|
|
2149
2144
|
allowDuplicates: !!t || c?.view.full_name === e.full_name || a?.form.full_name === e.full_name,
|
|
2150
2145
|
children: n
|
|
2151
2146
|
})
|
|
2152
2147
|
});
|
|
2153
|
-
},
|
|
2154
|
-
let r =
|
|
2155
|
-
return
|
|
2148
|
+
}, Un = ({ children: e, view: t, allowDuplicates: n }) => {
|
|
2149
|
+
let r = d(), { store: i } = R(), a = t.full_name || "", o = c(() => i.getRendering().elements[a], [i, a]), s = v(i.subscribeRendering, o, o);
|
|
2150
|
+
return p(() => a ? i.registerView(a, r) : void 0, [
|
|
2156
2151
|
i,
|
|
2157
2152
|
a,
|
|
2158
2153
|
r
|
|
2159
|
-
]), a && !n &&
|
|
2154
|
+
]), a && !n && s !== r ? null : /* @__PURE__ */ T(w, { children: e });
|
|
2160
2155
|
};
|
|
2161
|
-
function
|
|
2162
|
-
let e = t.useContext(
|
|
2156
|
+
function J() {
|
|
2157
|
+
let e = t.useContext(Hn);
|
|
2163
2158
|
if (!e) throw Error("UseFormView must be used within a FormViewProvider.");
|
|
2164
2159
|
return e;
|
|
2165
2160
|
}
|
|
2166
|
-
function
|
|
2167
|
-
return t.useContext(
|
|
2161
|
+
function Wn() {
|
|
2162
|
+
return t.useContext(Hn);
|
|
2168
2163
|
}
|
|
2169
|
-
var
|
|
2170
|
-
let { navigate: o, generateLink: s, generateActionLink:
|
|
2171
|
-
|
|
2172
|
-
let
|
|
2173
|
-
|
|
2174
|
-
session:
|
|
2164
|
+
var Gn = Ln(o(({ onSuccess: e, onError: t, onLoad: n, onStateChange: r, embedded: i = !1 }, a) => {
|
|
2165
|
+
let { navigate: o, generateLink: s, generateActionLink: c } = k(), { actionRequest: l, setActionRequest: d } = z(), p = c(l), m = zn(l), [h, v] = _(null), y = h?.session === m ? h.data : null, b = g(null), x = g(0), S = g(void 0), C = g(null), w = B(), { startLoading: ne, stopLoading: re } = _t() || {};
|
|
2166
|
+
f(a, () => ({ getFormRef: () => C.current }));
|
|
2167
|
+
let ie = (e, t) => {
|
|
2168
|
+
ne?.(D?.full_name || "form"), b.current = {
|
|
2169
|
+
session: m,
|
|
2175
2170
|
snapshot: t
|
|
2176
|
-
},
|
|
2177
|
-
...
|
|
2178
|
-
method:
|
|
2171
|
+
}, x.current = Math.max(Date.now(), x.current + 1), e.set("_ts", String(x.current)), d({
|
|
2172
|
+
...l,
|
|
2173
|
+
method: ee.POST,
|
|
2179
2174
|
body: e,
|
|
2180
|
-
bodyType:
|
|
2175
|
+
bodyType: te.FormData
|
|
2181
2176
|
});
|
|
2182
2177
|
};
|
|
2183
|
-
|
|
2178
|
+
u(() => {
|
|
2184
2179
|
n && n();
|
|
2185
|
-
}, []),
|
|
2186
|
-
let t =
|
|
2187
|
-
if (!n ||
|
|
2188
|
-
|
|
2189
|
-
let r =
|
|
2190
|
-
if (r && (
|
|
2180
|
+
}, []), u(() => {
|
|
2181
|
+
let t = w?.results, n = t?.form?.modify?.view;
|
|
2182
|
+
if (!n || S.current === t) return;
|
|
2183
|
+
S.current = t;
|
|
2184
|
+
let r = b.current?.session === m ? b.current.snapshot : void 0, a = We(n), c = !!n.submitted && w?.status === 200 && !Object.keys(a).length, u = "refresh";
|
|
2185
|
+
if (r && (u = c ? "saved" : "invalid"), v({
|
|
2191
2186
|
data: t,
|
|
2192
|
-
session:
|
|
2193
|
-
mode:
|
|
2187
|
+
session: m,
|
|
2188
|
+
mode: u,
|
|
2194
2189
|
submission: r
|
|
2195
|
-
}),
|
|
2196
|
-
|
|
2197
|
-
let
|
|
2190
|
+
}), re?.(n.full_name || "form"), !r || (b.current = null, !c)) return;
|
|
2191
|
+
C.current?.success();
|
|
2192
|
+
let d = () => {
|
|
2198
2193
|
t.redirect && !i && o(s(t.redirect.route, {
|
|
2199
|
-
...
|
|
2194
|
+
...l.parameters || {},
|
|
2200
2195
|
...t.redirect.parameters
|
|
2201
2196
|
}), !0);
|
|
2202
2197
|
}, f = e?.(t);
|
|
2203
|
-
f instanceof Promise ? f.then(
|
|
2204
|
-
}, [
|
|
2205
|
-
let
|
|
2206
|
-
if (!
|
|
2207
|
-
let
|
|
2208
|
-
return /* @__PURE__ */ T(
|
|
2209
|
-
loader:
|
|
2210
|
-
children: /* @__PURE__ */ E(
|
|
2211
|
-
ref:
|
|
2212
|
-
id:
|
|
2213
|
-
name:
|
|
2198
|
+
f instanceof Promise ? f.then(d, () => {}) : d();
|
|
2199
|
+
}, [w?.results, m]);
|
|
2200
|
+
let D = y?.form?.modify?.view;
|
|
2201
|
+
if (!D) return;
|
|
2202
|
+
let ae = [(D.name || "form") + "Field", ...D.block_prefixes || []];
|
|
2203
|
+
return /* @__PURE__ */ T(bt, {
|
|
2204
|
+
loader: D.full_name,
|
|
2205
|
+
children: /* @__PURE__ */ E(mt, {
|
|
2206
|
+
ref: C,
|
|
2207
|
+
id: D.id || "form",
|
|
2208
|
+
name: D.name || "form",
|
|
2214
2209
|
action: p,
|
|
2215
2210
|
method: "POST",
|
|
2216
2211
|
onStateChange: r,
|
|
2217
|
-
onSubmit:
|
|
2218
|
-
children: [/* @__PURE__ */ T(
|
|
2219
|
-
session:
|
|
2220
|
-
pending:
|
|
2221
|
-
loader:
|
|
2212
|
+
onSubmit: ie,
|
|
2213
|
+
children: [/* @__PURE__ */ T(Vn, {
|
|
2214
|
+
session: m,
|
|
2215
|
+
pending: b,
|
|
2216
|
+
loader: D.full_name || "form",
|
|
2222
2217
|
onError: t
|
|
2223
|
-
}), /* @__PURE__ */ T(
|
|
2224
|
-
view:
|
|
2225
|
-
syncMode:
|
|
2226
|
-
submission:
|
|
2227
|
-
children: /* @__PURE__ */ T(
|
|
2218
|
+
}), /* @__PURE__ */ T(q, {
|
|
2219
|
+
view: D,
|
|
2220
|
+
syncMode: h?.mode,
|
|
2221
|
+
submission: h?.submission,
|
|
2222
|
+
children: /* @__PURE__ */ T(G, {
|
|
2228
2223
|
name: "content",
|
|
2229
|
-
children: /* @__PURE__ */ E(
|
|
2230
|
-
view:
|
|
2224
|
+
children: /* @__PURE__ */ E(U, {
|
|
2225
|
+
view: ae,
|
|
2231
2226
|
prefix: "modify/form",
|
|
2232
|
-
data:
|
|
2227
|
+
data: D,
|
|
2233
2228
|
children: [
|
|
2234
|
-
/* @__PURE__ */ T(
|
|
2229
|
+
/* @__PURE__ */ T(G, {
|
|
2235
2230
|
name: "messages",
|
|
2236
|
-
children: Object.keys(
|
|
2231
|
+
children: Object.keys(y?.messages || {}).map((e) => /* @__PURE__ */ T("div", {
|
|
2237
2232
|
className: ["alert", "alert-" + e].join(" "),
|
|
2238
|
-
children: (
|
|
2233
|
+
children: (y?.messages[e] || ["Item was saved successful."]).join(" ")
|
|
2239
2234
|
}, "alert-" + e))
|
|
2240
2235
|
}),
|
|
2241
|
-
/* @__PURE__ */ T(
|
|
2242
|
-
/* @__PURE__ */ T(
|
|
2243
|
-
/* @__PURE__ */ T(
|
|
2236
|
+
/* @__PURE__ */ T(jn, { className: "alert alert-danger" }),
|
|
2237
|
+
/* @__PURE__ */ T(An, {}),
|
|
2238
|
+
/* @__PURE__ */ T(G, {
|
|
2244
2239
|
name: "actions",
|
|
2245
|
-
children: /* @__PURE__ */ T(
|
|
2240
|
+
children: /* @__PURE__ */ T(St, {
|
|
2246
2241
|
type: "submit",
|
|
2247
2242
|
className: "btn btn-primary",
|
|
2248
|
-
children: /* @__PURE__ */ T(
|
|
2243
|
+
children: /* @__PURE__ */ T(H, { children: "Save" })
|
|
2249
2244
|
})
|
|
2250
2245
|
})
|
|
2251
2246
|
]
|
|
2252
|
-
},
|
|
2247
|
+
}, D.id || "form")
|
|
2253
2248
|
})
|
|
2254
2249
|
})]
|
|
2255
|
-
},
|
|
2250
|
+
}, m)
|
|
2256
2251
|
});
|
|
2257
|
-
}), { name: "form" }),
|
|
2258
|
-
|
|
2252
|
+
}), { name: "form" }), Kn = r(!1), qn = () => l(Kn), Jn = ({ children: e }) => /* @__PURE__ */ T(Kn.Provider, {
|
|
2253
|
+
value: !0,
|
|
2254
|
+
children: e
|
|
2255
|
+
}), Yn = Ln(o(({ children: e, ...t }, n) => {
|
|
2256
|
+
let { closeModal: r, modal: i } = ma(), { open: a = !0, animation: o = "fade", backdrop: s = !0, keyboard: c = !0, size: l, onClose: d, className: p } = {
|
|
2259
2257
|
...t,
|
|
2260
2258
|
...i?.props || {}
|
|
2261
|
-
},
|
|
2262
|
-
|
|
2259
|
+
}, m = g(null), h = g(null), [v, y] = _(a), [b, ee] = _(!1), te = !1;
|
|
2260
|
+
f(n, () => ({
|
|
2263
2261
|
toggle: () => y(!v),
|
|
2264
2262
|
open: () => y(!0),
|
|
2265
|
-
close: () =>
|
|
2263
|
+
close: () => C(),
|
|
2266
2264
|
isOpen: () => v
|
|
2267
|
-
})),
|
|
2265
|
+
})), u(() => {
|
|
2268
2266
|
y(a);
|
|
2269
2267
|
}, [a]);
|
|
2270
|
-
let
|
|
2271
|
-
|
|
2272
|
-
case "Escape":
|
|
2273
|
-
D();
|
|
2274
|
-
break;
|
|
2275
|
-
}
|
|
2268
|
+
let x = (e) => {
|
|
2269
|
+
c && e.key === "Escape" && C();
|
|
2276
2270
|
};
|
|
2277
|
-
|
|
2271
|
+
u(() => {
|
|
2278
2272
|
if (!v) return;
|
|
2279
|
-
|
|
2280
|
-
let e =
|
|
2273
|
+
ee(!0);
|
|
2274
|
+
let e = m.current;
|
|
2281
2275
|
if (!e) return;
|
|
2282
2276
|
let t = () => {
|
|
2283
2277
|
e.addEventListener("animationend", n);
|
|
@@ -2285,41 +2279,41 @@ var Hn = Nn(a(({ onSuccess: e, onError: t, onLoad: n, onStateChange: r, embedded
|
|
|
2285
2279
|
e.classList.remove(o), e.removeEventListener("animationstart", t), e.removeEventListener("animationend", n);
|
|
2286
2280
|
};
|
|
2287
2281
|
return setTimeout(() => {
|
|
2288
|
-
e.classList.add("d-block", "show"),
|
|
2289
|
-
}, o ? 100 : 0), document.addEventListener("keydown",
|
|
2290
|
-
document.removeEventListener("keydown",
|
|
2282
|
+
e.classList.add("d-block", "show"), h?.current?.classList.add("show"), te = !0;
|
|
2283
|
+
}, o ? 100 : 0), document.addEventListener("keydown", x), e.addEventListener("animationstart", t), () => {
|
|
2284
|
+
document.removeEventListener("keydown", x), e.removeEventListener("animationstart", t), e.removeEventListener("animationend", n);
|
|
2291
2285
|
};
|
|
2292
|
-
}, [v]),
|
|
2293
|
-
|
|
2286
|
+
}, [v]), u(() => () => {
|
|
2287
|
+
te && d && d();
|
|
2294
2288
|
}, []);
|
|
2295
|
-
let
|
|
2289
|
+
let S = () => {
|
|
2296
2290
|
y(!1), r?.();
|
|
2297
|
-
},
|
|
2291
|
+
}, C = () => (ee(!1), new Promise((e, t) => {
|
|
2298
2292
|
if (!v) return e();
|
|
2299
2293
|
let n = () => {
|
|
2300
|
-
|
|
2294
|
+
m?.current?.classList.remove("show", "d-block"), e(), S();
|
|
2301
2295
|
};
|
|
2302
|
-
if (
|
|
2296
|
+
if (m.current?.classList.add("close"), o) {
|
|
2303
2297
|
let e = setTimeout(() => {
|
|
2304
2298
|
n();
|
|
2305
2299
|
}, o ? 50 : 0);
|
|
2306
|
-
|
|
2307
|
-
clearTimeout(e),
|
|
2308
|
-
}),
|
|
2300
|
+
m.current?.addEventListener("animationstart", () => {
|
|
2301
|
+
clearTimeout(e), m.current?.removeEventListener("animationend", n), m.current?.addEventListener("animationend", n);
|
|
2302
|
+
}), m.current?.classList.add(o);
|
|
2309
2303
|
} else n();
|
|
2310
2304
|
}));
|
|
2311
|
-
if (v) return
|
|
2312
|
-
ref:
|
|
2305
|
+
if (v) return ne(/* @__PURE__ */ E(w, { children: [s && /* @__PURE__ */ T("div", {
|
|
2306
|
+
ref: h,
|
|
2313
2307
|
className: [
|
|
2314
2308
|
"modal-backdrop",
|
|
2315
2309
|
"fade",
|
|
2316
2310
|
...b ? ["show"] : []
|
|
2317
2311
|
].filter((e) => e).join(" ")
|
|
2318
2312
|
}), /* @__PURE__ */ T("div", {
|
|
2319
|
-
ref:
|
|
2313
|
+
ref: m,
|
|
2320
2314
|
className: [
|
|
2321
2315
|
"modal",
|
|
2322
|
-
|
|
2316
|
+
l && "modal-" + l,
|
|
2323
2317
|
o && o,
|
|
2324
2318
|
p
|
|
2325
2319
|
].filter((e) => e).join(" "),
|
|
@@ -2329,7 +2323,7 @@ var Hn = Nn(a(({ onSuccess: e, onError: t, onLoad: n, onStateChange: r, embedded
|
|
|
2329
2323
|
children: /* @__PURE__ */ E("div", {
|
|
2330
2324
|
className: "modal-content",
|
|
2331
2325
|
children: [
|
|
2332
|
-
/* @__PURE__ */ T(
|
|
2326
|
+
/* @__PURE__ */ T(G, {
|
|
2333
2327
|
name: "header",
|
|
2334
2328
|
children: /* @__PURE__ */ E("div", {
|
|
2335
2329
|
className: "modal-header",
|
|
@@ -2337,17 +2331,17 @@ var Hn = Nn(a(({ onSuccess: e, onError: t, onLoad: n, onStateChange: r, embedded
|
|
|
2337
2331
|
/* @__PURE__ */ T("h5", {
|
|
2338
2332
|
className: "modal-title",
|
|
2339
2333
|
id: "exampleModalLabel",
|
|
2340
|
-
children: /* @__PURE__ */ T(
|
|
2334
|
+
children: /* @__PURE__ */ T(G, {
|
|
2341
2335
|
name: "title",
|
|
2342
2336
|
children: "Title"
|
|
2343
2337
|
})
|
|
2344
2338
|
}),
|
|
2345
|
-
/* @__PURE__ */ T(
|
|
2339
|
+
/* @__PURE__ */ T(G, {
|
|
2346
2340
|
name: "navigation",
|
|
2347
2341
|
children: /* @__PURE__ */ T("nav", { children: e })
|
|
2348
2342
|
}),
|
|
2349
2343
|
/* @__PURE__ */ T("button", {
|
|
2350
|
-
onClick:
|
|
2344
|
+
onClick: C,
|
|
2351
2345
|
type: "button",
|
|
2352
2346
|
className: "btn-close",
|
|
2353
2347
|
"aria-label": "Close"
|
|
@@ -2357,19 +2351,19 @@ var Hn = Nn(a(({ onSuccess: e, onError: t, onLoad: n, onStateChange: r, embedded
|
|
|
2357
2351
|
}),
|
|
2358
2352
|
/* @__PURE__ */ T("div", {
|
|
2359
2353
|
className: "modal-body",
|
|
2360
|
-
children: /* @__PURE__ */ T(
|
|
2354
|
+
children: /* @__PURE__ */ T(G, {
|
|
2361
2355
|
name: "content",
|
|
2362
2356
|
children: e
|
|
2363
2357
|
})
|
|
2364
2358
|
}),
|
|
2365
|
-
/* @__PURE__ */ T(
|
|
2359
|
+
/* @__PURE__ */ T(G, {
|
|
2366
2360
|
name: "footer",
|
|
2367
2361
|
children: /* @__PURE__ */ T("div", {
|
|
2368
2362
|
className: "modal-footer",
|
|
2369
|
-
children: /* @__PURE__ */ T(
|
|
2363
|
+
children: /* @__PURE__ */ T(G, {
|
|
2370
2364
|
name: "actions",
|
|
2371
2365
|
children: /* @__PURE__ */ T("button", {
|
|
2372
|
-
onClick:
|
|
2366
|
+
onClick: C,
|
|
2373
2367
|
type: "button",
|
|
2374
2368
|
className: "btn btn-secondary",
|
|
2375
2369
|
children: "Close"
|
|
@@ -2381,11 +2375,14 @@ var Hn = Nn(a(({ onSuccess: e, onError: t, onLoad: n, onStateChange: r, embedded
|
|
|
2381
2375
|
})
|
|
2382
2376
|
})
|
|
2383
2377
|
})] }), document.body);
|
|
2384
|
-
}), { name: "modal" }),
|
|
2385
|
-
|
|
2386
|
-
|
|
2378
|
+
}), { name: "modal" }), Xn = o((e, t) => /* @__PURE__ */ T(Jn, { children: /* @__PURE__ */ T(Yn, {
|
|
2379
|
+
...e,
|
|
2380
|
+
ref: t
|
|
2381
|
+
}) })), Zn = ({ animationData: e, path: t, options: n, width: r, height: i, className: a, ...o }) => {
|
|
2382
|
+
let s = g(null);
|
|
2383
|
+
return u(() => {
|
|
2387
2384
|
if (!s.current) return;
|
|
2388
|
-
let r = n?.autoplay === void 0
|
|
2385
|
+
let r = n?.autoplay === void 0 || n?.autoplay, i = re.loadAnimation({
|
|
2389
2386
|
renderer: "svg",
|
|
2390
2387
|
loop: !1,
|
|
2391
2388
|
rendererSettings: { preserveAspectRatio: "xMidYMid meet" },
|
|
@@ -2410,27 +2407,27 @@ var Hn = Nn(a(({ onSuccess: e, onError: t, onLoad: n, onStateChange: r, embedded
|
|
|
2410
2407
|
height: i
|
|
2411
2408
|
}
|
|
2412
2409
|
});
|
|
2413
|
-
},
|
|
2410
|
+
}, Qn = t.createContext(void 0), $n = /* @__PURE__ */ function(e) {
|
|
2414
2411
|
return 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;
|
|
2415
2412
|
}({});
|
|
2416
|
-
function
|
|
2417
|
-
let e = t.useContext(
|
|
2413
|
+
function er() {
|
|
2414
|
+
let e = t.useContext(Qn);
|
|
2418
2415
|
if (e === void 0) throw Error("UseAlert must be within AlertProvider");
|
|
2419
2416
|
return e;
|
|
2420
2417
|
}
|
|
2421
|
-
function
|
|
2422
|
-
let [t, n] =
|
|
2423
|
-
|
|
2418
|
+
function tr({ children: e }) {
|
|
2419
|
+
let [t, n] = _(), r = g(0), i = g(void 0), a = g(void 0), [o, s] = _(null);
|
|
2420
|
+
u(() => {
|
|
2424
2421
|
r.current += 1;
|
|
2425
|
-
}, [t]),
|
|
2422
|
+
}, [t]), u(() => () => {
|
|
2426
2423
|
clearTimeout(a.current);
|
|
2427
2424
|
}, []);
|
|
2428
|
-
let
|
|
2429
|
-
"/src/assets/images/alert/denied.json": () => import("./denied-
|
|
2430
|
-
"/src/assets/images/alert/info.json": () => import("./info-
|
|
2431
|
-
"/src/assets/images/alert/success.json": () => import("./success-
|
|
2432
|
-
"/src/assets/images/alert/warning.json": () => import("./warning-
|
|
2433
|
-
}),
|
|
2425
|
+
let c = /* #__PURE__ */ Object.assign({
|
|
2426
|
+
"/src/assets/images/alert/denied.json": () => import("./denied-Cg2igDWh.js"),
|
|
2427
|
+
"/src/assets/images/alert/info.json": () => import("./info-Dfyx45FU.js"),
|
|
2428
|
+
"/src/assets/images/alert/success.json": () => import("./success-B5xn1-UX.js"),
|
|
2429
|
+
"/src/assets/images/alert/warning.json": () => import("./warning-BaaC-X6i.js")
|
|
2430
|
+
}), l = () => {
|
|
2434
2431
|
clearTimeout(a.current), s(null), n(void 0);
|
|
2435
2432
|
}, d = (e) => {
|
|
2436
2433
|
clearTimeout(a.current);
|
|
@@ -2450,8 +2447,8 @@ function Jn({ children: e }) {
|
|
|
2450
2447
|
4: "info.json"
|
|
2451
2448
|
};
|
|
2452
2449
|
if (Object.hasOwn(r, t.icon)) {
|
|
2453
|
-
let e = r[t.icon], n = Object.keys(
|
|
2454
|
-
n &&
|
|
2450
|
+
let e = r[t.icon], n = Object.keys(c).filter((t) => t.endsWith(e)).pop();
|
|
2451
|
+
n && c[n]?.().then((e) => {
|
|
2455
2452
|
s(e.default);
|
|
2456
2453
|
});
|
|
2457
2454
|
}
|
|
@@ -2462,7 +2459,7 @@ function Jn({ children: e }) {
|
|
|
2462
2459
|
},
|
|
2463
2460
|
confirm: { label: "Confirm" }
|
|
2464
2461
|
}), t.timeout !== 0 && (t.timeoutProgress || (t.timeout ?? 0) > 0) && (a.current = setTimeout(() => {
|
|
2465
|
-
i.current?.close().finally(
|
|
2462
|
+
i.current?.close().finally(l);
|
|
2466
2463
|
}, t.timeout || 5e3)), i.current?.isOpen() ? i.current?.close().finally(() => {
|
|
2467
2464
|
n(t);
|
|
2468
2465
|
}) : n(t);
|
|
@@ -2473,25 +2470,25 @@ function Jn({ children: e }) {
|
|
|
2473
2470
|
isCancelled: e === "cancel",
|
|
2474
2471
|
isDenied: e === "deny"
|
|
2475
2472
|
};
|
|
2476
|
-
t?.onResult?.(n), i.current?.close().then(
|
|
2473
|
+
t?.onResult?.(n), i.current?.close().then(l);
|
|
2477
2474
|
};
|
|
2478
|
-
return /* @__PURE__ */ E(
|
|
2475
|
+
return /* @__PURE__ */ E(Qn.Provider, {
|
|
2479
2476
|
value: { open: d },
|
|
2480
|
-
children: [t && /* @__PURE__ */ E(
|
|
2477
|
+
children: [t && /* @__PURE__ */ E(Xn, {
|
|
2481
2478
|
size: t.size,
|
|
2482
2479
|
className: "modal-alert",
|
|
2483
2480
|
animation: t.animation,
|
|
2484
2481
|
open: !0,
|
|
2485
2482
|
ref: i,
|
|
2486
2483
|
children: [
|
|
2487
|
-
/* @__PURE__ */ T(
|
|
2488
|
-
/* @__PURE__ */ T(
|
|
2489
|
-
/* @__PURE__ */ T(
|
|
2484
|
+
/* @__PURE__ */ T(K, { name: "header" }),
|
|
2485
|
+
/* @__PURE__ */ T(K, { name: "footer" }),
|
|
2486
|
+
/* @__PURE__ */ T(K, {
|
|
2490
2487
|
name: "content",
|
|
2491
2488
|
children: /* @__PURE__ */ E("div", {
|
|
2492
2489
|
className: "d-flex flex-column align-items-center",
|
|
2493
2490
|
children: [
|
|
2494
|
-
o !== null && /* @__PURE__ */ T(
|
|
2491
|
+
o !== null && /* @__PURE__ */ T(Zn, {
|
|
2495
2492
|
className: "modal-alert-icon",
|
|
2496
2493
|
animationData: o
|
|
2497
2494
|
}),
|
|
@@ -2505,7 +2502,7 @@ function Jn({ children: e }) {
|
|
|
2505
2502
|
}),
|
|
2506
2503
|
t.actions && /* @__PURE__ */ T("div", {
|
|
2507
2504
|
className: "d-flex justify-content-center align-items-center",
|
|
2508
|
-
children: Object.keys(t.actions).map((e) => /* @__PURE__ */ T(
|
|
2505
|
+
children: Object.keys(t.actions).map((e) => /* @__PURE__ */ T(St, {
|
|
2509
2506
|
className: "btn btn-lg mx-2 " + (t.actions?.[e].classList ?? ["btn-primary"]).join(" "),
|
|
2510
2507
|
onClick: () => f(e),
|
|
2511
2508
|
children: (t.actions?.[e] ?? null)?.label || e
|
|
@@ -2518,43 +2515,43 @@ function Jn({ children: e }) {
|
|
|
2518
2515
|
}, r.current), e]
|
|
2519
2516
|
});
|
|
2520
2517
|
}
|
|
2521
|
-
function
|
|
2522
|
-
return (t) => /* @__PURE__ */ T(
|
|
2518
|
+
function nr(e) {
|
|
2519
|
+
return (t) => /* @__PURE__ */ T(tr, { children: /* @__PURE__ */ T(e, { ...t }) });
|
|
2523
2520
|
}
|
|
2524
2521
|
//#endregion
|
|
2525
2522
|
//#region src/component/crud/Modify.tsx
|
|
2526
|
-
var
|
|
2527
|
-
let { actionRequest: t } =
|
|
2523
|
+
var rr = Ln(({ children: e }) => {
|
|
2524
|
+
let { actionRequest: t } = z(), { getAction: n, generateLink: r } = k(), i = n(t.action.entity, "list", t.action.namespace);
|
|
2528
2525
|
return /* @__PURE__ */ E("section", {
|
|
2529
2526
|
className: "edit",
|
|
2530
2527
|
children: [/* @__PURE__ */ E("header", { children: [/* @__PURE__ */ E("h2", {
|
|
2531
2528
|
className: "title",
|
|
2532
|
-
children: [i && /* @__PURE__ */ T(
|
|
2529
|
+
children: [i && /* @__PURE__ */ T(W, {
|
|
2533
2530
|
to: r(i.route, t.parameters),
|
|
2534
2531
|
children: "←"
|
|
2535
|
-
}), /* @__PURE__ */ T(
|
|
2536
|
-
}), /* @__PURE__ */ T("nav", { children: /* @__PURE__ */ T(
|
|
2532
|
+
}), /* @__PURE__ */ T(G, { name: "title" })]
|
|
2533
|
+
}), /* @__PURE__ */ T("nav", { children: /* @__PURE__ */ T(G, { name: "navigation" }) })] }), /* @__PURE__ */ E("main", { children: [/* @__PURE__ */ T(G, { name: "content" }), /* @__PURE__ */ T(G, { name: "actions" })] })]
|
|
2537
2534
|
});
|
|
2538
|
-
}, { name: "modify" }),
|
|
2539
|
-
let { open: i } =
|
|
2540
|
-
if (o) return /* @__PURE__ */ E(
|
|
2541
|
-
/* @__PURE__ */ T(
|
|
2535
|
+
}, { name: "modify" }), ir = Vt(({ template: e, children: t, onSuccess: n, modal: r }) => {
|
|
2536
|
+
let { open: i } = er(), { closeModal: a } = ma(), o = B(), s = qn(), c = r ?? s, l = c ? Xn : e || rr;
|
|
2537
|
+
if (o) return /* @__PURE__ */ E(l, { children: [
|
|
2538
|
+
/* @__PURE__ */ T(K, {
|
|
2542
2539
|
name: "title",
|
|
2543
|
-
children: /* @__PURE__ */ T(
|
|
2540
|
+
children: /* @__PURE__ */ T(H, { children: o?.results?.title || "Title" })
|
|
2544
2541
|
}),
|
|
2545
|
-
/* @__PURE__ */ T(
|
|
2542
|
+
/* @__PURE__ */ T(K, {
|
|
2546
2543
|
name: "navigation",
|
|
2547
|
-
children: /* @__PURE__ */ T(
|
|
2544
|
+
children: /* @__PURE__ */ T(U, {
|
|
2548
2545
|
view: "navigation",
|
|
2549
2546
|
prefix: "modify"
|
|
2550
2547
|
})
|
|
2551
2548
|
}),
|
|
2552
|
-
/* @__PURE__ */ T(
|
|
2549
|
+
/* @__PURE__ */ T(K, {
|
|
2553
2550
|
name: "content",
|
|
2554
|
-
children: /* @__PURE__ */ T(
|
|
2551
|
+
children: /* @__PURE__ */ T(U, {
|
|
2555
2552
|
view: "content",
|
|
2556
2553
|
prefix: "modify",
|
|
2557
|
-
children: /* @__PURE__ */ T(
|
|
2554
|
+
children: /* @__PURE__ */ T(Gn, {
|
|
2558
2555
|
onSuccess: (e) => new Promise((t, r) => {
|
|
2559
2556
|
a();
|
|
2560
2557
|
let o = new CustomEvent("success", {
|
|
@@ -2565,7 +2562,7 @@ var Xn = Nn(({ children: e }) => {
|
|
|
2565
2562
|
i({
|
|
2566
2563
|
title: "Success",
|
|
2567
2564
|
text: Object.values(e.messages?.success ?? []).join(" ") ?? "Item was saved successful!",
|
|
2568
|
-
icon:
|
|
2565
|
+
icon: $n.success,
|
|
2569
2566
|
actions: { close: { label: "OK" } },
|
|
2570
2567
|
onResult: () => {
|
|
2571
2568
|
t();
|
|
@@ -2577,107 +2574,111 @@ var Xn = Nn(({ children: e }) => {
|
|
|
2577
2574
|
i({
|
|
2578
2575
|
title: e.status + " " + e.detail,
|
|
2579
2576
|
text: e.detail,
|
|
2580
|
-
icon:
|
|
2577
|
+
icon: $n.denied,
|
|
2581
2578
|
actions: { close: { label: "OK" } }
|
|
2582
2579
|
});
|
|
2583
2580
|
},
|
|
2584
|
-
embedded:
|
|
2585
|
-
children: /* @__PURE__ */ T(
|
|
2581
|
+
embedded: c,
|
|
2582
|
+
children: /* @__PURE__ */ T(K, { name: "actions" })
|
|
2586
2583
|
})
|
|
2587
2584
|
})
|
|
2588
2585
|
}),
|
|
2589
|
-
/* @__PURE__ */ T(
|
|
2586
|
+
/* @__PURE__ */ T(K, {
|
|
2590
2587
|
name: "actions",
|
|
2591
|
-
children: /* @__PURE__ */ T(
|
|
2588
|
+
children: /* @__PURE__ */ T(St, {
|
|
2592
2589
|
type: "submit",
|
|
2593
2590
|
className: "btn btn-primary",
|
|
2594
2591
|
form: o?.results?.form?.modify?.view.full_name || "modify",
|
|
2595
|
-
children: /* @__PURE__ */ T(
|
|
2592
|
+
children: /* @__PURE__ */ T(H, { children: "Submit" })
|
|
2596
2593
|
})
|
|
2597
2594
|
}),
|
|
2598
2595
|
t
|
|
2599
2596
|
] });
|
|
2600
|
-
}),
|
|
2601
|
-
function
|
|
2602
|
-
let e = t.useContext(
|
|
2597
|
+
}), ar = t.createContext(void 0);
|
|
2598
|
+
function or() {
|
|
2599
|
+
let e = t.useContext(ar);
|
|
2603
2600
|
if (e === void 0) throw Error("UseListItem must be within ListItemProvider");
|
|
2604
2601
|
return e;
|
|
2605
2602
|
}
|
|
2606
|
-
function
|
|
2607
|
-
return /* @__PURE__ */ T(
|
|
2603
|
+
function sr({ children: e, ...t }) {
|
|
2604
|
+
return /* @__PURE__ */ T(ar.Provider, {
|
|
2608
2605
|
value: t,
|
|
2609
2606
|
children: e
|
|
2610
2607
|
});
|
|
2611
2608
|
}
|
|
2612
2609
|
//#endregion
|
|
2613
2610
|
//#region src/component/crud/ItemValue.tsx
|
|
2614
|
-
var
|
|
2615
|
-
let { data: n } =
|
|
2611
|
+
var cr = ({ column: e, namespace: t }) => {
|
|
2612
|
+
let { data: n } = or(), { actionRequest: r } = z();
|
|
2616
2613
|
if (!n) return null;
|
|
2617
2614
|
let i = e.useFlatKey ? n[e.field] : e.field.split(".").reduce((e, t) => {
|
|
2618
|
-
if (
|
|
2615
|
+
if (typeof e == "object" && e) return e[t];
|
|
2619
2616
|
}, n);
|
|
2620
|
-
return /* @__PURE__ */ T(
|
|
2617
|
+
return /* @__PURE__ */ T(U, {
|
|
2621
2618
|
namespace: t,
|
|
2622
2619
|
data: n,
|
|
2623
2620
|
prefix: r.action.name || "list",
|
|
2624
2621
|
view: e.field,
|
|
2625
|
-
children: Array.isArray(i) ? i.join(", ") : /* @__PURE__ */ T(
|
|
2622
|
+
children: Array.isArray(i) ? i.join(", ") : /* @__PURE__ */ T(H, { children: i == null ? void 0 : String(i) })
|
|
2626
2623
|
});
|
|
2627
|
-
},
|
|
2624
|
+
}, lr = /* @__PURE__ */ function(e) {
|
|
2628
2625
|
return e.List = "list", e.Object = "object", e.Internal = "internal", e;
|
|
2629
|
-
}({}),
|
|
2626
|
+
}({}), ur = (e, ...t) => (t.forEach((t) => {
|
|
2630
2627
|
Object.keys(e).filter((e) => t.hasOwnProperty(e)).forEach((t) => {
|
|
2631
2628
|
delete e[t];
|
|
2632
2629
|
});
|
|
2633
|
-
}), e),
|
|
2630
|
+
}), e), dr = (e, ...t) => (t.forEach((t) => {
|
|
2634
2631
|
Object.keys(e).filter((e) => !t.hasOwnProperty(e)).forEach((t) => {
|
|
2635
2632
|
delete e[t];
|
|
2636
2633
|
});
|
|
2637
|
-
}), e),
|
|
2634
|
+
}), e), fr = (e, t = !0) => (Object.entries(e).map(([e, n]) => (t && n instanceof Object && (n = fr(n)), [e, n])).filter(([, e]) => e instanceof Object ? !Object.keys(e).length : [
|
|
2638
2635
|
"",
|
|
2639
2636
|
null,
|
|
2640
2637
|
void 0
|
|
2641
2638
|
].includes(e)).forEach(([t]) => {
|
|
2642
2639
|
delete e[t];
|
|
2643
|
-
}), e),
|
|
2644
|
-
function
|
|
2645
|
-
let n = t.useContext(
|
|
2640
|
+
}), e), pr = t.createContext(void 0);
|
|
2641
|
+
function Y(e = !0) {
|
|
2642
|
+
let n = t.useContext(pr);
|
|
2646
2643
|
if (n === void 0) {
|
|
2647
2644
|
if (e) throw Error("UseList must be within ListProvider");
|
|
2648
2645
|
return {};
|
|
2649
2646
|
}
|
|
2650
|
-
let r =
|
|
2647
|
+
let r = B();
|
|
2651
2648
|
if (!r) throw Error("No Data provided. Use DataProvider.");
|
|
2652
|
-
let { results: i, refresh: a } = r, { actionRequest: o, setActionRequest: s } =
|
|
2649
|
+
let { results: i, refresh: a } = r, { actionRequest: o, setActionRequest: s } = z(), { generateActionLink: c, navigate: l } = k(), { openModal: u } = ma(), { open: d } = er(), { embedded: f, onClick: p } = n, m = i?.entity?.primaryColumn, h = (i?.entity?.columns || []).filter((e) => e.visible).filter((e) => e.group !== !1), g = Object.values(i?.action || []), _ = (e) => Object.values(i?.action ?? []).filter((t) => t.visibility === e && t.name !== o.action.name), v = (e) => Object.values(i?.action ?? []).filter((t) => t.name === e).shift(), y = (e) => _(e).map((e) => ({
|
|
2653
2650
|
...o,
|
|
2654
2651
|
action: e
|
|
2655
|
-
})),
|
|
2652
|
+
})), b = (e) => {
|
|
2656
2653
|
let t = v(e);
|
|
2657
2654
|
if (t) return {
|
|
2658
2655
|
...o,
|
|
2659
2656
|
action: t
|
|
2660
2657
|
};
|
|
2661
|
-
},
|
|
2658
|
+
}, x = g.filter((e) => e.visibility === lr.Object), S = h.length + +!!g.length, C = i?.entity?.data.items ?? [], w = ({ newAction: e, excludeFilterParameters: t, clear: n }) => {
|
|
2662
2659
|
let r = { ...e || o };
|
|
2663
|
-
t?.forEach((e) => {
|
|
2660
|
+
if (t?.forEach((e) => {
|
|
2664
2661
|
delete r.query?.filter?.[e];
|
|
2665
|
-
}), n && delete r.query?.filter, f
|
|
2666
|
-
|
|
2662
|
+
}), n && delete r.query?.filter, f) s(r);
|
|
2663
|
+
else {
|
|
2664
|
+
let e = c(r);
|
|
2665
|
+
l(e);
|
|
2666
|
+
}
|
|
2667
|
+
}, T = (e, t) => {
|
|
2667
2668
|
if (!p?.(e, t)) {
|
|
2668
2669
|
switch (t?.preventDefault(), e.parameters = {
|
|
2669
2670
|
...e.parameters || {},
|
|
2670
2671
|
...o.parameters || {}
|
|
2671
|
-
}, e.parameters =
|
|
2672
|
-
case "list": return
|
|
2672
|
+
}, e.parameters = fr(e.parameters), Object.keys(e.parameters).length || (e.parameters = void 0), e.query !== void 0 && (Object.keys(e.query).length || (e.query = void 0)), e.action.name) {
|
|
2673
|
+
case "list": return w({ newAction: e });
|
|
2673
2674
|
case "delete":
|
|
2674
2675
|
d({
|
|
2675
2676
|
title: "Are you sure?",
|
|
2676
|
-
icon:
|
|
2677
|
+
icon: $n.confirm,
|
|
2677
2678
|
onResult: (t) => {
|
|
2678
|
-
t.isConfirmed &&
|
|
2679
|
+
t.isConfirmed && xa().fetch({
|
|
2679
2680
|
url: c(e),
|
|
2680
|
-
method:
|
|
2681
|
+
method: ee.DELETE
|
|
2681
2682
|
}).catch((e) => {
|
|
2682
2683
|
console.log("error", e);
|
|
2683
2684
|
}).finally(() => {
|
|
@@ -2687,29 +2688,25 @@ function X(e = !0) {
|
|
|
2687
2688
|
});
|
|
2688
2689
|
return;
|
|
2689
2690
|
}
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
a?.();
|
|
2697
|
-
}
|
|
2691
|
+
f ? u({
|
|
2692
|
+
action: e,
|
|
2693
|
+
props: {
|
|
2694
|
+
size: "lg",
|
|
2695
|
+
onClose: () => {
|
|
2696
|
+
a?.();
|
|
2698
2697
|
}
|
|
2699
|
-
}
|
|
2700
|
-
|
|
2701
|
-
}
|
|
2702
|
-
E({ newAction: e });
|
|
2698
|
+
}
|
|
2699
|
+
}) : w({ newAction: e });
|
|
2703
2700
|
}
|
|
2704
|
-
},
|
|
2701
|
+
}, E = (e, t, n) => new Promise((e, t) => {
|
|
2705
2702
|
d({
|
|
2706
2703
|
title: "Are you sure?",
|
|
2707
|
-
icon:
|
|
2704
|
+
icon: $n.confirm,
|
|
2708
2705
|
onResult: (r) => {
|
|
2709
|
-
r.isConfirmed ?
|
|
2706
|
+
r.isConfirmed ? xa().post({
|
|
2710
2707
|
url: c(o),
|
|
2711
2708
|
body: n,
|
|
2712
|
-
bodyType:
|
|
2709
|
+
bodyType: te.FormData
|
|
2713
2710
|
}).catch(() => {
|
|
2714
2711
|
t();
|
|
2715
2712
|
}).finally(() => {
|
|
@@ -2717,10 +2714,10 @@ function X(e = !0) {
|
|
|
2717
2714
|
}) : t();
|
|
2718
2715
|
}
|
|
2719
2716
|
});
|
|
2720
|
-
}),
|
|
2717
|
+
}), ne = (e) => {
|
|
2721
2718
|
if (e.choices !== void 0) {
|
|
2722
2719
|
let t = e.choices?.reduce((e, t) => [...e, ..."choices" in t ? Object.values(t.choices) : [t]], []).reduce((e, t) => {
|
|
2723
|
-
let n =
|
|
2720
|
+
let n = j(t), r = t.label instanceof Function ? t.label(t) : t.label;
|
|
2724
2721
|
return {
|
|
2725
2722
|
...e,
|
|
2726
2723
|
[n]: r
|
|
@@ -2729,33 +2726,33 @@ function X(e = !0) {
|
|
|
2729
2726
|
return Object.values(e.data instanceof Object ? e.data : [e.data]).map((e) => t[e] ?? e).join(", ") || null;
|
|
2730
2727
|
}
|
|
2731
2728
|
let t = Object.values(e.children || {});
|
|
2732
|
-
return t.length > 0 ? t.map(
|
|
2729
|
+
return t.length > 0 ? t.map(ne).filter((e) => e !== null).join(", ") || null : e.data == null || e.data === "" ? null : e.checked === void 0 ? typeof e.data == "string" || typeof e.data == "number" ? e.data : null : e.checked ? "Yes" : "No";
|
|
2733
2730
|
};
|
|
2734
2731
|
return {
|
|
2735
2732
|
data: i,
|
|
2736
2733
|
columns: h,
|
|
2737
2734
|
actions: g,
|
|
2738
|
-
objectActions:
|
|
2739
|
-
columnsTotal:
|
|
2735
|
+
objectActions: x,
|
|
2736
|
+
columnsTotal: S,
|
|
2740
2737
|
primaryColumn: m,
|
|
2741
|
-
items:
|
|
2742
|
-
onClick:
|
|
2743
|
-
handleAction:
|
|
2744
|
-
filterData:
|
|
2738
|
+
items: C,
|
|
2739
|
+
onClick: T,
|
|
2740
|
+
handleAction: T,
|
|
2741
|
+
filterData: w,
|
|
2745
2742
|
getActions: _,
|
|
2746
2743
|
getAction: v,
|
|
2747
|
-
getActionRequests:
|
|
2748
|
-
getActionRequest:
|
|
2749
|
-
handleBatchAction:
|
|
2744
|
+
getActionRequests: y,
|
|
2745
|
+
getActionRequest: b,
|
|
2746
|
+
handleBatchAction: E,
|
|
2750
2747
|
appliedFilters: Object.values(i?.form?.filter?.view?.children || []).map((e) => ({
|
|
2751
2748
|
label: e.label,
|
|
2752
|
-
value:
|
|
2749
|
+
value: ne(e),
|
|
2753
2750
|
formView: e
|
|
2754
2751
|
})).filter((e) => e.value !== null)
|
|
2755
2752
|
};
|
|
2756
2753
|
}
|
|
2757
|
-
function
|
|
2758
|
-
return /* @__PURE__ */ T(
|
|
2754
|
+
function mr({ embedded: e, onClick: t, children: n }) {
|
|
2755
|
+
return /* @__PURE__ */ T(pr.Provider, {
|
|
2759
2756
|
value: {
|
|
2760
2757
|
embedded: e,
|
|
2761
2758
|
onClick: t
|
|
@@ -2765,18 +2762,18 @@ function sr({ embedded: e, onClick: t, children: n }) {
|
|
|
2765
2762
|
}
|
|
2766
2763
|
//#endregion
|
|
2767
2764
|
//#region src/component/crud/batch/BatchActionsContext.tsx
|
|
2768
|
-
var
|
|
2769
|
-
function
|
|
2770
|
-
return t.useContext(
|
|
2765
|
+
var hr = t.createContext(void 0);
|
|
2766
|
+
function gr() {
|
|
2767
|
+
return t.useContext(hr);
|
|
2771
2768
|
}
|
|
2772
|
-
function
|
|
2773
|
-
let { data: n, items: r, primaryColumn: i } =
|
|
2769
|
+
function _r({ onClick: e, ...t }) {
|
|
2770
|
+
let { data: n, items: r, primaryColumn: i } = Y(), a = g([]), o = r?.map((e) => e[i?.field || ""] || 0) || [], s = !!o.length && o.reduce((e, t) => e && a.current.includes(t), !0), c = n?.form?.batch?.view?.children?.method?.choices?.reduce((e, t) => {
|
|
2774
2771
|
let n = t.label instanceof Function ? t.label(t) : t.label, r = t.value instanceof Function ? t.value() : t.value?.toString();
|
|
2775
2772
|
return {
|
|
2776
2773
|
...e,
|
|
2777
2774
|
[r]: n
|
|
2778
2775
|
};
|
|
2779
|
-
}, {}), l = !!Object.keys(c || {}).length && i, [, u] =
|
|
2776
|
+
}, {}), l = !!Object.keys(c || {}).length && i, [, u] = _(), d = (e, t = !1) => {
|
|
2780
2777
|
let n = o[e];
|
|
2781
2778
|
t ? a.current.push(n) : a.current = a.current.filter((e) => e !== n), u({});
|
|
2782
2779
|
}, f = (e = !1) => {
|
|
@@ -2784,7 +2781,7 @@ function ur({ onClick: e, ...t }) {
|
|
|
2784
2781
|
}, p = () => {
|
|
2785
2782
|
a.current = [], u({});
|
|
2786
2783
|
};
|
|
2787
|
-
return /* @__PURE__ */ T(
|
|
2784
|
+
return /* @__PURE__ */ T(hr.Provider, {
|
|
2788
2785
|
value: {
|
|
2789
2786
|
actions: c,
|
|
2790
2787
|
toggle: d,
|
|
@@ -2813,8 +2810,8 @@ function ur({ onClick: e, ...t }) {
|
|
|
2813
2810
|
}
|
|
2814
2811
|
//#endregion
|
|
2815
2812
|
//#region src/component/crud/batch/BatchItemSelector.tsx
|
|
2816
|
-
var
|
|
2817
|
-
let { index: t } =
|
|
2813
|
+
var vr = ({ className: e }) => {
|
|
2814
|
+
let { index: t } = or(), n = gr();
|
|
2818
2815
|
if (!n) return /* @__PURE__ */ T(w, {});
|
|
2819
2816
|
let { actions: r, toggle: i, isSelected: a } = n;
|
|
2820
2817
|
return Object.keys(r || {}).length > 0 && /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T("input", {
|
|
@@ -2824,58 +2821,58 @@ var dr = ({ className: e }) => {
|
|
|
2824
2821
|
name: "batch",
|
|
2825
2822
|
onChange: (e) => i(t, e.target.checked)
|
|
2826
2823
|
}) });
|
|
2827
|
-
},
|
|
2824
|
+
}, yr = ({ column: e, namespace: t }) => /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T(U, {
|
|
2828
2825
|
namespace: t,
|
|
2829
2826
|
data: e,
|
|
2830
2827
|
prefix: "list",
|
|
2831
2828
|
view: e.field + ".label",
|
|
2832
|
-
children: /* @__PURE__ */ T(
|
|
2833
|
-
}) }),
|
|
2834
|
-
let { generateActionLink: a } =
|
|
2835
|
-
return /* @__PURE__ */ T(
|
|
2829
|
+
children: /* @__PURE__ */ T(H, { children: e.label })
|
|
2830
|
+
}) }), br = ({ children: e, action: t, className: n, onClick: r, ...i }) => {
|
|
2831
|
+
let { generateActionLink: a } = k(), { onClick: o } = Y(!1);
|
|
2832
|
+
return /* @__PURE__ */ T(W, {
|
|
2836
2833
|
onClick: (e) => {
|
|
2837
2834
|
r && (r(e), e?.defaultPrevented) || o && o(t, e);
|
|
2838
2835
|
},
|
|
2839
2836
|
className: n,
|
|
2840
2837
|
to: a(t),
|
|
2841
2838
|
...i,
|
|
2842
|
-
children: e ?? /* @__PURE__ */ T(
|
|
2839
|
+
children: e ?? /* @__PURE__ */ T(H, { children: t.action.title ?? t.action.name })
|
|
2843
2840
|
});
|
|
2844
|
-
},
|
|
2845
|
-
let { results: e } =
|
|
2846
|
-
return { isListItemGranted:
|
|
2847
|
-
},
|
|
2848
|
-
let { isListItemGranted: r } =
|
|
2849
|
-
if (
|
|
2841
|
+
}, xr = () => {
|
|
2842
|
+
let { results: e } = B() || {};
|
|
2843
|
+
return { isListItemGranted: c(({ permission: t, id: n }) => t === null || typeof t == "string" && Object.values(e?.entity.acl[t] || []).map((e) => e.toString()).includes(n?.toString() || ""), [e]) };
|
|
2844
|
+
}, Sr = ({ permission: e, children: t, id: n }) => {
|
|
2845
|
+
let { isListItemGranted: r } = xr(), { id: i } = n ? { id: n } : or();
|
|
2846
|
+
if (e === null || r({
|
|
2850
2847
|
permission: e,
|
|
2851
2848
|
id: i
|
|
2852
|
-
}))
|
|
2853
|
-
},
|
|
2854
|
-
let { id: i } =
|
|
2849
|
+
})) return /* @__PURE__ */ T(w, { children: t });
|
|
2850
|
+
}, Cr = ({ action: e, icon: t, className: n, ...r }) => {
|
|
2851
|
+
let { id: i } = or(), { actionRequest: a } = z(), o = {
|
|
2855
2852
|
...e.parameters,
|
|
2856
2853
|
...a?.parameters || {},
|
|
2857
2854
|
id: i
|
|
2858
2855
|
};
|
|
2859
|
-
return /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T(
|
|
2856
|
+
return /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T(Sr, {
|
|
2860
2857
|
permission: e.action.permission,
|
|
2861
|
-
children: /* @__PURE__ */ E(
|
|
2858
|
+
children: /* @__PURE__ */ E(br, {
|
|
2862
2859
|
...r,
|
|
2863
2860
|
action: {
|
|
2864
2861
|
...e,
|
|
2865
2862
|
parameters: o
|
|
2866
2863
|
},
|
|
2867
2864
|
className: n,
|
|
2868
|
-
children: [t, /* @__PURE__ */ T(
|
|
2865
|
+
children: [t, /* @__PURE__ */ T(H, { children: e.action.title ?? e.action.name })]
|
|
2869
2866
|
})
|
|
2870
2867
|
}) });
|
|
2871
|
-
},
|
|
2872
|
-
let { objectActions: n } =
|
|
2873
|
-
return r && /* @__PURE__ */ T(
|
|
2868
|
+
}, wr = ({ namespace: e, routeParams: t }) => {
|
|
2869
|
+
let { objectActions: n } = Y(), { data: r } = or();
|
|
2870
|
+
return r && /* @__PURE__ */ T(U, {
|
|
2874
2871
|
namespace: e,
|
|
2875
2872
|
data: r,
|
|
2876
2873
|
prefix: "list",
|
|
2877
2874
|
view: "object.actions",
|
|
2878
|
-
children: n?.map((e, n) => /* @__PURE__ */ T(
|
|
2875
|
+
children: n?.map((e, n) => /* @__PURE__ */ T(Cr, {
|
|
2879
2876
|
action: {
|
|
2880
2877
|
action: e,
|
|
2881
2878
|
parameters: t
|
|
@@ -2889,27 +2886,27 @@ var dr = ({ className: e }) => {
|
|
|
2889
2886
|
].join(" ")
|
|
2890
2887
|
}, n))
|
|
2891
2888
|
});
|
|
2892
|
-
},
|
|
2893
|
-
let { columns: o, primaryColumn: s, objectActions: c, columnsTotal: l, items: u, data: d, onClick: f } =
|
|
2889
|
+
}, Tr = ({ routeParams: e, namespace: t, options: n, tableOptions: r, ...a }) => {
|
|
2890
|
+
let { columns: o, primaryColumn: s, objectActions: c, columnsTotal: l, items: u, data: d, onClick: f } = Y(), { actionRequest: p } = z(), { options: m } = O(), h = {
|
|
2894
2891
|
className: "table-responsive",
|
|
2895
2892
|
...a,
|
|
2896
2893
|
...m?.GridView || {}
|
|
2897
2894
|
};
|
|
2898
|
-
return
|
|
2895
|
+
return r = {
|
|
2899
2896
|
className: "table table-striped table-hover",
|
|
2900
2897
|
...m?.HTMLTableElement || {},
|
|
2901
|
-
...
|
|
2898
|
+
...r || {}
|
|
2902
2899
|
}, /* @__PURE__ */ T("div", {
|
|
2903
2900
|
...h,
|
|
2904
2901
|
children: /* @__PURE__ */ E("table", {
|
|
2905
|
-
...
|
|
2906
|
-
children: [/* @__PURE__ */ T("thead", { children: /* @__PURE__ */ E("tr", { children: [o.map((e, n) => /* @__PURE__ */
|
|
2902
|
+
...r,
|
|
2903
|
+
children: [/* @__PURE__ */ T("thead", { children: /* @__PURE__ */ E("tr", { children: [o.map((e, n) => /* @__PURE__ */ i("th", {
|
|
2907
2904
|
...e?.view?.header?.attr || {},
|
|
2908
2905
|
key: n
|
|
2909
|
-
}, /* @__PURE__ */ T(
|
|
2906
|
+
}, /* @__PURE__ */ T(yr, {
|
|
2910
2907
|
column: e,
|
|
2911
2908
|
namespace: t
|
|
2912
|
-
}), e.sortable && d?.sort?.[e.field] !== void 0 && /* @__PURE__ */ T(
|
|
2909
|
+
}), e.sortable && d?.sort?.[e.field] !== void 0 && /* @__PURE__ */ T(W, {
|
|
2913
2910
|
onClick: (t) => f && f({
|
|
2914
2911
|
...p,
|
|
2915
2912
|
query: {
|
|
@@ -2922,38 +2919,38 @@ var dr = ({ className: e }) => {
|
|
|
2922
2919
|
children: d.sort[e.field] ? d.sort[e.field] === "ASC" ? "⇑" : "⇓" : "⇅"
|
|
2923
2920
|
}))), s && c && c.length > 0 && /* @__PURE__ */ T("th", {
|
|
2924
2921
|
className: "text-end",
|
|
2925
|
-
children: /* @__PURE__ */ T(
|
|
2926
|
-
})] }) }), /* @__PURE__ */ T("tbody", { children: u?.length ? u.map((
|
|
2922
|
+
children: /* @__PURE__ */ T(H, { children: "Actions" })
|
|
2923
|
+
})] }) }), /* @__PURE__ */ T("tbody", { children: u?.length ? u.map((r, a) => /* @__PURE__ */ T(sr, {
|
|
2927
2924
|
index: a,
|
|
2928
|
-
id:
|
|
2929
|
-
data:
|
|
2930
|
-
children: /* @__PURE__ */ E("tr", { children: [o?.map((e,
|
|
2925
|
+
id: r[s?.field || ""] ?? void 0,
|
|
2926
|
+
data: r,
|
|
2927
|
+
children: /* @__PURE__ */ E("tr", { children: [o?.map((e, r) => {
|
|
2931
2928
|
let o = n?.columns?.[e.field];
|
|
2932
2929
|
return e = {
|
|
2933
2930
|
...e,
|
|
2934
2931
|
...o instanceof Function ? o(d?.entity?.data.items[a]) : n?.columns?.[e.field]
|
|
2935
|
-
}, /* @__PURE__ */
|
|
2932
|
+
}, /* @__PURE__ */ i("td", {
|
|
2936
2933
|
...e?.view?.content?.attr || {},
|
|
2937
|
-
key:
|
|
2938
|
-
},
|
|
2934
|
+
key: r
|
|
2935
|
+
}, r === 0 && /* @__PURE__ */ T(vr, { className: "me-2" }), /* @__PURE__ */ T(cr, {
|
|
2939
2936
|
column: e,
|
|
2940
2937
|
namespace: t
|
|
2941
2938
|
}));
|
|
2942
2939
|
}), s && c && c.length > 0 && /* @__PURE__ */ T("td", {
|
|
2943
2940
|
className: "text-end text-nowrap",
|
|
2944
|
-
children: /* @__PURE__ */ T(
|
|
2941
|
+
children: /* @__PURE__ */ T(wr, {
|
|
2945
2942
|
routeParams: e,
|
|
2946
2943
|
namespace: t
|
|
2947
2944
|
})
|
|
2948
2945
|
})] })
|
|
2949
2946
|
}, a)) : /* @__PURE__ */ T("tr", { children: /* @__PURE__ */ T("td", {
|
|
2950
2947
|
colSpan: l,
|
|
2951
|
-
children: /* @__PURE__ */ T(
|
|
2948
|
+
children: /* @__PURE__ */ T(H, { children: "Not results found." })
|
|
2952
2949
|
}) }) })]
|
|
2953
2950
|
})
|
|
2954
2951
|
});
|
|
2955
|
-
},
|
|
2956
|
-
let { onClick: a } =
|
|
2952
|
+
}, Er = ({ page: e, active: t = !1, title: n, children: r, className: i }) => {
|
|
2953
|
+
let { onClick: a } = Y(), { actionRequest: o } = z(), s = {
|
|
2957
2954
|
...o,
|
|
2958
2955
|
query: {
|
|
2959
2956
|
...o.query || {},
|
|
@@ -2962,7 +2959,7 @@ var dr = ({ className: e }) => {
|
|
|
2962
2959
|
};
|
|
2963
2960
|
return /* @__PURE__ */ T("li", {
|
|
2964
2961
|
className: `page-item ${t ? "active" : ""} ${i || ""}`,
|
|
2965
|
-
children: /* @__PURE__ */ T(
|
|
2962
|
+
children: /* @__PURE__ */ T(br, {
|
|
2966
2963
|
action: s,
|
|
2967
2964
|
...a && { onClick: (e) => {
|
|
2968
2965
|
a(s, e);
|
|
@@ -2972,8 +2969,8 @@ var dr = ({ className: e }) => {
|
|
|
2972
2969
|
children: r || e
|
|
2973
2970
|
})
|
|
2974
2971
|
});
|
|
2975
|
-
},
|
|
2976
|
-
let { data: e, onClick: t } =
|
|
2972
|
+
}, Dr = () => {
|
|
2973
|
+
let { data: e, onClick: t } = Y(), { actionRequest: n } = z(), r = e?.entity?.data.meta, i = r?.totalPages || 0, a = r?.totalResults || 0, o = r?.page || 1, s = r?.links, c = i > 1, l = r?.maxResults || 10, u = [
|
|
2977
2974
|
10,
|
|
2978
2975
|
25,
|
|
2979
2976
|
50
|
|
@@ -2981,7 +2978,7 @@ var dr = ({ className: e }) => {
|
|
|
2981
2978
|
return u.includes(l) || u.push(l), a > Math.min(...u) && /* @__PURE__ */ E("div", {
|
|
2982
2979
|
className: "d-flex flex-row flex-wrap flex-md-row justify-content-center align-items-center gap-3 py-2",
|
|
2983
2980
|
children: [
|
|
2984
|
-
/* @__PURE__ */ T("small", { children: /* @__PURE__ */ E(
|
|
2981
|
+
/* @__PURE__ */ T("small", { children: /* @__PURE__ */ E(H, {
|
|
2985
2982
|
translationKey: "PaginationResults",
|
|
2986
2983
|
properties: { count: a },
|
|
2987
2984
|
children: [a.toString(), " Results"]
|
|
@@ -2991,13 +2988,13 @@ var dr = ({ className: e }) => {
|
|
|
2991
2988
|
children: /* @__PURE__ */ E("ul", {
|
|
2992
2989
|
className: "pagination mb-0",
|
|
2993
2990
|
children: [
|
|
2994
|
-
o > 1 && /* @__PURE__ */ T(
|
|
2991
|
+
o > 1 && /* @__PURE__ */ T(Er, {
|
|
2995
2992
|
page: o - 1,
|
|
2996
2993
|
title: "Previous",
|
|
2997
2994
|
className: "page-previous",
|
|
2998
2995
|
children: "‹"
|
|
2999
2996
|
}),
|
|
3000
|
-
s && s[0] > 1 && /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(
|
|
2997
|
+
s && s[0] > 1 && /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(Er, {
|
|
3001
2998
|
page: 1,
|
|
3002
2999
|
active: o === 1
|
|
3003
3000
|
}, 1), o > 3 && /* @__PURE__ */ T("div", {
|
|
@@ -3007,7 +3004,7 @@ var dr = ({ className: e }) => {
|
|
|
3007
3004
|
children: "..."
|
|
3008
3005
|
})
|
|
3009
3006
|
})] }),
|
|
3010
|
-
(s || []).map((e) => /* @__PURE__ */ T(
|
|
3007
|
+
(s || []).map((e) => /* @__PURE__ */ T(Er, {
|
|
3011
3008
|
page: e,
|
|
3012
3009
|
active: e === o
|
|
3013
3010
|
}, e)),
|
|
@@ -3017,11 +3014,11 @@ var dr = ({ className: e }) => {
|
|
|
3017
3014
|
className: "page-link",
|
|
3018
3015
|
children: "..."
|
|
3019
3016
|
})
|
|
3020
|
-
}), /* @__PURE__ */ T(
|
|
3017
|
+
}), /* @__PURE__ */ T(Er, {
|
|
3021
3018
|
page: i,
|
|
3022
3019
|
active: i === o
|
|
3023
3020
|
}, i)] }),
|
|
3024
|
-
o < i && /* @__PURE__ */ T(
|
|
3021
|
+
o < i && /* @__PURE__ */ T(Er, {
|
|
3025
3022
|
page: o + 1,
|
|
3026
3023
|
title: "Go to Next Page",
|
|
3027
3024
|
className: "page-next",
|
|
@@ -3049,32 +3046,28 @@ var dr = ({ className: e }) => {
|
|
|
3049
3046
|
})
|
|
3050
3047
|
]
|
|
3051
3048
|
});
|
|
3052
|
-
},
|
|
3049
|
+
}, X = /* @__PURE__ */ new Map(), Or = {
|
|
3053
3050
|
set(e, t, n) {
|
|
3054
|
-
|
|
3055
|
-
let r =
|
|
3056
|
-
|
|
3057
|
-
console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(r.keys())[0]}.`);
|
|
3058
|
-
return;
|
|
3059
|
-
}
|
|
3060
|
-
r.set(t, n);
|
|
3051
|
+
X.has(e) || X.set(e, /* @__PURE__ */ new Map());
|
|
3052
|
+
let r = X.get(e);
|
|
3053
|
+
!r.has(t) && r.size !== 0 ? console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(r.keys())[0]}.`) : r.set(t, n);
|
|
3061
3054
|
},
|
|
3062
3055
|
get(e, t) {
|
|
3063
|
-
return
|
|
3056
|
+
return X.has(e) && X.get(e).get(t) || null;
|
|
3064
3057
|
},
|
|
3065
3058
|
remove(e, t) {
|
|
3066
|
-
if (!
|
|
3067
|
-
let n =
|
|
3068
|
-
n.delete(t), n.size === 0 &&
|
|
3059
|
+
if (!X.has(e)) return;
|
|
3060
|
+
let n = X.get(e);
|
|
3061
|
+
n.delete(t), n.size === 0 && X.delete(e);
|
|
3069
3062
|
}
|
|
3070
|
-
},
|
|
3063
|
+
}, kr = 1e3, Ar = "transitionend", jr = (e) => (e && window.CSS && window.CSS.escape && (e = e.replace(/#([^\s"#']+)/g, (e, t) => `#${CSS.escape(t)}`)), e), Mr = (e) => e == null ? `${e}` : Object.prototype.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(), Nr = (e) => {
|
|
3071
3064
|
if (!e) return 0;
|
|
3072
3065
|
let { transitionDuration: t, transitionDelay: n } = window.getComputedStyle(e);
|
|
3073
|
-
return !Number.parseFloat(t) && !Number.parseFloat(n) ? 0 : (t = t.split(",")[0], n = n.split(",")[0], (Number.parseFloat(t) + Number.parseFloat(n)) *
|
|
3074
|
-
},
|
|
3075
|
-
e.dispatchEvent(new Event(
|
|
3076
|
-
},
|
|
3077
|
-
if (!
|
|
3066
|
+
return !Number.parseFloat(t) && !Number.parseFloat(n) ? 0 : (t = t.split(",")[0], n = n.split(",")[0], (Number.parseFloat(t) + Number.parseFloat(n)) * kr);
|
|
3067
|
+
}, Pr = (e) => {
|
|
3068
|
+
e.dispatchEvent(new Event(Ar));
|
|
3069
|
+
}, Z = (e) => !e || typeof e != "object" ? !1 : (e.jquery !== void 0 && (e = e[0]), e.nodeType !== void 0), Fr = (e) => Z(e) ? e.jquery ? e[0] : e : typeof e == "string" && e.length > 0 ? document.querySelector(jr(e)) : null, Ir = (e) => {
|
|
3070
|
+
if (!Z(e) || e.getClientRects().length === 0) return !1;
|
|
3078
3071
|
let t = getComputedStyle(e).getPropertyValue("visibility") === "visible", n = e.closest("details:not([open])");
|
|
3079
3072
|
if (!n) return t;
|
|
3080
3073
|
if (n !== e) {
|
|
@@ -3082,124 +3075,124 @@ var dr = ({ className: e }) => {
|
|
|
3082
3075
|
if (t && t.parentNode !== n || t === null) return !1;
|
|
3083
3076
|
}
|
|
3084
3077
|
return t;
|
|
3085
|
-
},
|
|
3086
|
-
document.readyState === "loading" ? (
|
|
3087
|
-
for (let e of
|
|
3088
|
-
}),
|
|
3089
|
-
},
|
|
3090
|
-
|
|
3091
|
-
let t =
|
|
3078
|
+
}, Lr = (e) => !e || e.nodeType !== Node.ELEMENT_NODE || e.classList.contains("disabled") ? !0 : e.disabled === void 0 ? e.hasAttribute("disabled") && e.getAttribute("disabled") !== "false" : e.disabled, Rr = () => {}, zr = () => window.jQuery && !document.body.hasAttribute("data-bs-no-jquery") ? window.jQuery : null, Br = [], Vr = (e) => {
|
|
3079
|
+
document.readyState === "loading" ? (Br.length || document.addEventListener("DOMContentLoaded", () => {
|
|
3080
|
+
for (let e of Br) e();
|
|
3081
|
+
}), Br.push(e)) : e();
|
|
3082
|
+
}, Hr = () => document.documentElement.dir === "rtl", Ur = (e) => {
|
|
3083
|
+
Vr(() => {
|
|
3084
|
+
let t = zr();
|
|
3092
3085
|
/* istanbul ignore if */
|
|
3093
3086
|
if (t) {
|
|
3094
3087
|
let n = e.NAME, r = t.fn[n];
|
|
3095
3088
|
t.fn[n] = e.jQueryInterface, t.fn[n].Constructor = e, t.fn[n].noConflict = () => (t.fn[n] = r, e.jQueryInterface);
|
|
3096
3089
|
}
|
|
3097
3090
|
});
|
|
3098
|
-
},
|
|
3091
|
+
}, Wr = (e, t = [], n = e) => typeof e == "function" ? e.call(...t) : n, Gr = (e, t, n = !0) => {
|
|
3099
3092
|
if (!n) {
|
|
3100
|
-
|
|
3093
|
+
Wr(e);
|
|
3101
3094
|
return;
|
|
3102
3095
|
}
|
|
3103
|
-
let r =
|
|
3104
|
-
n === t && (i = !0, t.removeEventListener(
|
|
3096
|
+
let r = Nr(t) + 5, i = !1, a = ({ target: n }) => {
|
|
3097
|
+
n === t && (i = !0, t.removeEventListener(Ar, a), Wr(e));
|
|
3105
3098
|
};
|
|
3106
|
-
t.addEventListener(
|
|
3107
|
-
i ||
|
|
3099
|
+
t.addEventListener(Ar, a), setTimeout(() => {
|
|
3100
|
+
i || Pr(t);
|
|
3108
3101
|
}, r);
|
|
3109
|
-
},
|
|
3102
|
+
}, Kr = (e, t, n, r) => {
|
|
3110
3103
|
let i = e.length, a = e.indexOf(t);
|
|
3111
3104
|
return a === -1 ? !n && r ? e[i - 1] : e[0] : (a += n ? 1 : -1, r && (a = (a + i) % i), e[Math.max(0, Math.min(a, i - 1))]);
|
|
3112
|
-
},
|
|
3105
|
+
}, qr = /[^.]*(?=\..*)\.|.*/, Jr = /\..*/, Yr = /::\d+$/, Xr = {}, Zr = 1, Qr = {
|
|
3113
3106
|
mouseenter: "mouseover",
|
|
3114
3107
|
mouseleave: "mouseout"
|
|
3115
|
-
},
|
|
3116
|
-
function
|
|
3117
|
-
return t && `${t}::${
|
|
3108
|
+
}, $r = /* @__PURE__ */ new Set(/* @__PURE__ */ "click.dblclick.mouseup.mousedown.contextmenu.mousewheel.DOMMouseScroll.mouseover.mouseout.mousemove.selectstart.selectend.keydown.keypress.keyup.orientationchange.touchstart.touchmove.touchend.touchcancel.pointerdown.pointermove.pointerup.pointerleave.pointercancel.gesturestart.gesturechange.gestureend.focus.blur.change.reset.select.submit.focusin.focusout.load.unload.beforeunload.resize.move.DOMContentLoaded.readystatechange.error.abort.scroll".split("."));
|
|
3109
|
+
function ei(e, t) {
|
|
3110
|
+
return t && `${t}::${Zr++}` || e.uidEvent || Zr++;
|
|
3118
3111
|
}
|
|
3119
|
-
function
|
|
3120
|
-
let t =
|
|
3121
|
-
return e.uidEvent = t,
|
|
3112
|
+
function ti(e) {
|
|
3113
|
+
let t = ei(e);
|
|
3114
|
+
return e.uidEvent = t, Xr[t] = Xr[t] || {}, Xr[t];
|
|
3122
3115
|
}
|
|
3123
|
-
function
|
|
3116
|
+
function ni(e, t) {
|
|
3124
3117
|
return function n(r) {
|
|
3125
|
-
return
|
|
3118
|
+
return ui(r, { delegateTarget: e }), n.oneOff && Q.off(e, r.type, t), t.apply(e, [r]);
|
|
3126
3119
|
};
|
|
3127
3120
|
}
|
|
3128
|
-
function
|
|
3121
|
+
function ri(e, t, n) {
|
|
3129
3122
|
return function r(i) {
|
|
3130
3123
|
let a = e.querySelectorAll(t);
|
|
3131
|
-
for (let { target: o } = i; o && o !== this; o = o.parentNode) for (let s of a) if (s === o) return
|
|
3124
|
+
for (let { target: o } = i; o && o !== this; o = o.parentNode) for (let s of a) if (s === o) return ui(i, { delegateTarget: o }), r.oneOff && Q.off(e, i.type, t, n), n.apply(o, [i]);
|
|
3132
3125
|
};
|
|
3133
3126
|
}
|
|
3134
|
-
function
|
|
3127
|
+
function ii(e, t, n = null) {
|
|
3135
3128
|
return Object.values(e).find((e) => e.callable === t && e.delegationSelector === n);
|
|
3136
3129
|
}
|
|
3137
|
-
function
|
|
3138
|
-
let r = typeof t == "string", i = r ? n : t || n, a =
|
|
3139
|
-
return
|
|
3130
|
+
function ai(e, t, n) {
|
|
3131
|
+
let r = typeof t == "string", i = r ? n : t || n, a = li(e);
|
|
3132
|
+
return $r.has(a) || (a = e), [
|
|
3140
3133
|
r,
|
|
3141
3134
|
i,
|
|
3142
3135
|
a
|
|
3143
3136
|
];
|
|
3144
3137
|
}
|
|
3145
|
-
function
|
|
3138
|
+
function oi(e, t, n, r, i) {
|
|
3146
3139
|
if (typeof t != "string" || !e) return;
|
|
3147
|
-
let [a, o, s] =
|
|
3148
|
-
t in
|
|
3140
|
+
let [a, o, s] = ai(t, n, r);
|
|
3141
|
+
t in Qr && (o = ((e) => function(t) {
|
|
3149
3142
|
if (!t.relatedTarget || t.relatedTarget !== t.delegateTarget && !t.delegateTarget.contains(t.relatedTarget)) return e.call(this, t);
|
|
3150
3143
|
})(o));
|
|
3151
|
-
let c =
|
|
3144
|
+
let c = ti(e), l = c[s] || (c[s] = {}), u = ii(l, o, a ? n : null);
|
|
3152
3145
|
if (u) {
|
|
3153
3146
|
u.oneOff = u.oneOff && i;
|
|
3154
3147
|
return;
|
|
3155
3148
|
}
|
|
3156
|
-
let d =
|
|
3149
|
+
let d = ei(o, t.replace(qr, "")), f = a ? ri(e, n, o) : ni(e, o);
|
|
3157
3150
|
f.delegationSelector = a ? n : null, f.callable = o, f.oneOff = i, f.uidEvent = d, l[d] = f, e.addEventListener(s, f, a);
|
|
3158
3151
|
}
|
|
3159
|
-
function
|
|
3160
|
-
let a =
|
|
3152
|
+
function si(e, t, n, r, i) {
|
|
3153
|
+
let a = ii(t[n], r, i);
|
|
3161
3154
|
a && (e.removeEventListener(n, a, !!i), delete t[n][a.uidEvent]);
|
|
3162
3155
|
}
|
|
3163
|
-
function
|
|
3156
|
+
function ci(e, t, n, r) {
|
|
3164
3157
|
let i = t[n] || {};
|
|
3165
|
-
for (let [a, o] of Object.entries(i)) a.includes(r) &&
|
|
3158
|
+
for (let [a, o] of Object.entries(i)) a.includes(r) && si(e, t, n, o.callable, o.delegationSelector);
|
|
3166
3159
|
}
|
|
3167
|
-
function
|
|
3168
|
-
return e = e.replace(
|
|
3160
|
+
function li(e) {
|
|
3161
|
+
return e = e.replace(Jr, ""), Qr[e] || e;
|
|
3169
3162
|
}
|
|
3170
3163
|
var Q = {
|
|
3171
3164
|
on(e, t, n, r) {
|
|
3172
|
-
|
|
3165
|
+
oi(e, t, n, r, !1);
|
|
3173
3166
|
},
|
|
3174
3167
|
one(e, t, n, r) {
|
|
3175
|
-
|
|
3168
|
+
oi(e, t, n, r, !0);
|
|
3176
3169
|
},
|
|
3177
3170
|
off(e, t, n, r) {
|
|
3178
3171
|
if (typeof t != "string" || !e) return;
|
|
3179
|
-
let [i, a, o] =
|
|
3172
|
+
let [i, a, o] = ai(t, n, r), s = o !== t, c = ti(e), l = c[o] || {}, u = t.startsWith(".");
|
|
3180
3173
|
if (a !== void 0) {
|
|
3181
3174
|
if (!Object.keys(l).length) return;
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3175
|
+
si(e, c, o, a, i ? n : null);
|
|
3176
|
+
} else {
|
|
3177
|
+
if (u) for (let n of Object.keys(c)) ci(e, c, n, t.slice(1));
|
|
3178
|
+
for (let [n, r] of Object.entries(l)) {
|
|
3179
|
+
let i = n.replace(Yr, "");
|
|
3180
|
+
(!s || t.includes(i)) && si(e, c, o, r.callable, r.delegationSelector);
|
|
3181
|
+
}
|
|
3189
3182
|
}
|
|
3190
3183
|
},
|
|
3191
3184
|
trigger(e, t, n) {
|
|
3192
3185
|
if (typeof t != "string" || !e) return null;
|
|
3193
|
-
let r =
|
|
3186
|
+
let r = zr(), i = t !== li(t), a = null, o = !0, s = !0, c = !1;
|
|
3194
3187
|
i && r && (a = r.Event(t, n), r(e).trigger(a), o = !a.isPropagationStopped(), s = !a.isImmediatePropagationStopped(), c = a.isDefaultPrevented());
|
|
3195
|
-
let l =
|
|
3188
|
+
let l = ui(new Event(t, {
|
|
3196
3189
|
bubbles: o,
|
|
3197
3190
|
cancelable: !0
|
|
3198
3191
|
}), n);
|
|
3199
3192
|
return c && l.preventDefault(), s && e.dispatchEvent(l), l.defaultPrevented && a && a.preventDefault(), l;
|
|
3200
3193
|
}
|
|
3201
3194
|
};
|
|
3202
|
-
function
|
|
3195
|
+
function ui(e, t = {}) {
|
|
3203
3196
|
for (let [n, r] of Object.entries(t)) try {
|
|
3204
3197
|
e[n] = r;
|
|
3205
3198
|
} catch {
|
|
@@ -3214,7 +3207,7 @@ function ii(e, t = {}) {
|
|
|
3214
3207
|
}
|
|
3215
3208
|
//#endregion
|
|
3216
3209
|
//#region node_modules/bootstrap/js/src/dom/manipulator.js
|
|
3217
|
-
function
|
|
3210
|
+
function di(e) {
|
|
3218
3211
|
if (e === "true") return !0;
|
|
3219
3212
|
if (e === "false") return !1;
|
|
3220
3213
|
if (e === Number(e).toString()) return Number(e);
|
|
@@ -3226,29 +3219,29 @@ function ai(e) {
|
|
|
3226
3219
|
return e;
|
|
3227
3220
|
}
|
|
3228
3221
|
}
|
|
3229
|
-
function
|
|
3222
|
+
function fi(e) {
|
|
3230
3223
|
return e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
3231
3224
|
}
|
|
3232
|
-
var
|
|
3225
|
+
var pi = {
|
|
3233
3226
|
setDataAttribute(e, t, n) {
|
|
3234
|
-
e.setAttribute(`data-bs-${
|
|
3227
|
+
e.setAttribute(`data-bs-${fi(t)}`, n);
|
|
3235
3228
|
},
|
|
3236
3229
|
removeDataAttribute(e, t) {
|
|
3237
|
-
e.removeAttribute(`data-bs-${
|
|
3230
|
+
e.removeAttribute(`data-bs-${fi(t)}`);
|
|
3238
3231
|
},
|
|
3239
3232
|
getDataAttributes(e) {
|
|
3240
3233
|
if (!e) return {};
|
|
3241
3234
|
let t = {}, n = Object.keys(e.dataset).filter((e) => e.startsWith("bs") && !e.startsWith("bsConfig"));
|
|
3242
3235
|
for (let r of n) {
|
|
3243
3236
|
let n = r.replace(/^bs/, "");
|
|
3244
|
-
n = n.charAt(0).toLowerCase() + n.slice(1), t[n] =
|
|
3237
|
+
n = n.charAt(0).toLowerCase() + n.slice(1), t[n] = di(e.dataset[r]);
|
|
3245
3238
|
}
|
|
3246
3239
|
return t;
|
|
3247
3240
|
},
|
|
3248
3241
|
getDataAttribute(e, t) {
|
|
3249
|
-
return
|
|
3242
|
+
return di(e.getAttribute(`data-bs-${fi(t)}`));
|
|
3250
3243
|
}
|
|
3251
|
-
},
|
|
3244
|
+
}, mi = class {
|
|
3252
3245
|
static get Default() {
|
|
3253
3246
|
return {};
|
|
3254
3247
|
}
|
|
@@ -3265,42 +3258,42 @@ var si = {
|
|
|
3265
3258
|
return e;
|
|
3266
3259
|
}
|
|
3267
3260
|
_mergeConfigObj(e, t) {
|
|
3268
|
-
let n =
|
|
3261
|
+
let n = Z(t) ? pi.getDataAttribute(t, "config") : {};
|
|
3269
3262
|
return {
|
|
3270
3263
|
...this.constructor.Default,
|
|
3271
3264
|
...typeof n == "object" ? n : {},
|
|
3272
|
-
...
|
|
3265
|
+
...Z(t) ? pi.getDataAttributes(t) : {},
|
|
3273
3266
|
...typeof e == "object" ? e : {}
|
|
3274
3267
|
};
|
|
3275
3268
|
}
|
|
3276
3269
|
_typeCheckConfig(e, t = this.constructor.DefaultType) {
|
|
3277
3270
|
for (let [n, r] of Object.entries(t)) {
|
|
3278
|
-
let t = e[n], i =
|
|
3271
|
+
let t = e[n], i = Z(t) ? "element" : Mr(t);
|
|
3279
3272
|
if (!new RegExp(r).test(i)) throw TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${n}" provided type "${i}" but expected type "${r}".`);
|
|
3280
3273
|
}
|
|
3281
3274
|
}
|
|
3282
|
-
},
|
|
3275
|
+
}, hi = "5.3.8", gi = class extends mi {
|
|
3283
3276
|
constructor(e, t) {
|
|
3284
|
-
super(), e =
|
|
3277
|
+
super(), e = Fr(e), e && (this._element = e, this._config = this._getConfig(t), Or.set(this._element, this.constructor.DATA_KEY, this));
|
|
3285
3278
|
}
|
|
3286
3279
|
dispose() {
|
|
3287
|
-
|
|
3280
|
+
Or.remove(this._element, this.constructor.DATA_KEY), Q.off(this._element, this.constructor.EVENT_KEY);
|
|
3288
3281
|
for (let e of Object.getOwnPropertyNames(this)) this[e] = null;
|
|
3289
3282
|
}
|
|
3290
3283
|
_queueCallback(e, t, n = !0) {
|
|
3291
|
-
|
|
3284
|
+
Gr(e, t, n);
|
|
3292
3285
|
}
|
|
3293
3286
|
_getConfig(e) {
|
|
3294
3287
|
return e = this._mergeConfigObj(e, this._element), e = this._configAfterMerge(e), this._typeCheckConfig(e), e;
|
|
3295
3288
|
}
|
|
3296
3289
|
static getInstance(e) {
|
|
3297
|
-
return
|
|
3290
|
+
return Or.get(Fr(e), this.DATA_KEY);
|
|
3298
3291
|
}
|
|
3299
3292
|
static getOrCreateInstance(e, t = {}) {
|
|
3300
3293
|
return this.getInstance(e) || new this(e, typeof t == "object" ? t : null);
|
|
3301
3294
|
}
|
|
3302
3295
|
static get VERSION() {
|
|
3303
|
-
return
|
|
3296
|
+
return hi;
|
|
3304
3297
|
}
|
|
3305
3298
|
static get DATA_KEY() {
|
|
3306
3299
|
return `bs.${this.NAME}`;
|
|
@@ -3311,14 +3304,14 @@ var si = {
|
|
|
3311
3304
|
static eventName(e) {
|
|
3312
3305
|
return `${e}${this.EVENT_KEY}`;
|
|
3313
3306
|
}
|
|
3314
|
-
},
|
|
3307
|
+
}, _i = (e) => {
|
|
3315
3308
|
let t = e.getAttribute("data-bs-target");
|
|
3316
3309
|
if (!t || t === "#") {
|
|
3317
3310
|
let n = e.getAttribute("href");
|
|
3318
3311
|
if (!n || !n.includes("#") && !n.startsWith(".")) return null;
|
|
3319
3312
|
n.includes("#") && !n.startsWith("#") && (n = `#${n.split("#")[1]}`), t = n && n !== "#" ? n.trim() : null;
|
|
3320
3313
|
}
|
|
3321
|
-
return t ? t.split(",").map((e) =>
|
|
3314
|
+
return t ? t.split(",").map((e) => jr(e)).join(",") : null;
|
|
3322
3315
|
}, $ = {
|
|
3323
3316
|
find(e, t = document.documentElement) {
|
|
3324
3317
|
return [].concat(...Element.prototype.querySelectorAll.call(t, e));
|
|
@@ -3361,60 +3354,60 @@ var si = {
|
|
|
3361
3354
|
"[tabindex]",
|
|
3362
3355
|
"[contenteditable=\"true\"]"
|
|
3363
3356
|
].map((e) => `${e}:not([tabindex^="-"])`).join(",");
|
|
3364
|
-
return this.find(t, e).filter((e) => !
|
|
3357
|
+
return this.find(t, e).filter((e) => !Lr(e) && Ir(e));
|
|
3365
3358
|
},
|
|
3366
3359
|
getSelectorFromElement(e) {
|
|
3367
|
-
let t =
|
|
3360
|
+
let t = _i(e);
|
|
3368
3361
|
return t && $.findOne(t) ? t : null;
|
|
3369
3362
|
},
|
|
3370
3363
|
getElementFromSelector(e) {
|
|
3371
|
-
let t =
|
|
3364
|
+
let t = _i(e);
|
|
3372
3365
|
return t ? $.findOne(t) : null;
|
|
3373
3366
|
},
|
|
3374
3367
|
getMultipleElementsFromSelector(e) {
|
|
3375
|
-
let t =
|
|
3368
|
+
let t = _i(e);
|
|
3376
3369
|
return t ? $.find(t) : [];
|
|
3377
3370
|
}
|
|
3378
|
-
},
|
|
3371
|
+
}, vi = "dropdown", yi = ".bs.dropdown", bi = ".data-api", xi = "Escape", Si = "Tab", Ci = "ArrowUp", wi = "ArrowDown", Ti = 2, Ei = `hide${yi}`, Di = `hidden${yi}`, Oi = `show${yi}`, ki = `shown${yi}`, Ai = `click${yi}${bi}`, ji = `keydown${yi}${bi}`, Mi = `keyup${yi}${bi}`, Ni = "show", Pi = "dropup", Fi = "dropend", Ii = "dropstart", Li = "dropup-center", Ri = "dropdown-center", zi = "[data-bs-toggle=\"dropdown\"]:not(.disabled):not(:disabled)", Bi = `${zi}.${Ni}`, Vi = ".dropdown-menu", Hi = ".navbar", Ui = ".navbar-nav", Wi = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)", Gi = Hr() ? "top-end" : "top-start", Ki = Hr() ? "top-start" : "top-end", qi = Hr() ? "bottom-end" : "bottom-start", Ji = Hr() ? "bottom-start" : "bottom-end", Yi = Hr() ? "left-start" : "right-start", Xi = Hr() ? "right-start" : "left-start", Zi = "top", Qi = "bottom", $i = {
|
|
3379
3372
|
autoClose: !0,
|
|
3380
3373
|
boundary: "clippingParents",
|
|
3381
3374
|
display: "dynamic",
|
|
3382
3375
|
offset: [0, 2],
|
|
3383
3376
|
popperConfig: null,
|
|
3384
3377
|
reference: "toggle"
|
|
3385
|
-
},
|
|
3378
|
+
}, ea = {
|
|
3386
3379
|
autoClose: "(boolean|string)",
|
|
3387
3380
|
boundary: "(string|element)",
|
|
3388
3381
|
display: "string",
|
|
3389
3382
|
offset: "(array|string|function)",
|
|
3390
3383
|
popperConfig: "(null|object|function)",
|
|
3391
3384
|
reference: "(string|element|object)"
|
|
3392
|
-
},
|
|
3385
|
+
}, ta = class e extends gi {
|
|
3393
3386
|
constructor(e, t) {
|
|
3394
|
-
super(e, t), this._popper = null, this._parent = this._element.parentNode, this._menu = $.next(this._element,
|
|
3387
|
+
super(e, t), this._popper = null, this._parent = this._element.parentNode, this._menu = $.next(this._element, Vi)[0] || $.prev(this._element, Vi)[0] || $.findOne(Vi, this._parent), this._inNavbar = this._detectNavbar();
|
|
3395
3388
|
}
|
|
3396
3389
|
static get Default() {
|
|
3397
|
-
return
|
|
3390
|
+
return $i;
|
|
3398
3391
|
}
|
|
3399
3392
|
static get DefaultType() {
|
|
3400
|
-
return
|
|
3393
|
+
return ea;
|
|
3401
3394
|
}
|
|
3402
3395
|
static get NAME() {
|
|
3403
|
-
return
|
|
3396
|
+
return vi;
|
|
3404
3397
|
}
|
|
3405
3398
|
toggle() {
|
|
3406
3399
|
return this._isShown() ? this.hide() : this.show();
|
|
3407
3400
|
}
|
|
3408
3401
|
show() {
|
|
3409
|
-
if (
|
|
3402
|
+
if (Lr(this._element) || this._isShown()) return;
|
|
3410
3403
|
let e = { relatedTarget: this._element };
|
|
3411
|
-
if (!Q.trigger(this._element,
|
|
3412
|
-
if (this._createPopper(), "ontouchstart" in document.documentElement && !this._parent.closest(
|
|
3413
|
-
this._element.focus(), this._element.setAttribute("aria-expanded", !0), this._menu.classList.add(
|
|
3404
|
+
if (!Q.trigger(this._element, Oi, e).defaultPrevented) {
|
|
3405
|
+
if (this._createPopper(), "ontouchstart" in document.documentElement && !this._parent.closest(Ui)) for (let e of [].concat(...document.body.children)) Q.on(e, "mouseover", Rr);
|
|
3406
|
+
this._element.focus(), this._element.setAttribute("aria-expanded", !0), this._menu.classList.add(Ni), this._element.classList.add(Ni), Q.trigger(this._element, ki, e);
|
|
3414
3407
|
}
|
|
3415
3408
|
}
|
|
3416
3409
|
hide() {
|
|
3417
|
-
if (
|
|
3410
|
+
if (Lr(this._element) || !this._isShown()) return;
|
|
3418
3411
|
let e = { relatedTarget: this._element };
|
|
3419
3412
|
this._completeHide(e);
|
|
3420
3413
|
}
|
|
@@ -3425,36 +3418,36 @@ var si = {
|
|
|
3425
3418
|
this._inNavbar = this._detectNavbar(), this._popper && this._popper.update();
|
|
3426
3419
|
}
|
|
3427
3420
|
_completeHide(e) {
|
|
3428
|
-
if (!Q.trigger(this._element,
|
|
3429
|
-
if ("ontouchstart" in document.documentElement) for (let e of [].concat(...document.body.children)) Q.off(e, "mouseover",
|
|
3430
|
-
this._popper && this._popper.destroy(), this._menu.classList.remove(
|
|
3421
|
+
if (!Q.trigger(this._element, Ei, e).defaultPrevented) {
|
|
3422
|
+
if ("ontouchstart" in document.documentElement) for (let e of [].concat(...document.body.children)) Q.off(e, "mouseover", Rr);
|
|
3423
|
+
this._popper && this._popper.destroy(), this._menu.classList.remove(Ni), this._element.classList.remove(Ni), this._element.setAttribute("aria-expanded", "false"), pi.removeDataAttribute(this._menu, "popper"), Q.trigger(this._element, Di, e);
|
|
3431
3424
|
}
|
|
3432
3425
|
}
|
|
3433
3426
|
_getConfig(e) {
|
|
3434
|
-
if (e = super._getConfig(e), typeof e.reference == "object" && !
|
|
3427
|
+
if (e = super._getConfig(e), typeof e.reference == "object" && !Z(e.reference) && typeof e.reference.getBoundingClientRect != "function") throw TypeError(`${vi.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
|
|
3435
3428
|
return e;
|
|
3436
3429
|
}
|
|
3437
3430
|
_createPopper() {
|
|
3438
|
-
if (
|
|
3431
|
+
if (ie === void 0) throw TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org/docs/v2/)");
|
|
3439
3432
|
let e = this._element;
|
|
3440
|
-
this._config.reference === "parent" ? e = this._parent :
|
|
3433
|
+
this._config.reference === "parent" ? e = this._parent : Z(this._config.reference) ? e = Fr(this._config.reference) : typeof this._config.reference == "object" && (e = this._config.reference);
|
|
3441
3434
|
let t = this._getPopperConfig();
|
|
3442
|
-
this._popper =
|
|
3435
|
+
this._popper = ie.createPopper(e, this._menu, t);
|
|
3443
3436
|
}
|
|
3444
3437
|
_isShown() {
|
|
3445
|
-
return this._menu.classList.contains(
|
|
3438
|
+
return this._menu.classList.contains(Ni);
|
|
3446
3439
|
}
|
|
3447
3440
|
_getPlacement() {
|
|
3448
3441
|
let e = this._parent;
|
|
3449
|
-
if (e.classList.contains(
|
|
3450
|
-
if (e.classList.contains(
|
|
3451
|
-
if (e.classList.contains(
|
|
3452
|
-
if (e.classList.contains(
|
|
3442
|
+
if (e.classList.contains(Fi)) return Yi;
|
|
3443
|
+
if (e.classList.contains(Ii)) return Xi;
|
|
3444
|
+
if (e.classList.contains(Li)) return Zi;
|
|
3445
|
+
if (e.classList.contains(Ri)) return Qi;
|
|
3453
3446
|
let t = getComputedStyle(this._menu).getPropertyValue("--bs-position").trim() === "end";
|
|
3454
|
-
return e.classList.contains(
|
|
3447
|
+
return e.classList.contains(Pi) ? t ? Ki : Gi : t ? Ji : qi;
|
|
3455
3448
|
}
|
|
3456
3449
|
_detectNavbar() {
|
|
3457
|
-
return this._element.closest(
|
|
3450
|
+
return this._element.closest(Hi) !== null;
|
|
3458
3451
|
}
|
|
3459
3452
|
_getOffset() {
|
|
3460
3453
|
let { offset: e } = this._config;
|
|
@@ -3471,17 +3464,17 @@ var si = {
|
|
|
3471
3464
|
options: { offset: this._getOffset() }
|
|
3472
3465
|
}]
|
|
3473
3466
|
};
|
|
3474
|
-
return (this._inNavbar || this._config.display === "static") && (
|
|
3467
|
+
return (this._inNavbar || this._config.display === "static") && (pi.setDataAttribute(this._menu, "popper", "static"), e.modifiers = [{
|
|
3475
3468
|
name: "applyStyles",
|
|
3476
3469
|
enabled: !1
|
|
3477
3470
|
}]), {
|
|
3478
3471
|
...e,
|
|
3479
|
-
...
|
|
3472
|
+
...Wr(this._config.popperConfig, [void 0, e])
|
|
3480
3473
|
};
|
|
3481
3474
|
}
|
|
3482
3475
|
_selectMenuItem({ key: e, target: t }) {
|
|
3483
|
-
let n = $.find(
|
|
3484
|
-
n.length &&
|
|
3476
|
+
let n = $.find(Wi, this._menu).filter((e) => Ir(e));
|
|
3477
|
+
n.length && Kr(n, t, e === wi, !n.includes(t)).focus();
|
|
3485
3478
|
}
|
|
3486
3479
|
static jQueryInterface(t) {
|
|
3487
3480
|
return this.each(function() {
|
|
@@ -3493,41 +3486,37 @@ var si = {
|
|
|
3493
3486
|
});
|
|
3494
3487
|
}
|
|
3495
3488
|
static clearMenus(t) {
|
|
3496
|
-
if (t.button ===
|
|
3497
|
-
let n = $.find(
|
|
3489
|
+
if (t.button === Ti || t.type === "keyup" && t.key !== Si) return;
|
|
3490
|
+
let n = $.find(Bi);
|
|
3498
3491
|
for (let r of n) {
|
|
3499
3492
|
let n = e.getInstance(r);
|
|
3500
3493
|
if (!n || n._config.autoClose === !1) continue;
|
|
3501
3494
|
let i = t.composedPath(), a = i.includes(n._menu);
|
|
3502
|
-
if (i.includes(n._element) || n._config.autoClose === "inside" && !a || n._config.autoClose === "outside" && a || n._menu.contains(t.target) && (t.type === "keyup" && t.key ===
|
|
3495
|
+
if (i.includes(n._element) || n._config.autoClose === "inside" && !a || n._config.autoClose === "outside" && a || n._menu.contains(t.target) && (t.type === "keyup" && t.key === Si || /input|select|option|textarea|form/i.test(t.target.tagName))) continue;
|
|
3503
3496
|
let o = { relatedTarget: n._element };
|
|
3504
3497
|
t.type === "click" && (o.clickEvent = t), n._completeHide(o);
|
|
3505
3498
|
}
|
|
3506
3499
|
}
|
|
3507
3500
|
static dataApiKeydownHandler(t) {
|
|
3508
|
-
let n = /input|textarea/i.test(t.target.tagName), r = t.key ===
|
|
3501
|
+
let n = /input|textarea/i.test(t.target.tagName), r = t.key === xi, i = [Ci, wi].includes(t.key);
|
|
3509
3502
|
if (!i && !r || n && !r) return;
|
|
3510
3503
|
t.preventDefault();
|
|
3511
|
-
let a = this.matches(
|
|
3512
|
-
|
|
3513
|
-
t.stopPropagation(), o.show(), o._selectMenuItem(t);
|
|
3514
|
-
return;
|
|
3515
|
-
}
|
|
3516
|
-
o._isShown() && (t.stopPropagation(), o.hide(), a.focus());
|
|
3504
|
+
let a = this.matches(zi) ? this : $.prev(this, zi)[0] || $.next(this, zi)[0] || $.findOne(zi, t.delegateTarget.parentNode), o = e.getOrCreateInstance(a);
|
|
3505
|
+
i ? (t.stopPropagation(), o.show(), o._selectMenuItem(t)) : o._isShown() && (t.stopPropagation(), o.hide(), a.focus());
|
|
3517
3506
|
}
|
|
3518
3507
|
};
|
|
3519
|
-
Q.on(document,
|
|
3520
|
-
e.preventDefault(),
|
|
3521
|
-
}),
|
|
3508
|
+
Q.on(document, ji, zi, ta.dataApiKeydownHandler), Q.on(document, ji, Vi, ta.dataApiKeydownHandler), Q.on(document, Ai, ta.clearMenus), Q.on(document, Mi, ta.clearMenus), Q.on(document, Ai, zi, function(e) {
|
|
3509
|
+
e.preventDefault(), ta.getOrCreateInstance(this).toggle();
|
|
3510
|
+
}), Ur(ta);
|
|
3522
3511
|
//#endregion
|
|
3523
3512
|
//#region src/component/Dropdown.tsx
|
|
3524
|
-
var
|
|
3513
|
+
var na = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ T(w, { children: e }), ra = ({ children: e, position: t, ...n }) => /* @__PURE__ */ T("div", {
|
|
3525
3514
|
className: "dropdown-menu dropdown-menu-" + (t || "left"),
|
|
3526
3515
|
children: e
|
|
3527
|
-
}),
|
|
3528
|
-
let o =
|
|
3529
|
-
|
|
3530
|
-
let e = new
|
|
3516
|
+
}), ia = ({ className: e, children: n, autoClose: r, strategy: i = "absolute", icon: a }) => {
|
|
3517
|
+
let o = g(null);
|
|
3518
|
+
u(() => {
|
|
3519
|
+
let e = new ta(o.current, {
|
|
3531
3520
|
autoClose: r ?? !0,
|
|
3532
3521
|
boundary: document.body,
|
|
3533
3522
|
popperConfig: { strategy: i }
|
|
@@ -3536,29 +3525,29 @@ var Xi = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ T(w, {
|
|
|
3536
3525
|
e.dispose();
|
|
3537
3526
|
};
|
|
3538
3527
|
}, []);
|
|
3539
|
-
let s = t.Children.toArray(n).find((e) => t.isValidElement(e) && e.type ===
|
|
3528
|
+
let s = t.Children.toArray(n).find((e) => t.isValidElement(e) && e.type === ra), c = t.Children.toArray(n).filter((e) => t.isValidElement(e) && e.type === W), l = t.Children.toArray(n).find((e) => t.isValidElement(e) && e.type === na), d = t.Children.toArray(n).filter((e) => !t.isValidElement(e) || e.type !== W && e.type !== ra && e.type !== na), f = t.isValidElement(l) ? l.props : {};
|
|
3540
3529
|
return /* @__PURE__ */ E("div", {
|
|
3541
3530
|
className: [...(e || "").split(" "), "dropdown"].filter((e, t, n) => n.indexOf(e) === t).join(" "),
|
|
3542
|
-
children: [/* @__PURE__ */ T(
|
|
3531
|
+
children: [/* @__PURE__ */ T(St, {
|
|
3543
3532
|
ref: o,
|
|
3544
3533
|
"data-bs-toggle": "dropdown",
|
|
3545
3534
|
...f,
|
|
3546
3535
|
className: [...(f.className || "").split(" ")].filter((e, t, n) => n.indexOf(e) === t).join(" "),
|
|
3547
3536
|
children: f.children ? f.children : d
|
|
3548
|
-
}), s || /* @__PURE__ */ T(
|
|
3537
|
+
}), s || /* @__PURE__ */ T(ra, { children: c })]
|
|
3549
3538
|
});
|
|
3550
|
-
},
|
|
3551
|
-
let { appliedFilters: t } =
|
|
3539
|
+
}, aa = ({ onClick: e }) => {
|
|
3540
|
+
let { appliedFilters: t } = Y();
|
|
3552
3541
|
return !!t?.length && /* @__PURE__ */ T("div", {
|
|
3553
3542
|
className: "filters d-flex mb-sm overflow-auto",
|
|
3554
3543
|
children: t?.map((t, n) => /* @__PURE__ */ E("div", {
|
|
3555
3544
|
className: "filters-item d-flex text-nowrap flex-column me-2 mb-2",
|
|
3556
3545
|
children: [/* @__PURE__ */ T("small", {
|
|
3557
3546
|
className: "mb-2",
|
|
3558
|
-
children: /* @__PURE__ */ T(
|
|
3547
|
+
children: /* @__PURE__ */ T(H, { children: t.label })
|
|
3559
3548
|
}), /* @__PURE__ */ E("div", {
|
|
3560
3549
|
className: "btn btn-sm btn-primary me-1 mb-1",
|
|
3561
|
-
children: [/* @__PURE__ */ T(
|
|
3550
|
+
children: [/* @__PURE__ */ T(H, { children: t.value }), e && /* @__PURE__ */ T("span", {
|
|
3562
3551
|
onClick: () => e(t.formView.name),
|
|
3563
3552
|
className: "ms-2",
|
|
3564
3553
|
children: "×"
|
|
@@ -3566,8 +3555,8 @@ var Xi = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ T(w, {
|
|
|
3566
3555
|
})]
|
|
3567
3556
|
}, n))
|
|
3568
3557
|
});
|
|
3569
|
-
},
|
|
3570
|
-
let { actions: e, isSelectedAll: t, toggleAll: n, selected: r, executeAction: i, clear: a } =
|
|
3558
|
+
}, oa = () => {
|
|
3559
|
+
let { actions: e, isSelectedAll: t, toggleAll: n, selected: r, executeAction: i, clear: a } = gr() || {};
|
|
3571
3560
|
return e && /* @__PURE__ */ E("div", {
|
|
3572
3561
|
className: "btn-group btn-group-sm mb-2",
|
|
3573
3562
|
children: [
|
|
@@ -3579,16 +3568,16 @@ var Xi = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ T(w, {
|
|
|
3579
3568
|
type: "checkbox"
|
|
3580
3569
|
})
|
|
3581
3570
|
}),
|
|
3582
|
-
!!r?.length && /* @__PURE__ */ E(
|
|
3571
|
+
!!r?.length && /* @__PURE__ */ E(ia, {
|
|
3583
3572
|
className: "btn btn-sm btn-light",
|
|
3584
|
-
children: [/* @__PURE__ */ T(
|
|
3573
|
+
children: [/* @__PURE__ */ T(na, {
|
|
3585
3574
|
disabled: !r?.length,
|
|
3586
3575
|
className: "bg-transparent border-0",
|
|
3587
|
-
children: !!r?.length && /* @__PURE__ */ T(
|
|
3576
|
+
children: !!r?.length && /* @__PURE__ */ T(H, {
|
|
3588
3577
|
properties: { number: r?.length },
|
|
3589
3578
|
children: ":number selected"
|
|
3590
3579
|
})
|
|
3591
|
-
}), /* @__PURE__ */ T(
|
|
3580
|
+
}), /* @__PURE__ */ T(ra, { children: Object.keys(e).map((t) => /* @__PURE__ */ T(W, {
|
|
3592
3581
|
to: "#",
|
|
3593
3582
|
onClick: () => i?.(t),
|
|
3594
3583
|
className: "dropdown-item",
|
|
@@ -3603,41 +3592,41 @@ var Xi = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ T(w, {
|
|
|
3603
3592
|
})
|
|
3604
3593
|
]
|
|
3605
3594
|
});
|
|
3606
|
-
},
|
|
3595
|
+
}, sa = Vt(({ children: e, embedded: t = !1, title: n, className: r, onAction: i }) => /* @__PURE__ */ T(mr, {
|
|
3607
3596
|
embedded: t,
|
|
3608
3597
|
onClick: i,
|
|
3609
|
-
children: /* @__PURE__ */ T(
|
|
3598
|
+
children: /* @__PURE__ */ T(la, {
|
|
3610
3599
|
title: n,
|
|
3611
3600
|
className: r,
|
|
3612
3601
|
children: e
|
|
3613
3602
|
})
|
|
3614
3603
|
}));
|
|
3615
|
-
function
|
|
3616
|
-
return (n) => /* @__PURE__ */ T(
|
|
3604
|
+
function ca(e, t) {
|
|
3605
|
+
return (n) => /* @__PURE__ */ T(mr, {
|
|
3617
3606
|
...t || {},
|
|
3618
3607
|
children: /* @__PURE__ */ T(e, { ...n })
|
|
3619
3608
|
});
|
|
3620
3609
|
}
|
|
3621
|
-
var
|
|
3622
|
-
let { data: r, handleAction: i, filterData: a, getActions: o, handleBatchAction: s } =
|
|
3610
|
+
var la = Ln(({ title: e, className: n }) => {
|
|
3611
|
+
let { data: r, handleAction: i, filterData: a, getActions: o, handleBatchAction: s } = Y(), { actionRequest: c } = z(), { location: l } = k(), u = g(null), d = o?.(lr.List), f = c.action.entity;
|
|
3623
3612
|
if (!f) throw Error("Invalid Entity");
|
|
3624
3613
|
return /* @__PURE__ */ E("section", {
|
|
3625
3614
|
className: n || "list",
|
|
3626
3615
|
children: [
|
|
3627
|
-
/* @__PURE__ */ T(
|
|
3616
|
+
/* @__PURE__ */ T(G, {
|
|
3628
3617
|
name: "header",
|
|
3629
3618
|
children: /* @__PURE__ */ E("header", {
|
|
3630
3619
|
className: "content-header d-flex flex-column flex-md-row gap-3 mb-3 justify-content-between align-items-md-center flex-wrap",
|
|
3631
|
-
children: [/* @__PURE__ */ T(
|
|
3620
|
+
children: [/* @__PURE__ */ T(G, {
|
|
3632
3621
|
name: "title",
|
|
3633
|
-
children: e !== !1 && (t.isValidElement(e) ? e : /* @__PURE__ */ T("h2", { children: /* @__PURE__ */ T(
|
|
3622
|
+
children: e !== !1 && (t.isValidElement(e) ? e : /* @__PURE__ */ T("h2", { children: /* @__PURE__ */ T(H, { children: e ?? r?.title }) }))
|
|
3634
3623
|
}), /* @__PURE__ */ E("div", {
|
|
3635
3624
|
className: "d-flex align-items-center flex-wrap gap-2",
|
|
3636
|
-
children: [/* @__PURE__ */ T(
|
|
3625
|
+
children: [/* @__PURE__ */ T(G, {
|
|
3637
3626
|
name: "actions",
|
|
3638
3627
|
children: d && d.length > 0 && /* @__PURE__ */ T("div", {
|
|
3639
3628
|
className: "btn-group",
|
|
3640
|
-
children: d.map((e, t) => /* @__PURE__ */ T(
|
|
3629
|
+
children: d.map((e, t) => /* @__PURE__ */ T(br, {
|
|
3641
3630
|
action: {
|
|
3642
3631
|
...c,
|
|
3643
3632
|
action: e
|
|
@@ -3645,49 +3634,49 @@ var ra = Nn(({ title: e, className: n }) => {
|
|
|
3645
3634
|
className: "btn btn-outline-secondary"
|
|
3646
3635
|
}, t))
|
|
3647
3636
|
})
|
|
3648
|
-
}), r?.form?.filter?.view && /* @__PURE__ */ T(
|
|
3637
|
+
}), r?.form?.filter?.view && /* @__PURE__ */ T(G, {
|
|
3649
3638
|
name: "filter",
|
|
3650
3639
|
children: /* @__PURE__ */ E("div", {
|
|
3651
3640
|
className: "btn-group",
|
|
3652
|
-
children: [/* @__PURE__ */ E(
|
|
3641
|
+
children: [/* @__PURE__ */ E(ia, {
|
|
3653
3642
|
autoClose: "outside",
|
|
3654
|
-
children: [/* @__PURE__ */ T(
|
|
3643
|
+
children: [/* @__PURE__ */ T(na, {
|
|
3655
3644
|
className: "btn dropdown-toggle btn-outline-dark",
|
|
3656
|
-
children: /* @__PURE__ */ T(
|
|
3657
|
-
}), /* @__PURE__ */ T(
|
|
3645
|
+
children: /* @__PURE__ */ T(H, { children: "Filter" })
|
|
3646
|
+
}), /* @__PURE__ */ T(ra, {
|
|
3658
3647
|
position: "end",
|
|
3659
3648
|
children: /* @__PURE__ */ T("div", {
|
|
3660
3649
|
className: "filter",
|
|
3661
|
-
children: /* @__PURE__ */ E(
|
|
3662
|
-
id: "filter_" +
|
|
3650
|
+
children: /* @__PURE__ */ E(mt, {
|
|
3651
|
+
id: "filter_" + ft(f),
|
|
3663
3652
|
ref: u,
|
|
3664
3653
|
onSubmit: (e) => i?.({
|
|
3665
3654
|
...c,
|
|
3666
|
-
query:
|
|
3655
|
+
query: fr(x(e))
|
|
3667
3656
|
}),
|
|
3668
3657
|
onReset: () => i?.({
|
|
3669
3658
|
...c,
|
|
3670
3659
|
query: void 0
|
|
3671
3660
|
}),
|
|
3672
|
-
children: [r?.form?.filter && /* @__PURE__ */ T(
|
|
3661
|
+
children: [r?.form?.filter && /* @__PURE__ */ T(q, {
|
|
3673
3662
|
view: r.form.filter.view,
|
|
3674
|
-
children: /* @__PURE__ */ T(
|
|
3663
|
+
children: /* @__PURE__ */ T(kn, {})
|
|
3675
3664
|
}), /* @__PURE__ */ E("div", {
|
|
3676
3665
|
className: "d-flex gap-2",
|
|
3677
3666
|
children: [/* @__PURE__ */ T("button", {
|
|
3678
3667
|
className: "btn btn-primary",
|
|
3679
3668
|
type: "submit",
|
|
3680
|
-
children: /* @__PURE__ */ T(
|
|
3669
|
+
children: /* @__PURE__ */ T(H, { children: "Apply Filters" })
|
|
3681
3670
|
}), /* @__PURE__ */ T("button", {
|
|
3682
3671
|
className: "btn",
|
|
3683
3672
|
type: "reset",
|
|
3684
|
-
children: /* @__PURE__ */ T(
|
|
3673
|
+
children: /* @__PURE__ */ T(H, { children: "Clear" })
|
|
3685
3674
|
})]
|
|
3686
3675
|
})]
|
|
3687
|
-
},
|
|
3676
|
+
}, zn(c, !0))
|
|
3688
3677
|
})
|
|
3689
3678
|
})]
|
|
3690
|
-
}), l.searchParams.has("filter") && /* @__PURE__ */ T(
|
|
3679
|
+
}), l.searchParams.has("filter") && /* @__PURE__ */ T(St, {
|
|
3691
3680
|
onClick: () => {
|
|
3692
3681
|
u.current?.reset();
|
|
3693
3682
|
},
|
|
@@ -3699,51 +3688,51 @@ var ra = Nn(({ title: e, className: n }) => {
|
|
|
3699
3688
|
})]
|
|
3700
3689
|
})
|
|
3701
3690
|
}),
|
|
3702
|
-
/* @__PURE__ */ T(
|
|
3691
|
+
/* @__PURE__ */ T(G, {
|
|
3703
3692
|
name: "filters",
|
|
3704
|
-
children: /* @__PURE__ */ T(
|
|
3693
|
+
children: /* @__PURE__ */ T(aa, {
|
|
3705
3694
|
formView: r.form?.filter?.view,
|
|
3706
3695
|
onClick: (e) => a?.({ excludeFilterParameters: [e] })
|
|
3707
3696
|
})
|
|
3708
3697
|
}),
|
|
3709
|
-
/* @__PURE__ */ E(
|
|
3698
|
+
/* @__PURE__ */ E(_r, {
|
|
3710
3699
|
onClick: s,
|
|
3711
|
-
children: [/* @__PURE__ */ T(
|
|
3700
|
+
children: [/* @__PURE__ */ T(oa, {}), /* @__PURE__ */ E(G, {
|
|
3712
3701
|
name: "content",
|
|
3713
|
-
children: [/* @__PURE__ */ T(
|
|
3702
|
+
children: [/* @__PURE__ */ T(U, {
|
|
3714
3703
|
prefix: "list",
|
|
3715
3704
|
view: "content",
|
|
3716
|
-
children: /* @__PURE__ */ T(
|
|
3717
|
-
}, "list"), /* @__PURE__ */ T(
|
|
3705
|
+
children: /* @__PURE__ */ T(Tr, { routeParams: c.parameters })
|
|
3706
|
+
}, "list"), /* @__PURE__ */ T(U, {
|
|
3718
3707
|
prefix: "list",
|
|
3719
3708
|
view: "paginator",
|
|
3720
|
-
children: /* @__PURE__ */ T(
|
|
3709
|
+
children: /* @__PURE__ */ T(Dr, {})
|
|
3721
3710
|
}, "paginator")]
|
|
3722
3711
|
})]
|
|
3723
3712
|
})
|
|
3724
3713
|
]
|
|
3725
3714
|
});
|
|
3726
|
-
}, { name: "list" }),
|
|
3715
|
+
}, { name: "list" }), ua = ({ view: e }) => /* @__PURE__ */ E(w, { children: [
|
|
3727
3716
|
"View \"",
|
|
3728
3717
|
e,
|
|
3729
3718
|
"\" Not found."
|
|
3730
|
-
] }),
|
|
3719
|
+
] }), da = ({ view: e, props: n }) => {
|
|
3731
3720
|
let r = {
|
|
3732
|
-
add:
|
|
3733
|
-
edit:
|
|
3734
|
-
list:
|
|
3735
|
-
}, i =
|
|
3736
|
-
return /* @__PURE__ */ T(
|
|
3721
|
+
add: ir,
|
|
3722
|
+
edit: ir,
|
|
3723
|
+
list: sa
|
|
3724
|
+
}, i = wt();
|
|
3725
|
+
return /* @__PURE__ */ T(U, {
|
|
3737
3726
|
view: e,
|
|
3738
3727
|
props: n,
|
|
3739
|
-
children: r[e] === void 0 ? /* @__PURE__ */ T(
|
|
3728
|
+
children: r[e] === void 0 ? /* @__PURE__ */ T(ua, { view: e }) : t.createElement(r[e], n)
|
|
3740
3729
|
}, i + e);
|
|
3741
|
-
},
|
|
3730
|
+
}, fa = ({ view: e, namespace: t, props: n }) => /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T(da, {
|
|
3742
3731
|
view: e,
|
|
3743
3732
|
props: n
|
|
3744
|
-
}) }),
|
|
3745
|
-
function
|
|
3746
|
-
let { modal: e, setModal: n } = t.useContext(
|
|
3733
|
+
}) }), pa = t.createContext({});
|
|
3734
|
+
function ma() {
|
|
3735
|
+
let { modal: e, setModal: n } = t.useContext(pa);
|
|
3747
3736
|
return {
|
|
3748
3737
|
modal: e,
|
|
3749
3738
|
openModal: (e) => {
|
|
@@ -3754,75 +3743,75 @@ function ca() {
|
|
|
3754
3743
|
}
|
|
3755
3744
|
};
|
|
3756
3745
|
}
|
|
3757
|
-
function
|
|
3758
|
-
let [t, n] =
|
|
3746
|
+
function ha(e) {
|
|
3747
|
+
let [t, n] = h((e, t) => {
|
|
3759
3748
|
let n = [...e];
|
|
3760
3749
|
return t ? n.push(t) : n.pop(), n;
|
|
3761
|
-
}, []), r = t[t.length - 1] ?? null, { open: i } =
|
|
3762
|
-
|
|
3750
|
+
}, []), r = t[t.length - 1] ?? null, { open: i } = er(), a = g(0);
|
|
3751
|
+
u(() => {
|
|
3763
3752
|
a.current += 1;
|
|
3764
3753
|
}, [r]);
|
|
3765
3754
|
let o = { ...r?.props || {} }, s = (e) => e ? [
|
|
3766
3755
|
e.action.action.entity,
|
|
3767
3756
|
e.action.action.namespace,
|
|
3768
3757
|
e.action.action.name
|
|
3769
|
-
].filter((e) => e).join("-") : Date.now().toString(),
|
|
3770
|
-
return /* @__PURE__ */ E(
|
|
3758
|
+
].filter((e) => e).join("-") : Date.now().toString(), c = s(r);
|
|
3759
|
+
return /* @__PURE__ */ E(pa.Provider, {
|
|
3771
3760
|
value: {
|
|
3772
3761
|
modal: r,
|
|
3773
3762
|
setModal: (e) => {
|
|
3774
|
-
|
|
3763
|
+
c !== s(e) && n(e);
|
|
3775
3764
|
}
|
|
3776
3765
|
},
|
|
3777
|
-
children: [e.children, r && /* @__PURE__ */ T(
|
|
3766
|
+
children: [e.children, r && /* @__PURE__ */ T(ge, {
|
|
3778
3767
|
fallback: (e) => {
|
|
3779
3768
|
n(null), i({
|
|
3780
3769
|
title: e?.detail ?? "Unknown Error",
|
|
3781
|
-
icon:
|
|
3770
|
+
icon: $n.denied,
|
|
3782
3771
|
actions: { close: { label: "OK" } }
|
|
3783
3772
|
});
|
|
3784
3773
|
},
|
|
3785
|
-
children: /* @__PURE__ */ T(
|
|
3774
|
+
children: /* @__PURE__ */ T(At, {
|
|
3786
3775
|
actionRequest: r.action,
|
|
3787
|
-
children: /* @__PURE__ */ T(
|
|
3776
|
+
children: /* @__PURE__ */ T(Jn, { children: /* @__PURE__ */ T(fa, {
|
|
3788
3777
|
view: r.action.action.name || "list",
|
|
3789
3778
|
props: {
|
|
3790
3779
|
modal: !0,
|
|
3791
3780
|
props: o
|
|
3792
3781
|
}
|
|
3793
|
-
})
|
|
3794
|
-
},
|
|
3782
|
+
}) })
|
|
3783
|
+
}, c)
|
|
3795
3784
|
})]
|
|
3796
3785
|
});
|
|
3797
3786
|
}
|
|
3798
3787
|
//#endregion
|
|
3799
3788
|
//#region src/context/CrudProvider.tsx
|
|
3800
|
-
var
|
|
3789
|
+
var ga = ({ children: e, config: t }) => /* @__PURE__ */ T(ye, {
|
|
3801
3790
|
config: t,
|
|
3802
|
-
children: /* @__PURE__ */ T(
|
|
3803
|
-
}),
|
|
3804
|
-
|
|
3805
|
-
},
|
|
3806
|
-
let { location: n } =
|
|
3807
|
-
return /* @__PURE__ */ T(
|
|
3791
|
+
children: /* @__PURE__ */ T(mn, { children: /* @__PURE__ */ T(xt, { children: /* @__PURE__ */ T(tr, { children: /* @__PURE__ */ T(ha, { children: e }) }) }) })
|
|
3792
|
+
}), _a = null, va = {}, ya = "dakataa_crud", ba = ({ connection: e, templates: t }) => {
|
|
3793
|
+
y.namespace[ya] = e, va.templates = t, _a = null;
|
|
3794
|
+
}, xa = () => (_a ||= y.instance({ namespace: ya }), _a), Sa = ({ children: e, fallback: t }) => {
|
|
3795
|
+
let { location: n } = k();
|
|
3796
|
+
return /* @__PURE__ */ T(ge, {
|
|
3808
3797
|
fallback: t,
|
|
3809
3798
|
resetKeys: [n.pathname, n.search],
|
|
3810
3799
|
children: e
|
|
3811
3800
|
});
|
|
3812
|
-
},
|
|
3813
|
-
let r = Object.assign(
|
|
3814
|
-
return /* @__PURE__ */ T(
|
|
3815
|
-
fallback: n ?? /* @__PURE__ */ T(
|
|
3816
|
-
children: /* @__PURE__ */ T(
|
|
3801
|
+
}, Ca = ({ children: e, config: t, errorFallback: n }) => {
|
|
3802
|
+
let r = Object.assign(va.templates ?? {}, t?.templates ?? {}), i = Se(t?.link?.prefix) || "/";
|
|
3803
|
+
return /* @__PURE__ */ T(je, { children: /* @__PURE__ */ T(Dt, { children: /* @__PURE__ */ T(Sa, {
|
|
3804
|
+
fallback: n ?? /* @__PURE__ */ T(ce, { homePath: i }),
|
|
3805
|
+
children: /* @__PURE__ */ T(ga, {
|
|
3817
3806
|
config: {
|
|
3818
|
-
...t || { env:
|
|
3807
|
+
...t || { env: _e.DEV },
|
|
3819
3808
|
templates: r
|
|
3820
3809
|
},
|
|
3821
3810
|
children: e
|
|
3822
3811
|
})
|
|
3823
3812
|
}) }) });
|
|
3824
|
-
},
|
|
3825
|
-
let { columns: t } =
|
|
3813
|
+
}, wa = ({ namespace: e }) => {
|
|
3814
|
+
let { columns: t } = Y();
|
|
3826
3815
|
return /* @__PURE__ */ T("div", {
|
|
3827
3816
|
className: "card mb-3",
|
|
3828
3817
|
children: /* @__PURE__ */ T("div", {
|
|
@@ -3830,18 +3819,18 @@ var ua = ({ children: e, config: t }) => /* @__PURE__ */ T(he, {
|
|
|
3830
3819
|
children: /* @__PURE__ */ E("div", {
|
|
3831
3820
|
className: "d-flex flex-row gap-3 align-items-start",
|
|
3832
3821
|
children: [
|
|
3833
|
-
/* @__PURE__ */ T(
|
|
3822
|
+
/* @__PURE__ */ T(vr, {}),
|
|
3834
3823
|
/* @__PURE__ */ T("div", {
|
|
3835
3824
|
className: "d-flex flex-column flex-wrap gap-2",
|
|
3836
3825
|
children: t.map((t, n) => /* @__PURE__ */ E("div", {
|
|
3837
3826
|
className: "d-flex align-items-start",
|
|
3838
3827
|
children: [/* @__PURE__ */ E("span", {
|
|
3839
3828
|
className: "text-secondary me-1",
|
|
3840
|
-
children: [/* @__PURE__ */ T(
|
|
3829
|
+
children: [/* @__PURE__ */ T(yr, {
|
|
3841
3830
|
column: t,
|
|
3842
3831
|
namespace: e
|
|
3843
3832
|
}), ":"]
|
|
3844
|
-
}), /* @__PURE__ */ T(
|
|
3833
|
+
}), /* @__PURE__ */ T(cr, {
|
|
3845
3834
|
column: t,
|
|
3846
3835
|
namespace: e
|
|
3847
3836
|
})]
|
|
@@ -3849,41 +3838,41 @@ var ua = ({ children: e, config: t }) => /* @__PURE__ */ T(he, {
|
|
|
3849
3838
|
}),
|
|
3850
3839
|
/* @__PURE__ */ T("div", {
|
|
3851
3840
|
className: "ms-auto",
|
|
3852
|
-
children: /* @__PURE__ */ T(
|
|
3841
|
+
children: /* @__PURE__ */ T(wr, { namespace: e })
|
|
3853
3842
|
})
|
|
3854
3843
|
]
|
|
3855
3844
|
})
|
|
3856
3845
|
})
|
|
3857
3846
|
});
|
|
3858
|
-
},
|
|
3859
|
-
let { items: r, primaryColumn: i, data: a } =
|
|
3860
|
-
return !!a && (r?.length ? r.map((t, r) => /* @__PURE__ */ T(
|
|
3847
|
+
}, Ta = ({ itemView: e, emptyView: t, namespace: n }) => {
|
|
3848
|
+
let { items: r, primaryColumn: i, data: a } = Y();
|
|
3849
|
+
return !!a && (r?.length ? r.map((t, r) => /* @__PURE__ */ T(sr, {
|
|
3861
3850
|
index: r,
|
|
3862
3851
|
id: t[i?.field || ""] ?? void 0,
|
|
3863
3852
|
data: t,
|
|
3864
|
-
children: /* @__PURE__ */ T(
|
|
3853
|
+
children: /* @__PURE__ */ T(U, {
|
|
3865
3854
|
namespace: n,
|
|
3866
3855
|
prefix: "list",
|
|
3867
3856
|
view: "listItem",
|
|
3868
|
-
children: e || /* @__PURE__ */ T(
|
|
3857
|
+
children: e || /* @__PURE__ */ T(wa, { namespace: n })
|
|
3869
3858
|
}, a?.entity?.data.items[r][i?.field ?? ""])
|
|
3870
|
-
}, r)) : t === void 0 ? /* @__PURE__ */ T(
|
|
3871
|
-
},
|
|
3872
|
-
let { form: t } =
|
|
3859
|
+
}, r)) : t === void 0 ? /* @__PURE__ */ T(H, { children: "No results found." }) : t);
|
|
3860
|
+
}, Ea = ({ name: e }) => {
|
|
3861
|
+
let { form: t } = J(), n = e ? t.children?.[e] : t;
|
|
3873
3862
|
if (!n) throw Error("Missing Form View for FormLabel" + (e ? ": " + e : ""));
|
|
3874
|
-
return /* @__PURE__ */ T(
|
|
3875
|
-
},
|
|
3876
|
-
let a = t.Children.toArray(n).find((n) => t.isValidElement(n) && n.type ===
|
|
3863
|
+
return /* @__PURE__ */ T(nn, { view: n });
|
|
3864
|
+
}, Da = ({ children: e }) => /* @__PURE__ */ T(w, { children: e }), Oa = s(({ name: e, children: n, parent: r, render: i }) => (n = t.Children.toArray((i ? i(r) : n) || []).map((e) => (t.isValidElement(e) && e.type === Da && (e = t.cloneElement(e, { children: r })), e)), /* @__PURE__ */ T(w, { children: n }))), ka = s(({ name: e, content: n, children: r, data: i }) => {
|
|
3865
|
+
let a = t.Children.toArray(n).find((n) => t.isValidElement(n) && n.type === Oa && n.props.name === e), o = null;
|
|
3877
3866
|
a && t.isValidElement(a) && (o = t.cloneElement(a, {
|
|
3878
3867
|
parent: r,
|
|
3879
3868
|
data: i
|
|
3880
3869
|
}));
|
|
3881
|
-
let s = t.Children.toArray(r).filter((e) => t.isValidElement(e) && e.type !==
|
|
3870
|
+
let s = t.Children.toArray(r).filter((e) => t.isValidElement(e) && e.type !== Oa);
|
|
3882
3871
|
return /* @__PURE__ */ T(w, { children: o || (s.length ? s : r) });
|
|
3883
|
-
}),
|
|
3872
|
+
}), Aa = t.createContext(null), ja = ({ item: e }) => /* @__PURE__ */ T(Aa.Provider, {
|
|
3884
3873
|
value: e,
|
|
3885
|
-
children: e.parent?.parent ? /* @__PURE__ */ T(
|
|
3886
|
-
}),
|
|
3874
|
+
children: e.parent?.parent ? /* @__PURE__ */ T(ja, { item: e.parent }) : e.parent?.element ? e.parent.element : e.element
|
|
3875
|
+
}), Ma = () => t.useContext(Aa)?.element || "Empty", Na = ({ children: e }) => {
|
|
3887
3876
|
let t = (e, r) => n.toArray(e).reduce((e, n) => {
|
|
3888
3877
|
let i = n.props, a = (e) => e?.replace(/\/$/, ""), o = [r?.path, i?.path].filter((e) => e).map((e) => a(e)).join("/"), s = t(i.children, {
|
|
3889
3878
|
path: o,
|
|
@@ -3894,37 +3883,37 @@ var ua = ({ children: e, config: t }) => /* @__PURE__ */ T(he, {
|
|
|
3894
3883
|
element: i?.element,
|
|
3895
3884
|
parent: r
|
|
3896
3885
|
}]];
|
|
3897
|
-
}, []), r =
|
|
3886
|
+
}, []), r = g(null);
|
|
3898
3887
|
r.current === null && (r.current = t(e));
|
|
3899
|
-
let { matchPath: i } =
|
|
3888
|
+
let { matchPath: i } = k(), a = r.current.filter((e) => e.path && i(e.path, document.location.href)).shift(), [, o] = _(document.location.href), s = () => {
|
|
3900
3889
|
o(document.location.href);
|
|
3901
3890
|
};
|
|
3902
|
-
if (
|
|
3891
|
+
if (u(() => (s(), window.addEventListener("locationchange", s), () => {
|
|
3903
3892
|
window.removeEventListener("locationchange", s);
|
|
3904
|
-
}), []), a) return /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T(
|
|
3905
|
-
},
|
|
3906
|
-
let r = !!e.items?.length, { location: i, generateRoute: a } =
|
|
3907
|
-
d(e === void 0 ? !
|
|
3893
|
+
}), []), a) return /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T(ja, { item: a }) });
|
|
3894
|
+
}, Pa = (e) => null, Fa = t.createContext(null), Ia = () => t.useContext(Fa), La = ({ item: e, open: n = !1 }) => {
|
|
3895
|
+
let r = !!e.items?.length, { location: i, generateRoute: a } = k(), o = i.pathname.replace(/(.*?)\/?$/i, "$1"), s = a(e.route), c = o.includes(s, 0), [l, d] = t.useState(c), f = Ia(), p = g(null), m = g(null), h = "collapse", _ = "collapsing", v = { toggle: (e) => {
|
|
3896
|
+
d(e === void 0 ? !l : e);
|
|
3908
3897
|
} }, y = () => {
|
|
3909
|
-
p.current?.classList.remove(_), p.current?.classList.add(
|
|
3898
|
+
p.current?.classList.remove(_), p.current?.classList.add(h), p.current?.classList.toggle("show", l), p.current?.style.removeProperty("height");
|
|
3910
3899
|
}, b = () => {
|
|
3911
|
-
|
|
3900
|
+
m.current &&= (clearTimeout(m.current), null);
|
|
3912
3901
|
};
|
|
3913
|
-
return
|
|
3914
|
-
p.current?.style.setProperty("height", (
|
|
3915
|
-
}, 10),
|
|
3902
|
+
return u(() => (l && f && f.toggle(!0), p.current?.addEventListener("animationstart", b), p.current?.addEventListener("transitionstart", b), p.current?.addEventListener("animationend", y), p.current?.addEventListener("transitionend", y), p.current?.style.setProperty("height", (l ? 0 : p.current?.scrollHeight) + "px"), p.current?.classList.remove("show"), p.current?.classList.remove(h), p.current?.classList.add(_), setTimeout(() => {
|
|
3903
|
+
p.current?.style.setProperty("height", (l ? p.current?.scrollHeight : 0) + "px");
|
|
3904
|
+
}, 10), m.current = setTimeout(y, 50), () => {
|
|
3916
3905
|
b(), p.current?.removeEventListener("animationstart", b), p.current?.removeEventListener("transitionstart", b), p.current?.removeEventListener("animationend", y), p.current?.removeEventListener("transitionend", y);
|
|
3917
|
-
}), [
|
|
3918
|
-
n !==
|
|
3919
|
-
}, [n]), /* @__PURE__ */ T(
|
|
3906
|
+
}), [l]), u(() => {
|
|
3907
|
+
n !== l && d(n);
|
|
3908
|
+
}, [n]), /* @__PURE__ */ T(Fa.Provider, {
|
|
3920
3909
|
value: v,
|
|
3921
3910
|
children: /* @__PURE__ */ E("nav", {
|
|
3922
|
-
className: ["item", ...
|
|
3923
|
-
children: [/* @__PURE__ */ E(
|
|
3911
|
+
className: ["item", ...l || c ? ["active"] : []].join(" "),
|
|
3912
|
+
children: [/* @__PURE__ */ E(W, {
|
|
3924
3913
|
to: r ? "#" : a(e.route),
|
|
3925
3914
|
...e.icon && { icon: e.icon },
|
|
3926
3915
|
...r && { onClick: () => {
|
|
3927
|
-
d(!
|
|
3916
|
+
d(!l);
|
|
3928
3917
|
} },
|
|
3929
3918
|
children: [/* @__PURE__ */ T("span", { className: "icon" }), /* @__PURE__ */ T("span", {
|
|
3930
3919
|
className: "title",
|
|
@@ -3932,39 +3921,39 @@ var ua = ({ children: e, config: t }) => /* @__PURE__ */ T(he, {
|
|
|
3932
3921
|
})]
|
|
3933
3922
|
}), r && !!e.items?.length && /* @__PURE__ */ T("nav", {
|
|
3934
3923
|
ref: p,
|
|
3935
|
-
className:
|
|
3936
|
-
children: /* @__PURE__ */ T(
|
|
3924
|
+
className: h,
|
|
3925
|
+
children: /* @__PURE__ */ T(Ra, { items: e.items })
|
|
3937
3926
|
})]
|
|
3938
3927
|
})
|
|
3939
3928
|
});
|
|
3940
|
-
},
|
|
3929
|
+
}, Ra = ({ items: e }) => e.map((e) => {
|
|
3941
3930
|
let t = [parent, e.title].filter((e) => e).join("-").toLowerCase();
|
|
3942
|
-
return /* @__PURE__ */ T(
|
|
3943
|
-
}),
|
|
3944
|
-
let o =
|
|
3945
|
-
|
|
3946
|
-
let
|
|
3947
|
-
|
|
3931
|
+
return /* @__PURE__ */ T(La, { item: e }, t);
|
|
3932
|
+
}), za = o(({ items: e, className: n, open: r = !1 }, i) => {
|
|
3933
|
+
let o = g(null), [s, c] = t.useState(r);
|
|
3934
|
+
i ||= a();
|
|
3935
|
+
let l = { toggle: (e) => {
|
|
3936
|
+
c(e === void 0 ? !s : e);
|
|
3948
3937
|
} };
|
|
3949
|
-
return
|
|
3938
|
+
return f(i, () => l), u(() => {
|
|
3950
3939
|
document.body.classList.toggle("toggle-nav", s);
|
|
3951
3940
|
let e = (t) => {
|
|
3952
|
-
o.current?.contains(t.target) || (
|
|
3941
|
+
o.current?.contains(t.target) || (c(!1), document.body.removeEventListener("click", e));
|
|
3953
3942
|
};
|
|
3954
3943
|
if (s) return document.body.addEventListener("click", e), () => {
|
|
3955
3944
|
document.body.removeEventListener("click", e);
|
|
3956
3945
|
};
|
|
3957
3946
|
}, [s]), /* @__PURE__ */ T("nav", {
|
|
3958
3947
|
ref: o,
|
|
3959
|
-
children: /* @__PURE__ */ T(
|
|
3948
|
+
children: /* @__PURE__ */ T(Ra, { items: e })
|
|
3960
3949
|
});
|
|
3961
|
-
}),
|
|
3962
|
-
let n =
|
|
3963
|
-
return
|
|
3964
|
-
|
|
3950
|
+
}), Ba = ({ children: e, ...t }) => {
|
|
3951
|
+
let n = g(null), [r, i] = _([]);
|
|
3952
|
+
return u(() => {
|
|
3953
|
+
xa().get({ url: "/_crud/navigation" }).then(({ status: e, data: t }) => {
|
|
3965
3954
|
e === 200 && i(t);
|
|
3966
3955
|
});
|
|
3967
|
-
}, []), /* @__PURE__ */ E(
|
|
3956
|
+
}, []), /* @__PURE__ */ E(se, { children: [/* @__PURE__ */ T("header", { children: /* @__PURE__ */ E("div", {
|
|
3968
3957
|
className: "wrap",
|
|
3969
3958
|
children: [
|
|
3970
3959
|
/* @__PURE__ */ T("button", {
|
|
@@ -3974,7 +3963,7 @@ var ua = ({ children: e, config: t }) => /* @__PURE__ */ T(he, {
|
|
|
3974
3963
|
}),
|
|
3975
3964
|
/* @__PURE__ */ T("nav", {
|
|
3976
3965
|
className: "first-nav",
|
|
3977
|
-
children: /* @__PURE__ */ T(
|
|
3966
|
+
children: /* @__PURE__ */ T(W, {
|
|
3978
3967
|
className: "logo",
|
|
3979
3968
|
to: "/",
|
|
3980
3969
|
children: "Admin"
|
|
@@ -3982,18 +3971,18 @@ var ua = ({ children: e, config: t }) => /* @__PURE__ */ T(he, {
|
|
|
3982
3971
|
}),
|
|
3983
3972
|
/* @__PURE__ */ T("nav", {
|
|
3984
3973
|
className: "second-nav",
|
|
3985
|
-
children: /* @__PURE__ */ E(
|
|
3974
|
+
children: /* @__PURE__ */ E(ia, {
|
|
3986
3975
|
className: "user",
|
|
3987
3976
|
children: [
|
|
3988
3977
|
/* @__PURE__ */ T("span", {
|
|
3989
3978
|
className: "initials",
|
|
3990
3979
|
children: "YL"
|
|
3991
3980
|
}),
|
|
3992
|
-
/* @__PURE__ */ T(
|
|
3981
|
+
/* @__PURE__ */ T(W, {
|
|
3993
3982
|
to: "#",
|
|
3994
3983
|
children: "Yordan Lazarov"
|
|
3995
3984
|
}),
|
|
3996
|
-
/* @__PURE__ */ T(
|
|
3985
|
+
/* @__PURE__ */ T(W, {
|
|
3997
3986
|
to: "#",
|
|
3998
3987
|
children: "Logout"
|
|
3999
3988
|
})
|
|
@@ -4003,7 +3992,7 @@ var ua = ({ children: e, config: t }) => /* @__PURE__ */ T(he, {
|
|
|
4003
3992
|
]
|
|
4004
3993
|
}) }), /* @__PURE__ */ E("main", { children: [!!r.length && /* @__PURE__ */ T("div", {
|
|
4005
3994
|
className: "navigation d-print-none",
|
|
4006
|
-
children: /* @__PURE__ */ T(
|
|
3995
|
+
children: /* @__PURE__ */ T(za, {
|
|
4007
3996
|
ref: n,
|
|
4008
3997
|
items: r
|
|
4009
3998
|
})
|
|
@@ -4011,8 +4000,8 @@ var ua = ({ children: e, config: t }) => /* @__PURE__ */ T(he, {
|
|
|
4011
4000
|
className: "content",
|
|
4012
4001
|
children: e
|
|
4013
4002
|
})] })] });
|
|
4014
|
-
},
|
|
4015
|
-
let i = Intl.NumberFormat().resolvedOptions().locale, { currency: a, locale: o } =
|
|
4003
|
+
}, Va = ({ currency: e, locale: t, children: n, precision: r = 2 }) => {
|
|
4004
|
+
let i = Intl.NumberFormat().resolvedOptions().locale, { currency: a, locale: o } = O();
|
|
4016
4005
|
e ??= a ?? "EUR", t ??= o ?? i;
|
|
4017
4006
|
let s = Number(n);
|
|
4018
4007
|
return /* @__PURE__ */ T(w, { children: !isNaN(s) && s.toLocaleString(t, {
|
|
@@ -4022,4 +4011,4 @@ var ua = ({ children: e, config: t }) => /* @__PURE__ */ T(he, {
|
|
|
4022
4011
|
}) });
|
|
4023
4012
|
};
|
|
4024
4013
|
//#endregion
|
|
4025
|
-
export {
|
|
4014
|
+
export { br as ActionLink, je as ActionProvider, lr as ActionVisibility, $n as AlertIcon, tr as AlertProvider, Ln as AsTemplate, En as BaseFormFieldError, On as BaseFormGroup, rn as BaseFormHelp, nn as BaseFormLabel, se as BaseLayout, G as Block, St as Button, un as Choice, ln as ChoiceGroupOption, cn as ChoiceOption, vn as Collection, Sn as CollectionItem, yn as CollectionList, ye as ConfigProvider, Ca as Crud, ba as CrudConfiguration, Gn as CrudForm, jt as CrudLoader, ga as CrudProvider, xa as CrudRequester, At as CurrentActionRequestProvider, Bt as DataContextProvider, Rt as DataProvider, ia as Dropdown, na as DropdownButton, ra as DropdownContent, U as DynamicView, _e as Environment, ge as ErrorBoundary, D as Exception, K as Extend, mt as Form, Dn as FormError, Tn as FormField, kn as FormFieldViewLoader, Qt as FormGroup, Ea as FormLabel, An as FormRest, jn as FormRestError, tn as FormSetting, q as FormViewProvider, A as FormViewTypeEnum, It as GetData, Lt as GetDataByAction, Tr as GridView, oe as HttpException, dn as Input, Sr as IsListItemActionGranted, Cr as ItemAction, W as Link, sa as List, la as ListInner, wa as ListItem, sr as ListItemProvider, mr as ListProvider, Ta as ListView, Zn as LottieAnimation, Ba as MainLayout, Xn as Modal, ha as ModalProvider, ir as Modify, Va as Money, Ma as Outlet, Dr as Paginator, In as Parent, Pa as Route, Na as Router, sn as SelectGroupOption, on as SelectOption, Pn as Template, ka as TemplateBlock, Oa as TemplateExtend, Da as TemplateParentBlock, H as Translation, k as UseActions, er as UseAlert, _n as UseCollection, xn as UseCollectionItem, O as UseConfig, Ot as UseCurrentActionCollection, z as UseCurrentActionRequest, B as UseDataProvider, Jt as UseDynamicView, R as UseForm, en as UseFormSettings, J as UseFormView, Y as UseList, or as UseListItem, ma as UseModal, V as UseTranslate, fa as ViewLoader, Me as WithActionProviderContext, nr as WithAlertProvider, Vt as WithDataProvider, ca as WithListProvider, Ce as addPathPrefix, Wt as capitalize, Ne as choiceList, j as choiceToken, Ut as maskEmail, ft as nameToId, Se as normalizePathPrefix, dr as objectKeyDiff, ur as objectKeyIntersect, fr as objectRemoveEmpty, we as removePathPrefix, I as resolveAttribute, Pe as selectionTokens, Gt as titlize, ut as useFormErrors, lt as useFormField, at as useFormState, ot as useFormValue, st as useFormValues, qn as useIsModal, xr as useListItemActionGranted };
|