@bluemarble/bm-components 2.0.1 → 2.0.3
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/index.js +642 -757
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +640 -755
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -1
package/dist/index.js
CHANGED
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __create = Object.create;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __objRest = (source, exclude) => {
|
|
25
|
-
var target = {};
|
|
26
|
-
for (var prop in source)
|
|
27
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
if (source != null && __getOwnPropSymbols)
|
|
30
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
-
target[prop] = source[prop];
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
};
|
|
36
7
|
var __commonJS = (cb, mod) => function __require() {
|
|
37
8
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
38
9
|
};
|
|
@@ -52,26 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
52
23
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
53
24
|
mod
|
|
54
25
|
));
|
|
55
|
-
var __async = (__this, __arguments, generator) => {
|
|
56
|
-
return new Promise((resolve, reject) => {
|
|
57
|
-
var fulfilled = (value) => {
|
|
58
|
-
try {
|
|
59
|
-
step(generator.next(value));
|
|
60
|
-
} catch (e) {
|
|
61
|
-
reject(e);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
var rejected = (value) => {
|
|
65
|
-
try {
|
|
66
|
-
step(generator.throw(value));
|
|
67
|
-
} catch (e) {
|
|
68
|
-
reject(e);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
72
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
26
|
|
|
76
27
|
// node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js
|
|
77
28
|
var require_react_is_production_min = __commonJS({
|
|
@@ -1287,7 +1238,7 @@ var GridHeader = ({
|
|
|
1287
1238
|
{
|
|
1288
1239
|
key: title.name,
|
|
1289
1240
|
sortDirection: orderBy === title.name ? order : false,
|
|
1290
|
-
sx:
|
|
1241
|
+
sx: { fontWeight: "bold", ...title.sx }
|
|
1291
1242
|
},
|
|
1292
1243
|
/* @__PURE__ */ React2.default.createElement(
|
|
1293
1244
|
_material.TableSortLabel,
|
|
@@ -1358,7 +1309,9 @@ function deepClone(source) {
|
|
|
1358
1309
|
function deepmerge(target, source, options = {
|
|
1359
1310
|
clone: true
|
|
1360
1311
|
}) {
|
|
1361
|
-
const output = options.clone ?
|
|
1312
|
+
const output = options.clone ? {
|
|
1313
|
+
...target
|
|
1314
|
+
} : target;
|
|
1362
1315
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
1363
1316
|
Object.keys(source).forEach((key) => {
|
|
1364
1317
|
if (/* @__PURE__ */ React2.isValidElement(source[key]) || (0, import_react_is.isValidElementType)(source[key])) {
|
|
@@ -1384,13 +1337,16 @@ var sortBreakpointsValues = (values2) => {
|
|
|
1384
1337
|
})) || [];
|
|
1385
1338
|
breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
|
|
1386
1339
|
return breakpointsAsArray.reduce((acc, obj) => {
|
|
1387
|
-
return
|
|
1340
|
+
return {
|
|
1341
|
+
...acc,
|
|
1388
1342
|
[obj.key]: obj.val
|
|
1389
|
-
}
|
|
1343
|
+
};
|
|
1390
1344
|
}, {});
|
|
1391
1345
|
};
|
|
1392
1346
|
function createBreakpoints(breakpoints) {
|
|
1393
|
-
const
|
|
1347
|
+
const {
|
|
1348
|
+
// The breakpoint **start** at this value.
|
|
1349
|
+
// For instance with the first breakpoint xs: [xs, sm).
|
|
1394
1350
|
values: values2 = {
|
|
1395
1351
|
xs: 0,
|
|
1396
1352
|
// phone
|
|
@@ -1404,14 +1360,9 @@ function createBreakpoints(breakpoints) {
|
|
|
1404
1360
|
// large screen
|
|
1405
1361
|
},
|
|
1406
1362
|
unit = "px",
|
|
1407
|
-
step = 5
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
// For instance with the first breakpoint xs: [xs, sm).
|
|
1411
|
-
"values",
|
|
1412
|
-
"unit",
|
|
1413
|
-
"step"
|
|
1414
|
-
]);
|
|
1363
|
+
step = 5,
|
|
1364
|
+
...other
|
|
1365
|
+
} = breakpoints;
|
|
1415
1366
|
const sortedValues = sortBreakpointsValues(values2);
|
|
1416
1367
|
const keys = Object.keys(sortedValues);
|
|
1417
1368
|
function up(key) {
|
|
@@ -1442,7 +1393,7 @@ function createBreakpoints(breakpoints) {
|
|
|
1442
1393
|
}
|
|
1443
1394
|
return between(key, keys[keys.indexOf(key) + 1]).replace("@media", "@media not all and");
|
|
1444
1395
|
}
|
|
1445
|
-
return
|
|
1396
|
+
return {
|
|
1446
1397
|
keys,
|
|
1447
1398
|
values: sortedValues,
|
|
1448
1399
|
up,
|
|
@@ -1450,8 +1401,9 @@ function createBreakpoints(breakpoints) {
|
|
|
1450
1401
|
between,
|
|
1451
1402
|
only,
|
|
1452
1403
|
not,
|
|
1453
|
-
unit
|
|
1454
|
-
|
|
1404
|
+
unit,
|
|
1405
|
+
...other
|
|
1406
|
+
};
|
|
1455
1407
|
}
|
|
1456
1408
|
|
|
1457
1409
|
// node_modules/@mui/system/esm/cssContainerQueries/cssContainerQueries.js
|
|
@@ -1460,9 +1412,8 @@ function sortContainerQueries(theme, css2) {
|
|
|
1460
1412
|
return css2;
|
|
1461
1413
|
}
|
|
1462
1414
|
const sorted = Object.keys(css2).filter((key) => key.startsWith("@container")).sort((a, b) => {
|
|
1463
|
-
var _a, _b;
|
|
1464
1415
|
const regex = /min-width:\s*([0-9.]+)/;
|
|
1465
|
-
return +((
|
|
1416
|
+
return +(_optionalChain([a, 'access', _2 => _2.match, 'call', _3 => _3(regex), 'optionalAccess', _4 => _4[1]]) || 0) - +(_optionalChain([b, 'access', _5 => _5.match, 'call', _6 => _6(regex), 'optionalAccess', _7 => _7[1]]) || 0);
|
|
1466
1417
|
});
|
|
1467
1418
|
if (!sorted.length) {
|
|
1468
1419
|
return css2;
|
|
@@ -1472,7 +1423,9 @@ function sortContainerQueries(theme, css2) {
|
|
|
1472
1423
|
delete acc[key];
|
|
1473
1424
|
acc[key] = value;
|
|
1474
1425
|
return acc;
|
|
1475
|
-
},
|
|
1426
|
+
}, {
|
|
1427
|
+
...css2
|
|
1428
|
+
});
|
|
1476
1429
|
}
|
|
1477
1430
|
function isCqShorthand(breakpointKeys, value) {
|
|
1478
1431
|
return value === "@" || value.startsWith("@") && (breakpointKeys.some((key) => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
@@ -1511,9 +1464,10 @@ function cssContainerQueries(themeInput) {
|
|
|
1511
1464
|
return node;
|
|
1512
1465
|
};
|
|
1513
1466
|
attachCq(containerQueries);
|
|
1514
|
-
return
|
|
1467
|
+
return {
|
|
1468
|
+
...themeInput,
|
|
1515
1469
|
containerQueries
|
|
1516
|
-
}
|
|
1470
|
+
};
|
|
1517
1471
|
}
|
|
1518
1472
|
|
|
1519
1473
|
// node_modules/@mui/system/esm/createTheme/shape.js
|
|
@@ -1600,12 +1554,11 @@ function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
|
1600
1554
|
return output;
|
|
1601
1555
|
}
|
|
1602
1556
|
function createEmptyBreakpointObject(breakpointsInput = {}) {
|
|
1603
|
-
|
|
1604
|
-
const breakpointsInOrder = (_a = breakpointsInput.keys) == null ? void 0 : _a.reduce((acc, key) => {
|
|
1557
|
+
const breakpointsInOrder = _optionalChain([breakpointsInput, 'access', _8 => _8.keys, 'optionalAccess', _9 => _9.reduce, 'call', _10 => _10((acc, key) => {
|
|
1605
1558
|
const breakpointStyleKey = breakpointsInput.up(key);
|
|
1606
1559
|
acc[breakpointStyleKey] = {};
|
|
1607
1560
|
return acc;
|
|
1608
|
-
}, {});
|
|
1561
|
+
}, {})]);
|
|
1609
1562
|
return breakpointsInOrder || {};
|
|
1610
1563
|
}
|
|
1611
1564
|
function removeUnusedBreakpoints(breakpointKeys, style3) {
|
|
@@ -1742,8 +1695,7 @@ var marginKeys = ["m", "mt", "mr", "mb", "ml", "mx", "my", "margin", "marginTop"
|
|
|
1742
1695
|
var paddingKeys = ["p", "pt", "pr", "pb", "pl", "px", "py", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "paddingX", "paddingY", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "paddingBlock", "paddingBlockStart", "paddingBlockEnd"];
|
|
1743
1696
|
var spacingKeys = [...marginKeys, ...paddingKeys];
|
|
1744
1697
|
function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
1745
|
-
|
|
1746
|
-
const themeSpacing = (_a = getPath(theme, themeKey, true)) != null ? _a : defaultValue;
|
|
1698
|
+
const themeSpacing = _nullishCoalesce(getPath(theme, themeKey, true), () => ( defaultValue));
|
|
1747
1699
|
if (typeof themeSpacing === "number" || typeof themeSpacing === "string") {
|
|
1748
1700
|
return (val) => {
|
|
1749
1701
|
if (typeof val === "string") {
|
|
@@ -2048,14 +2000,13 @@ var width = style_default({
|
|
|
2048
2000
|
var maxWidth = (props) => {
|
|
2049
2001
|
if (props.maxWidth !== void 0 && props.maxWidth !== null) {
|
|
2050
2002
|
const styleFromPropValue = (propValue) => {
|
|
2051
|
-
|
|
2052
|
-
const breakpoint = ((_c = (_b = (_a = props.theme) == null ? void 0 : _a.breakpoints) == null ? void 0 : _b.values) == null ? void 0 : _c[propValue]) || values[propValue];
|
|
2003
|
+
const breakpoint = _optionalChain([props, 'access', _11 => _11.theme, 'optionalAccess', _12 => _12.breakpoints, 'optionalAccess', _13 => _13.values, 'optionalAccess', _14 => _14[propValue]]) || values[propValue];
|
|
2053
2004
|
if (!breakpoint) {
|
|
2054
2005
|
return {
|
|
2055
2006
|
maxWidth: sizingTransform(propValue)
|
|
2056
2007
|
};
|
|
2057
2008
|
}
|
|
2058
|
-
if ((
|
|
2009
|
+
if (_optionalChain([props, 'access', _15 => _15.theme, 'optionalAccess', _16 => _16.breakpoints, 'optionalAccess', _17 => _17.unit]) !== "px") {
|
|
2059
2010
|
return {
|
|
2060
2011
|
maxWidth: `${breakpoint}${props.theme.breakpoints.unit}`
|
|
2061
2012
|
};
|
|
@@ -2445,7 +2396,6 @@ function unstable_createStyleFunctionSx() {
|
|
|
2445
2396
|
return handleBreakpoints(props, val, styleFromPropValue);
|
|
2446
2397
|
}
|
|
2447
2398
|
function styleFunctionSx2(props) {
|
|
2448
|
-
var _a;
|
|
2449
2399
|
const {
|
|
2450
2400
|
sx,
|
|
2451
2401
|
theme = {},
|
|
@@ -2454,7 +2404,7 @@ function unstable_createStyleFunctionSx() {
|
|
|
2454
2404
|
if (!sx) {
|
|
2455
2405
|
return null;
|
|
2456
2406
|
}
|
|
2457
|
-
const config = (
|
|
2407
|
+
const config = _nullishCoalesce(theme.unstable_sxConfig, () => ( defaultSxConfig_default));
|
|
2458
2408
|
function traverse(sxInput) {
|
|
2459
2409
|
let sxObject = sxInput;
|
|
2460
2410
|
if (typeof sxInput === "function") {
|
|
@@ -2512,10 +2462,9 @@ var styleFunctionSx_default = styleFunctionSx;
|
|
|
2512
2462
|
|
|
2513
2463
|
// node_modules/@mui/system/esm/createTheme/applyStyles.js
|
|
2514
2464
|
function applyStyles(key, styles2) {
|
|
2515
|
-
var _a;
|
|
2516
2465
|
const theme = this;
|
|
2517
2466
|
if (theme.vars) {
|
|
2518
|
-
if (!(
|
|
2467
|
+
if (!_optionalChain([theme, 'access', _18 => _18.colorSchemes, 'optionalAccess', _19 => _19[key]]) || typeof theme.getColorSchemeSelector !== "function") {
|
|
2519
2468
|
return {};
|
|
2520
2469
|
}
|
|
2521
2470
|
let selector = theme.getColorSchemeSelector(key);
|
|
@@ -2537,17 +2486,13 @@ function applyStyles(key, styles2) {
|
|
|
2537
2486
|
|
|
2538
2487
|
// node_modules/@mui/system/esm/createTheme/createTheme.js
|
|
2539
2488
|
function createTheme(options = {}, ...args) {
|
|
2540
|
-
const
|
|
2489
|
+
const {
|
|
2541
2490
|
breakpoints: breakpointsInput = {},
|
|
2542
2491
|
palette: paletteInput = {},
|
|
2543
2492
|
spacing: spacingInput,
|
|
2544
|
-
shape: shapeInput = {}
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
"palette",
|
|
2548
|
-
"spacing",
|
|
2549
|
-
"shape"
|
|
2550
|
-
]);
|
|
2493
|
+
shape: shapeInput = {},
|
|
2494
|
+
...other
|
|
2495
|
+
} = options;
|
|
2551
2496
|
const breakpoints = createBreakpoints(breakpointsInput);
|
|
2552
2497
|
const spacing2 = createSpacing(spacingInput);
|
|
2553
2498
|
let muiTheme = deepmerge({
|
|
@@ -2555,16 +2500,23 @@ function createTheme(options = {}, ...args) {
|
|
|
2555
2500
|
direction: "ltr",
|
|
2556
2501
|
components: {},
|
|
2557
2502
|
// Inject component definitions.
|
|
2558
|
-
palette:
|
|
2559
|
-
mode: "light"
|
|
2560
|
-
|
|
2503
|
+
palette: {
|
|
2504
|
+
mode: "light",
|
|
2505
|
+
...paletteInput
|
|
2506
|
+
},
|
|
2561
2507
|
spacing: spacing2,
|
|
2562
|
-
shape:
|
|
2508
|
+
shape: {
|
|
2509
|
+
...shape_default,
|
|
2510
|
+
...shapeInput
|
|
2511
|
+
}
|
|
2563
2512
|
}, other);
|
|
2564
2513
|
muiTheme = cssContainerQueries(muiTheme);
|
|
2565
2514
|
muiTheme.applyStyles = applyStyles;
|
|
2566
2515
|
muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
|
|
2567
|
-
muiTheme.unstable_sxConfig =
|
|
2516
|
+
muiTheme.unstable_sxConfig = {
|
|
2517
|
+
...defaultSxConfig_default,
|
|
2518
|
+
..._optionalChain([other, 'optionalAccess', _20 => _20.unstable_sxConfig])
|
|
2519
|
+
};
|
|
2568
2520
|
muiTheme.unstable_sx = function sx(props) {
|
|
2569
2521
|
return styleFunctionSx_default({
|
|
2570
2522
|
sx: props,
|
|
@@ -2595,12 +2547,11 @@ var useTheme_default = useTheme2;
|
|
|
2595
2547
|
|
|
2596
2548
|
// node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js
|
|
2597
2549
|
var splitProps = (props) => {
|
|
2598
|
-
var _a, _b;
|
|
2599
2550
|
const result = {
|
|
2600
2551
|
systemProps: {},
|
|
2601
2552
|
otherProps: {}
|
|
2602
2553
|
};
|
|
2603
|
-
const config = (
|
|
2554
|
+
const config = _nullishCoalesce(_optionalChain([props, 'optionalAccess', _21 => _21.theme, 'optionalAccess', _22 => _22.unstable_sxConfig]), () => ( defaultSxConfig_default));
|
|
2604
2555
|
Object.keys(props).forEach((prop) => {
|
|
2605
2556
|
if (config[prop]) {
|
|
2606
2557
|
result.systemProps[prop] = props[prop];
|
|
@@ -2611,11 +2562,10 @@ var splitProps = (props) => {
|
|
|
2611
2562
|
return result;
|
|
2612
2563
|
};
|
|
2613
2564
|
function extendSxProp(props) {
|
|
2614
|
-
const
|
|
2615
|
-
sx: inSx
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
]);
|
|
2565
|
+
const {
|
|
2566
|
+
sx: inSx,
|
|
2567
|
+
...other
|
|
2568
|
+
} = props;
|
|
2619
2569
|
const {
|
|
2620
2570
|
systemProps,
|
|
2621
2571
|
otherProps
|
|
@@ -2629,14 +2579,21 @@ function extendSxProp(props) {
|
|
|
2629
2579
|
if (!isPlainObject(result)) {
|
|
2630
2580
|
return systemProps;
|
|
2631
2581
|
}
|
|
2632
|
-
return
|
|
2582
|
+
return {
|
|
2583
|
+
...systemProps,
|
|
2584
|
+
...result
|
|
2585
|
+
};
|
|
2633
2586
|
};
|
|
2634
2587
|
} else {
|
|
2635
|
-
finalSx =
|
|
2588
|
+
finalSx = {
|
|
2589
|
+
...systemProps,
|
|
2590
|
+
...inSx
|
|
2591
|
+
};
|
|
2636
2592
|
}
|
|
2637
|
-
return
|
|
2593
|
+
return {
|
|
2594
|
+
...otherProps,
|
|
2638
2595
|
sx: finalSx
|
|
2639
|
-
}
|
|
2596
|
+
};
|
|
2640
2597
|
}
|
|
2641
2598
|
|
|
2642
2599
|
// node_modules/@mui/system/esm/Box/Box.js
|
|
@@ -2694,19 +2651,18 @@ function createBox(options = {}) {
|
|
|
2694
2651
|
})(styleFunctionSx_default);
|
|
2695
2652
|
const Box9 = /* @__PURE__ */ React4.forwardRef(function Box10(inProps, ref) {
|
|
2696
2653
|
const theme = useTheme_default(defaultTheme);
|
|
2697
|
-
const
|
|
2654
|
+
const {
|
|
2698
2655
|
className,
|
|
2699
|
-
component = "div"
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
]);
|
|
2704
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoxRoot, __spreadValues({
|
|
2656
|
+
component = "div",
|
|
2657
|
+
...other
|
|
2658
|
+
} = extendSxProp(inProps);
|
|
2659
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoxRoot, {
|
|
2705
2660
|
as: component,
|
|
2706
2661
|
ref,
|
|
2707
2662
|
className: clsx_default(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
2708
|
-
theme: themeId ? theme[themeId] || theme : theme
|
|
2709
|
-
|
|
2663
|
+
theme: themeId ? theme[themeId] || theme : theme,
|
|
2664
|
+
...other
|
|
2665
|
+
});
|
|
2710
2666
|
});
|
|
2711
2667
|
return Box9;
|
|
2712
2668
|
}
|
|
@@ -3101,12 +3057,12 @@ var Grid = (props) => {
|
|
|
3101
3057
|
options: columnTitles.map((title) => title.label),
|
|
3102
3058
|
renderInput: (params) => /* @__PURE__ */ React2.default.createElement(
|
|
3103
3059
|
_material.TextField,
|
|
3104
|
-
|
|
3060
|
+
{
|
|
3105
3061
|
variant: "standard",
|
|
3106
|
-
margin: "dense"
|
|
3107
|
-
|
|
3062
|
+
margin: "dense",
|
|
3063
|
+
...params,
|
|
3108
3064
|
label: "Coluna"
|
|
3109
|
-
}
|
|
3065
|
+
}
|
|
3110
3066
|
)
|
|
3111
3067
|
}
|
|
3112
3068
|
), /* @__PURE__ */ React2.default.createElement(
|
|
@@ -3120,12 +3076,12 @@ var Grid = (props) => {
|
|
|
3120
3076
|
options: valuesToFilter.map((title) => title),
|
|
3121
3077
|
renderInput: (params) => /* @__PURE__ */ React2.default.createElement(
|
|
3122
3078
|
_material.TextField,
|
|
3123
|
-
|
|
3079
|
+
{
|
|
3124
3080
|
variant: "standard",
|
|
3125
|
-
margin: "dense"
|
|
3126
|
-
|
|
3081
|
+
margin: "dense",
|
|
3082
|
+
...params,
|
|
3127
3083
|
label: "Valor"
|
|
3128
|
-
}
|
|
3084
|
+
}
|
|
3129
3085
|
)
|
|
3130
3086
|
}
|
|
3131
3087
|
), /* @__PURE__ */ React2.default.createElement(_material.Box, { sx: { py: 1 } }), /* @__PURE__ */ React2.default.createElement(
|
|
@@ -3198,7 +3154,6 @@ var Grid_default = Grid;
|
|
|
3198
3154
|
|
|
3199
3155
|
var _moment = require('moment'); var _moment2 = _interopRequireDefault(_moment);
|
|
3200
3156
|
var DefaultInput = (allProps) => {
|
|
3201
|
-
var _a;
|
|
3202
3157
|
const {
|
|
3203
3158
|
TextFieldProps: TextFieldProps3,
|
|
3204
3159
|
onSave,
|
|
@@ -3224,14 +3179,13 @@ var DefaultInput = (allProps) => {
|
|
|
3224
3179
|
}
|
|
3225
3180
|
};
|
|
3226
3181
|
const handleSave = (event) => {
|
|
3227
|
-
|
|
3228
|
-
onUpdateValue(String((_a2 = event.target) == null ? void 0 : _a2.value));
|
|
3182
|
+
onUpdateValue(String(_optionalChain([event, 'access', _23 => _23.target, 'optionalAccess', _24 => _24.value])));
|
|
3229
3183
|
setIsEditing(false);
|
|
3230
3184
|
const response = {
|
|
3231
3185
|
name,
|
|
3232
3186
|
event,
|
|
3233
|
-
value: (
|
|
3234
|
-
data:
|
|
3187
|
+
value: _optionalChain([event, 'access', _25 => _25.target, 'optionalAccess', _26 => _26.value]),
|
|
3188
|
+
data: { ...rowData, [name]: _optionalChain([event, 'access', _27 => _27.target, 'optionalAccess', _28 => _28.value]) }
|
|
3235
3189
|
};
|
|
3236
3190
|
onSave(response);
|
|
3237
3191
|
};
|
|
@@ -3241,17 +3195,18 @@ var DefaultInput = (allProps) => {
|
|
|
3241
3195
|
};
|
|
3242
3196
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3243
3197
|
_material.TextField,
|
|
3244
|
-
|
|
3198
|
+
{
|
|
3245
3199
|
name,
|
|
3246
3200
|
focused: isEditing,
|
|
3247
3201
|
onBlur: (ev) => handleSave(ev),
|
|
3248
3202
|
autoFocus: true,
|
|
3249
3203
|
type,
|
|
3250
3204
|
size: "small",
|
|
3251
|
-
defaultValue: formatDefaultValue(rowData
|
|
3252
|
-
sx:
|
|
3253
|
-
width: fullWidth ? "100%" : "intial"
|
|
3254
|
-
|
|
3205
|
+
defaultValue: formatDefaultValue(_optionalChain([rowData, 'optionalAccess', _29 => _29[name]])),
|
|
3206
|
+
sx: {
|
|
3207
|
+
width: fullWidth ? "100%" : "intial",
|
|
3208
|
+
..._optionalChain([TextFieldProps3, 'optionalAccess', _30 => _30.sx])
|
|
3209
|
+
},
|
|
3255
3210
|
inputProps: {
|
|
3256
3211
|
style: {
|
|
3257
3212
|
paddingBottom: 6,
|
|
@@ -3259,13 +3214,16 @@ var DefaultInput = (allProps) => {
|
|
|
3259
3214
|
},
|
|
3260
3215
|
onKeyDown
|
|
3261
3216
|
},
|
|
3262
|
-
InputProps:
|
|
3263
|
-
|
|
3217
|
+
InputProps: {
|
|
3218
|
+
..._optionalChain([TextFieldProps3, 'optionalAccess', _31 => _31.InputProps]),
|
|
3219
|
+
sx: {
|
|
3264
3220
|
fontSize: 14,
|
|
3265
|
-
pl: 0.2
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3221
|
+
pl: 0.2,
|
|
3222
|
+
..._optionalChain([TextFieldProps3, 'optionalAccess', _32 => _32.InputProps, 'optionalAccess', _33 => _33.sx])
|
|
3223
|
+
}
|
|
3224
|
+
},
|
|
3225
|
+
...TextFieldProps3
|
|
3226
|
+
}
|
|
3269
3227
|
);
|
|
3270
3228
|
};
|
|
3271
3229
|
|
|
@@ -3274,7 +3232,6 @@ var _reactimask = require('react-imask');
|
|
|
3274
3232
|
|
|
3275
3233
|
|
|
3276
3234
|
var InputMask = (allProps) => {
|
|
3277
|
-
var _a;
|
|
3278
3235
|
const {
|
|
3279
3236
|
TextFieldProps: TextFieldProps3,
|
|
3280
3237
|
onSave,
|
|
@@ -3290,15 +3247,14 @@ var InputMask = (allProps) => {
|
|
|
3290
3247
|
mask
|
|
3291
3248
|
);
|
|
3292
3249
|
const handleSave = (event) => {
|
|
3293
|
-
var _a2, _b, _c;
|
|
3294
3250
|
setIsEditing(false);
|
|
3295
|
-
setValue(String((
|
|
3251
|
+
setValue(String(_optionalChain([event, 'access', _34 => _34.target, 'optionalAccess', _35 => _35.value])));
|
|
3296
3252
|
const response = {
|
|
3297
3253
|
name,
|
|
3298
3254
|
event,
|
|
3299
|
-
value: (
|
|
3255
|
+
value: _optionalChain([event, 'access', _36 => _36.target, 'optionalAccess', _37 => _37.value]),
|
|
3300
3256
|
unmaskedValue,
|
|
3301
|
-
data:
|
|
3257
|
+
data: { ...rowData, [name]: _optionalChain([event, 'access', _38 => _38.target, 'optionalAccess', _39 => _39.value]) }
|
|
3302
3258
|
};
|
|
3303
3259
|
onSave(response);
|
|
3304
3260
|
};
|
|
@@ -3307,20 +3263,21 @@ var InputMask = (allProps) => {
|
|
|
3307
3263
|
if (ev.code === "Escape") handleCancelEditing();
|
|
3308
3264
|
};
|
|
3309
3265
|
_react.useEffect.call(void 0, () => {
|
|
3310
|
-
if (rowData
|
|
3311
|
-
}, [rowData
|
|
3266
|
+
if (_optionalChain([rowData, 'optionalAccess', _40 => _40[name]])) setValue(String(_optionalChain([rowData, 'optionalAccess', _41 => _41[name]])));
|
|
3267
|
+
}, [_optionalChain([rowData, 'optionalAccess', _42 => _42[name]])]);
|
|
3312
3268
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3313
3269
|
_material.TextField,
|
|
3314
|
-
|
|
3270
|
+
{
|
|
3315
3271
|
inputRef: ref,
|
|
3316
3272
|
name,
|
|
3317
3273
|
focused: isEditing,
|
|
3318
3274
|
onBlur: (ev) => handleSave(ev),
|
|
3319
3275
|
autoFocus: true,
|
|
3320
3276
|
size: "small",
|
|
3321
|
-
sx:
|
|
3322
|
-
width: fullWidth ? "100%" : "intial"
|
|
3323
|
-
|
|
3277
|
+
sx: {
|
|
3278
|
+
width: fullWidth ? "100%" : "intial",
|
|
3279
|
+
..._optionalChain([TextFieldProps3, 'optionalAccess', _43 => _43.sx])
|
|
3280
|
+
},
|
|
3324
3281
|
inputProps: {
|
|
3325
3282
|
style: {
|
|
3326
3283
|
paddingBottom: 6,
|
|
@@ -3328,19 +3285,22 @@ var InputMask = (allProps) => {
|
|
|
3328
3285
|
},
|
|
3329
3286
|
onKeyDown
|
|
3330
3287
|
},
|
|
3331
|
-
InputProps:
|
|
3332
|
-
|
|
3288
|
+
InputProps: {
|
|
3289
|
+
..._optionalChain([TextFieldProps3, 'optionalAccess', _44 => _44.InputProps]),
|
|
3290
|
+
sx: {
|
|
3333
3291
|
fontSize: 14,
|
|
3334
|
-
pl: 0.2
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3292
|
+
pl: 0.2,
|
|
3293
|
+
..._optionalChain([TextFieldProps3, 'optionalAccess', _45 => _45.InputProps, 'optionalAccess', _46 => _46.sx])
|
|
3294
|
+
}
|
|
3295
|
+
},
|
|
3296
|
+
...TextFieldProps3
|
|
3297
|
+
}
|
|
3338
3298
|
);
|
|
3339
3299
|
};
|
|
3340
3300
|
|
|
3341
3301
|
// src/components/Grid/EditableTableCell/index.tsx
|
|
3342
3302
|
var EditableTableCell = (allProps) => {
|
|
3343
|
-
const
|
|
3303
|
+
const {
|
|
3344
3304
|
TextFieldProps: TextFieldProps3,
|
|
3345
3305
|
onSave = () => {
|
|
3346
3306
|
},
|
|
@@ -3353,37 +3313,27 @@ var EditableTableCell = (allProps) => {
|
|
|
3353
3313
|
formatInputDefautvalue,
|
|
3354
3314
|
bordered,
|
|
3355
3315
|
type,
|
|
3356
|
-
rowIndex
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
"onSave",
|
|
3360
|
-
"onCancel",
|
|
3361
|
-
"name",
|
|
3362
|
-
"rowData",
|
|
3363
|
-
"mask",
|
|
3364
|
-
"fullWidth",
|
|
3365
|
-
"formatCellValue",
|
|
3366
|
-
"formatInputDefautvalue",
|
|
3367
|
-
"bordered",
|
|
3368
|
-
"type",
|
|
3369
|
-
"rowIndex"
|
|
3370
|
-
]);
|
|
3316
|
+
rowIndex,
|
|
3317
|
+
...props
|
|
3318
|
+
} = allProps;
|
|
3371
3319
|
const [isEditing, setIsEditing] = _react.useState.call(void 0, false);
|
|
3372
|
-
const [value, setValue] = _react.useState.call(void 0, rowData
|
|
3320
|
+
const [value, setValue] = _react.useState.call(void 0, _optionalChain([rowData, 'optionalAccess', _47 => _47[name]]));
|
|
3373
3321
|
const handleCancelEditing = () => {
|
|
3374
3322
|
setIsEditing(false);
|
|
3375
3323
|
if (onCancel) onCancel();
|
|
3376
3324
|
};
|
|
3377
3325
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3378
3326
|
_material.TableCell,
|
|
3379
|
-
|
|
3380
|
-
|
|
3327
|
+
{
|
|
3328
|
+
...props,
|
|
3329
|
+
sx: {
|
|
3330
|
+
...(props || {}).sx,
|
|
3381
3331
|
p: isEditing ? 0 : "intial",
|
|
3382
3332
|
border: bordered ? "1px solid" : "initial",
|
|
3383
3333
|
borderColor: "divider"
|
|
3384
|
-
}
|
|
3334
|
+
},
|
|
3385
3335
|
onDoubleClick: () => setIsEditing(true)
|
|
3386
|
-
}
|
|
3336
|
+
},
|
|
3387
3337
|
isEditing ? /* @__PURE__ */ React2.default.createElement(React2.default.Fragment, null, mask ? /* @__PURE__ */ React2.default.createElement(
|
|
3388
3338
|
InputMask,
|
|
3389
3339
|
{
|
|
@@ -3392,10 +3342,9 @@ var EditableTableCell = (allProps) => {
|
|
|
3392
3342
|
setIsEditing,
|
|
3393
3343
|
name,
|
|
3394
3344
|
rowData,
|
|
3395
|
-
onSave: (
|
|
3396
|
-
var _c = _b, { value: value2 } = _c, rest = __objRest(_c, ["value"]);
|
|
3345
|
+
onSave: ({ value: value2, ...rest }) => {
|
|
3397
3346
|
setValue(value2);
|
|
3398
|
-
onSave(
|
|
3347
|
+
onSave({ value: value2, ...rest });
|
|
3399
3348
|
},
|
|
3400
3349
|
handleCancelEditing,
|
|
3401
3350
|
formatInputDefautvalue
|
|
@@ -3423,52 +3372,42 @@ var EditableTableCell = (allProps) => {
|
|
|
3423
3372
|
|
|
3424
3373
|
|
|
3425
3374
|
var _formik = require('formik');
|
|
3426
|
-
var Input = (
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
else return /* @__PURE__ */ React2.default.createElement(BaseInput, __spreadValues({}, rest));
|
|
3375
|
+
var Input = ({ withFormik = true, ...rest }) => {
|
|
3376
|
+
if (withFormik) return /* @__PURE__ */ React2.default.createElement(FormikInput, { ...rest });
|
|
3377
|
+
else return /* @__PURE__ */ React2.default.createElement(BaseInput, { ...rest });
|
|
3430
3378
|
};
|
|
3431
3379
|
var BaseInput = (props) => {
|
|
3432
|
-
return /* @__PURE__ */ React2.default.createElement(_material.TextField,
|
|
3380
|
+
return /* @__PURE__ */ React2.default.createElement(_material.TextField, { fullWidth: true, ...props });
|
|
3433
3381
|
};
|
|
3434
|
-
var FormikInput = (
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
})
|
|
3447
|
-
);
|
|
3448
|
-
});
|
|
3382
|
+
var FormikInput = ({ name, shrink, ...rest }) => {
|
|
3383
|
+
return /* @__PURE__ */ React2.default.createElement(_formik.Field, { name }, ({ field: { value, ...field }, meta: { error } }) => /* @__PURE__ */ React2.default.createElement(
|
|
3384
|
+
BaseInput,
|
|
3385
|
+
{
|
|
3386
|
+
defaultValue: value,
|
|
3387
|
+
error: Boolean(error),
|
|
3388
|
+
helperText: error,
|
|
3389
|
+
...field,
|
|
3390
|
+
...rest,
|
|
3391
|
+
InputLabelProps: { shrink, ...rest.InputLabelProps }
|
|
3392
|
+
}
|
|
3393
|
+
));
|
|
3449
3394
|
};
|
|
3450
3395
|
|
|
3451
3396
|
// src/components/InputMask/index.tsx
|
|
3452
3397
|
|
|
3453
3398
|
|
|
3454
3399
|
|
|
3455
|
-
function InputMask2(
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
else return /* @__PURE__ */ React2.default.createElement(BaseInputMask, __spreadValues({}, rest));
|
|
3400
|
+
function InputMask2({ withFormik = true, ...rest }) {
|
|
3401
|
+
if (withFormik) return /* @__PURE__ */ React2.default.createElement(FormikInputMask, { ...rest });
|
|
3402
|
+
else return /* @__PURE__ */ React2.default.createElement(BaseInputMask, { ...rest });
|
|
3459
3403
|
}
|
|
3460
|
-
var BaseInputMask = (
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
"mask",
|
|
3468
|
-
"defaultValue",
|
|
3469
|
-
"onChangeValue",
|
|
3470
|
-
"value"
|
|
3471
|
-
]);
|
|
3404
|
+
var BaseInputMask = ({
|
|
3405
|
+
mask,
|
|
3406
|
+
defaultValue,
|
|
3407
|
+
onChangeValue,
|
|
3408
|
+
value: controlledValue,
|
|
3409
|
+
...rest
|
|
3410
|
+
}) => {
|
|
3472
3411
|
const { ref, value, setValue, maskRef, unmaskedValue } = _reactimask.useIMask.call(void 0,
|
|
3473
3412
|
mask,
|
|
3474
3413
|
{
|
|
@@ -3485,18 +3424,14 @@ var BaseInputMask = (_a) => {
|
|
|
3485
3424
|
setValue(controlledValue);
|
|
3486
3425
|
maskRef.current.value = controlledValue;
|
|
3487
3426
|
}, [controlledValue]);
|
|
3488
|
-
return /* @__PURE__ */ React2.default.createElement(BaseInput,
|
|
3427
|
+
return /* @__PURE__ */ React2.default.createElement(BaseInput, { inputRef: ref, ...rest });
|
|
3489
3428
|
};
|
|
3490
|
-
function FormikInputMask(
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
"mask",
|
|
3497
|
-
"defaultValue",
|
|
3498
|
-
"name"
|
|
3499
|
-
]);
|
|
3429
|
+
function FormikInputMask({
|
|
3430
|
+
mask,
|
|
3431
|
+
defaultValue,
|
|
3432
|
+
name,
|
|
3433
|
+
...rest
|
|
3434
|
+
}) {
|
|
3500
3435
|
const { ref, value, unmaskedValue, maskRef, setValue } = _reactimask.useIMask.call(void 0,
|
|
3501
3436
|
mask
|
|
3502
3437
|
);
|
|
@@ -3516,23 +3451,22 @@ function FormikInputMask(_a) {
|
|
|
3516
3451
|
if (formikSaveFunction.current)
|
|
3517
3452
|
formikSaveFunction.current(name, unmaskedValue);
|
|
3518
3453
|
}, [value]);
|
|
3519
|
-
return /* @__PURE__ */ React2.default.createElement(_formik.Field, { name }, (
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
form: { setFieldValue }
|
|
3525
|
-
} = _b2;
|
|
3454
|
+
return /* @__PURE__ */ React2.default.createElement(_formik.Field, { name }, ({
|
|
3455
|
+
field: { value: value2, ...field },
|
|
3456
|
+
meta: { error },
|
|
3457
|
+
form: { setFieldValue }
|
|
3458
|
+
}) => {
|
|
3526
3459
|
initialValue.current = value2;
|
|
3527
3460
|
formikSaveFunction.current = setFieldValue;
|
|
3528
3461
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3529
3462
|
BaseInput,
|
|
3530
|
-
|
|
3463
|
+
{
|
|
3464
|
+
...rest,
|
|
3531
3465
|
name: field.name,
|
|
3532
3466
|
inputRef: ref,
|
|
3533
3467
|
error: Boolean(error),
|
|
3534
3468
|
helperText: error
|
|
3535
|
-
}
|
|
3469
|
+
}
|
|
3536
3470
|
);
|
|
3537
3471
|
});
|
|
3538
3472
|
}
|
|
@@ -3547,70 +3481,58 @@ function FormikInputMask(_a) {
|
|
|
3547
3481
|
|
|
3548
3482
|
|
|
3549
3483
|
var CustomInputLabel = _material.InputLabel;
|
|
3550
|
-
function Select(
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
else return /* @__PURE__ */ React2.default.createElement(BaseSelect, __spreadValues({}, rest));
|
|
3484
|
+
function Select({ withFormik = true, ...rest }) {
|
|
3485
|
+
if (withFormik) return /* @__PURE__ */ React2.default.createElement(FormikSelect, { ...rest });
|
|
3486
|
+
else return /* @__PURE__ */ React2.default.createElement(BaseSelect, { ...rest });
|
|
3554
3487
|
}
|
|
3555
|
-
function BaseSelect(
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
"label",
|
|
3565
|
-
"children",
|
|
3566
|
-
"FormControlProps",
|
|
3567
|
-
"InputLabelProps"
|
|
3568
|
-
]);
|
|
3569
|
-
return /* @__PURE__ */ React2.default.createElement(_material.FormControl, __spreadValues({ fullWidth: true }, FormControlProps2), /* @__PURE__ */ React2.default.createElement(CustomInputLabel, __spreadValues({}, InputLabelProps2), label), /* @__PURE__ */ React2.default.createElement(
|
|
3488
|
+
function BaseSelect({
|
|
3489
|
+
name,
|
|
3490
|
+
label,
|
|
3491
|
+
children,
|
|
3492
|
+
FormControlProps: FormControlProps2,
|
|
3493
|
+
InputLabelProps: InputLabelProps2,
|
|
3494
|
+
...rest
|
|
3495
|
+
}) {
|
|
3496
|
+
return /* @__PURE__ */ React2.default.createElement(_material.FormControl, { fullWidth: true, ...FormControlProps2 }, /* @__PURE__ */ React2.default.createElement(CustomInputLabel, { ...InputLabelProps2 }, label), /* @__PURE__ */ React2.default.createElement(
|
|
3570
3497
|
_material.Select,
|
|
3571
|
-
|
|
3498
|
+
{
|
|
3572
3499
|
name,
|
|
3573
3500
|
inputProps: {
|
|
3574
3501
|
name
|
|
3575
3502
|
},
|
|
3576
|
-
label
|
|
3577
|
-
|
|
3503
|
+
label,
|
|
3504
|
+
...rest
|
|
3505
|
+
},
|
|
3578
3506
|
children
|
|
3579
3507
|
));
|
|
3580
3508
|
}
|
|
3581
|
-
function FormikSelect(
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
"label",
|
|
3592
|
-
"children",
|
|
3593
|
-
"FormControlProps",
|
|
3594
|
-
"InputLabelProps",
|
|
3595
|
-
"helperText"
|
|
3596
|
-
]);
|
|
3597
|
-
const [_a2, ..._b2] = _formik.useField.call(void 0, { name }), _c = _a2, { value } = _c, field = __objRest(_c, ["value"]), [meta, { setValue }] = _b2;
|
|
3509
|
+
function FormikSelect({
|
|
3510
|
+
name,
|
|
3511
|
+
label,
|
|
3512
|
+
children,
|
|
3513
|
+
FormControlProps: FormControlProps2,
|
|
3514
|
+
InputLabelProps: InputLabelProps2,
|
|
3515
|
+
helperText,
|
|
3516
|
+
...rest
|
|
3517
|
+
}) {
|
|
3518
|
+
const [{ value, ...field }, meta, { setValue }] = _formik.useField.call(void 0, { name });
|
|
3598
3519
|
const onChange = (_, { props: { value: value2 } }) => {
|
|
3599
3520
|
setValue(value2);
|
|
3600
3521
|
};
|
|
3601
|
-
return /* @__PURE__ */ React2.default.createElement(_material.FormControl,
|
|
3522
|
+
return /* @__PURE__ */ React2.default.createElement(_material.FormControl, { fullWidth: true, ...FormControlProps2, error: Boolean(_optionalChain([meta, 'optionalAccess', _48 => _48.error])) }, /* @__PURE__ */ React2.default.createElement(CustomInputLabel, { ...InputLabelProps2 }, label), /* @__PURE__ */ React2.default.createElement(
|
|
3602
3523
|
_material.Select,
|
|
3603
|
-
|
|
3524
|
+
{
|
|
3604
3525
|
inputProps: {
|
|
3605
3526
|
name
|
|
3606
3527
|
},
|
|
3607
|
-
label
|
|
3608
|
-
|
|
3528
|
+
label,
|
|
3529
|
+
...rest,
|
|
3530
|
+
...field,
|
|
3609
3531
|
defaultValue: value,
|
|
3610
3532
|
onChange
|
|
3611
|
-
}
|
|
3533
|
+
},
|
|
3612
3534
|
children
|
|
3613
|
-
), /* @__PURE__ */ React2.default.createElement(_material.FormHelperText, null, helperText || (meta
|
|
3535
|
+
), /* @__PURE__ */ React2.default.createElement(_material.FormHelperText, null, helperText || _optionalChain([meta, 'optionalAccess', _49 => _49.error])));
|
|
3614
3536
|
}
|
|
3615
3537
|
|
|
3616
3538
|
// src/components/Autocomplete/index.tsx
|
|
@@ -3626,70 +3548,65 @@ function FormikSelect(_a) {
|
|
|
3626
3548
|
|
|
3627
3549
|
|
|
3628
3550
|
var _styles = require('@mui/material/styles');
|
|
3629
|
-
function Autocomplete2(
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
"withFormik",
|
|
3636
|
-
"name",
|
|
3637
|
-
"getOptionValue"
|
|
3638
|
-
]);
|
|
3551
|
+
function Autocomplete2({
|
|
3552
|
+
withFormik = true,
|
|
3553
|
+
name,
|
|
3554
|
+
getOptionValue,
|
|
3555
|
+
...rest
|
|
3556
|
+
}) {
|
|
3639
3557
|
if (withFormik) {
|
|
3640
3558
|
const theme = _styles.useTheme.call(void 0, );
|
|
3641
3559
|
const isLegacyBehaviorDisabledTheme = _react.useMemo.call(void 0, () => {
|
|
3642
|
-
|
|
3643
|
-
return ((_c = (_b2 = (_a2 = theme.components) == null ? void 0 : _a2.MuiAutocomplete) == null ? void 0 : _b2.defaultProps) == null ? void 0 : _c["data-legacy-behavior"]) === "disabled";
|
|
3560
|
+
return _optionalChain([theme, 'access', _50 => _50.components, 'optionalAccess', _51 => _51.MuiAutocomplete, 'optionalAccess', _52 => _52.defaultProps, 'optionalAccess', _53 => _53["data-legacy-behavior"]]) === "disabled";
|
|
3644
3561
|
}, [theme]);
|
|
3645
|
-
const isLegacyBehaviorDisabled = typeof (rest
|
|
3562
|
+
const isLegacyBehaviorDisabled = typeof _optionalChain([rest, 'optionalAccess', _54 => _54["data-legacy-behavior"]]) !== "undefined" ? rest["data-legacy-behavior"] === "disabled" : isLegacyBehaviorDisabledTheme;
|
|
3646
3563
|
if (isLegacyBehaviorDisabled)
|
|
3647
3564
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3648
3565
|
FormikAutocomplete,
|
|
3649
|
-
|
|
3566
|
+
{
|
|
3650
3567
|
name,
|
|
3651
|
-
getOptionValue
|
|
3652
|
-
|
|
3568
|
+
getOptionValue,
|
|
3569
|
+
...rest
|
|
3570
|
+
}
|
|
3653
3571
|
);
|
|
3654
3572
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3655
3573
|
FormikAutocompleteLegacy,
|
|
3656
|
-
|
|
3574
|
+
{
|
|
3657
3575
|
name,
|
|
3658
|
-
getOptionValue
|
|
3659
|
-
|
|
3576
|
+
getOptionValue,
|
|
3577
|
+
...rest
|
|
3578
|
+
}
|
|
3660
3579
|
);
|
|
3661
3580
|
}
|
|
3662
|
-
return /* @__PURE__ */ React2.default.createElement(BaseInput2,
|
|
3581
|
+
return /* @__PURE__ */ React2.default.createElement(BaseInput2, { ...rest });
|
|
3663
3582
|
}
|
|
3664
3583
|
function BaseInput2(props) {
|
|
3665
3584
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3666
3585
|
_material.Autocomplete,
|
|
3667
|
-
|
|
3586
|
+
{
|
|
3668
3587
|
fullWidth: true,
|
|
3669
|
-
renderInput: (params) => /* @__PURE__ */ React2.default.createElement(_material.TextField,
|
|
3670
|
-
|
|
3588
|
+
renderInput: (params) => /* @__PURE__ */ React2.default.createElement(_material.TextField, { label: props.label, ...params }),
|
|
3589
|
+
...props
|
|
3590
|
+
}
|
|
3671
3591
|
);
|
|
3672
3592
|
}
|
|
3673
|
-
function FormikAutocompleteLegacy(
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
"option"
|
|
3680
|
-
]);
|
|
3681
|
-
const [_a2, ..._b2] = _formik.useField.call(void 0, {
|
|
3593
|
+
function FormikAutocompleteLegacy({
|
|
3594
|
+
getOptionValue,
|
|
3595
|
+
option,
|
|
3596
|
+
...props
|
|
3597
|
+
}) {
|
|
3598
|
+
const [{ value, ...field }, meta, { setValue }] = _formik.useField.call(void 0, {
|
|
3682
3599
|
name: props.name
|
|
3683
|
-
})
|
|
3600
|
+
});
|
|
3684
3601
|
const [defaultOption] = _react.useState.call(void 0, () => {
|
|
3685
|
-
const key = option
|
|
3602
|
+
const key = _optionalChain([option, 'optionalAccess', _55 => _55.key]);
|
|
3686
3603
|
if (key) return props.options.find((option2) => option2[key] === value);
|
|
3687
3604
|
return props.options.find(
|
|
3688
3605
|
(option2) => Object.values(option2)[0] === value
|
|
3689
3606
|
);
|
|
3690
3607
|
});
|
|
3691
3608
|
const onChange = (_, newValue) => {
|
|
3692
|
-
const value2 = option
|
|
3609
|
+
const value2 = _optionalChain([option, 'optionalAccess', _56 => _56.value]);
|
|
3693
3610
|
if (getOptionValue) {
|
|
3694
3611
|
setValue(getOptionValue(newValue));
|
|
3695
3612
|
} else if (value2) {
|
|
@@ -3697,54 +3614,55 @@ function FormikAutocompleteLegacy(_a) {
|
|
|
3697
3614
|
} else setValue(newValue);
|
|
3698
3615
|
};
|
|
3699
3616
|
const getOptionLabel = (item) => {
|
|
3700
|
-
if (props
|
|
3701
|
-
if (option
|
|
3617
|
+
if (_optionalChain([props, 'optionalAccess', _57 => _57.getOptionLabel])) return props.getOptionLabel(item);
|
|
3618
|
+
if (_optionalChain([option, 'optionalAccess', _58 => _58.label])) return String(item[option.label]);
|
|
3702
3619
|
return "[getOptionLabel] error";
|
|
3703
3620
|
};
|
|
3704
3621
|
const isOptionEqualToValue = (a, b) => {
|
|
3705
|
-
const key = option
|
|
3706
|
-
if (props
|
|
3622
|
+
const key = _optionalChain([option, 'optionalAccess', _59 => _59.key]);
|
|
3623
|
+
if (_optionalChain([props, 'optionalAccess', _60 => _60.isOptionEqualToValue])) return props.isOptionEqualToValue(a, b);
|
|
3707
3624
|
if (key) return a[key] === b[key];
|
|
3708
3625
|
return Object.values(a)[0] === Object.values(b)[0];
|
|
3709
3626
|
};
|
|
3710
3627
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3711
3628
|
_material.Autocomplete,
|
|
3712
|
-
|
|
3629
|
+
{
|
|
3713
3630
|
getOptionLabel,
|
|
3714
3631
|
renderInput: (params) => /* @__PURE__ */ React2.default.createElement(
|
|
3715
3632
|
_material.TextField,
|
|
3716
|
-
|
|
3717
|
-
error: Boolean(meta
|
|
3718
|
-
helperText: meta
|
|
3719
|
-
|
|
3720
|
-
|
|
3633
|
+
{
|
|
3634
|
+
error: Boolean(_optionalChain([meta, 'optionalAccess', _61 => _61.error])),
|
|
3635
|
+
helperText: _optionalChain([meta, 'optionalAccess', _62 => _62.error]),
|
|
3636
|
+
...params,
|
|
3637
|
+
...field,
|
|
3638
|
+
InputProps: {
|
|
3639
|
+
...params.InputProps,
|
|
3721
3640
|
endAdornment: /* @__PURE__ */ React2.default.createElement(_react.Fragment, null, props.loading ? /* @__PURE__ */ React2.default.createElement(_material.CircularProgress, { color: "inherit", size: 20 }) : null, params.InputProps.endAdornment)
|
|
3722
|
-
}
|
|
3641
|
+
},
|
|
3723
3642
|
label: props.label,
|
|
3724
3643
|
required: props.required,
|
|
3725
|
-
autoFocus: props.autoFocus
|
|
3726
|
-
|
|
3644
|
+
autoFocus: props.autoFocus,
|
|
3645
|
+
...props.textFieldProps
|
|
3646
|
+
}
|
|
3727
3647
|
),
|
|
3728
3648
|
defaultValue: defaultOption || null,
|
|
3729
3649
|
onChange,
|
|
3730
|
-
isOptionEqualToValue
|
|
3731
|
-
|
|
3650
|
+
isOptionEqualToValue,
|
|
3651
|
+
...props
|
|
3652
|
+
}
|
|
3732
3653
|
);
|
|
3733
3654
|
}
|
|
3734
|
-
function FormikAutocomplete(
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
"option"
|
|
3741
|
-
]);
|
|
3742
|
-
const [_a2, ..._b2] = _formik.useField.call(void 0, {
|
|
3655
|
+
function FormikAutocomplete({
|
|
3656
|
+
getOptionValue,
|
|
3657
|
+
option,
|
|
3658
|
+
...props
|
|
3659
|
+
}) {
|
|
3660
|
+
const [{ value, ...field }, meta, { setValue }] = _formik.useField.call(void 0, {
|
|
3743
3661
|
name: props.name
|
|
3744
|
-
})
|
|
3662
|
+
});
|
|
3745
3663
|
const [defaultValue] = _react.useState.call(void 0, value);
|
|
3746
3664
|
const onChange = (_, newValue) => {
|
|
3747
|
-
const value2 = option
|
|
3665
|
+
const value2 = _optionalChain([option, 'optionalAccess', _63 => _63.value]);
|
|
3748
3666
|
if (getOptionValue) {
|
|
3749
3667
|
setValue(getOptionValue(newValue));
|
|
3750
3668
|
} else if (value2) {
|
|
@@ -3753,24 +3671,28 @@ function FormikAutocomplete(_a) {
|
|
|
3753
3671
|
};
|
|
3754
3672
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3755
3673
|
_material.Autocomplete,
|
|
3756
|
-
|
|
3674
|
+
{
|
|
3757
3675
|
renderInput: (params) => /* @__PURE__ */ React2.default.createElement(
|
|
3758
3676
|
_material.TextField,
|
|
3759
|
-
|
|
3760
|
-
error: Boolean(meta
|
|
3761
|
-
helperText: meta
|
|
3762
|
-
|
|
3763
|
-
|
|
3677
|
+
{
|
|
3678
|
+
error: Boolean(_optionalChain([meta, 'optionalAccess', _64 => _64.error])),
|
|
3679
|
+
helperText: _optionalChain([meta, 'optionalAccess', _65 => _65.error]),
|
|
3680
|
+
...params,
|
|
3681
|
+
...field,
|
|
3682
|
+
InputProps: {
|
|
3683
|
+
...params.InputProps,
|
|
3764
3684
|
endAdornment: /* @__PURE__ */ React2.default.createElement(_react.Fragment, null, props.loading ? /* @__PURE__ */ React2.default.createElement(_material.CircularProgress, { color: "inherit", size: 20 }) : null, params.InputProps.endAdornment)
|
|
3765
|
-
}
|
|
3685
|
+
},
|
|
3766
3686
|
label: props.label,
|
|
3767
3687
|
required: props.required,
|
|
3768
|
-
autoFocus: props.autoFocus
|
|
3769
|
-
|
|
3688
|
+
autoFocus: props.autoFocus,
|
|
3689
|
+
...props.textFieldProps
|
|
3690
|
+
}
|
|
3770
3691
|
),
|
|
3771
3692
|
defaultValue,
|
|
3772
|
-
onChange
|
|
3773
|
-
|
|
3693
|
+
onChange,
|
|
3694
|
+
...props
|
|
3695
|
+
}
|
|
3774
3696
|
);
|
|
3775
3697
|
}
|
|
3776
3698
|
|
|
@@ -3781,57 +3703,49 @@ function FormikAutocomplete(_a) {
|
|
|
3781
3703
|
|
|
3782
3704
|
|
|
3783
3705
|
|
|
3784
|
-
var Checkbox = (
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
]);
|
|
3792
|
-
if (withFormik && name) return /* @__PURE__ */ React2.default.createElement(FormikCheckbox, __spreadValues({ name }, props));
|
|
3793
|
-
else return /* @__PURE__ */ React2.default.createElement(BaseCheckbox, __spreadValues({}, props));
|
|
3706
|
+
var Checkbox = ({
|
|
3707
|
+
withFormik = true,
|
|
3708
|
+
name,
|
|
3709
|
+
...props
|
|
3710
|
+
}) => {
|
|
3711
|
+
if (withFormik && name) return /* @__PURE__ */ React2.default.createElement(FormikCheckbox, { name, ...props });
|
|
3712
|
+
else return /* @__PURE__ */ React2.default.createElement(BaseCheckbox, { ...props });
|
|
3794
3713
|
};
|
|
3795
|
-
var BaseCheckbox = (
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
"label",
|
|
3801
|
-
"FormControlLabelProps"
|
|
3802
|
-
]);
|
|
3714
|
+
var BaseCheckbox = ({
|
|
3715
|
+
label,
|
|
3716
|
+
FormControlLabelProps: FormControlLabelProps3,
|
|
3717
|
+
...props
|
|
3718
|
+
}) => {
|
|
3803
3719
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3804
3720
|
_material.FormControlLabel,
|
|
3805
|
-
|
|
3721
|
+
{
|
|
3806
3722
|
label,
|
|
3807
|
-
control: /* @__PURE__ */ React2.default.createElement(_material.Checkbox,
|
|
3808
|
-
|
|
3723
|
+
control: /* @__PURE__ */ React2.default.createElement(_material.Checkbox, { ...props }),
|
|
3724
|
+
...FormControlLabelProps3
|
|
3725
|
+
}
|
|
3809
3726
|
);
|
|
3810
3727
|
};
|
|
3811
|
-
var FormikCheckbox = (
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
"name",
|
|
3819
|
-
"FormControlLabelProps"
|
|
3820
|
-
]);
|
|
3821
|
-
const [_a2, ..._b2] = _formik.useField.call(void 0, {
|
|
3728
|
+
var FormikCheckbox = ({
|
|
3729
|
+
label,
|
|
3730
|
+
name,
|
|
3731
|
+
FormControlLabelProps: FormControlLabelProps3,
|
|
3732
|
+
...props
|
|
3733
|
+
}) => {
|
|
3734
|
+
const [{ value, ...field }, , { setValue }] = _formik.useField.call(void 0, {
|
|
3822
3735
|
name
|
|
3823
|
-
})
|
|
3736
|
+
});
|
|
3824
3737
|
const onChange = (_, value2) => {
|
|
3825
3738
|
setValue(value2);
|
|
3826
3739
|
};
|
|
3827
3740
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3828
3741
|
_material.FormControlLabel,
|
|
3829
|
-
|
|
3742
|
+
{
|
|
3830
3743
|
label,
|
|
3831
|
-
control: /* @__PURE__ */ React2.default.createElement(_material.Checkbox,
|
|
3832
|
-
|
|
3833
|
-
onChange
|
|
3834
|
-
|
|
3744
|
+
control: /* @__PURE__ */ React2.default.createElement(_material.Checkbox, { ...props, defaultChecked: Boolean(value) }),
|
|
3745
|
+
...field,
|
|
3746
|
+
onChange,
|
|
3747
|
+
...FormControlLabelProps3
|
|
3748
|
+
}
|
|
3835
3749
|
);
|
|
3836
3750
|
};
|
|
3837
3751
|
|
|
@@ -3842,50 +3756,45 @@ var FormikCheckbox = (_a) => {
|
|
|
3842
3756
|
|
|
3843
3757
|
|
|
3844
3758
|
|
|
3845
|
-
var Switch = (
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
else return /* @__PURE__ */ React2.default.createElement(BaseSwitch, __spreadValues({}, props));
|
|
3759
|
+
var Switch = ({ withFormik = true, name, ...props }) => {
|
|
3760
|
+
if (withFormik && name) return /* @__PURE__ */ React2.default.createElement(FormikSwitch, { name, ...props });
|
|
3761
|
+
else return /* @__PURE__ */ React2.default.createElement(BaseSwitch, { ...props });
|
|
3849
3762
|
};
|
|
3850
|
-
var BaseSwitch = (
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
"label",
|
|
3856
|
-
"FormControlLabelProps"
|
|
3857
|
-
]);
|
|
3763
|
+
var BaseSwitch = ({
|
|
3764
|
+
label,
|
|
3765
|
+
FormControlLabelProps: FormControlLabelProps3,
|
|
3766
|
+
...props
|
|
3767
|
+
}) => {
|
|
3858
3768
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3859
3769
|
_material.FormControlLabel,
|
|
3860
|
-
|
|
3770
|
+
{
|
|
3861
3771
|
label,
|
|
3862
|
-
control: /* @__PURE__ */ React2.default.createElement(_material.Switch,
|
|
3863
|
-
|
|
3772
|
+
control: /* @__PURE__ */ React2.default.createElement(_material.Switch, { ...props }),
|
|
3773
|
+
...FormControlLabelProps3
|
|
3774
|
+
}
|
|
3864
3775
|
);
|
|
3865
3776
|
};
|
|
3866
|
-
var FormikSwitch = (
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
"name",
|
|
3874
|
-
"FormControlLabelProps"
|
|
3875
|
-
]);
|
|
3876
|
-
const [_a2, ..._b2] = _formik.useField.call(void 0, {
|
|
3777
|
+
var FormikSwitch = ({
|
|
3778
|
+
label,
|
|
3779
|
+
name,
|
|
3780
|
+
FormControlLabelProps: FormControlLabelProps3,
|
|
3781
|
+
...props
|
|
3782
|
+
}) => {
|
|
3783
|
+
const [{ value, onChange: unused, ...field }, , { setValue }] = _formik.useField.call(void 0, {
|
|
3877
3784
|
name
|
|
3878
|
-
})
|
|
3785
|
+
});
|
|
3879
3786
|
const onChange = (_, value2) => {
|
|
3880
3787
|
setValue(value2);
|
|
3881
3788
|
};
|
|
3882
3789
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3883
3790
|
_material.FormControlLabel,
|
|
3884
|
-
|
|
3791
|
+
{
|
|
3885
3792
|
label,
|
|
3886
3793
|
onChange,
|
|
3887
|
-
control: /* @__PURE__ */ React2.default.createElement(_material.Switch,
|
|
3888
|
-
|
|
3794
|
+
control: /* @__PURE__ */ React2.default.createElement(_material.Switch, { defaultChecked: value, ...props }),
|
|
3795
|
+
...field,
|
|
3796
|
+
...FormControlLabelProps3
|
|
3797
|
+
}
|
|
3889
3798
|
);
|
|
3890
3799
|
};
|
|
3891
3800
|
|
|
@@ -3899,26 +3808,20 @@ var FormikSwitch = (_a) => {
|
|
|
3899
3808
|
|
|
3900
3809
|
|
|
3901
3810
|
|
|
3902
|
-
var Radio = (
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
]);
|
|
3910
|
-
if (withFormik && name) return /* @__PURE__ */ React2.default.createElement(FormikRadio, __spreadValues({ name }, rest));
|
|
3911
|
-
else return /* @__PURE__ */ React2.default.createElement(BaseRadio, __spreadValues({}, rest));
|
|
3811
|
+
var Radio = ({
|
|
3812
|
+
name,
|
|
3813
|
+
withFormik = true,
|
|
3814
|
+
...rest
|
|
3815
|
+
}) => {
|
|
3816
|
+
if (withFormik && name) return /* @__PURE__ */ React2.default.createElement(FormikRadio, { name, ...rest });
|
|
3817
|
+
else return /* @__PURE__ */ React2.default.createElement(BaseRadio, { ...rest });
|
|
3912
3818
|
};
|
|
3913
|
-
var BaseRadio = (
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
"options"
|
|
3920
|
-
]);
|
|
3921
|
-
return /* @__PURE__ */ React2.default.createElement(_material.FormControl, null, label && /* @__PURE__ */ React2.default.createElement(_material.FormLabel, null, label), /* @__PURE__ */ React2.default.createElement(_material.RadioGroup, __spreadValues({}, rest), options.map((option) => /* @__PURE__ */ React2.default.createElement(
|
|
3819
|
+
var BaseRadio = ({
|
|
3820
|
+
label,
|
|
3821
|
+
options,
|
|
3822
|
+
...rest
|
|
3823
|
+
}) => {
|
|
3824
|
+
return /* @__PURE__ */ React2.default.createElement(_material.FormControl, null, label && /* @__PURE__ */ React2.default.createElement(_material.FormLabel, null, label), /* @__PURE__ */ React2.default.createElement(_material.RadioGroup, { ...rest }, options.map((option) => /* @__PURE__ */ React2.default.createElement(
|
|
3922
3825
|
_material.FormControlLabel,
|
|
3923
3826
|
{
|
|
3924
3827
|
key: String(option.value),
|
|
@@ -3928,25 +3831,22 @@ var BaseRadio = (_a) => {
|
|
|
3928
3831
|
}
|
|
3929
3832
|
))));
|
|
3930
3833
|
};
|
|
3931
|
-
var FormikRadio = (
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
"label",
|
|
3938
|
-
"name",
|
|
3939
|
-
"options"
|
|
3940
|
-
]);
|
|
3834
|
+
var FormikRadio = ({
|
|
3835
|
+
label,
|
|
3836
|
+
name,
|
|
3837
|
+
options,
|
|
3838
|
+
...rest
|
|
3839
|
+
}) => {
|
|
3941
3840
|
const onChange = (setFieldValue, value) => {
|
|
3942
3841
|
setFieldValue(name, value);
|
|
3943
3842
|
};
|
|
3944
3843
|
return /* @__PURE__ */ React2.default.createElement(_formik.Field, null, ({ field: { value }, form: { setFieldValue } }) => /* @__PURE__ */ React2.default.createElement(_material.FormControl, null, label && /* @__PURE__ */ React2.default.createElement(_material.FormLabel, null, label), /* @__PURE__ */ React2.default.createElement(
|
|
3945
3844
|
_material.RadioGroup,
|
|
3946
|
-
|
|
3845
|
+
{
|
|
3947
3846
|
defaultValue: value,
|
|
3948
|
-
onChange: (_, value2) => onChange(setFieldValue, value2)
|
|
3949
|
-
|
|
3847
|
+
onChange: (_, value2) => onChange(setFieldValue, value2),
|
|
3848
|
+
...rest
|
|
3849
|
+
},
|
|
3950
3850
|
options.map((option) => /* @__PURE__ */ React2.default.createElement(
|
|
3951
3851
|
_material.FormControlLabel,
|
|
3952
3852
|
{
|
|
@@ -3965,32 +3865,29 @@ var FormikRadio = (_a) => {
|
|
|
3965
3865
|
|
|
3966
3866
|
|
|
3967
3867
|
|
|
3968
|
-
var LargeButton = (
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
"loading",
|
|
3976
|
-
"children",
|
|
3977
|
-
"CircularProgressProps",
|
|
3978
|
-
"sx"
|
|
3979
|
-
]);
|
|
3868
|
+
var LargeButton = ({
|
|
3869
|
+
loading,
|
|
3870
|
+
children,
|
|
3871
|
+
CircularProgressProps: CircularProgressProps2,
|
|
3872
|
+
sx,
|
|
3873
|
+
...rest
|
|
3874
|
+
}) => {
|
|
3980
3875
|
return /* @__PURE__ */ React2.default.createElement(
|
|
3981
3876
|
_material.Button,
|
|
3982
|
-
|
|
3877
|
+
{
|
|
3983
3878
|
variant: "contained",
|
|
3984
3879
|
fullWidth: true,
|
|
3985
|
-
sx:
|
|
3986
|
-
disabled: rest.disabled || loading
|
|
3987
|
-
|
|
3880
|
+
sx: { fontWeight: "bold", ...sx },
|
|
3881
|
+
disabled: rest.disabled || loading,
|
|
3882
|
+
...rest
|
|
3883
|
+
},
|
|
3988
3884
|
loading ? /* @__PURE__ */ React2.default.createElement(
|
|
3989
3885
|
_material.CircularProgress,
|
|
3990
|
-
|
|
3886
|
+
{
|
|
3991
3887
|
size: 25,
|
|
3992
|
-
color: "inherit"
|
|
3993
|
-
|
|
3888
|
+
color: "inherit",
|
|
3889
|
+
...CircularProgressProps2
|
|
3890
|
+
}
|
|
3994
3891
|
) : children
|
|
3995
3892
|
);
|
|
3996
3893
|
};
|
|
@@ -4004,15 +3901,16 @@ function getTabProps(index) {
|
|
|
4004
3901
|
};
|
|
4005
3902
|
}
|
|
4006
3903
|
var TabPanel = (props) => {
|
|
4007
|
-
const
|
|
3904
|
+
const { children, value, index, ...other } = props;
|
|
4008
3905
|
return /* @__PURE__ */ React2.default.createElement(
|
|
4009
3906
|
"div",
|
|
4010
|
-
|
|
3907
|
+
{
|
|
4011
3908
|
role: "tabpanel",
|
|
4012
3909
|
hidden: value !== index,
|
|
4013
3910
|
id: `tabpanel-${index}`,
|
|
4014
|
-
"aria-labelledby": `tab-${index}
|
|
4015
|
-
|
|
3911
|
+
"aria-labelledby": `tab-${index}`,
|
|
3912
|
+
...other
|
|
3913
|
+
},
|
|
4016
3914
|
value === index && /* @__PURE__ */ React2.default.createElement(React2.default.Fragment, null, children)
|
|
4017
3915
|
);
|
|
4018
3916
|
};
|
|
@@ -4158,48 +4056,56 @@ function BaseGrid({
|
|
|
4158
4056
|
}) {
|
|
4159
4057
|
return /* @__PURE__ */ React2.default.createElement(
|
|
4160
4058
|
_material.Paper,
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4059
|
+
{
|
|
4060
|
+
...paperProps,
|
|
4061
|
+
sx: {
|
|
4062
|
+
...styles.rowGap(dense),
|
|
4063
|
+
...styles.bordered(bordered),
|
|
4064
|
+
...styles.striped(striped),
|
|
4065
|
+
...styles.lastRowBorder(hideFooter),
|
|
4066
|
+
..._optionalChain([paperProps, 'optionalAccess', _66 => _66.sx])
|
|
4067
|
+
}
|
|
4068
|
+
},
|
|
4164
4069
|
/* @__PURE__ */ React2.default.createElement(
|
|
4165
4070
|
_material.Box,
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4071
|
+
{
|
|
4072
|
+
...boxContainerProps,
|
|
4073
|
+
sx: { overflowX: "auto", ..._optionalChain([boxContainerProps, 'optionalAccess', _67 => _67.sx]) }
|
|
4074
|
+
},
|
|
4169
4075
|
/* @__PURE__ */ React2.default.createElement(
|
|
4170
4076
|
_material.Table,
|
|
4171
|
-
|
|
4077
|
+
{
|
|
4172
4078
|
size: "small",
|
|
4173
|
-
stickyHeader: true
|
|
4174
|
-
|
|
4175
|
-
sx:
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
}
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
}
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
)
|
|
4202
|
-
|
|
4079
|
+
stickyHeader: true,
|
|
4080
|
+
...tableProps,
|
|
4081
|
+
sx: {
|
|
4082
|
+
..._optionalChain([tableProps, 'optionalAccess', _68 => _68.sx])
|
|
4083
|
+
}
|
|
4084
|
+
},
|
|
4085
|
+
/* @__PURE__ */ React2.default.createElement(_material.TableHead, { ...tableHeadProps }, /* @__PURE__ */ React2.default.createElement(_material.TableRow, null, prependColumn, columns.map((column) => /* @__PURE__ */ React2.default.createElement(
|
|
4086
|
+
_material.TableCell,
|
|
4087
|
+
{
|
|
4088
|
+
key: column.name,
|
|
4089
|
+
padding: dense ? "none" : "normal",
|
|
4090
|
+
...column.props,
|
|
4091
|
+
sx: {
|
|
4092
|
+
pl: 2,
|
|
4093
|
+
..._optionalChain([column, 'optionalAccess', _69 => _69.sx])
|
|
4094
|
+
}
|
|
4095
|
+
},
|
|
4096
|
+
column.children ? column.children : /* @__PURE__ */ React2.default.createElement(
|
|
4097
|
+
_material.TableSortLabel,
|
|
4098
|
+
{
|
|
4099
|
+
active: sortedBy.some((p) => p.prop === column.name),
|
|
4100
|
+
direction: _optionalChain([sortedBy, 'access', _70 => _70.find, 'call', _71 => _71((p) => p.prop === column.name), 'optionalAccess', _72 => _72.direction]) || "desc",
|
|
4101
|
+
onClick: () => onSortBy(column.name),
|
|
4102
|
+
disabled: column.canSort === false,
|
|
4103
|
+
...tableSortLabelProps,
|
|
4104
|
+
sx: { ..._optionalChain([tableSortLabelProps, 'optionalAccess', _73 => _73.sx]) }
|
|
4105
|
+
},
|
|
4106
|
+
column.label
|
|
4107
|
+
)
|
|
4108
|
+
)), appendColumn), isLoading && /* @__PURE__ */ React2.default.createElement(_material.TableRow, null, /* @__PURE__ */ React2.default.createElement(
|
|
4203
4109
|
_material.TableCell,
|
|
4204
4110
|
{
|
|
4205
4111
|
colSpan: loadingColSpan || columns.length,
|
|
@@ -4207,7 +4113,7 @@ function BaseGrid({
|
|
|
4207
4113
|
},
|
|
4208
4114
|
/* @__PURE__ */ React2.default.createElement(_material.LinearProgress, null)
|
|
4209
4115
|
))),
|
|
4210
|
-
/* @__PURE__ */ React2.default.createElement(_material.TableBody,
|
|
4116
|
+
/* @__PURE__ */ React2.default.createElement(_material.TableBody, { ...tableBodyProps }, children)
|
|
4211
4117
|
)
|
|
4212
4118
|
),
|
|
4213
4119
|
!hideFooter && /* @__PURE__ */ React2.default.createElement(
|
|
@@ -4243,21 +4149,22 @@ function BaseGridAutoRows({
|
|
|
4243
4149
|
|
|
4244
4150
|
|
|
4245
4151
|
|
|
4246
|
-
var Modal = (
|
|
4247
|
-
|
|
4248
|
-
return /* @__PURE__ */ React2.default.createElement(_material.Modal, __spreadValues({ open, onClose }, rest), /* @__PURE__ */ React2.default.createElement(
|
|
4152
|
+
var Modal = ({ open, onClose, BoxProps: BoxProps3, ...rest }) => {
|
|
4153
|
+
return /* @__PURE__ */ React2.default.createElement(_material.Modal, { open, onClose, ...rest }, /* @__PURE__ */ React2.default.createElement(
|
|
4249
4154
|
_material.Box,
|
|
4250
|
-
|
|
4251
|
-
|
|
4155
|
+
{
|
|
4156
|
+
...BoxProps3,
|
|
4157
|
+
sx: {
|
|
4252
4158
|
outline: "none",
|
|
4253
4159
|
backgroundColor: "background.paper",
|
|
4254
4160
|
position: "absolute",
|
|
4255
4161
|
top: "50%",
|
|
4256
4162
|
left: "50%",
|
|
4257
4163
|
transform: "translate(-50%, -50%)",
|
|
4258
|
-
borderRadius: 1
|
|
4259
|
-
|
|
4260
|
-
|
|
4164
|
+
borderRadius: 1,
|
|
4165
|
+
..._optionalChain([BoxProps3, 'optionalAccess', _74 => _74.sx])
|
|
4166
|
+
}
|
|
4167
|
+
},
|
|
4261
4168
|
rest.children
|
|
4262
4169
|
));
|
|
4263
4170
|
};
|
|
@@ -4281,21 +4188,15 @@ function GetInputLabel(columns) {
|
|
|
4281
4188
|
|
|
4282
4189
|
|
|
4283
4190
|
|
|
4284
|
-
var Dialog = (
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
"title",
|
|
4294
|
-
"loading",
|
|
4295
|
-
"body",
|
|
4296
|
-
"options"
|
|
4297
|
-
]);
|
|
4298
|
-
return /* @__PURE__ */ React2.default.createElement(_material.Dialog, __spreadValues({ open }, rest), /* @__PURE__ */ React2.default.createElement(_material.Box, { sx: { p: 2 } }, /* @__PURE__ */ React2.default.createElement(_material.DialogTitle, { sx: { fontWeight: "bold" } }, title), /* @__PURE__ */ React2.default.createElement(_material.DialogContentText, { sx: { px: "10px", textAlign: "center", mb: 2 } }, body), /* @__PURE__ */ React2.default.createElement(_material.DialogActions, null, options.map((option, index) => {
|
|
4191
|
+
var Dialog = ({
|
|
4192
|
+
open,
|
|
4193
|
+
title,
|
|
4194
|
+
loading,
|
|
4195
|
+
body,
|
|
4196
|
+
options,
|
|
4197
|
+
...rest
|
|
4198
|
+
}) => {
|
|
4199
|
+
return /* @__PURE__ */ React2.default.createElement(_material.Dialog, { open, ...rest }, /* @__PURE__ */ React2.default.createElement(_material.Box, { sx: { p: 2 } }, /* @__PURE__ */ React2.default.createElement(_material.DialogTitle, { sx: { fontWeight: "bold" } }, title), /* @__PURE__ */ React2.default.createElement(_material.DialogContentText, { sx: { px: "10px", textAlign: "center", mb: 2 } }, body), /* @__PURE__ */ React2.default.createElement(_material.DialogActions, null, options.map((option, index) => {
|
|
4299
4200
|
return /* @__PURE__ */ React2.default.createElement(
|
|
4300
4201
|
_material.Button,
|
|
4301
4202
|
{
|
|
@@ -4325,31 +4226,31 @@ var _colors = require('@mui/material/colors');
|
|
|
4325
4226
|
function UseDialogConfirm() {
|
|
4326
4227
|
const [opened, setOpened] = _react.useState.call(void 0, false);
|
|
4327
4228
|
const [isLoading, setLoading] = _react.useState.call(void 0, false);
|
|
4328
|
-
const onConfirmFn = _react.useRef.call(void 0, () =>
|
|
4329
|
-
})
|
|
4229
|
+
const onConfirmFn = _react.useRef.call(void 0, async () => {
|
|
4230
|
+
});
|
|
4330
4231
|
const paramsFn = _react.useRef.call(void 0, []);
|
|
4331
4232
|
const onConfirm = (fn) => {
|
|
4332
4233
|
onConfirmFn.current = fn;
|
|
4333
|
-
return (...params) =>
|
|
4234
|
+
return async (...params) => {
|
|
4334
4235
|
paramsFn.current = params;
|
|
4335
4236
|
setOpened(true);
|
|
4336
|
-
}
|
|
4237
|
+
};
|
|
4337
4238
|
};
|
|
4338
|
-
const onProceed = (event) =>
|
|
4339
|
-
event
|
|
4340
|
-
event
|
|
4239
|
+
const onProceed = async (event) => {
|
|
4240
|
+
_optionalChain([event, 'optionalAccess', _75 => _75.preventDefault, 'call', _76 => _76()]);
|
|
4241
|
+
_optionalChain([event, 'optionalAccess', _77 => _77.stopPropagation, 'call', _78 => _78()]);
|
|
4341
4242
|
setLoading(true);
|
|
4342
4243
|
try {
|
|
4343
4244
|
if (!onConfirmFn.current) return;
|
|
4344
|
-
|
|
4245
|
+
await onConfirmFn.current(...paramsFn.current);
|
|
4345
4246
|
} finally {
|
|
4346
4247
|
setOpened(false);
|
|
4347
4248
|
setLoading(false);
|
|
4348
4249
|
}
|
|
4349
|
-
}
|
|
4250
|
+
};
|
|
4350
4251
|
const onCancel = (event) => {
|
|
4351
|
-
event
|
|
4352
|
-
event
|
|
4252
|
+
_optionalChain([event, 'optionalAccess', _79 => _79.preventDefault, 'call', _80 => _80()]);
|
|
4253
|
+
_optionalChain([event, 'optionalAccess', _81 => _81.stopPropagation, 'call', _82 => _82()]);
|
|
4353
4254
|
setOpened(false);
|
|
4354
4255
|
};
|
|
4355
4256
|
const onCloseModal = () => {
|
|
@@ -4490,18 +4391,13 @@ function useBaseDialogInstance() {
|
|
|
4490
4391
|
|
|
4491
4392
|
|
|
4492
4393
|
|
|
4493
|
-
var BaseDialogHeader = (
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
"title",
|
|
4501
|
-
"onClose",
|
|
4502
|
-
"IconButtonProps",
|
|
4503
|
-
"TypographyProps"
|
|
4504
|
-
]);
|
|
4394
|
+
var BaseDialogHeader = ({
|
|
4395
|
+
title,
|
|
4396
|
+
onClose,
|
|
4397
|
+
IconButtonProps,
|
|
4398
|
+
TypographyProps: TypographyProps2,
|
|
4399
|
+
...props
|
|
4400
|
+
}) => {
|
|
4505
4401
|
const { name } = useBaseDialogInstance();
|
|
4506
4402
|
const { close: closeDialog } = useBaseDialog();
|
|
4507
4403
|
function handleClose() {
|
|
@@ -4510,57 +4406,54 @@ var BaseDialogHeader = (_a) => {
|
|
|
4510
4406
|
}
|
|
4511
4407
|
return /* @__PURE__ */ React2.default.createElement(
|
|
4512
4408
|
_material.Stack,
|
|
4513
|
-
|
|
4409
|
+
{
|
|
4514
4410
|
direction: "row",
|
|
4515
4411
|
alignItems: "center",
|
|
4516
4412
|
justifyContent: "space-between",
|
|
4517
4413
|
px: 2,
|
|
4518
|
-
my: 1
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
/* @__PURE__ */ React2.default.createElement(_material.
|
|
4414
|
+
my: 1,
|
|
4415
|
+
...props
|
|
4416
|
+
},
|
|
4417
|
+
/* @__PURE__ */ React2.default.createElement(_material.Typography, { variant: "h6", fontWeight: "bold", ...TypographyProps2 }, title),
|
|
4418
|
+
/* @__PURE__ */ React2.default.createElement(_material.IconButton, { ...IconButtonProps, onClick: handleClose }, /* @__PURE__ */ React2.default.createElement(_md.MdClose, null))
|
|
4522
4419
|
);
|
|
4523
4420
|
};
|
|
4524
4421
|
|
|
4525
4422
|
// src/components/BaseDialog/BaseDialog.tsx
|
|
4526
|
-
var BaseDialogContainer = (
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
"children"
|
|
4531
|
-
]);
|
|
4423
|
+
var BaseDialogContainer = ({
|
|
4424
|
+
children,
|
|
4425
|
+
...rest
|
|
4426
|
+
}) => {
|
|
4532
4427
|
const { name } = useBaseDialogInstance();
|
|
4533
4428
|
const { isOpened, close: closeDialog } = useBaseDialog();
|
|
4534
|
-
return /* @__PURE__ */ React2.default.createElement(Modal,
|
|
4429
|
+
return /* @__PURE__ */ React2.default.createElement(Modal, { open: isOpened(name), onClose: () => closeDialog(name), ...rest }, children instanceof Function ? children({ close: () => closeDialog(name) }) : children);
|
|
4535
4430
|
};
|
|
4536
4431
|
var BaseDialogBody = (props) => {
|
|
4537
|
-
return /* @__PURE__ */ React2.default.createElement(_material.Box,
|
|
4432
|
+
return /* @__PURE__ */ React2.default.createElement(_material.Box, { px: 2, pb: 2, width: "100vw", maxWidth: 650, ...props }, props.children);
|
|
4538
4433
|
};
|
|
4539
|
-
var BaseDialogTrigger = (
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
"name",
|
|
4545
|
-
"onClick"
|
|
4546
|
-
]);
|
|
4434
|
+
var BaseDialogTrigger = ({
|
|
4435
|
+
name,
|
|
4436
|
+
onClick,
|
|
4437
|
+
...props
|
|
4438
|
+
}) => {
|
|
4547
4439
|
const { open } = useBaseDialog();
|
|
4548
4440
|
return /* @__PURE__ */ React2.default.createElement(
|
|
4549
4441
|
_material.Button,
|
|
4550
|
-
|
|
4442
|
+
{
|
|
4443
|
+
...props,
|
|
4551
4444
|
onClick: (...params) => {
|
|
4552
4445
|
if (onClick) onClick(...params);
|
|
4553
4446
|
open(name);
|
|
4554
4447
|
}
|
|
4555
|
-
}
|
|
4448
|
+
},
|
|
4556
4449
|
props.children
|
|
4557
4450
|
);
|
|
4558
4451
|
};
|
|
4559
4452
|
var BaseDialogCreate = (name = /* @__PURE__ */ Symbol()) => {
|
|
4560
4453
|
return {
|
|
4561
4454
|
name,
|
|
4562
|
-
Trigger: (props) => /* @__PURE__ */ React2.default.createElement(BaseDialogTrigger,
|
|
4563
|
-
Root: (props) => /* @__PURE__ */ React2.default.createElement(BaseDialogInstanceProvider,
|
|
4455
|
+
Trigger: (props) => /* @__PURE__ */ React2.default.createElement(BaseDialogTrigger, { name, ...props }),
|
|
4456
|
+
Root: (props) => /* @__PURE__ */ React2.default.createElement(BaseDialogInstanceProvider, { name, ...props }),
|
|
4564
4457
|
Container: BaseDialogContainer,
|
|
4565
4458
|
Header: BaseDialogHeader,
|
|
4566
4459
|
Body: BaseDialogBody
|
|
@@ -4608,27 +4501,23 @@ var VALID_METHODS = [
|
|
|
4608
4501
|
"PATCH"
|
|
4609
4502
|
];
|
|
4610
4503
|
var _ApiHelper = class _ApiHelper {
|
|
4611
|
-
onFinally(req, res) {
|
|
4612
|
-
return __async(this, null, function* () {
|
|
4613
|
-
});
|
|
4504
|
+
async onFinally(req, res) {
|
|
4614
4505
|
}
|
|
4615
|
-
onError(req, res, error) {
|
|
4616
|
-
return __async(this, null, function* () {
|
|
4617
|
-
});
|
|
4506
|
+
async onError(req, res, error) {
|
|
4618
4507
|
}
|
|
4619
4508
|
constructor(props) {
|
|
4620
|
-
this.middlewares = ((props
|
|
4621
|
-
this.onFinally = (props
|
|
4622
|
-
})
|
|
4623
|
-
this.onError = (props
|
|
4624
|
-
})
|
|
4509
|
+
this.middlewares = (_optionalChain([props, 'optionalAccess', _83 => _83.middlewares]) || []).reverse();
|
|
4510
|
+
this.onFinally = _optionalChain([props, 'optionalAccess', _84 => _84.onFinally]) || (async () => {
|
|
4511
|
+
});
|
|
4512
|
+
this.onError = _optionalChain([props, 'optionalAccess', _85 => _85.onError]) || (async () => {
|
|
4513
|
+
});
|
|
4625
4514
|
}
|
|
4626
4515
|
setMiddlewares(middlewares) {
|
|
4627
4516
|
this.middlewares = middlewares.reverse();
|
|
4628
4517
|
return this;
|
|
4629
4518
|
}
|
|
4630
4519
|
createMethods(methods) {
|
|
4631
|
-
return (req, res) =>
|
|
4520
|
+
return async (req, res) => {
|
|
4632
4521
|
const currentMethod = methods[req.method] || methods.ALL;
|
|
4633
4522
|
if (req.method === "OPTIONS") return res.status(200).end();
|
|
4634
4523
|
try {
|
|
@@ -4639,7 +4528,7 @@ var _ApiHelper = class _ApiHelper {
|
|
|
4639
4528
|
(acc, fn) => fn(acc),
|
|
4640
4529
|
currentMethod
|
|
4641
4530
|
);
|
|
4642
|
-
|
|
4531
|
+
await methodWithMiddlewares(req, res);
|
|
4643
4532
|
} catch (error) {
|
|
4644
4533
|
if (error instanceof DomainError)
|
|
4645
4534
|
return res.status(400).json(error.message);
|
|
@@ -4656,9 +4545,9 @@ var _ApiHelper = class _ApiHelper {
|
|
|
4656
4545
|
this.onError(req, res, error);
|
|
4657
4546
|
throw new Error(error);
|
|
4658
4547
|
} finally {
|
|
4659
|
-
|
|
4548
|
+
await this.onFinally(req, res);
|
|
4660
4549
|
}
|
|
4661
|
-
}
|
|
4550
|
+
};
|
|
4662
4551
|
}
|
|
4663
4552
|
static parserErrorWrapper(body, parser) {
|
|
4664
4553
|
try {
|
|
@@ -4790,23 +4679,23 @@ function useFormHelper() {
|
|
|
4790
4679
|
const sourceRef = _react.useRef.call(void 0, new AbortController());
|
|
4791
4680
|
const onSubmitWrapper = _react.useCallback.call(void 0,
|
|
4792
4681
|
(fn, { name }) => {
|
|
4793
|
-
return (fields, methods) =>
|
|
4682
|
+
return async (fields, methods) => {
|
|
4794
4683
|
const LOADING_NAME = name;
|
|
4795
4684
|
setLoading(LOADING_NAME);
|
|
4796
4685
|
try {
|
|
4797
|
-
|
|
4686
|
+
await fn(fields, methods);
|
|
4798
4687
|
} catch (error) {
|
|
4799
4688
|
errorHandler(error, methods.setErrors);
|
|
4800
4689
|
} finally {
|
|
4801
4690
|
setLoading(LOADING_NAME, true);
|
|
4802
4691
|
}
|
|
4803
|
-
}
|
|
4692
|
+
};
|
|
4804
4693
|
},
|
|
4805
4694
|
[setLoading]
|
|
4806
4695
|
);
|
|
4807
4696
|
const onRequestWrapper = _react.useCallback.call(void 0,
|
|
4808
4697
|
(fn, { name }) => {
|
|
4809
|
-
return (...params) =>
|
|
4698
|
+
return async (...params) => {
|
|
4810
4699
|
const LOADING_NAME = name;
|
|
4811
4700
|
setLoading(LOADING_NAME);
|
|
4812
4701
|
api.interceptors.request.use(
|
|
@@ -4821,20 +4710,20 @@ function useFormHelper() {
|
|
|
4821
4710
|
}
|
|
4822
4711
|
);
|
|
4823
4712
|
try {
|
|
4824
|
-
const response =
|
|
4713
|
+
const response = await fn(...params);
|
|
4825
4714
|
return response;
|
|
4826
4715
|
} catch (error) {
|
|
4827
4716
|
errorHandler(error);
|
|
4828
4717
|
} finally {
|
|
4829
4718
|
setLoading(LOADING_NAME, true);
|
|
4830
4719
|
}
|
|
4831
|
-
}
|
|
4720
|
+
};
|
|
4832
4721
|
},
|
|
4833
4722
|
[setLoading, api]
|
|
4834
4723
|
);
|
|
4835
4724
|
const errorHandler = _react.useCallback.call(void 0,
|
|
4836
4725
|
(error, callback) => {
|
|
4837
|
-
if ((error
|
|
4726
|
+
if (_optionalChain([error, 'optionalAccess', _86 => _86.message]) === "cancel.navigation") return;
|
|
4838
4727
|
if (callback) {
|
|
4839
4728
|
if (error.response.data.code === "invalid.body") {
|
|
4840
4729
|
const errors = error.response.data.details.issues;
|
|
@@ -4855,10 +4744,12 @@ function useFormHelper() {
|
|
|
4855
4744
|
sourceRef.current = new AbortController();
|
|
4856
4745
|
};
|
|
4857
4746
|
}, []);
|
|
4858
|
-
return
|
|
4747
|
+
return {
|
|
4748
|
+
...alertProps,
|
|
4749
|
+
...loadingProps,
|
|
4859
4750
|
onSubmitWrapper,
|
|
4860
4751
|
onRequestWrapper
|
|
4861
|
-
}
|
|
4752
|
+
};
|
|
4862
4753
|
}
|
|
4863
4754
|
|
|
4864
4755
|
// src/helpers/authHelper.ts
|
|
@@ -4872,8 +4763,7 @@ function decodeSessionToken({
|
|
|
4872
4763
|
sessionTokenName,
|
|
4873
4764
|
validate
|
|
4874
4765
|
}) {
|
|
4875
|
-
|
|
4876
|
-
const token = ((_a = req.headers.authorization) == null ? void 0 : _a.split(" ")[1]) || req.cookies[sessionTokenName];
|
|
4766
|
+
const token = _optionalChain([req, 'access', _87 => _87.headers, 'access', _88 => _88.authorization, 'optionalAccess', _89 => _89.split, 'call', _90 => _90(" "), 'access', _91 => _91[1]]) || req.cookies[sessionTokenName];
|
|
4877
4767
|
if (!token) {
|
|
4878
4768
|
res.status(401).json({ error: "Token inv\xE1lido", code: "token.invalid" });
|
|
4879
4769
|
return true;
|
|
@@ -4903,19 +4793,19 @@ var AuthHelper = class {
|
|
|
4903
4793
|
onCreateRefreshToken,
|
|
4904
4794
|
onGetUserData
|
|
4905
4795
|
}) {
|
|
4906
|
-
this.generateJwtAndRefreshToken =
|
|
4796
|
+
this.generateJwtAndRefreshToken = async (userId, payload = {}) => {
|
|
4907
4797
|
const token = _jsonwebtoken2.default.sign(payload, process.env.JWT_SECRET, {
|
|
4908
4798
|
subject: String(userId),
|
|
4909
4799
|
expiresIn: this.tokenExpTimeInSeconds || 60 * 15
|
|
4910
4800
|
// 15 minutos
|
|
4911
4801
|
});
|
|
4912
4802
|
const uniqueToken = _uuid.v4.call(void 0, );
|
|
4913
|
-
|
|
4803
|
+
await this.onCreateRefreshToken(userId, uniqueToken);
|
|
4914
4804
|
return {
|
|
4915
4805
|
token,
|
|
4916
4806
|
refreshToken: uniqueToken
|
|
4917
4807
|
};
|
|
4918
|
-
}
|
|
4808
|
+
};
|
|
4919
4809
|
this.invalidateCookies = (res) => {
|
|
4920
4810
|
return res.setHeader("Set-Cookie", [
|
|
4921
4811
|
_cookie.serialize.call(void 0, this.cookies.sessionToken, "", {
|
|
@@ -4937,66 +4827,15 @@ var AuthHelper = class {
|
|
|
4937
4827
|
this.onCreateRefreshToken = onCreateRefreshToken;
|
|
4938
4828
|
this.onGetUserData = onGetUserData;
|
|
4939
4829
|
}
|
|
4940
|
-
handler(req, res) {
|
|
4941
|
-
return
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
{}
|
|
4949
|
-
);
|
|
4950
|
-
_nookies.setCookie.call(void 0, { res }, this.cookies.sessionToken, token, {
|
|
4951
|
-
secure: true,
|
|
4952
|
-
maxAge: 60 * 60 * 24 * 30,
|
|
4953
|
-
// 30 days
|
|
4954
|
-
path: "/",
|
|
4955
|
-
sameSite: true
|
|
4956
|
-
});
|
|
4957
|
-
_nookies.setCookie.call(void 0, { res }, this.cookies.refreshToken, refreshToken, {
|
|
4958
|
-
secure: true,
|
|
4959
|
-
maxAge: 60 * 60 * 24 * 30,
|
|
4960
|
-
// 30 days
|
|
4961
|
-
path: "/",
|
|
4962
|
-
sameSite: true,
|
|
4963
|
-
httpOnly: true
|
|
4964
|
-
});
|
|
4965
|
-
return res.json({ token, refreshToken });
|
|
4966
|
-
}
|
|
4967
|
-
throw new HttpError(400, loginResult.response);
|
|
4968
|
-
}
|
|
4969
|
-
if (req.url.endsWith("/logout")) {
|
|
4970
|
-
this.invalidateCookies(res).end();
|
|
4971
|
-
}
|
|
4972
|
-
if (req.url.endsWith("/refresh")) {
|
|
4973
|
-
const error = decodeSessionToken({
|
|
4974
|
-
req,
|
|
4975
|
-
res,
|
|
4976
|
-
sessionTokenName: this.cookies.sessionToken,
|
|
4977
|
-
validate: false
|
|
4978
|
-
});
|
|
4979
|
-
if (error) return;
|
|
4980
|
-
const userId = String(req.user);
|
|
4981
|
-
const refreshToken = _nookies.parseCookies.call(void 0, { req })[this.cookies.refreshToken];
|
|
4982
|
-
if (!refreshToken) {
|
|
4983
|
-
this.invalidateCookies(res);
|
|
4984
|
-
return res.status(400).json({
|
|
4985
|
-
error: "Refresh Token inv\xE1lido"
|
|
4986
|
-
});
|
|
4987
|
-
}
|
|
4988
|
-
const isValidRefreshToken = yield this.onValidateRefreshToken(
|
|
4989
|
-
userId,
|
|
4990
|
-
refreshToken
|
|
4830
|
+
async handler(req, res) {
|
|
4831
|
+
if (!req.url) return res.status(400).json({ error: "url not sent" });
|
|
4832
|
+
if (req.url.endsWith("/login")) {
|
|
4833
|
+
const loginResult = await this.onLogin(req.body);
|
|
4834
|
+
if (loginResult.status === "sucess") {
|
|
4835
|
+
const { refreshToken, token } = await this.generateJwtAndRefreshToken(
|
|
4836
|
+
loginResult.userId,
|
|
4837
|
+
{}
|
|
4991
4838
|
);
|
|
4992
|
-
if (!isValidRefreshToken) {
|
|
4993
|
-
this.invalidateCookies(res);
|
|
4994
|
-
return res.status(400).json({
|
|
4995
|
-
error: "Refresh Token inv\xE1lido"
|
|
4996
|
-
});
|
|
4997
|
-
}
|
|
4998
|
-
yield this.onInvalidateRefreshToken(userId, refreshToken);
|
|
4999
|
-
const { token, refreshToken: newRefreshToken } = yield this.generateJwtAndRefreshToken(userId, {});
|
|
5000
4839
|
_nookies.setCookie.call(void 0, { res }, this.cookies.sessionToken, token, {
|
|
5001
4840
|
secure: true,
|
|
5002
4841
|
maxAge: 60 * 60 * 24 * 30,
|
|
@@ -5004,7 +4843,7 @@ var AuthHelper = class {
|
|
|
5004
4843
|
path: "/",
|
|
5005
4844
|
sameSite: true
|
|
5006
4845
|
});
|
|
5007
|
-
_nookies.setCookie.call(void 0, { res }, this.cookies.refreshToken,
|
|
4846
|
+
_nookies.setCookie.call(void 0, { res }, this.cookies.refreshToken, refreshToken, {
|
|
5008
4847
|
secure: true,
|
|
5009
4848
|
maxAge: 60 * 60 * 24 * 30,
|
|
5010
4849
|
// 30 days
|
|
@@ -5012,74 +4851,121 @@ var AuthHelper = class {
|
|
|
5012
4851
|
sameSite: true,
|
|
5013
4852
|
httpOnly: true
|
|
5014
4853
|
});
|
|
5015
|
-
return res.json({
|
|
5016
|
-
token,
|
|
5017
|
-
refreshToken: newRefreshToken
|
|
5018
|
-
});
|
|
4854
|
+
return res.json({ token, refreshToken });
|
|
5019
4855
|
}
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
4856
|
+
throw new HttpError(400, loginResult.response);
|
|
4857
|
+
}
|
|
4858
|
+
if (req.url.endsWith("/logout")) {
|
|
4859
|
+
this.invalidateCookies(res).end();
|
|
4860
|
+
}
|
|
4861
|
+
if (req.url.endsWith("/refresh")) {
|
|
4862
|
+
const error = decodeSessionToken({
|
|
4863
|
+
req,
|
|
4864
|
+
res,
|
|
4865
|
+
sessionTokenName: this.cookies.sessionToken,
|
|
4866
|
+
validate: false
|
|
4867
|
+
});
|
|
4868
|
+
if (error) return;
|
|
4869
|
+
const userId = String(req.user);
|
|
4870
|
+
const refreshToken = _nookies.parseCookies.call(void 0, { req })[this.cookies.refreshToken];
|
|
4871
|
+
if (!refreshToken) {
|
|
4872
|
+
this.invalidateCookies(res);
|
|
4873
|
+
return res.status(400).json({
|
|
4874
|
+
error: "Refresh Token inv\xE1lido"
|
|
5026
4875
|
});
|
|
5027
|
-
if (error) return;
|
|
5028
|
-
if (!req.user)
|
|
5029
|
-
return res.status(400).json({ error: "Usu\xE1rio n\xE3o encontrado" });
|
|
5030
|
-
const userData = yield this.onGetUserData(req.user);
|
|
5031
|
-
if (!userData)
|
|
5032
|
-
return res.status(400).json({ error: "Usu\xE1rio n\xE3o encontrado" });
|
|
5033
|
-
return res.json(userData);
|
|
5034
4876
|
}
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
const url = `https://login.microsoftonline.com/${this.oauth.tenant_id}/oauth2/v2.0/authorize?${new URLSearchParams(params)}`;
|
|
5044
|
-
return res.json({
|
|
5045
|
-
url
|
|
4877
|
+
const isValidRefreshToken = await this.onValidateRefreshToken(
|
|
4878
|
+
userId,
|
|
4879
|
+
refreshToken
|
|
4880
|
+
);
|
|
4881
|
+
if (!isValidRefreshToken) {
|
|
4882
|
+
this.invalidateCookies(res);
|
|
4883
|
+
return res.status(400).json({
|
|
4884
|
+
error: "Refresh Token inv\xE1lido"
|
|
5046
4885
|
});
|
|
5047
4886
|
}
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
4887
|
+
await this.onInvalidateRefreshToken(userId, refreshToken);
|
|
4888
|
+
const { token, refreshToken: newRefreshToken } = await this.generateJwtAndRefreshToken(userId, {});
|
|
4889
|
+
_nookies.setCookie.call(void 0, { res }, this.cookies.sessionToken, token, {
|
|
4890
|
+
secure: true,
|
|
4891
|
+
maxAge: 60 * 60 * 24 * 30,
|
|
4892
|
+
// 30 days
|
|
4893
|
+
path: "/",
|
|
4894
|
+
sameSite: true
|
|
4895
|
+
});
|
|
4896
|
+
_nookies.setCookie.call(void 0, { res }, this.cookies.refreshToken, newRefreshToken, {
|
|
4897
|
+
secure: true,
|
|
4898
|
+
maxAge: 60 * 60 * 24 * 30,
|
|
4899
|
+
// 30 days
|
|
4900
|
+
path: "/",
|
|
4901
|
+
sameSite: true,
|
|
4902
|
+
httpOnly: true
|
|
4903
|
+
});
|
|
4904
|
+
return res.json({
|
|
4905
|
+
token,
|
|
4906
|
+
refreshToken: newRefreshToken
|
|
4907
|
+
});
|
|
4908
|
+
}
|
|
4909
|
+
if (req.url.endsWith("/me")) {
|
|
4910
|
+
const error = decodeSessionToken({
|
|
4911
|
+
req,
|
|
4912
|
+
res,
|
|
4913
|
+
sessionTokenName: this.cookies.sessionToken,
|
|
4914
|
+
validate: true
|
|
4915
|
+
});
|
|
4916
|
+
if (error) return;
|
|
4917
|
+
if (!req.user)
|
|
4918
|
+
return res.status(400).json({ error: "Usu\xE1rio n\xE3o encontrado" });
|
|
4919
|
+
const userData = await this.onGetUserData(req.user);
|
|
4920
|
+
if (!userData)
|
|
4921
|
+
return res.status(400).json({ error: "Usu\xE1rio n\xE3o encontrado" });
|
|
4922
|
+
return res.json(userData);
|
|
4923
|
+
}
|
|
4924
|
+
if (req.url.endsWith("/oauth-url") && this.oauth) {
|
|
4925
|
+
const params = {
|
|
5055
4926
|
client_id: this.oauth.client_id,
|
|
5056
|
-
scope: this.oauth.scope,
|
|
5057
|
-
code,
|
|
5058
|
-
session_state: this.oauth.client_id,
|
|
5059
4927
|
redirect_uri: this.oauth.redirect_uri,
|
|
5060
|
-
|
|
5061
|
-
|
|
4928
|
+
scope: this.oauth.scope,
|
|
4929
|
+
response_type: "code",
|
|
4930
|
+
response_mode: "query"
|
|
5062
4931
|
};
|
|
5063
|
-
const
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
4932
|
+
const url = `https://login.microsoftonline.com/${this.oauth.tenant_id}/oauth2/v2.0/authorize?${new URLSearchParams(params)}`;
|
|
4933
|
+
return res.json({
|
|
4934
|
+
url
|
|
4935
|
+
});
|
|
4936
|
+
}
|
|
4937
|
+
return res.status(404).json({ error: "Route not found" });
|
|
4938
|
+
}
|
|
4939
|
+
async oauthSignInCallback(code) {
|
|
4940
|
+
if (!this.oauth) throw new Error("OAUTH variables is not defined");
|
|
4941
|
+
const body = {
|
|
4942
|
+
client_id: this.oauth.client_id,
|
|
4943
|
+
scope: this.oauth.scope,
|
|
4944
|
+
code,
|
|
4945
|
+
session_state: this.oauth.client_id,
|
|
4946
|
+
redirect_uri: this.oauth.redirect_uri,
|
|
4947
|
+
grant_type: "authorization_code",
|
|
4948
|
+
client_secret: this.oauth.client_secret
|
|
4949
|
+
};
|
|
4950
|
+
const response = await fetch(
|
|
4951
|
+
`https://login.microsoftonline.com/${this.oauth.tenant_id}/oauth2/v2.0/token`,
|
|
4952
|
+
{
|
|
4953
|
+
method: "POST",
|
|
4954
|
+
body: new URLSearchParams(body),
|
|
4955
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
4956
|
+
}
|
|
4957
|
+
);
|
|
4958
|
+
const data = await response.json();
|
|
4959
|
+
const decodedToken = _jsonwebtoken2.default.decode(data.access_token);
|
|
4960
|
+
const email = decodedToken.upn;
|
|
4961
|
+
const fullName = `${_optionalChain([decodedToken, 'optionalAccess', _92 => _92.given_name])} ${_optionalChain([decodedToken, 'optionalAccess', _93 => _93.family_name])}`;
|
|
4962
|
+
return { decodedToken, email, fullName };
|
|
5077
4963
|
}
|
|
5078
4964
|
createOauthCallbackGetServerSideProps({
|
|
5079
4965
|
onSuccessDestination,
|
|
5080
4966
|
onFailedDestination
|
|
5081
4967
|
}) {
|
|
5082
|
-
return (ctx) =>
|
|
4968
|
+
return async (ctx) => {
|
|
5083
4969
|
if (!this.oauth) throw new Error("Oauth env variables are not defined");
|
|
5084
4970
|
const code = ctx.query.code;
|
|
5085
4971
|
if (!code)
|
|
@@ -5090,14 +4976,14 @@ var AuthHelper = class {
|
|
|
5090
4976
|
}
|
|
5091
4977
|
};
|
|
5092
4978
|
try {
|
|
5093
|
-
const { fullName, email } =
|
|
5094
|
-
const userExists =
|
|
4979
|
+
const { fullName, email } = await this.oauthSignInCallback(code);
|
|
4980
|
+
const userExists = await this.onGetUserData(email);
|
|
5095
4981
|
if (!userExists && !this.oauth.onCreateUser)
|
|
5096
4982
|
throw new Error("User does not exists");
|
|
5097
4983
|
if (!userExists && this.oauth.onCreateUser) {
|
|
5098
|
-
|
|
4984
|
+
await this.oauth.onCreateUser({ fullname: fullName, email });
|
|
5099
4985
|
}
|
|
5100
|
-
const { token, refreshToken } =
|
|
4986
|
+
const { token, refreshToken } = await this.generateJwtAndRefreshToken(
|
|
5101
4987
|
email,
|
|
5102
4988
|
{}
|
|
5103
4989
|
);
|
|
@@ -5127,7 +5013,7 @@ var AuthHelper = class {
|
|
|
5127
5013
|
}
|
|
5128
5014
|
};
|
|
5129
5015
|
}
|
|
5130
|
-
}
|
|
5016
|
+
};
|
|
5131
5017
|
}
|
|
5132
5018
|
};
|
|
5133
5019
|
|
|
@@ -5156,7 +5042,7 @@ function useFilter(props = { defaultFilters: [] }) {
|
|
|
5156
5042
|
return defaultFilters || [];
|
|
5157
5043
|
});
|
|
5158
5044
|
const filterBy = _react.useCallback.call(void 0, (newFilter) => {
|
|
5159
|
-
const propToCompare = (newFilter
|
|
5045
|
+
const propToCompare = _optionalChain([newFilter, 'optionalAccess', _94 => _94.id]) ? "id" : "prop";
|
|
5160
5046
|
function removeRepeatedFilters(filter) {
|
|
5161
5047
|
return filter[propToCompare] !== newFilter[propToCompare];
|
|
5162
5048
|
}
|
|
@@ -5448,7 +5334,7 @@ function useAsyncGrid({
|
|
|
5448
5334
|
setSortedBy((prev) => [...prev, { prop, direction }]);
|
|
5449
5335
|
}, []);
|
|
5450
5336
|
const onSortBy = _react.useCallback.call(void 0,
|
|
5451
|
-
(prop) =>
|
|
5337
|
+
async (prop) => {
|
|
5452
5338
|
if (!prop) return;
|
|
5453
5339
|
let finalArr = [];
|
|
5454
5340
|
const currentSorted = sortedBy.find((p) => p.prop === prop);
|
|
@@ -5467,52 +5353,52 @@ function useAsyncGrid({
|
|
|
5467
5353
|
} else {
|
|
5468
5354
|
finalArr = [...sortedBy, { prop, direction: "desc" }];
|
|
5469
5355
|
}
|
|
5470
|
-
|
|
5356
|
+
await updateGridContent({
|
|
5471
5357
|
page: currentPage,
|
|
5472
5358
|
sortedBy: finalArr,
|
|
5473
5359
|
rowsPerPage
|
|
5474
5360
|
});
|
|
5475
|
-
}
|
|
5361
|
+
},
|
|
5476
5362
|
[sortedBy, toggleSortedDirection, rowsPerPage, currentPage]
|
|
5477
5363
|
);
|
|
5478
5364
|
const set = _react.useCallback.call(void 0, (data) => {
|
|
5479
5365
|
setDefaultData(data);
|
|
5480
5366
|
}, []);
|
|
5481
5367
|
const baseRequest = _react.useCallback.call(void 0,
|
|
5482
|
-
|
|
5368
|
+
async ({
|
|
5483
5369
|
page,
|
|
5484
5370
|
search: search2,
|
|
5485
5371
|
filters: filters2,
|
|
5486
5372
|
sortedBy: sortedBy2,
|
|
5487
5373
|
rowsPerPage: rowsPerPage2
|
|
5488
|
-
}) {
|
|
5374
|
+
}) => {
|
|
5489
5375
|
if (!axiosInstance) throw new Error("Axios instance not provided");
|
|
5490
5376
|
try {
|
|
5491
5377
|
const params = new URLSearchParams({
|
|
5492
5378
|
page: String(page),
|
|
5493
5379
|
rowsPerPage: String(rowsPerPage2),
|
|
5494
|
-
searchText: (search2
|
|
5380
|
+
searchText: _optionalChain([search2, 'optionalAccess', _95 => _95.value]) || "",
|
|
5495
5381
|
sort: sortedBy2.map(({ prop, direction }) => `${prop}:${direction}`).join(","),
|
|
5496
5382
|
filters: filters2.map(
|
|
5497
5383
|
(filter) => `${filter.prop}:${filter.compareType}:${filter.value}`
|
|
5498
5384
|
).join(",")
|
|
5499
5385
|
});
|
|
5500
5386
|
const pathWithParams = `${url}?${params.toString()}`;
|
|
5501
|
-
const { data } =
|
|
5387
|
+
const { data } = await axiosInstance.get(pathWithParams);
|
|
5502
5388
|
setTotalNumberOfItems(data.totalNumberOfItems);
|
|
5503
5389
|
return data.rows;
|
|
5504
5390
|
} catch (_) {
|
|
5505
5391
|
return [];
|
|
5506
5392
|
}
|
|
5507
|
-
}
|
|
5393
|
+
},
|
|
5508
5394
|
[axiosInstance, url]
|
|
5509
5395
|
);
|
|
5510
5396
|
const updateGridContent = _react.useCallback.call(void 0,
|
|
5511
|
-
|
|
5397
|
+
async ({
|
|
5512
5398
|
page,
|
|
5513
5399
|
sortedBy: sortedBy2,
|
|
5514
5400
|
rowsPerPage: rowsPerPage2
|
|
5515
|
-
}) {
|
|
5401
|
+
}) => {
|
|
5516
5402
|
setIsLoading(true);
|
|
5517
5403
|
try {
|
|
5518
5404
|
const props = {
|
|
@@ -5522,7 +5408,7 @@ function useAsyncGrid({
|
|
|
5522
5408
|
search,
|
|
5523
5409
|
filters
|
|
5524
5410
|
};
|
|
5525
|
-
const result = !onRequest ?
|
|
5411
|
+
const result = !onRequest ? await baseRequest(props) : await onRequest(props);
|
|
5526
5412
|
setSortedBy(sortedBy2);
|
|
5527
5413
|
setRowsPerPage(rowsPerPage2);
|
|
5528
5414
|
set(result);
|
|
@@ -5530,7 +5416,7 @@ function useAsyncGrid({
|
|
|
5530
5416
|
} finally {
|
|
5531
5417
|
setIsLoading(false);
|
|
5532
5418
|
}
|
|
5533
|
-
}
|
|
5419
|
+
},
|
|
5534
5420
|
[set, search, filters, onRequest, baseRequest]
|
|
5535
5421
|
);
|
|
5536
5422
|
const onPageChange = _react.useCallback.call(void 0,
|
|
@@ -5614,32 +5500,31 @@ function CreateAuthProvider({
|
|
|
5614
5500
|
const [status, setStatus] = _react.useState.call(void 0, "unauthenticated");
|
|
5615
5501
|
const { createAlert } = useAlert();
|
|
5616
5502
|
const signIn = _react.useCallback.call(void 0,
|
|
5617
|
-
|
|
5618
|
-
var _a, _b;
|
|
5503
|
+
async ({ email, password }) => {
|
|
5619
5504
|
setStatus("loading");
|
|
5620
5505
|
try {
|
|
5621
|
-
const response =
|
|
5506
|
+
const response = await api.post("/auth/login", {
|
|
5622
5507
|
email,
|
|
5623
5508
|
password
|
|
5624
5509
|
});
|
|
5625
5510
|
const { token } = response.data;
|
|
5626
5511
|
api.defaults.headers.common.Authorization = `Bearer ${token}`;
|
|
5627
|
-
const { data } =
|
|
5512
|
+
const { data } = await api.get("/auth/me");
|
|
5628
5513
|
setUser(data);
|
|
5629
5514
|
setStatus("autenticated");
|
|
5630
5515
|
return true;
|
|
5631
5516
|
} catch (error) {
|
|
5632
|
-
createAlert((
|
|
5517
|
+
createAlert(_optionalChain([error, 'optionalAccess', _96 => _96.response, 'optionalAccess', _97 => _97.data, 'optionalAccess', _98 => _98.error]), "error");
|
|
5633
5518
|
setStatus("unauthenticated");
|
|
5634
5519
|
throw error;
|
|
5635
5520
|
}
|
|
5636
|
-
}
|
|
5521
|
+
},
|
|
5637
5522
|
[createAlert, api]
|
|
5638
5523
|
);
|
|
5639
|
-
const ClientSignOut = _react.useCallback.call(void 0, () =>
|
|
5640
|
-
|
|
5524
|
+
const ClientSignOut = _react.useCallback.call(void 0, async () => {
|
|
5525
|
+
await api.get("/auth/logout");
|
|
5641
5526
|
setUser(void 0);
|
|
5642
|
-
}
|
|
5527
|
+
}, [api]);
|
|
5643
5528
|
_react.useEffect.call(void 0, () => {
|
|
5644
5529
|
const token = _nookies.parseCookies.call(void 0, )[sessionTokenName];
|
|
5645
5530
|
if (token) {
|