master-data-management-react 0.1.3 → 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/README.md +14 -0
- 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/hooks/useApiService.d.ts +2 -0
- package/dist/hooks/useApiService.d.ts.map +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +354 -350
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,81 +1,87 @@
|
|
|
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
|
-
const vt = (a,
|
|
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
|
|
12
|
+
getMetadata: async (c) => {
|
|
13
|
+
const f = await a.get(u.metadata(c));
|
|
14
14
|
return {
|
|
15
|
-
data:
|
|
15
|
+
data: f.data.data ?? f.data
|
|
16
16
|
};
|
|
17
17
|
},
|
|
18
|
-
getRecords: async (
|
|
19
|
-
const s = await a.get(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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 (
|
|
50
|
-
params:
|
|
49
|
+
exportCSV: async (c, f) => await a.get(u.exportCSV(c), {
|
|
50
|
+
params: f,
|
|
51
51
|
responseType: "blob"
|
|
52
52
|
}),
|
|
53
|
-
exportExcel: async (
|
|
54
|
-
params:
|
|
53
|
+
exportExcel: async (c, f) => await a.get(u.exportExcel(c), {
|
|
54
|
+
params: f,
|
|
55
55
|
responseType: "blob"
|
|
56
|
-
})
|
|
56
|
+
}),
|
|
57
|
+
getDropdownOptions: async (c) => {
|
|
58
|
+
const f = u.dropdownOptions ? u.dropdownOptions(c) : c, s = await a.get(f);
|
|
59
|
+
return {
|
|
60
|
+
data: s.data.data ?? s.data
|
|
61
|
+
};
|
|
62
|
+
}
|
|
57
63
|
});
|
|
58
64
|
var be = { exports: {} }, Ae = {};
|
|
59
65
|
var st;
|
|
60
66
|
function er() {
|
|
61
67
|
if (st) return Ae;
|
|
62
68
|
st = 1;
|
|
63
|
-
var a =
|
|
64
|
-
function
|
|
65
|
-
var S,
|
|
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
|
+
function X(p, g, Y) {
|
|
71
|
+
var S, I = {}, C = null, W = null;
|
|
66
72
|
Y !== void 0 && (C = "" + Y), g.key !== void 0 && (C = "" + g.key), g.ref !== void 0 && (W = g.ref);
|
|
67
|
-
for (S in g)
|
|
68
|
-
if (p && p.defaultProps) for (S in g = p.defaultProps, g)
|
|
69
|
-
return { $$typeof:
|
|
73
|
+
for (S in g) f.call(g, S) && !k.hasOwnProperty(S) && (I[S] = g[S]);
|
|
74
|
+
if (p && p.defaultProps) for (S in g = p.defaultProps, g) I[S] === void 0 && (I[S] = g[S]);
|
|
75
|
+
return { $$typeof: u, type: p, key: C, ref: W, props: I, _owner: s.current };
|
|
70
76
|
}
|
|
71
|
-
return Ae.Fragment =
|
|
77
|
+
return Ae.Fragment = c, Ae.jsx = X, Ae.jsxs = X, Ae;
|
|
72
78
|
}
|
|
73
|
-
var
|
|
79
|
+
var Oe = {};
|
|
74
80
|
var it;
|
|
75
81
|
function tr() {
|
|
76
82
|
return it || (it = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
77
|
-
var a =
|
|
78
|
-
function
|
|
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
|
+
function q(e) {
|
|
79
85
|
if (e === null || typeof e != "object")
|
|
80
86
|
return null;
|
|
81
87
|
var t = te && e[te] || e[de];
|
|
@@ -99,16 +105,16 @@ function tr() {
|
|
|
99
105
|
y.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, y);
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
|
-
var re = !1,
|
|
108
|
+
var re = !1, F = !1, G = !1, ue = !1, K = !1, oe;
|
|
103
109
|
oe = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
104
|
-
function
|
|
105
|
-
return !!(typeof e == "string" || typeof e == "function" || e ===
|
|
110
|
+
function m(e) {
|
|
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
|
|
106
112
|
// types supported by any Flight configuration anywhere since
|
|
107
113
|
// we don't know which Flight build this will end up being used
|
|
108
114
|
// with.
|
|
109
115
|
e.$$typeof === oe || e.getModuleId !== void 0));
|
|
110
116
|
}
|
|
111
|
-
function
|
|
117
|
+
function E(e, t, n) {
|
|
112
118
|
var l = e.displayName;
|
|
113
119
|
if (l)
|
|
114
120
|
return l;
|
|
@@ -126,9 +132,9 @@ function tr() {
|
|
|
126
132
|
if (typeof e == "string")
|
|
127
133
|
return e;
|
|
128
134
|
switch (e) {
|
|
129
|
-
case
|
|
135
|
+
case f:
|
|
130
136
|
return "Fragment";
|
|
131
|
-
case
|
|
137
|
+
case c:
|
|
132
138
|
return "Portal";
|
|
133
139
|
case k:
|
|
134
140
|
return "Profiler";
|
|
@@ -144,12 +150,12 @@ function tr() {
|
|
|
144
150
|
case p:
|
|
145
151
|
var t = e;
|
|
146
152
|
return i(t) + ".Consumer";
|
|
147
|
-
case
|
|
153
|
+
case X:
|
|
148
154
|
var n = e;
|
|
149
155
|
return i(n._context) + ".Provider";
|
|
150
156
|
case g:
|
|
151
|
-
return
|
|
152
|
-
case
|
|
157
|
+
return E(e, e.render, "ForwardRef");
|
|
158
|
+
case I:
|
|
153
159
|
var l = e.displayName || null;
|
|
154
160
|
return l !== null ? l : T(e.type) || "Memo";
|
|
155
161
|
case C: {
|
|
@@ -163,14 +169,14 @@ function tr() {
|
|
|
163
169
|
}
|
|
164
170
|
return null;
|
|
165
171
|
}
|
|
166
|
-
var
|
|
172
|
+
var j = Object.assign, h = 0, J, U, Q, fe, Te, ae, ge;
|
|
167
173
|
function ve() {
|
|
168
174
|
}
|
|
169
175
|
ve.__reactDisabledLog = !0;
|
|
170
|
-
function
|
|
176
|
+
function je() {
|
|
171
177
|
{
|
|
172
178
|
if (h === 0) {
|
|
173
|
-
|
|
179
|
+
J = console.log, U = console.info, Q = console.warn, fe = console.error, Te = console.group, ae = console.groupCollapsed, ge = console.groupEnd;
|
|
174
180
|
var e = {
|
|
175
181
|
configurable: !0,
|
|
176
182
|
enumerable: !0,
|
|
@@ -199,25 +205,25 @@ function tr() {
|
|
|
199
205
|
writable: !0
|
|
200
206
|
};
|
|
201
207
|
Object.defineProperties(console, {
|
|
202
|
-
log:
|
|
203
|
-
value:
|
|
208
|
+
log: j({}, e, {
|
|
209
|
+
value: J
|
|
204
210
|
}),
|
|
205
|
-
info:
|
|
211
|
+
info: j({}, e, {
|
|
206
212
|
value: U
|
|
207
213
|
}),
|
|
208
|
-
warn:
|
|
209
|
-
value:
|
|
214
|
+
warn: j({}, e, {
|
|
215
|
+
value: Q
|
|
210
216
|
}),
|
|
211
|
-
error:
|
|
217
|
+
error: j({}, e, {
|
|
212
218
|
value: fe
|
|
213
219
|
}),
|
|
214
|
-
group:
|
|
220
|
+
group: j({}, e, {
|
|
215
221
|
value: Te
|
|
216
222
|
}),
|
|
217
|
-
groupCollapsed:
|
|
223
|
+
groupCollapsed: j({}, e, {
|
|
218
224
|
value: ae
|
|
219
225
|
}),
|
|
220
|
-
groupEnd:
|
|
226
|
+
groupEnd: j({}, e, {
|
|
221
227
|
value: ge
|
|
222
228
|
})
|
|
223
229
|
});
|
|
@@ -225,7 +231,7 @@ function tr() {
|
|
|
225
231
|
h < 0 && D("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
226
232
|
}
|
|
227
233
|
}
|
|
228
|
-
var
|
|
234
|
+
var d = V.ReactCurrentDispatcher, v;
|
|
229
235
|
function x(e, t, n) {
|
|
230
236
|
{
|
|
231
237
|
if (v === void 0)
|
|
@@ -239,13 +245,13 @@ function tr() {
|
|
|
239
245
|
` + v + e;
|
|
240
246
|
}
|
|
241
247
|
}
|
|
242
|
-
var
|
|
248
|
+
var O = !1, b;
|
|
243
249
|
{
|
|
244
250
|
var Z = typeof WeakMap == "function" ? WeakMap : Map;
|
|
245
251
|
b = new Z();
|
|
246
252
|
}
|
|
247
253
|
function Se(e, t) {
|
|
248
|
-
if (!e ||
|
|
254
|
+
if (!e || O)
|
|
249
255
|
return "";
|
|
250
256
|
{
|
|
251
257
|
var n = b.get(e);
|
|
@@ -253,11 +259,11 @@ function tr() {
|
|
|
253
259
|
return n;
|
|
254
260
|
}
|
|
255
261
|
var l;
|
|
256
|
-
|
|
262
|
+
O = !0;
|
|
257
263
|
var A = Error.prepareStackTrace;
|
|
258
264
|
Error.prepareStackTrace = void 0;
|
|
259
265
|
var y;
|
|
260
|
-
y =
|
|
266
|
+
y = d.current, d.current = null, je();
|
|
261
267
|
try {
|
|
262
268
|
if (t) {
|
|
263
269
|
var _ = function() {
|
|
@@ -292,27 +298,27 @@ function tr() {
|
|
|
292
298
|
}
|
|
293
299
|
} catch (B) {
|
|
294
300
|
if (B && l && typeof B.stack == "string") {
|
|
295
|
-
for (var
|
|
301
|
+
for (var R = B.stack.split(`
|
|
296
302
|
`), $ = l.stack.split(`
|
|
297
|
-
`), L =
|
|
298
|
-
|
|
299
|
-
for (; L >= 1 &&
|
|
300
|
-
if (
|
|
301
|
-
if (L !== 1 ||
|
|
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)
|
|
302
308
|
do
|
|
303
|
-
if (L--,
|
|
304
|
-
var
|
|
305
|
-
` +
|
|
306
|
-
return e.displayName &&
|
|
309
|
+
if (L--, w--, w < 0 || R[L] !== $[w]) {
|
|
310
|
+
var z = `
|
|
311
|
+
` + R[L].replace(" at new ", " at ");
|
|
312
|
+
return e.displayName && z.includes("<anonymous>") && (z = z.replace("<anonymous>", e.displayName)), typeof e == "function" && b.set(e, z), z;
|
|
307
313
|
}
|
|
308
|
-
while (L >= 1 &&
|
|
314
|
+
while (L >= 1 && w >= 0);
|
|
309
315
|
break;
|
|
310
316
|
}
|
|
311
317
|
}
|
|
312
318
|
} finally {
|
|
313
|
-
|
|
319
|
+
O = !1, d.current = y, o(), Error.prepareStackTrace = A;
|
|
314
320
|
}
|
|
315
|
-
var
|
|
321
|
+
var Re = e ? e.displayName || e.name : "", Ee = Re ? x(Re) : "";
|
|
316
322
|
return typeof e == "function" && b.set(e, Ee), Ee;
|
|
317
323
|
}
|
|
318
324
|
function ht(e, t, n) {
|
|
@@ -339,7 +345,7 @@ function tr() {
|
|
|
339
345
|
switch (e.$$typeof) {
|
|
340
346
|
case g:
|
|
341
347
|
return ht(e.render);
|
|
342
|
-
case
|
|
348
|
+
case I:
|
|
343
349
|
return De(e.type, t, n);
|
|
344
350
|
case C: {
|
|
345
351
|
var l = e, A = l._payload, y = l._init;
|
|
@@ -359,28 +365,28 @@ function tr() {
|
|
|
359
365
|
} else
|
|
360
366
|
Xe.setExtraStackFrame(null);
|
|
361
367
|
}
|
|
362
|
-
function
|
|
368
|
+
function Ot(e, t, n, l, A) {
|
|
363
369
|
{
|
|
364
370
|
var y = Function.call.bind(he);
|
|
365
371
|
for (var _ in e)
|
|
366
372
|
if (y(e, _)) {
|
|
367
|
-
var
|
|
373
|
+
var R = void 0;
|
|
368
374
|
try {
|
|
369
375
|
if (typeof e[_] != "function") {
|
|
370
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`.");
|
|
371
377
|
throw $.name = "Invariant Violation", $;
|
|
372
378
|
}
|
|
373
|
-
|
|
379
|
+
R = e[_](t, _, l, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
374
380
|
} catch (L) {
|
|
375
|
-
|
|
381
|
+
R = L;
|
|
376
382
|
}
|
|
377
|
-
|
|
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));
|
|
378
384
|
}
|
|
379
385
|
}
|
|
380
386
|
}
|
|
381
|
-
var
|
|
382
|
-
function
|
|
383
|
-
return
|
|
387
|
+
var It = Array.isArray;
|
|
388
|
+
function we(e) {
|
|
389
|
+
return It(e);
|
|
384
390
|
}
|
|
385
391
|
function yt(e) {
|
|
386
392
|
{
|
|
@@ -449,10 +455,10 @@ function tr() {
|
|
|
449
455
|
});
|
|
450
456
|
}
|
|
451
457
|
}
|
|
452
|
-
var
|
|
453
|
-
var
|
|
458
|
+
var jt = function(e, t, n, l, A, y, _) {
|
|
459
|
+
var R = {
|
|
454
460
|
// This tag allows us to uniquely identify this as a React Element
|
|
455
|
-
$$typeof:
|
|
461
|
+
$$typeof: u,
|
|
456
462
|
// Built-in properties that belong on the element
|
|
457
463
|
type: e,
|
|
458
464
|
key: t,
|
|
@@ -461,27 +467,27 @@ function tr() {
|
|
|
461
467
|
// Record the component responsible for creating this element.
|
|
462
468
|
_owner: y
|
|
463
469
|
};
|
|
464
|
-
return
|
|
470
|
+
return R._store = {}, Object.defineProperty(R._store, "validated", {
|
|
465
471
|
configurable: !1,
|
|
466
472
|
enumerable: !1,
|
|
467
473
|
writable: !0,
|
|
468
474
|
value: !1
|
|
469
|
-
}), Object.defineProperty(
|
|
475
|
+
}), Object.defineProperty(R, "_self", {
|
|
470
476
|
configurable: !1,
|
|
471
477
|
enumerable: !1,
|
|
472
478
|
writable: !1,
|
|
473
479
|
value: l
|
|
474
|
-
}), Object.defineProperty(
|
|
480
|
+
}), Object.defineProperty(R, "_source", {
|
|
475
481
|
configurable: !1,
|
|
476
482
|
enumerable: !1,
|
|
477
483
|
writable: !1,
|
|
478
484
|
value: A
|
|
479
|
-
}), Object.freeze && (Object.freeze(
|
|
485
|
+
}), Object.freeze && (Object.freeze(R.props), Object.freeze(R)), R;
|
|
480
486
|
};
|
|
481
|
-
function
|
|
487
|
+
function wt(e, t, n, l, A) {
|
|
482
488
|
{
|
|
483
|
-
var y, _ = {},
|
|
484
|
-
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));
|
|
485
491
|
for (y in t)
|
|
486
492
|
he.call(t, y) && !Dt.hasOwnProperty(y) && (_[y] = t[y]);
|
|
487
493
|
if (e && e.defaultProps) {
|
|
@@ -489,14 +495,14 @@ function tr() {
|
|
|
489
495
|
for (y in L)
|
|
490
496
|
_[y] === void 0 && (_[y] = L[y]);
|
|
491
497
|
}
|
|
492
|
-
if (
|
|
493
|
-
var
|
|
494
|
-
|
|
498
|
+
if (R || $) {
|
|
499
|
+
var w = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
500
|
+
R && Lt(_, w), $ && Pt(_, w);
|
|
495
501
|
}
|
|
496
|
-
return
|
|
502
|
+
return jt(e, R, $, A, l, Ke.current, _);
|
|
497
503
|
}
|
|
498
504
|
}
|
|
499
|
-
var
|
|
505
|
+
var Me = V.ReactCurrentOwner, Ze = V.ReactDebugCurrentFrame;
|
|
500
506
|
function pe(e) {
|
|
501
507
|
if (e) {
|
|
502
508
|
var t = e._owner, n = De(e.type, e._source, t ? t.type : null);
|
|
@@ -504,15 +510,15 @@ function tr() {
|
|
|
504
510
|
} else
|
|
505
511
|
Ze.setExtraStackFrame(null);
|
|
506
512
|
}
|
|
507
|
-
var
|
|
508
|
-
|
|
513
|
+
var Fe;
|
|
514
|
+
Fe = !1;
|
|
509
515
|
function Ue(e) {
|
|
510
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
516
|
+
return typeof e == "object" && e !== null && e.$$typeof === u;
|
|
511
517
|
}
|
|
512
518
|
function et() {
|
|
513
519
|
{
|
|
514
|
-
if (
|
|
515
|
-
var e = T(
|
|
520
|
+
if (Me.current) {
|
|
521
|
+
var e = T(Me.current.type);
|
|
516
522
|
if (e)
|
|
517
523
|
return `
|
|
518
524
|
|
|
@@ -521,11 +527,11 @@ Check the render method of \`` + e + "`.";
|
|
|
521
527
|
return "";
|
|
522
528
|
}
|
|
523
529
|
}
|
|
524
|
-
function
|
|
530
|
+
function Mt(e) {
|
|
525
531
|
return "";
|
|
526
532
|
}
|
|
527
533
|
var tt = {};
|
|
528
|
-
function
|
|
534
|
+
function Ft(e) {
|
|
529
535
|
{
|
|
530
536
|
var t = et();
|
|
531
537
|
if (!t) {
|
|
@@ -542,19 +548,19 @@ Check the top-level render call using <` + n + ">.");
|
|
|
542
548
|
if (!e._store || e._store.validated || e.key != null)
|
|
543
549
|
return;
|
|
544
550
|
e._store.validated = !0;
|
|
545
|
-
var n =
|
|
551
|
+
var n = Ft(t);
|
|
546
552
|
if (tt[n])
|
|
547
553
|
return;
|
|
548
554
|
tt[n] = !0;
|
|
549
555
|
var l = "";
|
|
550
|
-
e && e._owner && e._owner !==
|
|
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);
|
|
551
557
|
}
|
|
552
558
|
}
|
|
553
559
|
function at(e, t) {
|
|
554
560
|
{
|
|
555
561
|
if (typeof e != "object")
|
|
556
562
|
return;
|
|
557
|
-
if (
|
|
563
|
+
if (we(e))
|
|
558
564
|
for (var n = 0; n < e.length; n++) {
|
|
559
565
|
var l = e[n];
|
|
560
566
|
Ue(l) && rt(l, t);
|
|
@@ -562,7 +568,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
562
568
|
else if (Ue(e))
|
|
563
569
|
e._store && (e._store.validated = !0);
|
|
564
570
|
else if (e) {
|
|
565
|
-
var A =
|
|
571
|
+
var A = q(e);
|
|
566
572
|
if (typeof A == "function" && A !== e.entries)
|
|
567
573
|
for (var y = A.call(e), _; !(_ = y.next()).done; )
|
|
568
574
|
Ue(_.value) && rt(_.value, t);
|
|
@@ -579,15 +585,15 @@ Check the top-level render call using <` + n + ">.");
|
|
|
579
585
|
n = t.propTypes;
|
|
580
586
|
else if (typeof t == "object" && (t.$$typeof === g || // Note: Memo only checks outer props here.
|
|
581
587
|
// Inner props are checked in the reconciler.
|
|
582
|
-
t.$$typeof ===
|
|
588
|
+
t.$$typeof === I))
|
|
583
589
|
n = t.propTypes;
|
|
584
590
|
else
|
|
585
591
|
return;
|
|
586
592
|
if (n) {
|
|
587
593
|
var l = T(t);
|
|
588
|
-
|
|
589
|
-
} else if (t.PropTypes !== void 0 && !
|
|
590
|
-
|
|
594
|
+
Ot(n, e.props, "prop", l, e);
|
|
595
|
+
} else if (t.PropTypes !== void 0 && !Fe) {
|
|
596
|
+
Fe = !0;
|
|
591
597
|
var A = T(t);
|
|
592
598
|
D("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", A || "Unknown");
|
|
593
599
|
}
|
|
@@ -609,30 +615,30 @@ Check the top-level render call using <` + n + ">.");
|
|
|
609
615
|
var nt = {};
|
|
610
616
|
function ot(e, t, n, l, A, y) {
|
|
611
617
|
{
|
|
612
|
-
var _ =
|
|
618
|
+
var _ = m(e);
|
|
613
619
|
if (!_) {
|
|
614
|
-
var
|
|
615
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
616
|
-
var $ =
|
|
617
|
-
$ ?
|
|
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();
|
|
618
624
|
var L;
|
|
619
|
-
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);
|
|
620
626
|
}
|
|
621
|
-
var
|
|
622
|
-
if (
|
|
623
|
-
return
|
|
627
|
+
var w = wt(e, t, n, A, y);
|
|
628
|
+
if (w == null)
|
|
629
|
+
return w;
|
|
624
630
|
if (_) {
|
|
625
|
-
var
|
|
626
|
-
if (
|
|
631
|
+
var z = t.children;
|
|
632
|
+
if (z !== void 0)
|
|
627
633
|
if (l)
|
|
628
|
-
if (
|
|
629
|
-
for (var
|
|
630
|
-
at(
|
|
631
|
-
Object.freeze && Object.freeze(
|
|
634
|
+
if (we(z)) {
|
|
635
|
+
for (var Re = 0; Re < z.length; Re++)
|
|
636
|
+
at(z[Re], e);
|
|
637
|
+
Object.freeze && Object.freeze(z);
|
|
632
638
|
} else
|
|
633
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.");
|
|
634
640
|
else
|
|
635
|
-
at(
|
|
641
|
+
at(z, e);
|
|
636
642
|
}
|
|
637
643
|
if (he.call(t, "key")) {
|
|
638
644
|
var Ee = T(e), B = Object.keys(t).filter(function(Bt) {
|
|
@@ -648,7 +654,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
648
654
|
<%s key={someKey} {...props} />`, Ge, Ee, Wt, Ee), nt[Ee + Ge] = !0;
|
|
649
655
|
}
|
|
650
656
|
}
|
|
651
|
-
return e ===
|
|
657
|
+
return e === f ? Gt(w) : Ut(w), w;
|
|
652
658
|
}
|
|
653
659
|
}
|
|
654
660
|
function kt(e, t, n) {
|
|
@@ -658,8 +664,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
658
664
|
return ot(e, t, n, !1);
|
|
659
665
|
}
|
|
660
666
|
var Vt = Yt, $t = kt;
|
|
661
|
-
|
|
662
|
-
})()),
|
|
667
|
+
Oe.Fragment = f, Oe.jsx = Vt, Oe.jsxs = $t;
|
|
668
|
+
})()), Oe;
|
|
663
669
|
}
|
|
664
670
|
var lt;
|
|
665
671
|
function rr() {
|
|
@@ -827,7 +833,7 @@ const nr = ce(N)(({ theme: a }) => ({
|
|
|
827
833
|
SERVER_SIDE: "serverSide",
|
|
828
834
|
INFINITE: "infinite",
|
|
829
835
|
VIEWPORT: "viewport"
|
|
830
|
-
},
|
|
836
|
+
}, Or = {
|
|
831
837
|
DEFAULT_FLEX: 1,
|
|
832
838
|
ACTION_COLUMN_WIDTH: 150,
|
|
833
839
|
SORTABLE: !0,
|
|
@@ -847,40 +853,40 @@ const nr = ce(N)(({ theme: a }) => ({
|
|
|
847
853
|
Qt.registerModules([gt, Zt]);
|
|
848
854
|
const Er = ({
|
|
849
855
|
rows: a,
|
|
850
|
-
totalRecords:
|
|
851
|
-
currentPage:
|
|
852
|
-
loading:
|
|
856
|
+
totalRecords: u,
|
|
857
|
+
currentPage: c,
|
|
858
|
+
loading: f,
|
|
853
859
|
onPageChange: s,
|
|
854
860
|
columns: k,
|
|
855
|
-
pageSize:
|
|
861
|
+
pageSize: X,
|
|
856
862
|
pageSizeOptions: p,
|
|
857
863
|
onPageSizeChange: g,
|
|
858
864
|
setSort: Y,
|
|
859
865
|
sortModel: S,
|
|
860
|
-
height:
|
|
866
|
+
height: I = lr.DEFAULT_HEIGHT,
|
|
861
867
|
domLayout: C = ut.NORMAL,
|
|
862
868
|
getRowHeight: W,
|
|
863
869
|
pinnedBottomRowData: te,
|
|
864
870
|
showLoader: de = !0,
|
|
865
|
-
emptyDataMessage:
|
|
871
|
+
emptyDataMessage: q,
|
|
866
872
|
...V
|
|
867
873
|
}) => {
|
|
868
|
-
const D = We(null), P = We([]), re = (
|
|
869
|
-
if (
|
|
870
|
-
const G =
|
|
871
|
-
colId:
|
|
872
|
-
sort:
|
|
874
|
+
const D = We(null), P = We([]), re = (F) => {
|
|
875
|
+
if (F.source !== cr.UI_COLUMN_SORTED || (console.log("Sort Changed Event (User Initiated):", F), !Y)) return;
|
|
876
|
+
const G = F.api.getColumnState().filter((K) => K.sort).map((K) => ({
|
|
877
|
+
colId: K.colId,
|
|
878
|
+
sort: K.sort
|
|
873
879
|
}));
|
|
874
880
|
console.log("New Sort Model:", G), JSON.stringify(G) !== JSON.stringify(P.current) && (P.current = G, Y(G));
|
|
875
881
|
};
|
|
876
|
-
return de &&
|
|
882
|
+
return de && f ? /* @__PURE__ */ r.jsx(
|
|
877
883
|
ct,
|
|
878
884
|
{
|
|
879
885
|
style: {
|
|
880
886
|
display: "flex",
|
|
881
887
|
alignItems: "center",
|
|
882
888
|
justifyContent: "center",
|
|
883
|
-
height:
|
|
889
|
+
height: I,
|
|
884
890
|
minHeight: 120
|
|
885
891
|
},
|
|
886
892
|
children: /* @__PURE__ */ r.jsx(Le, {})
|
|
@@ -889,7 +895,7 @@ const Er = ({
|
|
|
889
895
|
/* @__PURE__ */ r.jsx(
|
|
890
896
|
sr,
|
|
891
897
|
{
|
|
892
|
-
height: C === ut.AUTO_HEIGHT ? void 0 :
|
|
898
|
+
height: C === ut.AUTO_HEIGHT ? void 0 : I,
|
|
893
899
|
children: /* @__PURE__ */ r.jsx(
|
|
894
900
|
Jt,
|
|
895
901
|
{
|
|
@@ -902,29 +908,27 @@ const Er = ({
|
|
|
902
908
|
rowModelType: St.CLIENT_SIDE,
|
|
903
909
|
modules: [gt],
|
|
904
910
|
localeText: {
|
|
905
|
-
noRowsToShow:
|
|
911
|
+
noRowsToShow: q || "No data to show"
|
|
906
912
|
},
|
|
907
913
|
...V,
|
|
908
914
|
enableBrowserTooltips: !0,
|
|
909
915
|
suppressMovableColumns: !0,
|
|
910
916
|
suppressMenuHide: !0,
|
|
911
917
|
onSortChanged: re,
|
|
912
|
-
multiSortKey: "ctrl",
|
|
913
|
-
alwaysMultiSort: !0,
|
|
914
918
|
defaultColDef: {
|
|
915
919
|
width: 170,
|
|
916
920
|
sortable: !0,
|
|
917
921
|
unSortIcon: !0,
|
|
918
|
-
tooltipValueGetter: (
|
|
922
|
+
tooltipValueGetter: (F) => F.value ?? dr.NO_DATA
|
|
919
923
|
},
|
|
920
924
|
suppressRowTransform: !0,
|
|
921
925
|
getRowHeight: W ?? (() => 54),
|
|
922
926
|
maintainColumnOrder: !0,
|
|
923
927
|
initialState: S && S.length > 0 ? {
|
|
924
928
|
sort: {
|
|
925
|
-
sortModel: S.map((
|
|
926
|
-
colId:
|
|
927
|
-
sort:
|
|
929
|
+
sortModel: S.map((F) => ({
|
|
930
|
+
colId: F.colId,
|
|
931
|
+
sort: F.sort
|
|
928
932
|
}))
|
|
929
933
|
}
|
|
930
934
|
} : void 0
|
|
@@ -932,28 +936,28 @@ const Er = ({
|
|
|
932
936
|
)
|
|
933
937
|
}
|
|
934
938
|
),
|
|
935
|
-
|
|
939
|
+
u === 0 && /* @__PURE__ */ r.jsx(zt, {})
|
|
936
940
|
] }) });
|
|
937
941
|
}, Tr = ({
|
|
938
942
|
totalRecords: a,
|
|
939
|
-
currentPage:
|
|
940
|
-
pageSize:
|
|
941
|
-
onPageChange:
|
|
943
|
+
currentPage: u,
|
|
944
|
+
pageSize: c,
|
|
945
|
+
onPageChange: f
|
|
942
946
|
}) => {
|
|
943
|
-
const s = Math.ceil(a /
|
|
947
|
+
const s = Math.ceil(a / c);
|
|
944
948
|
return /* @__PURE__ */ r.jsxs(N, { sx: { display: "flex", gap: 2, alignItems: "center" }, children: [
|
|
945
949
|
/* @__PURE__ */ r.jsx(
|
|
946
950
|
ne,
|
|
947
951
|
{
|
|
948
952
|
size: "small",
|
|
949
|
-
disabled:
|
|
950
|
-
onClick: () =>
|
|
953
|
+
disabled: u === 1,
|
|
954
|
+
onClick: () => f(u - 1),
|
|
951
955
|
children: "Previous"
|
|
952
956
|
}
|
|
953
957
|
),
|
|
954
958
|
/* @__PURE__ */ r.jsxs(_e, { variant: "body2", children: [
|
|
955
959
|
"Page ",
|
|
956
|
-
|
|
960
|
+
u,
|
|
957
961
|
" of ",
|
|
958
962
|
s || 1
|
|
959
963
|
] }),
|
|
@@ -961,8 +965,8 @@ const Er = ({
|
|
|
961
965
|
ne,
|
|
962
966
|
{
|
|
963
967
|
size: "small",
|
|
964
|
-
disabled:
|
|
965
|
-
onClick: () =>
|
|
968
|
+
disabled: u >= s,
|
|
969
|
+
onClick: () => f(u + 1),
|
|
966
970
|
children: "Next"
|
|
967
971
|
}
|
|
968
972
|
)
|
|
@@ -1007,9 +1011,9 @@ const Er = ({
|
|
|
1007
1011
|
FAILED_LOAD_OPTIONS: (a) => `Failed to load options for ${a}`,
|
|
1008
1012
|
FAILED_LOAD_FORM_CONFIG: "Failed to load form configuration",
|
|
1009
1013
|
FIELD_REQUIRED: (a) => `${a} is required`,
|
|
1010
|
-
FIELD_MIN_VALUE: (a,
|
|
1011
|
-
FIELD_MAX_VALUE: (a,
|
|
1012
|
-
},
|
|
1014
|
+
FIELD_MIN_VALUE: (a, u) => `${a} must be at least ${u}`,
|
|
1015
|
+
FIELD_MAX_VALUE: (a, u) => `${a} must be at most ${u}`
|
|
1016
|
+
}, Ir = {
|
|
1013
1017
|
RECORD_CREATED: "Record created successfully",
|
|
1014
1018
|
RECORD_UPDATED: "Record updated successfully",
|
|
1015
1019
|
RECORD_DELETED: "Record deleted successfully"
|
|
@@ -1047,7 +1051,7 @@ const Er = ({
|
|
|
1047
1051
|
ACTION_BUTTON_GAP: 1,
|
|
1048
1052
|
FORM_MARGIN_TOP: 3,
|
|
1049
1053
|
FORM_MARGIN_BOTTOM: 2
|
|
1050
|
-
}, Tt = [10, 20, 50, 100], pr = " *",
|
|
1054
|
+
}, Tt = [10, 20, 50, 100], pr = " *", Rr = "red", mr = "_display", Nr = {
|
|
1051
1055
|
ISO_DATE: "YYYY-MM-DD",
|
|
1052
1056
|
DISPLAY_DATE: "DD/MM/YYYY",
|
|
1053
1057
|
FILE_DATE: "YYYY-MM-DD"
|
|
@@ -1059,25 +1063,25 @@ const Er = ({
|
|
|
1059
1063
|
HEADERS: {
|
|
1060
1064
|
CONTENT_TYPE: "application/json"
|
|
1061
1065
|
}
|
|
1062
|
-
}, Mr = {
|
|
1063
|
-
MASTER: "/master"
|
|
1064
1066
|
}, jr = {
|
|
1067
|
+
MASTER: "/master"
|
|
1068
|
+
}, wr = {
|
|
1065
1069
|
// Entity endpoints
|
|
1066
1070
|
ENTITIES: "/master/entities",
|
|
1067
1071
|
ENTITY_METADATA: (a) => `/master/${a}/metadata`,
|
|
1068
1072
|
ENTITY_RECORDS: (a) => `/master/${a}/records`,
|
|
1069
|
-
ENTITY_RECORD_BY_ID: (a,
|
|
1073
|
+
ENTITY_RECORD_BY_ID: (a, u) => `/master/${a}/records/${u}`,
|
|
1070
1074
|
ENTITY_OPTIONS: (a) => `/master/${a}/options`,
|
|
1071
1075
|
// Export endpoints
|
|
1072
1076
|
EXPORT_CSV: (a) => `/master/${a}/export/csv`,
|
|
1073
1077
|
EXPORT_EXCEL: (a) => `/master/${a}/export/excel`
|
|
1074
|
-
},
|
|
1078
|
+
}, Mr = {
|
|
1075
1079
|
GET: "GET",
|
|
1076
1080
|
POST: "POST",
|
|
1077
1081
|
PUT: "PUT",
|
|
1078
1082
|
DELETE: "DELETE",
|
|
1079
1083
|
PATCH: "PATCH"
|
|
1080
|
-
},
|
|
1084
|
+
}, Fr = {
|
|
1081
1085
|
PAGE: "page",
|
|
1082
1086
|
LIMIT: "limit",
|
|
1083
1087
|
SEARCH: "search",
|
|
@@ -1091,7 +1095,7 @@ const Er = ({
|
|
|
1091
1095
|
JSON: "json",
|
|
1092
1096
|
BLOB: "blob",
|
|
1093
1097
|
TEXT: "text"
|
|
1094
|
-
},
|
|
1098
|
+
}, Rt = {
|
|
1095
1099
|
CSV: "text/csv;charset=utf-8;",
|
|
1096
1100
|
EXCEL: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1097
1101
|
JSON: "application/json"
|
|
@@ -1100,7 +1104,7 @@ const Er = ({
|
|
|
1100
1104
|
COUNT: "count",
|
|
1101
1105
|
MESSAGE: "message",
|
|
1102
1106
|
ERROR: "error"
|
|
1103
|
-
},
|
|
1107
|
+
}, H = {
|
|
1104
1108
|
CREATE: "create",
|
|
1105
1109
|
EDIT: "edit",
|
|
1106
1110
|
VIEW: "view"
|
|
@@ -1159,21 +1163,21 @@ const Er = ({
|
|
|
1159
1163
|
ENTITY_MATCH: /\/master\/([^\/]+)\/options/
|
|
1160
1164
|
}, Hr = ({
|
|
1161
1165
|
apiClient: a,
|
|
1162
|
-
apiEndpoints:
|
|
1163
|
-
onNavigateToNew:
|
|
1164
|
-
onNavigateToEdit:
|
|
1166
|
+
apiEndpoints: u,
|
|
1167
|
+
onNavigateToNew: c,
|
|
1168
|
+
onNavigateToEdit: f
|
|
1165
1169
|
}) => {
|
|
1166
|
-
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);
|
|
1167
1171
|
Ce(() => {
|
|
1168
1172
|
(async () => {
|
|
1169
1173
|
try {
|
|
1170
|
-
const x = ((await s.getEntities()).data || []).map((
|
|
1171
|
-
name:
|
|
1172
|
-
label:
|
|
1174
|
+
const x = ((await s.getEntities()).data || []).map((O) => ({
|
|
1175
|
+
name: O.tableName || O.name,
|
|
1176
|
+
label: O.displayName || O.label
|
|
1173
1177
|
}));
|
|
1174
|
-
|
|
1175
|
-
} catch (
|
|
1176
|
-
console.error(ie.FAILED_LOAD_ENTITIES,
|
|
1178
|
+
X(x), x.length > 0 && g(x[0]);
|
|
1179
|
+
} catch (d) {
|
|
1180
|
+
console.error(ie.FAILED_LOAD_ENTITIES, d);
|
|
1177
1181
|
}
|
|
1178
1182
|
})();
|
|
1179
1183
|
}, []), Ce(() => {
|
|
@@ -1186,72 +1190,72 @@ const Er = ({
|
|
|
1186
1190
|
(v.parameterList || []).forEach((b) => {
|
|
1187
1191
|
x[b.name] = null;
|
|
1188
1192
|
}), C(x);
|
|
1189
|
-
const
|
|
1193
|
+
const O = {};
|
|
1190
1194
|
for (const b of v.parameterList || [])
|
|
1191
|
-
b.options && Array.isArray(b.options) && (
|
|
1192
|
-
i(
|
|
1193
|
-
} catch (
|
|
1194
|
-
console.error(ie.FAILED_LOAD_METADATA,
|
|
1195
|
+
b.options && Array.isArray(b.options) && (O[b.name] = b.options);
|
|
1196
|
+
i(O), q([]), m(!1);
|
|
1197
|
+
} catch (d) {
|
|
1198
|
+
console.error(ie.FAILED_LOAD_METADATA, d);
|
|
1195
1199
|
}
|
|
1196
1200
|
})();
|
|
1197
1201
|
}, [p]);
|
|
1198
|
-
const
|
|
1199
|
-
const o = {},
|
|
1200
|
-
Y.forEach((
|
|
1201
|
-
if (
|
|
1202
|
-
const Z =
|
|
1203
|
-
Z && (o[`${
|
|
1202
|
+
const Q = me(() => {
|
|
1203
|
+
const o = {}, d = [], v = [];
|
|
1204
|
+
Y.forEach((O) => {
|
|
1205
|
+
if (O.dataType === Ne.DATERANGE) {
|
|
1206
|
+
const Z = I[`${O.name}${se.FROM}`], Se = I[`${O.name}${se.TO}`];
|
|
1207
|
+
Z && (o[`${O.name}${se.FROM}`] = Z), Se && (o[`${O.name}${se.TO}`] = Se);
|
|
1204
1208
|
return;
|
|
1205
1209
|
}
|
|
1206
|
-
const b = O
|
|
1207
|
-
b == null || b === "" || (
|
|
1210
|
+
const b = I[O.name];
|
|
1211
|
+
b == null || b === "" || (O.options ? o[O.name] = b : (d.push(O.name), v.push(String(b).trim())));
|
|
1208
1212
|
});
|
|
1209
1213
|
const x = {
|
|
1210
|
-
page:
|
|
1214
|
+
page: F,
|
|
1211
1215
|
limit: P
|
|
1212
1216
|
};
|
|
1213
|
-
return Object.keys(o).length > 0 && Object.entries(o).forEach(([
|
|
1214
|
-
x[`filters[${
|
|
1215
|
-
}),
|
|
1216
|
-
}, [Y,
|
|
1217
|
+
return Object.keys(o).length > 0 && Object.entries(o).forEach(([O, b]) => {
|
|
1218
|
+
x[`filters[${O}]`] = b;
|
|
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;
|
|
1220
|
+
}, [Y, I, F, P, T]), fe = Ie(async () => {
|
|
1217
1221
|
if (!(!p || !U.current)) {
|
|
1218
|
-
U.current = !1,
|
|
1222
|
+
U.current = !1, K(!0);
|
|
1219
1223
|
try {
|
|
1220
|
-
console.log("Fetching with params:",
|
|
1221
|
-
const o = await s.getRecords(p.name,
|
|
1222
|
-
|
|
1224
|
+
console.log("Fetching with params:", Q);
|
|
1225
|
+
const o = await s.getRecords(p.name, Q), d = o.data || [], v = o.total || 0;
|
|
1226
|
+
q(d), D(v);
|
|
1223
1227
|
} catch (o) {
|
|
1224
|
-
console.error(ie.FAILED_FETCH_LIST, o), console.error("Full error:", o),
|
|
1228
|
+
console.error(ie.FAILED_FETCH_LIST, o), console.error("Full error:", o), q([]), D(0);
|
|
1225
1229
|
} finally {
|
|
1226
|
-
|
|
1230
|
+
K(!1), U.current = !0;
|
|
1227
1231
|
}
|
|
1228
1232
|
}
|
|
1229
|
-
}, [p,
|
|
1233
|
+
}, [p, Q]);
|
|
1230
1234
|
Ce(() => {
|
|
1231
|
-
oe && (
|
|
1232
|
-
}, [
|
|
1235
|
+
oe && (F > 1 || T.length > 0) && fe();
|
|
1236
|
+
}, [F, P, T, oe, fe]);
|
|
1233
1237
|
const Te = () => {
|
|
1234
|
-
G(1),
|
|
1238
|
+
G(1), m(!0), setTimeout(() => {
|
|
1235
1239
|
U.current = !0, fe();
|
|
1236
1240
|
}, 0);
|
|
1237
1241
|
}, ae = (o) => {
|
|
1238
|
-
|
|
1242
|
+
J(o.currentTarget);
|
|
1239
1243
|
}, ge = () => {
|
|
1240
|
-
|
|
1244
|
+
J(null);
|
|
1241
1245
|
}, ve = async (o) => {
|
|
1242
1246
|
if (p)
|
|
1243
1247
|
try {
|
|
1244
|
-
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");
|
|
1245
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);
|
|
1246
|
-
} catch (
|
|
1247
|
-
console.error(`Failed to export ${o.toUpperCase()}:`,
|
|
1250
|
+
} catch (d) {
|
|
1251
|
+
console.error(`Failed to export ${o.toUpperCase()}:`, d);
|
|
1248
1252
|
} finally {
|
|
1249
1253
|
ge();
|
|
1250
1254
|
}
|
|
1251
|
-
},
|
|
1252
|
-
const o = W.map((
|
|
1253
|
-
field:
|
|
1254
|
-
headerName:
|
|
1255
|
+
}, je = me(() => {
|
|
1256
|
+
const o = W.map((d) => ({
|
|
1257
|
+
field: d.name,
|
|
1258
|
+
headerName: d.label,
|
|
1255
1259
|
sortable: !0,
|
|
1256
1260
|
filter: !1,
|
|
1257
1261
|
flex: 1
|
|
@@ -1262,20 +1266,20 @@ const Er = ({
|
|
|
1262
1266
|
sortable: !1,
|
|
1263
1267
|
filter: !1,
|
|
1264
1268
|
width: 150,
|
|
1265
|
-
cellRenderer: (
|
|
1266
|
-
const v =
|
|
1269
|
+
cellRenderer: (d) => {
|
|
1270
|
+
const v = d.data;
|
|
1267
1271
|
return !v || !p ? null : /* @__PURE__ */ r.jsx(N, { sx: { display: "flex", gap: 1, py: 1 }, children: /* @__PURE__ */ r.jsx(
|
|
1268
1272
|
ne,
|
|
1269
1273
|
{
|
|
1270
1274
|
size: "small",
|
|
1271
1275
|
variant: "outlined",
|
|
1272
|
-
onClick: () =>
|
|
1276
|
+
onClick: () => f?.(p.name, v.id),
|
|
1273
1277
|
children: le.EDIT
|
|
1274
1278
|
}
|
|
1275
1279
|
) });
|
|
1276
1280
|
}
|
|
1277
1281
|
}), o;
|
|
1278
|
-
}, [W, p,
|
|
1282
|
+
}, [W, p, f]);
|
|
1279
1283
|
return /* @__PURE__ */ r.jsxs(N, { className: "master-view", children: [
|
|
1280
1284
|
/* @__PURE__ */ r.jsxs(_t, { className: "filter-section", children: [
|
|
1281
1285
|
/* @__PURE__ */ r.jsx(_e, { variant: "h5", gutterBottom: !0, children: Pe.MASTER_DATA_MANAGEMENT }),
|
|
@@ -1288,7 +1292,7 @@ const Er = ({
|
|
|
1288
1292
|
options: k,
|
|
1289
1293
|
getOptionLabel: (o) => o.label,
|
|
1290
1294
|
value: p,
|
|
1291
|
-
onChange: (o,
|
|
1295
|
+
onChange: (o, d) => g(d),
|
|
1292
1296
|
renderInput: (o) => /* @__PURE__ */ r.jsx(ee, { ...o, size: "small", placeholder: ye.SELECT_ENTITY }),
|
|
1293
1297
|
className: "field-input"
|
|
1294
1298
|
}
|
|
@@ -1302,8 +1306,8 @@ const Er = ({
|
|
|
1302
1306
|
{
|
|
1303
1307
|
type: "date",
|
|
1304
1308
|
size: "small",
|
|
1305
|
-
value:
|
|
1306
|
-
onChange: (
|
|
1309
|
+
value: I[`${o.name}${se.FROM}`] || "",
|
|
1310
|
+
onChange: (d) => C((v) => ({ ...v, [`${o.name}${se.FROM}`]: d.target.value })),
|
|
1307
1311
|
sx: { flex: 1 }
|
|
1308
1312
|
}
|
|
1309
1313
|
),
|
|
@@ -1313,8 +1317,8 @@ const Er = ({
|
|
|
1313
1317
|
type: "date",
|
|
1314
1318
|
size: "small",
|
|
1315
1319
|
label: Ye.TO,
|
|
1316
|
-
value:
|
|
1317
|
-
onChange: (
|
|
1320
|
+
value: I[`${o.name}${se.TO}`] || "",
|
|
1321
|
+
onChange: (d) => C((v) => ({ ...v, [`${o.name}${se.TO}`]: d.target.value })),
|
|
1318
1322
|
sx: { flex: 1 }
|
|
1319
1323
|
}
|
|
1320
1324
|
)
|
|
@@ -1323,18 +1327,18 @@ const Er = ({
|
|
|
1323
1327
|
{
|
|
1324
1328
|
type: "date",
|
|
1325
1329
|
size: "small",
|
|
1326
|
-
value:
|
|
1327
|
-
onChange: (
|
|
1330
|
+
value: I[o.name] || "",
|
|
1331
|
+
onChange: (d) => C((v) => ({ ...v, [o.name]: d.target.value })),
|
|
1328
1332
|
className: "field-input"
|
|
1329
1333
|
}
|
|
1330
1334
|
) : o.options ? /* @__PURE__ */ r.jsx(
|
|
1331
1335
|
Be,
|
|
1332
1336
|
{
|
|
1333
|
-
options:
|
|
1334
|
-
getOptionLabel: (
|
|
1335
|
-
value:
|
|
1336
|
-
onChange: (
|
|
1337
|
-
renderInput: (
|
|
1337
|
+
options: E[o.name] || o.options,
|
|
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) }),
|
|
1338
1342
|
className: "field-input"
|
|
1339
1343
|
}
|
|
1340
1344
|
) : o.dataType === Ne.NUMBER ? /* @__PURE__ */ r.jsx(
|
|
@@ -1342,8 +1346,8 @@ const Er = ({
|
|
|
1342
1346
|
{
|
|
1343
1347
|
type: "number",
|
|
1344
1348
|
size: "small",
|
|
1345
|
-
value:
|
|
1346
|
-
onChange: (
|
|
1349
|
+
value: I[o.name] || "",
|
|
1350
|
+
onChange: (d) => C((v) => ({ ...v, [o.name]: d.target.value })),
|
|
1347
1351
|
placeholder: ye.FILTER_BY(o.label),
|
|
1348
1352
|
className: "field-input"
|
|
1349
1353
|
}
|
|
@@ -1351,8 +1355,8 @@ const Er = ({
|
|
|
1351
1355
|
ee,
|
|
1352
1356
|
{
|
|
1353
1357
|
size: "small",
|
|
1354
|
-
value:
|
|
1355
|
-
onChange: (
|
|
1358
|
+
value: I[o.name] || "",
|
|
1359
|
+
onChange: (d) => C((v) => ({ ...v, [o.name]: d.target.value })),
|
|
1356
1360
|
placeholder: ye.FILTER_BY(o.label),
|
|
1357
1361
|
className: "field-input"
|
|
1358
1362
|
}
|
|
@@ -1366,7 +1370,7 @@ const Er = ({
|
|
|
1366
1370
|
{
|
|
1367
1371
|
variant: "contained",
|
|
1368
1372
|
disabled: !p,
|
|
1369
|
-
onClick: () => p &&
|
|
1373
|
+
onClick: () => p && c?.(p.name),
|
|
1370
1374
|
children: le.ADD_NEW_RECORD
|
|
1371
1375
|
}
|
|
1372
1376
|
)
|
|
@@ -1400,9 +1404,9 @@ const Er = ({
|
|
|
1400
1404
|
Er,
|
|
1401
1405
|
{
|
|
1402
1406
|
rows: de,
|
|
1403
|
-
columns:
|
|
1407
|
+
columns: je,
|
|
1404
1408
|
totalRecords: V,
|
|
1405
|
-
currentPage:
|
|
1409
|
+
currentPage: F,
|
|
1406
1410
|
loading: ue,
|
|
1407
1411
|
rowModelType: St.CLIENT_SIDE,
|
|
1408
1412
|
onPageChange: G,
|
|
@@ -1411,7 +1415,7 @@ const Er = ({
|
|
|
1411
1415
|
onPageSizeChange: (o) => {
|
|
1412
1416
|
re(o), G(1);
|
|
1413
1417
|
},
|
|
1414
|
-
setSort:
|
|
1418
|
+
setSort: j,
|
|
1415
1419
|
sortModel: T,
|
|
1416
1420
|
height: 500
|
|
1417
1421
|
},
|
|
@@ -1446,7 +1450,7 @@ const Er = ({
|
|
|
1446
1450
|
Tr,
|
|
1447
1451
|
{
|
|
1448
1452
|
totalRecords: V,
|
|
1449
|
-
currentPage:
|
|
1453
|
+
currentPage: F,
|
|
1450
1454
|
onPageChange: G,
|
|
1451
1455
|
pageSize: P
|
|
1452
1456
|
}
|
|
@@ -1456,165 +1460,165 @@ const Er = ({
|
|
|
1456
1460
|
] });
|
|
1457
1461
|
}, Xr = ({
|
|
1458
1462
|
apiClient: a,
|
|
1459
|
-
apiEndpoints:
|
|
1460
|
-
entity:
|
|
1461
|
-
id:
|
|
1463
|
+
apiEndpoints: u,
|
|
1464
|
+
entity: c,
|
|
1465
|
+
id: f,
|
|
1462
1466
|
mode: s,
|
|
1463
1467
|
onBack: k,
|
|
1464
|
-
onSuccess:
|
|
1468
|
+
onSuccess: X
|
|
1465
1469
|
}) => {
|
|
1466
|
-
const p =
|
|
1467
|
-
const i = g[
|
|
1468
|
-
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);
|
|
1469
1473
|
}), [re, g]);
|
|
1470
1474
|
Ce(() => {
|
|
1471
|
-
if (!
|
|
1472
|
-
let
|
|
1475
|
+
if (!c) return;
|
|
1476
|
+
let m = !0;
|
|
1473
1477
|
return (async () => {
|
|
1474
1478
|
V(!0), P(null);
|
|
1475
1479
|
try {
|
|
1476
|
-
const i = await p.getMetadata(
|
|
1477
|
-
if (!
|
|
1478
|
-
const
|
|
1479
|
-
Y(
|
|
1480
|
+
const i = await p.getMetadata(c);
|
|
1481
|
+
if (!m) return;
|
|
1482
|
+
const j = (i.data?.data || i.data || {}).formConfig || {};
|
|
1483
|
+
Y(j);
|
|
1480
1484
|
const h = {};
|
|
1481
|
-
for (const [
|
|
1485
|
+
for (const [J, U] of Object.entries(j))
|
|
1482
1486
|
if (U.fieldType === $e.DROPDOWN)
|
|
1483
1487
|
if (U.optionType === "API" && U.option && typeof U.option == "string")
|
|
1484
1488
|
try {
|
|
1485
|
-
const
|
|
1489
|
+
const Te = ((await p.getDropdownOptions(U.option)).data || []).map((ae) => ({
|
|
1486
1490
|
value: ae.id,
|
|
1487
1491
|
label: ae.name || ae.displayName || String(ae.id)
|
|
1488
1492
|
}));
|
|
1489
1493
|
h[U.fieldName] = Te;
|
|
1490
|
-
} catch (
|
|
1491
|
-
console.error(`Failed to load options for ${
|
|
1494
|
+
} catch (Q) {
|
|
1495
|
+
console.error(`Failed to load options for ${J}:`, Q), h[U.fieldName] = [];
|
|
1492
1496
|
}
|
|
1493
1497
|
else U.optionType === "Raw" && Array.isArray(U.option) && (h[U.fieldName] = U.option);
|
|
1494
|
-
|
|
1498
|
+
m && de(h);
|
|
1495
1499
|
} catch (i) {
|
|
1496
|
-
console.error(ie.FAILED_LOAD_METADATA, i),
|
|
1500
|
+
console.error(ie.FAILED_LOAD_METADATA, i), m && P(ie.FAILED_LOAD_FORM_CONFIG);
|
|
1497
1501
|
} finally {
|
|
1498
|
-
|
|
1502
|
+
m && V(!1);
|
|
1499
1503
|
}
|
|
1500
1504
|
})(), () => {
|
|
1501
|
-
|
|
1505
|
+
m = !1;
|
|
1502
1506
|
};
|
|
1503
|
-
}, [
|
|
1504
|
-
if (!
|
|
1505
|
-
|
|
1507
|
+
}, [c, p, a]), Ce(() => {
|
|
1508
|
+
if (!c || !f || s === H.CREATE) {
|
|
1509
|
+
I({});
|
|
1506
1510
|
return;
|
|
1507
1511
|
}
|
|
1508
|
-
let
|
|
1512
|
+
let m = !0;
|
|
1509
1513
|
return (async () => {
|
|
1510
1514
|
W(!0), P(null);
|
|
1511
1515
|
try {
|
|
1512
|
-
const i = await p.getRecord(
|
|
1513
|
-
if (!
|
|
1514
|
-
const T = i.data?.data || i.data || {},
|
|
1515
|
-
for (const [h,
|
|
1516
|
-
h.endsWith(
|
|
1517
|
-
|
|
1516
|
+
const i = await p.getRecord(c, f);
|
|
1517
|
+
if (!m) return;
|
|
1518
|
+
const T = i.data?.data || i.data || {}, j = {};
|
|
1519
|
+
for (const [h, J] of Object.entries(T))
|
|
1520
|
+
h.endsWith(mr) || (j[h] = J);
|
|
1521
|
+
I(j);
|
|
1518
1522
|
} catch (i) {
|
|
1519
|
-
console.error(ie.FAILED_LOAD_RECORD, i),
|
|
1523
|
+
console.error(ie.FAILED_LOAD_RECORD, i), m && P(ie.FAILED_LOAD_RECORD);
|
|
1520
1524
|
} finally {
|
|
1521
|
-
|
|
1525
|
+
m && W(!1);
|
|
1522
1526
|
}
|
|
1523
1527
|
})(), () => {
|
|
1524
|
-
|
|
1528
|
+
m = !1;
|
|
1525
1529
|
};
|
|
1526
|
-
}, [
|
|
1527
|
-
const G =
|
|
1528
|
-
|
|
1529
|
-
}, []), ue =
|
|
1530
|
-
const
|
|
1531
|
-
for (const [
|
|
1532
|
-
i.validation?.required && !S[i.fieldName] &&
|
|
1533
|
-
return
|
|
1534
|
-
}, [g, S]),
|
|
1535
|
-
if (!
|
|
1536
|
-
const
|
|
1537
|
-
if (
|
|
1538
|
-
P(
|
|
1530
|
+
}, [c, f, s, p]);
|
|
1531
|
+
const G = Ie((m, E) => {
|
|
1532
|
+
I((i) => ({ ...i, [m]: E }));
|
|
1533
|
+
}, []), ue = Ie(() => {
|
|
1534
|
+
const m = [];
|
|
1535
|
+
for (const [E, i] of Object.entries(g))
|
|
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;
|
|
1538
|
+
}, [g, S]), K = Ie(async () => {
|
|
1539
|
+
if (!c) return;
|
|
1540
|
+
const m = ue();
|
|
1541
|
+
if (m.length > 0) {
|
|
1542
|
+
P(m.join(", "));
|
|
1539
1543
|
return;
|
|
1540
1544
|
}
|
|
1541
1545
|
W(!0), P(null);
|
|
1542
1546
|
try {
|
|
1543
|
-
const
|
|
1547
|
+
const E = {};
|
|
1544
1548
|
for (const i of Object.values(g)) {
|
|
1545
1549
|
const T = i.fieldName;
|
|
1546
|
-
T && S[T] !== void 0 && S[T] !== "" && (
|
|
1550
|
+
T && S[T] !== void 0 && S[T] !== "" && (E[T] = S[T]);
|
|
1547
1551
|
}
|
|
1548
|
-
if (s ===
|
|
1549
|
-
const i = await p.createRecord(
|
|
1550
|
-
|
|
1551
|
-
} else if (
|
|
1552
|
-
const i = await p.updateRecord(
|
|
1553
|
-
|
|
1552
|
+
if (s === H.CREATE) {
|
|
1553
|
+
const i = await p.createRecord(c, { data: E });
|
|
1554
|
+
X?.(i);
|
|
1555
|
+
} else if (f) {
|
|
1556
|
+
const i = await p.updateRecord(c, f, { data: E });
|
|
1557
|
+
X?.(i);
|
|
1554
1558
|
}
|
|
1555
1559
|
k?.();
|
|
1556
|
-
} catch (
|
|
1557
|
-
console.error("Failed to save record:",
|
|
1558
|
-
const i =
|
|
1560
|
+
} catch (E) {
|
|
1561
|
+
console.error("Failed to save record:", E);
|
|
1562
|
+
const i = E?.response?.data?.message || (Array.isArray(E?.response?.data?.message) ? E.response.data.message.join(", ") : "Failed to save record. Please try again.");
|
|
1559
1563
|
P(i);
|
|
1560
1564
|
} finally {
|
|
1561
1565
|
W(!1);
|
|
1562
1566
|
}
|
|
1563
|
-
}, [
|
|
1564
|
-
const
|
|
1565
|
-
if (!
|
|
1566
|
-
const T = S[i] ?? "",
|
|
1567
|
+
}, [c, g, S, ue, s, f, p, k, X]), oe = Ie((m) => {
|
|
1568
|
+
const E = g[m], i = E?.fieldName;
|
|
1569
|
+
if (!E || i === "id") return null;
|
|
1570
|
+
const T = S[i] ?? "", j = s === H.VIEW || C;
|
|
1567
1571
|
return /* @__PURE__ */ r.jsxs(N, { className: "form-field", children: [
|
|
1568
1572
|
/* @__PURE__ */ r.jsxs(_e, { variant: "body2", className: "field-label", children: [
|
|
1569
|
-
|
|
1570
|
-
|
|
1573
|
+
m,
|
|
1574
|
+
E.validation?.required && s !== H.VIEW && /* @__PURE__ */ r.jsx("span", { style: { color: Rr }, children: pr })
|
|
1571
1575
|
] }),
|
|
1572
|
-
|
|
1576
|
+
E.fieldType === $e.DROPDOWN ? /* @__PURE__ */ r.jsx(
|
|
1573
1577
|
Be,
|
|
1574
1578
|
{
|
|
1575
1579
|
options: te[i] || [],
|
|
1576
1580
|
getOptionLabel: (h) => h.label || String(h.value),
|
|
1577
1581
|
value: te[i]?.find((h) => h.value === T) || null,
|
|
1578
|
-
onChange: (h,
|
|
1579
|
-
disabled:
|
|
1580
|
-
loading:
|
|
1582
|
+
onChange: (h, J) => G(i, J?.value ?? null),
|
|
1583
|
+
disabled: j,
|
|
1584
|
+
loading: q,
|
|
1581
1585
|
renderInput: (h) => /* @__PURE__ */ r.jsx(
|
|
1582
1586
|
ee,
|
|
1583
1587
|
{
|
|
1584
1588
|
...h,
|
|
1585
1589
|
size: "small",
|
|
1586
|
-
placeholder: ye.SELECT(
|
|
1587
|
-
error:
|
|
1590
|
+
placeholder: ye.SELECT(m),
|
|
1591
|
+
error: E.validation?.required && !T && s !== H.VIEW
|
|
1588
1592
|
}
|
|
1589
1593
|
),
|
|
1590
1594
|
className: "field-input"
|
|
1591
1595
|
}
|
|
1592
|
-
) :
|
|
1596
|
+
) : E.fieldType === $e.DATEPICKER ? /* @__PURE__ */ r.jsx(
|
|
1593
1597
|
ee,
|
|
1594
1598
|
{
|
|
1595
1599
|
type: "date",
|
|
1596
1600
|
size: "small",
|
|
1597
1601
|
value: T ? String(T).slice(0, 10) : "",
|
|
1598
1602
|
onChange: (h) => G(i, h.target.value),
|
|
1599
|
-
disabled:
|
|
1600
|
-
error:
|
|
1603
|
+
disabled: j,
|
|
1604
|
+
error: E.validation?.required && !T && s !== H.VIEW,
|
|
1601
1605
|
className: "field-input",
|
|
1602
1606
|
InputLabelProps: { shrink: !0 }
|
|
1603
1607
|
}
|
|
1604
|
-
) :
|
|
1608
|
+
) : E.dataType === "number" || E.dataType === "float" ? /* @__PURE__ */ r.jsx(
|
|
1605
1609
|
ee,
|
|
1606
1610
|
{
|
|
1607
1611
|
type: "number",
|
|
1608
1612
|
size: "small",
|
|
1609
1613
|
value: T,
|
|
1610
1614
|
onChange: (h) => G(i, h.target.value),
|
|
1611
|
-
disabled:
|
|
1612
|
-
placeholder:
|
|
1613
|
-
error:
|
|
1615
|
+
disabled: j,
|
|
1616
|
+
placeholder: m,
|
|
1617
|
+
error: E.validation?.required && !T && s !== H.VIEW,
|
|
1614
1618
|
inputProps: {
|
|
1615
|
-
max:
|
|
1616
|
-
min:
|
|
1617
|
-
step:
|
|
1619
|
+
max: E.validation?.max,
|
|
1620
|
+
min: E.validation?.min,
|
|
1621
|
+
step: E.dataType === "float" ? 0.01 : 1
|
|
1618
1622
|
},
|
|
1619
1623
|
className: "field-input"
|
|
1620
1624
|
}
|
|
@@ -1624,33 +1628,33 @@ const Er = ({
|
|
|
1624
1628
|
size: "small",
|
|
1625
1629
|
value: T,
|
|
1626
1630
|
onChange: (h) => G(i, h.target.value),
|
|
1627
|
-
disabled:
|
|
1628
|
-
placeholder:
|
|
1629
|
-
error:
|
|
1631
|
+
disabled: j,
|
|
1632
|
+
placeholder: m,
|
|
1633
|
+
error: E.validation?.required && !T && s !== H.VIEW,
|
|
1630
1634
|
inputProps: {
|
|
1631
|
-
maxLength:
|
|
1635
|
+
maxLength: E.validation?.max
|
|
1632
1636
|
},
|
|
1633
1637
|
className: "field-input"
|
|
1634
1638
|
}
|
|
1635
1639
|
)
|
|
1636
|
-
] },
|
|
1637
|
-
}, [g, S, te, G, s, C,
|
|
1638
|
-
return
|
|
1640
|
+
] }, m);
|
|
1641
|
+
}, [g, S, te, G, s, C, q]);
|
|
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: [
|
|
1639
1643
|
/* @__PURE__ */ r.jsxs(_e, { variant: "h5", gutterBottom: !0, children: [
|
|
1640
|
-
s ===
|
|
1641
|
-
|
|
1644
|
+
s === H.CREATE ? Pe.ADD_NEW_RECORD : s === H.EDIT ? Pe.EDIT_RECORD : Pe.VIEW_RECORD,
|
|
1645
|
+
c && ` - ${c.charAt(0).toUpperCase() + c.slice(1)}`
|
|
1642
1646
|
] }),
|
|
1643
1647
|
D && /* @__PURE__ */ r.jsx(Kt, { severity: "error", onClose: () => P(null), sx: { mb: 2 }, children: D }),
|
|
1644
|
-
C && s !==
|
|
1645
|
-
/* @__PURE__ */ r.jsx(N, { className: "form-fields", children:
|
|
1646
|
-
/* @__PURE__ */ r.jsx(N, { className: "action-buttons", mt: 3, children: s !==
|
|
1648
|
+
C && s !== H.VIEW && /* @__PURE__ */ r.jsx(N, { display: "flex", justifyContent: "center", my: 2, children: /* @__PURE__ */ r.jsx(Le, { size: 24 }) }),
|
|
1649
|
+
/* @__PURE__ */ r.jsx(N, { className: "form-fields", children: F.map(oe) }),
|
|
1650
|
+
/* @__PURE__ */ r.jsx(N, { className: "action-buttons", mt: 3, children: s !== H.VIEW ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1647
1651
|
/* @__PURE__ */ r.jsx(
|
|
1648
1652
|
ne,
|
|
1649
1653
|
{
|
|
1650
1654
|
variant: "contained",
|
|
1651
|
-
onClick:
|
|
1655
|
+
onClick: K,
|
|
1652
1656
|
disabled: C,
|
|
1653
|
-
children: C ? /* @__PURE__ */ r.jsx(Le, { size: 24 }) : s ===
|
|
1657
|
+
children: C ? /* @__PURE__ */ r.jsx(Le, { size: 24 }) : s === H.CREATE ? le.CREATE : le.UPDATE
|
|
1654
1658
|
}
|
|
1655
1659
|
),
|
|
1656
1660
|
/* @__PURE__ */ r.jsx(
|
|
@@ -1668,8 +1672,8 @@ const Er = ({
|
|
|
1668
1672
|
ROOT: "/",
|
|
1669
1673
|
MASTER: "/master",
|
|
1670
1674
|
MASTER_ENTITY_NEW: (a) => `/master/${a}/new`,
|
|
1671
|
-
MASTER_ENTITY_VIEW: (a,
|
|
1672
|
-
MASTER_ENTITY_EDIT: (a,
|
|
1675
|
+
MASTER_ENTITY_VIEW: (a, u) => `/master/${a}/${u}`,
|
|
1676
|
+
MASTER_ENTITY_EDIT: (a, u) => `/master/${a}/${u}/edit`
|
|
1673
1677
|
}, qr = {
|
|
1674
1678
|
ROOT: "/",
|
|
1675
1679
|
MASTER: "/master",
|
|
@@ -1688,17 +1692,17 @@ const Er = ({
|
|
|
1688
1692
|
EDIT: "/edit"
|
|
1689
1693
|
};
|
|
1690
1694
|
export {
|
|
1691
|
-
|
|
1695
|
+
jr as API_BASE_PATHS,
|
|
1692
1696
|
Pr as API_CONFIG,
|
|
1693
|
-
|
|
1697
|
+
wr as API_ENDPOINTS,
|
|
1694
1698
|
Lr as ARIA_LABELS,
|
|
1695
1699
|
le as BUTTON_LABELS,
|
|
1696
|
-
|
|
1700
|
+
Or as COLUMN_PROPERTIES,
|
|
1697
1701
|
xr as CSS_CLASSES,
|
|
1698
1702
|
Ne as DATA_TYPES,
|
|
1699
1703
|
Nr as DATE_FORMATS,
|
|
1700
1704
|
se as DATE_RANGE_SUFFIXES,
|
|
1701
|
-
|
|
1705
|
+
mr as DISPLAY_FIELD_SUFFIX,
|
|
1702
1706
|
Cr as EMPTY_STATE_MESSAGES,
|
|
1703
1707
|
ie as ERROR_MESSAGES,
|
|
1704
1708
|
ft as EXPORT_OPTIONS,
|
|
@@ -1706,7 +1710,7 @@ export {
|
|
|
1706
1710
|
Yr as FIELD_NAMES,
|
|
1707
1711
|
$e as FIELD_TYPES,
|
|
1708
1712
|
Et as FILE_EXTENSIONS,
|
|
1709
|
-
|
|
1713
|
+
H as FORM_MODES,
|
|
1710
1714
|
ur as GRID_CSS_CLASSES,
|
|
1711
1715
|
cr as GRID_EVENT_SOURCES,
|
|
1712
1716
|
ut as GRID_LAYOUT,
|
|
@@ -1714,10 +1718,10 @@ export {
|
|
|
1714
1718
|
lr as GRID_SETTINGS,
|
|
1715
1719
|
Ve as GRID_TEXT,
|
|
1716
1720
|
fr as GRID_TIMEOUTS,
|
|
1717
|
-
|
|
1721
|
+
Mr as HTTP_METHODS,
|
|
1718
1722
|
$r as INPUT_TYPES,
|
|
1719
1723
|
Dr as LOADING_MESSAGES,
|
|
1720
|
-
|
|
1724
|
+
Rt as MIME_TYPES,
|
|
1721
1725
|
Xr as MasterForm,
|
|
1722
1726
|
Hr as MasterView,
|
|
1723
1727
|
Wr as NUMBER_INPUT,
|
|
@@ -1727,10 +1731,10 @@ export {
|
|
|
1727
1731
|
hr as PAGINATION_SETTINGS,
|
|
1728
1732
|
ye as PLACEHOLDERS,
|
|
1729
1733
|
Tr as Pagination,
|
|
1730
|
-
|
|
1734
|
+
Fr as QUERY_PARAMS,
|
|
1731
1735
|
Br as REGEX_PATTERNS,
|
|
1732
1736
|
pr as REQUIRED_INDICATOR,
|
|
1733
|
-
|
|
1737
|
+
Rr as REQUIRED_INDICATOR_COLOR,
|
|
1734
1738
|
Gr as RESPONSE_KEYS,
|
|
1735
1739
|
Ur as RESPONSE_TYPES,
|
|
1736
1740
|
zr as ROUTES,
|
|
@@ -1741,7 +1745,7 @@ export {
|
|
|
1741
1745
|
pt as SORT_ORDER,
|
|
1742
1746
|
Ar as SORT_SETTINGS,
|
|
1743
1747
|
br as STYLE_CONSTANTS,
|
|
1744
|
-
|
|
1748
|
+
Ir as SUCCESS_MESSAGES,
|
|
1745
1749
|
Er as ServerSideGrid,
|
|
1746
1750
|
Jr as URL_PARAMS,
|
|
1747
1751
|
yr as VALIDATION_MESSAGES,
|