@luminix/mui-cms 0.0.1-beta.0 → 0.0.1-beta.1
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 +36 -36
- package/dist/mui-cms.js +1103 -1033
- package/package.json +1 -1
- package/types/components/ModelIndex/Filter/Content.d.ts +3 -1
- package/types/components/ModelIndex/Filter/useRow.d.ts +2 -0
- package/types/support/string.d.ts +2 -0
- package/types/types/Contexts.d.ts +1 -0
- package/types/types/Filter.d.ts +5 -0
package/dist/mui-cms.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as r, jsxs as m, Fragment as
|
|
1
|
+
var Ct = Object.defineProperty;
|
|
2
|
+
var At = (e, t, n) => t in e ? Ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var ue = (e, t, n) => At(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { jsx as r, jsxs as m, Fragment as T } from "react/jsx-runtime";
|
|
5
5
|
import f from "lodash";
|
|
6
|
-
import { Reducible as
|
|
7
|
-
import { Outlet as
|
|
8
|
-
import { useCollection as
|
|
9
|
-
import { useMediaQuery as
|
|
10
|
-
import p, { useContext as
|
|
11
|
-
import { useTranslation as
|
|
12
|
-
import { Close as
|
|
13
|
-
import { useTheme as
|
|
14
|
-
import { isAxiosError as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
class
|
|
6
|
+
import { Reducible as rt, model as ne, config as Z, collect as N, app as C, Plugin as at } from "@luminix/core";
|
|
7
|
+
import { Outlet as vt, useParams as Dt, useNavigate as Ae, useSearchParams as W, Link as oe, Form as Tt } from "react-router-dom";
|
|
8
|
+
import { useCollection as ot, PaginationProvider as Ft, usePagination as re, ModelForm as It, useApplyReducers as ve, LuminixProvider as Pt } from "@luminix/react";
|
|
9
|
+
import { useMediaQuery as ie, Dialog as De, DialogTitle as Te, DialogContent as Fe, DialogContentText as Mt, DialogActions as Ie, Button as M, Snackbar as Bt, Alert as Et, IconButton as E, AlertTitle as Lt, Box as j, Unstable_Grid2 as Y, Fab as Ot, SpeedDial as Nt, SpeedDialIcon as Rt, SpeedDialAction as jt, ButtonGroup as qt, Popper as Wt, Grow as zt, Paper as Pe, ClickAwayListener as Ut, MenuList as Vt, MenuItem as G, AppBar as st, Toolbar as Yt, Typography as q, Avatar as Kt, Drawer as lt, Divider as se, Autocomplete as $t, TextField as ae, CircularProgress as Ht, Switch as Zt, Stack as B, FormControl as we, InputLabel as ke, Select as le, Badge as Me, Popover as Gt, Link as Se, Collapse as it, TableCell as K, RadioGroup as $e, FormControlLabel as de, Radio as pe, TableContainer as Qt, Table as Xt, TableHead as Jt, TableRow as _, Checkbox as Be, TableSortLabel as _t, Skeleton as He, TableBody as en, TableFooter as tn, Tabs as nn, Tab as Ze, Breadcrumbs as rn, List as an, ListItem as on, ListItemButton as sn, ListItemIcon as ct, ListItemText as ut, Menu as dt, CssBaseline as ln } from "@mui/material";
|
|
10
|
+
import p, { useContext as pt, useMemo as cn } from "react";
|
|
11
|
+
import { useTranslation as F, initReactI18next as un } from "react-i18next";
|
|
12
|
+
import { Close as Ee, ArrowDropDown as dn, ChevronLeft as Le, ChevronRight as Oe, HighlightOffOutlined as Ge, AddCircleOutline as pn, FilterList as hn, Menu as mn, LastPage as fn, FirstPage as gn, Search as Qe, SwapVert as bn, ArrowUpward as yn, ArrowDownward as xn, MoreVert as ht, ExpandLess as wn, ExpandMore as kn, PeopleOutlined as Sn, CategoryOutlined as Cn, DashboardOutlined as An, Add as vn } from "@mui/icons-material";
|
|
13
|
+
import { useTheme as Ne, styled as U, createTheme as Dn, ThemeProvider as Tn } from "@mui/material/styles";
|
|
14
|
+
import { isAxiosError as Fn } from "axios";
|
|
15
|
+
import Xe from "react-dom";
|
|
16
|
+
import z from "i18next";
|
|
17
|
+
class In {
|
|
18
18
|
constructor() {
|
|
19
19
|
}
|
|
20
20
|
getComponents() {
|
|
@@ -24,10 +24,10 @@ class Cn {
|
|
|
24
24
|
return this.getComponents()[t];
|
|
25
25
|
}
|
|
26
26
|
getRoutes() {
|
|
27
|
-
return this.cmsRoutes([], this.getComponents(),
|
|
27
|
+
return this.cmsRoutes([], this.getComponents(), ne().make());
|
|
28
28
|
}
|
|
29
29
|
getMenuItems() {
|
|
30
|
-
return this.menuItems([],
|
|
30
|
+
return this.menuItems([], ne().make());
|
|
31
31
|
}
|
|
32
32
|
getModelFormProps(t) {
|
|
33
33
|
return this.wireModelFormProps({}, t);
|
|
@@ -54,8 +54,8 @@ class Cn {
|
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
class
|
|
57
|
+
const Pn = rt(In), te = (e) => !(f.isUndefined(e) || f.isNull(e) || f.isEmpty(e));
|
|
58
|
+
class Mn {
|
|
59
59
|
getInputType(t) {
|
|
60
60
|
switch (t) {
|
|
61
61
|
case "int":
|
|
@@ -77,14 +77,21 @@ class Dn {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
getOperators() {
|
|
80
|
-
return
|
|
80
|
+
return Z("luminix.admin.filter.operators");
|
|
81
81
|
}
|
|
82
82
|
getMatchingOperators(t) {
|
|
83
|
-
return this.getOperators().filter((n) => !t.is_relation && ["relation"].includes(n) || ["
|
|
83
|
+
return this.getOperators().filter((n) => ["like"].includes(n) || !t.is_relation && ["relation"].includes(n) || ["text"].includes(this.getInputType(t.type)) && [
|
|
84
|
+
"greaterThan",
|
|
85
|
+
"greaterThanOrEquals",
|
|
86
|
+
"lessThan",
|
|
87
|
+
"lessThanOrEquals",
|
|
88
|
+
"between",
|
|
89
|
+
"notBetween"
|
|
90
|
+
].includes(n) || ["number", "date", "datetime-local", "boolean"].includes(this.getInputType(t.type)) && ["like"].includes(n) || !t.nullable && ["null", "notNull"].includes(n) ? !1 : n).map((n) => {
|
|
84
91
|
let a = n;
|
|
85
92
|
switch (n) {
|
|
86
93
|
case "equals":
|
|
87
|
-
a = "
|
|
94
|
+
a = "=";
|
|
88
95
|
break;
|
|
89
96
|
case "notEquals":
|
|
90
97
|
a = "!=";
|
|
@@ -101,6 +108,9 @@ class Dn {
|
|
|
101
108
|
case "lessThanOrEquals":
|
|
102
109
|
a = "<=";
|
|
103
110
|
break;
|
|
111
|
+
default:
|
|
112
|
+
a = f.startCase(a);
|
|
113
|
+
break;
|
|
104
114
|
}
|
|
105
115
|
return {
|
|
106
116
|
key: n,
|
|
@@ -111,12 +121,13 @@ class Dn {
|
|
|
111
121
|
getFilterableColumns(t) {
|
|
112
122
|
const { attributes: n = [], relations: a = {} } = t.getSchema();
|
|
113
123
|
return [
|
|
114
|
-
...n.filter((s) => !s.hidden).map((s) => {
|
|
124
|
+
...n.filter((s) => !s.hidden && !s.appended).map((s) => {
|
|
115
125
|
let o = s.phpType ?? "string";
|
|
116
126
|
return !f.isNull(s.cast) && !f.isEmpty(s.cast) && (o = s.cast), {
|
|
117
127
|
key: s.name,
|
|
118
|
-
label: f.
|
|
128
|
+
label: f.startCase(s.name),
|
|
119
129
|
type: o,
|
|
130
|
+
nullable: s.nullable,
|
|
120
131
|
is_relation: !1
|
|
121
132
|
};
|
|
122
133
|
}),
|
|
@@ -125,8 +136,9 @@ class Dn {
|
|
|
125
136
|
...s,
|
|
126
137
|
{
|
|
127
138
|
key: o,
|
|
128
|
-
label: f.
|
|
139
|
+
label: f.startCase(o),
|
|
129
140
|
type: "autocomplete",
|
|
141
|
+
nullable: !1,
|
|
130
142
|
is_relation: !0
|
|
131
143
|
}
|
|
132
144
|
], [])
|
|
@@ -134,18 +146,18 @@ class Dn {
|
|
|
134
146
|
}
|
|
135
147
|
checkIfCanApplyFilters(t) {
|
|
136
148
|
return !!(t.length === 0 || t.map((a) => {
|
|
137
|
-
if (!
|
|
149
|
+
if (!te(a.key) || !te(a.operator))
|
|
138
150
|
return !0;
|
|
139
151
|
if (["boolean"].includes(this.getInputType(a.type))) {
|
|
140
152
|
if (f.isUndefined(a.value) || f.isNull(a.value))
|
|
141
153
|
return !0;
|
|
142
|
-
} else if (!
|
|
154
|
+
} else if (!te(a.value))
|
|
143
155
|
return !0;
|
|
144
|
-
return !!(Array.isArray(a.value) && ["between", "notBetween"].includes(a.operator) && (!
|
|
156
|
+
return !!(Array.isArray(a.value) && ["between", "notBetween"].includes(a.operator) && (!te(a.value[0]) || !te(a.value[1])));
|
|
145
157
|
}).includes(!0));
|
|
146
158
|
}
|
|
147
159
|
}
|
|
148
|
-
const
|
|
160
|
+
const Bn = rt(Mn), En = {
|
|
149
161
|
open: !1,
|
|
150
162
|
setOpen: () => {
|
|
151
163
|
},
|
|
@@ -160,57 +172,57 @@ const Tn = Xe(Dn), Fn = {
|
|
|
160
172
|
showBackButton: !1,
|
|
161
173
|
setShowBackButton: () => {
|
|
162
174
|
}
|
|
163
|
-
}, V = p.createContext(
|
|
164
|
-
const [t, n] = p.useState(!1), [a, s] = p.useState(""), [o,
|
|
175
|
+
}, V = p.createContext(En), he = document.title, Ln = ({ children: e }) => {
|
|
176
|
+
const [t, n] = p.useState(!1), [a, s] = p.useState(""), [o, i] = p.useState(!1), [l, c] = p.useState(!1), d = Z("luminix.cms.layout", {}), u = ie((g) => g.breakpoints.up((d == null ? void 0 : d.breakpoint) || "md")), h = {
|
|
165
177
|
open: t,
|
|
166
178
|
setOpen: n,
|
|
167
|
-
layout:
|
|
168
|
-
isBreakpointUp:
|
|
179
|
+
layout: d,
|
|
180
|
+
isBreakpointUp: u,
|
|
169
181
|
currentPage: a,
|
|
170
182
|
setCurrentPage: s,
|
|
171
183
|
showSearch: o,
|
|
172
|
-
setShowSearch:
|
|
173
|
-
showBackButton:
|
|
184
|
+
setShowSearch: i,
|
|
185
|
+
showBackButton: l,
|
|
174
186
|
setShowBackButton: c
|
|
175
187
|
};
|
|
176
|
-
return p.useEffect(() => (document.title = a ? `${a} | ${
|
|
177
|
-
document.title =
|
|
188
|
+
return p.useEffect(() => (document.title = a ? `${a} | ${Z("app.name", he)}` : Z("app.name", he), () => {
|
|
189
|
+
document.title = he;
|
|
178
190
|
}), [a]), /* @__PURE__ */ r(V.Provider, { value: h, children: e });
|
|
179
|
-
},
|
|
191
|
+
}, mt = p.createContext({
|
|
180
192
|
Model: null
|
|
181
|
-
}),
|
|
193
|
+
}), me = ({ Model: e, children: t }) => /* @__PURE__ */ r(mt.Provider, { value: { Model: e }, children: t }), ft = p.createContext({
|
|
182
194
|
isOpen: !1,
|
|
183
195
|
dialog: () => Promise.reject(new Error("Trying to access DialogContext outside of DialogProvider")),
|
|
184
196
|
dismissDialog: () => {
|
|
185
197
|
},
|
|
186
198
|
current: void 0
|
|
187
199
|
});
|
|
188
|
-
function
|
|
200
|
+
function On(e) {
|
|
189
201
|
const [t, n] = p.useState(e);
|
|
190
202
|
return p.useEffect(() => {
|
|
191
203
|
e && n(e);
|
|
192
204
|
}, [e]), e || t;
|
|
193
205
|
}
|
|
194
|
-
function
|
|
195
|
-
const [{ current: n, resolve: a }, s] = p.useState({}), o =
|
|
206
|
+
function Nn({ children: e, ...t }) {
|
|
207
|
+
const [{ current: n, resolve: a }, s] = p.useState({}), o = On(n), i = p.useCallback((u) => new Promise((h) => {
|
|
196
208
|
s({
|
|
197
|
-
current: typeof
|
|
209
|
+
current: typeof u == "string" ? { message: u } : u,
|
|
198
210
|
resolve: h
|
|
199
211
|
});
|
|
200
|
-
}), []), { t:
|
|
212
|
+
}), []), { t: l } = F(), c = () => {
|
|
201
213
|
a && a(!1), s({});
|
|
202
|
-
},
|
|
214
|
+
}, d = () => {
|
|
203
215
|
a && a(!0), s({});
|
|
204
216
|
};
|
|
205
|
-
return /* @__PURE__ */ m(
|
|
217
|
+
return /* @__PURE__ */ m(ft.Provider, { value: {
|
|
206
218
|
isOpen: !!n,
|
|
207
219
|
current: n,
|
|
208
|
-
dialog:
|
|
220
|
+
dialog: i,
|
|
209
221
|
dismissDialog: c
|
|
210
222
|
}, children: [
|
|
211
223
|
e,
|
|
212
224
|
/* @__PURE__ */ m(
|
|
213
|
-
|
|
225
|
+
De,
|
|
214
226
|
{
|
|
215
227
|
open: !!n,
|
|
216
228
|
"aria-labelledby": "alert-dialog-title",
|
|
@@ -218,14 +230,14 @@ function Mn({ children: e, ...t }) {
|
|
|
218
230
|
...(n == null ? void 0 : n.dismissable) ?? !0 ? { onClose: c } : {},
|
|
219
231
|
...t,
|
|
220
232
|
children: [
|
|
221
|
-
(o == null ? void 0 : o.title) && /* @__PURE__ */ r(
|
|
222
|
-
/* @__PURE__ */ r(
|
|
223
|
-
/* @__PURE__ */ m(
|
|
224
|
-
(o == null ? void 0 : o.type) === "confirm" && /* @__PURE__ */ m(
|
|
225
|
-
/* @__PURE__ */ r(
|
|
226
|
-
/* @__PURE__ */ r(
|
|
233
|
+
(o == null ? void 0 : o.title) && /* @__PURE__ */ r(Te, { id: "alert-dialog-title", children: o.title }),
|
|
234
|
+
/* @__PURE__ */ r(Fe, { children: /* @__PURE__ */ r(Mt, { id: "alert-dialog-description", children: o == null ? void 0 : o.message }) }),
|
|
235
|
+
/* @__PURE__ */ m(Ie, { children: [
|
|
236
|
+
(o == null ? void 0 : o.type) === "confirm" && /* @__PURE__ */ m(T, { children: [
|
|
237
|
+
/* @__PURE__ */ r(M, { onClick: c, children: (o == null ? void 0 : o.cancelText) ?? l("No") }),
|
|
238
|
+
/* @__PURE__ */ r(M, { onClick: d, autoFocus: !0, children: (o == null ? void 0 : o.confirmText) ?? l("Yes") })
|
|
227
239
|
] }),
|
|
228
|
-
((o == null ? void 0 : o.type) ?? "alert") === "alert" && /* @__PURE__ */ r(
|
|
240
|
+
((o == null ? void 0 : o.type) ?? "alert") === "alert" && /* @__PURE__ */ r(M, { onClick: c, autoFocus: !0, children: (o == null ? void 0 : o.confirmText) ?? l("Ok") })
|
|
229
241
|
] })
|
|
230
242
|
]
|
|
231
243
|
}
|
|
@@ -233,10 +245,10 @@ function Mn({ children: e, ...t }) {
|
|
|
233
245
|
] });
|
|
234
246
|
}
|
|
235
247
|
function v() {
|
|
236
|
-
const { isBreakpointUp: e } =
|
|
248
|
+
const { isBreakpointUp: e } = pt(V);
|
|
237
249
|
return e;
|
|
238
250
|
}
|
|
239
|
-
const
|
|
251
|
+
const Re = p.createContext({
|
|
240
252
|
isOpen: !1,
|
|
241
253
|
notify: () => {
|
|
242
254
|
},
|
|
@@ -247,11 +259,11 @@ const Be = p.createContext({
|
|
|
247
259
|
displacement: "8px",
|
|
248
260
|
setDisplacement: () => {
|
|
249
261
|
}
|
|
250
|
-
}),
|
|
251
|
-
|
|
262
|
+
}), Ce = N([]), Rn = (e) => {
|
|
263
|
+
Ce.push(
|
|
252
264
|
typeof e == "string" ? { message: e } : e
|
|
253
265
|
);
|
|
254
|
-
},
|
|
266
|
+
}, jn = ({
|
|
255
267
|
children: e,
|
|
256
268
|
autoHideDuration: t = 6e3,
|
|
257
269
|
variant: n,
|
|
@@ -259,80 +271,80 @@ const Be = p.createContext({
|
|
|
259
271
|
sx: s,
|
|
260
272
|
...o
|
|
261
273
|
}) => {
|
|
262
|
-
const
|
|
263
|
-
|
|
274
|
+
const i = ot(Ce), l = v(), d = Ne().spacing(l ? 3 : 1), [u, h] = p.useState(), [g, y] = p.useState(d), { vertical: S = "bottom" } = a || {}, b = (w, k) => {
|
|
275
|
+
k !== "clickaway" && h(void 0);
|
|
264
276
|
};
|
|
265
277
|
return p.useEffect(() => {
|
|
266
|
-
if (!
|
|
267
|
-
const
|
|
268
|
-
h(
|
|
278
|
+
if (!u && i.isNotEmpty()) {
|
|
279
|
+
const w = setTimeout(() => {
|
|
280
|
+
h(Ce.pull(0) ?? void 0);
|
|
269
281
|
}, 100);
|
|
270
|
-
return () => clearTimeout(
|
|
282
|
+
return () => clearTimeout(w);
|
|
271
283
|
}
|
|
272
|
-
}, [
|
|
273
|
-
isOpen: !!
|
|
274
|
-
notify:
|
|
284
|
+
}, [u, i]), /* @__PURE__ */ m(Re.Provider, { value: {
|
|
285
|
+
isOpen: !!u,
|
|
286
|
+
notify: Rn,
|
|
275
287
|
dismissNotification: b,
|
|
276
|
-
notifications:
|
|
277
|
-
current:
|
|
288
|
+
notifications: i.all(),
|
|
289
|
+
current: u,
|
|
278
290
|
displacement: g,
|
|
279
291
|
setDisplacement: y
|
|
280
292
|
}, children: [
|
|
281
293
|
e,
|
|
282
294
|
/* @__PURE__ */ r(
|
|
283
|
-
|
|
295
|
+
Bt,
|
|
284
296
|
{
|
|
285
|
-
open: !!
|
|
297
|
+
open: !!u,
|
|
286
298
|
autoHideDuration: t,
|
|
287
299
|
anchorOrigin: a,
|
|
288
300
|
onClose: b,
|
|
289
301
|
sx: {
|
|
290
302
|
...s,
|
|
291
|
-
[
|
|
303
|
+
[S]: `${g} !important`
|
|
292
304
|
},
|
|
293
305
|
...o,
|
|
294
|
-
children:
|
|
295
|
-
|
|
306
|
+
children: u && /* @__PURE__ */ m(
|
|
307
|
+
Et,
|
|
296
308
|
{
|
|
297
309
|
onClose: b,
|
|
298
|
-
severity:
|
|
310
|
+
severity: u.severity,
|
|
299
311
|
variant: n,
|
|
300
312
|
sx: { width: "100%" },
|
|
301
|
-
action:
|
|
302
|
-
...
|
|
303
|
-
|
|
313
|
+
action: u.actions && [
|
|
314
|
+
...u.actions.map(({ label: w, callback: k }, x) => /* @__PURE__ */ r(
|
|
315
|
+
M,
|
|
304
316
|
{
|
|
305
317
|
color: "inherit",
|
|
306
318
|
size: "small",
|
|
307
|
-
onClick:
|
|
308
|
-
children:
|
|
319
|
+
onClick: k,
|
|
320
|
+
children: w
|
|
309
321
|
},
|
|
310
|
-
|
|
322
|
+
x
|
|
311
323
|
)),
|
|
312
|
-
/* @__PURE__ */ r(
|
|
324
|
+
/* @__PURE__ */ r(E, { "aria-label": "close", color: "inherit", size: "small", onClick: b, children: /* @__PURE__ */ r(Ee, {}) }, "close")
|
|
313
325
|
],
|
|
314
326
|
children: [
|
|
315
|
-
|
|
316
|
-
|
|
327
|
+
u.title && /* @__PURE__ */ r(Lt, { children: u.title }),
|
|
328
|
+
u.message
|
|
317
329
|
]
|
|
318
330
|
}
|
|
319
331
|
)
|
|
320
332
|
}
|
|
321
333
|
)
|
|
322
334
|
] });
|
|
323
|
-
},
|
|
324
|
-
const t =
|
|
335
|
+
}, qn = ({ children: e }) => {
|
|
336
|
+
const t = ie("(prefers-color-scheme: dark)");
|
|
325
337
|
return /* @__PURE__ */ r(
|
|
326
|
-
|
|
338
|
+
jn,
|
|
327
339
|
{
|
|
328
340
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
329
341
|
variant: t ? "standard" : "filled",
|
|
330
|
-
children: /* @__PURE__ */ r(
|
|
342
|
+
children: /* @__PURE__ */ r(Nn, { children: /* @__PURE__ */ r(Ln, { children: e }) })
|
|
331
343
|
}
|
|
332
344
|
);
|
|
333
|
-
},
|
|
345
|
+
}, Wn = (e, { Layout: t, Dashboard: n, ModelIndex: a, ModelItem: s, Error: o }, i) => [
|
|
334
346
|
{
|
|
335
|
-
element: /* @__PURE__ */ r(
|
|
347
|
+
element: /* @__PURE__ */ r(qn, { children: /* @__PURE__ */ r(t, { children: /* @__PURE__ */ r(vt, {}) }) }),
|
|
336
348
|
errorElement: /* @__PURE__ */ r(o, {}),
|
|
337
349
|
children: [
|
|
338
350
|
{
|
|
@@ -340,118 +352,118 @@ const Be = p.createContext({
|
|
|
340
352
|
name: "luminix.cms.dashboard",
|
|
341
353
|
element: /* @__PURE__ */ r(n, {})
|
|
342
354
|
},
|
|
343
|
-
...Object.entries(
|
|
355
|
+
...Object.entries(i).flatMap(([l, c]) => [
|
|
344
356
|
{
|
|
345
357
|
path: "/" + f.kebabCase(c.plural()),
|
|
346
|
-
name: `luminix.cms.${
|
|
347
|
-
element: /* @__PURE__ */ r(
|
|
358
|
+
name: `luminix.cms.${l}.index`,
|
|
359
|
+
element: /* @__PURE__ */ r(me, { Model: c, children: /* @__PURE__ */ r(Ft, { factory: c.query, children: /* @__PURE__ */ r(a, {}) }) })
|
|
348
360
|
},
|
|
349
361
|
{
|
|
350
362
|
path: "/" + f.kebabCase(c.plural()) + "/create",
|
|
351
|
-
name: `luminix.cms.${
|
|
352
|
-
element: /* @__PURE__ */ r(
|
|
363
|
+
name: `luminix.cms.${l}.item`,
|
|
364
|
+
element: /* @__PURE__ */ r(me, { Model: c, children: /* @__PURE__ */ r(s, { create: !0 }) })
|
|
353
365
|
},
|
|
354
366
|
{
|
|
355
367
|
path: "/" + f.kebabCase(c.plural()) + "/:id",
|
|
356
|
-
name: `luminix.cms.${
|
|
357
|
-
element: /* @__PURE__ */ r(
|
|
368
|
+
name: `luminix.cms.${l}.item`,
|
|
369
|
+
element: /* @__PURE__ */ r(me, { Model: c, children: /* @__PURE__ */ r(s, {}) })
|
|
358
370
|
}
|
|
359
371
|
])
|
|
360
372
|
]
|
|
361
373
|
}
|
|
362
374
|
];
|
|
363
|
-
function
|
|
375
|
+
function je(e) {
|
|
364
376
|
const { setCurrentPage: t } = p.useContext(V);
|
|
365
377
|
p.useEffect(() => (t(e), () => {
|
|
366
378
|
t("");
|
|
367
379
|
}), [e, t]);
|
|
368
380
|
}
|
|
369
|
-
const
|
|
370
|
-
const { t: e } =
|
|
371
|
-
return
|
|
372
|
-
},
|
|
381
|
+
const zn = () => {
|
|
382
|
+
const { t: e } = F();
|
|
383
|
+
return je(e("Dashboard")), /* @__PURE__ */ r(T, { children: "Dashboard" });
|
|
384
|
+
}, Un = ({ error: e }) => /* @__PURE__ */ m("div", { children: [
|
|
373
385
|
/* @__PURE__ */ r("h1", { children: "Ops..." }),
|
|
374
386
|
/* @__PURE__ */ r("p", { children: "Something went wrong" }),
|
|
375
|
-
|
|
387
|
+
C().hasDebugModeEnabled() && e && /* @__PURE__ */ r(T, { children: /* @__PURE__ */ m("pre", { style: { whiteSpace: "pre-wrap" }, children: [
|
|
376
388
|
e.message,
|
|
377
389
|
/* @__PURE__ */ r("br", {}),
|
|
378
390
|
e.stack
|
|
379
391
|
] }) })
|
|
380
392
|
] });
|
|
381
393
|
function L(e, t) {
|
|
382
|
-
const { layout: n } =
|
|
383
|
-
return
|
|
394
|
+
const { layout: n } = pt(V);
|
|
395
|
+
return cn(() => f.get(n, e, t), [n, e, t]);
|
|
384
396
|
}
|
|
385
|
-
const
|
|
397
|
+
const Vn = U("div")(({ theme: e }) => ({
|
|
386
398
|
padding: e.spacing(0, 1),
|
|
387
399
|
// necessary for content to be below app bar
|
|
388
400
|
...e.mixins.toolbar
|
|
389
|
-
})),
|
|
401
|
+
})), Yn = ({ children: e, slotProps: t, ...n }) => {
|
|
390
402
|
const {
|
|
391
403
|
DesktopPageTitle: a,
|
|
392
404
|
["Layout.AppBar"]: s,
|
|
393
405
|
["Layout.Drawer"]: o
|
|
394
|
-
} =
|
|
395
|
-
AppBar:
|
|
406
|
+
} = C("cms").getComponents(), i = L("appBar.height"), {
|
|
407
|
+
AppBar: l,
|
|
396
408
|
Drawer: c,
|
|
397
|
-
main:
|
|
409
|
+
main: d
|
|
398
410
|
} = t || {};
|
|
399
|
-
return /* @__PURE__ */ m(
|
|
411
|
+
return /* @__PURE__ */ m(j, { sx: { display: "flex" }, ...n, children: [
|
|
400
412
|
/* @__PURE__ */ r(
|
|
401
413
|
s,
|
|
402
414
|
{
|
|
403
415
|
position: "fixed",
|
|
404
|
-
...
|
|
416
|
+
...l
|
|
405
417
|
}
|
|
406
418
|
),
|
|
407
419
|
/* @__PURE__ */ r(o, { ...c }),
|
|
408
420
|
/* @__PURE__ */ m(
|
|
409
|
-
|
|
421
|
+
j,
|
|
410
422
|
{
|
|
411
423
|
component: "main",
|
|
412
424
|
sx: {
|
|
413
425
|
flexGrow: 1
|
|
414
426
|
// p: { xs: 1, sm: 2, md: 3 },
|
|
415
427
|
},
|
|
416
|
-
...
|
|
428
|
+
...d,
|
|
417
429
|
children: [
|
|
418
|
-
/* @__PURE__ */ r(
|
|
430
|
+
/* @__PURE__ */ r(Vn, { style: { height: i } }),
|
|
419
431
|
/* @__PURE__ */ r(a, {}),
|
|
420
|
-
/* @__PURE__ */ r(
|
|
432
|
+
/* @__PURE__ */ r(j, { sx: { p: { xs: 1, sm: 2, md: 3 } }, children: e })
|
|
421
433
|
]
|
|
422
434
|
}
|
|
423
435
|
)
|
|
424
436
|
] });
|
|
425
437
|
};
|
|
426
|
-
function
|
|
438
|
+
function Kn() {
|
|
427
439
|
const { setShowSearch: e } = p.useContext(V);
|
|
428
440
|
p.useEffect(() => (e(!0), () => {
|
|
429
441
|
e(!1);
|
|
430
442
|
}), [e]);
|
|
431
443
|
}
|
|
432
|
-
function
|
|
433
|
-
const { Model: e } = p.useContext(
|
|
444
|
+
function $() {
|
|
445
|
+
const { Model: e } = p.useContext(mt);
|
|
434
446
|
return e;
|
|
435
447
|
}
|
|
436
|
-
const
|
|
437
|
-
const e =
|
|
448
|
+
const $n = () => {
|
|
449
|
+
const e = $(), {
|
|
438
450
|
data: t,
|
|
439
451
|
error: n,
|
|
440
452
|
loading: a
|
|
441
|
-
} =
|
|
442
|
-
|
|
453
|
+
} = re();
|
|
454
|
+
je(e.plural()), Kn();
|
|
443
455
|
const s = v(), {
|
|
444
456
|
Breadcrumbs: o,
|
|
445
|
-
["ModelIndex.Pagination"]:
|
|
446
|
-
["ModelIndex.StaticActions"]:
|
|
457
|
+
["ModelIndex.Pagination"]: i,
|
|
458
|
+
["ModelIndex.StaticActions"]: l,
|
|
447
459
|
["ModelIndex.Table"]: c,
|
|
448
|
-
["ModelIndex.Table.TableBody"]:
|
|
449
|
-
["ModelIndex.Table.TableHead"]:
|
|
460
|
+
["ModelIndex.Table.TableBody"]: d,
|
|
461
|
+
["ModelIndex.Table.TableHead"]: u,
|
|
450
462
|
["ModelIndex.Table.TableFooter"]: h,
|
|
451
463
|
["ModelIndex.Table.TableToolbar"]: g,
|
|
452
464
|
["ModelIndex.Table.TableBody.TableRow"]: y,
|
|
453
|
-
["ModelIndex.Tabs"]:
|
|
454
|
-
} =
|
|
465
|
+
["ModelIndex.Tabs"]: S
|
|
466
|
+
} = C("cms").getComponents();
|
|
455
467
|
return /* @__PURE__ */ m(Y, { container: !0, spacing: 2, children: [
|
|
456
468
|
/* @__PURE__ */ m(
|
|
457
469
|
Y,
|
|
@@ -469,12 +481,12 @@ const Un = () => {
|
|
|
469
481
|
]
|
|
470
482
|
}
|
|
471
483
|
),
|
|
472
|
-
/* @__PURE__ */ r(
|
|
484
|
+
/* @__PURE__ */ r(l, { variant: s ? "default" : "fab" })
|
|
473
485
|
]
|
|
474
486
|
}
|
|
475
487
|
),
|
|
476
|
-
!s && /* @__PURE__ */ r(Y, { display: "flex", justifyContent: "center", xs: 12, children: /* @__PURE__ */ r(
|
|
477
|
-
/* @__PURE__ */ r(Y, { xs: 12, sx: { pb: 0 }, children: /* @__PURE__ */ r(
|
|
488
|
+
!s && /* @__PURE__ */ r(Y, { display: "flex", justifyContent: "center", xs: 12, children: /* @__PURE__ */ r(i, { variant: "compact" }) }),
|
|
489
|
+
/* @__PURE__ */ r(Y, { xs: 12, sx: { pb: 0 }, children: /* @__PURE__ */ r(S, {}) }),
|
|
478
490
|
/* @__PURE__ */ r(Y, { xs: 12, sx: { pt: 0 }, children: /* @__PURE__ */ m(
|
|
479
491
|
c,
|
|
480
492
|
{
|
|
@@ -482,58 +494,58 @@ const Un = () => {
|
|
|
482
494
|
loading: a,
|
|
483
495
|
error: n,
|
|
484
496
|
children: [
|
|
485
|
-
/* @__PURE__ */ r(
|
|
486
|
-
/* @__PURE__ */ r(
|
|
497
|
+
/* @__PURE__ */ r(u, { children: /* @__PURE__ */ r(g, {}) }),
|
|
498
|
+
/* @__PURE__ */ r(d, { children: (b) => /* @__PURE__ */ r(y, { item: b }, b.getKey()) }),
|
|
487
499
|
/* @__PURE__ */ r(h, {})
|
|
488
500
|
]
|
|
489
501
|
}
|
|
490
502
|
) })
|
|
491
503
|
] });
|
|
492
504
|
};
|
|
493
|
-
function
|
|
505
|
+
function Hn() {
|
|
494
506
|
const { setShowBackButton: e } = p.useContext(V);
|
|
495
507
|
p.useEffect(() => (e(!0), () => {
|
|
496
508
|
e(!1);
|
|
497
509
|
}), [e]);
|
|
498
510
|
}
|
|
499
|
-
function
|
|
511
|
+
function X(e) {
|
|
500
512
|
return (t) => {
|
|
501
513
|
var n;
|
|
502
514
|
if (!(t instanceof Error))
|
|
503
515
|
throw t;
|
|
504
516
|
e({
|
|
505
|
-
message:
|
|
517
|
+
message: Fn(t) ? ((n = t.response) == null ? void 0 : n.data.message) ?? t.message : t.message,
|
|
506
518
|
severity: "error"
|
|
507
519
|
});
|
|
508
520
|
};
|
|
509
521
|
}
|
|
510
|
-
function
|
|
511
|
-
return p.useContext(
|
|
522
|
+
function qe() {
|
|
523
|
+
return p.useContext(Re).notify;
|
|
512
524
|
}
|
|
513
|
-
function
|
|
514
|
-
const e =
|
|
525
|
+
function Zn() {
|
|
526
|
+
const e = qe();
|
|
515
527
|
return p.useCallback((t) => {
|
|
516
|
-
|
|
528
|
+
X(e)(t);
|
|
517
529
|
}, [e]);
|
|
518
530
|
}
|
|
519
|
-
const
|
|
520
|
-
const [t, n] = p.useState(), { id: a } =
|
|
521
|
-
|
|
522
|
-
t != null && t.exists ? s("Edit :model “:label“", { model:
|
|
523
|
-
),
|
|
524
|
-
const
|
|
531
|
+
const Gn = ({ create: e = !1 }) => {
|
|
532
|
+
const [t, n] = p.useState(), { id: a } = Dt(), { t: s } = F(), o = qe(), i = Ae(), l = $(), c = L("breakpoint", "md");
|
|
533
|
+
je(
|
|
534
|
+
t != null && t.exists ? s("Edit :model “:label“", { model: l.singular(), label: (t == null ? void 0 : t.getLabel()) || "..." }) : s("Create :model", { model: l.singular() })
|
|
535
|
+
), Hn();
|
|
536
|
+
const d = C("cms").getComponent("Breadcrumbs");
|
|
525
537
|
p.useEffect(() => {
|
|
526
|
-
e ? n(new
|
|
527
|
-
}, [a,
|
|
528
|
-
const
|
|
529
|
-
o(s(":model saved successfully", { model:
|
|
530
|
-
}, [o,
|
|
538
|
+
e ? n(new l()) : l.find(a).then((y) => n(y ?? void 0));
|
|
539
|
+
}, [a, l, e]);
|
|
540
|
+
const u = p.useCallback(() => {
|
|
541
|
+
o(s(":model saved successfully", { model: l.singular() })), t != null && t.wasRecentlyCreated && i(`/${f.kebabCase(l.plural())}/${t.getKey()}`);
|
|
542
|
+
}, [o, i, l, t, s]), h = Zn(), g = p.useMemo(() => C("cms").getModelFormProps(t), [t]);
|
|
531
543
|
return t ? /* @__PURE__ */ m(Y, { container: !0, children: [
|
|
532
544
|
/* @__PURE__ */ r(Y, { xs: 12, children: /* @__PURE__ */ r(
|
|
533
|
-
|
|
545
|
+
d,
|
|
534
546
|
{
|
|
535
547
|
parts: [
|
|
536
|
-
{ name:
|
|
548
|
+
{ name: l.plural(), href: "/" + f.kebabCase(l.plural()) },
|
|
537
549
|
{ name: t.exists ? t.getLabel() : s("New") }
|
|
538
550
|
]
|
|
539
551
|
}
|
|
@@ -544,12 +556,12 @@ const zn = ({ create: e = !1 }) => {
|
|
|
544
556
|
xs: 12,
|
|
545
557
|
[c]: 6,
|
|
546
558
|
children: /* @__PURE__ */ r(
|
|
547
|
-
|
|
559
|
+
It,
|
|
548
560
|
{
|
|
549
561
|
submitText: "Save",
|
|
550
562
|
...g,
|
|
551
563
|
item: t,
|
|
552
|
-
onSuccess:
|
|
564
|
+
onSuccess: u,
|
|
553
565
|
onError: h
|
|
554
566
|
}
|
|
555
567
|
)
|
|
@@ -557,85 +569,85 @@ const zn = ({ create: e = !1 }) => {
|
|
|
557
569
|
)
|
|
558
570
|
] }) : null;
|
|
559
571
|
};
|
|
560
|
-
function
|
|
572
|
+
function Qn(e) {
|
|
561
573
|
const {
|
|
562
574
|
setDisplacement: t
|
|
563
|
-
} = p.useContext(
|
|
575
|
+
} = p.useContext(Re), n = Ne(), a = v(), s = n.spacing(a ? 3 : 1), o = e === !1 ? s : n.spacing(e);
|
|
564
576
|
p.useEffect(() => (t(o), () => {
|
|
565
577
|
t(s);
|
|
566
578
|
}), [o, s]);
|
|
567
579
|
}
|
|
568
|
-
function
|
|
569
|
-
return p.useContext(
|
|
580
|
+
function Xn() {
|
|
581
|
+
return p.useContext(ft).dialog;
|
|
570
582
|
}
|
|
571
|
-
function
|
|
572
|
-
const e = Ae(), t =
|
|
583
|
+
function We() {
|
|
584
|
+
const e = Ae(), t = qe(), n = Xn(), { t: a } = F(), { refresh: s } = re();
|
|
573
585
|
return { navigate: e, notify: t, dialog: n, t: a, refresh: s };
|
|
574
586
|
}
|
|
575
|
-
const
|
|
587
|
+
const Jn = U(Ot)(({ theme: e }) => ({
|
|
576
588
|
position: "fixed",
|
|
577
589
|
bottom: e.spacing(2),
|
|
578
590
|
right: e.spacing(2)
|
|
579
|
-
})),
|
|
591
|
+
})), _n = U(Nt)(({ theme: e }) => ({
|
|
580
592
|
position: "fixed",
|
|
581
593
|
bottom: e.spacing(2),
|
|
582
594
|
right: e.spacing(2)
|
|
583
|
-
})),
|
|
584
|
-
const t =
|
|
585
|
-
if (
|
|
595
|
+
})), er = ({ variant: e = "default" }) => {
|
|
596
|
+
const t = $(), n = v(), [a] = W(), s = a.get("tab") ?? "all", [o, i] = p.useState(!1), l = p.useRef(null), [c, d] = p.useState(0), u = We(), h = p.useMemo(() => C("cms").getStaticActions(t, s), [t, s]);
|
|
597
|
+
if (Qn(
|
|
586
598
|
e === "fab" && h.length > 0 ? n ? 12 : 10 : !1
|
|
587
599
|
), h.length === 0)
|
|
588
600
|
return null;
|
|
589
|
-
const g = (b,
|
|
590
|
-
|
|
601
|
+
const g = (b, w) => {
|
|
602
|
+
d(w), i(!1);
|
|
591
603
|
}, y = () => {
|
|
592
|
-
|
|
593
|
-
},
|
|
594
|
-
|
|
604
|
+
i((b) => !b);
|
|
605
|
+
}, S = (b) => {
|
|
606
|
+
l.current && l.current.contains(b.target) || i(!1);
|
|
595
607
|
};
|
|
596
|
-
return e === "fab" ? h.length === 1 ?
|
|
608
|
+
return e === "fab" ? h.length === 1 ? Xe.createPortal(
|
|
597
609
|
/* @__PURE__ */ r(
|
|
598
|
-
|
|
610
|
+
Jn,
|
|
599
611
|
{
|
|
600
612
|
color: "primary",
|
|
601
|
-
onClick: () => h[0].callback(
|
|
613
|
+
onClick: () => h[0].callback(u),
|
|
602
614
|
children: h[0].icon || h[0].label.charAt(0).toUpperCase()
|
|
603
615
|
}
|
|
604
616
|
),
|
|
605
617
|
document.body
|
|
606
|
-
) :
|
|
618
|
+
) : Xe.createPortal(
|
|
607
619
|
/* @__PURE__ */ r(
|
|
608
|
-
|
|
620
|
+
_n,
|
|
609
621
|
{
|
|
610
622
|
ariaLabel: `actions for ${t.singular()}`,
|
|
611
|
-
icon: /* @__PURE__ */ r(
|
|
623
|
+
icon: /* @__PURE__ */ r(Rt, {}),
|
|
612
624
|
color: "primary",
|
|
613
|
-
onClose: () =>
|
|
614
|
-
onOpen: () =>
|
|
625
|
+
onClose: () => i(!1),
|
|
626
|
+
onOpen: () => i(!0),
|
|
615
627
|
open: o,
|
|
616
628
|
children: h.map((b) => /* @__PURE__ */ r(
|
|
617
|
-
|
|
629
|
+
jt,
|
|
618
630
|
{
|
|
619
631
|
icon: b.icon || b.label.charAt(0).toUpperCase(),
|
|
620
632
|
tooltipTitle: b.label,
|
|
621
|
-
onClick: () => b.callback(
|
|
633
|
+
onClick: () => b.callback(u)
|
|
622
634
|
},
|
|
623
635
|
b.label
|
|
624
636
|
))
|
|
625
637
|
}
|
|
626
638
|
),
|
|
627
639
|
document.body
|
|
628
|
-
) : /* @__PURE__ */ m(
|
|
640
|
+
) : /* @__PURE__ */ m(T, { children: [
|
|
629
641
|
/* @__PURE__ */ m(
|
|
630
|
-
|
|
642
|
+
qt,
|
|
631
643
|
{
|
|
632
644
|
variant: "contained",
|
|
633
|
-
ref:
|
|
645
|
+
ref: l,
|
|
634
646
|
"aria-label": h[c].label,
|
|
635
647
|
children: [
|
|
636
|
-
/* @__PURE__ */ r(
|
|
648
|
+
/* @__PURE__ */ r(M, { onClick: () => h[c].callback(u), children: h[c].label }),
|
|
637
649
|
h.length > 1 && /* @__PURE__ */ r(
|
|
638
|
-
|
|
650
|
+
M,
|
|
639
651
|
{
|
|
640
652
|
variant: "contained",
|
|
641
653
|
size: "small",
|
|
@@ -644,34 +656,34 @@ const Hn = U(Mt)(({ theme: e }) => ({
|
|
|
644
656
|
"aria-label": `select ${t.singular()} actions`,
|
|
645
657
|
"aria-haspopup": "menu",
|
|
646
658
|
onClick: y,
|
|
647
|
-
children: /* @__PURE__ */ r(
|
|
659
|
+
children: /* @__PURE__ */ r(dn, {})
|
|
648
660
|
}
|
|
649
661
|
)
|
|
650
662
|
]
|
|
651
663
|
}
|
|
652
664
|
),
|
|
653
665
|
/* @__PURE__ */ r(
|
|
654
|
-
|
|
666
|
+
Wt,
|
|
655
667
|
{
|
|
656
668
|
open: o,
|
|
657
|
-
anchorEl:
|
|
669
|
+
anchorEl: l.current,
|
|
658
670
|
role: void 0,
|
|
659
671
|
transition: !0,
|
|
660
|
-
children: ({ TransitionProps: b, placement:
|
|
661
|
-
|
|
672
|
+
children: ({ TransitionProps: b, placement: w }) => /* @__PURE__ */ r(
|
|
673
|
+
zt,
|
|
662
674
|
{
|
|
663
675
|
...b,
|
|
664
676
|
style: {
|
|
665
|
-
transformOrigin:
|
|
677
|
+
transformOrigin: w === "bottom" ? "center top" : "center bottom"
|
|
666
678
|
},
|
|
667
|
-
children: /* @__PURE__ */ r(
|
|
668
|
-
|
|
679
|
+
children: /* @__PURE__ */ r(Pe, { children: /* @__PURE__ */ r(Ut, { onClickAway: S, children: /* @__PURE__ */ r(Vt, { id: "split-button-menu", children: h.map((k, x) => /* @__PURE__ */ r(
|
|
680
|
+
G,
|
|
669
681
|
{
|
|
670
|
-
selected:
|
|
671
|
-
onClick: (
|
|
672
|
-
children:
|
|
682
|
+
selected: x === c,
|
|
683
|
+
onClick: (A) => g(A, x),
|
|
684
|
+
children: k.label
|
|
673
685
|
},
|
|
674
|
-
|
|
686
|
+
k.label
|
|
675
687
|
)) }) }) })
|
|
676
688
|
}
|
|
677
689
|
)
|
|
@@ -679,7 +691,7 @@ const Hn = U(Mt)(({ theme: e }) => ({
|
|
|
679
691
|
)
|
|
680
692
|
] });
|
|
681
693
|
};
|
|
682
|
-
function
|
|
694
|
+
function ze() {
|
|
683
695
|
const { open: e, setOpen: t } = p.useContext(V);
|
|
684
696
|
return {
|
|
685
697
|
open: e,
|
|
@@ -694,21 +706,21 @@ function Re() {
|
|
|
694
706
|
}
|
|
695
707
|
};
|
|
696
708
|
}
|
|
697
|
-
function
|
|
709
|
+
function gt() {
|
|
698
710
|
const { currentPage: e } = p.useContext(V);
|
|
699
711
|
return e;
|
|
700
712
|
}
|
|
701
|
-
function
|
|
713
|
+
function tr() {
|
|
702
714
|
const { showSearch: e } = p.useContext(V);
|
|
703
715
|
return e;
|
|
704
716
|
}
|
|
705
|
-
const
|
|
706
|
-
function
|
|
717
|
+
const nr = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAABbWlDQ1BpY2MAACiRdZG9S0JRGMZ/aqWU0VBDRIOBRYORFERj2eAiIWaQ1aI3PwI/LvcqIa1BS4PQELX0NfQf1Bq0FgRBEUQ0Nve1hNzeo4ISdS7nvj+ec56Xc54D9lBWy5ltfsjli0YkGPAsxZY9zldcdADjDMU1U58Nh0P8O77usal6N6Z6/b/vz9G1ljQ1sLmEpzTdKArPCIc2irriHeE+LRNfEz4S9hlyQOFrpSfq/KI4XecPxUY0Mgd21dOTbuFEC2sZIyc8KuzNZUta4zzqJu5kfnFB6oDMQUwiBAngIUGJdbIUGZOal8z+9vlrvnkK4tHkr1PGEEeajHh9opaka1JqSvSkfFnKKvffeZqpyYl6d3cA2p8t630YnLtQrVjW97FlVU/A8QSX+aa/IDlNf4peaWreQ+jZgvOrppbYg4tt6H/U40a8Jjlk2lMpeDuD7hj03kLnSj2rxjqnDxDdlCe6gf0DGJH9Pas/3QVn+hiI/rEAAAAJcEhZcwAACxEAAAsRAX9kX5EAAAWBSURBVFhHxZl/TFtVFMe/pZQOGMIA0W3iBgOloLIBzrkZJsuWmCwah/8sYW4my0QYc1NijM5o1MQ4/3B/CUb/0Bn+mTHzD4PjRxEUxEGmcWb8VsbPTTYYDBjQFlrPubTQ0va9+6qdJ3lp+t69537eOfeec+59OpAklpWvQkhICV0FsNvT4XCE8X0tYrPb8WBsLL7L34eoMPnukxYrjpprYe4fgEGvtxJDOzFU0PXJYHHRnC6x/NNwAqnQGY35WFiAY35eC9dSWwv1Ld+zB/kPpEr3H52dRVFNLRoGBxEeGir66fhXr4fDYjlHfwv4bjHD0Q1pxSsbWglu27q1eDpl08pHfv8PT0+jsLoGLdeuLcFxY2EgupxMxQx4iC0XqDiooz4kBCeys2GgXxnpnbiFF6urcenGDQ84j76LTC8woClQt7JCC73t3k3JeDIxUYYN7WNjOFJVjZ7xcf9wpMnJZGLARedLqfds5HA4EGkw4DhZT6fTqWr4dWREuHVwagqrnHNOpZNcK39K5sgNh0xp2JyQ4K/J0v3m4WFyaw3G5uZgpEUgKwFbb4GslxARgZItW1THqunrQ4m5DtNWq/Q8dSkNGJDDysGMDGyMjlYE/LanB6X1DZijuRoquYjcFQYEOE9BOZnADj/ysF84O1n4y8uXcbKxCdye4TiYuwvPWjXogAB5oMLNmYgP5xjvWzj4nu3sQkZ8HPQ67/DDcAzeTatZSTQDMtxD8fHYn5ampBc71q9H5XP5YBCOle4SQiueXf5mY6MIO0pW1AzIoeV4dpYIL0qitFJnCa60oQHfdHUrxkLWrwmQU9rO+xPxbKp8vl35ElwclJjNOH/liiqcZkB2DRkQH1xooUCrF65ZF7ka+1JTRLpTEy4OXqLi4Ee34kCtjyYLMlDj0BDqBwYI1AFek2W7d1OFpA739+3bOEKB+sLVq1KWc4FrAuTQwQUBXzM0j157NAf7KZOoCae2w1VV+H3kuiY41qv+6m6j302Zg4Un+d7kZJTm5Kix4c+JCRys/F7ASeZfD53SgGy9A+kmMUjqmjX4aGcuwlRyKocQhmsbHQ0ITtqCHMcYZteGDTDFxeLjvDzcExmpaL3fqHJ5nuD+IgsGYjmXcqk5yBE/JSZGWO7D3FyCjFOE44VUVGvGGK1apXioqMT5UAqQ499TSUlYTcFZDa62rx/HKM7dCqBy8QWsCsjWuy8qCgU0/9SksrcXL9fVYdY2r7ms8qdbEZDhWN7Zvl1AKsm57m68SmWVjaytlFuVdPh65ncVczKPNhpxelee6layor0dJ36oF+WUTEbxBeLvnpcFecXaFux4JiUFrz+2VSwMJfns0h94t7lZNNFL7EuUdPl65gXIC6IwMxPvPbFDtJ+g/XIMWdKXnL54EadaWxFK9R7n6WCIh4ut5KKta+/Fyce3iRru/eZfMDg56TWu69mpllYYggjHA3tY0E6ABaZ0Ebt4L8HVbgYVp+7Cm6W3m5rwObnWSFklOHZbHtEDkA5vkBwTLazXT5ZjN7u7jt3/xk+N+KqtTXPS93KD5A0PF/Mq7Lx5U1jlWFYWktx2bDM2G16pr8eZOwjH7+AZZsh9Pw8Ni3dzX5FTlBVKKACf7ehCxL/b60vabbmZ5xyk+yvDyjidBHBeNff3I8Lgteg1D6i1g9eId7mFFA4xXAVziX6nLed6Ea9Mcn1mRjzjovQoWU7L/kGrdWTaM+DSkSqX8nzIw3Bv0YkAn6m4Tj5llAWhzTwDdohjVxIG7KAqmE+hvu7s/F/hnEwdDHiGz4RdwoG4liwnc94XBIstq1xk+oIBy/jAms6EFw+w6YbaXiOYYGw5ZnEeopeLTEWfIYzOzxAHAv0M8Z9A63T8GaLN7TOE5R/LwhBxBS+RxAAAAABJRU5ErkJggg==", rr = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAABbWlDQ1BpY2MAACiRdZG9S0JRGMZ/aqWU0VBDRIOBRYORFERj2eAiIWaQ1aI3PwI/LvcqIa1BS4PQELX0NfQf1Bq0FgRBEUQ0Nve1hNzeo4ISdS7nvj+ec56Xc54D9lBWy5ltfsjli0YkGPAsxZY9zldcdADjDMU1U58Nh0P8O77usal6N6Z6/b/vz9G1ljQ1sLmEpzTdKArPCIc2irriHeE+LRNfEz4S9hlyQOFrpSfq/KI4XecPxUY0Mgd21dOTbuFEC2sZIyc8KuzNZUta4zzqJu5kfnFB6oDMQUwiBAngIUGJdbIUGZOal8z+9vlrvnkK4tHkr1PGEEeajHh9opaka1JqSvSkfFnKKvffeZqpyYl6d3cA2p8t630YnLtQrVjW97FlVU/A8QSX+aa/IDlNf4peaWreQ+jZgvOrppbYg4tt6H/U40a8Jjlk2lMpeDuD7hj03kLnSj2rxjqnDxDdlCe6gf0DGJH9Pas/3QVn+hiI/rEAAAAJcEhZcwAACxEAAAsRAX9kX5EAAAUfSURBVFhHzZhdTFxFFMfPwsKypUCBlAS2XWyKfPSB0qZay6ql6NK1NE3TJjWxD/pgfCD6Uq2JMcZYY1RelKrVWmtTqTEmYuqTJiYWGwVpwkLLZwKWBhXS8lEEkd1l2fX8Z7lm6Z17996rLp5kumQ6d+Z3/3POmXPHRmyRaDSDf562ER2NEm3h33T0m7WfZ2Zof8uXNBcKUYqNZ0lgi5EIrXM46H2vl2rcGzE6xK2f2wVu79lstoCd4Zzo4OkOYUTiaTFKbic7/TS1sEAZdrt8QFxvaGmJCjIz6XSdl3YVFSn/A2Gqllt1NBo9ipkaAMfKCbMK6L95ky4ODZHDAFyQ4Yqzs+nDvXVUVVCwvLLqB4I1pPA/jytgVuF4F6iJ1VsIhxO+YIDHlObmUnP9Pj04hfYJO0NVqNhNdlwaHaVvb9xIqB5eYBsrdsa3VyhowCqwxYkdRmcm+BLUW2IV9SYCXLWriD6oq6NC9j2DZsBhEsx0cWiYOsbHyZGaqjkScLVuN8N5KTcDCcO46b10wll+DwbpHb9fN6X8yXAHS0ro7do9tDbdfPb6R4DNff00OD1NTslGICsgIB6rqKDG3Q8aSj0yRSwDjs/P09meHkrX2NoIJ+GGbVX0iscjW9dwn2XA091X6de5Oal6OCF8m+6iR8vLhcKccFVACCr4bQmnHL30ZuOH1U+rplvZgSNt3xctNL+4qOl/OE3CDCoz9EP5N3nrD5WW6gJaUrCps5OmAwGpegoQIldmgFvD8Aia/Zs3y4as6DMN2PbbGH02MIgCgxChKAoyJH4o2zZsfc5ycbAnVhwkBDS9xT+NjYm8B0CcqeN/zNNXw8MiUcugFAKlODjD5+/OwsKEYMoA04B3zny89Xtq7uvTjGaMB5wray195POJo86Mmd7i+MlPdXXT+d5e3RwHlTfl5NDHj/hoS36+GTYxFtWMYZvkWk+x77hAaLxyRVe5AMOV5+WJysUKnGlAnByIztHZWTp+qVX4oFbljFNk6/r19AnD3c25zqoZVhARiLJqYGqKnmttpV84SaelyB/HS+zkKvlCfb3RskqT33CQIDnX8/cG6rieiQmya8Ah9XiLi+mU92HTlYuM0nCQfDMyQvDBWa5gtOCg3AFOvk0P1VKWhcrFMiDA4H/prJoe3GE+tt7iE0JW3cgWN9Ind6K4J6MUpRNt7XSdt1gGh4McyqGsOsnK/ZtwwNDd4hneztfa2+nzwUFprgNckOGerKykV+/3SF/AiEp6YzQBv74+Qm90dFDf5CStSUtTzYEiKMSR/cz27fTirvs0043qQZMd0ig+19NLL1y+LBTBN8QMVy78lf/31DiHw9yev/ceOrZjh8klzQ1X+eDVW7fY59oE0MueanJzWgGMYoBDO8GV8n8NhzVVgJ/2D9AER+2RsjLxgd3NwEpCVioWFJpPba00J4XF0SofRLRmss+5s7PopR9+jJXrrOYS+1sa132NNbsFfLJMpWBZfp5Y+92uLhq+fVuohyrYydBII8mEA4cK0OPaIADDEb4pYDhEKk4FXJEd4O/bZJtqi6Ga4msoEBDFqII9Lley2cR6KkBcPsKwrYA7yxc9cfd3SYdUbXG+0ykCAkfWHZeLSYfDggBc8X2IG6hs/vJ6nVPJAxti/rgqZLFFw0gj1/DxrhhvbZQL0/iu1fz7GhQ8H69QKue8mo3iQvv/YOegoJNby2rKpLE2mGKXifyHg9uz3Lq4BTUeSEY31vZzOwYmbOFfRuevM6ot++oAAAAASUVORK5CYII=";
|
|
718
|
+
function bt() {
|
|
707
719
|
const { showBackButton: e } = p.useContext(V);
|
|
708
720
|
return e;
|
|
709
721
|
}
|
|
710
|
-
const
|
|
711
|
-
|
|
722
|
+
const ar = U(
|
|
723
|
+
st,
|
|
712
724
|
{ shouldForwardProp: (e) => !["open", "drawerWidth", "height"].includes(String(e)) }
|
|
713
725
|
)(({ theme: e, open: t, drawerWidth: n, height: a }) => ({
|
|
714
726
|
zIndex: e.zIndex.drawer + 1,
|
|
@@ -725,19 +737,19 @@ const _n = U(
|
|
|
725
737
|
duration: e.transitions.duration.enteringScreen
|
|
726
738
|
})
|
|
727
739
|
}
|
|
728
|
-
})),
|
|
729
|
-
|
|
740
|
+
})), or = U(
|
|
741
|
+
st,
|
|
730
742
|
{ shouldForwardProp: (e) => !["open", "drawerWidth", "height"].includes(String(e)) }
|
|
731
|
-
)(({ height: e }) => ({ height: e })),
|
|
732
|
-
const n = v(), a =
|
|
743
|
+
)(({ height: e }) => ({ height: e })), sr = ({ slots: e = {}, ...t }) => {
|
|
744
|
+
const n = v(), a = ie("(prefers-color-scheme: dark)"), s = n ? ar : or, {
|
|
733
745
|
["Layout.AppBar.MenuButton"]: o,
|
|
734
|
-
["Layout.SearchBar"]:
|
|
735
|
-
["Layout.BackButton"]:
|
|
736
|
-
} =
|
|
746
|
+
["Layout.SearchBar"]: i,
|
|
747
|
+
["Layout.BackButton"]: l
|
|
748
|
+
} = C("cms").getComponents(), { open: c } = ze(), d = tr(), u = bt(), h = L("appBar.height"), g = L("drawer.width", 280), {
|
|
737
749
|
start: y = null,
|
|
738
750
|
//: title = config('app.name', document.title),
|
|
739
|
-
end:
|
|
740
|
-
} = e, b =
|
|
751
|
+
end: S = null
|
|
752
|
+
} = e, b = gt();
|
|
741
753
|
return /* @__PURE__ */ r(
|
|
742
754
|
s,
|
|
743
755
|
{
|
|
@@ -745,38 +757,38 @@ const _n = U(
|
|
|
745
757
|
height: h,
|
|
746
758
|
drawerWidth: g,
|
|
747
759
|
...t,
|
|
748
|
-
children: /* @__PURE__ */ m(
|
|
749
|
-
(n && !c || !n && !
|
|
750
|
-
!n &&
|
|
760
|
+
children: /* @__PURE__ */ m(Yt, { children: [
|
|
761
|
+
(n && !c || !n && !u) && /* @__PURE__ */ r(o, {}),
|
|
762
|
+
!n && u && /* @__PURE__ */ r(l, {}),
|
|
751
763
|
n ? null : y,
|
|
752
764
|
/* @__PURE__ */ r(
|
|
753
|
-
|
|
765
|
+
q,
|
|
754
766
|
{
|
|
755
767
|
width: "100%",
|
|
756
768
|
variant: "h6",
|
|
757
769
|
noWrap: !0,
|
|
758
770
|
component: "div",
|
|
759
|
-
children: !n && b ||
|
|
771
|
+
children: !n && b || Z("app.name", document.title)
|
|
760
772
|
}
|
|
761
773
|
),
|
|
762
|
-
/* @__PURE__ */ r(
|
|
774
|
+
/* @__PURE__ */ r(j, { sx: { flexGrow: 1 } }),
|
|
763
775
|
/* @__PURE__ */ m(
|
|
764
|
-
|
|
776
|
+
j,
|
|
765
777
|
{
|
|
766
778
|
display: "flex",
|
|
767
779
|
alignItems: "center",
|
|
768
780
|
children: [
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
781
|
+
d && /* @__PURE__ */ r(i, {}),
|
|
782
|
+
S || /* @__PURE__ */ r(
|
|
783
|
+
Kt,
|
|
772
784
|
{
|
|
773
|
-
src: a ?
|
|
785
|
+
src: a ? nr : rr,
|
|
774
786
|
alt: "Luminix",
|
|
775
787
|
variant: "square",
|
|
776
788
|
sx: {
|
|
777
789
|
width: 40,
|
|
778
790
|
height: 40,
|
|
779
|
-
marginLeft:
|
|
791
|
+
marginLeft: d ? 2 : 0
|
|
780
792
|
}
|
|
781
793
|
}
|
|
782
794
|
)
|
|
@@ -787,28 +799,28 @@ const _n = U(
|
|
|
787
799
|
}
|
|
788
800
|
);
|
|
789
801
|
};
|
|
790
|
-
function
|
|
802
|
+
function lr(e) {
|
|
791
803
|
return /* @__PURE__ */ r(
|
|
792
|
-
|
|
804
|
+
E,
|
|
793
805
|
{
|
|
794
|
-
component:
|
|
806
|
+
component: oe,
|
|
795
807
|
to: -1,
|
|
796
808
|
edge: "start",
|
|
797
809
|
color: "inherit",
|
|
798
810
|
"aria-label": "back",
|
|
799
811
|
...e,
|
|
800
|
-
children: /* @__PURE__ */ r(
|
|
812
|
+
children: /* @__PURE__ */ r(Le, {})
|
|
801
813
|
}
|
|
802
814
|
);
|
|
803
815
|
}
|
|
804
|
-
const
|
|
816
|
+
const Je = (e, t) => ({
|
|
805
817
|
width: t,
|
|
806
818
|
transition: e.transitions.create("width", {
|
|
807
819
|
easing: e.transitions.easing.sharp,
|
|
808
820
|
duration: e.transitions.duration.enteringScreen
|
|
809
821
|
}),
|
|
810
822
|
overflowX: "hidden"
|
|
811
|
-
}),
|
|
823
|
+
}), _e = (e) => ({
|
|
812
824
|
transition: e.transitions.create("width", {
|
|
813
825
|
easing: e.transitions.easing.sharp,
|
|
814
826
|
duration: e.transitions.duration.leavingScreen
|
|
@@ -816,41 +828,41 @@ const $e = (e, t) => ({
|
|
|
816
828
|
overflowX: "hidden",
|
|
817
829
|
width: `calc(${e.spacing(9)} + 1px)`,
|
|
818
830
|
[e.breakpoints.up("sm")]: { width: `calc(${e.spacing(10)} + 1px)` }
|
|
819
|
-
}),
|
|
820
|
-
|
|
831
|
+
}), ir = U(
|
|
832
|
+
lt,
|
|
821
833
|
{ shouldForwardProp: (e) => !["open", "width"].includes(String(e)) }
|
|
822
834
|
)(({ theme: e, open: t, width: n }) => ({
|
|
823
835
|
flexShrink: 0,
|
|
824
836
|
whiteSpace: "nowrap",
|
|
825
837
|
boxSizing: "border-box",
|
|
826
838
|
...t && {
|
|
827
|
-
|
|
828
|
-
"& .MuiDrawer-paper":
|
|
839
|
+
...Je(e, n),
|
|
840
|
+
"& .MuiDrawer-paper": Je(e, n)
|
|
829
841
|
},
|
|
830
842
|
...!t && {
|
|
831
|
-
...
|
|
832
|
-
"& .MuiDrawer-paper":
|
|
843
|
+
..._e(e),
|
|
844
|
+
"& .MuiDrawer-paper": _e(e)
|
|
833
845
|
}
|
|
834
|
-
})),
|
|
835
|
-
|
|
846
|
+
})), cr = U(
|
|
847
|
+
lt,
|
|
836
848
|
{ shouldForwardProp: (e) => e !== "width" }
|
|
837
|
-
)(() => ({})),
|
|
849
|
+
)(() => ({})), ur = U("div")(({ theme: e }) => ({
|
|
838
850
|
display: "flex",
|
|
839
851
|
alignItems: "center",
|
|
840
852
|
justifyContent: "space-between",
|
|
841
853
|
padding: e.spacing(0, 1),
|
|
842
854
|
// necessary for content to be below app bar
|
|
843
855
|
...e.mixins.toolbar
|
|
844
|
-
})),
|
|
845
|
-
const t =
|
|
856
|
+
})), dr = (e) => {
|
|
857
|
+
const t = Ne(), n = v(), { open: a, handleDrawerClose: s } = ze(), o = n ? ir : cr, i = L("drawer.width", 280), l = L("appBar.height"), c = C("cms").getComponent("RecursiveList"), d = C("cms").getMenuItems();
|
|
846
858
|
return /* @__PURE__ */ m(
|
|
847
859
|
o,
|
|
848
860
|
{
|
|
849
861
|
variant: n ? "permanent" : "temporary",
|
|
850
862
|
open: a,
|
|
851
|
-
width:
|
|
863
|
+
width: i,
|
|
852
864
|
onClose: s,
|
|
853
|
-
PaperProps: { sx: { width:
|
|
865
|
+
PaperProps: { sx: { width: i } },
|
|
854
866
|
sx: {
|
|
855
867
|
display: "flex",
|
|
856
868
|
direction: "flex-column",
|
|
@@ -859,25 +871,25 @@ const $e = (e, t) => ({
|
|
|
859
871
|
},
|
|
860
872
|
...e,
|
|
861
873
|
children: [
|
|
862
|
-
/* @__PURE__ */ r(
|
|
863
|
-
/* @__PURE__ */ r(
|
|
864
|
-
/* @__PURE__ */ r(
|
|
874
|
+
/* @__PURE__ */ r(ur, { style: { height: l }, children: /* @__PURE__ */ r(E, { onClick: s, children: t.direction === "ltr" ? /* @__PURE__ */ r(Le, {}) : /* @__PURE__ */ r(Oe, {}) }) }),
|
|
875
|
+
/* @__PURE__ */ r(se, {}),
|
|
876
|
+
/* @__PURE__ */ r(j, { sx: { flexGrow: 1, overflowY: "auto", overflowX: "hidden" }, children: /* @__PURE__ */ r(
|
|
865
877
|
c,
|
|
866
878
|
{
|
|
867
879
|
collapsed: !a && n,
|
|
868
|
-
items:
|
|
880
|
+
items: d,
|
|
869
881
|
onClick: () => !n && s()
|
|
870
882
|
}
|
|
871
883
|
) })
|
|
872
884
|
]
|
|
873
885
|
}
|
|
874
886
|
);
|
|
875
|
-
},
|
|
876
|
-
const e =
|
|
887
|
+
}, pr = () => {
|
|
888
|
+
const e = gt(), t = L("breakpoint", "md"), n = bt(), {
|
|
877
889
|
["Layout.BackButton"]: a
|
|
878
|
-
} =
|
|
890
|
+
} = C("cms").getComponents();
|
|
879
891
|
return /* @__PURE__ */ m(
|
|
880
|
-
|
|
892
|
+
Pe,
|
|
881
893
|
{
|
|
882
894
|
sx: {
|
|
883
895
|
display: { xs: "none", [t]: "flex" },
|
|
@@ -889,11 +901,11 @@ const $e = (e, t) => ({
|
|
|
889
901
|
},
|
|
890
902
|
children: [
|
|
891
903
|
n && /* @__PURE__ */ r(a, {}),
|
|
892
|
-
/* @__PURE__ */ r(
|
|
904
|
+
/* @__PURE__ */ r(q, { variant: "h5", noWrap: !0, children: e })
|
|
893
905
|
]
|
|
894
906
|
}
|
|
895
907
|
);
|
|
896
|
-
},
|
|
908
|
+
}, Ue = p.createContext({
|
|
897
909
|
Model: null,
|
|
898
910
|
anchorEl: null,
|
|
899
911
|
setAnchorEl: () => {
|
|
@@ -904,11 +916,13 @@ const $e = (e, t) => ({
|
|
|
904
916
|
searchParams: new URLSearchParams(),
|
|
905
917
|
setSearchParams: () => {
|
|
906
918
|
},
|
|
919
|
+
handleApplyFilters: () => {
|
|
920
|
+
},
|
|
907
921
|
clearSearchParams: () => {
|
|
908
922
|
},
|
|
909
923
|
clearFilters: () => {
|
|
910
924
|
}
|
|
911
|
-
}),
|
|
925
|
+
}), ee = p.createContext({
|
|
912
926
|
key: "",
|
|
913
927
|
type: "",
|
|
914
928
|
operator: "",
|
|
@@ -925,37 +939,33 @@ const $e = (e, t) => ({
|
|
|
925
939
|
},
|
|
926
940
|
setIsRelation: () => {
|
|
927
941
|
}
|
|
928
|
-
}),
|
|
942
|
+
}), hr = (e) => {
|
|
929
943
|
if (!Array.isArray(e))
|
|
930
944
|
return e;
|
|
931
945
|
let t;
|
|
932
946
|
return f.isEmpty(e) ? t = "" : t = e[0], t;
|
|
933
|
-
},
|
|
947
|
+
}, mr = (e) => {
|
|
934
948
|
if (Array.isArray(e))
|
|
935
949
|
return e;
|
|
936
950
|
let t;
|
|
937
951
|
return f.isEmpty(e) ? t = [] : t = [e, ""], t;
|
|
938
|
-
},
|
|
939
|
-
const a = e.getSchema().relations[t], s =
|
|
940
|
-
for (const
|
|
941
|
-
const { data: c } = await s.where(o,
|
|
942
|
-
|
|
952
|
+
}, fr = async (e, t, n) => {
|
|
953
|
+
const a = e.getSchema().relations[t], s = ne().make(a.model), o = s.getSchema().primaryKey, i = [];
|
|
954
|
+
for (const l of n) {
|
|
955
|
+
const { data: c } = await s.where(o, l).get();
|
|
956
|
+
i.push(c.first());
|
|
943
957
|
}
|
|
944
|
-
return
|
|
958
|
+
return i;
|
|
945
959
|
};
|
|
946
|
-
function
|
|
947
|
-
const n =
|
|
948
|
-
s((
|
|
949
|
-
},
|
|
950
|
-
const
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
$ ? (c("relation"), g([])) : y && c("equals"), k($);
|
|
954
|
-
}
|
|
955
|
-
M !== u && (["boolean"].includes(n.getInputType(M)) && c("equals"), g(() => {
|
|
956
|
-
if (["between", "notBetween"].includes(i))
|
|
960
|
+
function gr(e, t) {
|
|
961
|
+
const n = C("filter"), { Model: a, setColumnsFilter: s } = p.useContext(Ue), [o, i] = p.useState(t.key), [l, c] = p.useState(t.operator), [d, u] = p.useState(t.type), [h, g] = p.useState(t.value), [y, S] = p.useState(t.nullable), [b, w] = p.useState(t.is_relation), k = p.useMemo(() => n.getFilterableColumns(a), [a]), x = (O) => () => {
|
|
962
|
+
s((I) => I.filter((D, H) => H !== O));
|
|
963
|
+
}, A = async (O) => {
|
|
964
|
+
const I = O.target.value, D = k.find((St) => St.key === I), H = (D == null ? void 0 : D.type) ?? "text", kt = (D == null ? void 0 : D.nullable) ?? !1, Ke = (D == null ? void 0 : D.is_relation) ?? !1;
|
|
965
|
+
Ke ? (c("relation"), g([])) : b && c("equals"), w(Ke), S(kt), H !== d && (["boolean"].includes(n.getInputType(H)) && c("equals"), g(() => {
|
|
966
|
+
if (["between", "notBetween"].includes(l))
|
|
957
967
|
return [];
|
|
958
|
-
switch (n.getInputType(
|
|
968
|
+
switch (n.getInputType(H)) {
|
|
959
969
|
case "number":
|
|
960
970
|
return 0;
|
|
961
971
|
case "boolean":
|
|
@@ -963,103 +973,101 @@ function dr(e, t) {
|
|
|
963
973
|
default:
|
|
964
974
|
return "";
|
|
965
975
|
}
|
|
966
|
-
})),
|
|
967
|
-
},
|
|
968
|
-
const
|
|
969
|
-
|
|
970
|
-
switch (
|
|
976
|
+
})), i(I), u(H);
|
|
977
|
+
}, R = async (O) => {
|
|
978
|
+
const I = O.target.value;
|
|
979
|
+
l !== I && g((D) => {
|
|
980
|
+
switch (I) {
|
|
971
981
|
case "between":
|
|
972
982
|
case "notBetween":
|
|
973
|
-
return
|
|
983
|
+
return mr(D);
|
|
974
984
|
case "null":
|
|
975
985
|
case "notNull":
|
|
976
986
|
return "1";
|
|
977
987
|
default:
|
|
978
|
-
return
|
|
988
|
+
return hr(D);
|
|
979
989
|
}
|
|
980
|
-
}), c(
|
|
990
|
+
}), c(I);
|
|
981
991
|
};
|
|
982
992
|
return p.useEffect(() => {
|
|
983
|
-
s((
|
|
993
|
+
s((O) => O.map((D, H) => e === H ? {
|
|
984
994
|
...D,
|
|
985
995
|
key: o,
|
|
986
|
-
operator:
|
|
987
|
-
type:
|
|
996
|
+
operator: l,
|
|
997
|
+
type: d,
|
|
988
998
|
value: h,
|
|
989
|
-
|
|
999
|
+
nullable: y,
|
|
1000
|
+
is_relation: b
|
|
990
1001
|
} : D));
|
|
991
|
-
}, [o,
|
|
992
|
-
columns:
|
|
1002
|
+
}, [o, l, d, h, y, b]), {
|
|
1003
|
+
columns: k,
|
|
993
1004
|
key: o,
|
|
994
|
-
setKey:
|
|
995
|
-
operator:
|
|
1005
|
+
setKey: i,
|
|
1006
|
+
operator: l,
|
|
996
1007
|
setOperator: c,
|
|
997
|
-
type:
|
|
998
|
-
setType:
|
|
1008
|
+
type: d,
|
|
1009
|
+
setType: u,
|
|
999
1010
|
value: h,
|
|
1000
1011
|
setValue: g,
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1012
|
+
nullable: y,
|
|
1013
|
+
setNullable: S,
|
|
1014
|
+
isRelation: b,
|
|
1015
|
+
setIsRelation: w,
|
|
1016
|
+
handleKey: A,
|
|
1017
|
+
handleOperator: R,
|
|
1005
1018
|
handleRemoveColumn: x
|
|
1006
1019
|
};
|
|
1007
1020
|
}
|
|
1008
|
-
const
|
|
1009
|
-
const a = e.getSchema().relations[t].model, { data: s } = await
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
}, pr = async (e, t, n = "", a) => {
|
|
1017
|
-
const s = e.getSchema().relations[t], o = te().make(s.model), l = o.getSchema().primaryKey, { data: i } = await o.searchBy(n).get();
|
|
1018
|
-
return O([...a, ...i]).unique(l);
|
|
1019
|
-
}, hr = () => {
|
|
1020
|
-
const e = v(), t = K(), {
|
|
1021
|
+
const et = async (e, t, n) => {
|
|
1022
|
+
const a = e.getSchema().relations[t].model, { data: s } = await ne().make(a).get(), o = s.all().filter((d) => !n.find((u) => u.getKey() === d.getKey())), i = o.length, l = n.length, c = 15;
|
|
1023
|
+
return i + l > c ? N([...n, ...o.slice(0, c - l)]) : N([...n, ...o]);
|
|
1024
|
+
}, br = async (e, t, n = "", a) => {
|
|
1025
|
+
const s = e.getSchema().relations[t], o = ne().make(s.model), i = o.getSchema().primaryKey, { data: l } = await o.searchBy(n).get();
|
|
1026
|
+
return N([...a, ...l]).unique(i);
|
|
1027
|
+
}, yr = () => {
|
|
1028
|
+
const e = v(), t = $(), {
|
|
1021
1029
|
key: n,
|
|
1022
1030
|
value: a,
|
|
1023
1031
|
setValue: s
|
|
1024
|
-
} = p.useContext(
|
|
1025
|
-
() => o &&
|
|
1026
|
-
[o,
|
|
1027
|
-
),
|
|
1028
|
-
c(
|
|
1032
|
+
} = p.useContext(ee), [o, i] = p.useState(!1), [l, c] = p.useState(""), [d, u] = p.useState(N([])), [h, g] = p.useState([]), y = p.useMemo(
|
|
1033
|
+
() => o && d.count() === 0,
|
|
1034
|
+
[o, d]
|
|
1035
|
+
), S = async (b, w) => {
|
|
1036
|
+
c(w), f.isEmpty(w) || u(await br(t, n, w, N(h)));
|
|
1029
1037
|
};
|
|
1030
1038
|
return p.useEffect(() => {
|
|
1031
|
-
a.length > 0 && (async () => g(await
|
|
1039
|
+
a.length > 0 && (async () => g(await fr(t, n, a)))();
|
|
1032
1040
|
}, []), p.useEffect(() => {
|
|
1033
1041
|
let b = !0;
|
|
1034
1042
|
if (y)
|
|
1035
|
-
return (async () => b &&
|
|
1043
|
+
return (async () => b && u(await et(t, n, h)))(), () => {
|
|
1036
1044
|
b = !1;
|
|
1037
1045
|
};
|
|
1038
1046
|
}, [y]), p.useEffect(() => {
|
|
1039
|
-
s(h.map((b) => b.getKey())), f.isEmpty(
|
|
1047
|
+
s(h.map((b) => b.getKey())), f.isEmpty(l) ? (async () => u(await et(t, n, h)))() : u(N([]));
|
|
1040
1048
|
}, [h]), /* @__PURE__ */ r(
|
|
1041
|
-
|
|
1049
|
+
$t,
|
|
1042
1050
|
{
|
|
1043
1051
|
sx: { width: e ? 377 : "100%" },
|
|
1044
1052
|
open: o,
|
|
1045
1053
|
onOpen: () => {
|
|
1046
|
-
|
|
1054
|
+
i(!0);
|
|
1047
1055
|
},
|
|
1048
1056
|
onClose: () => {
|
|
1049
|
-
|
|
1057
|
+
i(!1);
|
|
1050
1058
|
},
|
|
1051
1059
|
value: h,
|
|
1052
|
-
onChange: (b,
|
|
1053
|
-
g(
|
|
1060
|
+
onChange: (b, w) => {
|
|
1061
|
+
g(w);
|
|
1054
1062
|
},
|
|
1055
|
-
inputValue:
|
|
1056
|
-
onInputChange:
|
|
1057
|
-
options:
|
|
1063
|
+
inputValue: l,
|
|
1064
|
+
onInputChange: S,
|
|
1065
|
+
options: d.all() || [],
|
|
1058
1066
|
getOptionLabel: (b) => b.getLabel(),
|
|
1059
|
-
isOptionEqualToValue: (b,
|
|
1067
|
+
isOptionEqualToValue: (b, w) => b.getKey() === w.getKey(),
|
|
1060
1068
|
filterOptions: (b) => b,
|
|
1061
1069
|
renderInput: (b) => /* @__PURE__ */ r(
|
|
1062
|
-
|
|
1070
|
+
xr,
|
|
1063
1071
|
{
|
|
1064
1072
|
params: b,
|
|
1065
1073
|
loading: y
|
|
@@ -1072,52 +1080,52 @@ const Ze = async (e, t, n) => {
|
|
|
1072
1080
|
multiple: !0
|
|
1073
1081
|
}
|
|
1074
1082
|
);
|
|
1075
|
-
},
|
|
1076
|
-
const { t: n } =
|
|
1083
|
+
}, xr = ({ params: e, loading: t }) => {
|
|
1084
|
+
const { t: n } = F();
|
|
1077
1085
|
return /* @__PURE__ */ r(
|
|
1078
|
-
|
|
1086
|
+
ae,
|
|
1079
1087
|
{
|
|
1080
1088
|
...e,
|
|
1081
1089
|
label: n("Value"),
|
|
1082
1090
|
InputProps: {
|
|
1083
1091
|
...e.InputProps,
|
|
1084
1092
|
endAdornment: /* @__PURE__ */ m(p.Fragment, { children: [
|
|
1085
|
-
t ? /* @__PURE__ */ r(
|
|
1093
|
+
t ? /* @__PURE__ */ r(Ht, { color: "inherit", size: 20 }) : null,
|
|
1086
1094
|
e.InputProps.endAdornment
|
|
1087
1095
|
] })
|
|
1088
1096
|
}
|
|
1089
1097
|
}
|
|
1090
1098
|
);
|
|
1091
|
-
},
|
|
1092
|
-
const { t } =
|
|
1099
|
+
}, fe = ({ index: e = null }) => {
|
|
1100
|
+
const { t } = F(), n = v(), a = C("filter"), {
|
|
1093
1101
|
type: s,
|
|
1094
1102
|
value: o,
|
|
1095
|
-
setValue:
|
|
1096
|
-
} = p.useContext(
|
|
1103
|
+
setValue: i
|
|
1104
|
+
} = p.useContext(ee), c = a.getInputType(s) === "datetime-local" ? 230 : 167.5, d = e !== null ? `${t("Date")} ${e + 1}` : `${t("Date")}`, u = p.useMemo(
|
|
1097
1105
|
() => e !== null ? o[e] : o,
|
|
1098
1106
|
[o]
|
|
1099
1107
|
), h = (g) => {
|
|
1100
|
-
|
|
1101
|
-
const
|
|
1102
|
-
return
|
|
1108
|
+
i(typeof e == "number" ? (y) => {
|
|
1109
|
+
const S = y;
|
|
1110
|
+
return S[e] = g.target.value, [...S];
|
|
1103
1111
|
} : g.target.value);
|
|
1104
1112
|
};
|
|
1105
1113
|
return /* @__PURE__ */ r(
|
|
1106
|
-
|
|
1114
|
+
ae,
|
|
1107
1115
|
{
|
|
1108
1116
|
type: a.getInputType(s),
|
|
1109
|
-
label:
|
|
1110
|
-
value:
|
|
1117
|
+
label: d,
|
|
1118
|
+
value: u || /* @__PURE__ */ new Date(),
|
|
1111
1119
|
onChange: h,
|
|
1112
1120
|
size: "small",
|
|
1113
1121
|
sx: { width: n ? c : "100%" }
|
|
1114
1122
|
}
|
|
1115
1123
|
);
|
|
1116
|
-
},
|
|
1117
|
-
const e = v(), { value: t, setValue: n } = p.useContext(
|
|
1118
|
-
return /* @__PURE__ */ m(
|
|
1124
|
+
}, wr = () => {
|
|
1125
|
+
const e = v(), { value: t, setValue: n } = p.useContext(ee);
|
|
1126
|
+
return /* @__PURE__ */ m(T, { children: [
|
|
1119
1127
|
/* @__PURE__ */ r(
|
|
1120
|
-
|
|
1128
|
+
Zt,
|
|
1121
1129
|
{
|
|
1122
1130
|
checked: t,
|
|
1123
1131
|
onChange: (s) => {
|
|
@@ -1128,96 +1136,96 @@ const Ze = async (e, t, n) => {
|
|
|
1128
1136
|
size: "small"
|
|
1129
1137
|
}
|
|
1130
1138
|
),
|
|
1131
|
-
e && /* @__PURE__ */ r(
|
|
1139
|
+
e && /* @__PURE__ */ r(j, { width: 325 })
|
|
1132
1140
|
] });
|
|
1133
|
-
},
|
|
1134
|
-
const { t } =
|
|
1141
|
+
}, ge = ({ index: e = null }) => {
|
|
1142
|
+
const { t } = F(), n = v(), a = C("filter"), {
|
|
1135
1143
|
type: s,
|
|
1136
1144
|
value: o,
|
|
1137
|
-
setValue:
|
|
1138
|
-
} = p.useContext(
|
|
1145
|
+
setValue: i
|
|
1146
|
+
} = p.useContext(ee), l = e !== null ? `${t("Value")} ${e + 1}` : `${t("Value")}`, c = p.useMemo(
|
|
1139
1147
|
() => e !== null ? o[e] : o,
|
|
1140
1148
|
[o]
|
|
1141
|
-
),
|
|
1142
|
-
|
|
1149
|
+
), d = (u) => {
|
|
1150
|
+
i(typeof e == "number" ? (h) => {
|
|
1143
1151
|
const g = h;
|
|
1144
|
-
return g[e] =
|
|
1145
|
-
} :
|
|
1152
|
+
return g[e] = u.target.value, [...g];
|
|
1153
|
+
} : u.target.value);
|
|
1146
1154
|
};
|
|
1147
1155
|
return /* @__PURE__ */ r(
|
|
1148
|
-
|
|
1156
|
+
ae,
|
|
1149
1157
|
{
|
|
1150
1158
|
type: a.getInputType(s),
|
|
1151
|
-
label:
|
|
1159
|
+
label: l,
|
|
1152
1160
|
value: c || "",
|
|
1153
|
-
onChange:
|
|
1161
|
+
onChange: d,
|
|
1154
1162
|
sx: { width: n ? 167.5 : "100%" },
|
|
1155
1163
|
size: "small"
|
|
1156
1164
|
}
|
|
1157
1165
|
);
|
|
1158
|
-
},
|
|
1159
|
-
const e = v(), t =
|
|
1166
|
+
}, be = () => {
|
|
1167
|
+
const e = v(), t = C("filter"), { type: n, operator: a } = p.useContext(ee), s = p.useMemo(
|
|
1160
1168
|
() => ["between", "notBetween"].includes(a),
|
|
1161
1169
|
[a]
|
|
1162
1170
|
);
|
|
1163
1171
|
if (["null", "notNull"].includes(a))
|
|
1164
|
-
return e ? /* @__PURE__ */ r(
|
|
1172
|
+
return e ? /* @__PURE__ */ r(j, { width: 230 }) : null;
|
|
1165
1173
|
if (s)
|
|
1166
1174
|
switch (t.getInputType(n)) {
|
|
1167
1175
|
case "date":
|
|
1168
1176
|
case "datetime-local":
|
|
1169
|
-
return /* @__PURE__ */ m(
|
|
1170
|
-
/* @__PURE__ */ r(me, { index: 0 }),
|
|
1171
|
-
/* @__PURE__ */ r(me, { index: 1 })
|
|
1172
|
-
] });
|
|
1173
|
-
default:
|
|
1174
|
-
return /* @__PURE__ */ m(F, { children: [
|
|
1177
|
+
return /* @__PURE__ */ m(T, { children: [
|
|
1175
1178
|
/* @__PURE__ */ r(fe, { index: 0 }),
|
|
1176
1179
|
/* @__PURE__ */ r(fe, { index: 1 })
|
|
1177
1180
|
] });
|
|
1181
|
+
default:
|
|
1182
|
+
return /* @__PURE__ */ m(T, { children: [
|
|
1183
|
+
/* @__PURE__ */ r(ge, { index: 0 }),
|
|
1184
|
+
/* @__PURE__ */ r(ge, { index: 1 })
|
|
1185
|
+
] });
|
|
1178
1186
|
}
|
|
1179
1187
|
switch (t.getInputType(n)) {
|
|
1180
1188
|
case "date":
|
|
1181
1189
|
case "datetime-local":
|
|
1182
|
-
return /* @__PURE__ */ r(
|
|
1190
|
+
return /* @__PURE__ */ r(fe, {});
|
|
1183
1191
|
case "autocomplete":
|
|
1184
|
-
return /* @__PURE__ */ r(
|
|
1192
|
+
return /* @__PURE__ */ r(yr, {});
|
|
1185
1193
|
case "boolean":
|
|
1186
|
-
return /* @__PURE__ */ r(
|
|
1194
|
+
return /* @__PURE__ */ r(wr, {});
|
|
1187
1195
|
default:
|
|
1188
|
-
return /* @__PURE__ */ r(
|
|
1196
|
+
return /* @__PURE__ */ r(ge, {});
|
|
1189
1197
|
}
|
|
1190
|
-
},
|
|
1191
|
-
const { t: n } =
|
|
1192
|
-
columns:
|
|
1198
|
+
}, kr = ({ index: e, column: t }) => {
|
|
1199
|
+
const { t: n } = F(), a = v(), s = L("breakpoint", "md"), o = C("filter"), i = p.useMemo(() => o.getMatchingOperators(t), [t]), {
|
|
1200
|
+
columns: l,
|
|
1193
1201
|
key: c,
|
|
1194
|
-
setKey:
|
|
1195
|
-
operator:
|
|
1202
|
+
setKey: d,
|
|
1203
|
+
operator: u,
|
|
1196
1204
|
setOperator: h,
|
|
1197
1205
|
type: g,
|
|
1198
1206
|
setType: y,
|
|
1199
|
-
value:
|
|
1207
|
+
value: S,
|
|
1200
1208
|
setValue: b,
|
|
1201
|
-
isRelation:
|
|
1202
|
-
setIsRelation:
|
|
1203
|
-
handleKey:
|
|
1204
|
-
handleOperator:
|
|
1205
|
-
handleRemoveColumn:
|
|
1206
|
-
} =
|
|
1209
|
+
isRelation: w,
|
|
1210
|
+
setIsRelation: k,
|
|
1211
|
+
handleKey: x,
|
|
1212
|
+
handleOperator: A,
|
|
1213
|
+
handleRemoveColumn: R
|
|
1214
|
+
} = gr(e, t), O = ["boolean"].includes(o.getInputType(g));
|
|
1207
1215
|
return /* @__PURE__ */ r(
|
|
1208
|
-
|
|
1216
|
+
ee.Provider,
|
|
1209
1217
|
{
|
|
1210
1218
|
value: {
|
|
1211
1219
|
key: c,
|
|
1212
|
-
setKey:
|
|
1220
|
+
setKey: d,
|
|
1213
1221
|
type: g,
|
|
1214
1222
|
setType: y,
|
|
1215
|
-
operator:
|
|
1223
|
+
operator: u,
|
|
1216
1224
|
setOperator: h,
|
|
1217
|
-
value:
|
|
1225
|
+
value: S,
|
|
1218
1226
|
setValue: b,
|
|
1219
|
-
isRelation:
|
|
1220
|
-
setIsRelation:
|
|
1227
|
+
isRelation: w,
|
|
1228
|
+
setIsRelation: k
|
|
1221
1229
|
},
|
|
1222
1230
|
children: /* @__PURE__ */ m(
|
|
1223
1231
|
Y,
|
|
@@ -1257,11 +1265,11 @@ const Ze = async (e, t, n) => {
|
|
|
1257
1265
|
...!a && { width: "100%" },
|
|
1258
1266
|
gap: 1,
|
|
1259
1267
|
children: [
|
|
1260
|
-
/* @__PURE__ */ m(
|
|
1261
|
-
width: a ?
|
|
1268
|
+
/* @__PURE__ */ m(we, { sx: {
|
|
1269
|
+
width: a ? 195 : `calc(100% - ${O ? 88 : 44}px)`
|
|
1262
1270
|
}, children: [
|
|
1263
1271
|
/* @__PURE__ */ r(
|
|
1264
|
-
|
|
1272
|
+
ke,
|
|
1265
1273
|
{
|
|
1266
1274
|
id: "filter-column-select-label",
|
|
1267
1275
|
size: "small",
|
|
@@ -1269,20 +1277,21 @@ const Ze = async (e, t, n) => {
|
|
|
1269
1277
|
}
|
|
1270
1278
|
),
|
|
1271
1279
|
/* @__PURE__ */ r(
|
|
1272
|
-
|
|
1280
|
+
le,
|
|
1273
1281
|
{
|
|
1274
1282
|
labelId: "filter-column-select-label",
|
|
1275
1283
|
id: "filter-column-select",
|
|
1276
1284
|
value: c,
|
|
1277
|
-
|
|
1285
|
+
label: n("Column"),
|
|
1286
|
+
onChange: x,
|
|
1278
1287
|
size: "small",
|
|
1279
|
-
children:
|
|
1280
|
-
|
|
1288
|
+
children: l.map(({ key: I, label: D }) => /* @__PURE__ */ r(
|
|
1289
|
+
G,
|
|
1281
1290
|
{
|
|
1282
|
-
value:
|
|
1283
|
-
children:
|
|
1291
|
+
value: I,
|
|
1292
|
+
children: n(D)
|
|
1284
1293
|
},
|
|
1285
|
-
`column_${
|
|
1294
|
+
`column_${I}_option`
|
|
1286
1295
|
))
|
|
1287
1296
|
}
|
|
1288
1297
|
)
|
|
@@ -1293,13 +1302,13 @@ const Ze = async (e, t, n) => {
|
|
|
1293
1302
|
direction: "row",
|
|
1294
1303
|
alignItems: "center",
|
|
1295
1304
|
children: [
|
|
1296
|
-
|
|
1305
|
+
O && /* @__PURE__ */ r(be, {}),
|
|
1297
1306
|
/* @__PURE__ */ r(
|
|
1298
|
-
|
|
1307
|
+
E,
|
|
1299
1308
|
{
|
|
1300
1309
|
color: "error",
|
|
1301
|
-
onClick:
|
|
1302
|
-
children: /* @__PURE__ */ r(
|
|
1310
|
+
onClick: R(e),
|
|
1311
|
+
children: /* @__PURE__ */ r(Ge, {})
|
|
1303
1312
|
}
|
|
1304
1313
|
)
|
|
1305
1314
|
]
|
|
@@ -1308,11 +1317,11 @@ const Ze = async (e, t, n) => {
|
|
|
1308
1317
|
]
|
|
1309
1318
|
}
|
|
1310
1319
|
),
|
|
1311
|
-
!
|
|
1312
|
-
width: a ?
|
|
1320
|
+
!w && !O && /* @__PURE__ */ m(we, { sx: {
|
|
1321
|
+
width: a ? 147.5 : "100%"
|
|
1313
1322
|
}, children: [
|
|
1314
1323
|
/* @__PURE__ */ r(
|
|
1315
|
-
|
|
1324
|
+
ke,
|
|
1316
1325
|
{
|
|
1317
1326
|
id: "filter-operator-select-label",
|
|
1318
1327
|
size: "small",
|
|
@@ -1320,35 +1329,36 @@ const Ze = async (e, t, n) => {
|
|
|
1320
1329
|
}
|
|
1321
1330
|
),
|
|
1322
1331
|
/* @__PURE__ */ r(
|
|
1323
|
-
|
|
1332
|
+
le,
|
|
1324
1333
|
{
|
|
1325
1334
|
labelId: "filter-operator-select-label",
|
|
1326
1335
|
id: "filter-operator-select",
|
|
1327
|
-
value:
|
|
1328
|
-
|
|
1336
|
+
value: u,
|
|
1337
|
+
label: n("Operator"),
|
|
1338
|
+
onChange: A,
|
|
1329
1339
|
size: "small",
|
|
1330
|
-
children:
|
|
1331
|
-
|
|
1340
|
+
children: i.map(({ key: I, label: D }) => /* @__PURE__ */ r(
|
|
1341
|
+
G,
|
|
1332
1342
|
{
|
|
1333
|
-
value:
|
|
1334
|
-
children: n(
|
|
1343
|
+
value: I,
|
|
1344
|
+
children: n(D)
|
|
1335
1345
|
},
|
|
1336
|
-
`operator_${
|
|
1346
|
+
`operator_${I}_option`
|
|
1337
1347
|
))
|
|
1338
1348
|
}
|
|
1339
1349
|
)
|
|
1340
1350
|
] }),
|
|
1341
|
-
a ? /* @__PURE__ */ r(
|
|
1351
|
+
a ? /* @__PURE__ */ r(be, {}) : !O && /* @__PURE__ */ r(be, {})
|
|
1342
1352
|
]
|
|
1343
1353
|
},
|
|
1344
1354
|
`filter_${c}_${e}`
|
|
1345
1355
|
),
|
|
1346
1356
|
a && /* @__PURE__ */ r(
|
|
1347
|
-
|
|
1357
|
+
E,
|
|
1348
1358
|
{
|
|
1349
1359
|
color: "error",
|
|
1350
|
-
onClick:
|
|
1351
|
-
children: /* @__PURE__ */ r(
|
|
1360
|
+
onClick: R(e),
|
|
1361
|
+
children: /* @__PURE__ */ r(Ge, {})
|
|
1352
1362
|
}
|
|
1353
1363
|
)
|
|
1354
1364
|
]
|
|
@@ -1356,38 +1366,135 @@ const Ze = async (e, t, n) => {
|
|
|
1356
1366
|
)
|
|
1357
1367
|
}
|
|
1358
1368
|
);
|
|
1359
|
-
},
|
|
1369
|
+
}, tt = ({ dialog: e = !1 }) => {
|
|
1370
|
+
const { t } = F(), n = v(), a = L("breakpoint", "md"), s = C("filter"), {
|
|
1371
|
+
columnsFilter: o,
|
|
1372
|
+
setColumnsFilter: i,
|
|
1373
|
+
handleApplyFilters: l,
|
|
1374
|
+
clearFilters: c
|
|
1375
|
+
} = p.useContext(Ue), d = () => {
|
|
1376
|
+
i((u) => [
|
|
1377
|
+
...u,
|
|
1378
|
+
{
|
|
1379
|
+
key: "",
|
|
1380
|
+
operator: "equals",
|
|
1381
|
+
type: "text",
|
|
1382
|
+
value: "",
|
|
1383
|
+
appended: !1,
|
|
1384
|
+
nullable: !1,
|
|
1385
|
+
is_relation: !1
|
|
1386
|
+
}
|
|
1387
|
+
]);
|
|
1388
|
+
};
|
|
1389
|
+
return /* @__PURE__ */ m(
|
|
1390
|
+
j,
|
|
1391
|
+
{
|
|
1392
|
+
sx: {
|
|
1393
|
+
minWidth: { [a]: 567.5 },
|
|
1394
|
+
p: e ? 0 : 2
|
|
1395
|
+
},
|
|
1396
|
+
children: [
|
|
1397
|
+
/* @__PURE__ */ r(B, { children: o.map((u, h, g) => {
|
|
1398
|
+
const y = h == g.length - 1;
|
|
1399
|
+
return /* @__PURE__ */ m(T, { children: [
|
|
1400
|
+
/* @__PURE__ */ r(
|
|
1401
|
+
kr,
|
|
1402
|
+
{
|
|
1403
|
+
index: h,
|
|
1404
|
+
column: u
|
|
1405
|
+
},
|
|
1406
|
+
`row_${u.key}`
|
|
1407
|
+
),
|
|
1408
|
+
!n && /* @__PURE__ */ r(se, { sx: {
|
|
1409
|
+
mt: y ? 0.625 : 1.25,
|
|
1410
|
+
mb: y ? 0.75 : 1.5,
|
|
1411
|
+
...y && {
|
|
1412
|
+
border: "none"
|
|
1413
|
+
}
|
|
1414
|
+
} })
|
|
1415
|
+
] });
|
|
1416
|
+
}) }),
|
|
1417
|
+
/* @__PURE__ */ r(
|
|
1418
|
+
B,
|
|
1419
|
+
{
|
|
1420
|
+
direction: "row",
|
|
1421
|
+
alignItems: "center",
|
|
1422
|
+
justifyContent: "center",
|
|
1423
|
+
children: n ? /* @__PURE__ */ r(
|
|
1424
|
+
M,
|
|
1425
|
+
{
|
|
1426
|
+
variant: "outlined",
|
|
1427
|
+
onClick: d,
|
|
1428
|
+
fullWidth: !0,
|
|
1429
|
+
sx: { mt: 0.75 },
|
|
1430
|
+
children: `+ ${t("Add Column")}`
|
|
1431
|
+
}
|
|
1432
|
+
) : /* @__PURE__ */ r(
|
|
1433
|
+
E,
|
|
1434
|
+
{
|
|
1435
|
+
onClick: d,
|
|
1436
|
+
color: "primary",
|
|
1437
|
+
sx: { fontSize: 32 },
|
|
1438
|
+
children: /* @__PURE__ */ r(pn, { fontSize: "inherit" })
|
|
1439
|
+
}
|
|
1440
|
+
)
|
|
1441
|
+
}
|
|
1442
|
+
),
|
|
1443
|
+
n && /* @__PURE__ */ m(
|
|
1444
|
+
B,
|
|
1445
|
+
{
|
|
1446
|
+
direction: "row",
|
|
1447
|
+
justifyContent: "space-between",
|
|
1448
|
+
mt: 2,
|
|
1449
|
+
children: [
|
|
1450
|
+
/* @__PURE__ */ r(M, { onClick: c, children: t("Clear") }),
|
|
1451
|
+
/* @__PURE__ */ r(
|
|
1452
|
+
M,
|
|
1453
|
+
{
|
|
1454
|
+
variant: "contained",
|
|
1455
|
+
onClick: l,
|
|
1456
|
+
disabled: s.checkIfCanApplyFilters(o),
|
|
1457
|
+
children: t("Apply")
|
|
1458
|
+
}
|
|
1459
|
+
)
|
|
1460
|
+
]
|
|
1461
|
+
}
|
|
1462
|
+
)
|
|
1463
|
+
]
|
|
1464
|
+
}
|
|
1465
|
+
);
|
|
1466
|
+
}, yt = (e) => {
|
|
1360
1467
|
const t = {};
|
|
1361
1468
|
for (const [n, a] of e.entries())
|
|
1362
1469
|
f.set(t, n, a);
|
|
1363
1470
|
return t;
|
|
1364
|
-
},
|
|
1365
|
-
const t = e instanceof Date ? e : new Date(e), n = `${t.getFullYear()}`, a = `${f.padStart(`${t.getMonth() + 1}`, 2, "0")}`, s = `${f.padStart(`${t.getDate()}`, 2, "0")}`, o = `${f.padStart(`${t.getHours()}`, 2, "0")}`,
|
|
1366
|
-
return `${n}-${a}-${s}T${o}:${
|
|
1367
|
-
},
|
|
1368
|
-
const n =
|
|
1369
|
-
return Object.entries(s).forEach(([,
|
|
1370
|
-
Object.entries(
|
|
1371
|
-
e.filter((
|
|
1372
|
-
const
|
|
1373
|
-
const g = f.camelCase(
|
|
1471
|
+
}, nt = (e) => {
|
|
1472
|
+
const t = e instanceof Date ? e : new Date(e), n = `${t.getFullYear()}`, a = `${f.padStart(`${t.getMonth() + 1}`, 2, "0")}`, s = `${f.padStart(`${t.getDate()}`, 2, "0")}`, o = `${f.padStart(`${t.getHours()}`, 2, "0")}`, i = `${f.padStart(`${t.getMinutes()}`, 2, "0")}`;
|
|
1473
|
+
return `${n}-${a}-${s}T${o}:${i}`;
|
|
1474
|
+
}, Sr = (e, t) => {
|
|
1475
|
+
const n = C("filter"), a = yt(t), s = Object.keys(a).reduce((i, l) => (["where"].includes(l) && (i[l] = a[l]), i), {}), o = [];
|
|
1476
|
+
return Object.entries(s).forEach(([, i]) => {
|
|
1477
|
+
Object.entries(i).forEach(([l, c]) => {
|
|
1478
|
+
e.filter((d) => {
|
|
1479
|
+
const u = (() => {
|
|
1480
|
+
const g = f.camelCase(l.split(f.camelCase(d.key))[1]);
|
|
1374
1481
|
return f.isEmpty(g) ? "equals" : g;
|
|
1375
1482
|
})();
|
|
1376
|
-
if (!n.getOperators().includes(
|
|
1483
|
+
if (!n.getOperators().includes(u))
|
|
1377
1484
|
return !1;
|
|
1378
|
-
const h = f.snakeCase(
|
|
1379
|
-
return
|
|
1380
|
-
}).forEach((
|
|
1381
|
-
let
|
|
1382
|
-
(f.isUndefined(
|
|
1485
|
+
const h = f.snakeCase(l.split(f.upperFirst(u))[0]);
|
|
1486
|
+
return d.key === h;
|
|
1487
|
+
}).forEach((d) => {
|
|
1488
|
+
let u = f.camelCase(l.split(f.camelCase(d.key))[1]);
|
|
1489
|
+
(f.isUndefined(u) || f.isNull(u) || f.isEmpty(u)) && (u = "equals");
|
|
1383
1490
|
let h = c;
|
|
1384
|
-
switch (n.getInputType(
|
|
1491
|
+
switch (n.getInputType(d.type)) {
|
|
1385
1492
|
case "text": {
|
|
1386
1493
|
Array.isArray(c) && (h = c.join(","));
|
|
1387
1494
|
break;
|
|
1388
1495
|
}
|
|
1389
1496
|
case "datetime-local": {
|
|
1390
|
-
Array.isArray(c) ? h = c.map((g) =>
|
|
1497
|
+
Array.isArray(c) ? h = c.map((g) => nt(g)) : h = nt(c);
|
|
1391
1498
|
break;
|
|
1392
1499
|
}
|
|
1393
1500
|
case "boolean": {
|
|
@@ -1396,218 +1503,181 @@ const Ze = async (e, t, n) => {
|
|
|
1396
1503
|
}
|
|
1397
1504
|
}
|
|
1398
1505
|
o.push({
|
|
1399
|
-
key:
|
|
1400
|
-
operator:
|
|
1401
|
-
type:
|
|
1506
|
+
key: d.key,
|
|
1507
|
+
operator: u,
|
|
1508
|
+
type: d.type,
|
|
1402
1509
|
value: h,
|
|
1403
|
-
|
|
1510
|
+
nullable: d.nullable,
|
|
1511
|
+
is_relation: d.is_relation
|
|
1404
1512
|
});
|
|
1405
1513
|
});
|
|
1406
1514
|
});
|
|
1407
1515
|
}), o;
|
|
1408
|
-
},
|
|
1409
|
-
const t =
|
|
1516
|
+
}, Cr = (e) => {
|
|
1517
|
+
const t = C("filter"), n = new URLSearchParams();
|
|
1410
1518
|
return e.forEach((a) => {
|
|
1411
|
-
const { key: s, operator: o, value:
|
|
1519
|
+
const { key: s, operator: o, value: i, type: l } = a;
|
|
1412
1520
|
let c = f.upperFirst(o);
|
|
1413
|
-
if (["equals"].includes(
|
|
1414
|
-
|
|
1415
|
-
let h =
|
|
1416
|
-
switch (t.getInputType(
|
|
1521
|
+
if (["equals"].includes(f.camelCase(o)) && (c = ""), Array.isArray(i))
|
|
1522
|
+
i.forEach((d, u) => {
|
|
1523
|
+
let h = d;
|
|
1524
|
+
switch (t.getInputType(l)) {
|
|
1417
1525
|
case "datetime-local": {
|
|
1418
|
-
h = new Date(
|
|
1526
|
+
h = new Date(d).toISOString();
|
|
1419
1527
|
break;
|
|
1420
1528
|
}
|
|
1421
1529
|
}
|
|
1422
|
-
n.set(`where[${f.camelCase(s)}${c}][${
|
|
1530
|
+
n.set(`where[${f.camelCase(s)}${c}][${u}]`, h);
|
|
1423
1531
|
});
|
|
1424
1532
|
else {
|
|
1425
|
-
let
|
|
1426
|
-
switch (t.getInputType(
|
|
1533
|
+
let d = i;
|
|
1534
|
+
switch (t.getInputType(l)) {
|
|
1427
1535
|
case "datetime-local": {
|
|
1428
|
-
|
|
1536
|
+
d = new Date(i).toISOString();
|
|
1429
1537
|
break;
|
|
1430
1538
|
}
|
|
1431
1539
|
}
|
|
1432
|
-
n.set(`where[${f.camelCase(s)}${c}]`,
|
|
1540
|
+
n.set(`where[${f.camelCase(s)}${c}]`, d);
|
|
1433
1541
|
}
|
|
1434
1542
|
}), n;
|
|
1435
|
-
},
|
|
1436
|
-
const { t: e } =
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
clearSearchParams: i,
|
|
1441
|
-
clearFilters: c
|
|
1442
|
-
} = p.useContext(Ne), u = () => {
|
|
1443
|
-
o((h) => [
|
|
1444
|
-
...h,
|
|
1445
|
-
{
|
|
1446
|
-
key: "",
|
|
1447
|
-
operator: "equals",
|
|
1448
|
-
type: "text",
|
|
1449
|
-
value: "",
|
|
1450
|
-
is_relation: !1
|
|
1451
|
-
}
|
|
1452
|
-
]);
|
|
1453
|
-
}, d = () => {
|
|
1454
|
-
i();
|
|
1455
|
-
const h = yr(s);
|
|
1456
|
-
l(h, { replace: !0 });
|
|
1457
|
-
};
|
|
1458
|
-
return /* @__PURE__ */ m(
|
|
1459
|
-
N,
|
|
1460
|
-
{
|
|
1461
|
-
sx: { minWidth: { [n]: 567.5 } },
|
|
1462
|
-
p: 2,
|
|
1463
|
-
children: [
|
|
1464
|
-
/* @__PURE__ */ r(B, { children: s.map((h, g) => /* @__PURE__ */ m(F, { children: [
|
|
1465
|
-
/* @__PURE__ */ r(
|
|
1466
|
-
gr,
|
|
1467
|
-
{
|
|
1468
|
-
index: g,
|
|
1469
|
-
column: h
|
|
1470
|
-
},
|
|
1471
|
-
`row_${h.key}`
|
|
1472
|
-
),
|
|
1473
|
-
!t && /* @__PURE__ */ r(oe, { sx: {
|
|
1474
|
-
mt: 1.25,
|
|
1475
|
-
mb: 1.5
|
|
1476
|
-
} })
|
|
1477
|
-
] })) }),
|
|
1478
|
-
/* @__PURE__ */ r(B, { mt: 0.75, children: /* @__PURE__ */ r(
|
|
1479
|
-
E,
|
|
1480
|
-
{
|
|
1481
|
-
variant: "outlined",
|
|
1482
|
-
onClick: u,
|
|
1483
|
-
fullWidth: !0,
|
|
1484
|
-
children: `+ ${e("Add Column")}`
|
|
1485
|
-
}
|
|
1486
|
-
) }),
|
|
1487
|
-
/* @__PURE__ */ m(
|
|
1488
|
-
B,
|
|
1489
|
-
{
|
|
1490
|
-
direction: "row",
|
|
1491
|
-
justifyContent: "space-between",
|
|
1492
|
-
mt: 2,
|
|
1493
|
-
children: [
|
|
1494
|
-
/* @__PURE__ */ r(E, { onClick: c, children: e("Clear") }),
|
|
1495
|
-
/* @__PURE__ */ r(
|
|
1496
|
-
E,
|
|
1497
|
-
{
|
|
1498
|
-
variant: "contained",
|
|
1499
|
-
onClick: d,
|
|
1500
|
-
disabled: a.checkIfCanApplyFilters(s),
|
|
1501
|
-
children: e("Apply")
|
|
1502
|
-
}
|
|
1503
|
-
)
|
|
1504
|
-
]
|
|
1505
|
-
}
|
|
1506
|
-
)
|
|
1507
|
-
]
|
|
1508
|
-
}
|
|
1509
|
-
);
|
|
1510
|
-
}, xr = () => {
|
|
1511
|
-
const e = A("filter"), t = v(), n = K(), [a, s] = q(), o = p.useMemo(() => "where" in gt(a), [a]), [l, i] = p.useState(null), [c, u] = p.useState([]), d = !!l, h = p.useMemo(() => e.getFilterableColumns(n), [n]), g = (x) => {
|
|
1512
|
-
i(x.currentTarget);
|
|
1513
|
-
}, y = () => {
|
|
1514
|
-
i(null), setTimeout(() => {
|
|
1543
|
+
}, Ar = () => {
|
|
1544
|
+
const { t: e } = F(), t = C("filter"), n = v(), a = $(), [s, o] = W(), i = p.useMemo(() => "where" in yt(s), [s]), [l, c] = p.useState(null), [d, u] = p.useState([]), h = !!l, g = p.useMemo(() => t.getFilterableColumns(a), [a]), y = (x) => {
|
|
1545
|
+
c(x.currentTarget);
|
|
1546
|
+
}, S = () => {
|
|
1547
|
+
c(null), setTimeout(() => {
|
|
1515
1548
|
u([]);
|
|
1516
1549
|
}, 300);
|
|
1517
|
-
}, k = () => {
|
|
1518
|
-
s((x) => {
|
|
1519
|
-
const S = new URLSearchParams(x);
|
|
1520
|
-
for (const [w] of x.entries())
|
|
1521
|
-
w.startsWith("where[") && S.delete(w);
|
|
1522
|
-
return S;
|
|
1523
|
-
});
|
|
1524
1550
|
}, b = () => {
|
|
1525
|
-
|
|
1551
|
+
w();
|
|
1552
|
+
const x = Cr(d);
|
|
1553
|
+
o(x, { replace: !0 });
|
|
1554
|
+
}, w = () => {
|
|
1555
|
+
o((x) => {
|
|
1556
|
+
const A = new URLSearchParams(x);
|
|
1557
|
+
for (const [R] of x.entries())
|
|
1558
|
+
R.startsWith("where[") && A.delete(R);
|
|
1559
|
+
return A;
|
|
1560
|
+
});
|
|
1561
|
+
}, k = () => {
|
|
1562
|
+
w(), setTimeout(() => {
|
|
1526
1563
|
u([]);
|
|
1527
1564
|
}, 300);
|
|
1528
1565
|
};
|
|
1529
1566
|
return p.useEffect(() => {
|
|
1530
|
-
const x =
|
|
1567
|
+
const x = Sr(g, s);
|
|
1531
1568
|
u(x);
|
|
1532
|
-
}, [
|
|
1533
|
-
|
|
1569
|
+
}, [g, s, l]), /* @__PURE__ */ m(
|
|
1570
|
+
Ue.Provider,
|
|
1534
1571
|
{
|
|
1535
1572
|
value: {
|
|
1536
|
-
Model:
|
|
1573
|
+
Model: a,
|
|
1537
1574
|
anchorEl: l,
|
|
1538
|
-
setAnchorEl:
|
|
1539
|
-
columnsFilter:
|
|
1575
|
+
setAnchorEl: c,
|
|
1576
|
+
columnsFilter: d,
|
|
1540
1577
|
setColumnsFilter: u,
|
|
1541
|
-
searchParams:
|
|
1542
|
-
setSearchParams:
|
|
1543
|
-
|
|
1544
|
-
|
|
1578
|
+
searchParams: s,
|
|
1579
|
+
setSearchParams: o,
|
|
1580
|
+
handleApplyFilters: b,
|
|
1581
|
+
clearSearchParams: w,
|
|
1582
|
+
clearFilters: k
|
|
1545
1583
|
},
|
|
1546
1584
|
children: [
|
|
1547
1585
|
/* @__PURE__ */ r(
|
|
1548
|
-
|
|
1586
|
+
E,
|
|
1549
1587
|
{
|
|
1550
1588
|
"aria-describedby": "model-filter-popover-button",
|
|
1551
1589
|
"aria-label": "filter",
|
|
1552
|
-
onClick:
|
|
1590
|
+
onClick: y,
|
|
1553
1591
|
children: /* @__PURE__ */ r(
|
|
1554
|
-
|
|
1592
|
+
Me,
|
|
1555
1593
|
{
|
|
1556
1594
|
color: "secondary",
|
|
1557
1595
|
variant: "dot",
|
|
1558
|
-
invisible: !
|
|
1559
|
-
children: /* @__PURE__ */ r(
|
|
1596
|
+
invisible: !i,
|
|
1597
|
+
children: /* @__PURE__ */ r(hn, {})
|
|
1560
1598
|
}
|
|
1561
1599
|
)
|
|
1562
1600
|
}
|
|
1563
1601
|
),
|
|
1564
|
-
|
|
1565
|
-
|
|
1602
|
+
n ? /* @__PURE__ */ r(
|
|
1603
|
+
Gt,
|
|
1566
1604
|
{
|
|
1567
1605
|
id: "model-filter-popover",
|
|
1568
|
-
open:
|
|
1606
|
+
open: h,
|
|
1569
1607
|
anchorEl: l,
|
|
1570
|
-
onClose:
|
|
1608
|
+
onClose: S,
|
|
1571
1609
|
anchorOrigin: {
|
|
1572
1610
|
vertical: "bottom",
|
|
1573
1611
|
horizontal: "left"
|
|
1574
1612
|
},
|
|
1575
|
-
children: /* @__PURE__ */ r(
|
|
1613
|
+
children: /* @__PURE__ */ r(tt, {})
|
|
1576
1614
|
}
|
|
1577
|
-
) : /* @__PURE__ */
|
|
1578
|
-
|
|
1615
|
+
) : /* @__PURE__ */ m(
|
|
1616
|
+
De,
|
|
1579
1617
|
{
|
|
1580
|
-
open:
|
|
1581
|
-
onClose:
|
|
1618
|
+
open: h,
|
|
1619
|
+
onClose: S,
|
|
1582
1620
|
fullWidth: !0,
|
|
1583
|
-
children:
|
|
1621
|
+
children: [
|
|
1622
|
+
/* @__PURE__ */ m(Te, { children: [
|
|
1623
|
+
e("Filter :model", { model: a.plural() }),
|
|
1624
|
+
/* @__PURE__ */ r(
|
|
1625
|
+
E,
|
|
1626
|
+
{
|
|
1627
|
+
onClick: S,
|
|
1628
|
+
sx: { position: "absolute", right: 8, top: 8 },
|
|
1629
|
+
children: /* @__PURE__ */ r(Ee, {})
|
|
1630
|
+
}
|
|
1631
|
+
)
|
|
1632
|
+
] }),
|
|
1633
|
+
/* @__PURE__ */ r(Fe, { dividers: !0, children: /* @__PURE__ */ r(tt, { dialog: !0 }) }),
|
|
1634
|
+
/* @__PURE__ */ m(Ie, { children: [
|
|
1635
|
+
/* @__PURE__ */ r(
|
|
1636
|
+
M,
|
|
1637
|
+
{
|
|
1638
|
+
onClick: k,
|
|
1639
|
+
sx: { mr: "auto" },
|
|
1640
|
+
children: e("Clear")
|
|
1641
|
+
}
|
|
1642
|
+
),
|
|
1643
|
+
/* @__PURE__ */ r(
|
|
1644
|
+
M,
|
|
1645
|
+
{
|
|
1646
|
+
variant: "contained",
|
|
1647
|
+
onClick: b,
|
|
1648
|
+
disabled: t.checkIfCanApplyFilters(d),
|
|
1649
|
+
children: e("Apply")
|
|
1650
|
+
}
|
|
1651
|
+
)
|
|
1652
|
+
] })
|
|
1653
|
+
]
|
|
1584
1654
|
}
|
|
1585
1655
|
)
|
|
1586
1656
|
]
|
|
1587
1657
|
}
|
|
1588
1658
|
);
|
|
1589
|
-
},
|
|
1659
|
+
}, Ve = p.createContext({
|
|
1590
1660
|
columns: [],
|
|
1591
1661
|
columnCount: 0,
|
|
1592
|
-
selected:
|
|
1662
|
+
selected: N([]),
|
|
1593
1663
|
massActions: [],
|
|
1594
|
-
items:
|
|
1664
|
+
items: N([]),
|
|
1595
1665
|
error: new Error("Trying to access TableContext outside of TableProvider"),
|
|
1596
1666
|
Model: null
|
|
1597
1667
|
});
|
|
1598
|
-
function
|
|
1668
|
+
function Ye() {
|
|
1599
1669
|
const {
|
|
1600
1670
|
selected: e,
|
|
1601
1671
|
items: t
|
|
1602
|
-
} = p.useContext(
|
|
1672
|
+
} = p.useContext(Ve), n = ot(e), a = () => {
|
|
1603
1673
|
e.splice(0, e.count());
|
|
1604
|
-
}, s = (
|
|
1605
|
-
const
|
|
1606
|
-
if (
|
|
1607
|
-
e.pull(
|
|
1674
|
+
}, s = (d) => {
|
|
1675
|
+
const u = e.search(d);
|
|
1676
|
+
if (u !== !1) {
|
|
1677
|
+
e.pull(u);
|
|
1608
1678
|
return;
|
|
1609
1679
|
}
|
|
1610
|
-
e.push(
|
|
1680
|
+
e.push(d);
|
|
1611
1681
|
}, o = () => {
|
|
1612
1682
|
if (t) {
|
|
1613
1683
|
if (e.count() === t.count()) {
|
|
@@ -1616,27 +1686,27 @@ function qe() {
|
|
|
1616
1686
|
}
|
|
1617
1687
|
e.splice(0, e.count(), ...t);
|
|
1618
1688
|
}
|
|
1619
|
-
},
|
|
1689
|
+
}, i = (d) => n.contains(d), l = t ? n.count() > 0 && n.count() < t.count() : !1, c = t && t.count() ? n.count() === t.count() : !1;
|
|
1620
1690
|
return {
|
|
1621
1691
|
selected: n,
|
|
1622
|
-
indeterminate:
|
|
1692
|
+
indeterminate: l,
|
|
1623
1693
|
allSelected: c,
|
|
1624
|
-
isSelected:
|
|
1694
|
+
isSelected: i,
|
|
1625
1695
|
handleClearSelected: a,
|
|
1626
1696
|
handleSelectToggle: s,
|
|
1627
1697
|
handleSelectToggleAll: o
|
|
1628
1698
|
};
|
|
1629
1699
|
}
|
|
1630
|
-
function
|
|
1631
|
-
return p.useContext(
|
|
1700
|
+
function Q() {
|
|
1701
|
+
return p.useContext(Ve);
|
|
1632
1702
|
}
|
|
1633
|
-
function
|
|
1634
|
-
const [t, n] = p.useState(""), { selected: a } =
|
|
1635
|
-
n(
|
|
1703
|
+
function vr(e) {
|
|
1704
|
+
const [t, n] = p.useState(""), { selected: a } = Ye(), { t: s } = F(), o = We(), { massActions: i } = Q(), l = (d) => {
|
|
1705
|
+
n(d.target.value);
|
|
1636
1706
|
};
|
|
1637
1707
|
if (p.useEffect(() => {
|
|
1638
1708
|
a.isEmpty() && n("");
|
|
1639
|
-
}, [a]),
|
|
1709
|
+
}, [a]), i.length === 0)
|
|
1640
1710
|
return null;
|
|
1641
1711
|
const c = a.isEmpty() ? s("Select items to apply") : s("Select action");
|
|
1642
1712
|
return /* @__PURE__ */ m(
|
|
@@ -1647,30 +1717,30 @@ function wr(e) {
|
|
|
1647
1717
|
...e,
|
|
1648
1718
|
children: [
|
|
1649
1719
|
/* @__PURE__ */ m(
|
|
1650
|
-
|
|
1720
|
+
we,
|
|
1651
1721
|
{
|
|
1652
1722
|
sx: { m: 1, minWidth: 200 },
|
|
1653
1723
|
size: "small",
|
|
1654
1724
|
children: [
|
|
1655
|
-
/* @__PURE__ */ r(
|
|
1725
|
+
/* @__PURE__ */ r(ke, { id: "mass-actions-select-label", children: c }),
|
|
1656
1726
|
/* @__PURE__ */ m(
|
|
1657
|
-
|
|
1727
|
+
le,
|
|
1658
1728
|
{
|
|
1659
1729
|
labelId: "mass-actions-select-label",
|
|
1660
1730
|
id: "mass-actions-select",
|
|
1661
1731
|
value: t,
|
|
1662
1732
|
label: c,
|
|
1663
|
-
onChange:
|
|
1733
|
+
onChange: l,
|
|
1664
1734
|
disabled: a.isEmpty(),
|
|
1665
1735
|
children: [
|
|
1666
|
-
/* @__PURE__ */ r(
|
|
1667
|
-
|
|
1668
|
-
|
|
1736
|
+
/* @__PURE__ */ r(G, { value: "", children: /* @__PURE__ */ r("em", { children: s("None") }) }),
|
|
1737
|
+
i.map((d) => /* @__PURE__ */ r(
|
|
1738
|
+
G,
|
|
1669
1739
|
{
|
|
1670
|
-
value:
|
|
1671
|
-
children:
|
|
1740
|
+
value: d.key,
|
|
1741
|
+
children: d.label
|
|
1672
1742
|
},
|
|
1673
|
-
|
|
1743
|
+
d.key
|
|
1674
1744
|
))
|
|
1675
1745
|
]
|
|
1676
1746
|
}
|
|
@@ -1679,13 +1749,13 @@ function wr(e) {
|
|
|
1679
1749
|
}
|
|
1680
1750
|
),
|
|
1681
1751
|
/* @__PURE__ */ r(
|
|
1682
|
-
|
|
1752
|
+
M,
|
|
1683
1753
|
{
|
|
1684
1754
|
size: "small",
|
|
1685
1755
|
disabled: a.isEmpty() || !t,
|
|
1686
1756
|
onClick: () => {
|
|
1687
|
-
var
|
|
1688
|
-
(
|
|
1757
|
+
var d;
|
|
1758
|
+
(d = i.find((u) => u.key === t)) == null || d.callback({
|
|
1689
1759
|
selected: a,
|
|
1690
1760
|
...o
|
|
1691
1761
|
});
|
|
@@ -1697,23 +1767,23 @@ function wr(e) {
|
|
|
1697
1767
|
}
|
|
1698
1768
|
);
|
|
1699
1769
|
}
|
|
1700
|
-
const
|
|
1701
|
-
const { handleDrawerOpen: e } =
|
|
1770
|
+
const Dr = () => {
|
|
1771
|
+
const { handleDrawerOpen: e } = ze();
|
|
1702
1772
|
return /* @__PURE__ */ r(
|
|
1703
|
-
|
|
1773
|
+
E,
|
|
1704
1774
|
{
|
|
1705
1775
|
color: "inherit",
|
|
1706
1776
|
"aria-label": "open drawer",
|
|
1707
1777
|
edge: "start",
|
|
1708
1778
|
onClick: e,
|
|
1709
1779
|
sx: { mr: { md: 2 } },
|
|
1710
|
-
children: /* @__PURE__ */ r(
|
|
1780
|
+
children: /* @__PURE__ */ r(mn, {})
|
|
1711
1781
|
}
|
|
1712
1782
|
);
|
|
1713
|
-
},
|
|
1783
|
+
}, ce = p.forwardRef(({ to: e, children: t, ...n }, a) => /* @__PURE__ */ r(
|
|
1714
1784
|
Se,
|
|
1715
1785
|
{
|
|
1716
|
-
component:
|
|
1786
|
+
component: oe,
|
|
1717
1787
|
to: e,
|
|
1718
1788
|
ref: a,
|
|
1719
1789
|
sx: { textDecoration: "none" },
|
|
@@ -1721,38 +1791,38 @@ const Sr = () => {
|
|
|
1721
1791
|
children: t
|
|
1722
1792
|
}
|
|
1723
1793
|
));
|
|
1724
|
-
|
|
1725
|
-
const
|
|
1726
|
-
"« Previous": /* @__PURE__ */ r(
|
|
1727
|
-
"Next »": /* @__PURE__ */ r(
|
|
1728
|
-
"Last »": /* @__PURE__ */ r(
|
|
1729
|
-
"« First": /* @__PURE__ */ r(
|
|
1730
|
-
}[e] || e }) : /* @__PURE__ */ r(
|
|
1731
|
-
const n = e === "default", [a, s] =
|
|
1732
|
-
links:
|
|
1794
|
+
ce.displayName = "Link";
|
|
1795
|
+
const Tr = ({ label: e }) => isNaN(e) || isNaN(parseFloat(e)) ? /* @__PURE__ */ r(T, { children: {
|
|
1796
|
+
"« Previous": /* @__PURE__ */ r(Le, {}),
|
|
1797
|
+
"Next »": /* @__PURE__ */ r(Oe, {}),
|
|
1798
|
+
"Last »": /* @__PURE__ */ r(fn, {}),
|
|
1799
|
+
"« First": /* @__PURE__ */ r(gn, {})
|
|
1800
|
+
}[e] || e }) : /* @__PURE__ */ r(T, { children: e }), Fr = ({ variant: e = "default", ...t }) => {
|
|
1801
|
+
const n = e === "default", [a, s] = W(), [o, i] = p.useState(a.get("page") || "1"), {
|
|
1802
|
+
links: l,
|
|
1733
1803
|
meta: {
|
|
1734
1804
|
current_page: c = 1,
|
|
1735
|
-
links:
|
|
1736
|
-
last_page:
|
|
1805
|
+
links: d = [],
|
|
1806
|
+
last_page: u = 1
|
|
1737
1807
|
} = {}
|
|
1738
|
-
} =
|
|
1808
|
+
} = re(), {
|
|
1739
1809
|
first: h,
|
|
1740
1810
|
prev: g,
|
|
1741
1811
|
next: y,
|
|
1742
|
-
last:
|
|
1743
|
-
} =
|
|
1744
|
-
|
|
1745
|
-
},
|
|
1812
|
+
last: S
|
|
1813
|
+
} = l || {}, b = (k) => {
|
|
1814
|
+
k.preventDefault(), s((x) => (x.set("page", o || "1"), x));
|
|
1815
|
+
}, w = [
|
|
1746
1816
|
{ url: c > 1 ? h : null, label: "« First", active: !1 },
|
|
1747
1817
|
{ url: g, label: "« Previous", active: !1 },
|
|
1748
1818
|
{
|
|
1749
1819
|
element: /* @__PURE__ */ r(
|
|
1750
|
-
|
|
1820
|
+
Tt,
|
|
1751
1821
|
{
|
|
1752
1822
|
onSubmit: b,
|
|
1753
1823
|
preventScrollReset: !0,
|
|
1754
1824
|
children: /* @__PURE__ */ r(
|
|
1755
|
-
|
|
1825
|
+
ae,
|
|
1756
1826
|
{
|
|
1757
1827
|
size: "small",
|
|
1758
1828
|
type: "number",
|
|
@@ -1768,15 +1838,15 @@ const kr = ({ label: e }) => isNaN(e) || isNaN(parseFloat(e)) ? /* @__PURE__ */
|
|
|
1768
1838
|
}
|
|
1769
1839
|
},
|
|
1770
1840
|
value: o,
|
|
1771
|
-
error: Number(o) >
|
|
1772
|
-
helperText: Number(o) >
|
|
1773
|
-
onChange: (
|
|
1774
|
-
!Number.isNaN(Number(
|
|
1841
|
+
error: Number(o) > u,
|
|
1842
|
+
helperText: Number(o) > u ? `Max ${u}` : void 0,
|
|
1843
|
+
onChange: (k) => {
|
|
1844
|
+
!Number.isNaN(Number(k.target.value)) && Number(k.target.value) > 0 && i(k.target.value), k.target.value === "" && i("");
|
|
1775
1845
|
},
|
|
1776
|
-
onBlur: (
|
|
1777
|
-
s((
|
|
1846
|
+
onBlur: (k) => {
|
|
1847
|
+
s((x) => (x.set("page", k.target.value || "1"), x), { replace: !0 });
|
|
1778
1848
|
},
|
|
1779
|
-
disabled:
|
|
1849
|
+
disabled: u === 1,
|
|
1780
1850
|
"aria-label": "Page number"
|
|
1781
1851
|
}
|
|
1782
1852
|
)
|
|
@@ -1785,10 +1855,10 @@ const kr = ({ label: e }) => isNaN(e) || isNaN(parseFloat(e)) ? /* @__PURE__ */
|
|
|
1785
1855
|
)
|
|
1786
1856
|
},
|
|
1787
1857
|
{ url: y, label: "Next »", active: !1 },
|
|
1788
|
-
{ url: c <
|
|
1858
|
+
{ url: c < u ? S : null, label: "Last »", active: !1 }
|
|
1789
1859
|
];
|
|
1790
1860
|
return p.useEffect(() => {
|
|
1791
|
-
c &&
|
|
1861
|
+
c && i(String(c));
|
|
1792
1862
|
}, [c]), /* @__PURE__ */ r(
|
|
1793
1863
|
B,
|
|
1794
1864
|
{
|
|
@@ -1797,10 +1867,10 @@ const kr = ({ label: e }) => isNaN(e) || isNaN(parseFloat(e)) ? /* @__PURE__ */
|
|
|
1797
1867
|
justifyContent: "center",
|
|
1798
1868
|
alignItems: "center",
|
|
1799
1869
|
...t,
|
|
1800
|
-
children: (n ?
|
|
1801
|
-
|
|
1870
|
+
children: (n ? d : w).map((k, x) => k.element || /* @__PURE__ */ r(
|
|
1871
|
+
M,
|
|
1802
1872
|
{
|
|
1803
|
-
variant:
|
|
1873
|
+
variant: k.active ? "contained" : "text",
|
|
1804
1874
|
color: "primary",
|
|
1805
1875
|
size: "small",
|
|
1806
1876
|
sx: {
|
|
@@ -1809,40 +1879,40 @@ const kr = ({ label: e }) => isNaN(e) || isNaN(parseFloat(e)) ? /* @__PURE__ */
|
|
|
1809
1879
|
height: 32,
|
|
1810
1880
|
borderRadius: "50%"
|
|
1811
1881
|
},
|
|
1812
|
-
disabled: !
|
|
1813
|
-
component:
|
|
1814
|
-
to:
|
|
1815
|
-
children: /* @__PURE__ */ r(
|
|
1882
|
+
disabled: !k.url,
|
|
1883
|
+
component: ce,
|
|
1884
|
+
to: k.url,
|
|
1885
|
+
children: /* @__PURE__ */ r(Tr, { label: k.label })
|
|
1816
1886
|
},
|
|
1817
|
-
|
|
1887
|
+
x
|
|
1818
1888
|
))
|
|
1819
1889
|
}
|
|
1820
1890
|
);
|
|
1821
|
-
},
|
|
1822
|
-
const { t: e } =
|
|
1891
|
+
}, Ir = () => {
|
|
1892
|
+
const { t: e } = F(), {
|
|
1823
1893
|
meta: {
|
|
1824
1894
|
total: t = 0,
|
|
1825
1895
|
from: n = 0,
|
|
1826
1896
|
to: a = 0
|
|
1827
1897
|
} = {}
|
|
1828
|
-
} =
|
|
1829
|
-
return /* @__PURE__ */ r(
|
|
1898
|
+
} = re();
|
|
1899
|
+
return /* @__PURE__ */ r(q, { variant: "caption", noWrap: !0, children: e(":from–:to of :total", {
|
|
1830
1900
|
from: n,
|
|
1831
1901
|
to: a,
|
|
1832
1902
|
total: t
|
|
1833
1903
|
}) });
|
|
1834
|
-
},
|
|
1835
|
-
const { t: e } =
|
|
1904
|
+
}, Pr = () => {
|
|
1905
|
+
const { t: e } = F(), {
|
|
1836
1906
|
meta: {
|
|
1837
1907
|
per_page: t = 15
|
|
1838
1908
|
} = {}
|
|
1839
|
-
} =
|
|
1840
|
-
n((
|
|
1841
|
-
const
|
|
1842
|
-
return
|
|
1909
|
+
} = re(), [, n] = W(), a = (o) => {
|
|
1910
|
+
n((i) => {
|
|
1911
|
+
const l = new URLSearchParams(i);
|
|
1912
|
+
return l.set("per_page", o.target.value.toString()), l;
|
|
1843
1913
|
});
|
|
1844
|
-
}, s =
|
|
1845
|
-
|
|
1914
|
+
}, s = ve(
|
|
1915
|
+
C("cms"),
|
|
1846
1916
|
"perPageOptions",
|
|
1847
1917
|
[15, 30, 75, 150]
|
|
1848
1918
|
);
|
|
@@ -1853,12 +1923,12 @@ const kr = ({ label: e }) => isNaN(e) || isNaN(parseFloat(e)) ? /* @__PURE__ */
|
|
|
1853
1923
|
alignItems: "center",
|
|
1854
1924
|
gap: 1,
|
|
1855
1925
|
children: [
|
|
1856
|
-
/* @__PURE__ */ m(
|
|
1926
|
+
/* @__PURE__ */ m(q, { variant: "caption", children: [
|
|
1857
1927
|
e("Rows per page"),
|
|
1858
1928
|
":"
|
|
1859
1929
|
] }),
|
|
1860
1930
|
/* @__PURE__ */ r(
|
|
1861
|
-
|
|
1931
|
+
le,
|
|
1862
1932
|
{
|
|
1863
1933
|
value: t,
|
|
1864
1934
|
onChange: a,
|
|
@@ -1871,11 +1941,11 @@ const kr = ({ label: e }) => isNaN(e) || isNaN(parseFloat(e)) ? /* @__PURE__ */
|
|
|
1871
1941
|
}
|
|
1872
1942
|
},
|
|
1873
1943
|
children: s.map((o) => /* @__PURE__ */ r(
|
|
1874
|
-
|
|
1944
|
+
G,
|
|
1875
1945
|
{
|
|
1876
1946
|
value: o,
|
|
1877
1947
|
sx: {
|
|
1878
|
-
fontSize: (
|
|
1948
|
+
fontSize: (i) => i.typography.caption.fontSize,
|
|
1879
1949
|
minHeight: "unset",
|
|
1880
1950
|
lineHeight: 1,
|
|
1881
1951
|
py: 1.5
|
|
@@ -1890,44 +1960,44 @@ const kr = ({ label: e }) => isNaN(e) || isNaN(parseFloat(e)) ? /* @__PURE__ */
|
|
|
1890
1960
|
}
|
|
1891
1961
|
);
|
|
1892
1962
|
};
|
|
1893
|
-
function
|
|
1963
|
+
function Mr(e, t) {
|
|
1894
1964
|
const [n, a] = p.useState(!1);
|
|
1895
1965
|
return p.useEffect(() => {
|
|
1896
|
-
const s = /* @__PURE__ */ new Set(), o = (
|
|
1897
|
-
s.add(
|
|
1898
|
-
},
|
|
1899
|
-
s.delete(
|
|
1966
|
+
const s = /* @__PURE__ */ new Set(), o = (l) => {
|
|
1967
|
+
s.add(l.key), e.every((c) => s.has(c)) && (a(!0), t && t());
|
|
1968
|
+
}, i = (l) => {
|
|
1969
|
+
s.delete(l.key), e.every((c) => !s.has(c)) && a(!1);
|
|
1900
1970
|
};
|
|
1901
|
-
return window.addEventListener("keydown", o), window.addEventListener("keyup",
|
|
1902
|
-
window.removeEventListener("keydown", o), window.removeEventListener("keyup",
|
|
1971
|
+
return window.addEventListener("keydown", o), window.addEventListener("keyup", i), () => {
|
|
1972
|
+
window.removeEventListener("keydown", o), window.removeEventListener("keyup", i);
|
|
1903
1973
|
};
|
|
1904
1974
|
}, [e, t]), n;
|
|
1905
1975
|
}
|
|
1906
|
-
const
|
|
1976
|
+
const Br = U(ae)(({ theme: e }) => ({
|
|
1907
1977
|
"& .MuiInputBase-root": {
|
|
1908
1978
|
backgroundColor: e.palette.background.paper
|
|
1909
1979
|
}
|
|
1910
1980
|
// transition: 'width 250ms ease-in-out',
|
|
1911
|
-
})),
|
|
1981
|
+
})), Er = f.throttle((e, t) => {
|
|
1912
1982
|
t((n) => {
|
|
1913
1983
|
const a = new URLSearchParams(n);
|
|
1914
1984
|
return e ? a.set("q", e) : a.delete("q"), a;
|
|
1915
1985
|
});
|
|
1916
|
-
}, 500),
|
|
1917
|
-
const [e, t] =
|
|
1986
|
+
}, 500), Lr = () => {
|
|
1987
|
+
const [e, t] = W(), n = e.get("q") || "", [a, s] = p.useState(n), [o, i] = p.useState(!1), l = p.useRef(null), { t: c } = F();
|
|
1918
1988
|
p.useEffect(() => {
|
|
1919
1989
|
s(n);
|
|
1920
1990
|
}, [n]);
|
|
1921
|
-
const
|
|
1922
|
-
s(g.target.value),
|
|
1923
|
-
},
|
|
1924
|
-
|
|
1925
|
-
|
|
1991
|
+
const d = (g) => {
|
|
1992
|
+
s(g.target.value), Er(g.target.value, t);
|
|
1993
|
+
}, u = v();
|
|
1994
|
+
Mr(["Control", "/"], () => {
|
|
1995
|
+
l.current.focus();
|
|
1926
1996
|
});
|
|
1927
|
-
const h =
|
|
1928
|
-
return /* @__PURE__ */ m(
|
|
1929
|
-
!
|
|
1930
|
-
|
|
1997
|
+
const h = u ? 300 : "calc(100vw - 58px)";
|
|
1998
|
+
return /* @__PURE__ */ m(T, { children: [
|
|
1999
|
+
!u && !o && /* @__PURE__ */ r(E, { color: "inherit", onClick: () => i(!0), children: /* @__PURE__ */ r(
|
|
2000
|
+
Me,
|
|
1931
2001
|
{
|
|
1932
2002
|
variant: "dot",
|
|
1933
2003
|
color: "secondary",
|
|
@@ -1936,32 +2006,32 @@ const Tr = U(re)(({ theme: e }) => ({
|
|
|
1936
2006
|
vertical: "bottom",
|
|
1937
2007
|
horizontal: "left"
|
|
1938
2008
|
},
|
|
1939
|
-
children: /* @__PURE__ */ r(
|
|
2009
|
+
children: /* @__PURE__ */ r(Qe, {})
|
|
1940
2010
|
}
|
|
1941
2011
|
) }),
|
|
1942
2012
|
/* @__PURE__ */ r(
|
|
1943
|
-
|
|
2013
|
+
it,
|
|
1944
2014
|
{
|
|
1945
2015
|
orientation: "horizontal",
|
|
1946
|
-
in:
|
|
2016
|
+
in: u || o,
|
|
1947
2017
|
addEndListener: () => {
|
|
1948
2018
|
var g;
|
|
1949
|
-
!
|
|
2019
|
+
!u && o && ((g = l.current) == null || g.focus());
|
|
1950
2020
|
},
|
|
1951
2021
|
unmountOnExit: !1,
|
|
1952
2022
|
children: /* @__PURE__ */ r(
|
|
1953
|
-
|
|
2023
|
+
Br,
|
|
1954
2024
|
{
|
|
1955
|
-
placeholder:
|
|
2025
|
+
placeholder: u ? `(Ctrl + /) ${c("Search...")}` : `${c("Search...")}`,
|
|
1956
2026
|
value: a,
|
|
1957
2027
|
InputProps: {
|
|
1958
|
-
endAdornment: /* @__PURE__ */ r(
|
|
2028
|
+
endAdornment: /* @__PURE__ */ r(Qe, {})
|
|
1959
2029
|
},
|
|
1960
2030
|
inputProps: {
|
|
1961
|
-
ref:
|
|
2031
|
+
ref: l
|
|
1962
2032
|
},
|
|
1963
|
-
onChange:
|
|
1964
|
-
onBlur: () =>
|
|
2033
|
+
onChange: d,
|
|
2034
|
+
onBlur: () => i(!1),
|
|
1965
2035
|
sx: { width: h },
|
|
1966
2036
|
size: "small"
|
|
1967
2037
|
}
|
|
@@ -1969,109 +2039,109 @@ const Tr = U(re)(({ theme: e }) => ({
|
|
|
1969
2039
|
}
|
|
1970
2040
|
)
|
|
1971
2041
|
] });
|
|
1972
|
-
},
|
|
1973
|
-
|
|
2042
|
+
}, Or = ({ children: e, ...t }) => /* @__PURE__ */ r(
|
|
2043
|
+
K,
|
|
1974
2044
|
{
|
|
1975
2045
|
sx: { width: "1px" },
|
|
1976
2046
|
padding: "checkbox",
|
|
1977
2047
|
...t,
|
|
1978
2048
|
children: e
|
|
1979
2049
|
}
|
|
1980
|
-
),
|
|
1981
|
-
const { t: e } =
|
|
2050
|
+
), Nr = () => {
|
|
2051
|
+
const { t: e } = F(), [t, n] = W(), {
|
|
1982
2052
|
columns: a,
|
|
1983
2053
|
Model: s
|
|
1984
|
-
} =
|
|
2054
|
+
} = Q(), o = t.get("order_by") || "", [i = "", l = ""] = o.split(":"), [c, d] = p.useState(i), [u, h] = p.useState(l), [g, y] = p.useState(!1), S = () => {
|
|
1985
2055
|
y(!0);
|
|
1986
2056
|
}, b = () => {
|
|
1987
|
-
y(!1),
|
|
1988
|
-
},
|
|
1989
|
-
if (!c || !
|
|
2057
|
+
y(!1), d(i), h(l);
|
|
2058
|
+
}, w = () => {
|
|
2059
|
+
if (!c || !u) {
|
|
1990
2060
|
y(!1);
|
|
1991
2061
|
return;
|
|
1992
2062
|
}
|
|
1993
|
-
n((
|
|
1994
|
-
const
|
|
1995
|
-
return
|
|
2063
|
+
n((x) => {
|
|
2064
|
+
const A = new URLSearchParams(x);
|
|
2065
|
+
return A.set("order_by", `${c}:${u}`), A;
|
|
1996
2066
|
}), y(!1);
|
|
1997
|
-
},
|
|
1998
|
-
n((
|
|
1999
|
-
const
|
|
2000
|
-
return
|
|
2001
|
-
}), y(!1),
|
|
2067
|
+
}, k = () => {
|
|
2068
|
+
n((x) => {
|
|
2069
|
+
const A = new URLSearchParams(x);
|
|
2070
|
+
return A.delete("order_by"), A;
|
|
2071
|
+
}), y(!1), d(""), h("");
|
|
2002
2072
|
};
|
|
2003
|
-
return /* @__PURE__ */ m(
|
|
2004
|
-
/* @__PURE__ */ r(
|
|
2005
|
-
|
|
2073
|
+
return /* @__PURE__ */ m(T, { children: [
|
|
2074
|
+
/* @__PURE__ */ r(E, { onClick: S, children: /* @__PURE__ */ r(
|
|
2075
|
+
Me,
|
|
2006
2076
|
{
|
|
2007
2077
|
color: "secondary",
|
|
2008
2078
|
variant: "dot",
|
|
2009
|
-
invisible: !
|
|
2010
|
-
children: /* @__PURE__ */ r(
|
|
2079
|
+
invisible: !i,
|
|
2080
|
+
children: /* @__PURE__ */ r(bn, {})
|
|
2011
2081
|
}
|
|
2012
2082
|
) }),
|
|
2013
|
-
/* @__PURE__ */ m(
|
|
2014
|
-
/* @__PURE__ */ m(
|
|
2083
|
+
/* @__PURE__ */ m(De, { open: g, onClose: b, fullWidth: !0, children: [
|
|
2084
|
+
/* @__PURE__ */ m(Te, { children: [
|
|
2015
2085
|
e("Sort :model", { model: s.plural() }),
|
|
2016
2086
|
/* @__PURE__ */ r(
|
|
2017
|
-
|
|
2087
|
+
E,
|
|
2018
2088
|
{
|
|
2019
2089
|
onClick: b,
|
|
2020
2090
|
sx: { position: "absolute", right: 8, top: 8 },
|
|
2021
|
-
children: /* @__PURE__ */ r(
|
|
2091
|
+
children: /* @__PURE__ */ r(Ee, {})
|
|
2022
2092
|
}
|
|
2023
2093
|
)
|
|
2024
2094
|
] }),
|
|
2025
|
-
/* @__PURE__ */ m(
|
|
2095
|
+
/* @__PURE__ */ m(Fe, { dividers: !0, children: [
|
|
2026
2096
|
/* @__PURE__ */ m(
|
|
2027
|
-
|
|
2097
|
+
$e,
|
|
2028
2098
|
{
|
|
2029
2099
|
value: c,
|
|
2030
|
-
onChange: (
|
|
2031
|
-
|
|
2100
|
+
onChange: (x) => {
|
|
2101
|
+
d(x.target.value), u || h("asc");
|
|
2032
2102
|
},
|
|
2033
2103
|
children: [
|
|
2034
|
-
/* @__PURE__ */ r(
|
|
2035
|
-
/* @__PURE__ */ r(
|
|
2036
|
-
|
|
2037
|
-
|
|
2104
|
+
/* @__PURE__ */ r(q, { variant: "caption", children: e("Column") }),
|
|
2105
|
+
/* @__PURE__ */ r(se, {}),
|
|
2106
|
+
N(a).whereStrict("sortable", "!=", !1).map(({ key: x, label: A }) => /* @__PURE__ */ r(
|
|
2107
|
+
de,
|
|
2038
2108
|
{
|
|
2039
|
-
value:
|
|
2040
|
-
control: /* @__PURE__ */ r(
|
|
2041
|
-
label:
|
|
2109
|
+
value: x,
|
|
2110
|
+
control: /* @__PURE__ */ r(pe, {}),
|
|
2111
|
+
label: A
|
|
2042
2112
|
},
|
|
2043
|
-
|
|
2113
|
+
x
|
|
2044
2114
|
))
|
|
2045
2115
|
]
|
|
2046
2116
|
}
|
|
2047
2117
|
),
|
|
2048
|
-
/* @__PURE__ */ r(
|
|
2049
|
-
/* @__PURE__ */ r(
|
|
2118
|
+
/* @__PURE__ */ r(q, { variant: "caption", children: e("Direction") }),
|
|
2119
|
+
/* @__PURE__ */ r(se, {}),
|
|
2050
2120
|
/* @__PURE__ */ m(
|
|
2051
|
-
|
|
2121
|
+
$e,
|
|
2052
2122
|
{
|
|
2053
|
-
value:
|
|
2054
|
-
onChange: (
|
|
2123
|
+
value: u,
|
|
2124
|
+
onChange: (x) => h(x.target.value),
|
|
2055
2125
|
children: [
|
|
2056
2126
|
/* @__PURE__ */ r(
|
|
2057
|
-
|
|
2127
|
+
de,
|
|
2058
2128
|
{
|
|
2059
2129
|
value: "asc",
|
|
2060
|
-
control: /* @__PURE__ */ r(
|
|
2061
|
-
label: /* @__PURE__ */ m(
|
|
2130
|
+
control: /* @__PURE__ */ r(pe, {}),
|
|
2131
|
+
label: /* @__PURE__ */ m(T, { children: [
|
|
2062
2132
|
e("Ascending"),
|
|
2063
|
-
/* @__PURE__ */ r(
|
|
2133
|
+
/* @__PURE__ */ r(yn, {})
|
|
2064
2134
|
] })
|
|
2065
2135
|
}
|
|
2066
2136
|
),
|
|
2067
2137
|
/* @__PURE__ */ r(
|
|
2068
|
-
|
|
2138
|
+
de,
|
|
2069
2139
|
{
|
|
2070
2140
|
value: "desc",
|
|
2071
|
-
control: /* @__PURE__ */ r(
|
|
2072
|
-
label: /* @__PURE__ */ m(
|
|
2141
|
+
control: /* @__PURE__ */ r(pe, {}),
|
|
2142
|
+
label: /* @__PURE__ */ m(T, { children: [
|
|
2073
2143
|
e("Descending"),
|
|
2074
|
-
/* @__PURE__ */ r(
|
|
2144
|
+
/* @__PURE__ */ r(xn, {})
|
|
2075
2145
|
] })
|
|
2076
2146
|
}
|
|
2077
2147
|
)
|
|
@@ -2079,169 +2149,169 @@ const Tr = U(re)(({ theme: e }) => ({
|
|
|
2079
2149
|
}
|
|
2080
2150
|
)
|
|
2081
2151
|
] }),
|
|
2082
|
-
/* @__PURE__ */ m(
|
|
2083
|
-
/* @__PURE__ */ r(
|
|
2084
|
-
/* @__PURE__ */ r(
|
|
2152
|
+
/* @__PURE__ */ m(Ie, { children: [
|
|
2153
|
+
/* @__PURE__ */ r(M, { onClick: k, sx: { mr: "auto" }, children: e("Clear") }),
|
|
2154
|
+
/* @__PURE__ */ r(M, { onClick: w, variant: "contained", children: e("Apply") })
|
|
2085
2155
|
] })
|
|
2086
2156
|
] })
|
|
2087
2157
|
] });
|
|
2088
|
-
},
|
|
2089
|
-
const s =
|
|
2158
|
+
}, Rr = ({ items: e, loading: t, children: n, error: a }) => {
|
|
2159
|
+
const s = $(), o = p.useMemo(() => N([]), [s, e]), [i] = W(), l = i.get("tab") ?? "all", c = p.useMemo(() => [
|
|
2090
2160
|
{
|
|
2091
2161
|
key: s.getSchema().labeledBy,
|
|
2092
2162
|
label: f.upperFirst(f.camelCase(s.getSchema().labeledBy))
|
|
2093
2163
|
}
|
|
2094
|
-
], [s]),
|
|
2095
|
-
|
|
2164
|
+
], [s]), d = v(), u = p.useMemo(() => C("cms").getMassActions(s, l), [s, l]), h = ve(
|
|
2165
|
+
C("cms"),
|
|
2096
2166
|
`model${f.upperFirst(f.camelCase(s.getSchemaName()))}Columns`,
|
|
2097
2167
|
c
|
|
2098
|
-
), y = (
|
|
2168
|
+
), y = (d ? h.length : 1) + (u.length > 0 ? 2 : 1), S = {
|
|
2099
2169
|
columns: h,
|
|
2100
2170
|
columnCount: y,
|
|
2101
|
-
massActions:
|
|
2171
|
+
massActions: u,
|
|
2102
2172
|
items: e,
|
|
2103
2173
|
loading: t,
|
|
2104
2174
|
selected: o,
|
|
2105
2175
|
error: a,
|
|
2106
2176
|
Model: s
|
|
2107
2177
|
};
|
|
2108
|
-
return /* @__PURE__ */ r(
|
|
2109
|
-
},
|
|
2178
|
+
return /* @__PURE__ */ r(Ve.Provider, { value: S, children: n });
|
|
2179
|
+
}, jr = ({
|
|
2110
2180
|
items: e,
|
|
2111
2181
|
loading: t,
|
|
2112
2182
|
error: n,
|
|
2113
2183
|
children: a,
|
|
2114
2184
|
...s
|
|
2115
2185
|
}) => /* @__PURE__ */ r(
|
|
2116
|
-
|
|
2186
|
+
Rr,
|
|
2117
2187
|
{
|
|
2118
2188
|
items: e,
|
|
2119
2189
|
loading: t,
|
|
2120
2190
|
error: n,
|
|
2121
|
-
children: /* @__PURE__ */ r(
|
|
2191
|
+
children: /* @__PURE__ */ r(Qt, { component: Pe, children: /* @__PURE__ */ r(Xt, { ...s, children: a }) })
|
|
2122
2192
|
}
|
|
2123
|
-
),
|
|
2193
|
+
), qr = ({ children: e, ...t }) => {
|
|
2124
2194
|
const {
|
|
2125
2195
|
massActions: n,
|
|
2126
2196
|
columns: a,
|
|
2127
2197
|
items: s
|
|
2128
|
-
} =
|
|
2198
|
+
} = Q(), o = v(), [i, l] = W(), {
|
|
2129
2199
|
indeterminate: c,
|
|
2130
|
-
allSelected:
|
|
2131
|
-
handleSelectToggleAll:
|
|
2132
|
-
} =
|
|
2200
|
+
allSelected: d,
|
|
2201
|
+
handleSelectToggleAll: u
|
|
2202
|
+
} = Ye(), {
|
|
2133
2203
|
["ModelIndex.Table.ShrinkedCell"]: h
|
|
2134
|
-
} =
|
|
2135
|
-
|
|
2136
|
-
const
|
|
2137
|
-
return
|
|
2138
|
-
} : (
|
|
2139
|
-
const
|
|
2140
|
-
return
|
|
2204
|
+
} = C("cms").getComponents(), g = i.get("order_by") || "", [y, S] = g.split(":"), b = (w) => () => {
|
|
2205
|
+
l(y === w ? (k) => {
|
|
2206
|
+
const x = new URLSearchParams(k);
|
|
2207
|
+
return S ? S === "desc" ? (x.delete("order_by"), x) : (x.set("order_by", `${w}:desc`), x) : (x.set("order_by", `${w}:asc`), x);
|
|
2208
|
+
} : (k) => {
|
|
2209
|
+
const x = new URLSearchParams(k);
|
|
2210
|
+
return x.set("order_by", `${w}:asc`), x;
|
|
2141
2211
|
});
|
|
2142
2212
|
};
|
|
2143
|
-
return /* @__PURE__ */ m(
|
|
2213
|
+
return /* @__PURE__ */ m(Jt, { ...t, children: [
|
|
2144
2214
|
e,
|
|
2145
|
-
o && /* @__PURE__ */ m(
|
|
2215
|
+
o && /* @__PURE__ */ m(_, { children: [
|
|
2146
2216
|
n.length > 0 && /* @__PURE__ */ r(h, { children: /* @__PURE__ */ r(
|
|
2147
|
-
|
|
2217
|
+
Be,
|
|
2148
2218
|
{
|
|
2149
2219
|
indeterminate: c,
|
|
2150
|
-
checked:
|
|
2151
|
-
onChange:
|
|
2220
|
+
checked: d,
|
|
2221
|
+
onChange: u,
|
|
2152
2222
|
disabled: s && s.count() === 0
|
|
2153
2223
|
}
|
|
2154
2224
|
) }),
|
|
2155
|
-
a.map(({ key:
|
|
2156
|
-
|
|
2225
|
+
a.map(({ key: w, label: k, sortable: x = !0, ...A }) => /* @__PURE__ */ r(
|
|
2226
|
+
K,
|
|
2157
2227
|
{
|
|
2158
|
-
sortDirection:
|
|
2159
|
-
...
|
|
2228
|
+
sortDirection: x && y === w && S || !1,
|
|
2229
|
+
...A,
|
|
2160
2230
|
children: /* @__PURE__ */ m(
|
|
2161
|
-
|
|
2231
|
+
_t,
|
|
2162
2232
|
{
|
|
2163
|
-
active:
|
|
2164
|
-
direction:
|
|
2165
|
-
onClick: b(
|
|
2233
|
+
active: x && y === w,
|
|
2234
|
+
direction: S,
|
|
2235
|
+
onClick: b(w),
|
|
2166
2236
|
children: [
|
|
2167
|
-
|
|
2168
|
-
|
|
2237
|
+
k,
|
|
2238
|
+
x && y === w ? /* @__PURE__ */ r(j, { component: "span", sx: { visibility: "hidden", display: "none" }, children: S === "desc" ? "sorted descending" : "sorted ascending" }) : null
|
|
2169
2239
|
]
|
|
2170
2240
|
}
|
|
2171
2241
|
)
|
|
2172
2242
|
},
|
|
2173
|
-
|
|
2243
|
+
w
|
|
2174
2244
|
)),
|
|
2175
2245
|
/* @__PURE__ */ r(h, {})
|
|
2176
2246
|
] })
|
|
2177
2247
|
] });
|
|
2178
|
-
},
|
|
2248
|
+
}, Wr = () => {
|
|
2179
2249
|
const {
|
|
2180
2250
|
massActions: e,
|
|
2181
2251
|
columns: t
|
|
2182
|
-
} =
|
|
2252
|
+
} = Q(), n = v(), {
|
|
2183
2253
|
["ModelIndex.Table.ShrinkedCell"]: a
|
|
2184
|
-
} =
|
|
2185
|
-
return /* @__PURE__ */ r(
|
|
2186
|
-
e.length > 0 && /* @__PURE__ */ r(a, { children: /* @__PURE__ */ r(
|
|
2187
|
-
n && t.map(({ key: c, label:
|
|
2188
|
-
|
|
2254
|
+
} = C("cms").getComponents(), [s] = W(), o = parseInt(s.get("per_page") || "15");
|
|
2255
|
+
return /* @__PURE__ */ r(T, { children: Array.from({ length: o }).map((i, l) => /* @__PURE__ */ m(_, { children: [
|
|
2256
|
+
e.length > 0 && /* @__PURE__ */ r(a, { children: /* @__PURE__ */ r(Be, {}) }),
|
|
2257
|
+
n && t.map(({ key: c, label: d, sortable: u, ...h }, g) => /* @__PURE__ */ r(K, { ...h, children: /* @__PURE__ */ r(
|
|
2258
|
+
He,
|
|
2189
2259
|
{
|
|
2190
2260
|
variant: "text",
|
|
2191
2261
|
height: 24
|
|
2192
2262
|
}
|
|
2193
2263
|
) }, g)),
|
|
2194
|
-
!n && /* @__PURE__ */ r(
|
|
2195
|
-
|
|
2264
|
+
!n && /* @__PURE__ */ r(K, { sx: { px: 0 }, children: Array.from({ length: t.length }).map((c, d) => /* @__PURE__ */ r(
|
|
2265
|
+
He,
|
|
2196
2266
|
{
|
|
2197
2267
|
variant: "text",
|
|
2198
2268
|
width: "100%",
|
|
2199
2269
|
height: 24
|
|
2200
2270
|
},
|
|
2201
|
-
|
|
2271
|
+
d
|
|
2202
2272
|
)) }),
|
|
2203
|
-
/* @__PURE__ */ r(a, { children: /* @__PURE__ */ r(
|
|
2204
|
-
] },
|
|
2205
|
-
},
|
|
2206
|
-
const n =
|
|
2273
|
+
/* @__PURE__ */ r(a, { children: /* @__PURE__ */ r(E, { children: /* @__PURE__ */ r(ht, {}) }) })
|
|
2274
|
+
] }, l)) });
|
|
2275
|
+
}, zr = ({ children: e, ...t }) => {
|
|
2276
|
+
const n = $(), { t: a } = F(), {
|
|
2207
2277
|
items: s,
|
|
2208
2278
|
loading: o,
|
|
2209
|
-
columnCount:
|
|
2210
|
-
} =
|
|
2211
|
-
["ModelIndex.StaticActions"]:
|
|
2212
|
-
} =
|
|
2213
|
-
return /* @__PURE__ */ m(
|
|
2214
|
-
o && /* @__PURE__ */ r(
|
|
2279
|
+
columnCount: i
|
|
2280
|
+
} = Q(), {
|
|
2281
|
+
["ModelIndex.StaticActions"]: l
|
|
2282
|
+
} = C("cms").getComponents(), c = p.isValidElement(e) ? e : (s || N([])).map(e);
|
|
2283
|
+
return /* @__PURE__ */ m(en, { ...t, children: [
|
|
2284
|
+
o && /* @__PURE__ */ r(Wr, {}),
|
|
2215
2285
|
c,
|
|
2216
|
-
s && !s.count() && /* @__PURE__ */ r(
|
|
2217
|
-
/* @__PURE__ */ r(
|
|
2286
|
+
s && !s.count() && /* @__PURE__ */ r(_, { children: /* @__PURE__ */ m(K, { colSpan: i, sx: { textAlign: "center", py: 10 }, children: [
|
|
2287
|
+
/* @__PURE__ */ r(q, { children: a("No :model found", {
|
|
2218
2288
|
model: n.plural().toLocaleLowerCase()
|
|
2219
2289
|
}) }),
|
|
2220
2290
|
/* @__PURE__ */ r("br", {}),
|
|
2221
|
-
/* @__PURE__ */ r(
|
|
2291
|
+
/* @__PURE__ */ r(l, {})
|
|
2222
2292
|
] }) })
|
|
2223
2293
|
] });
|
|
2224
|
-
},
|
|
2294
|
+
}, J = U(q)(() => ({
|
|
2225
2295
|
whiteSpace: "nowrap",
|
|
2226
2296
|
overflow: "hidden",
|
|
2227
2297
|
textOverflow: "ellipsis",
|
|
2228
2298
|
"& label": {
|
|
2229
2299
|
fontWeight: "bold"
|
|
2230
2300
|
}
|
|
2231
|
-
})),
|
|
2301
|
+
})), Ur = ({ content: e }) => ["string", "number"].includes(typeof e) ? /* @__PURE__ */ r(J, { children: e }) : e instanceof Date ? /* @__PURE__ */ r(J, { children: e.toLocaleString(Z("app.locale", "en")) }) : typeof e == "object" && !p.isValidElement(e) ? /* @__PURE__ */ r(J, { children: JSON.stringify(e) }) : /* @__PURE__ */ r(p.Fragment, { children: e }), Vr = ({ label: e, content: t }) => ["string", "number"].includes(typeof t) ? /* @__PURE__ */ m(J, { children: [
|
|
2232
2302
|
/* @__PURE__ */ m("label", { children: [
|
|
2233
2303
|
e,
|
|
2234
2304
|
":"
|
|
2235
2305
|
] }),
|
|
2236
2306
|
" ",
|
|
2237
2307
|
t
|
|
2238
|
-
] }) : t instanceof Date ? /* @__PURE__ */ m(
|
|
2308
|
+
] }) : t instanceof Date ? /* @__PURE__ */ m(J, { children: [
|
|
2239
2309
|
/* @__PURE__ */ m("label", { children: [
|
|
2240
2310
|
e,
|
|
2241
2311
|
":"
|
|
2242
2312
|
] }),
|
|
2243
|
-
t.toLocaleString(
|
|
2244
|
-
] }) : typeof t == "object" && !p.isValidElement(t) ? /* @__PURE__ */ m(
|
|
2313
|
+
t.toLocaleString(Z("app.locale", "en"))
|
|
2314
|
+
] }) : typeof t == "object" && !p.isValidElement(t) ? /* @__PURE__ */ m(J, { children: [
|
|
2245
2315
|
/* @__PURE__ */ m("label", { children: [
|
|
2246
2316
|
e,
|
|
2247
2317
|
":"
|
|
@@ -2249,47 +2319,47 @@ const Tr = U(re)(({ theme: e }) => ({
|
|
|
2249
2319
|
" ",
|
|
2250
2320
|
JSON.stringify(t)
|
|
2251
2321
|
] }) : /* @__PURE__ */ m(p.Fragment, { children: [
|
|
2252
|
-
/* @__PURE__ */ r(
|
|
2322
|
+
/* @__PURE__ */ r(q, { sx: { display: "inline" }, children: /* @__PURE__ */ m("b", { children: [
|
|
2253
2323
|
e,
|
|
2254
2324
|
":"
|
|
2255
2325
|
] }) }),
|
|
2256
2326
|
" ",
|
|
2257
2327
|
t
|
|
2258
|
-
] }),
|
|
2259
|
-
const n = v(), a = Ae(), s =
|
|
2328
|
+
] }), Yr = ({ item: e, ...t }) => {
|
|
2329
|
+
const n = v(), a = Ae(), s = $(), { massActions: o, columns: i } = Q(), l = p.useMemo(() => i.map((g) => ({
|
|
2260
2330
|
...g,
|
|
2261
|
-
content:
|
|
2262
|
-
})), [
|
|
2331
|
+
content: C("cms")[`model${e.constructor.name}Get${f.upperFirst(f.camelCase(g.key))}Content`](e.getAttribute(g.key), e)
|
|
2332
|
+
})), [i, e]), {
|
|
2263
2333
|
["ModelIndex.Table.ShrinkedCell"]: c,
|
|
2264
|
-
["ModelIndex.InstanceActions"]:
|
|
2265
|
-
} =
|
|
2266
|
-
isSelected:
|
|
2334
|
+
["ModelIndex.InstanceActions"]: d
|
|
2335
|
+
} = C("cms").getComponents(), {
|
|
2336
|
+
isSelected: u,
|
|
2267
2337
|
handleSelectToggle: h
|
|
2268
|
-
} =
|
|
2338
|
+
} = Ye();
|
|
2269
2339
|
return /* @__PURE__ */ m(
|
|
2270
|
-
|
|
2340
|
+
_,
|
|
2271
2341
|
{
|
|
2272
2342
|
...t,
|
|
2273
2343
|
sx: { cursor: e.deletedAt ? "default" : "pointer" },
|
|
2274
|
-
selected:
|
|
2344
|
+
selected: u(e),
|
|
2275
2345
|
hover: !e.deletedAt,
|
|
2276
2346
|
children: [
|
|
2277
2347
|
o.length > 0 && /* @__PURE__ */ r(c, { children: /* @__PURE__ */ r(
|
|
2278
|
-
|
|
2348
|
+
Be,
|
|
2279
2349
|
{
|
|
2280
|
-
checked:
|
|
2350
|
+
checked: u(e),
|
|
2281
2351
|
onChange: () => h(e)
|
|
2282
2352
|
}
|
|
2283
2353
|
) }),
|
|
2284
|
-
n &&
|
|
2285
|
-
|
|
2354
|
+
n && l.map(({ key: g, label: y, sortable: S, content: b, ...w }) => /* @__PURE__ */ r(
|
|
2355
|
+
K,
|
|
2286
2356
|
{
|
|
2287
|
-
...
|
|
2357
|
+
...w,
|
|
2288
2358
|
onClick: () => {
|
|
2289
2359
|
e.deletedAt || a(`/${f.kebabCase(s.plural())}/${e.getKey()}`);
|
|
2290
2360
|
},
|
|
2291
2361
|
children: /* @__PURE__ */ r(
|
|
2292
|
-
|
|
2362
|
+
Ur,
|
|
2293
2363
|
{
|
|
2294
2364
|
label: y,
|
|
2295
2365
|
content: b
|
|
@@ -2299,29 +2369,29 @@ const Tr = U(re)(({ theme: e }) => ({
|
|
|
2299
2369
|
g
|
|
2300
2370
|
)),
|
|
2301
2371
|
!n && /* @__PURE__ */ r(
|
|
2302
|
-
|
|
2372
|
+
K,
|
|
2303
2373
|
{
|
|
2304
2374
|
sx: { maxWidth: 0, px: 0 },
|
|
2305
2375
|
onClick: () => {
|
|
2306
2376
|
e.deletedAt || a(`/${f.kebabCase(s.plural())}/${e.getKey()}`);
|
|
2307
2377
|
},
|
|
2308
|
-
children:
|
|
2378
|
+
children: l.map(({ key: g, ...y }) => /* @__PURE__ */ r(Vr, { ...y }, g))
|
|
2309
2379
|
}
|
|
2310
2380
|
),
|
|
2311
|
-
/* @__PURE__ */ r(c, { children: /* @__PURE__ */ r(
|
|
2381
|
+
/* @__PURE__ */ r(c, { children: /* @__PURE__ */ r(d, { item: e }) })
|
|
2312
2382
|
]
|
|
2313
2383
|
}
|
|
2314
2384
|
);
|
|
2315
|
-
},
|
|
2385
|
+
}, Kr = ({ children: e, ...t }) => {
|
|
2316
2386
|
const {
|
|
2317
2387
|
columnCount: n
|
|
2318
|
-
} =
|
|
2388
|
+
} = Q(), a = v(), s = L("breakpoint", "md"), {
|
|
2319
2389
|
["ModelIndex.Pagination"]: o,
|
|
2320
|
-
["ModelIndex.PaginationDetails"]:
|
|
2321
|
-
["ModelIndex.PerPageSwitch"]:
|
|
2322
|
-
} =
|
|
2323
|
-
return /* @__PURE__ */ m(
|
|
2324
|
-
/* @__PURE__ */ r(
|
|
2390
|
+
["ModelIndex.PaginationDetails"]: i,
|
|
2391
|
+
["ModelIndex.PerPageSwitch"]: l
|
|
2392
|
+
} = C("cms").getComponents();
|
|
2393
|
+
return /* @__PURE__ */ m(tn, { ...t, children: [
|
|
2394
|
+
/* @__PURE__ */ r(_, { children: /* @__PURE__ */ r(K, { colSpan: n, children: /* @__PURE__ */ m(
|
|
2325
2395
|
B,
|
|
2326
2396
|
{
|
|
2327
2397
|
direction: a ? "row" : "column-reverse",
|
|
@@ -2338,8 +2408,8 @@ const Tr = U(re)(({ theme: e }) => ({
|
|
|
2338
2408
|
width: { xs: "100%", [s]: "auto" },
|
|
2339
2409
|
gap: a ? 2 : 0,
|
|
2340
2410
|
children: [
|
|
2341
|
-
/* @__PURE__ */ r(
|
|
2342
|
-
/* @__PURE__ */ r(
|
|
2411
|
+
/* @__PURE__ */ r(l, {}),
|
|
2412
|
+
/* @__PURE__ */ r(i, {})
|
|
2343
2413
|
]
|
|
2344
2414
|
}
|
|
2345
2415
|
),
|
|
@@ -2355,20 +2425,20 @@ const Tr = U(re)(({ theme: e }) => ({
|
|
|
2355
2425
|
) }) }),
|
|
2356
2426
|
e
|
|
2357
2427
|
] });
|
|
2358
|
-
},
|
|
2428
|
+
}, $r = () => {
|
|
2359
2429
|
const {
|
|
2360
2430
|
columnCount: e
|
|
2361
|
-
} =
|
|
2431
|
+
} = Q(), {
|
|
2362
2432
|
["ModelIndex.Filter"]: t,
|
|
2363
2433
|
["ModelIndex.MassActions"]: n,
|
|
2364
2434
|
["ModelIndex.Sort"]: a,
|
|
2365
2435
|
["ModelIndex.Pagination"]: s
|
|
2366
2436
|
// ['ModelIndex.PaginationDetails']: PaginationDetails,
|
|
2367
|
-
} =
|
|
2368
|
-
return /* @__PURE__ */ r(
|
|
2437
|
+
} = C("cms").getComponents(), o = v(), i = L("breakpoint", "md");
|
|
2438
|
+
return /* @__PURE__ */ r(_, { children: /* @__PURE__ */ r(K, { colSpan: e, sx: { p: 1 }, children: /* @__PURE__ */ m(
|
|
2369
2439
|
B,
|
|
2370
2440
|
{
|
|
2371
|
-
direction: { xs: "column", [
|
|
2441
|
+
direction: { xs: "column", [i]: "row" },
|
|
2372
2442
|
justifyContent: "space-between",
|
|
2373
2443
|
spacing: 1,
|
|
2374
2444
|
children: [
|
|
@@ -2377,7 +2447,7 @@ const Tr = U(re)(({ theme: e }) => ({
|
|
|
2377
2447
|
{
|
|
2378
2448
|
direction: "row",
|
|
2379
2449
|
alignItems: "center",
|
|
2380
|
-
width: { [
|
|
2450
|
+
width: { [i]: "100%" },
|
|
2381
2451
|
children: [
|
|
2382
2452
|
/* @__PURE__ */ r(t, {}),
|
|
2383
2453
|
!o && /* @__PURE__ */ r(a, {})
|
|
@@ -2389,7 +2459,7 @@ const Tr = U(re)(({ theme: e }) => ({
|
|
|
2389
2459
|
{
|
|
2390
2460
|
direction: "row",
|
|
2391
2461
|
alignItems: "center",
|
|
2392
|
-
justifyContent: { xs: "center", [
|
|
2462
|
+
justifyContent: { xs: "center", [i]: "flex-end" },
|
|
2393
2463
|
rowGap: 2,
|
|
2394
2464
|
children: /* @__PURE__ */ r(
|
|
2395
2465
|
s,
|
|
@@ -2405,19 +2475,19 @@ const Tr = U(re)(({ theme: e }) => ({
|
|
|
2405
2475
|
}
|
|
2406
2476
|
) }) });
|
|
2407
2477
|
};
|
|
2408
|
-
function
|
|
2409
|
-
const e =
|
|
2478
|
+
function Hr() {
|
|
2479
|
+
const e = $(), { t } = F(), [n, a] = W(), s = n.get("tab") || "all", o = (c, d) => {
|
|
2410
2480
|
a(() => {
|
|
2411
|
-
const
|
|
2412
|
-
return
|
|
2481
|
+
const u = new URLSearchParams();
|
|
2482
|
+
return d !== "all" && u.set("tab", d), u;
|
|
2413
2483
|
});
|
|
2414
|
-
},
|
|
2415
|
-
|
|
2484
|
+
}, i = p.useMemo(() => e.getSchema().softDeletes ? [{ label: t("Trashed"), value: "trashed" }] : [], [e]), l = ve(
|
|
2485
|
+
C("cms"),
|
|
2416
2486
|
`model${f.upperFirst(f.camelCase(e.getSchemaName()))}Tabs`,
|
|
2417
|
-
|
|
2487
|
+
i
|
|
2418
2488
|
);
|
|
2419
|
-
return
|
|
2420
|
-
|
|
2489
|
+
return l.length === 0 ? null : /* @__PURE__ */ r(j, { sx: { maxWidth: { xs: 320, sm: 480 }, bgcolor: "background.paper" }, children: /* @__PURE__ */ m(
|
|
2490
|
+
nn,
|
|
2421
2491
|
{
|
|
2422
2492
|
value: s,
|
|
2423
2493
|
onChange: o,
|
|
@@ -2427,14 +2497,14 @@ function Vr() {
|
|
|
2427
2497
|
allowScrollButtonsMobile: !0,
|
|
2428
2498
|
children: [
|
|
2429
2499
|
/* @__PURE__ */ r(
|
|
2430
|
-
|
|
2500
|
+
Ze,
|
|
2431
2501
|
{
|
|
2432
2502
|
label: t("All"),
|
|
2433
2503
|
value: "all"
|
|
2434
2504
|
}
|
|
2435
2505
|
),
|
|
2436
|
-
|
|
2437
|
-
|
|
2506
|
+
l.map((c) => /* @__PURE__ */ r(
|
|
2507
|
+
Ze,
|
|
2438
2508
|
{
|
|
2439
2509
|
label: c.label,
|
|
2440
2510
|
value: c.value
|
|
@@ -2445,13 +2515,13 @@ function Vr() {
|
|
|
2445
2515
|
}
|
|
2446
2516
|
) });
|
|
2447
2517
|
}
|
|
2448
|
-
function
|
|
2518
|
+
function Zr(e) {
|
|
2449
2519
|
const {
|
|
2450
2520
|
parts: t,
|
|
2451
2521
|
...n
|
|
2452
2522
|
} = e;
|
|
2453
2523
|
return /* @__PURE__ */ m(
|
|
2454
|
-
|
|
2524
|
+
rn,
|
|
2455
2525
|
{
|
|
2456
2526
|
"aria-label": "breadcrumb",
|
|
2457
2527
|
...n,
|
|
@@ -2462,8 +2532,8 @@ function Yr(e) {
|
|
|
2462
2532
|
underline: "hover",
|
|
2463
2533
|
color: "inherit",
|
|
2464
2534
|
to: "/",
|
|
2465
|
-
component:
|
|
2466
|
-
children:
|
|
2535
|
+
component: oe,
|
|
2536
|
+
children: Z("app.name", "Laravel")
|
|
2467
2537
|
}
|
|
2468
2538
|
),
|
|
2469
2539
|
t == null ? void 0 : t.map(({ name: a, href: s }, o) => s ? /* @__PURE__ */ r(
|
|
@@ -2472,12 +2542,12 @@ function Yr(e) {
|
|
|
2472
2542
|
underline: "hover",
|
|
2473
2543
|
color: "inherit",
|
|
2474
2544
|
to: s,
|
|
2475
|
-
component:
|
|
2545
|
+
component: oe,
|
|
2476
2546
|
children: a
|
|
2477
2547
|
},
|
|
2478
2548
|
o
|
|
2479
2549
|
) : /* @__PURE__ */ r(
|
|
2480
|
-
|
|
2550
|
+
q,
|
|
2481
2551
|
{
|
|
2482
2552
|
color: "text.primary",
|
|
2483
2553
|
children: a
|
|
@@ -2488,56 +2558,56 @@ function Yr(e) {
|
|
|
2488
2558
|
}
|
|
2489
2559
|
);
|
|
2490
2560
|
}
|
|
2491
|
-
const
|
|
2561
|
+
const xt = ({
|
|
2492
2562
|
collapsed: e = !1,
|
|
2493
2563
|
items: t,
|
|
2494
2564
|
onClick: n,
|
|
2495
2565
|
...a
|
|
2496
2566
|
}) => {
|
|
2497
|
-
const [s, o] = p.useState(null), [
|
|
2498
|
-
return /* @__PURE__ */ m(
|
|
2567
|
+
const [s, o] = p.useState(null), [i, l] = p.useState(null), [c, d] = p.useState({}), u = L("drawer.width", 280), h = C("cms").getComponent("RecursiveMenu");
|
|
2568
|
+
return /* @__PURE__ */ m(an, { ...a, children: [
|
|
2499
2569
|
t.map((g) => {
|
|
2500
2570
|
const {
|
|
2501
2571
|
text: y,
|
|
2502
|
-
icon:
|
|
2572
|
+
icon: S,
|
|
2503
2573
|
element: b = null,
|
|
2504
|
-
key:
|
|
2505
|
-
children:
|
|
2506
|
-
to:
|
|
2507
|
-
onClick:
|
|
2574
|
+
key: w,
|
|
2575
|
+
children: k,
|
|
2576
|
+
to: x,
|
|
2577
|
+
onClick: A
|
|
2508
2578
|
} = g;
|
|
2509
2579
|
return b || /* @__PURE__ */ m(
|
|
2510
|
-
|
|
2580
|
+
on,
|
|
2511
2581
|
{
|
|
2512
2582
|
disablePadding: !0,
|
|
2513
2583
|
sx: { display: "block" },
|
|
2514
2584
|
children: [
|
|
2515
2585
|
/* @__PURE__ */ m(
|
|
2516
|
-
|
|
2586
|
+
sn,
|
|
2517
2587
|
{
|
|
2518
2588
|
sx: {
|
|
2519
2589
|
minHeight: 48,
|
|
2520
2590
|
justifyContent: e ? "center" : "initial",
|
|
2521
2591
|
px: 2.5
|
|
2522
2592
|
},
|
|
2523
|
-
onClick: (
|
|
2524
|
-
if (
|
|
2593
|
+
onClick: (R) => {
|
|
2594
|
+
if (A && A(R), k) {
|
|
2525
2595
|
if (e) {
|
|
2526
|
-
|
|
2596
|
+
l(() => (o(R.currentTarget), k));
|
|
2527
2597
|
return;
|
|
2528
2598
|
}
|
|
2529
|
-
|
|
2599
|
+
d({
|
|
2530
2600
|
...c,
|
|
2531
|
-
[
|
|
2601
|
+
[w]: !c[w]
|
|
2532
2602
|
});
|
|
2533
2603
|
return;
|
|
2534
2604
|
}
|
|
2535
|
-
n && n(
|
|
2605
|
+
n && n(R);
|
|
2536
2606
|
},
|
|
2537
|
-
...
|
|
2607
|
+
...x ? { to: x, component: ce } : {},
|
|
2538
2608
|
children: [
|
|
2539
2609
|
/* @__PURE__ */ m(
|
|
2540
|
-
|
|
2610
|
+
ct,
|
|
2541
2611
|
{
|
|
2542
2612
|
sx: {
|
|
2543
2613
|
minWidth: 0,
|
|
@@ -2548,9 +2618,9 @@ const bt = ({
|
|
|
2548
2618
|
color: "inherit"
|
|
2549
2619
|
},
|
|
2550
2620
|
children: [
|
|
2551
|
-
|
|
2621
|
+
S,
|
|
2552
2622
|
e && /* @__PURE__ */ r(
|
|
2553
|
-
|
|
2623
|
+
q,
|
|
2554
2624
|
{
|
|
2555
2625
|
fontSize: 10,
|
|
2556
2626
|
sx: { mt: 0.5 },
|
|
@@ -2560,21 +2630,21 @@ const bt = ({
|
|
|
2560
2630
|
]
|
|
2561
2631
|
}
|
|
2562
2632
|
),
|
|
2563
|
-
!e && /* @__PURE__ */ r(
|
|
2564
|
-
!e &&
|
|
2633
|
+
!e && /* @__PURE__ */ r(ut, { primary: y }),
|
|
2634
|
+
!e && k && (c[w] ? /* @__PURE__ */ r(wn, {}) : /* @__PURE__ */ r(kn, {}))
|
|
2565
2635
|
]
|
|
2566
2636
|
}
|
|
2567
2637
|
),
|
|
2568
|
-
|
|
2569
|
-
|
|
2638
|
+
k && !e && /* @__PURE__ */ r(
|
|
2639
|
+
it,
|
|
2570
2640
|
{
|
|
2571
|
-
in: c[
|
|
2641
|
+
in: c[w],
|
|
2572
2642
|
timeout: "auto",
|
|
2573
2643
|
unmountOnExit: !0,
|
|
2574
2644
|
children: /* @__PURE__ */ r(
|
|
2575
|
-
|
|
2645
|
+
xt,
|
|
2576
2646
|
{
|
|
2577
|
-
items:
|
|
2647
|
+
items: k,
|
|
2578
2648
|
onClick: n,
|
|
2579
2649
|
collapsed: e,
|
|
2580
2650
|
sx: { pl: e ? 0 : 2, pb: 0 }
|
|
@@ -2584,46 +2654,46 @@ const bt = ({
|
|
|
2584
2654
|
)
|
|
2585
2655
|
]
|
|
2586
2656
|
},
|
|
2587
|
-
|
|
2657
|
+
w
|
|
2588
2658
|
);
|
|
2589
2659
|
}),
|
|
2590
2660
|
e && /* @__PURE__ */ r(
|
|
2591
2661
|
h,
|
|
2592
2662
|
{
|
|
2593
|
-
items:
|
|
2663
|
+
items: i || [],
|
|
2594
2664
|
onClick: n,
|
|
2595
2665
|
collapsed: !1,
|
|
2596
2666
|
sx: { pl: e ? 0 : 2, pb: 0 },
|
|
2597
2667
|
anchorEl: s,
|
|
2598
2668
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
2599
2669
|
onClose: () => {
|
|
2600
|
-
o(null),
|
|
2670
|
+
o(null), l(null);
|
|
2601
2671
|
},
|
|
2602
2672
|
open: !!s,
|
|
2603
|
-
slotProps: { paper: { sx: { minWidth:
|
|
2673
|
+
slotProps: { paper: { sx: { minWidth: u } } }
|
|
2604
2674
|
}
|
|
2605
2675
|
)
|
|
2606
2676
|
] });
|
|
2607
|
-
},
|
|
2677
|
+
}, wt = ({
|
|
2608
2678
|
collapsed: e = !1,
|
|
2609
2679
|
items: t,
|
|
2610
2680
|
onClick: n,
|
|
2611
2681
|
...a
|
|
2612
2682
|
}) => {
|
|
2613
|
-
const [s, o] = p.useState({}),
|
|
2614
|
-
return /* @__PURE__ */ m(
|
|
2615
|
-
/* @__PURE__ */ r(
|
|
2683
|
+
const [s, o] = p.useState({}), i = L("drawer.width", 280);
|
|
2684
|
+
return /* @__PURE__ */ m(T, { children: [
|
|
2685
|
+
/* @__PURE__ */ r(dt, { ...a, children: t.map((l) => {
|
|
2616
2686
|
const {
|
|
2617
2687
|
text: c,
|
|
2618
|
-
icon:
|
|
2619
|
-
element:
|
|
2688
|
+
icon: d,
|
|
2689
|
+
element: u = null,
|
|
2620
2690
|
key: h,
|
|
2621
2691
|
children: g,
|
|
2622
2692
|
onClick: y,
|
|
2623
|
-
to:
|
|
2624
|
-
} =
|
|
2625
|
-
return
|
|
2626
|
-
|
|
2693
|
+
to: S
|
|
2694
|
+
} = l;
|
|
2695
|
+
return u || /* @__PURE__ */ m(
|
|
2696
|
+
G,
|
|
2627
2697
|
{
|
|
2628
2698
|
onClick: (b) => {
|
|
2629
2699
|
if (y && y(b), g) {
|
|
@@ -2635,14 +2705,14 @@ const bt = ({
|
|
|
2635
2705
|
}
|
|
2636
2706
|
n && n(b);
|
|
2637
2707
|
},
|
|
2638
|
-
...
|
|
2639
|
-
component:
|
|
2640
|
-
to:
|
|
2708
|
+
...S ? {
|
|
2709
|
+
component: ce,
|
|
2710
|
+
to: S
|
|
2641
2711
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2642
2712
|
} : {},
|
|
2643
2713
|
children: [
|
|
2644
|
-
|
|
2645
|
-
|
|
2714
|
+
d && /* @__PURE__ */ r(
|
|
2715
|
+
ct,
|
|
2646
2716
|
{
|
|
2647
2717
|
sx: {
|
|
2648
2718
|
minWidth: 0,
|
|
@@ -2650,22 +2720,22 @@ const bt = ({
|
|
|
2650
2720
|
justifyContent: "center",
|
|
2651
2721
|
color: "inherit"
|
|
2652
2722
|
},
|
|
2653
|
-
children:
|
|
2723
|
+
children: d
|
|
2654
2724
|
}
|
|
2655
2725
|
),
|
|
2656
|
-
/* @__PURE__ */ r(
|
|
2657
|
-
!e && g && /* @__PURE__ */ r(
|
|
2726
|
+
/* @__PURE__ */ r(ut, { sx: { opacity: e ? 0 : 1 }, children: c }),
|
|
2727
|
+
!e && g && /* @__PURE__ */ r(Oe, {})
|
|
2658
2728
|
]
|
|
2659
2729
|
},
|
|
2660
2730
|
h
|
|
2661
2731
|
);
|
|
2662
2732
|
}) }),
|
|
2663
|
-
t.map((
|
|
2664
|
-
const { key: c, children:
|
|
2665
|
-
return
|
|
2666
|
-
|
|
2733
|
+
t.map((l) => {
|
|
2734
|
+
const { key: c, children: d } = l;
|
|
2735
|
+
return d ? /* @__PURE__ */ r(
|
|
2736
|
+
wt,
|
|
2667
2737
|
{
|
|
2668
|
-
items:
|
|
2738
|
+
items: d,
|
|
2669
2739
|
onClick: n,
|
|
2670
2740
|
collapsed: e,
|
|
2671
2741
|
sx: { pl: e ? 0 : 2, pb: 0 },
|
|
@@ -2673,30 +2743,30 @@ const bt = ({
|
|
|
2673
2743
|
anchorEl: s[c],
|
|
2674
2744
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
2675
2745
|
onClose: () => o({ ...s, [c]: null }),
|
|
2676
|
-
slotProps: { paper: { sx: { minWidth:
|
|
2746
|
+
slotProps: { paper: { sx: { minWidth: i } } }
|
|
2677
2747
|
},
|
|
2678
2748
|
c
|
|
2679
2749
|
) : null;
|
|
2680
2750
|
})
|
|
2681
2751
|
] });
|
|
2682
|
-
},
|
|
2752
|
+
}, ye = {
|
|
2683
2753
|
delete: (e) => async ({ selected: t, notify: n, dialog: a, refresh: s, t: o }) => {
|
|
2684
|
-
const
|
|
2754
|
+
const i = e.getSchema().softDeletes ? "send to trash" : "delete permanently", l = e.getSchema().softDeletes ? "sent to trash" : "deleted";
|
|
2685
2755
|
if (await a({
|
|
2686
2756
|
title: e.getSchema().softDeletes ? o("Confirm send to trash") : o("Confirm delete permanently"),
|
|
2687
|
-
message: o(`Are you sure you want to ${
|
|
2757
|
+
message: o(`Are you sure you want to ${i} :count :model?`, {
|
|
2688
2758
|
count: t.count(),
|
|
2689
2759
|
model: f.lowerFirst(t.count() === 1 ? e.singular() : e.plural())
|
|
2690
2760
|
}),
|
|
2691
2761
|
type: "confirm"
|
|
2692
2762
|
}))
|
|
2693
2763
|
try {
|
|
2694
|
-
await e.delete(t.pluck(e.getSchema().primaryKey).all()), n(o(`Successfully ${
|
|
2764
|
+
await e.delete(t.pluck(e.getSchema().primaryKey).all()), n(o(`Successfully ${l} :count :model`, {
|
|
2695
2765
|
count: t.count(),
|
|
2696
2766
|
model: f.lowerFirst(t.count() === 1 ? e.singular() : e.plural())
|
|
2697
2767
|
})), s();
|
|
2698
|
-
} catch (
|
|
2699
|
-
|
|
2768
|
+
} catch (d) {
|
|
2769
|
+
X(n)(d);
|
|
2700
2770
|
}
|
|
2701
2771
|
},
|
|
2702
2772
|
restore: (e) => async ({ selected: t, notify: n, dialog: a, refresh: s, t: o }) => {
|
|
@@ -2713,8 +2783,8 @@ const bt = ({
|
|
|
2713
2783
|
count: t.count(),
|
|
2714
2784
|
model: f.lowerFirst(t.count() === 1 ? e.singular() : e.plural())
|
|
2715
2785
|
})), s();
|
|
2716
|
-
} catch (
|
|
2717
|
-
|
|
2786
|
+
} catch (l) {
|
|
2787
|
+
X(n)(l);
|
|
2718
2788
|
}
|
|
2719
2789
|
},
|
|
2720
2790
|
forceDelete: (e) => async ({ selected: t, notify: n, dialog: a, refresh: s, t: o }) => {
|
|
@@ -2731,28 +2801,28 @@ const bt = ({
|
|
|
2731
2801
|
count: t.count(),
|
|
2732
2802
|
model: f.lowerFirst(t.count() === 1 ? e.singular() : e.plural())
|
|
2733
2803
|
})), s();
|
|
2734
|
-
} catch (
|
|
2735
|
-
|
|
2804
|
+
} catch (l) {
|
|
2805
|
+
X(n)(l);
|
|
2736
2806
|
}
|
|
2737
2807
|
}
|
|
2738
|
-
},
|
|
2808
|
+
}, xe = {
|
|
2739
2809
|
delete: (e) => async ({ item: t, notify: n, dialog: a, refresh: s, t: o }) => {
|
|
2740
|
-
const
|
|
2810
|
+
const i = e.getSchema().softDeletes ? "send :model “:label” to trash" : "delete :model “:label” permanently", l = e.getSchema().softDeletes ? "sent :model “:label” to trash" : "deleted :model “:label”";
|
|
2741
2811
|
if (await a({
|
|
2742
2812
|
title: e.getSchema().softDeletes ? o("Confirm send to trash") : o("Confirm permanent deletion"),
|
|
2743
|
-
message: o(`Are you sure you want to ${
|
|
2813
|
+
message: o(`Are you sure you want to ${i}?`, {
|
|
2744
2814
|
model: f.lowerFirst(e.singular()),
|
|
2745
2815
|
label: t.getLabel()
|
|
2746
2816
|
}),
|
|
2747
2817
|
type: "confirm"
|
|
2748
2818
|
}))
|
|
2749
2819
|
try {
|
|
2750
|
-
await t.delete(), n(o(`Successfully ${
|
|
2820
|
+
await t.delete(), n(o(`Successfully ${l}`, {
|
|
2751
2821
|
model: e.singular(),
|
|
2752
2822
|
label: t.getLabel()
|
|
2753
2823
|
})), s();
|
|
2754
|
-
} catch (
|
|
2755
|
-
|
|
2824
|
+
} catch (d) {
|
|
2825
|
+
X(n)(d);
|
|
2756
2826
|
}
|
|
2757
2827
|
},
|
|
2758
2828
|
restore: (e) => async ({ item: t, notify: n, dialog: a, refresh: s, t: o }) => {
|
|
@@ -2769,8 +2839,8 @@ const bt = ({
|
|
|
2769
2839
|
model: e.singular(),
|
|
2770
2840
|
label: t.getLabel()
|
|
2771
2841
|
})), s();
|
|
2772
|
-
} catch (
|
|
2773
|
-
|
|
2842
|
+
} catch (l) {
|
|
2843
|
+
X(n)(l);
|
|
2774
2844
|
}
|
|
2775
2845
|
},
|
|
2776
2846
|
forceDelete: (e) => async ({ item: t, notify: n, dialog: a, refresh: s, t: o }) => {
|
|
@@ -2787,70 +2857,70 @@ const bt = ({
|
|
|
2787
2857
|
model: e.singular(),
|
|
2788
2858
|
label: t.getLabel()
|
|
2789
2859
|
})), s();
|
|
2790
|
-
} catch (
|
|
2791
|
-
|
|
2860
|
+
} catch (l) {
|
|
2861
|
+
X(n)(l);
|
|
2792
2862
|
}
|
|
2793
2863
|
}
|
|
2794
|
-
},
|
|
2864
|
+
}, Gr = {
|
|
2795
2865
|
create: (e) => ({ navigate: t }) => {
|
|
2796
2866
|
t(`/${f.kebabCase(e.plural())}/create`);
|
|
2797
2867
|
}
|
|
2798
|
-
},
|
|
2799
|
-
const t =
|
|
2800
|
-
|
|
2801
|
-
},
|
|
2802
|
-
|
|
2868
|
+
}, Qr = ({ item: e }) => {
|
|
2869
|
+
const t = We(), [n] = W(), a = n.get("tab") ?? "all", s = p.useMemo(() => C("cms").getInstanceActions(e.constructor, a), [e, a]), [o, i] = p.useState(null), l = !!o, c = (u) => {
|
|
2870
|
+
i(u.currentTarget);
|
|
2871
|
+
}, d = () => {
|
|
2872
|
+
i(null);
|
|
2803
2873
|
};
|
|
2804
|
-
return /* @__PURE__ */ m(
|
|
2874
|
+
return /* @__PURE__ */ m(T, { children: [
|
|
2805
2875
|
/* @__PURE__ */ r(
|
|
2806
|
-
|
|
2876
|
+
E,
|
|
2807
2877
|
{
|
|
2808
2878
|
"aria-describedby": "model-item-actions",
|
|
2809
2879
|
"aria-label": "filter",
|
|
2810
2880
|
onClick: c,
|
|
2811
|
-
children: /* @__PURE__ */ r(
|
|
2881
|
+
children: /* @__PURE__ */ r(ht, {})
|
|
2812
2882
|
}
|
|
2813
2883
|
),
|
|
2814
2884
|
/* @__PURE__ */ r(
|
|
2815
|
-
|
|
2885
|
+
dt,
|
|
2816
2886
|
{
|
|
2817
2887
|
id: "model-item-actions",
|
|
2818
2888
|
anchorEl: o,
|
|
2819
|
-
open:
|
|
2820
|
-
onClose:
|
|
2889
|
+
open: l,
|
|
2890
|
+
onClose: d,
|
|
2821
2891
|
MenuListProps: {
|
|
2822
2892
|
"aria-labelledby": "model-item-action"
|
|
2823
2893
|
},
|
|
2824
|
-
children: s.map((
|
|
2825
|
-
|
|
2894
|
+
children: s.map((u) => /* @__PURE__ */ m(
|
|
2895
|
+
G,
|
|
2826
2896
|
{
|
|
2827
2897
|
onClick: () => {
|
|
2828
|
-
|
|
2898
|
+
u.callback({
|
|
2829
2899
|
item: e,
|
|
2830
2900
|
...t
|
|
2831
|
-
}),
|
|
2901
|
+
}), d();
|
|
2832
2902
|
},
|
|
2833
2903
|
sx: { px: 1, gap: 0.75 },
|
|
2834
2904
|
children: [
|
|
2835
|
-
|
|
2836
|
-
|
|
2905
|
+
u.icon,
|
|
2906
|
+
u.label
|
|
2837
2907
|
]
|
|
2838
2908
|
},
|
|
2839
|
-
|
|
2909
|
+
u.label
|
|
2840
2910
|
))
|
|
2841
2911
|
}
|
|
2842
2912
|
)
|
|
2843
2913
|
] });
|
|
2844
2914
|
};
|
|
2845
2915
|
let P;
|
|
2846
|
-
class
|
|
2916
|
+
class Xr extends at {
|
|
2847
2917
|
constructor(n = {}) {
|
|
2848
2918
|
super();
|
|
2849
|
-
|
|
2919
|
+
ue(this, "name", "Luminix CMS Plugin");
|
|
2850
2920
|
this.options = n;
|
|
2851
2921
|
}
|
|
2852
2922
|
register(n) {
|
|
2853
|
-
P = n, P.bind("cms", new
|
|
2923
|
+
P = n, P.bind("cms", new Pn()), P.bind("filter", new Bn()), P.once("booting", () => {
|
|
2854
2924
|
this.bootModels();
|
|
2855
2925
|
});
|
|
2856
2926
|
}
|
|
@@ -2862,50 +2932,50 @@ class $r extends Je {
|
|
|
2862
2932
|
"model",
|
|
2863
2933
|
(n, a) => class extends n {
|
|
2864
2934
|
static icon() {
|
|
2865
|
-
return a === "user" ? /* @__PURE__ */ r(
|
|
2935
|
+
return a === "user" ? /* @__PURE__ */ r(Sn, {}) : /* @__PURE__ */ r(Cn, {});
|
|
2866
2936
|
}
|
|
2867
2937
|
},
|
|
2868
2938
|
0
|
|
2869
2939
|
);
|
|
2870
2940
|
}
|
|
2871
2941
|
bootRoutes() {
|
|
2872
|
-
P.make("cms").reducer("cmsRoutes",
|
|
2942
|
+
P.make("cms").reducer("cmsRoutes", Wn, 0), P.make("route").reducer("routerOptions", (n) => ({
|
|
2873
2943
|
...n,
|
|
2874
2944
|
basename: P.make("config").get("luminix.admin.url", "/admin")
|
|
2875
2945
|
}));
|
|
2876
2946
|
}
|
|
2877
2947
|
bootComponents() {
|
|
2878
2948
|
P.make("cms").reducer("componentMap", () => ({
|
|
2879
|
-
Layout:
|
|
2880
|
-
Dashboard:
|
|
2881
|
-
ModelIndex:
|
|
2882
|
-
ModelItem:
|
|
2883
|
-
Error:
|
|
2884
|
-
DesktopPageTitle:
|
|
2885
|
-
RecursiveList:
|
|
2886
|
-
RecursiveMenu:
|
|
2887
|
-
Breadcrumbs:
|
|
2888
|
-
"Layout.AppBar":
|
|
2889
|
-
"Layout.Drawer":
|
|
2890
|
-
"Layout.AppBar.MenuButton":
|
|
2891
|
-
"Layout.SearchBar":
|
|
2892
|
-
"Layout.BackButton":
|
|
2893
|
-
"ModelIndex.Filter":
|
|
2894
|
-
"ModelIndex.InstanceActions":
|
|
2895
|
-
"ModelIndex.MassActions":
|
|
2896
|
-
"ModelIndex.Pagination":
|
|
2897
|
-
"ModelIndex.PaginationDetails":
|
|
2898
|
-
"ModelIndex.PerPageSwitch":
|
|
2899
|
-
"ModelIndex.Sort":
|
|
2900
|
-
"ModelIndex.StaticActions":
|
|
2901
|
-
"ModelIndex.Table":
|
|
2902
|
-
"ModelIndex.Table.TableHead":
|
|
2903
|
-
"ModelIndex.Table.TableBody":
|
|
2904
|
-
"ModelIndex.Table.TableFooter":
|
|
2905
|
-
"ModelIndex.Table.TableToolbar":
|
|
2906
|
-
"ModelIndex.Table.TableBody.TableRow":
|
|
2907
|
-
"ModelIndex.Table.ShrinkedCell":
|
|
2908
|
-
"ModelIndex.Tabs":
|
|
2949
|
+
Layout: Yn,
|
|
2950
|
+
Dashboard: zn,
|
|
2951
|
+
ModelIndex: $n,
|
|
2952
|
+
ModelItem: Gn,
|
|
2953
|
+
Error: Un,
|
|
2954
|
+
DesktopPageTitle: pr,
|
|
2955
|
+
RecursiveList: xt,
|
|
2956
|
+
RecursiveMenu: wt,
|
|
2957
|
+
Breadcrumbs: Zr,
|
|
2958
|
+
"Layout.AppBar": sr,
|
|
2959
|
+
"Layout.Drawer": dr,
|
|
2960
|
+
"Layout.AppBar.MenuButton": Dr,
|
|
2961
|
+
"Layout.SearchBar": Lr,
|
|
2962
|
+
"Layout.BackButton": lr,
|
|
2963
|
+
"ModelIndex.Filter": Ar,
|
|
2964
|
+
"ModelIndex.InstanceActions": Qr,
|
|
2965
|
+
"ModelIndex.MassActions": vr,
|
|
2966
|
+
"ModelIndex.Pagination": Fr,
|
|
2967
|
+
"ModelIndex.PaginationDetails": Ir,
|
|
2968
|
+
"ModelIndex.PerPageSwitch": Pr,
|
|
2969
|
+
"ModelIndex.Sort": Nr,
|
|
2970
|
+
"ModelIndex.StaticActions": er,
|
|
2971
|
+
"ModelIndex.Table": jr,
|
|
2972
|
+
"ModelIndex.Table.TableHead": qr,
|
|
2973
|
+
"ModelIndex.Table.TableBody": zr,
|
|
2974
|
+
"ModelIndex.Table.TableFooter": Kr,
|
|
2975
|
+
"ModelIndex.Table.TableToolbar": $r,
|
|
2976
|
+
"ModelIndex.Table.TableBody.TableRow": Yr,
|
|
2977
|
+
"ModelIndex.Table.ShrinkedCell": Or,
|
|
2978
|
+
"ModelIndex.Tabs": Hr
|
|
2909
2979
|
}), 0);
|
|
2910
2980
|
}
|
|
2911
2981
|
bootMenu() {
|
|
@@ -2915,7 +2985,7 @@ class $r extends Je {
|
|
|
2915
2985
|
key: "dashboard",
|
|
2916
2986
|
text: "Dashboard",
|
|
2917
2987
|
to: "/",
|
|
2918
|
-
icon: /* @__PURE__ */ r(
|
|
2988
|
+
icon: /* @__PURE__ */ r(An, {})
|
|
2919
2989
|
},
|
|
2920
2990
|
...Object.entries(a).sort(([s], [o]) => s.localeCompare(o)).map(([s, o]) => ({
|
|
2921
2991
|
key: s,
|
|
@@ -2954,19 +3024,19 @@ class $r extends Je {
|
|
|
2954
3024
|
}
|
|
2955
3025
|
bootMassActions() {
|
|
2956
3026
|
P.make("cms").reducer("massActions", (n, a, s) => {
|
|
2957
|
-
const o = [], { softDeletes:
|
|
3027
|
+
const o = [], { softDeletes: i } = a.getSchema();
|
|
2958
3028
|
return s !== "trashed" ? o.push({
|
|
2959
3029
|
key: "delete",
|
|
2960
|
-
label:
|
|
2961
|
-
callback:
|
|
3030
|
+
label: i ? "Send to trash" : "Delete permanently",
|
|
3031
|
+
callback: ye.delete(a)
|
|
2962
3032
|
}) : (o.push({
|
|
2963
3033
|
key: "restore",
|
|
2964
3034
|
label: "Restore",
|
|
2965
|
-
callback:
|
|
3035
|
+
callback: ye.restore(a)
|
|
2966
3036
|
}), o.push({
|
|
2967
3037
|
key: "forceDelete",
|
|
2968
3038
|
label: "Delete permanently",
|
|
2969
|
-
callback:
|
|
3039
|
+
callback: ye.forceDelete(a)
|
|
2970
3040
|
})), [
|
|
2971
3041
|
...n,
|
|
2972
3042
|
...o
|
|
@@ -2975,16 +3045,16 @@ class $r extends Je {
|
|
|
2975
3045
|
}
|
|
2976
3046
|
bootInstanceActions() {
|
|
2977
3047
|
P.make("cms").reducer("instanceActions", (n, a, s) => {
|
|
2978
|
-
const o = [], { softDeletes:
|
|
3048
|
+
const o = [], { softDeletes: i } = a.getSchema();
|
|
2979
3049
|
return s !== "trashed" ? o.push({
|
|
2980
|
-
label:
|
|
2981
|
-
callback:
|
|
3050
|
+
label: i ? "Send to trash" : "Delete permanently",
|
|
3051
|
+
callback: xe.delete(a)
|
|
2982
3052
|
}) : (o.push({
|
|
2983
3053
|
label: "Restore",
|
|
2984
|
-
callback:
|
|
3054
|
+
callback: xe.restore(a)
|
|
2985
3055
|
}), o.push({
|
|
2986
3056
|
label: "Delete permanently",
|
|
2987
|
-
callback:
|
|
3057
|
+
callback: xe.forceDelete(a)
|
|
2988
3058
|
})), [
|
|
2989
3059
|
...n,
|
|
2990
3060
|
...o
|
|
@@ -2997,16 +3067,16 @@ class $r extends Je {
|
|
|
2997
3067
|
{
|
|
2998
3068
|
key: "create",
|
|
2999
3069
|
label: `Create ${a.singular()}`,
|
|
3000
|
-
callback:
|
|
3001
|
-
icon: /* @__PURE__ */ r(
|
|
3070
|
+
callback: Gr.create(a),
|
|
3071
|
+
icon: /* @__PURE__ */ r(vn, {})
|
|
3002
3072
|
}
|
|
3003
3073
|
], 0);
|
|
3004
3074
|
}
|
|
3005
3075
|
}
|
|
3006
|
-
class
|
|
3076
|
+
class Jr extends at {
|
|
3007
3077
|
constructor(n) {
|
|
3008
3078
|
super();
|
|
3009
|
-
|
|
3079
|
+
ue(this, "name", "Luminix CMS i18Next Plugin");
|
|
3010
3080
|
this.options = n;
|
|
3011
3081
|
}
|
|
3012
3082
|
register(n) {
|
|
@@ -3018,7 +3088,7 @@ class Hr extends Je {
|
|
|
3018
3088
|
this.translateModelColumns(a, n), this.translateMenuEntries(n), this.translateInstanceActions(n), this.translateMassActions(n), this.translateFormLabels(s), this.translateStaticActions(n);
|
|
3019
3089
|
}
|
|
3020
3090
|
initI18Next(n) {
|
|
3021
|
-
|
|
3091
|
+
z.use(un).init({
|
|
3022
3092
|
lng: n.get("app.locale", "en"),
|
|
3023
3093
|
fallbackLng: n.get("app.fallback_locale", "en"),
|
|
3024
3094
|
resources: {
|
|
@@ -3044,10 +3114,10 @@ class Hr extends Je {
|
|
|
3044
3114
|
"model",
|
|
3045
3115
|
(a) => class extends a {
|
|
3046
3116
|
static singular() {
|
|
3047
|
-
return
|
|
3117
|
+
return z.t(a.singular());
|
|
3048
3118
|
}
|
|
3049
3119
|
static plural() {
|
|
3050
|
-
return
|
|
3120
|
+
return z.t(a.plural());
|
|
3051
3121
|
}
|
|
3052
3122
|
},
|
|
3053
3123
|
0
|
|
@@ -3057,9 +3127,9 @@ class Hr extends Je {
|
|
|
3057
3127
|
for (const s of Object.keys(n.make()))
|
|
3058
3128
|
a.reducer(
|
|
3059
3129
|
`model${f.upperFirst(f.camelCase(s))}Columns`,
|
|
3060
|
-
(o) => o.map((
|
|
3061
|
-
...
|
|
3062
|
-
label:
|
|
3130
|
+
(o) => o.map((i) => ({
|
|
3131
|
+
...i,
|
|
3132
|
+
label: z.t(i.label)
|
|
3063
3133
|
})),
|
|
3064
3134
|
99
|
|
3065
3135
|
);
|
|
@@ -3069,7 +3139,7 @@ class Hr extends Je {
|
|
|
3069
3139
|
"menuItems",
|
|
3070
3140
|
(a) => {
|
|
3071
3141
|
const s = a.find((o) => o.key === "dashboard");
|
|
3072
|
-
return s && (s.text =
|
|
3142
|
+
return s && (s.text = z.t(s.text)), a;
|
|
3073
3143
|
},
|
|
3074
3144
|
5
|
|
3075
3145
|
);
|
|
@@ -3079,7 +3149,7 @@ class Hr extends Je {
|
|
|
3079
3149
|
"massActions",
|
|
3080
3150
|
(a) => a.map((s) => ({
|
|
3081
3151
|
...s,
|
|
3082
|
-
label:
|
|
3152
|
+
label: z.t(s.label)
|
|
3083
3153
|
})),
|
|
3084
3154
|
99
|
|
3085
3155
|
);
|
|
@@ -3089,7 +3159,7 @@ class Hr extends Je {
|
|
|
3089
3159
|
"instanceActions",
|
|
3090
3160
|
(a) => a.map((s) => ({
|
|
3091
3161
|
...s,
|
|
3092
|
-
label:
|
|
3162
|
+
label: z.t(s.label)
|
|
3093
3163
|
})),
|
|
3094
3164
|
99
|
|
3095
3165
|
);
|
|
@@ -3098,8 +3168,8 @@ class Hr extends Je {
|
|
|
3098
3168
|
n.reducer(
|
|
3099
3169
|
"staticActions",
|
|
3100
3170
|
(a, s) => {
|
|
3101
|
-
const o = a.find(({ key:
|
|
3102
|
-
return o && (o.label =
|
|
3171
|
+
const o = a.find(({ key: i }) => i === "create");
|
|
3172
|
+
return o && (o.label = z.t("Create :model", {
|
|
3103
3173
|
model: s.singular()
|
|
3104
3174
|
})), a;
|
|
3105
3175
|
}
|
|
@@ -3109,13 +3179,13 @@ class Hr extends Je {
|
|
|
3109
3179
|
n.reducer(
|
|
3110
3180
|
"getDefaultInputProps",
|
|
3111
3181
|
(a) => (Array.isArray(a) ? a.map((s) => {
|
|
3112
|
-
s.label && (s.label =
|
|
3113
|
-
}) : a.label && (a.label =
|
|
3182
|
+
s.label && (s.label = z.t(s.label));
|
|
3183
|
+
}) : a.label && (a.label = z.t(a.label)), a),
|
|
3114
3184
|
99
|
|
3115
3185
|
);
|
|
3116
3186
|
}
|
|
3117
3187
|
}
|
|
3118
|
-
const
|
|
3188
|
+
const _r = {
|
|
3119
3189
|
palette: {
|
|
3120
3190
|
primary: {
|
|
3121
3191
|
main: "#1d9798"
|
|
@@ -3124,27 +3194,27 @@ const Zr = {
|
|
|
3124
3194
|
main: "#fa510c"
|
|
3125
3195
|
}
|
|
3126
3196
|
}
|
|
3127
|
-
},
|
|
3128
|
-
theme: e =
|
|
3197
|
+
}, ma = ({
|
|
3198
|
+
theme: e = _r,
|
|
3129
3199
|
plugins: t,
|
|
3130
3200
|
i18nOptions: n = {}
|
|
3131
3201
|
}) => {
|
|
3132
|
-
const a =
|
|
3202
|
+
const a = ie("(prefers-color-scheme: dark)"), s = p.useMemo(() => Dn({
|
|
3133
3203
|
...e,
|
|
3134
3204
|
palette: {
|
|
3135
3205
|
...e.palette,
|
|
3136
3206
|
mode: a ? "dark" : "light"
|
|
3137
3207
|
}
|
|
3138
3208
|
}), [e, a]);
|
|
3139
|
-
return /* @__PURE__ */ m(
|
|
3140
|
-
/* @__PURE__ */ r(
|
|
3209
|
+
return /* @__PURE__ */ m(Tn, { theme: s, children: [
|
|
3210
|
+
/* @__PURE__ */ r(ln, {}),
|
|
3141
3211
|
/* @__PURE__ */ r(
|
|
3142
|
-
|
|
3212
|
+
Pt,
|
|
3143
3213
|
{
|
|
3144
3214
|
routes: (o) => o.make("cms").getRoutes(),
|
|
3145
3215
|
plugins: [
|
|
3146
|
-
new
|
|
3147
|
-
new
|
|
3216
|
+
new Xr(),
|
|
3217
|
+
new Jr(n),
|
|
3148
3218
|
...t || []
|
|
3149
3219
|
],
|
|
3150
3220
|
config: {
|
|
@@ -3158,6 +3228,6 @@ const Zr = {
|
|
|
3158
3228
|
] });
|
|
3159
3229
|
};
|
|
3160
3230
|
export {
|
|
3161
|
-
|
|
3162
|
-
|
|
3231
|
+
Xr as CmsPlugin,
|
|
3232
|
+
ma as LuminixCms
|
|
3163
3233
|
};
|