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.
Files changed (35) hide show
  1. package/dist-modules/components/DynamicComponent.js +6 -5
  2. package/dist-modules/components/FormGenerator.js +57 -67
  3. package/dist-modules/components/controls/CheckBox/checkbox.js +14 -22
  4. package/dist-modules/components/controls/DataTable/datatable.js +11 -10
  5. package/dist-modules/components/controls/DateTime/datetime.js +19 -29
  6. package/dist-modules/components/controls/DateTimePicker/datetimepicker.js +19 -29
  7. package/dist-modules/components/controls/Radio/radio.js +22 -36
  8. package/dist-modules/components/controls/Select/select.js +38 -56
  9. package/dist-modules/components/controls/Switch/switch.js +26 -40
  10. package/dist-modules/components/controls/TextField/textfield.js +40 -46
  11. package/dist-modules/components/controls/TimePicker/timepicker.js +19 -29
  12. package/dist-modules/components/controls/Typography/typography.js +7 -5
  13. package/dist-modules/components/controls/index.js +1 -1
  14. package/dist-modules/config/mui.js +1 -1
  15. package/dist-modules/data/checkbox.js +2 -2
  16. package/dist-modules/data/dataTable.js +2 -2
  17. package/dist-modules/data/dateTime.js +5 -5
  18. package/dist-modules/data/radio.js +2 -2
  19. package/dist-modules/data/select.js +5 -5
  20. package/dist-modules/data/switch.js +2 -2
  21. package/dist-modules/data/textfield.js +4 -4
  22. package/dist-modules/index.js +1 -1
  23. package/dist-modules/util/helper.js +48 -47
  24. package/dist-modules/util/useIsFirstRender.js +1 -1
  25. package/dist-modules/util/useUpdateEffect.js +2 -2
  26. package/dist-modules/util/validation.js +31 -31
  27. package/docs/asset-manifest.json +7 -7
  28. package/docs/build/2.3c12d3a0.js +2 -0
  29. package/docs/build/{2.30373255.js.LICENSE.txt → 2.3c12d3a0.js.LICENSE.txt} +0 -8
  30. package/docs/build/main.4e61cdbd.js +1 -0
  31. package/docs/index.html +3 -3
  32. package/package.json +1 -1
  33. package/docs/build/2.30373255.js +0 -2
  34. package/docs/build/main.26d6f886.js +0 -1
  35. /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
