@maif/react-forms 1.0.43 → 1.0.46
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/lib/esm/index.js +13 -9
- package/lib/index.js +13 -9
- package/package.json +1 -1
package/lib/esm/index.js
CHANGED
|
@@ -1251,7 +1251,7 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1251
1251
|
}, /*#__PURE__*/React.createElement("input", {
|
|
1252
1252
|
disabled: props.disabled,
|
|
1253
1253
|
type: "text",
|
|
1254
|
-
className: classNames(classes.w_50),
|
|
1254
|
+
className: classNames(classes.w_50, classes.input),
|
|
1255
1255
|
placeholder: props.placeholderKey,
|
|
1256
1256
|
value: key,
|
|
1257
1257
|
onChange: function onChange(e) {
|
|
@@ -1260,7 +1260,7 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1260
1260
|
}), /*#__PURE__*/React.createElement("input", {
|
|
1261
1261
|
disabled: props.disabled,
|
|
1262
1262
|
type: "text",
|
|
1263
|
-
className: classNames(classes.w_50),
|
|
1263
|
+
className: classNames(classes.w_50, classes.input),
|
|
1264
1264
|
placeholder: props.placeholderValue,
|
|
1265
1265
|
value: value,
|
|
1266
1266
|
onChange: function onChange(e) {
|
|
@@ -29120,8 +29120,8 @@ var cleanInputArray = function cleanInputArray(obj, defaultValues, flow, subSche
|
|
|
29120
29120
|
return f.map(function (v) {
|
|
29121
29121
|
return v.flow || v;
|
|
29122
29122
|
});
|
|
29123
|
-
}).map(arrayFlatten).getOrElse(Object.keys(subSchema));
|
|
29124
|
-
return Object.entries(subSchema).filter(function (_ref2) {
|
|
29123
|
+
}).map(arrayFlatten).getOrElse(Object.keys(subSchema || {}));
|
|
29124
|
+
return Object.entries(subSchema || {}).filter(function (_ref2) {
|
|
29125
29125
|
var _ref3 = _slicedToArray(_ref2, 1),
|
|
29126
29126
|
key = _ref3[0];
|
|
29127
29127
|
|
|
@@ -29167,20 +29167,24 @@ var cleanOutputArray = function cleanOutputArray(obj, subSchema) {
|
|
|
29167
29167
|
|
|
29168
29168
|
if (isArray) {
|
|
29169
29169
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v.map(function (_ref6) {
|
|
29170
|
+
var _subSchema$key3;
|
|
29171
|
+
|
|
29170
29172
|
var value = _ref6.value;
|
|
29173
|
+
if (!!value && _typeof$1(value) === 'object' && !(value instanceof Date && !Array.isArray(value))) return cleanOutputArray(value, ((_subSchema$key3 = subSchema[key]) === null || _subSchema$key3 === void 0 ? void 0 : _subSchema$key3.schema) || {});
|
|
29171
29174
|
return value;
|
|
29172
29175
|
})));
|
|
29173
29176
|
}
|
|
29174
29177
|
|
|
29178
|
+
console.log('Not array', key);
|
|
29175
29179
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v));
|
|
29176
29180
|
} else if (!!v && _typeof$1(v) === 'object' && !(v instanceof Date && !Array.isArray(v))) {
|
|
29177
|
-
var _subSchema$
|
|
29181
|
+
var _subSchema$key4;
|
|
29178
29182
|
|
|
29179
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanOutputArray(v, ((_subSchema$
|
|
29183
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanOutputArray(v, ((_subSchema$key4 = subSchema[key]) === null || _subSchema$key4 === void 0 ? void 0 : _subSchema$key4.schema) || {})));
|
|
29180
29184
|
} else {
|
|
29181
|
-
var _subSchema$
|
|
29185
|
+
var _subSchema$key5;
|
|
29182
29186
|
|
|
29183
|
-
if (((_subSchema$
|
|
29187
|
+
if (((_subSchema$key5 = subSchema[key]) === null || _subSchema$key5 === void 0 ? void 0 : _subSchema$key5.type) === 'json') {
|
|
29184
29188
|
try {
|
|
29185
29189
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, JSON.parse(v)));
|
|
29186
29190
|
} catch (err) {
|
|
@@ -29994,7 +29998,7 @@ var ArrayStep = function ArrayStep(_ref12) {
|
|
|
29994
29998
|
onClick: function onClick() {
|
|
29995
29999
|
var newValue = cleanInputArray({}, getValues(entry), step.flow, step.schema);
|
|
29996
30000
|
append({
|
|
29997
|
-
value: step.addableDefaultValue || (newValue ? newValue : defaultVal())
|
|
30001
|
+
value: step.addableDefaultValue || (step.type === type.object && newValue ? newValue : defaultVal())
|
|
29998
30002
|
}); // trigger(entry);
|
|
29999
30003
|
|
|
30000
30004
|
option(step.onChange).map(function (onChange) {
|
package/lib/index.js
CHANGED
|
@@ -1285,7 +1285,7 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1285
1285
|
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
1286
1286
|
disabled: props.disabled,
|
|
1287
1287
|
type: "text",
|
|
1288
|
-
className: classNames__default["default"](classes.w_50),
|
|
1288
|
+
className: classNames__default["default"](classes.w_50, classes.input),
|
|
1289
1289
|
placeholder: props.placeholderKey,
|
|
1290
1290
|
value: key,
|
|
1291
1291
|
onChange: function onChange(e) {
|
|
@@ -1294,7 +1294,7 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1294
1294
|
}), /*#__PURE__*/React__default["default"].createElement("input", {
|
|
1295
1295
|
disabled: props.disabled,
|
|
1296
1296
|
type: "text",
|
|
1297
|
-
className: classNames__default["default"](classes.w_50),
|
|
1297
|
+
className: classNames__default["default"](classes.w_50, classes.input),
|
|
1298
1298
|
placeholder: props.placeholderValue,
|
|
1299
1299
|
value: value,
|
|
1300
1300
|
onChange: function onChange(e) {
|
|
@@ -29154,8 +29154,8 @@ var cleanInputArray = function cleanInputArray(obj, defaultValues, flow, subSche
|
|
|
29154
29154
|
return f.map(function (v) {
|
|
29155
29155
|
return v.flow || v;
|
|
29156
29156
|
});
|
|
29157
|
-
}).map(arrayFlatten).getOrElse(Object.keys(subSchema));
|
|
29158
|
-
return Object.entries(subSchema).filter(function (_ref2) {
|
|
29157
|
+
}).map(arrayFlatten).getOrElse(Object.keys(subSchema || {}));
|
|
29158
|
+
return Object.entries(subSchema || {}).filter(function (_ref2) {
|
|
29159
29159
|
var _ref3 = _slicedToArray(_ref2, 1),
|
|
29160
29160
|
key = _ref3[0];
|
|
29161
29161
|
|
|
@@ -29201,20 +29201,24 @@ var cleanOutputArray = function cleanOutputArray(obj, subSchema) {
|
|
|
29201
29201
|
|
|
29202
29202
|
if (isArray) {
|
|
29203
29203
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v.map(function (_ref6) {
|
|
29204
|
+
var _subSchema$key3;
|
|
29205
|
+
|
|
29204
29206
|
var value = _ref6.value;
|
|
29207
|
+
if (!!value && _typeof$1(value) === 'object' && !(value instanceof Date && !Array.isArray(value))) return cleanOutputArray(value, ((_subSchema$key3 = subSchema[key]) === null || _subSchema$key3 === void 0 ? void 0 : _subSchema$key3.schema) || {});
|
|
29205
29208
|
return value;
|
|
29206
29209
|
})));
|
|
29207
29210
|
}
|
|
29208
29211
|
|
|
29212
|
+
console.log('Not array', key);
|
|
29209
29213
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v));
|
|
29210
29214
|
} else if (!!v && _typeof$1(v) === 'object' && !(v instanceof Date && !Array.isArray(v))) {
|
|
29211
|
-
var _subSchema$
|
|
29215
|
+
var _subSchema$key4;
|
|
29212
29216
|
|
|
29213
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanOutputArray(v, ((_subSchema$
|
|
29217
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanOutputArray(v, ((_subSchema$key4 = subSchema[key]) === null || _subSchema$key4 === void 0 ? void 0 : _subSchema$key4.schema) || {})));
|
|
29214
29218
|
} else {
|
|
29215
|
-
var _subSchema$
|
|
29219
|
+
var _subSchema$key5;
|
|
29216
29220
|
|
|
29217
|
-
if (((_subSchema$
|
|
29221
|
+
if (((_subSchema$key5 = subSchema[key]) === null || _subSchema$key5 === void 0 ? void 0 : _subSchema$key5.type) === 'json') {
|
|
29218
29222
|
try {
|
|
29219
29223
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, JSON.parse(v)));
|
|
29220
29224
|
} catch (err) {
|
|
@@ -30028,7 +30032,7 @@ var ArrayStep = function ArrayStep(_ref12) {
|
|
|
30028
30032
|
onClick: function onClick() {
|
|
30029
30033
|
var newValue = cleanInputArray({}, getValues(entry), step.flow, step.schema);
|
|
30030
30034
|
append({
|
|
30031
|
-
value: step.addableDefaultValue || (newValue ? newValue : defaultVal())
|
|
30035
|
+
value: step.addableDefaultValue || (step.type === type.object && newValue ? newValue : defaultVal())
|
|
30032
30036
|
}); // trigger(entry);
|
|
30033
30037
|
|
|
30034
30038
|
option(step.onChange).map(function (onChange) {
|