@k-int/stripes-kint-components 5.2.3 → 5.3.1
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/CHANGELOG.md +15 -0
- package/es/index.js +8 -0
- package/es/lib/ActionList/ActionListFieldArray.js +61 -43
- package/es/lib/ComboButton/ComboButton.js +6 -5
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +7 -4
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +32 -30
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +2 -2
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +33 -32
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +3 -3
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +10 -5
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +25 -19
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +5 -5
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -2
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
- package/es/lib/CustomProperties/Edit/testResources.js +12 -11
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +11 -7
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +28 -20
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +8 -8
- package/es/lib/CustomProperties/Filter/testResources.js +2 -1
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +2 -1
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +26 -19
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +11 -7
- package/es/lib/CycleButton/CycleButton.js +1 -1
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +82 -29
- package/es/lib/EditableRefdataList/EditableRefdataList.js +33 -27
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +1 -1
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +5 -6
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +12 -10
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +0 -1
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +4 -4
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +7 -4
- package/es/lib/IconSelect/IconSelect.js +9 -5
- package/es/lib/NoResultsMessage/NoResultsMessage.js +4 -4
- package/es/lib/RefdataButtons/RefdataButtons.js +3 -3
- package/es/lib/RefdataCategoriesSettings/RefdataCategoriesSettings.js +158 -0
- package/es/lib/RefdataCategoriesSettings/index.js +13 -0
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +28 -21
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +6 -5
- package/es/lib/RichSelect/RichSelect.js +19 -14
- package/es/lib/RichSelect/useSelectedOption.js +2 -1
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +17 -14
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +6 -4
- package/es/lib/SASQRoute/SASQRoute.js +2 -2
- package/es/lib/SASQViewComponent/SASQViewComponent.js +9 -5
- package/es/lib/SettingPage/SettingPagePane.js +2 -2
- package/es/lib/SettingsFormContainer/SettingsFormContainer.js +2 -3
- package/es/lib/Typedown/Typedown.js +26 -20
- package/es/lib/hooks/__mocks__/index.js +4 -0
- package/es/lib/hooks/index.js +7 -0
- package/es/lib/hooks/typedownHooks/useTypedown.js +2 -2
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
- package/es/lib/hooks/useActionListRef.js +34 -0
- package/es/lib/hooks/useActiveElement.js +1 -1
- package/es/lib/hooks/useCustomProperties.js +2 -2
- package/es/lib/hooks/useHelperApp.js +6 -6
- package/es/lib/hooks/useIntlKeyStore.js +7 -4
- package/es/lib/hooks/useKintIntl.js +11 -5
- package/es/lib/hooks/useKiwtSASQuery.js +1 -1
- package/es/lib/hooks/useModConfigEntries.js +2 -2
- package/es/lib/hooks/useMutateCustomProperties.js +8 -8
- package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
- package/es/lib/hooks/useMutateRefdataCategory.js +4 -4
- package/es/lib/hooks/useMutateRefdataValue.js +6 -6
- package/es/lib/hooks/useQIndex.js +17 -9
- package/es/lib/hooks/useRefdata.js +3 -3
- package/es/lib/hooks/useTemplates.js +4 -4
- package/es/lib/settingsHooks/useAppSettings.js +11 -7
- package/es/lib/settingsHooks/useSettingSection.js +2 -2
- package/es/lib/settingsHooks/useSettings.js +3 -3
- package/es/lib/utils/buildUrl.js +3 -2
- package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +5 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
- package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +5 -4
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +3 -2
- package/es/lib/utils/generateKiwtQueryParams.js +37 -28
- package/es/lib/utils/groupCustomPropertiesByCtx.js +3 -2
- package/es/lib/utils/matchString.js +1 -1
- package/es/lib/utils/parseErrorResponse.js +3 -2
- package/es/lib/utils/parseModConfigEntry.js +0 -1
- package/es/lib/utils/selectorSafe.js +3 -2
- package/es/lib/utils/sortByLabel.js +3 -2
- package/es/lib/validators/validators.js +3 -3
- package/package.json +1 -1
- package/src/index.js +3 -0
- package/src/lib/ActionList/ActionListFieldArray.js +29 -15
- package/src/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +67 -13
- package/src/lib/RefdataCategoriesSettings/RefdataCategoriesSettings.js +176 -0
- package/src/lib/RefdataCategoriesSettings/index.js +1 -0
- package/src/lib/hooks/__mocks__/index.js +4 -0
- package/src/lib/hooks/index.js +1 -0
- package/src/lib/hooks/useActionListRef.js +36 -0
- package/src/lib/hooks/useQIndex.js +12 -4
|
@@ -11,6 +11,7 @@ var _CustomPropertyCard = _interopRequireDefault(require("./CustomPropertyCard")
|
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
const CustomPropertiesViewCtx = _ref => {
|
|
14
|
+
var _custprops$filter$len, _custprops$filter;
|
|
14
15
|
let {
|
|
15
16
|
ctx,
|
|
16
17
|
customProperties = [],
|
|
@@ -35,7 +36,7 @@ const CustomPropertiesViewCtx = _ref => {
|
|
|
35
36
|
// Chain formatKintMessages together using provided fallbackMessage to
|
|
36
37
|
// allow for "If override or translation exists, use it, else use default"
|
|
37
38
|
return kintIntl.formatKintMessage({
|
|
38
|
-
id:
|
|
39
|
+
id: "customProperties.ctx.".concat(ctx),
|
|
39
40
|
overrideValue: labelOverrides[ctx],
|
|
40
41
|
fallbackMessage: kintIntl.formatKintMessage({
|
|
41
42
|
id: 'customProperties.defaultTitle',
|
|
@@ -74,27 +75,30 @@ const CustomPropertiesViewCtx = _ref => {
|
|
|
74
75
|
]
|
|
75
76
|
}
|
|
76
77
|
});
|
|
77
|
-
|
|
78
78
|
if (isLoading) {
|
|
79
79
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Accordion, {
|
|
80
80
|
closedByDefault: true,
|
|
81
81
|
displayWhenClosed: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}),
|
|
82
82
|
displayWhenOpen: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}),
|
|
83
|
-
id:
|
|
83
|
+
id: "".concat(id, "-accordion-").concat(ctx),
|
|
84
84
|
label: getAccordionLabel(),
|
|
85
85
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {})
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
const countSetProperties = primary =>
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
const countSetProperties = primary => {
|
|
89
|
+
var _Object$entries$filte, _Object$entries;
|
|
90
|
+
return (_Object$entries$filte = (_Object$entries = Object.entries(customProperties)) === null || _Object$entries === void 0 || (_Object$entries = _Object$entries.filter(_ref2 => {
|
|
91
|
+
var _cp$, _cp$2, _cp$3;
|
|
92
|
+
let [_key, cp] = _ref2;
|
|
93
|
+
return (((_cp$ = cp[0]) === null || _cp$ === void 0 || (_cp$ = _cp$.type) === null || _cp$ === void 0 ? void 0 : _cp$.ctx) === ctx || ctx === 'isNull' && !((_cp$2 = cp[0]) !== null && _cp$2 !== void 0 && (_cp$2 = _cp$2.type) !== null && _cp$2 !== void 0 && _cp$2.ctx)) &&
|
|
94
|
+
// Either the ctx string matches, or isNull matches blank
|
|
95
|
+
((_cp$3 = cp[0]) === null || _cp$3 === void 0 || (_cp$3 = _cp$3.type) === null || _cp$3 === void 0 ? void 0 : _cp$3.primary) === primary // Only count non-primary set custprops
|
|
96
|
+
;
|
|
97
|
+
})) === null || _Object$entries === void 0 ? void 0 : _Object$entries.length) !== null && _Object$entries$filte !== void 0 ? _Object$entries$filte : 0;
|
|
98
|
+
};
|
|
95
99
|
|
|
96
100
|
// We need to display any set properties, along with any non-set primary properties
|
|
97
|
-
const primaryCount = custprops
|
|
101
|
+
const primaryCount = (_custprops$filter$len = custprops === null || custprops === void 0 || (_custprops$filter = custprops.filter(cp => cp.primary === true)) === null || _custprops$filter === void 0 ? void 0 : _custprops$filter.length) !== null && _custprops$filter$len !== void 0 ? _custprops$filter$len : 0;
|
|
98
102
|
const optionalCount = countSetProperties(false);
|
|
99
103
|
const setPrimaryCount = countSetProperties(true);
|
|
100
104
|
return primaryCount + optionalCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Accordion, {
|
|
@@ -105,15 +109,18 @@ const CustomPropertiesViewCtx = _ref => {
|
|
|
105
109
|
displayWhenOpen: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Badge, {
|
|
106
110
|
children: setPrimaryCount + optionalCount
|
|
107
111
|
}),
|
|
108
|
-
id:
|
|
112
|
+
id: "".concat(id, "-accordion-").concat(ctx),
|
|
109
113
|
label: getAccordionLabel(),
|
|
110
|
-
children: custprops.map((cp, index) =>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
children: custprops.map((cp, index) => {
|
|
115
|
+
var _customProperties$cp$;
|
|
116
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyCard.default, {
|
|
117
|
+
ctx: ctx,
|
|
118
|
+
customProperty: customProperties === null || customProperties === void 0 || (_customProperties$cp$ = customProperties[cp.name]) === null || _customProperties$cp$ === void 0 ? void 0 : _customProperties$cp$[0],
|
|
119
|
+
customPropertyDefinition: cp,
|
|
120
|
+
index: index,
|
|
121
|
+
labelOverrides: labelOverrides
|
|
122
|
+
}, "custom-property-card-".concat(ctx, "[").concat(index, "]"));
|
|
123
|
+
})
|
|
117
124
|
});
|
|
118
125
|
};
|
|
119
126
|
CustomPropertiesViewCtx.propTypes = {
|
|
@@ -30,8 +30,9 @@ const CustomPropertyCard = _ref => {
|
|
|
30
30
|
if (!toDisplay) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
|
-
const internalFalse = customProperty
|
|
33
|
+
const internalFalse = (customProperty === null || customProperty === void 0 ? void 0 : customProperty.internal) === false || (customProperty === null || customProperty === void 0 ? void 0 : customProperty.internal) === undefined && customPropertyDefinition.defaultInternal === false;
|
|
34
34
|
const renderValue = () => {
|
|
35
|
+
var _customProperty$value, _customProperty$value2, _customProperty$value3, _customProperty$value4;
|
|
35
36
|
if (!customProperty) {
|
|
36
37
|
return kintIntl.formatKintMessage({
|
|
37
38
|
id: 'notSet',
|
|
@@ -41,11 +42,14 @@ const CustomPropertyCard = _ref => {
|
|
|
41
42
|
switch (customPropertyDefinition.type) {
|
|
42
43
|
case CUSTPROP_TYPES.MULTI_REFDATA_CLASS_NAME:
|
|
43
44
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.List, {
|
|
44
|
-
items: customProperty.value
|
|
45
|
+
items: (_customProperty$value = customProperty.value) === null || _customProperty$value === void 0 ? void 0 : _customProperty$value.map(item => {
|
|
46
|
+
var _item$label;
|
|
47
|
+
return (_item$label = item === null || item === void 0 ? void 0 : item.label) !== null && _item$label !== void 0 ? _item$label : item === null || item === void 0 ? void 0 : item.value;
|
|
48
|
+
}),
|
|
45
49
|
listStyle: "bullets"
|
|
46
50
|
});
|
|
47
51
|
case CUSTPROP_TYPES.REFDATA_CLASS_NAME:
|
|
48
|
-
return customProperty.value
|
|
52
|
+
return (_customProperty$value2 = (_customProperty$value3 = customProperty.value) === null || _customProperty$value3 === void 0 ? void 0 : _customProperty$value3.label) !== null && _customProperty$value2 !== void 0 ? _customProperty$value2 : (_customProperty$value4 = customProperty.value) === null || _customProperty$value4 === void 0 ? void 0 : _customProperty$value4.value;
|
|
49
53
|
case CUSTPROP_TYPES.DECIMAL_CLASS_NAME:
|
|
50
54
|
case CUSTPROP_TYPES.INTEGER_CLASS_NAME:
|
|
51
55
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedNumber, {
|
|
@@ -73,7 +77,7 @@ const CustomPropertyCard = _ref => {
|
|
|
73
77
|
content: customPropertyDefinition.description
|
|
74
78
|
}) : null]
|
|
75
79
|
}),
|
|
76
|
-
id:
|
|
80
|
+
id: "customproperty-card-".concat(index),
|
|
77
81
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Row, {
|
|
78
82
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
79
83
|
xs: 6,
|
|
@@ -84,7 +88,7 @@ const CustomPropertyCard = _ref => {
|
|
|
84
88
|
}),
|
|
85
89
|
children: renderValue()
|
|
86
90
|
})
|
|
87
|
-
}), customProperty
|
|
91
|
+
}), customProperty !== null && customProperty !== void 0 && customProperty.note ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
88
92
|
xs: 6,
|
|
89
93
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
90
94
|
label: kintIntl.formatKintMessage({
|
|
@@ -119,7 +123,7 @@ const CustomPropertyCard = _ref => {
|
|
|
119
123
|
id: 'customProperties.publicNote',
|
|
120
124
|
overrideValue: labelOverrides.publicNote
|
|
121
125
|
}),
|
|
122
|
-
children: customProperty
|
|
126
|
+
children: customProperty !== null && customProperty !== void 0 && customProperty.publicNote ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
123
127
|
style: {
|
|
124
128
|
whiteSpace: 'pre-wrap'
|
|
125
129
|
},
|
|
@@ -128,7 +132,7 @@ const CustomPropertyCard = _ref => {
|
|
|
128
132
|
})
|
|
129
133
|
})]
|
|
130
134
|
})]
|
|
131
|
-
},
|
|
135
|
+
}, "customPropertyCard-".concat(ctx, "[").concat(index, "]"));
|
|
132
136
|
};
|
|
133
137
|
CustomPropertyCard.propTypes = {
|
|
134
138
|
ctx: _propTypes.default.string,
|
|
@@ -4,18 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _components = require("@folio/stripes/components");
|
|
10
10
|
var _core = require("@folio/stripes/core");
|
|
11
11
|
var _hooks = require("../hooks");
|
|
12
|
+
var _SearchField = _interopRequireDefault(require("../SearchField"));
|
|
12
13
|
var _ActionList = _interopRequireDefault(require("../ActionList"));
|
|
13
14
|
var _validators = require("../validators");
|
|
14
15
|
var _utils = require("../utils");
|
|
16
|
+
var _CustomProperties = _interopRequireDefault(require("../../../styles/CustomProperties.css"));
|
|
15
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
19
|
const propTypes = {
|
|
20
20
|
afterQueryCalls: _propTypes.default.object,
|
|
21
21
|
catchQueryCalls: _propTypes.default.object,
|
|
@@ -24,13 +24,18 @@ const propTypes = {
|
|
|
24
24
|
delete: _propTypes.default.bool,
|
|
25
25
|
view: _propTypes.default.bool
|
|
26
26
|
}),
|
|
27
|
+
handleRefdataCategoryClick: _propTypes.default.func,
|
|
28
|
+
hideCreateButton: _propTypes.default.bool,
|
|
27
29
|
intlKey: _propTypes.default.string,
|
|
28
30
|
intlNS: _propTypes.default.string,
|
|
31
|
+
isSearchDisabled: _propTypes.default.bool,
|
|
29
32
|
label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
30
33
|
labelOverrides: _propTypes.default.object,
|
|
34
|
+
onConfirmDelete: _propTypes.default.func,
|
|
31
35
|
refdataEndpoint: _propTypes.default.string
|
|
32
36
|
};
|
|
33
|
-
const EditableRefdataCategoryList = _ref => {
|
|
37
|
+
const EditableRefdataCategoryList = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
38
|
+
var _deleteModal$refdata2;
|
|
34
39
|
let {
|
|
35
40
|
afterQueryCalls,
|
|
36
41
|
catchQueryCalls,
|
|
@@ -45,11 +50,17 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
45
50
|
create: true,
|
|
46
51
|
delete: true
|
|
47
52
|
},
|
|
53
|
+
handleRefdataCategoryClick,
|
|
54
|
+
hideCreateButton,
|
|
55
|
+
isSearchDisabled,
|
|
48
56
|
intlKey: passedIntlKey,
|
|
49
57
|
intlNS: passedIntlNS,
|
|
50
58
|
label,
|
|
51
59
|
labelOverrides = {},
|
|
52
60
|
// An object containing translation alternatives
|
|
61
|
+
// A function which will fire on confirmation of delete,
|
|
62
|
+
// with id of deleted Refdata category
|
|
63
|
+
onConfirmDelete = _id => null,
|
|
53
64
|
refdataEndpoint
|
|
54
65
|
} = _ref;
|
|
55
66
|
/* A component that allows for editing of refdata categories */
|
|
@@ -68,6 +79,7 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
68
79
|
endpoint: refdataEndpoint,
|
|
69
80
|
returnQueryObject: true
|
|
70
81
|
});
|
|
82
|
+
const [searchTerm, setSearchTerm] = (0, _react.useState)('');
|
|
71
83
|
const [contentData, setContentData] = (0, _react.useState)([]);
|
|
72
84
|
const [deleteModal, setDeleteModal] = (0, _react.useState)({
|
|
73
85
|
visible: false,
|
|
@@ -76,9 +88,16 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
76
88
|
const sortByDesc = (a, b) => a.desc.localeCompare(b.desc);
|
|
77
89
|
(0, _react.useEffect)(() => {
|
|
78
90
|
if (!isRefdataLoading) {
|
|
79
|
-
|
|
91
|
+
if (searchTerm) {
|
|
92
|
+
var _filteredRefdata$sort;
|
|
93
|
+
const filteredRefdata = refdata === null || refdata === void 0 ? void 0 : refdata.filter(rd => rd.desc.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
94
|
+
setContentData((_filteredRefdata$sort = filteredRefdata === null || filteredRefdata === void 0 ? void 0 : filteredRefdata.sort(sortByDesc)) !== null && _filteredRefdata$sort !== void 0 ? _filteredRefdata$sort : []);
|
|
95
|
+
} else {
|
|
96
|
+
var _refdata$sort;
|
|
97
|
+
setContentData((_refdata$sort = refdata === null || refdata === void 0 ? void 0 : refdata.sort(sortByDesc)) !== null && _refdata$sort !== void 0 ? _refdata$sort : []);
|
|
98
|
+
}
|
|
80
99
|
}
|
|
81
|
-
}, [isRefdataLoading, refdata]);
|
|
100
|
+
}, [isRefdataLoading, refdata, searchTerm]);
|
|
82
101
|
|
|
83
102
|
// Edit and Create will use the same POST mutation
|
|
84
103
|
const {
|
|
@@ -87,12 +106,12 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
87
106
|
} = (0, _hooks.useMutateRefdataCategory)({
|
|
88
107
|
afterQueryCalls: {
|
|
89
108
|
delete: json => {
|
|
90
|
-
if (afterQueryCalls
|
|
109
|
+
if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.delete) {
|
|
91
110
|
afterQueryCalls.delete(json);
|
|
92
111
|
}
|
|
93
112
|
},
|
|
94
113
|
post: json => {
|
|
95
|
-
if (afterQueryCalls
|
|
114
|
+
if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.post) {
|
|
96
115
|
afterQueryCalls.post(json);
|
|
97
116
|
}
|
|
98
117
|
}
|
|
@@ -101,23 +120,23 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
101
120
|
// Default delete behaviour is to fire a callout, either with kint-components default message
|
|
102
121
|
// or one provided in labelOverrides, which is passed the error message and refdata in question
|
|
103
122
|
delete: async err => {
|
|
123
|
+
var _deleteModal$refdata;
|
|
104
124
|
const errorResp = await (0, _utils.parseErrorResponse)(err.response);
|
|
105
125
|
callout.sendCallout({
|
|
106
126
|
message: kintIntl.formatKintMessage({
|
|
107
127
|
id: 'refdataCategory.deleteRefdataCategory.errorMessage',
|
|
108
|
-
overrideValue: labelOverrides
|
|
128
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteError
|
|
109
129
|
}, {
|
|
110
|
-
label: deleteModal
|
|
111
|
-
error: errorResp
|
|
130
|
+
label: deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata = deleteModal.refdata) === null || _deleteModal$refdata === void 0 ? void 0 : _deleteModal$refdata.label,
|
|
131
|
+
error: errorResp === null || errorResp === void 0 ? void 0 : errorResp.message
|
|
112
132
|
}),
|
|
113
133
|
type: 'error'
|
|
114
134
|
});
|
|
115
135
|
},
|
|
116
136
|
...catchQueryCalls // override defaults here
|
|
117
137
|
},
|
|
118
|
-
|
|
119
138
|
endpoint: refdataEndpoint,
|
|
120
|
-
id: refdata
|
|
139
|
+
id: refdata === null || refdata === void 0 ? void 0 : refdata.id,
|
|
121
140
|
queryParams: {
|
|
122
141
|
delete: {
|
|
123
142
|
enabled: !!refdata
|
|
@@ -133,13 +152,14 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
133
152
|
|
|
134
153
|
// This is the function which will take a row in the table and assign the relevant actions to it
|
|
135
154
|
const actionAssigner = rowData => {
|
|
155
|
+
var _rowData$values;
|
|
136
156
|
const actionArray = [];
|
|
137
|
-
if (!rowData
|
|
157
|
+
if (!(rowData !== null && rowData !== void 0 && (_rowData$values = rowData.values) !== null && _rowData$values !== void 0 && _rowData$values.length) && deleteCondition) {
|
|
138
158
|
actionArray.push({
|
|
139
159
|
name: 'delete',
|
|
140
160
|
label: kintIntl.formatKintMessage({
|
|
141
161
|
id: 'delete',
|
|
142
|
-
overrideValue: labelOverrides
|
|
162
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
|
|
143
163
|
}),
|
|
144
164
|
icon: 'trash',
|
|
145
165
|
callback: data => setDeleteModal({
|
|
@@ -148,25 +168,39 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
148
168
|
}),
|
|
149
169
|
ariaLabel: data => kintIntl.formatKintMessage({
|
|
150
170
|
id: 'refdataCategory.deleteAriaLabel',
|
|
151
|
-
overrideValue: labelOverrides
|
|
171
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteAriaLabel
|
|
152
172
|
}, {
|
|
153
|
-
label: data
|
|
173
|
+
label: data === null || data === void 0 ? void 0 : data.label
|
|
154
174
|
})
|
|
155
175
|
});
|
|
156
176
|
}
|
|
157
177
|
return actionArray;
|
|
158
178
|
};
|
|
159
179
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
160
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
180
|
+
children: [!isSearchDisabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
181
|
+
className: _CustomProperties.default.lookupSearchContainer,
|
|
182
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchField.default, {
|
|
183
|
+
ariaLabel: kintIntl.formatKintMessage({
|
|
184
|
+
id: 'refdataCategories.config.searchAriaLabel',
|
|
185
|
+
overrideValue: labelOverrides.searchAriaLabel,
|
|
186
|
+
fallbackMessage: 'refdata-category-search-field'
|
|
187
|
+
}),
|
|
188
|
+
className: _CustomProperties.default.lookupSearch,
|
|
189
|
+
marginBottom0: true,
|
|
190
|
+
onChange: e => setSearchTerm(e.target.value),
|
|
191
|
+
value: searchTerm
|
|
192
|
+
})
|
|
193
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionList.default, {
|
|
194
|
+
ref: ref,
|
|
161
195
|
actionAssigner: actionAssigner,
|
|
162
196
|
columnMapping: {
|
|
163
197
|
desc: kintIntl.formatKintMessage({
|
|
164
198
|
id: 'refdataCategory.refdataCategory',
|
|
165
|
-
overrideValue: labelOverrides
|
|
199
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.refdataCategory
|
|
166
200
|
}),
|
|
167
201
|
values: kintIntl.formatKintMessage({
|
|
168
202
|
id: 'refdataCategory.noOfValues',
|
|
169
|
-
overrideValue: labelOverrides
|
|
203
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.noOfValues
|
|
170
204
|
})
|
|
171
205
|
},
|
|
172
206
|
contentData: contentData,
|
|
@@ -175,10 +209,27 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
175
209
|
},
|
|
176
210
|
createCallback: !createCondition ? null : data => createRefdataCategory(data),
|
|
177
211
|
formatter: {
|
|
178
|
-
|
|
212
|
+
desc: rowData => {
|
|
213
|
+
if (handleRefdataCategoryClick) {
|
|
214
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
215
|
+
buttonStyle: "link",
|
|
216
|
+
onClick: () => handleRefdataCategoryClick(rowData),
|
|
217
|
+
children: rowData === null || rowData === void 0 ? void 0 : rowData.desc
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return rowData === null || rowData === void 0 ? void 0 : rowData.desc;
|
|
221
|
+
},
|
|
222
|
+
values: rowData => {
|
|
223
|
+
var _rowData$values2;
|
|
224
|
+
return rowData === null || rowData === void 0 || (_rowData$values2 = rowData.values) === null || _rowData$values2 === void 0 ? void 0 : _rowData$values2.length;
|
|
225
|
+
}
|
|
179
226
|
}
|
|
180
227
|
/* Hide actions column when no permissions, or no deletable refdata categories */,
|
|
181
|
-
hideActionsColumn: !createCondition && !deleteCondition || !contentData
|
|
228
|
+
hideActionsColumn: !createCondition && !deleteCondition || !(contentData !== null && contentData !== void 0 && contentData.find(cd => {
|
|
229
|
+
var _cd$values;
|
|
230
|
+
return (cd === null || cd === void 0 || (_cd$values = cd.values) === null || _cd$values === void 0 ? void 0 : _cd$values.length) === 0;
|
|
231
|
+
})),
|
|
232
|
+
hideCreateButton: hideCreateButton,
|
|
182
233
|
label: label,
|
|
183
234
|
validateFields: {
|
|
184
235
|
desc: () => _validators.required
|
|
@@ -187,32 +238,34 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
187
238
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ConfirmationModal, {
|
|
188
239
|
confirmLabel: kintIntl.formatKintMessage({
|
|
189
240
|
id: 'delete',
|
|
190
|
-
overrideValue: labelOverrides
|
|
241
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
|
|
191
242
|
}),
|
|
192
243
|
heading: kintIntl.formatKintMessage({
|
|
193
244
|
id: 'refdataCategory.deleteRefdataCategory',
|
|
194
|
-
overrideValue: labelOverrides
|
|
245
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteRefdataCategory
|
|
195
246
|
}),
|
|
196
247
|
message: kintIntl.formatKintMessage({
|
|
197
248
|
id: 'refdataCategory.deleteRefdataCategory.confirmMessage',
|
|
198
|
-
overrideValue: labelOverrides
|
|
249
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteRefdataCategoryMessage
|
|
199
250
|
}, {
|
|
200
|
-
name: deleteModal
|
|
251
|
+
name: deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata2 = deleteModal.refdata) === null || _deleteModal$refdata2 === void 0 ? void 0 : _deleteModal$refdata2.desc
|
|
201
252
|
}),
|
|
202
253
|
onCancel: () => setDeleteModal({
|
|
203
254
|
visible: false,
|
|
204
255
|
refdata: null
|
|
205
256
|
}),
|
|
206
257
|
onConfirm: () => {
|
|
207
|
-
|
|
258
|
+
var _deleteModal$refdata3, _deleteModal$refdata4;
|
|
259
|
+
deleteRefdataCategory(deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata3 = deleteModal.refdata) === null || _deleteModal$refdata3 === void 0 ? void 0 : _deleteModal$refdata3.id);
|
|
260
|
+
onConfirmDelete(deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata4 = deleteModal.refdata) === null || _deleteModal$refdata4 === void 0 ? void 0 : _deleteModal$refdata4.id);
|
|
208
261
|
setDeleteModal({
|
|
209
262
|
visible: false,
|
|
210
263
|
refdata: null
|
|
211
264
|
});
|
|
212
265
|
},
|
|
213
|
-
open: deleteModal
|
|
266
|
+
open: deleteModal === null || deleteModal === void 0 ? void 0 : deleteModal.visible
|
|
214
267
|
})]
|
|
215
268
|
});
|
|
216
|
-
};
|
|
269
|
+
});
|
|
217
270
|
EditableRefdataCategoryList.propTypes = propTypes;
|
|
218
271
|
var _default = exports.default = EditableRefdataCategoryList;
|
|
@@ -33,6 +33,7 @@ const propTypes = {
|
|
|
33
33
|
refdataEndpoint: _propTypes.default.string
|
|
34
34
|
};
|
|
35
35
|
const EditableRefdataList = _ref => {
|
|
36
|
+
var _deleteModal$refdata2;
|
|
36
37
|
let {
|
|
37
38
|
afterQueryCalls,
|
|
38
39
|
allowSpecial = false,
|
|
@@ -87,7 +88,8 @@ const EditableRefdataList = _ref => {
|
|
|
87
88
|
const sortByLabel = (a, b) => a.label.localeCompare(b.label);
|
|
88
89
|
(0, _react.useEffect)(() => {
|
|
89
90
|
if (!isRefdataLoading) {
|
|
90
|
-
|
|
91
|
+
var _refdata$values$sort, _refdata$values;
|
|
92
|
+
setContentData((_refdata$values$sort = refdata === null || refdata === void 0 || (_refdata$values = refdata.values) === null || _refdata$values === void 0 ? void 0 : _refdata$values.sort(sortByLabel)) !== null && _refdata$values$sort !== void 0 ? _refdata$values$sort : []);
|
|
91
93
|
}
|
|
92
94
|
}, [isRefdataLoading, refdata]);
|
|
93
95
|
|
|
@@ -98,14 +100,16 @@ const EditableRefdataList = _ref => {
|
|
|
98
100
|
} = (0, _hooks.useMutateRefdataValue)({
|
|
99
101
|
afterQueryCalls: {
|
|
100
102
|
delete: json => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
var _json$values$sort, _json$values;
|
|
104
|
+
setContentData((_json$values$sort = json === null || json === void 0 || (_json$values = json.values) === null || _json$values === void 0 ? void 0 : _json$values.sort(sortByLabel)) !== null && _json$values$sort !== void 0 ? _json$values$sort : []);
|
|
105
|
+
if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.delete) {
|
|
103
106
|
afterQueryCalls.delete(json);
|
|
104
107
|
}
|
|
105
108
|
},
|
|
106
109
|
put: json => {
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
var _json$values$sort2, _json$values2;
|
|
111
|
+
setContentData((_json$values$sort2 = json === null || json === void 0 || (_json$values2 = json.values) === null || _json$values2 === void 0 ? void 0 : _json$values2.sort(sortByLabel)) !== null && _json$values$sort2 !== void 0 ? _json$values$sort2 : []);
|
|
112
|
+
if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.put) {
|
|
109
113
|
afterQueryCalls.put(json);
|
|
110
114
|
}
|
|
111
115
|
}
|
|
@@ -114,23 +118,23 @@ const EditableRefdataList = _ref => {
|
|
|
114
118
|
// Default delete behaviour is to fire a callout, either with kint-components default message
|
|
115
119
|
// or one provided in labelOverrides, which is passed the error message and refdata in question
|
|
116
120
|
delete: async err => {
|
|
121
|
+
var _deleteModal$refdata;
|
|
117
122
|
const errorResp = await (0, _utils.parseErrorResponse)(err.response);
|
|
118
123
|
callout.sendCallout({
|
|
119
124
|
message: kintIntl.formatKintMessage({
|
|
120
125
|
id: 'refdata.deleteRefdataValue.errorMessage',
|
|
121
|
-
overrideValue: labelOverrides
|
|
126
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteError
|
|
122
127
|
}, {
|
|
123
|
-
label: deleteModal
|
|
124
|
-
error: errorResp
|
|
128
|
+
label: deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata = deleteModal.refdata) === null || _deleteModal$refdata === void 0 ? void 0 : _deleteModal$refdata.label,
|
|
129
|
+
error: errorResp === null || errorResp === void 0 ? void 0 : errorResp.message
|
|
125
130
|
}),
|
|
126
131
|
type: 'error'
|
|
127
132
|
});
|
|
128
133
|
},
|
|
129
134
|
...catchQueryCalls // override defaults here
|
|
130
135
|
},
|
|
131
|
-
|
|
132
136
|
endpoint: refdataEndpoint,
|
|
133
|
-
id: refdata
|
|
137
|
+
id: refdata === null || refdata === void 0 ? void 0 : refdata.id,
|
|
134
138
|
queryParams: {
|
|
135
139
|
delete: {
|
|
136
140
|
enabled: !!refdata
|
|
@@ -152,24 +156,24 @@ const EditableRefdataList = _ref => {
|
|
|
152
156
|
name: 'edit',
|
|
153
157
|
label: kintIntl.formatKintMessage({
|
|
154
158
|
id: 'edit',
|
|
155
|
-
overrideValue: labelOverrides
|
|
159
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.edit
|
|
156
160
|
}),
|
|
157
161
|
icon: 'edit',
|
|
158
162
|
callback: data => editRefdataValue(data),
|
|
159
163
|
ariaLabel: data => kintIntl.formatKintMessage({
|
|
160
164
|
id: 'refdata.editAriaLabel',
|
|
161
|
-
overrideValue: labelOverrides
|
|
165
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.editAriaLabel
|
|
162
166
|
}, {
|
|
163
|
-
label: data
|
|
167
|
+
label: data === null || data === void 0 ? void 0 : data.label
|
|
164
168
|
})
|
|
165
169
|
});
|
|
166
170
|
}
|
|
167
|
-
if (!refdata
|
|
171
|
+
if (!(refdata !== null && refdata !== void 0 && refdata.internal) && deleteCondition) {
|
|
168
172
|
actionArray.push({
|
|
169
173
|
name: 'delete',
|
|
170
174
|
label: kintIntl.formatKintMessage({
|
|
171
175
|
id: 'delete',
|
|
172
|
-
overrideValue: labelOverrides
|
|
176
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
|
|
173
177
|
}),
|
|
174
178
|
icon: 'trash',
|
|
175
179
|
callback: data => setDeleteModal({
|
|
@@ -178,9 +182,9 @@ const EditableRefdataList = _ref => {
|
|
|
178
182
|
}),
|
|
179
183
|
ariaLabel: data => kintIntl.formatKintMessage({
|
|
180
184
|
id: 'refdata.deleteAriaLabel',
|
|
181
|
-
overrideValue: labelOverrides
|
|
185
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteAriaLabel
|
|
182
186
|
}, {
|
|
183
|
-
label: data
|
|
187
|
+
label: data === null || data === void 0 ? void 0 : data.label
|
|
184
188
|
})
|
|
185
189
|
});
|
|
186
190
|
}
|
|
@@ -192,24 +196,25 @@ const EditableRefdataList = _ref => {
|
|
|
192
196
|
columnMapping: {
|
|
193
197
|
label: kintIntl.formatKintMessage({
|
|
194
198
|
id: 'refdata.label',
|
|
195
|
-
overrideValue: labelOverrides
|
|
199
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.label
|
|
196
200
|
}),
|
|
197
201
|
value: kintIntl.formatKintMessage({
|
|
198
202
|
id: 'refdata.value',
|
|
199
|
-
overrideValue: labelOverrides
|
|
203
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.value
|
|
200
204
|
})
|
|
201
205
|
},
|
|
202
206
|
contentData: contentData,
|
|
203
207
|
creatableFields: {
|
|
204
208
|
value: () => false
|
|
205
209
|
},
|
|
206
|
-
createCallback: !createCondition || refdata
|
|
210
|
+
createCallback: !createCondition || refdata !== null && refdata !== void 0 && refdata.internal ? null : data => {
|
|
207
211
|
if (allowSpecial) {
|
|
208
212
|
editRefdataValue(data);
|
|
209
213
|
} else {
|
|
214
|
+
var _selectorSafe;
|
|
210
215
|
editRefdataValue({
|
|
211
216
|
...data,
|
|
212
|
-
value: (0, _utils.selectorSafe)(data
|
|
217
|
+
value: (_selectorSafe = (0, _utils.selectorSafe)(data === null || data === void 0 ? void 0 : data.label)) === null || _selectorSafe === void 0 ? void 0 : _selectorSafe.replaceAll('%20', ' ')
|
|
213
218
|
});
|
|
214
219
|
}
|
|
215
220
|
},
|
|
@@ -226,30 +231,31 @@ const EditableRefdataList = _ref => {
|
|
|
226
231
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ConfirmationModal, {
|
|
227
232
|
confirmLabel: kintIntl.formatKintMessage({
|
|
228
233
|
id: 'delete',
|
|
229
|
-
overrideValue: labelOverrides
|
|
234
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
|
|
230
235
|
}),
|
|
231
236
|
heading: kintIntl.formatKintMessage({
|
|
232
237
|
id: 'refdata.deleteRefdataValue',
|
|
233
|
-
overrideValue: labelOverrides
|
|
238
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteRefdataValue
|
|
234
239
|
}),
|
|
235
240
|
message: kintIntl.formatKintMessage({
|
|
236
241
|
id: 'refdata.deleteRefdataValue.confirmMessage',
|
|
237
|
-
overrideValue: labelOverrides
|
|
242
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteRefdataValueMessage
|
|
238
243
|
}, {
|
|
239
|
-
name: deleteModal
|
|
244
|
+
name: deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata2 = deleteModal.refdata) === null || _deleteModal$refdata2 === void 0 ? void 0 : _deleteModal$refdata2.label
|
|
240
245
|
}),
|
|
241
246
|
onCancel: () => setDeleteModal({
|
|
242
247
|
visible: false,
|
|
243
248
|
refdata: null
|
|
244
249
|
}),
|
|
245
250
|
onConfirm: () => {
|
|
246
|
-
|
|
251
|
+
var _deleteModal$refdata3;
|
|
252
|
+
deleteRefdataValue(deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata3 = deleteModal.refdata) === null || _deleteModal$refdata3 === void 0 ? void 0 : _deleteModal$refdata3.id);
|
|
247
253
|
setDeleteModal({
|
|
248
254
|
visible: false,
|
|
249
255
|
refdata: null
|
|
250
256
|
});
|
|
251
257
|
},
|
|
252
|
-
open: deleteModal
|
|
258
|
+
open: deleteModal === null || deleteModal === void 0 ? void 0 : deleteModal.visible
|
|
253
259
|
})]
|
|
254
260
|
});
|
|
255
261
|
};
|
|
@@ -28,7 +28,7 @@ const EditableSettingsListFieldArray = _ref => {
|
|
|
28
28
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
29
29
|
allowEdit: allowEdit,
|
|
30
30
|
component: _SettingField.SettingField,
|
|
31
|
-
"data-testid":
|
|
31
|
+
"data-testid": "editableSettingsListFieldArray[".concat(i, "]"),
|
|
32
32
|
intlKey: passedIntlKey,
|
|
33
33
|
intlNS: passedIntlNS,
|
|
34
34
|
labelOverrides: labelOverrides,
|
|
@@ -25,7 +25,7 @@ const EditSettingValue = props => {
|
|
|
25
25
|
const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
26
26
|
const fieldLabel = kintIntl.formatKintMessage({
|
|
27
27
|
id: 'settings.valueFor',
|
|
28
|
-
overrideValue: labelOverrides
|
|
28
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.valueFor
|
|
29
29
|
}, {
|
|
30
30
|
name: setting.key
|
|
31
31
|
});
|
|
@@ -41,14 +41,14 @@ const EditSettingValue = props => {
|
|
|
41
41
|
"aria-label": fieldLabel,
|
|
42
42
|
component: RefdataComponent,
|
|
43
43
|
dataOptions: refdata,
|
|
44
|
-
name:
|
|
44
|
+
name: "".concat(input.name, ".value")
|
|
45
45
|
});
|
|
46
46
|
case 'Password':
|
|
47
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
48
48
|
"aria-label": fieldLabel,
|
|
49
49
|
autoFocus: true,
|
|
50
50
|
component: _components.TextField,
|
|
51
|
-
name:
|
|
51
|
+
name: "".concat(input.name, ".value"),
|
|
52
52
|
parse: v => v // Lets us send an empty string instead of 'undefined'
|
|
53
53
|
,
|
|
54
54
|
type: "password"
|
|
@@ -68,7 +68,7 @@ const EditSettingValue = props => {
|
|
|
68
68
|
"aria-label": fieldLabel,
|
|
69
69
|
component: _components.Select,
|
|
70
70
|
dataOptions: selectTemplateValues,
|
|
71
|
-
name:
|
|
71
|
+
name: "".concat(input.name, ".value"),
|
|
72
72
|
parse: v => v
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -78,12 +78,11 @@ const EditSettingValue = props => {
|
|
|
78
78
|
"aria-label": fieldLabel,
|
|
79
79
|
autoFocus: true,
|
|
80
80
|
component: _components.TextField,
|
|
81
|
-
name:
|
|
81
|
+
name: "".concat(input.name, ".value"),
|
|
82
82
|
parse: v => v // Lets us send an empty string instead of 'undefined'
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
|
|
87
86
|
EditSettingValue.propTypes = {
|
|
88
87
|
currentSetting: _propTypes.default.shape({
|
|
89
88
|
settingType: _propTypes.default.string,
|