dynamic-mui 1.0.83 → 1.0.84
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/craco.config.js +11 -13
- package/dist-modules/util/helper.js +39 -23
- package/package.json +1 -1
package/craco.config.js
CHANGED
|
@@ -1,31 +1,29 @@
|
|
|
1
|
+
// craco.config.js
|
|
1
2
|
module.exports = {
|
|
2
|
-
// 1) Keep your existing webpack tweaks
|
|
3
3
|
webpack: {
|
|
4
4
|
configure(config) {
|
|
5
|
-
const experiments = {
|
|
6
|
-
...config.experiments,
|
|
7
|
-
topLevelAwait: true,
|
|
8
|
-
};
|
|
9
5
|
return {
|
|
10
6
|
...config,
|
|
11
|
-
experiments
|
|
7
|
+
experiments: {
|
|
8
|
+
...config.experiments,
|
|
9
|
+
topLevelAwait: true,
|
|
10
|
+
},
|
|
12
11
|
};
|
|
13
12
|
},
|
|
14
13
|
alias: {},
|
|
15
14
|
},
|
|
16
15
|
|
|
17
|
-
// 2) Add an eslint section so CRACO drives all of ESLint
|
|
18
16
|
eslint: {
|
|
19
17
|
enable: true,
|
|
20
|
-
mode: 'extends',
|
|
18
|
+
mode: 'extends',
|
|
21
19
|
configure: {
|
|
22
20
|
extends: [
|
|
23
|
-
'react-app', // CRA’s
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'prettier', // disable conflicts with Prettier
|
|
21
|
+
'react-app', // CRA’s built-in rules
|
|
22
|
+
'airbnb', // your Airbnb overrides
|
|
23
|
+
'prettier', // disables any conflicts with Prettier
|
|
27
24
|
],
|
|
28
|
-
plugins
|
|
25
|
+
// you can omit the `plugins` array entirely—ESLint will load
|
|
26
|
+
// all the plugins that react-app already configures
|
|
29
27
|
rules: {
|
|
30
28
|
'react/react-in-jsx-scope': 'off',
|
|
31
29
|
'prettier/prettier': 'error',
|
|
@@ -12,40 +12,56 @@ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
|
12
12
|
var _material = require("@mui/material");
|
|
13
13
|
var _xDatePickers = require("@mui/x-date-pickers");
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
const _excluded = ["row", "xs", "sm", "md", "lg", "xl"];
|
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
20
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
22
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
-
function
|
|
23
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
24
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
22
25
|
function generateLayout(data) {
|
|
26
|
+
const cloned = (0, _lodash.cloneDeep)(data);
|
|
27
|
+
const normalized = cloned.map(item => {
|
|
28
|
+
if (!item.layout) return item;
|
|
29
|
+
const _item$layout = item.layout,
|
|
30
|
+
{
|
|
31
|
+
row,
|
|
32
|
+
xs,
|
|
33
|
+
sm,
|
|
34
|
+
md,
|
|
35
|
+
lg,
|
|
36
|
+
xl
|
|
37
|
+
} = _item$layout,
|
|
38
|
+
restLayout = _objectWithoutProperties(_item$layout, _excluded);
|
|
39
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
40
|
+
layout: _objectSpread(_objectSpread({}, restLayout), {}, {
|
|
41
|
+
row,
|
|
42
|
+
size: {
|
|
43
|
+
xs,
|
|
44
|
+
sm,
|
|
45
|
+
md,
|
|
46
|
+
lg,
|
|
47
|
+
xl
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
});
|
|
23
52
|
const layout = {
|
|
24
53
|
wrows: [],
|
|
25
54
|
worows: []
|
|
26
55
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const rowIndex = (0, _lodash.map)(wrows, 'layout.row');
|
|
37
|
-
const uniqIndex = (0, _lodash.uniq)(rowIndex);
|
|
38
|
-
const sortedIndex = (0, _lodash.sortBy)(uniqIndex);
|
|
39
|
-
(0, _lodash.each)(sortedIndex, value => {
|
|
40
|
-
const rows = [];
|
|
41
|
-
(0, _lodash.each)(wrows, item => {
|
|
42
|
-
if (item.layout) {
|
|
43
|
-
if (item.layout.row === value) {
|
|
44
|
-
rows.push(item);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
layout.wrows.push(rows);
|
|
56
|
+
layout.worows = (0, _lodash.remove)(normalized, it => {
|
|
57
|
+
var _it$layout;
|
|
58
|
+
return ((_it$layout = it.layout) === null || _it$layout === void 0 ? void 0 : _it$layout.row) == null;
|
|
59
|
+
});
|
|
60
|
+
const rowIndex = (0, _lodash.map)(normalized, 'layout.row');
|
|
61
|
+
const sortedRows = (0, _lodash.sortBy)((0, _lodash.uniq)(rowIndex));
|
|
62
|
+
(0, _lodash.each)(sortedRows, rowNum => {
|
|
63
|
+
const rowItems = normalized.filter(it => it.layout.row === rowNum);
|
|
64
|
+
layout.wrows.push(rowItems);
|
|
49
65
|
});
|
|
50
66
|
return layout;
|
|
51
67
|
}
|