dynamic-mui 1.0.20 → 1.0.22
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-modules/components/DynamicComponent.js +6 -5
- package/dist-modules/components/FormGenerator.js +57 -67
- package/dist-modules/components/controls/CheckBox/checkbox.js +14 -22
- package/dist-modules/components/controls/DataTable/datatable.js +11 -10
- package/dist-modules/components/controls/DateTime/datetime.js +19 -29
- package/dist-modules/components/controls/DateTimePicker/datetimepicker.js +19 -29
- package/dist-modules/components/controls/Radio/radio.js +22 -36
- package/dist-modules/components/controls/Select/select.js +38 -56
- package/dist-modules/components/controls/Switch/switch.js +26 -40
- package/dist-modules/components/controls/TextField/textfield.js +40 -46
- package/dist-modules/components/controls/TimePicker/timepicker.js +19 -29
- package/dist-modules/components/controls/Typography/typography.js +7 -5
- package/dist-modules/components/controls/index.js +1 -1
- package/dist-modules/config/mui.js +1 -1
- package/dist-modules/data/checkbox.js +2 -2
- package/dist-modules/data/dataTable.js +2 -2
- package/dist-modules/data/dateTime.js +5 -5
- package/dist-modules/data/radio.js +2 -2
- package/dist-modules/data/select.js +5 -5
- package/dist-modules/data/switch.js +2 -2
- package/dist-modules/data/textfield.js +4 -4
- package/dist-modules/index.js +1 -1
- package/dist-modules/util/helper.js +48 -47
- package/dist-modules/util/useIsFirstRender.js +1 -1
- package/dist-modules/util/useUpdateEffect.js +2 -2
- package/dist-modules/util/validation.js +31 -31
- package/docs/asset-manifest.json +7 -7
- package/docs/build/2.3c12d3a0.js +2 -0
- package/docs/build/{2.30373255.js.LICENSE.txt → 2.3c12d3a0.js.LICENSE.txt} +0 -8
- package/docs/build/main.4e61cdbd.js +1 -0
- package/docs/index.html +3 -3
- package/package.json +1 -1
- package/docs/build/2.30373255.js +0 -2
- package/docs/build/main.26d6f886.js +0 -1
- /package/docs/build/{bundle.039d7aef.js → bundle.2d61df25.js} +0 -0
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.validation = exports.sizesAndLayout = exports.mui = exports.inputAdornment = void 0;
|
|
7
|
-
|
|
7
|
+
const mui = exports.mui = [{
|
|
8
8
|
type: 'textfield',
|
|
9
9
|
props: {
|
|
10
10
|
MuiAttributes: {
|
|
@@ -47,7 +47,7 @@ var mui = exports.mui = [{
|
|
|
47
47
|
sm: 4
|
|
48
48
|
}
|
|
49
49
|
}];
|
|
50
|
-
|
|
50
|
+
const validation = exports.validation = [{
|
|
51
51
|
type: 'textfield',
|
|
52
52
|
props: {
|
|
53
53
|
MuiAttributes: {
|
|
@@ -117,7 +117,7 @@ var validation = exports.validation = [{
|
|
|
117
117
|
format: '$0,0.00'
|
|
118
118
|
}
|
|
119
119
|
}];
|
|
120
|
-
|
|
120
|
+
const inputAdornment = exports.inputAdornment = [{
|
|
121
121
|
id: 'firstname',
|
|
122
122
|
type: 'textfield',
|
|
123
123
|
props: {
|
|
@@ -175,7 +175,7 @@ var inputAdornment = exports.inputAdornment = [{
|
|
|
175
175
|
sm: 6
|
|
176
176
|
}
|
|
177
177
|
}];
|
|
178
|
-
|
|
178
|
+
const sizesAndLayout = exports.sizesAndLayout = [{
|
|
179
179
|
id: 'textfieldoutlined',
|
|
180
180
|
type: 'textfield',
|
|
181
181
|
props: {
|
package/dist-modules/index.js
CHANGED
|
@@ -9,7 +9,7 @@ Object.keys(_FormGenerator).forEach(function (key) {
|
|
|
9
9
|
if (key in exports && exports[key] === _FormGenerator[key]) return;
|
|
10
10
|
Object.defineProperty(exports, key, {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function
|
|
12
|
+
get: function () {
|
|
13
13
|
return _FormGenerator[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
@@ -13,32 +13,26 @@ var _material = require("@mui/material");
|
|
|
13
13
|
var _xDatePickers = require("@mui/x-date-pickers");
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
17
|
-
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; }
|
|
18
|
-
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; }
|
|
19
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
21
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
22
16
|
function generateLayout(data) {
|
|
23
|
-
|
|
17
|
+
const layout = {
|
|
24
18
|
wrows: [],
|
|
25
19
|
worows: []
|
|
26
20
|
};
|
|
27
21
|
// All Items
|
|
28
|
-
|
|
22
|
+
const wrows = (0, _lodash.clone)(data);
|
|
29
23
|
// Remove Without Rows
|
|
30
|
-
layout.worows = (0, _lodash.remove)(wrows,
|
|
31
|
-
|
|
24
|
+
layout.worows = (0, _lodash.remove)(wrows, item => {
|
|
25
|
+
const isLayout = item.layout ? item.layout.row : item.layout;
|
|
32
26
|
return isLayout === undefined;
|
|
33
27
|
}); // Concat all items without rows
|
|
34
28
|
|
|
35
29
|
// All row indices
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(0, _lodash.each)(sortedIndex,
|
|
40
|
-
|
|
41
|
-
(0, _lodash.each)(wrows,
|
|
30
|
+
const rowIndex = (0, _lodash.map)(wrows, 'layout.row');
|
|
31
|
+
const uniqIndex = (0, _lodash.uniq)(rowIndex);
|
|
32
|
+
const sortedIndex = (0, _lodash.sortBy)(uniqIndex);
|
|
33
|
+
(0, _lodash.each)(sortedIndex, value => {
|
|
34
|
+
const rows = [];
|
|
35
|
+
(0, _lodash.each)(wrows, item => {
|
|
42
36
|
if (item.layout) {
|
|
43
37
|
if (item.layout.row === value) {
|
|
44
38
|
rows.push(item);
|
|
@@ -51,42 +45,47 @@ function generateLayout(data) {
|
|
|
51
45
|
}
|
|
52
46
|
function getInputProps(InputProps) {
|
|
53
47
|
if (!(0, _isEmpty.default)(InputProps)) {
|
|
54
|
-
|
|
55
|
-
MuiInputAdornment =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
const {
|
|
49
|
+
MuiInputAdornment = {},
|
|
50
|
+
position = 'start',
|
|
51
|
+
icon,
|
|
52
|
+
text,
|
|
53
|
+
textstyle = {}
|
|
54
|
+
} = InputProps;
|
|
55
|
+
return {
|
|
56
|
+
["".concat(position, "Adornment")]: /*#__PURE__*/_react.default.createElement(_material.InputAdornment, MuiInputAdornment, icon && /*#__PURE__*/_react.default.createElement(_material.Icon, null, icon), !(0, _isEmpty.default)(textstyle) ? /*#__PURE__*/_react.default.createElement("div", {
|
|
57
|
+
style: textstyle
|
|
58
|
+
}, text || '') : text || '')
|
|
59
|
+
};
|
|
65
60
|
}
|
|
66
61
|
return {};
|
|
67
62
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
const generateKey = function () {
|
|
64
|
+
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
65
|
+
let index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
66
|
+
const random = Math.random().toString(36).substr(2, 9);
|
|
67
|
+
const currentTime = new Date().toLocaleTimeString('en').trim();
|
|
73
68
|
return "".concat(prefix, "_").concat(index, "_").concat(random, "_").concat(currentTime);
|
|
74
69
|
};
|
|
75
|
-
|
|
70
|
+
exports.generateKey = generateKey;
|
|
71
|
+
const updatePatchData = (fields, patch, guid, response) => {
|
|
76
72
|
response[guid] = patch;
|
|
77
|
-
|
|
73
|
+
const formData = Object.assign([], fields);
|
|
78
74
|
// if (isEmpty(patch)) return fields;
|
|
79
|
-
return (0, _lodash.map)(formData,
|
|
75
|
+
return (0, _lodash.map)(formData, field => {
|
|
80
76
|
var _newField$props;
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
const newField = {
|
|
78
|
+
...field
|
|
79
|
+
};
|
|
80
|
+
const id = (newField === null || newField === void 0 ? void 0 : newField.id) || (newField === null || newField === void 0 || (_newField$props = newField.props) === null || _newField$props === void 0 ? void 0 : _newField$props.id);
|
|
83
81
|
if (id && response[guid][id]) {
|
|
84
82
|
newField.props.value = response[guid][id] || '';
|
|
85
83
|
}
|
|
86
84
|
return newField;
|
|
87
85
|
});
|
|
88
86
|
};
|
|
89
|
-
|
|
87
|
+
exports.updatePatchData = updatePatchData;
|
|
88
|
+
const DateComponent = name => {
|
|
90
89
|
if (name === 'MobileDatePicker') return _xDatePickers.MobileDatePicker;
|
|
91
90
|
if (name === 'DesktopDatePicker') return _xDatePickers.DesktopDatePicker;
|
|
92
91
|
// if (name === 'DateRangePicker') return DateRangePicker;
|
|
@@ -100,20 +99,22 @@ var DateComponent = exports.DateComponent = function DateComponent(name) {
|
|
|
100
99
|
if (name === 'DesktopTimePicker') return _xDatePickers.DesktopTimePicker;
|
|
101
100
|
return _xDatePickers.DatePicker;
|
|
102
101
|
};
|
|
103
|
-
|
|
102
|
+
exports.DateComponent = DateComponent;
|
|
103
|
+
const checkboxSX = color => {
|
|
104
104
|
if (color) return {
|
|
105
|
-
color
|
|
105
|
+
color,
|
|
106
106
|
'&.Mui-checked': {
|
|
107
|
-
color
|
|
107
|
+
color
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
return {};
|
|
111
111
|
};
|
|
112
|
+
exports.checkboxSX = checkboxSX;
|
|
112
113
|
var _default = exports.default = {
|
|
113
|
-
generateLayout
|
|
114
|
-
getInputProps
|
|
115
|
-
generateKey
|
|
116
|
-
updatePatchData
|
|
117
|
-
DateComponent
|
|
118
|
-
checkboxSX
|
|
114
|
+
generateLayout,
|
|
115
|
+
getInputProps,
|
|
116
|
+
generateKey,
|
|
117
|
+
updatePatchData,
|
|
118
|
+
DateComponent,
|
|
119
|
+
checkboxSX
|
|
119
120
|
};
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = useIsFirstRender;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
function useIsFirstRender() {
|
|
9
|
-
|
|
9
|
+
const isFirst = (0, _react.useRef)(true);
|
|
10
10
|
if (isFirst.current) {
|
|
11
11
|
isFirst.current = false;
|
|
12
12
|
return true;
|
|
@@ -8,10 +8,10 @@ var _react = require("react");
|
|
|
8
8
|
var _useIsFirstRender = _interopRequireDefault(require("./useIsFirstRender"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
function useUpdateEffect(effect, deps) {
|
|
11
|
-
|
|
11
|
+
const isFirst = (0, _useIsFirstRender.default)();
|
|
12
12
|
|
|
13
13
|
// eslint-disable-next-line consistent-return
|
|
14
|
-
(0, _react.useEffect)(
|
|
14
|
+
(0, _react.useEffect)(() => {
|
|
15
15
|
if (!isFirst) {
|
|
16
16
|
return effect();
|
|
17
17
|
}
|
|
@@ -7,95 +7,95 @@ exports.default = void 0;
|
|
|
7
7
|
var _validator = _interopRequireDefault(require("validator"));
|
|
8
8
|
var _numeral = _interopRequireDefault(require("numeral"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
email
|
|
10
|
+
const Validation = {
|
|
11
|
+
email(value, options) {
|
|
12
12
|
return _validator.default.isEmail(value, options);
|
|
13
13
|
},
|
|
14
|
-
equals
|
|
14
|
+
equals(value, comparison) {
|
|
15
15
|
return _validator.default.equals(value, comparison);
|
|
16
16
|
},
|
|
17
|
-
mandatory
|
|
17
|
+
mandatory(value) {
|
|
18
18
|
return !_validator.default.isEmpty(value);
|
|
19
19
|
},
|
|
20
|
-
mandatoryselect
|
|
20
|
+
mandatoryselect(value) {
|
|
21
21
|
return value.length > 0;
|
|
22
22
|
},
|
|
23
|
-
mobile
|
|
23
|
+
mobile(value, locale) {
|
|
24
24
|
return _validator.default.isMobilePhone(value, locale);
|
|
25
25
|
},
|
|
26
|
-
lowercase
|
|
26
|
+
lowercase(value) {
|
|
27
27
|
return _validator.default.isLowercase(value);
|
|
28
28
|
},
|
|
29
|
-
uppercase
|
|
29
|
+
uppercase(value) {
|
|
30
30
|
return _validator.default.isUppercase(value);
|
|
31
31
|
},
|
|
32
|
-
length
|
|
32
|
+
length(value, options) {
|
|
33
33
|
return _validator.default.isLength(value, options);
|
|
34
34
|
},
|
|
35
|
-
url
|
|
35
|
+
url(value, options) {
|
|
36
36
|
return _validator.default.isURL(value, options);
|
|
37
37
|
},
|
|
38
|
-
creditcard
|
|
38
|
+
creditcard(value) {
|
|
39
39
|
return _validator.default.isCreditCard(value);
|
|
40
40
|
},
|
|
41
|
-
currency
|
|
41
|
+
currency(value, options) {
|
|
42
42
|
return _validator.default.isCurrency(value, options);
|
|
43
43
|
},
|
|
44
|
-
date
|
|
44
|
+
date(value) {
|
|
45
45
|
return _validator.default.isDate(value);
|
|
46
46
|
},
|
|
47
|
-
boolean
|
|
47
|
+
boolean(value) {
|
|
48
48
|
return _validator.default.isBoolean(value);
|
|
49
49
|
},
|
|
50
|
-
alphanumeric
|
|
50
|
+
alphanumeric(value, locale) {
|
|
51
51
|
_validator.default.isAlphanumeric(value, locale);
|
|
52
52
|
},
|
|
53
|
-
contains
|
|
53
|
+
contains(value, seed) {
|
|
54
54
|
return _validator.default.contains(value, seed);
|
|
55
55
|
},
|
|
56
|
-
FQDN
|
|
56
|
+
FQDN(value, options) {
|
|
57
57
|
return _validator.default.isFQDN(value, options);
|
|
58
58
|
},
|
|
59
|
-
float
|
|
59
|
+
float(value, options) {
|
|
60
60
|
return _validator.default.isFloat(value, options);
|
|
61
61
|
},
|
|
62
|
-
ip
|
|
62
|
+
ip(value, version) {
|
|
63
63
|
return _validator.default.isIP(value, version);
|
|
64
64
|
},
|
|
65
|
-
ISBN
|
|
65
|
+
ISBN(value, version) {
|
|
66
66
|
return _validator.default.isISBN(value, version);
|
|
67
67
|
},
|
|
68
|
-
MACAddress
|
|
68
|
+
MACAddress(value) {
|
|
69
69
|
return _validator.default.isMACAddress(value);
|
|
70
70
|
},
|
|
71
|
-
MD5
|
|
71
|
+
MD5(value) {
|
|
72
72
|
return _validator.default.isMD5(value);
|
|
73
73
|
},
|
|
74
|
-
numeric
|
|
74
|
+
numeric(value) {
|
|
75
75
|
return _validator.default.isNumeric(value);
|
|
76
76
|
},
|
|
77
|
-
UUID
|
|
77
|
+
UUID(value, version) {
|
|
78
78
|
return _validator.default.isUUID(value, version);
|
|
79
79
|
},
|
|
80
|
-
matches
|
|
80
|
+
matches(value, pattern) {
|
|
81
81
|
return _validator.default.matches(value, pattern);
|
|
82
82
|
},
|
|
83
|
-
int
|
|
83
|
+
int(value, options) {
|
|
84
84
|
return _validator.default.isInt(value, options);
|
|
85
85
|
},
|
|
86
|
-
hexcolor
|
|
86
|
+
hexcolor(value) {
|
|
87
87
|
return _validator.default.isHexColor(value);
|
|
88
88
|
},
|
|
89
|
-
dataURI
|
|
89
|
+
dataURI(value) {
|
|
90
90
|
return _validator.default.isDataURI(value);
|
|
91
91
|
},
|
|
92
|
-
decimal
|
|
92
|
+
decimal(value) {
|
|
93
93
|
return _validator.default.isDecimal(value);
|
|
94
94
|
},
|
|
95
|
-
alpha
|
|
95
|
+
alpha(value, locale) {
|
|
96
96
|
return _validator.default.isAlpha(value, locale);
|
|
97
97
|
},
|
|
98
|
-
negative
|
|
98
|
+
negative(value) {
|
|
99
99
|
return (0, _numeral.default)(value).value() > -1;
|
|
100
100
|
}
|
|
101
101
|
};
|
package/docs/asset-manifest.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
|
-
"main.js": "/DinakaranS/-dynamic-mui/build/main.
|
|
4
|
-
"runtime-main.js": "/DinakaranS/-dynamic-mui/build/bundle.
|
|
5
|
-
"build/2.
|
|
6
|
-
"build/2.
|
|
3
|
+
"main.js": "/DinakaranS/-dynamic-mui/build/main.4e61cdbd.js",
|
|
4
|
+
"runtime-main.js": "/DinakaranS/-dynamic-mui/build/bundle.2d61df25.js",
|
|
5
|
+
"build/2.3c12d3a0.js": "/DinakaranS/-dynamic-mui/build/2.3c12d3a0.js",
|
|
6
|
+
"build/2.3c12d3a0.js.LICENSE.txt": "/DinakaranS/-dynamic-mui/build/2.3c12d3a0.js.LICENSE.txt",
|
|
7
7
|
"index.html": "/DinakaranS/-dynamic-mui/index.html"
|
|
8
8
|
},
|
|
9
9
|
"entrypoints": [
|
|
10
|
-
"build/bundle.
|
|
11
|
-
"build/2.
|
|
12
|
-
"build/main.
|
|
10
|
+
"build/bundle.2d61df25.js",
|
|
11
|
+
"build/2.3c12d3a0.js",
|
|
12
|
+
"build/main.4e61cdbd.js"
|
|
13
13
|
]
|
|
14
14
|
}
|