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