@scenid/react-formulator 0.5.2 → 0.5.3
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/index.cjs.js +34 -19
- package/dist/index.esm.js +34 -19
- package/package.json +1 -1
- package/src/Editable/FormAutocomplete/FormAutocomplete.jsx +1 -10
- package/src/Editable/FormAutocomplete/useFetchOptions.js +1 -1
- package/src/FormulatorFormSection.jsx +1 -2
- package/src/ReadOnly/FormReadOnlyRepeater.jsx +24 -8
- package/src/ReadOnly/FormReadOnlyText.jsx +7 -3
- package/stories/Forms.stories.jsx +16 -0
package/dist/index.cjs.js
CHANGED
|
@@ -29237,7 +29237,7 @@ FormSectionCard.propTypes = {
|
|
|
29237
29237
|
children: PropTypes__default["default"].node
|
|
29238
29238
|
};
|
|
29239
29239
|
|
|
29240
|
-
var useStyles$
|
|
29240
|
+
var useStyles$2 = styles$n.makeStyles(function (theme) {
|
|
29241
29241
|
return {
|
|
29242
29242
|
formSectionBlock: {
|
|
29243
29243
|
'&:not(:last-child)': {
|
|
@@ -29254,7 +29254,7 @@ var FormSectionBlock = function FormSectionBlock(_ref) {
|
|
|
29254
29254
|
descVariant = _ref.descVariant,
|
|
29255
29255
|
textAlign = _ref.textAlign,
|
|
29256
29256
|
children = _ref.children;
|
|
29257
|
-
var styles = useStyles$
|
|
29257
|
+
var styles = useStyles$2();
|
|
29258
29258
|
return /*#__PURE__*/React__default["default"].createElement(_Box__default["default"], {
|
|
29259
29259
|
className: styles.formSectionBlock
|
|
29260
29260
|
}, /*#__PURE__*/React__default["default"].createElement(FormGroupHeader, {
|
|
@@ -29280,7 +29280,7 @@ var _excluded$6 = ["prepend", "append", "componentProps"];
|
|
|
29280
29280
|
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29281
29281
|
|
|
29282
29282
|
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29283
|
-
var useStyles = styles$o.makeStyles(function (theme) {
|
|
29283
|
+
var useStyles$1 = styles$o.makeStyles(function (theme) {
|
|
29284
29284
|
return {
|
|
29285
29285
|
error: {
|
|
29286
29286
|
color: theme.palette.error.main
|
|
@@ -29305,7 +29305,7 @@ var FormControlField$1 = function FormControlField(_ref) {
|
|
|
29305
29305
|
validating = _ref.validating,
|
|
29306
29306
|
dirty = _ref.dirty,
|
|
29307
29307
|
onChange = _ref.onChange;
|
|
29308
|
-
var styles = useStyles();
|
|
29308
|
+
var styles = useStyles$1();
|
|
29309
29309
|
|
|
29310
29310
|
var finalProps = _objectSpread$4(_objectSpread$4({
|
|
29311
29311
|
name: name,
|
|
@@ -36537,7 +36537,8 @@ function friendlyDateTime(dateTimeish) {
|
|
|
36537
36537
|
var FormReadOnlyText = function FormReadOnlyText(_ref) {
|
|
36538
36538
|
var value = _ref.value,
|
|
36539
36539
|
type = _ref.type,
|
|
36540
|
-
renderFormat = _ref.renderFormat
|
|
36540
|
+
renderFormat = _ref.renderFormat,
|
|
36541
|
+
multiline = _ref.multiline;
|
|
36541
36542
|
var finalValue = value;
|
|
36542
36543
|
|
|
36543
36544
|
if (type === 'date' || type === 'datetime-local') {
|
|
@@ -36551,14 +36552,18 @@ var FormReadOnlyText = function FormReadOnlyText(_ref) {
|
|
|
36551
36552
|
}
|
|
36552
36553
|
|
|
36553
36554
|
return /*#__PURE__*/React__default["default"].createElement(_Typography__default["default"], {
|
|
36554
|
-
variant: "body1"
|
|
36555
|
+
variant: "body1",
|
|
36556
|
+
style: {
|
|
36557
|
+
whiteSpace: multiline ? 'pre-line' : 'inherit'
|
|
36558
|
+
}
|
|
36555
36559
|
}, finalValue);
|
|
36556
36560
|
};
|
|
36557
36561
|
|
|
36558
36562
|
FormReadOnlyText.propTypes = {
|
|
36559
36563
|
value: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string]),
|
|
36560
36564
|
type: PropTypes__default["default"].string,
|
|
36561
|
-
renderFormat: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].object])
|
|
36565
|
+
renderFormat: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].object]),
|
|
36566
|
+
multiline: PropTypes__default["default"].bool
|
|
36562
36567
|
};
|
|
36563
36568
|
|
|
36564
36569
|
function toVal(mix) {
|
|
@@ -38905,7 +38910,7 @@ var useFetchOptions = function useFetchOptions(arg) {
|
|
|
38905
38910
|
case 18:
|
|
38906
38911
|
_context2.prev = 18;
|
|
38907
38912
|
_context2.t0 = _context2["catch"](8);
|
|
38908
|
-
|
|
38913
|
+
setLoading(false);
|
|
38909
38914
|
|
|
38910
38915
|
case 21:
|
|
38911
38916
|
setLoading(false);
|
|
@@ -38972,10 +38977,7 @@ var FormAutocomplete = function FormAutocomplete(_ref) {
|
|
|
38972
38977
|
}, []);
|
|
38973
38978
|
|
|
38974
38979
|
if (readOnly) {
|
|
38975
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
38976
|
-
component: FormReadOnlyText,
|
|
38977
|
-
type: "text",
|
|
38978
|
-
componentProps: {},
|
|
38980
|
+
return /*#__PURE__*/React__default["default"].createElement(FormReadOnlyText, {
|
|
38979
38981
|
name: name,
|
|
38980
38982
|
value: value
|
|
38981
38983
|
});
|
|
@@ -77759,6 +77761,15 @@ FormReadOnlyBoolean.propTypes = {
|
|
|
77759
77761
|
defaultValue: PropTypes__default["default"].bool
|
|
77760
77762
|
};
|
|
77761
77763
|
|
|
77764
|
+
var useStyles = styles$n.makeStyles(function () {
|
|
77765
|
+
return {
|
|
77766
|
+
formRepeater: {
|
|
77767
|
+
padding: 0,
|
|
77768
|
+
margin: 0
|
|
77769
|
+
}
|
|
77770
|
+
};
|
|
77771
|
+
});
|
|
77772
|
+
|
|
77762
77773
|
var getValue = function getValue(value, catalog) {
|
|
77763
77774
|
if (catalog && catalog[value] !== undefined) return catalog[value];
|
|
77764
77775
|
return value;
|
|
@@ -77766,8 +77777,10 @@ var getValue = function getValue(value, catalog) {
|
|
|
77766
77777
|
|
|
77767
77778
|
var FormReadOnlyRepeater = function FormReadOnlyRepeater(_ref) {
|
|
77768
77779
|
var value = _ref.value,
|
|
77769
|
-
|
|
77770
|
-
|
|
77780
|
+
options = _ref.options;
|
|
77781
|
+
var styles = useStyles();
|
|
77782
|
+
return /*#__PURE__*/React__default["default"].createElement(_List__default["default"], {
|
|
77783
|
+
className: styles.formRepeater,
|
|
77771
77784
|
dense: true
|
|
77772
77785
|
}, value && value.map(function (entry, index) {
|
|
77773
77786
|
return (
|
|
@@ -77776,15 +77789,18 @@ var FormReadOnlyRepeater = function FormReadOnlyRepeater(_ref) {
|
|
|
77776
77789
|
React__default["default"].createElement(_ListItem__default["default"], {
|
|
77777
77790
|
key: "entry-".concat(index)
|
|
77778
77791
|
}, /*#__PURE__*/React__default["default"].createElement(_ListItemText__default["default"], {
|
|
77779
|
-
primary: getValue(entry,
|
|
77792
|
+
primary: getValue(entry, options),
|
|
77793
|
+
style: {
|
|
77794
|
+
margin: 0
|
|
77795
|
+
}
|
|
77780
77796
|
}))
|
|
77781
77797
|
);
|
|
77782
|
-
}))
|
|
77798
|
+
}));
|
|
77783
77799
|
};
|
|
77784
77800
|
|
|
77785
77801
|
FormReadOnlyRepeater.propTypes = {
|
|
77786
77802
|
value: PropTypes__default["default"].array,
|
|
77787
|
-
|
|
77803
|
+
options: PropTypes__default["default"].object
|
|
77788
77804
|
};
|
|
77789
77805
|
|
|
77790
77806
|
/**
|
|
@@ -83185,7 +83201,6 @@ var FormulatorFormSection = /*#__PURE__*/function (_React$Component) {
|
|
|
83185
83201
|
var mapEntry = isRender ? renderComponentMap[field] : componentMap[mapKey];
|
|
83186
83202
|
var component = mapEntry,
|
|
83187
83203
|
props = {};
|
|
83188
|
-
console.log(schema.properties, fieldEntry);
|
|
83189
83204
|
|
|
83190
83205
|
if (mapKey === 'array' && schema.properties[fieldEntry].options) {
|
|
83191
83206
|
props.options = schema.properties[fieldEntry].options.reduce(function (l, r) {
|
|
@@ -83200,7 +83215,7 @@ var FormulatorFormSection = /*#__PURE__*/function (_React$Component) {
|
|
|
83200
83215
|
var _translations$field;
|
|
83201
83216
|
|
|
83202
83217
|
return {
|
|
83203
|
-
label: (translations === null || translations === void 0 ? void 0 : (_translations$field = translations
|
|
83218
|
+
label: (translations === null || translations === void 0 ? void 0 : (_translations$field = translations[field]) === null || _translations$field === void 0 ? void 0 : _translations$field[value]) || value,
|
|
83204
83219
|
value: value
|
|
83205
83220
|
};
|
|
83206
83221
|
});
|
package/dist/index.esm.js
CHANGED
|
@@ -29169,7 +29169,7 @@ FormSectionCard.propTypes = {
|
|
|
29169
29169
|
children: PropTypes__default.node
|
|
29170
29170
|
};
|
|
29171
29171
|
|
|
29172
|
-
var useStyles$
|
|
29172
|
+
var useStyles$2 = makeStyles(function (theme) {
|
|
29173
29173
|
return {
|
|
29174
29174
|
formSectionBlock: {
|
|
29175
29175
|
'&:not(:last-child)': {
|
|
@@ -29186,7 +29186,7 @@ var FormSectionBlock = function FormSectionBlock(_ref) {
|
|
|
29186
29186
|
descVariant = _ref.descVariant,
|
|
29187
29187
|
textAlign = _ref.textAlign,
|
|
29188
29188
|
children = _ref.children;
|
|
29189
|
-
var styles = useStyles$
|
|
29189
|
+
var styles = useStyles$2();
|
|
29190
29190
|
return /*#__PURE__*/React__default.createElement(_Box, {
|
|
29191
29191
|
className: styles.formSectionBlock
|
|
29192
29192
|
}, /*#__PURE__*/React__default.createElement(FormGroupHeader, {
|
|
@@ -29212,7 +29212,7 @@ var _excluded$6 = ["prepend", "append", "componentProps"];
|
|
|
29212
29212
|
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29213
29213
|
|
|
29214
29214
|
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29215
|
-
var useStyles = makeStyles$1(function (theme) {
|
|
29215
|
+
var useStyles$1 = makeStyles$1(function (theme) {
|
|
29216
29216
|
return {
|
|
29217
29217
|
error: {
|
|
29218
29218
|
color: theme.palette.error.main
|
|
@@ -29237,7 +29237,7 @@ var FormControlField$1 = function FormControlField(_ref) {
|
|
|
29237
29237
|
validating = _ref.validating,
|
|
29238
29238
|
dirty = _ref.dirty,
|
|
29239
29239
|
onChange = _ref.onChange;
|
|
29240
|
-
var styles = useStyles();
|
|
29240
|
+
var styles = useStyles$1();
|
|
29241
29241
|
|
|
29242
29242
|
var finalProps = _objectSpread$4(_objectSpread$4({
|
|
29243
29243
|
name: name,
|
|
@@ -36469,7 +36469,8 @@ function friendlyDateTime(dateTimeish) {
|
|
|
36469
36469
|
var FormReadOnlyText = function FormReadOnlyText(_ref) {
|
|
36470
36470
|
var value = _ref.value,
|
|
36471
36471
|
type = _ref.type,
|
|
36472
|
-
renderFormat = _ref.renderFormat
|
|
36472
|
+
renderFormat = _ref.renderFormat,
|
|
36473
|
+
multiline = _ref.multiline;
|
|
36473
36474
|
var finalValue = value;
|
|
36474
36475
|
|
|
36475
36476
|
if (type === 'date' || type === 'datetime-local') {
|
|
@@ -36483,14 +36484,18 @@ var FormReadOnlyText = function FormReadOnlyText(_ref) {
|
|
|
36483
36484
|
}
|
|
36484
36485
|
|
|
36485
36486
|
return /*#__PURE__*/React__default.createElement(_Typography, {
|
|
36486
|
-
variant: "body1"
|
|
36487
|
+
variant: "body1",
|
|
36488
|
+
style: {
|
|
36489
|
+
whiteSpace: multiline ? 'pre-line' : 'inherit'
|
|
36490
|
+
}
|
|
36487
36491
|
}, finalValue);
|
|
36488
36492
|
};
|
|
36489
36493
|
|
|
36490
36494
|
FormReadOnlyText.propTypes = {
|
|
36491
36495
|
value: PropTypes__default.oneOfType([PropTypes__default.number, PropTypes__default.string]),
|
|
36492
36496
|
type: PropTypes__default.string,
|
|
36493
|
-
renderFormat: PropTypes__default.oneOfType([PropTypes__default.string, PropTypes__default.object])
|
|
36497
|
+
renderFormat: PropTypes__default.oneOfType([PropTypes__default.string, PropTypes__default.object]),
|
|
36498
|
+
multiline: PropTypes__default.bool
|
|
36494
36499
|
};
|
|
36495
36500
|
|
|
36496
36501
|
function toVal(mix) {
|
|
@@ -38837,7 +38842,7 @@ var useFetchOptions = function useFetchOptions(arg) {
|
|
|
38837
38842
|
case 18:
|
|
38838
38843
|
_context2.prev = 18;
|
|
38839
38844
|
_context2.t0 = _context2["catch"](8);
|
|
38840
|
-
|
|
38845
|
+
setLoading(false);
|
|
38841
38846
|
|
|
38842
38847
|
case 21:
|
|
38843
38848
|
setLoading(false);
|
|
@@ -38904,10 +38909,7 @@ var FormAutocomplete = function FormAutocomplete(_ref) {
|
|
|
38904
38909
|
}, []);
|
|
38905
38910
|
|
|
38906
38911
|
if (readOnly) {
|
|
38907
|
-
return /*#__PURE__*/React__default.createElement(
|
|
38908
|
-
component: FormReadOnlyText,
|
|
38909
|
-
type: "text",
|
|
38910
|
-
componentProps: {},
|
|
38912
|
+
return /*#__PURE__*/React__default.createElement(FormReadOnlyText, {
|
|
38911
38913
|
name: name,
|
|
38912
38914
|
value: value
|
|
38913
38915
|
});
|
|
@@ -77691,6 +77693,15 @@ FormReadOnlyBoolean.propTypes = {
|
|
|
77691
77693
|
defaultValue: PropTypes__default.bool
|
|
77692
77694
|
};
|
|
77693
77695
|
|
|
77696
|
+
var useStyles = makeStyles(function () {
|
|
77697
|
+
return {
|
|
77698
|
+
formRepeater: {
|
|
77699
|
+
padding: 0,
|
|
77700
|
+
margin: 0
|
|
77701
|
+
}
|
|
77702
|
+
};
|
|
77703
|
+
});
|
|
77704
|
+
|
|
77694
77705
|
var getValue = function getValue(value, catalog) {
|
|
77695
77706
|
if (catalog && catalog[value] !== undefined) return catalog[value];
|
|
77696
77707
|
return value;
|
|
@@ -77698,8 +77709,10 @@ var getValue = function getValue(value, catalog) {
|
|
|
77698
77709
|
|
|
77699
77710
|
var FormReadOnlyRepeater = function FormReadOnlyRepeater(_ref) {
|
|
77700
77711
|
var value = _ref.value,
|
|
77701
|
-
|
|
77702
|
-
|
|
77712
|
+
options = _ref.options;
|
|
77713
|
+
var styles = useStyles();
|
|
77714
|
+
return /*#__PURE__*/React__default.createElement(_List, {
|
|
77715
|
+
className: styles.formRepeater,
|
|
77703
77716
|
dense: true
|
|
77704
77717
|
}, value && value.map(function (entry, index) {
|
|
77705
77718
|
return (
|
|
@@ -77708,15 +77721,18 @@ var FormReadOnlyRepeater = function FormReadOnlyRepeater(_ref) {
|
|
|
77708
77721
|
React__default.createElement(_ListItem, {
|
|
77709
77722
|
key: "entry-".concat(index)
|
|
77710
77723
|
}, /*#__PURE__*/React__default.createElement(_ListItemText, {
|
|
77711
|
-
primary: getValue(entry,
|
|
77724
|
+
primary: getValue(entry, options),
|
|
77725
|
+
style: {
|
|
77726
|
+
margin: 0
|
|
77727
|
+
}
|
|
77712
77728
|
}))
|
|
77713
77729
|
);
|
|
77714
|
-
}))
|
|
77730
|
+
}));
|
|
77715
77731
|
};
|
|
77716
77732
|
|
|
77717
77733
|
FormReadOnlyRepeater.propTypes = {
|
|
77718
77734
|
value: PropTypes__default.array,
|
|
77719
|
-
|
|
77735
|
+
options: PropTypes__default.object
|
|
77720
77736
|
};
|
|
77721
77737
|
|
|
77722
77738
|
/**
|
|
@@ -83117,7 +83133,6 @@ var FormulatorFormSection = /*#__PURE__*/function (_React$Component) {
|
|
|
83117
83133
|
var mapEntry = isRender ? renderComponentMap[field] : componentMap[mapKey];
|
|
83118
83134
|
var component = mapEntry,
|
|
83119
83135
|
props = {};
|
|
83120
|
-
console.log(schema.properties, fieldEntry);
|
|
83121
83136
|
|
|
83122
83137
|
if (mapKey === 'array' && schema.properties[fieldEntry].options) {
|
|
83123
83138
|
props.options = schema.properties[fieldEntry].options.reduce(function (l, r) {
|
|
@@ -83132,7 +83147,7 @@ var FormulatorFormSection = /*#__PURE__*/function (_React$Component) {
|
|
|
83132
83147
|
var _translations$field;
|
|
83133
83148
|
|
|
83134
83149
|
return {
|
|
83135
|
-
label: (translations === null || translations === void 0 ? void 0 : (_translations$field = translations
|
|
83150
|
+
label: (translations === null || translations === void 0 ? void 0 : (_translations$field = translations[field]) === null || _translations$field === void 0 ? void 0 : _translations$field[value]) || value,
|
|
83136
83151
|
value: value
|
|
83137
83152
|
};
|
|
83138
83153
|
});
|
package/package.json
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
CircularProgress
|
|
12
12
|
} from '@material-ui/core'
|
|
13
13
|
|
|
14
|
-
import FormField from '../FormField'
|
|
15
14
|
import FormReadOnlyText from '../../ReadOnly/FormReadOnlyText'
|
|
16
15
|
import SelectOrCreate from '../../Components/SelectOrCreate'
|
|
17
16
|
|
|
@@ -44,15 +43,7 @@ const FormAutocomplete = ({
|
|
|
44
43
|
}, [])
|
|
45
44
|
|
|
46
45
|
if (readOnly) {
|
|
47
|
-
return
|
|
48
|
-
<FormField
|
|
49
|
-
component={FormReadOnlyText}
|
|
50
|
-
type="text"
|
|
51
|
-
componentProps={{}}
|
|
52
|
-
name={name}
|
|
53
|
-
value={value}
|
|
54
|
-
/>
|
|
55
|
-
)
|
|
46
|
+
return <FormReadOnlyText name={name} value={value} />
|
|
56
47
|
}
|
|
57
48
|
|
|
58
49
|
if (!options) {
|
|
@@ -110,7 +110,6 @@ class FormulatorFormSection extends React.Component {
|
|
|
110
110
|
const mapEntry = isRender ? renderComponentMap[field] : componentMap[mapKey]
|
|
111
111
|
let component = mapEntry, props = {}
|
|
112
112
|
|
|
113
|
-
console.log(schema.properties, fieldEntry)
|
|
114
113
|
if (mapKey === 'array' && schema.properties[fieldEntry].options) {
|
|
115
114
|
props.options = (
|
|
116
115
|
schema.properties[fieldEntry].options
|
|
@@ -124,7 +123,7 @@ class FormulatorFormSection extends React.Component {
|
|
|
124
123
|
if (mapKey === 'select') {
|
|
125
124
|
props.options = (
|
|
126
125
|
type.map(value => ({
|
|
127
|
-
label: translations?.field?.value || value,
|
|
126
|
+
label: translations?.[field]?.[value] || value,
|
|
128
127
|
value
|
|
129
128
|
}))
|
|
130
129
|
)
|
|
@@ -2,35 +2,51 @@ import React from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
Box,
|
|
6
5
|
List,
|
|
7
6
|
ListItem,
|
|
8
7
|
ListItemText
|
|
9
8
|
} from '@material-ui/core'
|
|
10
9
|
|
|
10
|
+
import { makeStyles } from '@material-ui/core/styles'
|
|
11
|
+
|
|
12
|
+
const useStyles = makeStyles(() => ({
|
|
13
|
+
formRepeater: {
|
|
14
|
+
padding: 0,
|
|
15
|
+
margin: 0
|
|
16
|
+
}
|
|
17
|
+
}))
|
|
18
|
+
|
|
11
19
|
const getValue = (value, catalog) => {
|
|
12
20
|
if (catalog && catalog[value] !== undefined) return catalog[value]
|
|
13
21
|
return value
|
|
14
22
|
}
|
|
15
23
|
|
|
16
|
-
const FormReadOnlyRepeater = ({ value,
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
const FormReadOnlyRepeater = ({ value, options }) => {
|
|
25
|
+
const styles = useStyles()
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<List
|
|
29
|
+
className={styles.formRepeater}
|
|
30
|
+
dense
|
|
31
|
+
>
|
|
19
32
|
{
|
|
20
33
|
value && value.map((entry, index) => (
|
|
21
34
|
// eslint-disable-next-line react/no-array-index-key
|
|
22
35
|
<ListItem key={`entry-${index}`}>
|
|
23
|
-
<ListItemText
|
|
36
|
+
<ListItemText
|
|
37
|
+
primary={getValue(entry, options)}
|
|
38
|
+
style={{ margin: 0 }}
|
|
39
|
+
/>
|
|
24
40
|
</ListItem>
|
|
25
41
|
))
|
|
26
42
|
}
|
|
27
43
|
</List>
|
|
28
|
-
|
|
29
|
-
|
|
44
|
+
)
|
|
45
|
+
}
|
|
30
46
|
|
|
31
47
|
FormReadOnlyRepeater.propTypes = {
|
|
32
48
|
value: PropTypes.array,
|
|
33
|
-
|
|
49
|
+
options: PropTypes.object
|
|
34
50
|
}
|
|
35
51
|
|
|
36
52
|
export default FormReadOnlyRepeater
|
|
@@ -5,7 +5,7 @@ import { Typography } from '@material-ui/core'
|
|
|
5
5
|
|
|
6
6
|
import { DateTime } from 'luxon'
|
|
7
7
|
|
|
8
|
-
const FormReadOnlyText = ({ value, type, renderFormat }) => {
|
|
8
|
+
const FormReadOnlyText = ({ value, type, renderFormat, multiline }) => {
|
|
9
9
|
let finalValue = value
|
|
10
10
|
|
|
11
11
|
if (type === 'date' || type === 'datetime-local') {
|
|
@@ -20,7 +20,10 @@ const FormReadOnlyText = ({ value, type, renderFormat }) => {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<Typography
|
|
23
|
+
<Typography
|
|
24
|
+
variant="body1"
|
|
25
|
+
style={{ whiteSpace: multiline ? 'pre-line' : 'inherit' }}
|
|
26
|
+
>
|
|
24
27
|
{finalValue}
|
|
25
28
|
</Typography>
|
|
26
29
|
)
|
|
@@ -35,7 +38,8 @@ FormReadOnlyText.propTypes = {
|
|
|
35
38
|
renderFormat: PropTypes.oneOfType([
|
|
36
39
|
PropTypes.string,
|
|
37
40
|
PropTypes.object
|
|
38
|
-
])
|
|
41
|
+
]),
|
|
42
|
+
multiline: PropTypes.bool
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
export default FormReadOnlyText
|
|
@@ -137,6 +137,12 @@ Types.args = {
|
|
|
137
137
|
},
|
|
138
138
|
translations: {
|
|
139
139
|
...typesTranslations,
|
|
140
|
+
simpleSelect: {
|
|
141
|
+
Citrus: 'Zitrone',
|
|
142
|
+
Banana: 'Banane',
|
|
143
|
+
Apple: 'Apfel',
|
|
144
|
+
Date: 'Dattel'
|
|
145
|
+
},
|
|
140
146
|
arrayCatalogRepeater: {
|
|
141
147
|
cat: 'Mieze',
|
|
142
148
|
dog: 'Doggo',
|
|
@@ -145,6 +151,16 @@ Types.args = {
|
|
|
145
151
|
}
|
|
146
152
|
},
|
|
147
153
|
data: {
|
|
154
|
+
simpleText: 'My first input text',
|
|
155
|
+
multilineText: 'A lot of lines\nin my input\nare fun!',
|
|
156
|
+
simpleSwitch: true,
|
|
157
|
+
simpleCheckbox: true,
|
|
158
|
+
booleanLabelPlace: false,
|
|
159
|
+
simpleNumber: 5,
|
|
160
|
+
advancedNumber: 1.25,
|
|
161
|
+
simpleSelect: 'Banana',
|
|
162
|
+
arrayRepeater: ['First Entry', 'Second Entry', 'And a third one'],
|
|
163
|
+
arrayCatalogRepeater: ['cat', 'dog', 'fish'],
|
|
148
164
|
hiddenDataInput: 'Data we do not want to show in Video Calls',
|
|
149
165
|
hiddenGroupInput1: 'sensitive data',
|
|
150
166
|
hiddenGroupInput2: 'non-public information',
|