@luminix/mui-cms 0.1.10 → 0.1.12
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/bundle/mui-cms.bundle.iife.js +8 -8
- package/dist/mui-cms.js +70 -66
- package/package.json +1 -1
- package/types/dist.d.ts +2 -1
- package/types/services/IconService.d.ts +1 -0
package/dist/mui-cms.js
CHANGED
|
@@ -10,7 +10,7 @@ import h, { useContext as xn, useMemo as ns } from "react";
|
|
|
10
10
|
import { useTranslation as L, initReactI18next as rs } from "react-i18next";
|
|
11
11
|
import { Close as Me, ArrowDropDown as Cn, ChevronLeft as Ne, ChevronRight as je, HighlightOffOutlined as lt, AddCircleOutline as En, FilterList as kn, Menu as Tn, LastPage as Dn, FirstPage as On, Search as ct, SwapVert as Rn, ArrowUpward as Pn, ArrowDownward as vn, MoreVert as Rt, ExpandLess as Fn, ExpandMore as Bn, Add as ss, CategoryOutlined as os, DashboardOutlined as as, PeopleOutlined as is } from "@mui/icons-material";
|
|
12
12
|
import { useTheme as Pt, styled as Z, createTheme as ls, ThemeProvider as cs } from "@mui/material/styles";
|
|
13
|
-
import { Str as
|
|
13
|
+
import { Str as k, Obj as G, Query as Ln, DateTime as Yt, Func as us, MakeFacade as vt, Reducible as In, ServiceProvider as Mn } from "@luminix/support";
|
|
14
14
|
import Jt from "react-dom";
|
|
15
15
|
import J from "i18next";
|
|
16
16
|
const ds = {
|
|
@@ -218,17 +218,17 @@ const Ft = h.createContext({
|
|
|
218
218
|
},
|
|
219
219
|
...Object.entries(o).flatMap(([a, l]) => [
|
|
220
220
|
{
|
|
221
|
-
path: "/" +
|
|
221
|
+
path: "/" + k.kebab(l.plural()),
|
|
222
222
|
name: `luminix.cms.${a}.index`,
|
|
223
223
|
element: /* @__PURE__ */ i(Je, { Model: l, children: /* @__PURE__ */ i(Ar, { factory: l.query, children: /* @__PURE__ */ i(r, {}) }) })
|
|
224
224
|
},
|
|
225
225
|
{
|
|
226
|
-
path: "/" +
|
|
226
|
+
path: "/" + k.kebab(l.plural()) + "/create",
|
|
227
227
|
name: `luminix.cms.${a}.item`,
|
|
228
228
|
element: /* @__PURE__ */ i(Je, { Model: l, children: /* @__PURE__ */ i(s, { create: !0 }) })
|
|
229
229
|
},
|
|
230
230
|
{
|
|
231
|
-
path: "/" +
|
|
231
|
+
path: "/" + k.kebab(l.plural()) + "/:id",
|
|
232
232
|
name: `luminix.cms.${a}.item`,
|
|
233
233
|
element: /* @__PURE__ */ i(Je, { Model: l, children: /* @__PURE__ */ i(s, {}) })
|
|
234
234
|
}
|
|
@@ -701,11 +701,11 @@ function He(e, t, n) {
|
|
|
701
701
|
if (p.endsWith(m, "{}"))
|
|
702
702
|
m = r ? m : m.slice(0, -2), b = JSON.stringify(b);
|
|
703
703
|
else if (p.isArray(b) && po(b) || (p.isFileList(b) || p.endsWith(m, "[]")) && (x = p.toArray(b)))
|
|
704
|
-
return m = Jn(m), x.forEach(function(
|
|
705
|
-
!(p.isUndefined(
|
|
704
|
+
return m = Jn(m), x.forEach(function(E, P) {
|
|
705
|
+
!(p.isUndefined(E) || E === null) && t.append(
|
|
706
706
|
// eslint-disable-next-line no-nested-ternary
|
|
707
707
|
a === !0 ? Xt([m], P, o) : a === null ? m : m + "[]",
|
|
708
|
-
u(
|
|
708
|
+
u(E)
|
|
709
709
|
);
|
|
710
710
|
}), !1;
|
|
711
711
|
}
|
|
@@ -1413,13 +1413,13 @@ const rr = (e) => {
|
|
|
1413
1413
|
function x() {
|
|
1414
1414
|
if (!g)
|
|
1415
1415
|
return;
|
|
1416
|
-
const
|
|
1416
|
+
const E = U.from(
|
|
1417
1417
|
"getAllResponseHeaders" in g && g.getAllResponseHeaders()
|
|
1418
1418
|
), O = {
|
|
1419
1419
|
data: !l || l === "text" || l === "json" ? g.responseText : g.response,
|
|
1420
1420
|
status: g.status,
|
|
1421
1421
|
statusText: g.statusText,
|
|
1422
|
-
headers:
|
|
1422
|
+
headers: E,
|
|
1423
1423
|
config: e,
|
|
1424
1424
|
request: g
|
|
1425
1425
|
};
|
|
@@ -1446,8 +1446,8 @@ const rr = (e) => {
|
|
|
1446
1446
|
)), g = null;
|
|
1447
1447
|
}, o === void 0 && a.setContentType(null), "setRequestHeader" in g && p.forEach(a.toJSON(), function(P, O) {
|
|
1448
1448
|
g.setRequestHeader(O, P);
|
|
1449
|
-
}), p.isUndefined(s.withCredentials) || (g.withCredentials = !!s.withCredentials), l && l !== "json" && (g.responseType = s.responseType), u && ([y, b] = Fe(u, !0), g.addEventListener("progress", y)), d && g.upload && ([f, S] = Fe(d), g.upload.addEventListener("progress", f), g.upload.addEventListener("loadend", S)), (s.cancelToken || s.signal) && (c = (
|
|
1450
|
-
g && (r(!
|
|
1449
|
+
}), p.isUndefined(s.withCredentials) || (g.withCredentials = !!s.withCredentials), l && l !== "json" && (g.responseType = s.responseType), u && ([y, b] = Fe(u, !0), g.addEventListener("progress", y)), d && g.upload && ([f, S] = Fe(d), g.upload.addEventListener("progress", f), g.upload.addEventListener("loadend", S)), (s.cancelToken || s.signal) && (c = (E) => {
|
|
1450
|
+
g && (r(!E || E.type ? new he(null, e, g) : E), g.abort(), g = null);
|
|
1451
1451
|
}, s.cancelToken && s.cancelToken.subscribe(c), s.signal && (s.signal.aborted ? c() : s.signal.addEventListener("abort", c)));
|
|
1452
1452
|
const A = Lo(s.url);
|
|
1453
1453
|
if (A && j.protocols.indexOf(A) === -1) {
|
|
@@ -1627,8 +1627,8 @@ const Jo = async (e) => {
|
|
|
1627
1627
|
credentials: x ? f : void 0
|
|
1628
1628
|
});
|
|
1629
1629
|
let A = await fetch(b);
|
|
1630
|
-
const
|
|
1631
|
-
if (ht && (l ||
|
|
1630
|
+
const E = ht && (u === "stream" || u === "response");
|
|
1631
|
+
if (ht && (l || E && m)) {
|
|
1632
1632
|
const O = {};
|
|
1633
1633
|
["status", "statusText", "headers"].forEach((Ee) => {
|
|
1634
1634
|
O[Ee] = A[Ee];
|
|
@@ -1646,7 +1646,7 @@ const Jo = async (e) => {
|
|
|
1646
1646
|
}
|
|
1647
1647
|
u = u || "text";
|
|
1648
1648
|
let P = await Be[p.findKey(Be, u) || "text"](A, e);
|
|
1649
|
-
return !
|
|
1649
|
+
return !E && m && m(), await new Promise((O, R) => {
|
|
1650
1650
|
tr(O, R, {
|
|
1651
1651
|
data: P,
|
|
1652
1652
|
headers: U.from(A.headers),
|
|
@@ -2121,14 +2121,14 @@ const oa = ({ create: e = !1 }) => {
|
|
|
2121
2121
|
e ? n(new l()) : l.find(r).then((S) => n(S ?? void 0));
|
|
2122
2122
|
}, [r, l, e]);
|
|
2123
2123
|
const c = h.useCallback(() => {
|
|
2124
|
-
o(s(":model saved successfully", { model: l.singular() })), t != null && t.wasRecentlyCreated && a(`/${
|
|
2124
|
+
o(s(":model saved successfully", { model: l.singular() })), t != null && t.wasRecentlyCreated && a(`/${k.kebab(l.plural())}/${t.getKey()}`);
|
|
2125
2125
|
}, [o, a, l, t, s]), f = sa(), y = h.useMemo(() => T("cms").getModelFormProps(t), [t]);
|
|
2126
2126
|
return t ? /* @__PURE__ */ w(Q, { container: !0, children: [
|
|
2127
2127
|
/* @__PURE__ */ i(Q, { xs: 12, children: /* @__PURE__ */ i(
|
|
2128
2128
|
u,
|
|
2129
2129
|
{
|
|
2130
2130
|
parts: [
|
|
2131
|
-
{ name: l.plural(), href: "/" +
|
|
2131
|
+
{ name: l.plural(), href: "/" + k.kebab(l.plural()) },
|
|
2132
2132
|
{ name: t.exists ? t.getLabel() : s("New") }
|
|
2133
2133
|
]
|
|
2134
2134
|
}
|
|
@@ -2263,7 +2263,7 @@ const la = Z(Rr)(({ theme: e }) => ({
|
|
|
2263
2263
|
oe,
|
|
2264
2264
|
{
|
|
2265
2265
|
selected: A === d,
|
|
2266
|
-
onClick: (
|
|
2266
|
+
onClick: (E) => y(E, A),
|
|
2267
2267
|
children: x.label
|
|
2268
2268
|
},
|
|
2269
2269
|
x.label
|
|
@@ -2543,7 +2543,7 @@ const dn = (e, t) => ({
|
|
|
2543
2543
|
function Ta(e, t) {
|
|
2544
2544
|
const n = T("filter"), { Model: r, setColumnsFilter: s } = h.useContext(_t), [o, a] = h.useState(t.key), [l, d] = h.useState(t.operator), [u, c] = h.useState(t.type), [f, y] = h.useState(t.value), [S, b] = h.useState(t.nullable), [m, g] = h.useState(t.is_relation), x = h.useMemo(() => n.getFilterableColumns(r), [r]), A = (O) => () => {
|
|
2545
2545
|
s((R) => R.filter((D, z) => z !== O));
|
|
2546
|
-
},
|
|
2546
|
+
}, E = async (O) => {
|
|
2547
2547
|
const R = O.target.value, D = x.find((hr) => hr.key === R), z = (D == null ? void 0 : D.type) ?? "text", Ee = (D == null ? void 0 : D.nullable) ?? !1, Wt = (D == null ? void 0 : D.is_relation) ?? !1;
|
|
2548
2548
|
Wt ? (d("relation"), y([])) : m && d("equals"), g(Wt), b(Ee), z !== u && (d("equals"), y(() => {
|
|
2549
2549
|
if (["between", "notBetween"].includes(l))
|
|
@@ -2596,7 +2596,7 @@ function Ta(e, t) {
|
|
|
2596
2596
|
setNullable: b,
|
|
2597
2597
|
isRelation: m,
|
|
2598
2598
|
setIsRelation: g,
|
|
2599
|
-
handleKey:
|
|
2599
|
+
handleKey: E,
|
|
2600
2600
|
handleOperator: P,
|
|
2601
2601
|
handleRemoveColumn: A
|
|
2602
2602
|
};
|
|
@@ -2792,7 +2792,7 @@ const pn = async (e, t, n) => {
|
|
|
2792
2792
|
isRelation: g,
|
|
2793
2793
|
setIsRelation: x,
|
|
2794
2794
|
handleKey: A,
|
|
2795
|
-
handleOperator:
|
|
2795
|
+
handleOperator: E,
|
|
2796
2796
|
handleRemoveColumn: P
|
|
2797
2797
|
} = Ta(e, t), O = ["boolean"].includes(o.getInputType(y));
|
|
2798
2798
|
return /* @__PURE__ */ i(
|
|
@@ -2918,7 +2918,7 @@ const pn = async (e, t, n) => {
|
|
|
2918
2918
|
id: "filter-operator-select",
|
|
2919
2919
|
value: c,
|
|
2920
2920
|
label: n("Operator"),
|
|
2921
|
-
onChange:
|
|
2921
|
+
onChange: E,
|
|
2922
2922
|
size: "small",
|
|
2923
2923
|
children: a.map(({ key: R, label: D }) => /* @__PURE__ */ i(
|
|
2924
2924
|
oe,
|
|
@@ -3052,15 +3052,15 @@ const pn = async (e, t, n) => {
|
|
|
3052
3052
|
Object.entries(a).forEach(([l, d]) => {
|
|
3053
3053
|
e.filter((u) => {
|
|
3054
3054
|
const c = (() => {
|
|
3055
|
-
const y =
|
|
3055
|
+
const y = k.camel(l.split(k.camel(u.key))[1]);
|
|
3056
3056
|
return G.isEmpty(y) ? "equals" : y;
|
|
3057
3057
|
})();
|
|
3058
3058
|
if (!n.getOperators().includes(c))
|
|
3059
3059
|
return !1;
|
|
3060
|
-
const f =
|
|
3060
|
+
const f = k.snake(l.split(k.ucfirst(c))[0]);
|
|
3061
3061
|
return u.key === f;
|
|
3062
3062
|
}).forEach((u) => {
|
|
3063
|
-
let c =
|
|
3063
|
+
let c = k.camel(l.split(k.camel(u.key))[1]);
|
|
3064
3064
|
(typeof c > "u" || c === null || G.isEmpty(c)) && (c = "equals");
|
|
3065
3065
|
let f = d;
|
|
3066
3066
|
switch (n.getInputType(u.type)) {
|
|
@@ -3092,8 +3092,8 @@ const pn = async (e, t, n) => {
|
|
|
3092
3092
|
const t = T("filter"), n = new URLSearchParams();
|
|
3093
3093
|
return e.forEach((r) => {
|
|
3094
3094
|
const { key: s, operator: o, value: a, type: l } = r;
|
|
3095
|
-
let d =
|
|
3096
|
-
if (["equals"].includes(
|
|
3095
|
+
let d = `:${o}`;
|
|
3096
|
+
if (["equals"].includes(o) && (d = ""), Array.isArray(a))
|
|
3097
3097
|
a.forEach((u, c) => {
|
|
3098
3098
|
let f = u;
|
|
3099
3099
|
switch (t.getInputType(l)) {
|
|
@@ -3102,7 +3102,7 @@ const pn = async (e, t, n) => {
|
|
|
3102
3102
|
break;
|
|
3103
3103
|
}
|
|
3104
3104
|
}
|
|
3105
|
-
n.set(`where[${
|
|
3105
|
+
n.set(`where[${s}${d}][${c}]`, f);
|
|
3106
3106
|
});
|
|
3107
3107
|
else {
|
|
3108
3108
|
let u = a;
|
|
@@ -3112,7 +3112,7 @@ const pn = async (e, t, n) => {
|
|
|
3112
3112
|
break;
|
|
3113
3113
|
}
|
|
3114
3114
|
}
|
|
3115
|
-
n.set(`where[${
|
|
3115
|
+
n.set(`where[${s}${d}]`, u);
|
|
3116
3116
|
}
|
|
3117
3117
|
}), n;
|
|
3118
3118
|
}, La = () => {
|
|
@@ -3128,10 +3128,10 @@ const pn = async (e, t, n) => {
|
|
|
3128
3128
|
o(A, { replace: !0 }), b();
|
|
3129
3129
|
}, g = () => {
|
|
3130
3130
|
o((A) => {
|
|
3131
|
-
const
|
|
3131
|
+
const E = new URLSearchParams(A);
|
|
3132
3132
|
for (const [P] of A.entries())
|
|
3133
|
-
P.startsWith("where[") &&
|
|
3134
|
-
return
|
|
3133
|
+
P.startsWith("where[") && E.delete(P);
|
|
3134
|
+
return E;
|
|
3135
3135
|
});
|
|
3136
3136
|
}, x = () => {
|
|
3137
3137
|
g(), b(), setTimeout(() => {
|
|
@@ -3636,13 +3636,13 @@ const Ha = Z(Ae)(({ theme: e }) => ({
|
|
|
3636
3636
|
return;
|
|
3637
3637
|
}
|
|
3638
3638
|
n((A) => {
|
|
3639
|
-
const
|
|
3640
|
-
return
|
|
3639
|
+
const E = new URLSearchParams(A);
|
|
3640
|
+
return E.set("order_by", `${d}:${c}`), E;
|
|
3641
3641
|
}), S(!1);
|
|
3642
3642
|
}, x = () => {
|
|
3643
3643
|
n((A) => {
|
|
3644
|
-
const
|
|
3645
|
-
return
|
|
3644
|
+
const E = new URLSearchParams(A);
|
|
3645
|
+
return E.delete("order_by"), E;
|
|
3646
3646
|
}), S(!1), u(""), f("");
|
|
3647
3647
|
};
|
|
3648
3648
|
return /* @__PURE__ */ w(B, { children: [
|
|
@@ -3678,12 +3678,12 @@ const Ha = Z(Ae)(({ theme: e }) => ({
|
|
|
3678
3678
|
children: [
|
|
3679
3679
|
/* @__PURE__ */ i($, { variant: "caption", children: e("Column") }),
|
|
3680
3680
|
/* @__PURE__ */ i(Pe, {}),
|
|
3681
|
-
W(r).whereStrict("sortable", "!=", !1).map(({ key: A, label:
|
|
3681
|
+
W(r).whereStrict("sortable", "!=", !1).map(({ key: A, label: E }) => /* @__PURE__ */ i(
|
|
3682
3682
|
$e,
|
|
3683
3683
|
{
|
|
3684
3684
|
value: A,
|
|
3685
3685
|
control: /* @__PURE__ */ i(Ke, {}),
|
|
3686
|
-
label:
|
|
3686
|
+
label: E
|
|
3687
3687
|
},
|
|
3688
3688
|
A
|
|
3689
3689
|
))
|
|
@@ -3734,11 +3734,11 @@ const Ha = Z(Ae)(({ theme: e }) => ({
|
|
|
3734
3734
|
const s = te(), o = h.useMemo(() => W([]), [s, e]), [a] = K(), l = a.get("tab") ?? "all", d = h.useMemo(() => [
|
|
3735
3735
|
{
|
|
3736
3736
|
key: s.getSchema().labeledBy,
|
|
3737
|
-
label:
|
|
3737
|
+
label: k.human(s.getSchema().labeledBy)
|
|
3738
3738
|
}
|
|
3739
3739
|
], [s]), u = v(), c = h.useMemo(() => T("cms").getMassActions(s, l), [s, l]), f = At(
|
|
3740
3740
|
T("cms"),
|
|
3741
|
-
`model${
|
|
3741
|
+
`model${k.studly(s.getSchemaName())}Columns`,
|
|
3742
3742
|
d
|
|
3743
3743
|
), S = (u ? f.length : 1) + (c.length > 0 ? 2 : 1), b = {
|
|
3744
3744
|
columns: f,
|
|
@@ -3797,11 +3797,11 @@ const Ha = Z(Ae)(({ theme: e }) => ({
|
|
|
3797
3797
|
disabled: s && s.count() === 0
|
|
3798
3798
|
}
|
|
3799
3799
|
) }),
|
|
3800
|
-
r.map(({ key: g, label: x, sortable: A = !0, ...
|
|
3800
|
+
r.map(({ key: g, label: x, sortable: A = !0, ...E }) => /* @__PURE__ */ i(
|
|
3801
3801
|
ee,
|
|
3802
3802
|
{
|
|
3803
3803
|
sortDirection: A && S === g && b || !1,
|
|
3804
|
-
...
|
|
3804
|
+
...E,
|
|
3805
3805
|
children: /* @__PURE__ */ w(
|
|
3806
3806
|
Kr,
|
|
3807
3807
|
{
|
|
@@ -3909,7 +3909,7 @@ const I = vt(Xa, wt), de = Z($)(() => ({
|
|
|
3909
3909
|
] }), ti = ({ item: e, ...t }) => {
|
|
3910
3910
|
const n = v(), r = St(), s = te(), { massActions: o, columns: a } = ae(), l = h.useMemo(() => a.map((y) => ({
|
|
3911
3911
|
...y,
|
|
3912
|
-
content: I[`model${
|
|
3912
|
+
content: I[`model${k.studly(e.getType())}Get${k.studly(y.key)}Content`](e.getAttribute(y.key), e)
|
|
3913
3913
|
})), [a, e]), {
|
|
3914
3914
|
["ModelIndex.Table.ShrinkedCell"]: d,
|
|
3915
3915
|
["ModelIndex.InstanceActions"]: u
|
|
@@ -3937,7 +3937,7 @@ const I = vt(Xa, wt), de = Z($)(() => ({
|
|
|
3937
3937
|
{
|
|
3938
3938
|
...g,
|
|
3939
3939
|
onClick: () => {
|
|
3940
|
-
e.deletedAt || r(`/${
|
|
3940
|
+
e.deletedAt || r(`/${k.kebab(s.plural())}/${e.getKey()}`);
|
|
3941
3941
|
},
|
|
3942
3942
|
children: /* @__PURE__ */ i(
|
|
3943
3943
|
Qa,
|
|
@@ -3954,7 +3954,7 @@ const I = vt(Xa, wt), de = Z($)(() => ({
|
|
|
3954
3954
|
{
|
|
3955
3955
|
sx: { maxWidth: 0, px: 0 },
|
|
3956
3956
|
onClick: () => {
|
|
3957
|
-
e.deletedAt || r(`/${
|
|
3957
|
+
e.deletedAt || r(`/${k.kebab(s.plural())}/${e.getKey()}`);
|
|
3958
3958
|
},
|
|
3959
3959
|
children: l.map(({ key: y, ...S }) => /* @__PURE__ */ i(ei, { ...S }, y))
|
|
3960
3960
|
}
|
|
@@ -4064,7 +4064,7 @@ function si() {
|
|
|
4064
4064
|
});
|
|
4065
4065
|
}, a = h.useMemo(() => e.getSchema().softDeletes ? [{ label: t("Trashed"), value: "trashed" }] : [], [e, t]), l = At(
|
|
4066
4066
|
T("cms"),
|
|
4067
|
-
`model${
|
|
4067
|
+
`model${k.studly(e.getSchemaName())}Tabs`,
|
|
4068
4068
|
a
|
|
4069
4069
|
);
|
|
4070
4070
|
return l.length === 0 ? null : /* @__PURE__ */ i(V, { sx: { maxWidth: { xs: 320, sm: 480 }, bgcolor: "background.paper" }, children: /* @__PURE__ */ w(
|
|
@@ -4155,7 +4155,7 @@ const fr = ({
|
|
|
4155
4155
|
key: g,
|
|
4156
4156
|
children: x,
|
|
4157
4157
|
to: A,
|
|
4158
|
-
onClick:
|
|
4158
|
+
onClick: E
|
|
4159
4159
|
} = y;
|
|
4160
4160
|
return m || /* @__PURE__ */ w(
|
|
4161
4161
|
Qr,
|
|
@@ -4172,7 +4172,7 @@ const fr = ({
|
|
|
4172
4172
|
px: 2.5
|
|
4173
4173
|
},
|
|
4174
4174
|
onClick: (P) => {
|
|
4175
|
-
if (
|
|
4175
|
+
if (E && E(P), x) {
|
|
4176
4176
|
if (e) {
|
|
4177
4177
|
l(() => (o(P.currentTarget), x));
|
|
4178
4178
|
return;
|
|
@@ -4337,14 +4337,14 @@ const fr = ({
|
|
|
4337
4337
|
title: e.getSchema().softDeletes ? o("Confirm send to trash") : o("Confirm delete permanently"),
|
|
4338
4338
|
message: o(`Are you sure you want to ${a} :count :model?`, {
|
|
4339
4339
|
count: t.count(),
|
|
4340
|
-
model:
|
|
4340
|
+
model: k.lcfirst(t.count() === 1 ? e.singular() : e.plural())
|
|
4341
4341
|
}),
|
|
4342
4342
|
type: "confirm"
|
|
4343
4343
|
}))
|
|
4344
4344
|
try {
|
|
4345
4345
|
await e.delete(t.pluck(e.getSchema().primaryKey).all()), n(o(`Successfully ${l} :count :model`, {
|
|
4346
4346
|
count: t.count(),
|
|
4347
|
-
model:
|
|
4347
|
+
model: k.lcfirst(t.count() === 1 ? e.singular() : e.plural())
|
|
4348
4348
|
})), s();
|
|
4349
4349
|
} catch (u) {
|
|
4350
4350
|
ce(n)(u);
|
|
@@ -4355,14 +4355,14 @@ const fr = ({
|
|
|
4355
4355
|
title: o("Confirm restore"),
|
|
4356
4356
|
message: o("Are you sure you want to restore :count :model?", {
|
|
4357
4357
|
count: t.count(),
|
|
4358
|
-
model:
|
|
4358
|
+
model: k.lcfirst(t.count() === 1 ? e.singular() : e.plural())
|
|
4359
4359
|
}),
|
|
4360
4360
|
type: "confirm"
|
|
4361
4361
|
}))
|
|
4362
4362
|
try {
|
|
4363
4363
|
await e.restore(t.pluck(e.getSchema().primaryKey).all()), n(o("Successfully restored :count :model", {
|
|
4364
4364
|
count: t.count(),
|
|
4365
|
-
model:
|
|
4365
|
+
model: k.lcfirst(t.count() === 1 ? e.singular() : e.plural())
|
|
4366
4366
|
})), s();
|
|
4367
4367
|
} catch (l) {
|
|
4368
4368
|
ce(n)(l);
|
|
@@ -4373,14 +4373,14 @@ const fr = ({
|
|
|
4373
4373
|
title: o("Confirm permanent deletion"),
|
|
4374
4374
|
message: o("Are you sure you want to delete permanently :count :model?", {
|
|
4375
4375
|
count: t.count(),
|
|
4376
|
-
model:
|
|
4376
|
+
model: k.lcfirst(t.count() === 1 ? e.singular() : e.plural())
|
|
4377
4377
|
}),
|
|
4378
4378
|
type: "confirm"
|
|
4379
4379
|
}))
|
|
4380
4380
|
try {
|
|
4381
4381
|
await e.forceDelete(t.pluck(e.getSchema().primaryKey).all()), n(o("Successfully deleted :count :model", {
|
|
4382
4382
|
count: t.count(),
|
|
4383
|
-
model:
|
|
4383
|
+
model: k.lcfirst(t.count() === 1 ? e.singular() : e.plural())
|
|
4384
4384
|
})), s();
|
|
4385
4385
|
} catch (l) {
|
|
4386
4386
|
ce(n)(l);
|
|
@@ -4392,7 +4392,7 @@ const fr = ({
|
|
|
4392
4392
|
if (await r({
|
|
4393
4393
|
title: e.getSchema().softDeletes ? o("Confirm send to trash") : o("Confirm permanent deletion"),
|
|
4394
4394
|
message: o(`Are you sure you want to ${a}?`, {
|
|
4395
|
-
model:
|
|
4395
|
+
model: k.lcfirst(e.singular()),
|
|
4396
4396
|
label: t.getLabel()
|
|
4397
4397
|
}),
|
|
4398
4398
|
type: "confirm"
|
|
@@ -4410,7 +4410,7 @@ const fr = ({
|
|
|
4410
4410
|
if (await r({
|
|
4411
4411
|
title: o("Confirm restore"),
|
|
4412
4412
|
message: o("Are you sure you want to restore :model “:label”?", {
|
|
4413
|
-
model:
|
|
4413
|
+
model: k.lcfirst(e.singular()),
|
|
4414
4414
|
label: t.getLabel()
|
|
4415
4415
|
}),
|
|
4416
4416
|
type: "confirm"
|
|
@@ -4428,7 +4428,7 @@ const fr = ({
|
|
|
4428
4428
|
if (await r({
|
|
4429
4429
|
title: o("Confirm permanent deletion"),
|
|
4430
4430
|
message: o("Are you sure you want to delete :model “:label” permanently?", {
|
|
4431
|
-
model:
|
|
4431
|
+
model: k.lcfirst(e.singular()),
|
|
4432
4432
|
label: t.getLabel()
|
|
4433
4433
|
}),
|
|
4434
4434
|
type: "confirm"
|
|
@@ -4444,7 +4444,7 @@ const fr = ({
|
|
|
4444
4444
|
}
|
|
4445
4445
|
}, ai = {
|
|
4446
4446
|
create: (e) => ({ navigate: t }) => {
|
|
4447
|
-
t(`/${
|
|
4447
|
+
t(`/${k.kebab(e.plural())}/create`);
|
|
4448
4448
|
}
|
|
4449
4449
|
}, ii = ({ item: e }) => {
|
|
4450
4450
|
const t = Ut(), [n] = K(), r = n.get("tab") ?? "all", s = h.useMemo(() => T("cms").getInstanceActions(e.constructor, r), [e, r]), [o, a] = h.useState(null), l = !!o, d = (c) => {
|
|
@@ -4512,21 +4512,21 @@ class li {
|
|
|
4512
4512
|
return this.wireModelFormProps({}, t);
|
|
4513
4513
|
}
|
|
4514
4514
|
getMassActions(t, n) {
|
|
4515
|
-
return this[`mass${
|
|
4515
|
+
return this[`mass${k.studly(t.getSchemaName())}Actions`](
|
|
4516
4516
|
this.massActions([], t, n),
|
|
4517
4517
|
t,
|
|
4518
4518
|
n
|
|
4519
4519
|
);
|
|
4520
4520
|
}
|
|
4521
4521
|
getInstanceActions(t, n) {
|
|
4522
|
-
return this[`instance${
|
|
4522
|
+
return this[`instance${k.studly(t.getSchemaName())}Actions`](
|
|
4523
4523
|
this.instanceActions([], t, n),
|
|
4524
4524
|
t,
|
|
4525
4525
|
n
|
|
4526
4526
|
);
|
|
4527
4527
|
}
|
|
4528
4528
|
getStaticActions(t, n) {
|
|
4529
|
-
return this[`static${
|
|
4529
|
+
return this[`static${k.studly(t.getSchemaName())}Actions`](
|
|
4530
4530
|
this.staticActions([], t, n),
|
|
4531
4531
|
t,
|
|
4532
4532
|
n
|
|
@@ -4588,7 +4588,7 @@ class ui {
|
|
|
4588
4588
|
r = "<=";
|
|
4589
4589
|
break;
|
|
4590
4590
|
default:
|
|
4591
|
-
r =
|
|
4591
|
+
r = k.human(r);
|
|
4592
4592
|
break;
|
|
4593
4593
|
}
|
|
4594
4594
|
return {
|
|
@@ -4604,7 +4604,7 @@ class ui {
|
|
|
4604
4604
|
let o = s.phpType ?? "string";
|
|
4605
4605
|
return s.cast !== null && !G.isEmpty(s.cast) && (o = s.cast), {
|
|
4606
4606
|
key: s.name,
|
|
4607
|
-
label:
|
|
4607
|
+
label: k.human(s.name),
|
|
4608
4608
|
type: o,
|
|
4609
4609
|
nullable: s.nullable,
|
|
4610
4610
|
is_relation: !1
|
|
@@ -4615,7 +4615,7 @@ class ui {
|
|
|
4615
4615
|
...s,
|
|
4616
4616
|
{
|
|
4617
4617
|
key: o,
|
|
4618
|
-
label:
|
|
4618
|
+
label: k.human(o),
|
|
4619
4619
|
type: "autocomplete",
|
|
4620
4620
|
nullable: !1,
|
|
4621
4621
|
is_relation: !0
|
|
@@ -4654,7 +4654,7 @@ class fi {
|
|
|
4654
4654
|
);
|
|
4655
4655
|
}
|
|
4656
4656
|
forModel(t, n) {
|
|
4657
|
-
Oe.reducer(`model${
|
|
4657
|
+
Oe.reducer(`model${k.studly(t)}`, (r) => {
|
|
4658
4658
|
const s = this;
|
|
4659
4659
|
return class extends r {
|
|
4660
4660
|
static icon() {
|
|
@@ -4675,6 +4675,9 @@ class fi {
|
|
|
4675
4675
|
const r = this.make(t);
|
|
4676
4676
|
return r ? /* @__PURE__ */ i(r, { ...n }) : null;
|
|
4677
4677
|
}
|
|
4678
|
+
all() {
|
|
4679
|
+
return this.icons.map((t) => t.name);
|
|
4680
|
+
}
|
|
4678
4681
|
}
|
|
4679
4682
|
class pi {
|
|
4680
4683
|
getFacadeAccessor() {
|
|
@@ -4781,7 +4784,7 @@ const ke = vt(pi, wt), Le = class Le extends Mn {
|
|
|
4781
4784
|
...Object.entries(n).sort(([r], [s]) => r.localeCompare(s)).map(([r, s]) => ({
|
|
4782
4785
|
key: r,
|
|
4783
4786
|
text: s.plural(),
|
|
4784
|
-
to: "/" +
|
|
4787
|
+
to: "/" + k.kebab(s.plural()),
|
|
4785
4788
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4786
4789
|
icon: s.icon()
|
|
4787
4790
|
}))
|
|
@@ -4913,7 +4916,7 @@ class hi extends Mn {
|
|
|
4913
4916
|
translateModelColumns() {
|
|
4914
4917
|
for (const t of Object.keys(Oe.make()))
|
|
4915
4918
|
I.reducer(
|
|
4916
|
-
`model${
|
|
4919
|
+
`model${k.studly(t)}Columns`,
|
|
4917
4920
|
(n) => n.map((r) => ({
|
|
4918
4921
|
...r,
|
|
4919
4922
|
label: J.t(r.label)
|
|
@@ -5021,6 +5024,7 @@ export {
|
|
|
5021
5024
|
yt as CmsServiceProvider,
|
|
5022
5025
|
hs as DialogProvider,
|
|
5023
5026
|
Ji as Filter,
|
|
5027
|
+
ke as Icon,
|
|
5024
5028
|
fs as LayoutProvider,
|
|
5025
5029
|
We as Link,
|
|
5026
5030
|
Yi as LuminixCms,
|
package/package.json
CHANGED
package/types/dist.d.ts
CHANGED
|
@@ -23,5 +23,6 @@ import { default as useSelection } from './hooks/useSelection';
|
|
|
23
23
|
import { default as useSetPageTitle } from './hooks/useSetPageTitle';
|
|
24
24
|
import { default as useTable } from './hooks/useTable';
|
|
25
25
|
import { default as Cms } from './facades/Cms';
|
|
26
|
+
import { default as Icon } from './facades/Icon';
|
|
26
27
|
import { default as Filter } from './facades/Filter';
|
|
27
|
-
export { CmsServiceProvider, i18NextServiceProvider, LuminixCms, Link, Cms, Filter, useActionEvent, useBackButton, useCurrentModel, useDialog, useDisplaceNotifications, useHandleError, useHasSearch, useIsDesktopMode, useLayoutConfig, useMenu, useNotify, usePageTitle, useSearch, useSelection, useSetPageTitle, useTable, DialogProvider, LayoutProvider, ModelProvider, NotificationProvider, };
|
|
28
|
+
export { CmsServiceProvider, i18NextServiceProvider, LuminixCms, Link, Cms, Filter, Icon, useActionEvent, useBackButton, useCurrentModel, useDialog, useDisplaceNotifications, useHandleError, useHasSearch, useIsDesktopMode, useLayoutConfig, useMenu, useNotify, usePageTitle, useSearch, useSelection, useSetPageTitle, useTable, DialogProvider, LayoutProvider, ModelProvider, NotificationProvider, };
|