@k-int/stripes-kint-components 5.1.1 → 5.1.2
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 +4 -0
- package/es/lib/ActionList/ActionListFieldArray.js +29 -32
- package/es/lib/ComboButton/ComboButton.js +5 -6
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +4 -7
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +29 -32
- 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 +32 -33
- 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 +5 -10
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +20 -26
- 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 +11 -12
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +6 -11
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +20 -28
- 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 +1 -2
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +1 -2
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +18 -26
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +7 -11
- package/es/lib/CycleButton/CycleButton.js +1 -1
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +21 -32
- package/es/lib/EditableRefdataList/EditableRefdataList.js +26 -33
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +1 -1
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +5 -5
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +10 -12
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +4 -4
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +4 -7
- package/es/lib/IconSelect/IconSelect.js +5 -9
- package/es/lib/NoResultsMessage/NoResultsMessage.js +4 -4
- package/es/lib/RefdataButtons/RefdataButtons.js +3 -3
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +21 -28
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +5 -6
- package/es/lib/RichSelect/RichSelect.js +14 -19
- package/es/lib/RichSelect/useSelectedOption.js +1 -2
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +14 -17
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +4 -6
- package/es/lib/SASQRoute/SASQRoute.js +2 -2
- package/es/lib/SASQViewComponent/SASQViewComponent.js +5 -9
- package/es/lib/SettingPage/SettingPagePane.js +2 -2
- package/es/lib/SettingsFormContainer/SettingsFormContainer.js +2 -2
- package/es/lib/Typedown/Typedown.js +19 -26
- package/es/lib/hooks/typedownHooks/useTypedown.js +2 -2
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
- 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 +4 -7
- package/es/lib/hooks/useKintIntl.js +5 -11
- 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 +5 -5
- package/es/lib/hooks/useRefdata.js +3 -3
- package/es/lib/hooks/useTemplates.js +4 -4
- package/es/lib/settingsHooks/useAppSettings.js +7 -11
- package/es/lib/settingsHooks/useSettingSection.js +2 -2
- package/es/lib/settingsHooks/useSettings.js +3 -3
- package/es/lib/utils/buildUrl.js +2 -3
- package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +6 -6
- package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
- package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +4 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
- package/es/lib/utils/generateKiwtQueryParams.js +28 -37
- package/es/lib/utils/groupCustomPropertiesByCtx.js +2 -3
- package/es/lib/utils/matchString.js +1 -1
- package/es/lib/utils/parseErrorResponse.js +2 -3
- package/es/lib/utils/selectorSafe.js +2 -3
- package/es/lib/utils/sortByLabel.js +2 -3
- package/es/lib/validators/validators.js +3 -3
- package/package.json +1 -1
- package/src/lib/CustomProperties/Edit/CustomPropertyField.js +4 -2
|
@@ -11,7 +11,6 @@ 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;
|
|
15
14
|
let {
|
|
16
15
|
ctx,
|
|
17
16
|
customProperties = [],
|
|
@@ -36,7 +35,7 @@ const CustomPropertiesViewCtx = _ref => {
|
|
|
36
35
|
// Chain formatKintMessages together using provided fallbackMessage to
|
|
37
36
|
// allow for "If override or translation exists, use it, else use default"
|
|
38
37
|
return kintIntl.formatKintMessage({
|
|
39
|
-
id:
|
|
38
|
+
id: `customProperties.ctx.${ctx}`,
|
|
40
39
|
overrideValue: labelOverrides[ctx],
|
|
41
40
|
fallbackMessage: kintIntl.formatKintMessage({
|
|
42
41
|
id: 'customProperties.defaultTitle',
|
|
@@ -81,25 +80,21 @@ const CustomPropertiesViewCtx = _ref => {
|
|
|
81
80
|
closedByDefault: true,
|
|
82
81
|
displayWhenClosed: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}),
|
|
83
82
|
displayWhenOpen: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}),
|
|
84
|
-
id:
|
|
83
|
+
id: `${id}-accordion-${ctx}`,
|
|
85
84
|
label: getAccordionLabel(),
|
|
86
85
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {})
|
|
87
86
|
});
|
|
88
87
|
}
|
|
89
|
-
const countSetProperties = primary => {
|
|
90
|
-
|
|
91
|
-
return (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
((_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
|
|
97
|
-
;
|
|
98
|
-
})) === null || _Object$entries === void 0 ? void 0 : _Object$entries.length) !== null && _Object$entries$filte !== void 0 ? _Object$entries$filte : 0;
|
|
99
|
-
};
|
|
88
|
+
const countSetProperties = primary => Object.entries(customProperties)?.filter(_ref2 => {
|
|
89
|
+
let [_key, cp] = _ref2;
|
|
90
|
+
return (cp[0]?.type?.ctx === ctx || ctx === 'isNull' && !cp[0]?.type?.ctx) &&
|
|
91
|
+
// Either the ctx string matches, or isNull matches blank
|
|
92
|
+
cp[0]?.type?.primary === primary // Only count non-primary set custprops
|
|
93
|
+
;
|
|
94
|
+
})?.length ?? 0;
|
|
100
95
|
|
|
101
96
|
// We need to display any set properties, along with any non-set primary properties
|
|
102
|
-
const primaryCount =
|
|
97
|
+
const primaryCount = custprops?.filter(cp => cp.primary === true)?.length ?? 0;
|
|
103
98
|
const optionalCount = countSetProperties(false);
|
|
104
99
|
const setPrimaryCount = countSetProperties(true);
|
|
105
100
|
return primaryCount + optionalCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Accordion, {
|
|
@@ -110,18 +105,15 @@ const CustomPropertiesViewCtx = _ref => {
|
|
|
110
105
|
displayWhenOpen: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Badge, {
|
|
111
106
|
children: setPrimaryCount + optionalCount
|
|
112
107
|
}),
|
|
113
|
-
id:
|
|
108
|
+
id: `${id}-accordion-${ctx}`,
|
|
114
109
|
label: getAccordionLabel(),
|
|
115
|
-
children: custprops.map((cp, index) => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
labelOverrides: labelOverrides
|
|
123
|
-
}, "custom-property-card-".concat(ctx, "[").concat(index, "]"));
|
|
124
|
-
})
|
|
110
|
+
children: custprops.map((cp, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyCard.default, {
|
|
111
|
+
ctx: ctx,
|
|
112
|
+
customProperty: customProperties?.[cp.name]?.[0],
|
|
113
|
+
customPropertyDefinition: cp,
|
|
114
|
+
index: index,
|
|
115
|
+
labelOverrides: labelOverrides
|
|
116
|
+
}, `custom-property-card-${ctx}[${index}]`))
|
|
125
117
|
});
|
|
126
118
|
};
|
|
127
119
|
CustomPropertiesViewCtx.propTypes = {
|
|
@@ -30,9 +30,8 @@ const CustomPropertyCard = _ref => {
|
|
|
30
30
|
if (!toDisplay) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
|
-
const internalFalse =
|
|
33
|
+
const internalFalse = customProperty?.internal === false || customProperty?.internal === undefined && customPropertyDefinition.defaultInternal === false;
|
|
34
34
|
const renderValue = () => {
|
|
35
|
-
var _customProperty$value, _customProperty$value2, _customProperty$value3, _customProperty$value4;
|
|
36
35
|
if (!customProperty) {
|
|
37
36
|
return kintIntl.formatKintMessage({
|
|
38
37
|
id: 'notSet',
|
|
@@ -42,14 +41,11 @@ const CustomPropertyCard = _ref => {
|
|
|
42
41
|
switch (customPropertyDefinition.type) {
|
|
43
42
|
case CUSTPROP_TYPES.MULTI_REFDATA_CLASS_NAME:
|
|
44
43
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.List, {
|
|
45
|
-
items:
|
|
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
|
-
}),
|
|
44
|
+
items: customProperty.value?.map(item => item?.label ?? item?.value),
|
|
49
45
|
listStyle: "bullets"
|
|
50
46
|
});
|
|
51
47
|
case CUSTPROP_TYPES.REFDATA_CLASS_NAME:
|
|
52
|
-
return
|
|
48
|
+
return customProperty.value?.label ?? customProperty.value?.value;
|
|
53
49
|
case CUSTPROP_TYPES.DECIMAL_CLASS_NAME:
|
|
54
50
|
case CUSTPROP_TYPES.INTEGER_CLASS_NAME:
|
|
55
51
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedNumber, {
|
|
@@ -77,7 +73,7 @@ const CustomPropertyCard = _ref => {
|
|
|
77
73
|
content: customPropertyDefinition.description
|
|
78
74
|
}) : null]
|
|
79
75
|
}),
|
|
80
|
-
id:
|
|
76
|
+
id: `customproperty-card-${index}`,
|
|
81
77
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Row, {
|
|
82
78
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
83
79
|
xs: 6,
|
|
@@ -88,7 +84,7 @@ const CustomPropertyCard = _ref => {
|
|
|
88
84
|
}),
|
|
89
85
|
children: renderValue()
|
|
90
86
|
})
|
|
91
|
-
}), customProperty
|
|
87
|
+
}), customProperty?.note ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
92
88
|
xs: 6,
|
|
93
89
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
94
90
|
label: kintIntl.formatKintMessage({
|
|
@@ -123,7 +119,7 @@ const CustomPropertyCard = _ref => {
|
|
|
123
119
|
id: 'customProperties.publicNote',
|
|
124
120
|
overrideValue: labelOverrides.publicNote
|
|
125
121
|
}),
|
|
126
|
-
children: customProperty
|
|
122
|
+
children: customProperty?.publicNote ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
127
123
|
style: {
|
|
128
124
|
whiteSpace: 'pre-wrap'
|
|
129
125
|
},
|
|
@@ -132,7 +128,7 @@ const CustomPropertyCard = _ref => {
|
|
|
132
128
|
})
|
|
133
129
|
})]
|
|
134
130
|
})]
|
|
135
|
-
},
|
|
131
|
+
}, `customPropertyCard-${ctx}[${index}]`);
|
|
136
132
|
};
|
|
137
133
|
CustomPropertyCard.propTypes = {
|
|
138
134
|
ctx: _propTypes.default.string,
|
|
@@ -31,7 +31,6 @@ const propTypes = {
|
|
|
31
31
|
refdataEndpoint: _propTypes.default.string
|
|
32
32
|
};
|
|
33
33
|
const EditableRefdataCategoryList = _ref => {
|
|
34
|
-
var _deleteModal$refdata2;
|
|
35
34
|
let {
|
|
36
35
|
afterQueryCalls,
|
|
37
36
|
catchQueryCalls,
|
|
@@ -77,8 +76,7 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
77
76
|
const sortByDesc = (a, b) => a.desc.localeCompare(b.desc);
|
|
78
77
|
(0, _react.useEffect)(() => {
|
|
79
78
|
if (!isRefdataLoading) {
|
|
80
|
-
|
|
81
|
-
setContentData((_refdata$sort = refdata === null || refdata === void 0 ? void 0 : refdata.sort(sortByDesc)) !== null && _refdata$sort !== void 0 ? _refdata$sort : []);
|
|
79
|
+
setContentData(refdata?.sort(sortByDesc) ?? []);
|
|
82
80
|
}
|
|
83
81
|
}, [isRefdataLoading, refdata]);
|
|
84
82
|
|
|
@@ -89,12 +87,12 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
89
87
|
} = (0, _hooks.useMutateRefdataCategory)({
|
|
90
88
|
afterQueryCalls: {
|
|
91
89
|
delete: json => {
|
|
92
|
-
if (afterQueryCalls
|
|
90
|
+
if (afterQueryCalls?.delete) {
|
|
93
91
|
afterQueryCalls.delete(json);
|
|
94
92
|
}
|
|
95
93
|
},
|
|
96
94
|
post: json => {
|
|
97
|
-
if (afterQueryCalls
|
|
95
|
+
if (afterQueryCalls?.post) {
|
|
98
96
|
afterQueryCalls.post(json);
|
|
99
97
|
}
|
|
100
98
|
}
|
|
@@ -103,15 +101,14 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
103
101
|
// Default delete behaviour is to fire a callout, either with kint-components default message
|
|
104
102
|
// or one provided in labelOverrides, which is passed the error message and refdata in question
|
|
105
103
|
delete: async err => {
|
|
106
|
-
var _deleteModal$refdata;
|
|
107
104
|
const errorResp = await (0, _utils.parseErrorResponse)(err.response);
|
|
108
105
|
callout.sendCallout({
|
|
109
106
|
message: kintIntl.formatKintMessage({
|
|
110
107
|
id: 'refdataCategory.deleteRefdataCategory.errorMessage',
|
|
111
|
-
overrideValue: labelOverrides
|
|
108
|
+
overrideValue: labelOverrides?.deleteError
|
|
112
109
|
}, {
|
|
113
|
-
label: deleteModal
|
|
114
|
-
error: errorResp
|
|
110
|
+
label: deleteModal?.refdata?.label,
|
|
111
|
+
error: errorResp?.message
|
|
115
112
|
}),
|
|
116
113
|
type: 'error'
|
|
117
114
|
});
|
|
@@ -120,7 +117,7 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
120
117
|
},
|
|
121
118
|
|
|
122
119
|
endpoint: refdataEndpoint,
|
|
123
|
-
id: refdata
|
|
120
|
+
id: refdata?.id,
|
|
124
121
|
queryParams: {
|
|
125
122
|
delete: {
|
|
126
123
|
enabled: !!refdata
|
|
@@ -136,14 +133,13 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
136
133
|
|
|
137
134
|
// This is the function which will take a row in the table and assign the relevant actions to it
|
|
138
135
|
const actionAssigner = rowData => {
|
|
139
|
-
var _rowData$values;
|
|
140
136
|
const actionArray = [];
|
|
141
|
-
if (!
|
|
137
|
+
if (!rowData?.values?.length && deleteCondition) {
|
|
142
138
|
actionArray.push({
|
|
143
139
|
name: 'delete',
|
|
144
140
|
label: kintIntl.formatKintMessage({
|
|
145
141
|
id: 'delete',
|
|
146
|
-
overrideValue: labelOverrides
|
|
142
|
+
overrideValue: labelOverrides?.delete
|
|
147
143
|
}),
|
|
148
144
|
icon: 'trash',
|
|
149
145
|
callback: data => setDeleteModal({
|
|
@@ -152,9 +148,9 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
152
148
|
}),
|
|
153
149
|
ariaLabel: data => kintIntl.formatKintMessage({
|
|
154
150
|
id: 'refdataCategory.deleteAriaLabel',
|
|
155
|
-
overrideValue: labelOverrides
|
|
151
|
+
overrideValue: labelOverrides?.deleteAriaLabel
|
|
156
152
|
}, {
|
|
157
|
-
label: data
|
|
153
|
+
label: data?.label
|
|
158
154
|
})
|
|
159
155
|
});
|
|
160
156
|
}
|
|
@@ -166,11 +162,11 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
166
162
|
columnMapping: {
|
|
167
163
|
desc: kintIntl.formatKintMessage({
|
|
168
164
|
id: 'refdataCategory.refdataCategory',
|
|
169
|
-
overrideValue: labelOverrides
|
|
165
|
+
overrideValue: labelOverrides?.refdataCategory
|
|
170
166
|
}),
|
|
171
167
|
values: kintIntl.formatKintMessage({
|
|
172
168
|
id: 'refdataCategory.noOfValues',
|
|
173
|
-
overrideValue: labelOverrides
|
|
169
|
+
overrideValue: labelOverrides?.noOfValues
|
|
174
170
|
})
|
|
175
171
|
},
|
|
176
172
|
contentData: contentData,
|
|
@@ -179,16 +175,10 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
179
175
|
},
|
|
180
176
|
createCallback: !createCondition ? null : data => createRefdataCategory(data),
|
|
181
177
|
formatter: {
|
|
182
|
-
values: rowData =>
|
|
183
|
-
var _rowData$values2;
|
|
184
|
-
return rowData === null || rowData === void 0 || (_rowData$values2 = rowData.values) === null || _rowData$values2 === void 0 ? void 0 : _rowData$values2.length;
|
|
185
|
-
}
|
|
178
|
+
values: rowData => rowData?.values?.length
|
|
186
179
|
}
|
|
187
180
|
/* Hide actions column when no permissions, or no deletable refdata categories */,
|
|
188
|
-
hideActionsColumn: !createCondition && !deleteCondition || !
|
|
189
|
-
var _cd$values;
|
|
190
|
-
return (cd === null || cd === void 0 || (_cd$values = cd.values) === null || _cd$values === void 0 ? void 0 : _cd$values.length) === 0;
|
|
191
|
-
})),
|
|
181
|
+
hideActionsColumn: !createCondition && !deleteCondition || !contentData?.find(cd => cd?.values?.length === 0),
|
|
192
182
|
label: label,
|
|
193
183
|
validateFields: {
|
|
194
184
|
desc: () => _validators.required
|
|
@@ -197,31 +187,30 @@ const EditableRefdataCategoryList = _ref => {
|
|
|
197
187
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ConfirmationModal, {
|
|
198
188
|
confirmLabel: kintIntl.formatKintMessage({
|
|
199
189
|
id: 'delete',
|
|
200
|
-
overrideValue: labelOverrides
|
|
190
|
+
overrideValue: labelOverrides?.delete
|
|
201
191
|
}),
|
|
202
192
|
heading: kintIntl.formatKintMessage({
|
|
203
193
|
id: 'refdataCategory.deleteRefdataCategory',
|
|
204
|
-
overrideValue: labelOverrides
|
|
194
|
+
overrideValue: labelOverrides?.deleteRefdataCategory
|
|
205
195
|
}),
|
|
206
196
|
message: kintIntl.formatKintMessage({
|
|
207
197
|
id: 'refdataCategory.deleteRefdataCategory.confirmMessage',
|
|
208
|
-
overrideValue: labelOverrides
|
|
198
|
+
overrideValue: labelOverrides?.deleteRefdataCategoryMessage
|
|
209
199
|
}, {
|
|
210
|
-
name: deleteModal
|
|
200
|
+
name: deleteModal?.refdata?.desc
|
|
211
201
|
}),
|
|
212
202
|
onCancel: () => setDeleteModal({
|
|
213
203
|
visible: false,
|
|
214
204
|
refdata: null
|
|
215
205
|
}),
|
|
216
206
|
onConfirm: () => {
|
|
217
|
-
|
|
218
|
-
deleteRefdataCategory(deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata3 = deleteModal.refdata) === null || _deleteModal$refdata3 === void 0 ? void 0 : _deleteModal$refdata3.id);
|
|
207
|
+
deleteRefdataCategory(deleteModal?.refdata?.id);
|
|
219
208
|
setDeleteModal({
|
|
220
209
|
visible: false,
|
|
221
210
|
refdata: null
|
|
222
211
|
});
|
|
223
212
|
},
|
|
224
|
-
open: deleteModal
|
|
213
|
+
open: deleteModal?.visible
|
|
225
214
|
})]
|
|
226
215
|
});
|
|
227
216
|
};
|
|
@@ -33,7 +33,6 @@ const propTypes = {
|
|
|
33
33
|
refdataEndpoint: _propTypes.default.string
|
|
34
34
|
};
|
|
35
35
|
const EditableRefdataList = _ref => {
|
|
36
|
-
var _deleteModal$refdata2;
|
|
37
36
|
let {
|
|
38
37
|
afterQueryCalls,
|
|
39
38
|
allowSpecial = false,
|
|
@@ -88,8 +87,7 @@ const EditableRefdataList = _ref => {
|
|
|
88
87
|
const sortByLabel = (a, b) => a.label.localeCompare(b.label);
|
|
89
88
|
(0, _react.useEffect)(() => {
|
|
90
89
|
if (!isRefdataLoading) {
|
|
91
|
-
|
|
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 : []);
|
|
90
|
+
setContentData(refdata?.values?.sort(sortByLabel) ?? []);
|
|
93
91
|
}
|
|
94
92
|
}, [isRefdataLoading, refdata]);
|
|
95
93
|
|
|
@@ -100,16 +98,14 @@ const EditableRefdataList = _ref => {
|
|
|
100
98
|
} = (0, _hooks.useMutateRefdataValue)({
|
|
101
99
|
afterQueryCalls: {
|
|
102
100
|
delete: json => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.delete) {
|
|
101
|
+
setContentData(json?.values?.sort(sortByLabel) ?? []);
|
|
102
|
+
if (afterQueryCalls?.delete) {
|
|
106
103
|
afterQueryCalls.delete(json);
|
|
107
104
|
}
|
|
108
105
|
},
|
|
109
106
|
put: json => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.put) {
|
|
107
|
+
setContentData(json?.values?.sort(sortByLabel) ?? []);
|
|
108
|
+
if (afterQueryCalls?.put) {
|
|
113
109
|
afterQueryCalls.put(json);
|
|
114
110
|
}
|
|
115
111
|
}
|
|
@@ -118,15 +114,14 @@ const EditableRefdataList = _ref => {
|
|
|
118
114
|
// Default delete behaviour is to fire a callout, either with kint-components default message
|
|
119
115
|
// or one provided in labelOverrides, which is passed the error message and refdata in question
|
|
120
116
|
delete: async err => {
|
|
121
|
-
var _deleteModal$refdata;
|
|
122
117
|
const errorResp = await (0, _utils.parseErrorResponse)(err.response);
|
|
123
118
|
callout.sendCallout({
|
|
124
119
|
message: kintIntl.formatKintMessage({
|
|
125
120
|
id: 'refdata.deleteRefdataValue.errorMessage',
|
|
126
|
-
overrideValue: labelOverrides
|
|
121
|
+
overrideValue: labelOverrides?.deleteError
|
|
127
122
|
}, {
|
|
128
|
-
label: deleteModal
|
|
129
|
-
error: errorResp
|
|
123
|
+
label: deleteModal?.refdata?.label,
|
|
124
|
+
error: errorResp?.message
|
|
130
125
|
}),
|
|
131
126
|
type: 'error'
|
|
132
127
|
});
|
|
@@ -135,7 +130,7 @@ const EditableRefdataList = _ref => {
|
|
|
135
130
|
},
|
|
136
131
|
|
|
137
132
|
endpoint: refdataEndpoint,
|
|
138
|
-
id: refdata
|
|
133
|
+
id: refdata?.id,
|
|
139
134
|
queryParams: {
|
|
140
135
|
delete: {
|
|
141
136
|
enabled: !!refdata
|
|
@@ -157,24 +152,24 @@ const EditableRefdataList = _ref => {
|
|
|
157
152
|
name: 'edit',
|
|
158
153
|
label: kintIntl.formatKintMessage({
|
|
159
154
|
id: 'edit',
|
|
160
|
-
overrideValue: labelOverrides
|
|
155
|
+
overrideValue: labelOverrides?.edit
|
|
161
156
|
}),
|
|
162
157
|
icon: 'edit',
|
|
163
158
|
callback: data => editRefdataValue(data),
|
|
164
159
|
ariaLabel: data => kintIntl.formatKintMessage({
|
|
165
160
|
id: 'refdata.editAriaLabel',
|
|
166
|
-
overrideValue: labelOverrides
|
|
161
|
+
overrideValue: labelOverrides?.editAriaLabel
|
|
167
162
|
}, {
|
|
168
|
-
label: data
|
|
163
|
+
label: data?.label
|
|
169
164
|
})
|
|
170
165
|
});
|
|
171
166
|
}
|
|
172
|
-
if (!
|
|
167
|
+
if (!refdata?.internal && deleteCondition) {
|
|
173
168
|
actionArray.push({
|
|
174
169
|
name: 'delete',
|
|
175
170
|
label: kintIntl.formatKintMessage({
|
|
176
171
|
id: 'delete',
|
|
177
|
-
overrideValue: labelOverrides
|
|
172
|
+
overrideValue: labelOverrides?.delete
|
|
178
173
|
}),
|
|
179
174
|
icon: 'trash',
|
|
180
175
|
callback: data => setDeleteModal({
|
|
@@ -183,9 +178,9 @@ const EditableRefdataList = _ref => {
|
|
|
183
178
|
}),
|
|
184
179
|
ariaLabel: data => kintIntl.formatKintMessage({
|
|
185
180
|
id: 'refdata.deleteAriaLabel',
|
|
186
|
-
overrideValue: labelOverrides
|
|
181
|
+
overrideValue: labelOverrides?.deleteAriaLabel
|
|
187
182
|
}, {
|
|
188
|
-
label: data
|
|
183
|
+
label: data?.label
|
|
189
184
|
})
|
|
190
185
|
});
|
|
191
186
|
}
|
|
@@ -197,25 +192,24 @@ const EditableRefdataList = _ref => {
|
|
|
197
192
|
columnMapping: {
|
|
198
193
|
label: kintIntl.formatKintMessage({
|
|
199
194
|
id: 'refdata.label',
|
|
200
|
-
overrideValue: labelOverrides
|
|
195
|
+
overrideValue: labelOverrides?.label
|
|
201
196
|
}),
|
|
202
197
|
value: kintIntl.formatKintMessage({
|
|
203
198
|
id: 'refdata.value',
|
|
204
|
-
overrideValue: labelOverrides
|
|
199
|
+
overrideValue: labelOverrides?.value
|
|
205
200
|
})
|
|
206
201
|
},
|
|
207
202
|
contentData: contentData,
|
|
208
203
|
creatableFields: {
|
|
209
204
|
value: () => false
|
|
210
205
|
},
|
|
211
|
-
createCallback: !createCondition || refdata
|
|
206
|
+
createCallback: !createCondition || refdata?.internal ? null : data => {
|
|
212
207
|
if (allowSpecial) {
|
|
213
208
|
editRefdataValue(data);
|
|
214
209
|
} else {
|
|
215
|
-
var _selectorSafe;
|
|
216
210
|
editRefdataValue({
|
|
217
211
|
...data,
|
|
218
|
-
value: (
|
|
212
|
+
value: (0, _utils.selectorSafe)(data?.label)?.replaceAll('%20', ' ')
|
|
219
213
|
});
|
|
220
214
|
}
|
|
221
215
|
},
|
|
@@ -232,31 +226,30 @@ const EditableRefdataList = _ref => {
|
|
|
232
226
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ConfirmationModal, {
|
|
233
227
|
confirmLabel: kintIntl.formatKintMessage({
|
|
234
228
|
id: 'delete',
|
|
235
|
-
overrideValue: labelOverrides
|
|
229
|
+
overrideValue: labelOverrides?.delete
|
|
236
230
|
}),
|
|
237
231
|
heading: kintIntl.formatKintMessage({
|
|
238
232
|
id: 'refdata.deleteRefdataValue',
|
|
239
|
-
overrideValue: labelOverrides
|
|
233
|
+
overrideValue: labelOverrides?.deleteRefdataValue
|
|
240
234
|
}),
|
|
241
235
|
message: kintIntl.formatKintMessage({
|
|
242
236
|
id: 'refdata.deleteRefdataValue.confirmMessage',
|
|
243
|
-
overrideValue: labelOverrides
|
|
237
|
+
overrideValue: labelOverrides?.deleteRefdataValueMessage
|
|
244
238
|
}, {
|
|
245
|
-
name: deleteModal
|
|
239
|
+
name: deleteModal?.refdata?.label
|
|
246
240
|
}),
|
|
247
241
|
onCancel: () => setDeleteModal({
|
|
248
242
|
visible: false,
|
|
249
243
|
refdata: null
|
|
250
244
|
}),
|
|
251
245
|
onConfirm: () => {
|
|
252
|
-
|
|
253
|
-
deleteRefdataValue(deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata3 = deleteModal.refdata) === null || _deleteModal$refdata3 === void 0 ? void 0 : _deleteModal$refdata3.id);
|
|
246
|
+
deleteRefdataValue(deleteModal?.refdata?.id);
|
|
254
247
|
setDeleteModal({
|
|
255
248
|
visible: false,
|
|
256
249
|
refdata: null
|
|
257
250
|
});
|
|
258
251
|
},
|
|
259
|
-
open: deleteModal
|
|
252
|
+
open: deleteModal?.visible
|
|
260
253
|
})]
|
|
261
254
|
});
|
|
262
255
|
};
|
|
@@ -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[${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?.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: `${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: `${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: `${input.name}.value`,
|
|
72
72
|
parse: v => v
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -78,7 +78,7 @@ const EditSettingValue = props => {
|
|
|
78
78
|
"aria-label": fieldLabel,
|
|
79
79
|
autoFocus: true,
|
|
80
80
|
component: _components.TextField,
|
|
81
|
-
name:
|
|
81
|
+
name: `${input.name}.value`,
|
|
82
82
|
parse: v => v // Lets us send an empty string instead of 'undefined'
|
|
83
83
|
});
|
|
84
84
|
}
|
|
@@ -20,23 +20,21 @@ const RenderSettingValue = props => {
|
|
|
20
20
|
const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
21
21
|
const NoCurrentValue = kintIntl.formatKintMessage({
|
|
22
22
|
id: 'settings.noCurrentValue',
|
|
23
|
-
overrideValue: labelOverrides
|
|
23
|
+
overrideValue: labelOverrides?.noCurrentValue
|
|
24
24
|
});
|
|
25
|
-
const defaultText =
|
|
25
|
+
const defaultText = `[${kintIntl.formatKintMessage({
|
|
26
26
|
id: 'settings.default',
|
|
27
|
-
overrideValue: labelOverrides
|
|
28
|
-
})
|
|
27
|
+
overrideValue: labelOverrides?.default
|
|
28
|
+
})}]`;
|
|
29
29
|
switch (setting.settingType) {
|
|
30
30
|
case 'Refdata':
|
|
31
31
|
{
|
|
32
32
|
if (setting.value) {
|
|
33
|
-
|
|
34
|
-
return (_refdata$filter$0$lab = refdata === null || refdata === void 0 || (_refdata$filter$ = refdata.filter(obj => obj.value === setting.value)[0]) === null || _refdata$filter$ === void 0 ? void 0 : _refdata$filter$.label) !== null && _refdata$filter$0$lab !== void 0 ? _refdata$filter$0$lab : null;
|
|
33
|
+
return refdata?.filter(obj => obj.value === setting.value)[0]?.label ?? null;
|
|
35
34
|
}
|
|
36
35
|
if (setting.defValue) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return "".concat(defaultText, " ").concat(defValue);
|
|
36
|
+
const defValue = refdata?.filter(obj => obj.value === setting.defValue)[0]?.label;
|
|
37
|
+
return `${defaultText} ${defValue}`;
|
|
40
38
|
}
|
|
41
39
|
return NoCurrentValue;
|
|
42
40
|
}
|
|
@@ -46,7 +44,7 @@ const RenderSettingValue = props => {
|
|
|
46
44
|
return '********';
|
|
47
45
|
}
|
|
48
46
|
if (setting.defValue) {
|
|
49
|
-
return
|
|
47
|
+
return `${defaultText} ********`;
|
|
50
48
|
}
|
|
51
49
|
return NoCurrentValue;
|
|
52
50
|
}
|
|
@@ -56,7 +54,7 @@ const RenderSettingValue = props => {
|
|
|
56
54
|
const settingId = setting.value || setting.defValue;
|
|
57
55
|
return obj.id === settingId;
|
|
58
56
|
})[0];
|
|
59
|
-
return
|
|
57
|
+
return templateValue?.name || NoCurrentValue;
|
|
60
58
|
}
|
|
61
59
|
default:
|
|
62
60
|
{
|
|
@@ -64,7 +62,7 @@ const RenderSettingValue = props => {
|
|
|
64
62
|
return setting.value;
|
|
65
63
|
}
|
|
66
64
|
if (setting.defValue) {
|
|
67
|
-
return
|
|
65
|
+
return `${defaultText} ${setting.defValue}`;
|
|
68
66
|
}
|
|
69
67
|
return NoCurrentValue;
|
|
70
68
|
}
|
|
@@ -42,14 +42,14 @@ const SettingField = settingFieldProps => {
|
|
|
42
42
|
endpoint: refdataEndpoint,
|
|
43
43
|
desc: currentSetting.vocab,
|
|
44
44
|
queryParams: {
|
|
45
|
-
enabled: !!
|
|
45
|
+
enabled: !!currentSetting?.vocab && currentSetting.settingType === 'Refdata'
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
const templates = (0, _hooks.useTemplates)({
|
|
49
49
|
context: currentSetting.vocab,
|
|
50
50
|
endpoint: templateEndpoint,
|
|
51
51
|
queryParams: {
|
|
52
|
-
enabled: !!
|
|
52
|
+
enabled: !!currentSetting?.vocab && currentSetting.settingType === 'Template'
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
const renderHelpText = helpTextId => {
|
|
@@ -115,10 +115,10 @@ const SettingField = settingFieldProps => {
|
|
|
115
115
|
} else {
|
|
116
116
|
RenderFunction = _EditSettingValue.default;
|
|
117
117
|
}
|
|
118
|
-
const id =
|
|
118
|
+
const id = `settings.${(0, _utils.toCamelCase)(currentSetting.section)}.${(0, _utils.toCamelCase)(currentSetting.key)}.help`;
|
|
119
119
|
const renderHeaderStart = () => {
|
|
120
120
|
const settingName = Object.keys(currentSetting).length > 0 ? kintIntl.formatKintMessage({
|
|
121
|
-
id:
|
|
121
|
+
id: `settings.${(0, _utils.toCamelCase)(currentSetting.section)}.${(0, _utils.toCamelCase)(currentSetting.key)}`
|
|
122
122
|
}) : kintIntl.formatKintMessage({
|
|
123
123
|
id: 'loading'
|
|
124
124
|
});
|