dynamic-mui 1.0.9 → 1.0.12

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.
@@ -46,7 +46,11 @@ function FormGenerator(props) {
46
46
  guid = props.guid,
47
47
  formRef = props.formRef,
48
48
  onSubmit = props.onSubmit,
49
- onChange = props.onChange;
49
+ onChange = props.onChange,
50
+ _props$MuiGridAttribu = props.MuiGridAttributes,
51
+ MuiGridAttributes = _props$MuiGridAttribu === void 0 ? {
52
+ spacing: 2
53
+ } : _props$MuiGridAttribu;
50
54
  var config = LIBMap.MUI;
51
55
  var dataObj = JSON.parse(JSON.stringify(data));
52
56
  var layout = (0, _helper.generateLayout)((0, _helper.updatePatchData)(JSON.parse(JSON.stringify(dataObj)), patch, guid));
@@ -69,11 +73,10 @@ function FormGenerator(props) {
69
73
  console.log(e);
70
74
  }
71
75
  };
72
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Grid.default, {
76
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Grid.default, _extends({
73
77
  key: (0, _helper.generateKey)('layout-grid'),
74
- container: true,
75
- spacing: 2
76
- }, layout.wrows.map(function (row) {
78
+ container: true
79
+ }, MuiGridAttributes), layout.wrows.map(function (row) {
77
80
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, row.map(function (field, index) {
78
81
  var _field$type = field.type,
79
82
  type = _field$type === void 0 ? '' : _field$type,
@@ -160,7 +163,9 @@ FormGenerator.propTypes = process.env.NODE_ENV !== "production" ? {
160
163
  /** Component Submit Function */
161
164
  onSubmit: _propTypes.default.func,
162
165
  /** Component On Change Function */
163
- onChange: _propTypes.default.func
166
+ onChange: _propTypes.default.func,
167
+ /** Grid Container Attributes */
168
+ MuiGridAttributes: _propTypes.default.objectOf(_propTypes.default.object)
164
169
  } : {};
165
170
  FormGenerator.defaultProps = {
166
171
  patch: {}
@@ -33,9 +33,17 @@ var icon = /*#__PURE__*/_react.default.createElement(_CheckBoxOutlineBlank.defau
33
33
  var checkedIcon = /*#__PURE__*/_react.default.createElement(_CheckBox.default, {
34
34
  fontSize: "small"
35
35
  });
36
- function Select(_ref) {
37
- var attributes = _ref.attributes,
38
- onChange = _ref.onChange;
36
+ var getValue = function getValue() {
37
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
38
+ var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
39
+ return options.find(function (_ref) {
40
+ var value = _ref.value;
41
+ return defaultValue === value;
42
+ });
43
+ };
44
+ function Select(_ref2) {
45
+ var attributes = _ref2.attributes,
46
+ onChange = _ref2.onChange;
39
47
  var _attributes$MuiAttrib = attributes.MuiAttributes,
40
48
  MuiAttributes = _attributes$MuiAttrib === void 0 ? {} : _attributes$MuiAttrib,
41
49
  _attributes$options = attributes.options,
@@ -44,7 +52,7 @@ function Select(_ref) {
44
52
  MuiBoxAttributes = _attributes$MuiBoxAtt === void 0 ? {} : _attributes$MuiBoxAtt,
45
53
  _attributes$id = attributes.id,
46
54
  id = _attributes$id === void 0 ? '' : _attributes$id;
47
- var _React$useState = _react.default.useState(),
55
+ var _React$useState = _react.default.useState((attributes === null || attributes === void 0 ? void 0 : attributes.value) && getValue(options, attributes === null || attributes === void 0 ? void 0 : attributes.value)),
48
56
  _React$useState2 = _slicedToArray(_React$useState, 2),
49
57
  value = _React$useState2[0],
50
58
  setValue = _React$useState2[1];
@@ -56,8 +64,8 @@ function Select(_ref) {
56
64
  if (MuiAttributes.multiple) {
57
65
  MuiAttributes.renderOption = function (props) {
58
66
  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
59
- var _ref2 = arguments.length > 2 ? arguments[2] : undefined,
60
- selected = _ref2.selected;
67
+ var _ref3 = arguments.length > 2 ? arguments[2] : undefined,
68
+ selected = _ref3.selected;
61
69
  return /*#__PURE__*/_react.default.createElement("li", props, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
62
70
  icon: icon,
63
71
  checkedIcon: checkedIcon,
@@ -11,6 +11,7 @@ var _lodash = require("lodash");
11
11
  var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
12
12
  var _material = require("@mui/material");
13
13
  var _xDatePickers = require("@mui/x-date-pickers");
14
+ var _react = _interopRequireDefault(require("react"));
14
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
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); }
16
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; }
@@ -59,7 +60,7 @@ function getInputProps(InputProps) {
59
60
  text = InputProps.text,
60
61
  _InputProps$textstyle = InputProps.textstyle,
61
62
  textstyle = _InputProps$textstyle === void 0 ? {} : _InputProps$textstyle;
62
- return _defineProperty({}, "".concat(position, "Adornment"), /*#__PURE__*/React.createElement(_material.InputAdornment, MuiInputAdornment, icon && /*#__PURE__*/React.createElement(_material.Icon, null, icon), !(0, _isEmpty.default)(textstyle) ? /*#__PURE__*/React.createElement("div", {
63
+ 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
64
  style: textstyle
64
65
  }, text || '') : text || ''));
65
66
  }
@@ -77,9 +78,11 @@ var updatePatchData = exports.updatePatchData = function updatePatchData(fields,
77
78
  var formData = Object.assign([], fields);
78
79
  // if (isEmpty(patch)) return fields;
79
80
  return (0, _lodash.map)(formData, function (field) {
81
+ var _newField$props;
80
82
  var newField = _objectSpread({}, field);
81
- if (newField.id && response[guid][field.id]) {
82
- newField.props.value = response[guid][field.id] || '';
83
+ 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);
84
+ if (id && response[guid][id]) {
85
+ newField.props.value = response[guid][id] || '';
83
86
  }
84
87
  return newField;
85
88
  });
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "files": {
3
- "main.js": "/DinakaranS/-dynamic-mui/build/main.b248710d.js",
3
+ "main.js": "/DinakaranS/-dynamic-mui/build/main.125a1037.js",
4
4
  "runtime-main.js": "/DinakaranS/-dynamic-mui/build/bundle.039d7aef.js",
5
- "build/2.162bc6e1.js": "/DinakaranS/-dynamic-mui/build/2.162bc6e1.js",
6
- "build/2.162bc6e1.js.LICENSE.txt": "/DinakaranS/-dynamic-mui/build/2.162bc6e1.js.LICENSE.txt",
5
+ "build/2.c7ab203b.js": "/DinakaranS/-dynamic-mui/build/2.c7ab203b.js",
6
+ "build/2.c7ab203b.js.LICENSE.txt": "/DinakaranS/-dynamic-mui/build/2.c7ab203b.js.LICENSE.txt",
7
7
  "index.html": "/DinakaranS/-dynamic-mui/index.html"
8
8
  },
9
9
  "entrypoints": [
10
10
  "build/bundle.039d7aef.js",
11
- "build/2.162bc6e1.js",
12
- "build/main.b248710d.js"
11
+ "build/2.c7ab203b.js",
12
+ "build/main.125a1037.js"
13
13
  ]
14
14
  }