master-data-management-react 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.d.ts +5 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/components/ServerSideGrid/ServerSideGrid.d.ts.map +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +215 -217
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/pages/MasterView/MasterView.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import
|
|
1
|
+
import mt, { useRef as We, useMemo as me, useState as M, useEffect as Ce, useCallback as Ie } from "react";
|
|
2
2
|
import { styled as ce, Box as N, Select as Ht, FormControl as Xt, CircularProgress as Le, Divider as zt, Button as ne, Typography as _e, Paper as _t, Autocomplete as Be, TextField as ee, Menu as qt, MenuItem as ke, Alert as Kt } from "@mui/material";
|
|
3
3
|
import { AgGridReact as Jt } from "ag-grid-react";
|
|
4
4
|
import { ModuleRegistry as Qt, ClientSideRowModelModule as gt, AllCommunityModule as Zt } from "ag-grid-community";
|
|
5
5
|
const vt = (a, u) => ({
|
|
6
6
|
getEntities: async () => {
|
|
7
|
-
const
|
|
7
|
+
const c = await a.get(u.entities);
|
|
8
8
|
return {
|
|
9
|
-
data:
|
|
9
|
+
data: c.data.data ?? c.data
|
|
10
10
|
};
|
|
11
11
|
},
|
|
12
|
-
getMetadata: async (
|
|
13
|
-
const f = await a.get(u.metadata(
|
|
12
|
+
getMetadata: async (c) => {
|
|
13
|
+
const f = await a.get(u.metadata(c));
|
|
14
14
|
return {
|
|
15
15
|
data: f.data.data ?? f.data
|
|
16
16
|
};
|
|
17
17
|
},
|
|
18
|
-
getRecords: async (
|
|
19
|
-
const s = await a.get(u.records(
|
|
18
|
+
getRecords: async (c, f) => {
|
|
19
|
+
const s = await a.get(u.records(c), { params: f });
|
|
20
20
|
return {
|
|
21
21
|
data: s.data.data ?? s.data,
|
|
22
22
|
total: s.data.total ?? s.data.count ?? 0
|
|
23
23
|
};
|
|
24
24
|
},
|
|
25
|
-
getRecord: async (
|
|
26
|
-
const s = await a.get(u.recordById(
|
|
25
|
+
getRecord: async (c, f) => {
|
|
26
|
+
const s = await a.get(u.recordById(c, f));
|
|
27
27
|
return {
|
|
28
28
|
data: s.data.data ?? s.data
|
|
29
29
|
};
|
|
30
30
|
},
|
|
31
|
-
createRecord: async (
|
|
32
|
-
const s = await a.post(u.records(
|
|
31
|
+
createRecord: async (c, f) => {
|
|
32
|
+
const s = await a.post(u.records(c), f);
|
|
33
33
|
return {
|
|
34
34
|
data: s.data.data ?? s.data
|
|
35
35
|
};
|
|
36
36
|
},
|
|
37
|
-
updateRecord: async (
|
|
38
|
-
const k = await a.put(u.recordById(
|
|
37
|
+
updateRecord: async (c, f, s) => {
|
|
38
|
+
const k = await a.put(u.recordById(c, f), s);
|
|
39
39
|
return {
|
|
40
40
|
data: k.data.data ?? k.data
|
|
41
41
|
};
|
|
42
42
|
},
|
|
43
|
-
deleteRecord: async (
|
|
44
|
-
const s = await a.delete(u.recordById(
|
|
43
|
+
deleteRecord: async (c, f) => {
|
|
44
|
+
const s = await a.delete(u.recordById(c, f));
|
|
45
45
|
return {
|
|
46
46
|
data: s.data.data ?? s.data
|
|
47
47
|
};
|
|
48
48
|
},
|
|
49
|
-
exportCSV: async (
|
|
49
|
+
exportCSV: async (c, f) => await a.get(u.exportCSV(c), {
|
|
50
50
|
params: f,
|
|
51
51
|
responseType: "blob"
|
|
52
52
|
}),
|
|
53
|
-
exportExcel: async (
|
|
53
|
+
exportExcel: async (c, f) => await a.get(u.exportExcel(c), {
|
|
54
54
|
params: f,
|
|
55
55
|
responseType: "blob"
|
|
56
56
|
}),
|
|
57
|
-
getDropdownOptions: async (
|
|
58
|
-
const f = u.dropdownOptions ? u.dropdownOptions(
|
|
57
|
+
getDropdownOptions: async (c) => {
|
|
58
|
+
const f = u.dropdownOptions ? u.dropdownOptions(c) : c, s = await a.get(f);
|
|
59
59
|
return {
|
|
60
60
|
data: s.data.data ?? s.data
|
|
61
61
|
};
|
|
@@ -66,7 +66,7 @@ var st;
|
|
|
66
66
|
function er() {
|
|
67
67
|
if (st) return Ae;
|
|
68
68
|
st = 1;
|
|
69
|
-
var a =
|
|
69
|
+
var a = mt, u = /* @__PURE__ */ Symbol.for("react.element"), c = /* @__PURE__ */ Symbol.for("react.fragment"), f = Object.prototype.hasOwnProperty, s = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, k = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
70
70
|
function X(p, g, Y) {
|
|
71
71
|
var S, I = {}, C = null, W = null;
|
|
72
72
|
Y !== void 0 && (C = "" + Y), g.key !== void 0 && (C = "" + g.key), g.ref !== void 0 && (W = g.ref);
|
|
@@ -74,13 +74,13 @@ function er() {
|
|
|
74
74
|
if (p && p.defaultProps) for (S in g = p.defaultProps, g) I[S] === void 0 && (I[S] = g[S]);
|
|
75
75
|
return { $$typeof: u, type: p, key: C, ref: W, props: I, _owner: s.current };
|
|
76
76
|
}
|
|
77
|
-
return Ae.Fragment =
|
|
77
|
+
return Ae.Fragment = c, Ae.jsx = X, Ae.jsxs = X, Ae;
|
|
78
78
|
}
|
|
79
79
|
var Oe = {};
|
|
80
80
|
var it;
|
|
81
81
|
function tr() {
|
|
82
82
|
return it || (it = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
83
|
-
var a =
|
|
83
|
+
var a = mt, u = /* @__PURE__ */ Symbol.for("react.element"), c = /* @__PURE__ */ Symbol.for("react.portal"), f = /* @__PURE__ */ Symbol.for("react.fragment"), s = /* @__PURE__ */ Symbol.for("react.strict_mode"), k = /* @__PURE__ */ Symbol.for("react.profiler"), X = /* @__PURE__ */ Symbol.for("react.provider"), p = /* @__PURE__ */ Symbol.for("react.context"), g = /* @__PURE__ */ Symbol.for("react.forward_ref"), Y = /* @__PURE__ */ Symbol.for("react.suspense"), S = /* @__PURE__ */ Symbol.for("react.suspense_list"), I = /* @__PURE__ */ Symbol.for("react.memo"), C = /* @__PURE__ */ Symbol.for("react.lazy"), W = /* @__PURE__ */ Symbol.for("react.offscreen"), te = Symbol.iterator, de = "@@iterator";
|
|
84
84
|
function q(e) {
|
|
85
85
|
if (e === null || typeof e != "object")
|
|
86
86
|
return null;
|
|
@@ -90,14 +90,14 @@ function tr() {
|
|
|
90
90
|
var V = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
91
91
|
function D(e) {
|
|
92
92
|
{
|
|
93
|
-
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0),
|
|
94
|
-
n[
|
|
93
|
+
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), l = 1; l < t; l++)
|
|
94
|
+
n[l - 1] = arguments[l];
|
|
95
95
|
P("error", e, n);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
function P(e, t, n) {
|
|
99
99
|
{
|
|
100
|
-
var
|
|
100
|
+
var l = V.ReactDebugCurrentFrame, A = l.getStackAddendum();
|
|
101
101
|
A !== "" && (t += "%s", n = n.concat([A]));
|
|
102
102
|
var y = n.map(function(_) {
|
|
103
103
|
return String(_);
|
|
@@ -107,7 +107,7 @@ function tr() {
|
|
|
107
107
|
}
|
|
108
108
|
var re = !1, F = !1, G = !1, ue = !1, K = !1, oe;
|
|
109
109
|
oe = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
110
|
-
function
|
|
110
|
+
function m(e) {
|
|
111
111
|
return !!(typeof e == "string" || typeof e == "function" || e === f || e === k || K || e === s || e === Y || e === S || ue || e === W || re || F || G || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === I || e.$$typeof === X || e.$$typeof === p || e.$$typeof === g || // This needs to include all possible module reference object
|
|
112
112
|
// types supported by any Flight configuration anywhere since
|
|
113
113
|
// we don't know which Flight build this will end up being used
|
|
@@ -115,9 +115,9 @@ function tr() {
|
|
|
115
115
|
e.$$typeof === oe || e.getModuleId !== void 0));
|
|
116
116
|
}
|
|
117
117
|
function E(e, t, n) {
|
|
118
|
-
var
|
|
119
|
-
if (
|
|
120
|
-
return
|
|
118
|
+
var l = e.displayName;
|
|
119
|
+
if (l)
|
|
120
|
+
return l;
|
|
121
121
|
var A = t.displayName || t.name || "";
|
|
122
122
|
return A !== "" ? n + "(" + A + ")" : n;
|
|
123
123
|
}
|
|
@@ -134,7 +134,7 @@ function tr() {
|
|
|
134
134
|
switch (e) {
|
|
135
135
|
case f:
|
|
136
136
|
return "Fragment";
|
|
137
|
-
case
|
|
137
|
+
case c:
|
|
138
138
|
return "Portal";
|
|
139
139
|
case k:
|
|
140
140
|
return "Profiler";
|
|
@@ -156,8 +156,8 @@ function tr() {
|
|
|
156
156
|
case g:
|
|
157
157
|
return E(e, e.render, "ForwardRef");
|
|
158
158
|
case I:
|
|
159
|
-
var
|
|
160
|
-
return
|
|
159
|
+
var l = e.displayName || null;
|
|
160
|
+
return l !== null ? l : T(e.type) || "Memo";
|
|
161
161
|
case C: {
|
|
162
162
|
var A = e, y = A._payload, _ = A._init;
|
|
163
163
|
try {
|
|
@@ -169,11 +169,11 @@ function tr() {
|
|
|
169
169
|
}
|
|
170
170
|
return null;
|
|
171
171
|
}
|
|
172
|
-
var
|
|
172
|
+
var j = Object.assign, h = 0, J, U, Q, fe, Te, ae, ge;
|
|
173
173
|
function ve() {
|
|
174
174
|
}
|
|
175
175
|
ve.__reactDisabledLog = !0;
|
|
176
|
-
function
|
|
176
|
+
function je() {
|
|
177
177
|
{
|
|
178
178
|
if (h === 0) {
|
|
179
179
|
J = console.log, U = console.info, Q = console.warn, fe = console.error, Te = console.group, ae = console.groupCollapsed, ge = console.groupEnd;
|
|
@@ -205,25 +205,25 @@ function tr() {
|
|
|
205
205
|
writable: !0
|
|
206
206
|
};
|
|
207
207
|
Object.defineProperties(console, {
|
|
208
|
-
log:
|
|
208
|
+
log: j({}, e, {
|
|
209
209
|
value: J
|
|
210
210
|
}),
|
|
211
|
-
info:
|
|
211
|
+
info: j({}, e, {
|
|
212
212
|
value: U
|
|
213
213
|
}),
|
|
214
|
-
warn:
|
|
214
|
+
warn: j({}, e, {
|
|
215
215
|
value: Q
|
|
216
216
|
}),
|
|
217
|
-
error:
|
|
217
|
+
error: j({}, e, {
|
|
218
218
|
value: fe
|
|
219
219
|
}),
|
|
220
|
-
group:
|
|
220
|
+
group: j({}, e, {
|
|
221
221
|
value: Te
|
|
222
222
|
}),
|
|
223
|
-
groupCollapsed:
|
|
223
|
+
groupCollapsed: j({}, e, {
|
|
224
224
|
value: ae
|
|
225
225
|
}),
|
|
226
|
-
groupEnd:
|
|
226
|
+
groupEnd: j({}, e, {
|
|
227
227
|
value: ge
|
|
228
228
|
})
|
|
229
229
|
});
|
|
@@ -231,15 +231,15 @@ function tr() {
|
|
|
231
231
|
h < 0 && D("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
var
|
|
234
|
+
var d = V.ReactCurrentDispatcher, v;
|
|
235
235
|
function x(e, t, n) {
|
|
236
236
|
{
|
|
237
237
|
if (v === void 0)
|
|
238
238
|
try {
|
|
239
239
|
throw Error();
|
|
240
240
|
} catch (A) {
|
|
241
|
-
var
|
|
242
|
-
v =
|
|
241
|
+
var l = A.stack.trim().match(/\n( *(at )?)/);
|
|
242
|
+
v = l && l[1] || "";
|
|
243
243
|
}
|
|
244
244
|
return `
|
|
245
245
|
` + v + e;
|
|
@@ -258,12 +258,12 @@ function tr() {
|
|
|
258
258
|
if (n !== void 0)
|
|
259
259
|
return n;
|
|
260
260
|
}
|
|
261
|
-
var
|
|
261
|
+
var l;
|
|
262
262
|
O = !0;
|
|
263
263
|
var A = Error.prepareStackTrace;
|
|
264
264
|
Error.prepareStackTrace = void 0;
|
|
265
265
|
var y;
|
|
266
|
-
y =
|
|
266
|
+
y = d.current, d.current = null, je();
|
|
267
267
|
try {
|
|
268
268
|
if (t) {
|
|
269
269
|
var _ = function() {
|
|
@@ -277,14 +277,14 @@ function tr() {
|
|
|
277
277
|
try {
|
|
278
278
|
Reflect.construct(_, []);
|
|
279
279
|
} catch (B) {
|
|
280
|
-
|
|
280
|
+
l = B;
|
|
281
281
|
}
|
|
282
282
|
Reflect.construct(e, [], _);
|
|
283
283
|
} else {
|
|
284
284
|
try {
|
|
285
285
|
_.call();
|
|
286
286
|
} catch (B) {
|
|
287
|
-
|
|
287
|
+
l = B;
|
|
288
288
|
}
|
|
289
289
|
e.call(_.prototype);
|
|
290
290
|
}
|
|
@@ -292,33 +292,33 @@ function tr() {
|
|
|
292
292
|
try {
|
|
293
293
|
throw Error();
|
|
294
294
|
} catch (B) {
|
|
295
|
-
|
|
295
|
+
l = B;
|
|
296
296
|
}
|
|
297
297
|
e();
|
|
298
298
|
}
|
|
299
299
|
} catch (B) {
|
|
300
|
-
if (B &&
|
|
301
|
-
for (var
|
|
302
|
-
`), $ =
|
|
303
|
-
`), L =
|
|
304
|
-
|
|
305
|
-
for (; L >= 1 &&
|
|
306
|
-
if (
|
|
307
|
-
if (L !== 1 ||
|
|
300
|
+
if (B && l && typeof B.stack == "string") {
|
|
301
|
+
for (var R = B.stack.split(`
|
|
302
|
+
`), $ = l.stack.split(`
|
|
303
|
+
`), L = R.length - 1, w = $.length - 1; L >= 1 && w >= 0 && R[L] !== $[w]; )
|
|
304
|
+
w--;
|
|
305
|
+
for (; L >= 1 && w >= 0; L--, w--)
|
|
306
|
+
if (R[L] !== $[w]) {
|
|
307
|
+
if (L !== 1 || w !== 1)
|
|
308
308
|
do
|
|
309
|
-
if (L--,
|
|
309
|
+
if (L--, w--, w < 0 || R[L] !== $[w]) {
|
|
310
310
|
var z = `
|
|
311
|
-
` +
|
|
311
|
+
` + R[L].replace(" at new ", " at ");
|
|
312
312
|
return e.displayName && z.includes("<anonymous>") && (z = z.replace("<anonymous>", e.displayName)), typeof e == "function" && b.set(e, z), z;
|
|
313
313
|
}
|
|
314
|
-
while (L >= 1 &&
|
|
314
|
+
while (L >= 1 && w >= 0);
|
|
315
315
|
break;
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
} finally {
|
|
319
|
-
O = !1,
|
|
319
|
+
O = !1, d.current = y, o(), Error.prepareStackTrace = A;
|
|
320
320
|
}
|
|
321
|
-
var
|
|
321
|
+
var Re = e ? e.displayName || e.name : "", Ee = Re ? x(Re) : "";
|
|
322
322
|
return typeof e == "function" && b.set(e, Ee), Ee;
|
|
323
323
|
}
|
|
324
324
|
function ht(e, t, n) {
|
|
@@ -348,7 +348,7 @@ function tr() {
|
|
|
348
348
|
case I:
|
|
349
349
|
return De(e.type, t, n);
|
|
350
350
|
case C: {
|
|
351
|
-
var
|
|
351
|
+
var l = e, A = l._payload, y = l._init;
|
|
352
352
|
try {
|
|
353
353
|
return De(y(A), t, n);
|
|
354
354
|
} catch {
|
|
@@ -365,27 +365,27 @@ function tr() {
|
|
|
365
365
|
} else
|
|
366
366
|
Xe.setExtraStackFrame(null);
|
|
367
367
|
}
|
|
368
|
-
function Ot(e, t, n,
|
|
368
|
+
function Ot(e, t, n, l, A) {
|
|
369
369
|
{
|
|
370
370
|
var y = Function.call.bind(he);
|
|
371
371
|
for (var _ in e)
|
|
372
372
|
if (y(e, _)) {
|
|
373
|
-
var
|
|
373
|
+
var R = void 0;
|
|
374
374
|
try {
|
|
375
375
|
if (typeof e[_] != "function") {
|
|
376
|
-
var $ = Error((
|
|
376
|
+
var $ = Error((l || "React class") + ": " + n + " type `" + _ + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[_] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
377
377
|
throw $.name = "Invariant Violation", $;
|
|
378
378
|
}
|
|
379
|
-
|
|
379
|
+
R = e[_](t, _, l, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
380
380
|
} catch (L) {
|
|
381
|
-
|
|
381
|
+
R = L;
|
|
382
382
|
}
|
|
383
|
-
|
|
383
|
+
R && !(R instanceof Error) && (xe(A), D("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", l || "React class", n, _, typeof R), xe(null)), R instanceof Error && !(R.message in He) && (He[R.message] = !0, xe(A), D("Failed %s type: %s", n, R.message), xe(null));
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
var It = Array.isArray;
|
|
388
|
-
function
|
|
388
|
+
function we(e) {
|
|
389
389
|
return It(e);
|
|
390
390
|
}
|
|
391
391
|
function yt(e) {
|
|
@@ -455,8 +455,8 @@ function tr() {
|
|
|
455
455
|
});
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
|
-
var
|
|
459
|
-
var
|
|
458
|
+
var jt = function(e, t, n, l, A, y, _) {
|
|
459
|
+
var R = {
|
|
460
460
|
// This tag allows us to uniquely identify this as a React Element
|
|
461
461
|
$$typeof: u,
|
|
462
462
|
// Built-in properties that belong on the element
|
|
@@ -467,27 +467,27 @@ function tr() {
|
|
|
467
467
|
// Record the component responsible for creating this element.
|
|
468
468
|
_owner: y
|
|
469
469
|
};
|
|
470
|
-
return
|
|
470
|
+
return R._store = {}, Object.defineProperty(R._store, "validated", {
|
|
471
471
|
configurable: !1,
|
|
472
472
|
enumerable: !1,
|
|
473
473
|
writable: !0,
|
|
474
474
|
value: !1
|
|
475
|
-
}), Object.defineProperty(
|
|
475
|
+
}), Object.defineProperty(R, "_self", {
|
|
476
476
|
configurable: !1,
|
|
477
477
|
enumerable: !1,
|
|
478
478
|
writable: !1,
|
|
479
|
-
value:
|
|
480
|
-
}), Object.defineProperty(
|
|
479
|
+
value: l
|
|
480
|
+
}), Object.defineProperty(R, "_source", {
|
|
481
481
|
configurable: !1,
|
|
482
482
|
enumerable: !1,
|
|
483
483
|
writable: !1,
|
|
484
484
|
value: A
|
|
485
|
-
}), Object.freeze && (Object.freeze(
|
|
485
|
+
}), Object.freeze && (Object.freeze(R.props), Object.freeze(R)), R;
|
|
486
486
|
};
|
|
487
|
-
function
|
|
487
|
+
function wt(e, t, n, l, A) {
|
|
488
488
|
{
|
|
489
|
-
var y, _ = {},
|
|
490
|
-
n !== void 0 && (qe(n),
|
|
489
|
+
var y, _ = {}, R = null, $ = null;
|
|
490
|
+
n !== void 0 && (qe(n), R = "" + n), bt(t) && (qe(t.key), R = "" + t.key), xt(t) && ($ = t.ref, Nt(t, A));
|
|
491
491
|
for (y in t)
|
|
492
492
|
he.call(t, y) && !Dt.hasOwnProperty(y) && (_[y] = t[y]);
|
|
493
493
|
if (e && e.defaultProps) {
|
|
@@ -495,14 +495,14 @@ function tr() {
|
|
|
495
495
|
for (y in L)
|
|
496
496
|
_[y] === void 0 && (_[y] = L[y]);
|
|
497
497
|
}
|
|
498
|
-
if (
|
|
499
|
-
var
|
|
500
|
-
|
|
498
|
+
if (R || $) {
|
|
499
|
+
var w = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
500
|
+
R && Lt(_, w), $ && Pt(_, w);
|
|
501
501
|
}
|
|
502
|
-
return
|
|
502
|
+
return jt(e, R, $, A, l, Ke.current, _);
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
var
|
|
505
|
+
var Me = V.ReactCurrentOwner, Ze = V.ReactDebugCurrentFrame;
|
|
506
506
|
function pe(e) {
|
|
507
507
|
if (e) {
|
|
508
508
|
var t = e._owner, n = De(e.type, e._source, t ? t.type : null);
|
|
@@ -517,8 +517,8 @@ function tr() {
|
|
|
517
517
|
}
|
|
518
518
|
function et() {
|
|
519
519
|
{
|
|
520
|
-
if (
|
|
521
|
-
var e = T(
|
|
520
|
+
if (Me.current) {
|
|
521
|
+
var e = T(Me.current.type);
|
|
522
522
|
if (e)
|
|
523
523
|
return `
|
|
524
524
|
|
|
@@ -527,7 +527,7 @@ Check the render method of \`` + e + "`.";
|
|
|
527
527
|
return "";
|
|
528
528
|
}
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function Mt(e) {
|
|
531
531
|
return "";
|
|
532
532
|
}
|
|
533
533
|
var tt = {};
|
|
@@ -552,18 +552,18 @@ Check the top-level render call using <` + n + ">.");
|
|
|
552
552
|
if (tt[n])
|
|
553
553
|
return;
|
|
554
554
|
tt[n] = !0;
|
|
555
|
-
var
|
|
556
|
-
e && e._owner && e._owner !==
|
|
555
|
+
var l = "";
|
|
556
|
+
e && e._owner && e._owner !== Me.current && (l = " It was passed a child from " + T(e._owner.type) + "."), pe(e), D('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, l), pe(null);
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
function at(e, t) {
|
|
560
560
|
{
|
|
561
561
|
if (typeof e != "object")
|
|
562
562
|
return;
|
|
563
|
-
if (
|
|
563
|
+
if (we(e))
|
|
564
564
|
for (var n = 0; n < e.length; n++) {
|
|
565
|
-
var
|
|
566
|
-
Ue(
|
|
565
|
+
var l = e[n];
|
|
566
|
+
Ue(l) && rt(l, t);
|
|
567
567
|
}
|
|
568
568
|
else if (Ue(e))
|
|
569
569
|
e._store && (e._store.validated = !0);
|
|
@@ -590,8 +590,8 @@ Check the top-level render call using <` + n + ">.");
|
|
|
590
590
|
else
|
|
591
591
|
return;
|
|
592
592
|
if (n) {
|
|
593
|
-
var
|
|
594
|
-
Ot(n, e.props, "prop",
|
|
593
|
+
var l = T(t);
|
|
594
|
+
Ot(n, e.props, "prop", l, e);
|
|
595
595
|
} else if (t.PropTypes !== void 0 && !Fe) {
|
|
596
596
|
Fe = !0;
|
|
597
597
|
var A = T(t);
|
|
@@ -603,9 +603,9 @@ Check the top-level render call using <` + n + ">.");
|
|
|
603
603
|
function Gt(e) {
|
|
604
604
|
{
|
|
605
605
|
for (var t = Object.keys(e.props), n = 0; n < t.length; n++) {
|
|
606
|
-
var
|
|
607
|
-
if (
|
|
608
|
-
pe(e), D("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",
|
|
606
|
+
var l = t[n];
|
|
607
|
+
if (l !== "children" && l !== "key") {
|
|
608
|
+
pe(e), D("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", l), pe(null);
|
|
609
609
|
break;
|
|
610
610
|
}
|
|
611
611
|
}
|
|
@@ -613,27 +613,27 @@ Check the top-level render call using <` + n + ">.");
|
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
var nt = {};
|
|
616
|
-
function ot(e, t, n,
|
|
616
|
+
function ot(e, t, n, l, A, y) {
|
|
617
617
|
{
|
|
618
|
-
var _ =
|
|
618
|
+
var _ = m(e);
|
|
619
619
|
if (!_) {
|
|
620
|
-
var
|
|
621
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
622
|
-
var $ =
|
|
623
|
-
$ ?
|
|
620
|
+
var R = "";
|
|
621
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (R += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
622
|
+
var $ = Mt();
|
|
623
|
+
$ ? R += $ : R += et();
|
|
624
624
|
var L;
|
|
625
|
-
e === null ? L = "null" :
|
|
625
|
+
e === null ? L = "null" : we(e) ? L = "array" : e !== void 0 && e.$$typeof === u ? (L = "<" + (T(e.type) || "Unknown") + " />", R = " Did you accidentally export a JSX literal instead of a component?") : L = typeof e, D("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", L, R);
|
|
626
626
|
}
|
|
627
|
-
var
|
|
628
|
-
if (
|
|
629
|
-
return
|
|
627
|
+
var w = wt(e, t, n, A, y);
|
|
628
|
+
if (w == null)
|
|
629
|
+
return w;
|
|
630
630
|
if (_) {
|
|
631
631
|
var z = t.children;
|
|
632
632
|
if (z !== void 0)
|
|
633
|
-
if (
|
|
634
|
-
if (
|
|
635
|
-
for (var
|
|
636
|
-
at(z[
|
|
633
|
+
if (l)
|
|
634
|
+
if (we(z)) {
|
|
635
|
+
for (var Re = 0; Re < z.length; Re++)
|
|
636
|
+
at(z[Re], e);
|
|
637
637
|
Object.freeze && Object.freeze(z);
|
|
638
638
|
} else
|
|
639
639
|
D("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
@@ -654,7 +654,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
654
654
|
<%s key={someKey} {...props} />`, Ge, Ee, Wt, Ee), nt[Ee + Ge] = !0;
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
|
-
return e === f ? Gt(
|
|
657
|
+
return e === f ? Gt(w) : Ut(w), w;
|
|
658
658
|
}
|
|
659
659
|
}
|
|
660
660
|
function kt(e, t, n) {
|
|
@@ -854,7 +854,7 @@ Qt.registerModules([gt, Zt]);
|
|
|
854
854
|
const Er = ({
|
|
855
855
|
rows: a,
|
|
856
856
|
totalRecords: u,
|
|
857
|
-
currentPage:
|
|
857
|
+
currentPage: c,
|
|
858
858
|
loading: f,
|
|
859
859
|
onPageChange: s,
|
|
860
860
|
columns: k,
|
|
@@ -915,8 +915,6 @@ const Er = ({
|
|
|
915
915
|
suppressMovableColumns: !0,
|
|
916
916
|
suppressMenuHide: !0,
|
|
917
917
|
onSortChanged: re,
|
|
918
|
-
multiSortKey: "ctrl",
|
|
919
|
-
alwaysMultiSort: !0,
|
|
920
918
|
defaultColDef: {
|
|
921
919
|
width: 170,
|
|
922
920
|
sortable: !0,
|
|
@@ -943,10 +941,10 @@ const Er = ({
|
|
|
943
941
|
}, Tr = ({
|
|
944
942
|
totalRecords: a,
|
|
945
943
|
currentPage: u,
|
|
946
|
-
pageSize:
|
|
944
|
+
pageSize: c,
|
|
947
945
|
onPageChange: f
|
|
948
946
|
}) => {
|
|
949
|
-
const s = Math.ceil(a /
|
|
947
|
+
const s = Math.ceil(a / c);
|
|
950
948
|
return /* @__PURE__ */ r.jsxs(N, { sx: { display: "flex", gap: 2, alignItems: "center" }, children: [
|
|
951
949
|
/* @__PURE__ */ r.jsx(
|
|
952
950
|
ne,
|
|
@@ -1053,7 +1051,7 @@ const Er = ({
|
|
|
1053
1051
|
ACTION_BUTTON_GAP: 1,
|
|
1054
1052
|
FORM_MARGIN_TOP: 3,
|
|
1055
1053
|
FORM_MARGIN_BOTTOM: 2
|
|
1056
|
-
}, Tt = [10, 20, 50, 100], pr = " *",
|
|
1054
|
+
}, Tt = [10, 20, 50, 100], pr = " *", Rr = "red", mr = "_display", Nr = {
|
|
1057
1055
|
ISO_DATE: "YYYY-MM-DD",
|
|
1058
1056
|
DISPLAY_DATE: "DD/MM/YYYY",
|
|
1059
1057
|
FILE_DATE: "YYYY-MM-DD"
|
|
@@ -1065,9 +1063,9 @@ const Er = ({
|
|
|
1065
1063
|
HEADERS: {
|
|
1066
1064
|
CONTENT_TYPE: "application/json"
|
|
1067
1065
|
}
|
|
1068
|
-
},
|
|
1066
|
+
}, jr = {
|
|
1069
1067
|
MASTER: "/master"
|
|
1070
|
-
},
|
|
1068
|
+
}, wr = {
|
|
1071
1069
|
// Entity endpoints
|
|
1072
1070
|
ENTITIES: "/master/entities",
|
|
1073
1071
|
ENTITY_METADATA: (a) => `/master/${a}/metadata`,
|
|
@@ -1077,7 +1075,7 @@ const Er = ({
|
|
|
1077
1075
|
// Export endpoints
|
|
1078
1076
|
EXPORT_CSV: (a) => `/master/${a}/export/csv`,
|
|
1079
1077
|
EXPORT_EXCEL: (a) => `/master/${a}/export/excel`
|
|
1080
|
-
},
|
|
1078
|
+
}, Mr = {
|
|
1081
1079
|
GET: "GET",
|
|
1082
1080
|
POST: "POST",
|
|
1083
1081
|
PUT: "PUT",
|
|
@@ -1097,7 +1095,7 @@ const Er = ({
|
|
|
1097
1095
|
JSON: "json",
|
|
1098
1096
|
BLOB: "blob",
|
|
1099
1097
|
TEXT: "text"
|
|
1100
|
-
},
|
|
1098
|
+
}, Rt = {
|
|
1101
1099
|
CSV: "text/csv;charset=utf-8;",
|
|
1102
1100
|
EXCEL: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1103
1101
|
JSON: "application/json"
|
|
@@ -1166,10 +1164,10 @@ const Er = ({
|
|
|
1166
1164
|
}, Hr = ({
|
|
1167
1165
|
apiClient: a,
|
|
1168
1166
|
apiEndpoints: u,
|
|
1169
|
-
onNavigateToNew:
|
|
1167
|
+
onNavigateToNew: c,
|
|
1170
1168
|
onNavigateToEdit: f
|
|
1171
1169
|
}) => {
|
|
1172
|
-
const s =
|
|
1170
|
+
const s = me(() => vt(a, u), [a, u]), [k, X] = M([]), [p, g] = M(null), [Y, S] = M([]), [I, C] = M({}), [W, te] = M([]), [de, q] = M([]), [V, D] = M(0), [P, re] = M(10), [F, G] = M(1), [ue, K] = M(!1), [oe, m] = M(!1), [E, i] = M({}), [T, j] = M([]), [h, J] = M(null), U = We(!0);
|
|
1173
1171
|
Ce(() => {
|
|
1174
1172
|
(async () => {
|
|
1175
1173
|
try {
|
|
@@ -1178,8 +1176,8 @@ const Er = ({
|
|
|
1178
1176
|
label: O.displayName || O.label
|
|
1179
1177
|
}));
|
|
1180
1178
|
X(x), x.length > 0 && g(x[0]);
|
|
1181
|
-
} catch (
|
|
1182
|
-
console.error(ie.FAILED_LOAD_ENTITIES,
|
|
1179
|
+
} catch (d) {
|
|
1180
|
+
console.error(ie.FAILED_LOAD_ENTITIES, d);
|
|
1183
1181
|
}
|
|
1184
1182
|
})();
|
|
1185
1183
|
}, []), Ce(() => {
|
|
@@ -1195,14 +1193,14 @@ const Er = ({
|
|
|
1195
1193
|
const O = {};
|
|
1196
1194
|
for (const b of v.parameterList || [])
|
|
1197
1195
|
b.options && Array.isArray(b.options) && (O[b.name] = b.options);
|
|
1198
|
-
i(O), q([]),
|
|
1199
|
-
} catch (
|
|
1200
|
-
console.error(ie.FAILED_LOAD_METADATA,
|
|
1196
|
+
i(O), q([]), m(!1);
|
|
1197
|
+
} catch (d) {
|
|
1198
|
+
console.error(ie.FAILED_LOAD_METADATA, d);
|
|
1201
1199
|
}
|
|
1202
1200
|
})();
|
|
1203
1201
|
}, [p]);
|
|
1204
|
-
const Q =
|
|
1205
|
-
const o = {},
|
|
1202
|
+
const Q = me(() => {
|
|
1203
|
+
const o = {}, d = [], v = [];
|
|
1206
1204
|
Y.forEach((O) => {
|
|
1207
1205
|
if (O.dataType === Ne.DATERANGE) {
|
|
1208
1206
|
const Z = I[`${O.name}${se.FROM}`], Se = I[`${O.name}${se.TO}`];
|
|
@@ -1210,7 +1208,7 @@ const Er = ({
|
|
|
1210
1208
|
return;
|
|
1211
1209
|
}
|
|
1212
1210
|
const b = I[O.name];
|
|
1213
|
-
b == null || b === "" || (O.options ? o[O.name] = b : (
|
|
1211
|
+
b == null || b === "" || (O.options ? o[O.name] = b : (d.push(O.name), v.push(String(b).trim())));
|
|
1214
1212
|
});
|
|
1215
1213
|
const x = {
|
|
1216
1214
|
page: F,
|
|
@@ -1218,14 +1216,14 @@ const Er = ({
|
|
|
1218
1216
|
};
|
|
1219
1217
|
return Object.keys(o).length > 0 && Object.entries(o).forEach(([O, b]) => {
|
|
1220
1218
|
x[`filters[${O}]`] = b;
|
|
1221
|
-
}),
|
|
1219
|
+
}), d.length > 0 && (x.search = v.join(","), x.searchBy = d.join(",")), T.length > 0 && (x.sortBy = T.map((O) => O.colId).join(","), x.sortOrder = T.map((O) => O.sort === "desc" ? pt.DESC : pt.ASC).join(",")), console.log("Query params:", x), x;
|
|
1222
1220
|
}, [Y, I, F, P, T]), fe = Ie(async () => {
|
|
1223
1221
|
if (!(!p || !U.current)) {
|
|
1224
1222
|
U.current = !1, K(!0);
|
|
1225
1223
|
try {
|
|
1226
1224
|
console.log("Fetching with params:", Q);
|
|
1227
|
-
const o = await s.getRecords(p.name, Q),
|
|
1228
|
-
q(
|
|
1225
|
+
const o = await s.getRecords(p.name, Q), d = o.data || [], v = o.total || 0;
|
|
1226
|
+
q(d), D(v);
|
|
1229
1227
|
} catch (o) {
|
|
1230
1228
|
console.error(ie.FAILED_FETCH_LIST, o), console.error("Full error:", o), q([]), D(0);
|
|
1231
1229
|
} finally {
|
|
@@ -1237,7 +1235,7 @@ const Er = ({
|
|
|
1237
1235
|
oe && (F > 1 || T.length > 0) && fe();
|
|
1238
1236
|
}, [F, P, T, oe, fe]);
|
|
1239
1237
|
const Te = () => {
|
|
1240
|
-
G(1),
|
|
1238
|
+
G(1), m(!0), setTimeout(() => {
|
|
1241
1239
|
U.current = !0, fe();
|
|
1242
1240
|
}, 0);
|
|
1243
1241
|
}, ae = (o) => {
|
|
@@ -1247,17 +1245,17 @@ const Er = ({
|
|
|
1247
1245
|
}, ve = async (o) => {
|
|
1248
1246
|
if (p)
|
|
1249
1247
|
try {
|
|
1250
|
-
const
|
|
1248
|
+
const d = o === "csv" ? await s.exportCSV(p.name, Q) : await s.exportExcel(p.name, Q), v = o === "csv" ? Rt.CSV : Rt.EXCEL, x = o === "csv" ? Et.CSV : Et.EXCEL, O = new Blob([d.data], { type: v }), b = URL.createObjectURL(O), Z = document.createElement("a");
|
|
1251
1249
|
Z.href = b, Z.download = `${p.name}_${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.${x}`, Z.style.visibility = "hidden", document.body.appendChild(Z), Z.click(), document.body.removeChild(Z), setTimeout(() => URL.revokeObjectURL(b), fr.URL_REVOKE);
|
|
1252
|
-
} catch (
|
|
1253
|
-
console.error(`Failed to export ${o.toUpperCase()}:`,
|
|
1250
|
+
} catch (d) {
|
|
1251
|
+
console.error(`Failed to export ${o.toUpperCase()}:`, d);
|
|
1254
1252
|
} finally {
|
|
1255
1253
|
ge();
|
|
1256
1254
|
}
|
|
1257
|
-
},
|
|
1258
|
-
const o = W.map((
|
|
1259
|
-
field:
|
|
1260
|
-
headerName:
|
|
1255
|
+
}, je = me(() => {
|
|
1256
|
+
const o = W.map((d) => ({
|
|
1257
|
+
field: d.name,
|
|
1258
|
+
headerName: d.label,
|
|
1261
1259
|
sortable: !0,
|
|
1262
1260
|
filter: !1,
|
|
1263
1261
|
flex: 1
|
|
@@ -1268,8 +1266,8 @@ const Er = ({
|
|
|
1268
1266
|
sortable: !1,
|
|
1269
1267
|
filter: !1,
|
|
1270
1268
|
width: 150,
|
|
1271
|
-
cellRenderer: (
|
|
1272
|
-
const v =
|
|
1269
|
+
cellRenderer: (d) => {
|
|
1270
|
+
const v = d.data;
|
|
1273
1271
|
return !v || !p ? null : /* @__PURE__ */ r.jsx(N, { sx: { display: "flex", gap: 1, py: 1 }, children: /* @__PURE__ */ r.jsx(
|
|
1274
1272
|
ne,
|
|
1275
1273
|
{
|
|
@@ -1294,7 +1292,7 @@ const Er = ({
|
|
|
1294
1292
|
options: k,
|
|
1295
1293
|
getOptionLabel: (o) => o.label,
|
|
1296
1294
|
value: p,
|
|
1297
|
-
onChange: (o,
|
|
1295
|
+
onChange: (o, d) => g(d),
|
|
1298
1296
|
renderInput: (o) => /* @__PURE__ */ r.jsx(ee, { ...o, size: "small", placeholder: ye.SELECT_ENTITY }),
|
|
1299
1297
|
className: "field-input"
|
|
1300
1298
|
}
|
|
@@ -1309,7 +1307,7 @@ const Er = ({
|
|
|
1309
1307
|
type: "date",
|
|
1310
1308
|
size: "small",
|
|
1311
1309
|
value: I[`${o.name}${se.FROM}`] || "",
|
|
1312
|
-
onChange: (
|
|
1310
|
+
onChange: (d) => C((v) => ({ ...v, [`${o.name}${se.FROM}`]: d.target.value })),
|
|
1313
1311
|
sx: { flex: 1 }
|
|
1314
1312
|
}
|
|
1315
1313
|
),
|
|
@@ -1320,7 +1318,7 @@ const Er = ({
|
|
|
1320
1318
|
size: "small",
|
|
1321
1319
|
label: Ye.TO,
|
|
1322
1320
|
value: I[`${o.name}${se.TO}`] || "",
|
|
1323
|
-
onChange: (
|
|
1321
|
+
onChange: (d) => C((v) => ({ ...v, [`${o.name}${se.TO}`]: d.target.value })),
|
|
1324
1322
|
sx: { flex: 1 }
|
|
1325
1323
|
}
|
|
1326
1324
|
)
|
|
@@ -1330,17 +1328,17 @@ const Er = ({
|
|
|
1330
1328
|
type: "date",
|
|
1331
1329
|
size: "small",
|
|
1332
1330
|
value: I[o.name] || "",
|
|
1333
|
-
onChange: (
|
|
1331
|
+
onChange: (d) => C((v) => ({ ...v, [o.name]: d.target.value })),
|
|
1334
1332
|
className: "field-input"
|
|
1335
1333
|
}
|
|
1336
1334
|
) : o.options ? /* @__PURE__ */ r.jsx(
|
|
1337
1335
|
Be,
|
|
1338
1336
|
{
|
|
1339
1337
|
options: E[o.name] || o.options,
|
|
1340
|
-
getOptionLabel: (
|
|
1341
|
-
value: E[o.name]?.find((
|
|
1342
|
-
onChange: (
|
|
1343
|
-
renderInput: (
|
|
1338
|
+
getOptionLabel: (d) => d.label || String(d.value),
|
|
1339
|
+
value: E[o.name]?.find((d) => d.value === I[o.name]) || null,
|
|
1340
|
+
onChange: (d, v) => C((x) => ({ ...x, [o.name]: v?.value || null })),
|
|
1341
|
+
renderInput: (d) => /* @__PURE__ */ r.jsx(ee, { ...d, size: "small", placeholder: ye.SELECT(o.label) }),
|
|
1344
1342
|
className: "field-input"
|
|
1345
1343
|
}
|
|
1346
1344
|
) : o.dataType === Ne.NUMBER ? /* @__PURE__ */ r.jsx(
|
|
@@ -1349,7 +1347,7 @@ const Er = ({
|
|
|
1349
1347
|
type: "number",
|
|
1350
1348
|
size: "small",
|
|
1351
1349
|
value: I[o.name] || "",
|
|
1352
|
-
onChange: (
|
|
1350
|
+
onChange: (d) => C((v) => ({ ...v, [o.name]: d.target.value })),
|
|
1353
1351
|
placeholder: ye.FILTER_BY(o.label),
|
|
1354
1352
|
className: "field-input"
|
|
1355
1353
|
}
|
|
@@ -1358,7 +1356,7 @@ const Er = ({
|
|
|
1358
1356
|
{
|
|
1359
1357
|
size: "small",
|
|
1360
1358
|
value: I[o.name] || "",
|
|
1361
|
-
onChange: (
|
|
1359
|
+
onChange: (d) => C((v) => ({ ...v, [o.name]: d.target.value })),
|
|
1362
1360
|
placeholder: ye.FILTER_BY(o.label),
|
|
1363
1361
|
className: "field-input"
|
|
1364
1362
|
}
|
|
@@ -1372,7 +1370,7 @@ const Er = ({
|
|
|
1372
1370
|
{
|
|
1373
1371
|
variant: "contained",
|
|
1374
1372
|
disabled: !p,
|
|
1375
|
-
onClick: () => p &&
|
|
1373
|
+
onClick: () => p && c?.(p.name),
|
|
1376
1374
|
children: le.ADD_NEW_RECORD
|
|
1377
1375
|
}
|
|
1378
1376
|
)
|
|
@@ -1406,7 +1404,7 @@ const Er = ({
|
|
|
1406
1404
|
Er,
|
|
1407
1405
|
{
|
|
1408
1406
|
rows: de,
|
|
1409
|
-
columns:
|
|
1407
|
+
columns: je,
|
|
1410
1408
|
totalRecords: V,
|
|
1411
1409
|
currentPage: F,
|
|
1412
1410
|
loading: ue,
|
|
@@ -1417,7 +1415,7 @@ const Er = ({
|
|
|
1417
1415
|
onPageSizeChange: (o) => {
|
|
1418
1416
|
re(o), G(1);
|
|
1419
1417
|
},
|
|
1420
|
-
setSort:
|
|
1418
|
+
setSort: j,
|
|
1421
1419
|
sortModel: T,
|
|
1422
1420
|
height: 500
|
|
1423
1421
|
},
|
|
@@ -1463,28 +1461,28 @@ const Er = ({
|
|
|
1463
1461
|
}, Xr = ({
|
|
1464
1462
|
apiClient: a,
|
|
1465
1463
|
apiEndpoints: u,
|
|
1466
|
-
entity:
|
|
1464
|
+
entity: c,
|
|
1467
1465
|
id: f,
|
|
1468
1466
|
mode: s,
|
|
1469
1467
|
onBack: k,
|
|
1470
1468
|
onSuccess: X
|
|
1471
1469
|
}) => {
|
|
1472
|
-
const p =
|
|
1473
|
-
const i = g[
|
|
1474
|
-
return i?.validation?.required && !T?.validation?.required ? -1 : !i?.validation?.required && T?.validation?.required ? 1 :
|
|
1470
|
+
const p = me(() => vt(a, u), [a, u]), [g, Y] = M({}), [S, I] = M({}), [C, W] = M(!1), [te, de] = M({}), [q, V] = M(!0), [D, P] = M(null), re = me(() => Object.keys(g), [g]), F = me(() => re.sort((m, E) => {
|
|
1471
|
+
const i = g[m], T = g[E];
|
|
1472
|
+
return i?.validation?.required && !T?.validation?.required ? -1 : !i?.validation?.required && T?.validation?.required ? 1 : m.localeCompare(E);
|
|
1475
1473
|
}), [re, g]);
|
|
1476
1474
|
Ce(() => {
|
|
1477
|
-
if (!
|
|
1478
|
-
let
|
|
1475
|
+
if (!c) return;
|
|
1476
|
+
let m = !0;
|
|
1479
1477
|
return (async () => {
|
|
1480
1478
|
V(!0), P(null);
|
|
1481
1479
|
try {
|
|
1482
|
-
const i = await p.getMetadata(
|
|
1483
|
-
if (!
|
|
1484
|
-
const
|
|
1485
|
-
Y(
|
|
1480
|
+
const i = await p.getMetadata(c);
|
|
1481
|
+
if (!m) return;
|
|
1482
|
+
const j = (i.data?.data || i.data || {}).formConfig || {};
|
|
1483
|
+
Y(j);
|
|
1486
1484
|
const h = {};
|
|
1487
|
-
for (const [J, U] of Object.entries(
|
|
1485
|
+
for (const [J, U] of Object.entries(j))
|
|
1488
1486
|
if (U.fieldType === $e.DROPDOWN)
|
|
1489
1487
|
if (U.optionType === "API" && U.option && typeof U.option == "string")
|
|
1490
1488
|
try {
|
|
@@ -1497,51 +1495,51 @@ const Er = ({
|
|
|
1497
1495
|
console.error(`Failed to load options for ${J}:`, Q), h[U.fieldName] = [];
|
|
1498
1496
|
}
|
|
1499
1497
|
else U.optionType === "Raw" && Array.isArray(U.option) && (h[U.fieldName] = U.option);
|
|
1500
|
-
|
|
1498
|
+
m && de(h);
|
|
1501
1499
|
} catch (i) {
|
|
1502
|
-
console.error(ie.FAILED_LOAD_METADATA, i),
|
|
1500
|
+
console.error(ie.FAILED_LOAD_METADATA, i), m && P(ie.FAILED_LOAD_FORM_CONFIG);
|
|
1503
1501
|
} finally {
|
|
1504
|
-
|
|
1502
|
+
m && V(!1);
|
|
1505
1503
|
}
|
|
1506
1504
|
})(), () => {
|
|
1507
|
-
|
|
1505
|
+
m = !1;
|
|
1508
1506
|
};
|
|
1509
|
-
}, [
|
|
1510
|
-
if (!
|
|
1507
|
+
}, [c, p, a]), Ce(() => {
|
|
1508
|
+
if (!c || !f || s === H.CREATE) {
|
|
1511
1509
|
I({});
|
|
1512
1510
|
return;
|
|
1513
1511
|
}
|
|
1514
|
-
let
|
|
1512
|
+
let m = !0;
|
|
1515
1513
|
return (async () => {
|
|
1516
1514
|
W(!0), P(null);
|
|
1517
1515
|
try {
|
|
1518
|
-
const i = await p.getRecord(
|
|
1519
|
-
if (!
|
|
1520
|
-
const T = i.data?.data || i.data || {},
|
|
1516
|
+
const i = await p.getRecord(c, f);
|
|
1517
|
+
if (!m) return;
|
|
1518
|
+
const T = i.data?.data || i.data || {}, j = {};
|
|
1521
1519
|
for (const [h, J] of Object.entries(T))
|
|
1522
|
-
h.endsWith(
|
|
1523
|
-
I(
|
|
1520
|
+
h.endsWith(mr) || (j[h] = J);
|
|
1521
|
+
I(j);
|
|
1524
1522
|
} catch (i) {
|
|
1525
|
-
console.error(ie.FAILED_LOAD_RECORD, i),
|
|
1523
|
+
console.error(ie.FAILED_LOAD_RECORD, i), m && P(ie.FAILED_LOAD_RECORD);
|
|
1526
1524
|
} finally {
|
|
1527
|
-
|
|
1525
|
+
m && W(!1);
|
|
1528
1526
|
}
|
|
1529
1527
|
})(), () => {
|
|
1530
|
-
|
|
1528
|
+
m = !1;
|
|
1531
1529
|
};
|
|
1532
|
-
}, [
|
|
1533
|
-
const G = Ie((
|
|
1534
|
-
I((i) => ({ ...i, [
|
|
1530
|
+
}, [c, f, s, p]);
|
|
1531
|
+
const G = Ie((m, E) => {
|
|
1532
|
+
I((i) => ({ ...i, [m]: E }));
|
|
1535
1533
|
}, []), ue = Ie(() => {
|
|
1536
|
-
const
|
|
1534
|
+
const m = [];
|
|
1537
1535
|
for (const [E, i] of Object.entries(g))
|
|
1538
|
-
i.validation?.required && !S[i.fieldName] &&
|
|
1539
|
-
return
|
|
1536
|
+
i.validation?.required && !S[i.fieldName] && m.push(ie.FIELD_REQUIRED(E)), i.validation?.min !== void 0 && S[i.fieldName] < i.validation.min && m.push(`${E} must be at least ${i.validation.min}`), i.validation?.max !== void 0 && S[i.fieldName] > i.validation.max && m.push(`${E} must be at most ${i.validation.max}`);
|
|
1537
|
+
return m;
|
|
1540
1538
|
}, [g, S]), K = Ie(async () => {
|
|
1541
|
-
if (!
|
|
1542
|
-
const
|
|
1543
|
-
if (
|
|
1544
|
-
P(
|
|
1539
|
+
if (!c) return;
|
|
1540
|
+
const m = ue();
|
|
1541
|
+
if (m.length > 0) {
|
|
1542
|
+
P(m.join(", "));
|
|
1545
1543
|
return;
|
|
1546
1544
|
}
|
|
1547
1545
|
W(!0), P(null);
|
|
@@ -1552,10 +1550,10 @@ const Er = ({
|
|
|
1552
1550
|
T && S[T] !== void 0 && S[T] !== "" && (E[T] = S[T]);
|
|
1553
1551
|
}
|
|
1554
1552
|
if (s === H.CREATE) {
|
|
1555
|
-
const i = await p.createRecord(
|
|
1553
|
+
const i = await p.createRecord(c, { data: E });
|
|
1556
1554
|
X?.(i);
|
|
1557
1555
|
} else if (f) {
|
|
1558
|
-
const i = await p.updateRecord(
|
|
1556
|
+
const i = await p.updateRecord(c, f, { data: E });
|
|
1559
1557
|
X?.(i);
|
|
1560
1558
|
}
|
|
1561
1559
|
k?.();
|
|
@@ -1566,14 +1564,14 @@ const Er = ({
|
|
|
1566
1564
|
} finally {
|
|
1567
1565
|
W(!1);
|
|
1568
1566
|
}
|
|
1569
|
-
}, [
|
|
1570
|
-
const E = g[
|
|
1567
|
+
}, [c, g, S, ue, s, f, p, k, X]), oe = Ie((m) => {
|
|
1568
|
+
const E = g[m], i = E?.fieldName;
|
|
1571
1569
|
if (!E || i === "id") return null;
|
|
1572
|
-
const T = S[i] ?? "",
|
|
1570
|
+
const T = S[i] ?? "", j = s === H.VIEW || C;
|
|
1573
1571
|
return /* @__PURE__ */ r.jsxs(N, { className: "form-field", children: [
|
|
1574
1572
|
/* @__PURE__ */ r.jsxs(_e, { variant: "body2", className: "field-label", children: [
|
|
1575
|
-
|
|
1576
|
-
E.validation?.required && s !== H.VIEW && /* @__PURE__ */ r.jsx("span", { style: { color:
|
|
1573
|
+
m,
|
|
1574
|
+
E.validation?.required && s !== H.VIEW && /* @__PURE__ */ r.jsx("span", { style: { color: Rr }, children: pr })
|
|
1577
1575
|
] }),
|
|
1578
1576
|
E.fieldType === $e.DROPDOWN ? /* @__PURE__ */ r.jsx(
|
|
1579
1577
|
Be,
|
|
@@ -1582,14 +1580,14 @@ const Er = ({
|
|
|
1582
1580
|
getOptionLabel: (h) => h.label || String(h.value),
|
|
1583
1581
|
value: te[i]?.find((h) => h.value === T) || null,
|
|
1584
1582
|
onChange: (h, J) => G(i, J?.value ?? null),
|
|
1585
|
-
disabled:
|
|
1583
|
+
disabled: j,
|
|
1586
1584
|
loading: q,
|
|
1587
1585
|
renderInput: (h) => /* @__PURE__ */ r.jsx(
|
|
1588
1586
|
ee,
|
|
1589
1587
|
{
|
|
1590
1588
|
...h,
|
|
1591
1589
|
size: "small",
|
|
1592
|
-
placeholder: ye.SELECT(
|
|
1590
|
+
placeholder: ye.SELECT(m),
|
|
1593
1591
|
error: E.validation?.required && !T && s !== H.VIEW
|
|
1594
1592
|
}
|
|
1595
1593
|
),
|
|
@@ -1602,7 +1600,7 @@ const Er = ({
|
|
|
1602
1600
|
size: "small",
|
|
1603
1601
|
value: T ? String(T).slice(0, 10) : "",
|
|
1604
1602
|
onChange: (h) => G(i, h.target.value),
|
|
1605
|
-
disabled:
|
|
1603
|
+
disabled: j,
|
|
1606
1604
|
error: E.validation?.required && !T && s !== H.VIEW,
|
|
1607
1605
|
className: "field-input",
|
|
1608
1606
|
InputLabelProps: { shrink: !0 }
|
|
@@ -1614,8 +1612,8 @@ const Er = ({
|
|
|
1614
1612
|
size: "small",
|
|
1615
1613
|
value: T,
|
|
1616
1614
|
onChange: (h) => G(i, h.target.value),
|
|
1617
|
-
disabled:
|
|
1618
|
-
placeholder:
|
|
1615
|
+
disabled: j,
|
|
1616
|
+
placeholder: m,
|
|
1619
1617
|
error: E.validation?.required && !T && s !== H.VIEW,
|
|
1620
1618
|
inputProps: {
|
|
1621
1619
|
max: E.validation?.max,
|
|
@@ -1630,8 +1628,8 @@ const Er = ({
|
|
|
1630
1628
|
size: "small",
|
|
1631
1629
|
value: T,
|
|
1632
1630
|
onChange: (h) => G(i, h.target.value),
|
|
1633
|
-
disabled:
|
|
1634
|
-
placeholder:
|
|
1631
|
+
disabled: j,
|
|
1632
|
+
placeholder: m,
|
|
1635
1633
|
error: E.validation?.required && !T && s !== H.VIEW,
|
|
1636
1634
|
inputProps: {
|
|
1637
1635
|
maxLength: E.validation?.max
|
|
@@ -1639,12 +1637,12 @@ const Er = ({
|
|
|
1639
1637
|
className: "field-input"
|
|
1640
1638
|
}
|
|
1641
1639
|
)
|
|
1642
|
-
] },
|
|
1640
|
+
] }, m);
|
|
1643
1641
|
}, [g, S, te, G, s, C, q]);
|
|
1644
1642
|
return q ? /* @__PURE__ */ r.jsx(N, { className: "loading-container", display: "flex", justifyContent: "center", alignItems: "center", minHeight: "400px", children: /* @__PURE__ */ r.jsx(Le, {}) }) : /* @__PURE__ */ r.jsx(N, { className: "master-form", children: /* @__PURE__ */ r.jsxs(_t, { className: "form-section", children: [
|
|
1645
1643
|
/* @__PURE__ */ r.jsxs(_e, { variant: "h5", gutterBottom: !0, children: [
|
|
1646
1644
|
s === H.CREATE ? Pe.ADD_NEW_RECORD : s === H.EDIT ? Pe.EDIT_RECORD : Pe.VIEW_RECORD,
|
|
1647
|
-
|
|
1645
|
+
c && ` - ${c.charAt(0).toUpperCase() + c.slice(1)}`
|
|
1648
1646
|
] }),
|
|
1649
1647
|
D && /* @__PURE__ */ r.jsx(Kt, { severity: "error", onClose: () => P(null), sx: { mb: 2 }, children: D }),
|
|
1650
1648
|
C && s !== H.VIEW && /* @__PURE__ */ r.jsx(N, { display: "flex", justifyContent: "center", my: 2, children: /* @__PURE__ */ r.jsx(Le, { size: 24 }) }),
|
|
@@ -1694,9 +1692,9 @@ const Er = ({
|
|
|
1694
1692
|
EDIT: "/edit"
|
|
1695
1693
|
};
|
|
1696
1694
|
export {
|
|
1697
|
-
|
|
1695
|
+
jr as API_BASE_PATHS,
|
|
1698
1696
|
Pr as API_CONFIG,
|
|
1699
|
-
|
|
1697
|
+
wr as API_ENDPOINTS,
|
|
1700
1698
|
Lr as ARIA_LABELS,
|
|
1701
1699
|
le as BUTTON_LABELS,
|
|
1702
1700
|
Or as COLUMN_PROPERTIES,
|
|
@@ -1704,7 +1702,7 @@ export {
|
|
|
1704
1702
|
Ne as DATA_TYPES,
|
|
1705
1703
|
Nr as DATE_FORMATS,
|
|
1706
1704
|
se as DATE_RANGE_SUFFIXES,
|
|
1707
|
-
|
|
1705
|
+
mr as DISPLAY_FIELD_SUFFIX,
|
|
1708
1706
|
Cr as EMPTY_STATE_MESSAGES,
|
|
1709
1707
|
ie as ERROR_MESSAGES,
|
|
1710
1708
|
ft as EXPORT_OPTIONS,
|
|
@@ -1720,10 +1718,10 @@ export {
|
|
|
1720
1718
|
lr as GRID_SETTINGS,
|
|
1721
1719
|
Ve as GRID_TEXT,
|
|
1722
1720
|
fr as GRID_TIMEOUTS,
|
|
1723
|
-
|
|
1721
|
+
Mr as HTTP_METHODS,
|
|
1724
1722
|
$r as INPUT_TYPES,
|
|
1725
1723
|
Dr as LOADING_MESSAGES,
|
|
1726
|
-
|
|
1724
|
+
Rt as MIME_TYPES,
|
|
1727
1725
|
Xr as MasterForm,
|
|
1728
1726
|
Hr as MasterView,
|
|
1729
1727
|
Wr as NUMBER_INPUT,
|
|
@@ -1736,7 +1734,7 @@ export {
|
|
|
1736
1734
|
Fr as QUERY_PARAMS,
|
|
1737
1735
|
Br as REGEX_PATTERNS,
|
|
1738
1736
|
pr as REQUIRED_INDICATOR,
|
|
1739
|
-
|
|
1737
|
+
Rr as REQUIRED_INDICATOR_COLOR,
|
|
1740
1738
|
Gr as RESPONSE_KEYS,
|
|
1741
1739
|
Ur as RESPONSE_TYPES,
|
|
1742
1740
|
zr as ROUTES,
|