- var mui = exports.mui = [{
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
- var validation = exports.validation = [{
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
- var inputAdornment = exports.inputAdornment = [{
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
- var sizesAndLayout = exports.sizesAndLayout = [{
178
+ const sizesAndLayout = exports.sizesAndLayout = [{
179
179
  id: 'textfieldoutlined',
180
180
  type: 'textfield',
181
181
  props: {
@@ -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 get() {
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
- var layout = {
17
+ const layout = {
24
18
  wrows: [],
25
19
  worows: []
26
20
  };
27
21
  // All Items
28
- var wrows = (0, _lodash.clone)(data);
22
+ const wrows = (0, _lodash.clone)(data);
29
23
  // Remove Without Rows
30
- layout.worows = (0, _lodash.remove)(wrows, function (item) {
31
- var isLayout = item.layout ? item.layout.row : item.layout;
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
- var rowIndex = (0, _lodash.map)(wrows, 'layout.row');
37
- var uniqIndex = (0, _lodash.uniq)(rowIndex);
38
- var sortedIndex = (0, _lodash.sortBy)(uniqIndex);
39
- (0, _lodash.each)(sortedIndex, function (value) {
40
- var rows = [];
41
- (0, _lodash.each)(wrows, function (item) {
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
- var _InputProps$MuiInputA = InputProps.MuiInputAdornment,
55
- MuiInputAdornment = _InputProps$MuiInputA === void 0 ? {} : _InputProps$MuiInputA,
56
- _InputProps$position = InputProps.position,
57
- position = _InputProps$position === void 0 ? 'start' : _InputProps$position,
58
- icon = InputProps.icon,
59
- text = InputProps.text,
60
- _InputProps$textstyle = InputProps.textstyle,
61
- textstyle = _InputProps$textstyle === void 0 ? {} : _InputProps$textstyle;
62
- return _defineProperty({}, "".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", {
63
- style: textstyle
64
- }, text || '') : text || ''));
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
- var generateKey = exports.generateKey = function generateKey() {
69
- var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
70
- var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
71
- var random = Math.random().toString(36).substr(2, 9);
72
- var currentTime = new Date().toLocaleTimeString('en').trim();
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
- var updatePatchData = exports.updatePatchData = function updatePatchData(fields, patch, guid, response) {
70
+ exports.generateKey = generateKey;
71
+ const updatePatchData = (fields, patch, guid, response) => {
76
72
  response[guid] = patch;
77
- var formData = Object.assign([], fields);
73
+ const formData = Object.assign([], fields);
78
74
  // if (isEmpty(patch)) return fields;
79
- return (0, _lodash.map)(formData, function (field) {
75
+ return (0, _lodash.map)(formData, field => {
80
76
  var _newField$props;
81
- var newField = _objectSpread({}, field);
82
- var 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);
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
- var DateComponent = exports.DateComponent = function DateComponent(name) {
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
- var checkboxSX = exports.checkboxSX = function checkboxSX(color) {
102
+ exports.DateComponent = DateComponent;
103
+ const checkboxSX = color => {
104
104
  if (color) return {
105
- color: color,
105
+ color,
106
106
  '&.Mui-checked': {
107
- color: color
107
+ color
108
108
  }
109
109
  };
110
110
  return {};
111
111
  };
112
+ exports.checkboxSX = checkboxSX;
112
113
  var _default = exports.default = {
113
- generateLayout: generateLayout,
114
- getInputProps: getInputProps,
115
- generateKey: generateKey,
116
- updatePatchData: updatePatchData,
117
- DateComponent: DateComponent,
118
- checkboxSX: 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
- var isFirst = (0, _react.useRef)(true);
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
- var isFirst = (0, _useIsFirstRender.default)();
11
+ const isFirst = (0, _useIsFirstRender.default)();
12
12
 
13
13
  // eslint-disable-next-line consistent-return
14
- (0, _react.useEffect)(function () {
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
- var Validation = {
11
- email: function email(value, options) {
10
+ const Validation = {
11
+ email(value, options) {
12
12
  return _validator.default.isEmail(value, options);
13
13
  },
14
- equals: function equals(value, comparison) {
14
+ equals(value, comparison) {
15
15
  return _validator.default.equals(value, comparison);
16
16
  },
17
- mandatory: function mandatory(value) {
17
+ mandatory(value) {
18
18
  return !_validator.default.isEmpty(value);
19
19
  },
20
- mandatoryselect: function mandatoryselect(value) {
20
+ mandatoryselect(value) {
21
21
  return value.length > 0;
22
22
  },
23
- mobile: function mobile(value, locale) {
23
+ mobile(value, locale) {
24
24
  return _validator.default.isMobilePhone(value, locale);
25
25
  },
26
- lowercase: function lowercase(value) {
26
+ lowercase(value) {
27
27
  return _validator.default.isLowercase(value);
28
28
  },
29
- uppercase: function uppercase(value) {
29
+ uppercase(value) {
30
30
  return _validator.default.isUppercase(value);
31
31
  },
32
- length: function length(value, options) {
32
+ length(value, options) {
33
33
  return _validator.default.isLength(value, options);
34
34
  },
35
- url: function url(value, options) {
35
+ url(value, options) {
36
36
  return _validator.default.isURL(value, options);
37
37
  },
38
- creditcard: function creditcard(value) {
38
+ creditcard(value) {
39
39
  return _validator.default.isCreditCard(value);
40
40
  },
41
- currency: function currency(value, options) {
41
+ currency(value, options) {
42
42
  return _validator.default.isCurrency(value, options);
43
43
  },
44
- date: function date(value) {
44
+ date(value) {
45
45
  return _validator.default.isDate(value);
46
46
  },
47
- boolean: function boolean(value) {
47
+ boolean(value) {
48
48
  return _validator.default.isBoolean(value);
49
49
  },
50
- alphanumeric: function alphanumeric(value, locale) {
50
+ alphanumeric(value, locale) {
51
51
  _validator.default.isAlphanumeric(value, locale);
52
52
  },
53
- contains: function contains(value, seed) {
53
+ contains(value, seed) {
54
54
  return _validator.default.contains(value, seed);
55
55
  },
56
- FQDN: function FQDN(value, options) {
56
+ FQDN(value, options) {
57
57
  return _validator.default.isFQDN(value, options);
58
58
  },
59
- float: function float(value, options) {
59
+ float(value, options) {
60
60
  return _validator.default.isFloat(value, options);
61
61
  },
62
- ip: function ip(value, version) {
62
+ ip(value, version) {
63
63
  return _validator.default.isIP(value, version);
64
64
  },
65
- ISBN: function ISBN(value, version) {
65
+ ISBN(value, version) {
66
66
  return _validator.default.isISBN(value, version);
67
67
  },
68
- MACAddress: function MACAddress(value) {
68
+ MACAddress(value) {
69
69
  return _validator.default.isMACAddress(value);
70
70
  },
71
- MD5: function MD5(value) {
71
+ MD5(value) {
72
72
  return _validator.default.isMD5(value);
73
73
  },
74
- numeric: function numeric(value) {
74
+ numeric(value) {
75
75
  return _validator.default.isNumeric(value);
76
76
  },
77
- UUID: function UUID(value, version) {
77
+ UUID(value, version) {
78
78
  return _validator.default.isUUID(value, version);
79
79
  },
80
- matches: function matches(value, pattern) {
80
+ matches(value, pattern) {
81
81
  return _validator.default.matches(value, pattern);
82
82
  },
83
- int: function int(value, options) {
83
+ int(value, options) {
84
84
  return _validator.default.isInt(value, options);
85
85
  },
86
- hexcolor: function hexcolor(value) {
86
+ hexcolor(value) {
87
87
  return _validator.default.isHexColor(value);
88
88
  },
89
- dataURI: function dataURI(value) {
89
+ dataURI(value) {
90
90
  return _validator.default.isDataURI(value);
91
91
  },
92
- decimal: function decimal(value) {
92
+ decimal(value) {
93
93
  return _validator.default.isDecimal(value);
94
94
  },
95
- alpha: function alpha(value, locale) {
95
+ alpha(value, locale) {
96
96
  return _validator.default.isAlpha(value, locale);
97
97
  },
98
- negative: function negative(value) {
98
+ negative(value) {
99
99
  return (0, _numeral.default)(value).value() > -1;
100
100
  }
101
101
  };
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "files": {
3
- "main.js": "/DinakaranS/-dynamic-mui/build/main.26d6f886.js",
4
- "runtime-main.js": "/DinakaranS/-dynamic-mui/build/bundle.039d7aef.js",
5
- "build/2.30373255.js": "/DinakaranS/-dynamic-mui/build/2.30373255.js",
6
- "build/2.30373255.js.LICENSE.txt": "/DinakaranS/-dynamic-mui/build/2.30373255.js.LICENSE.txt",
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.039d7aef.js",
11
- "build/2.30373255.js",
12
- "build/main.26d6f886.js"
10
+ "build/bundle.2d61df25.js",
11
+ "build/2.3c12d3a0.js",
12
+ "build/main.4e61cdbd.js"
13
13
  ]
14
14
  }