@pinuts/bsr-uikit-relaunch 0.2.36 → 0.2.37
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupInputField.d.ts","sourceRoot":"","sources":["../../../src/items/GroupInputField/GroupInputField.jsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"GroupInputField.d.ts","sourceRoot":"","sources":["../../../src/items/GroupInputField/GroupInputField.jsx"],"names":[],"mappings":";AAqKA,uEAMC;kBA3KiB,OAAO"}
|
|
@@ -55,8 +55,12 @@ const GroupInputField = _ref => {
|
|
|
55
55
|
const handleRadioChange = e => {
|
|
56
56
|
onChange(inputOptions[e.target.value]?.value);
|
|
57
57
|
};
|
|
58
|
+
const translateLabel = function () {
|
|
59
|
+
let label = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
60
|
+
return !label.includes(':') && !label.includes('<') ? t(label) : label;
|
|
61
|
+
};
|
|
58
62
|
if (viewMode) {
|
|
59
|
-
return /*#__PURE__*/_react.default.createElement(_HTMLParserSanitized.HTMLParserSanitized, null, inputOptions.filter(opt => getIsSelected(value, opt)).map(opt =>
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement(_HTMLParserSanitized.HTMLParserSanitized, null, inputOptions.filter(opt => getIsSelected(value, opt)).map(opt => translateLabel(opt.label)).join(', '));
|
|
60
64
|
}
|
|
61
65
|
const ariaDescribedBy = [helpText && fieldIds.helpText, isInvalid && fieldIds.errorMessage].filter(Boolean).join(' ');
|
|
62
66
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -94,7 +98,7 @@ const GroupInputField = _ref => {
|
|
|
94
98
|
})), /*#__PURE__*/_react.default.createElement("label", {
|
|
95
99
|
className: "label ps-2",
|
|
96
100
|
htmlFor: usedId
|
|
97
|
-
}, /*#__PURE__*/_react.default.createElement(_HTMLParserSanitized.HTMLParserSanitized, null,
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement(_HTMLParserSanitized.HTMLParserSanitized, null, translateLabel(opt.label))));
|
|
98
102
|
})) : /*#__PURE__*/_react.default.createElement("div", {
|
|
99
103
|
className: "error-text"
|
|
100
104
|
}, t('bsrItems.noOptionsGiven')));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../../../src/items/SelectField/SelectField.jsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../../../src/items/SelectField/SelectField.jsx"],"names":[],"mappings":";AAmHA,mEAMC;kBAzHiD,OAAO"}
|
|
@@ -37,6 +37,10 @@ const SelectField = _ref => {
|
|
|
37
37
|
const formControlClassNames = (0, _index.getFormControlClassNames)(isInvalid, readOnly, disabled, className, ['select', field.className].filter(Boolean));
|
|
38
38
|
const handleChange = e => onChange(e.target.value);
|
|
39
39
|
const selectOptions = (0, _useGetOptionList.default)(options, emptyOptionLabel, skipOptions);
|
|
40
|
+
const translateLabel = function () {
|
|
41
|
+
let label = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
42
|
+
return !label.includes(':') && !label.includes('<') ? t(label) : label;
|
|
43
|
+
};
|
|
40
44
|
|
|
41
45
|
// // if no option is selected yet, and no empty option is available, the first option will be preselected
|
|
42
46
|
const doItJustOnce = (0, _react.useRef)(false);
|
|
@@ -48,7 +52,7 @@ const SelectField = _ref => {
|
|
|
48
52
|
}
|
|
49
53
|
}, [field, emptyOption, selectOptions, helpers, doItJustOnce]);
|
|
50
54
|
if (viewMode) {
|
|
51
|
-
return selectOptions.filter(opt => opt.value === field?.value || opt.value !== '' && Array.isArray(field?.value) && field?.value?.includes(opt.value)).map(opt =>
|
|
55
|
+
return selectOptions.filter(opt => opt.value === field?.value || opt.value !== '' && Array.isArray(field?.value) && field?.value?.includes(opt.value)).map(opt => translateLabel(opt.label)).join(', ');
|
|
52
56
|
}
|
|
53
57
|
return /*#__PURE__*/_react.default.createElement("select", _extends({}, field, ariaAttributes, inputProps, {
|
|
54
58
|
className: formControlClassNames,
|
|
@@ -56,7 +60,7 @@ const SelectField = _ref => {
|
|
|
56
60
|
}), selectOptions.map(opt => /*#__PURE__*/_react.default.createElement("option", {
|
|
57
61
|
key: opt.value,
|
|
58
62
|
value: opt.value
|
|
59
|
-
},
|
|
63
|
+
}, translateLabel(opt.label))));
|
|
60
64
|
};
|
|
61
65
|
SelectField.propTypes = {
|
|
62
66
|
..._FormFieldChildPropTypes.default,
|