@k-int/stripes-kint-components 5.3.0 → 5.4.0
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/lib/ActionList/ActionListFieldArray.js +37 -32
- 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 -29
- 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 -18
- 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 -6
- 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 -18
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +11 -7
- package/es/lib/CycleButton/CycleButton.js +1 -1
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +38 -26
- package/es/lib/EditableRefdataList/EditableRefdataList.js +33 -26
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +1 -1
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +10 -6
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +12 -10
- 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 +17 -13
- 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 -2
- package/es/lib/Typedown/Typedown.js +26 -19
- package/es/lib/hooks/typedownHooks/useTypedown.js +2 -2
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
- package/es/lib/hooks/useActionListRef.js +1 -1
- 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 +1 -1
- package/es/lib/utils/generateKiwtQueryParams.js +37 -28
- package/es/lib/utils/groupCustomPropertiesByCtx.js +3 -2
- package/es/lib/utils/highlightString.js +28 -12
- package/es/lib/utils/matchString.js +17 -2
- package/es/lib/utils/parseErrorResponse.js +3 -2
- 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/lib/EditableSettingsList/SettingField/EditSettingValue.js +5 -1
- package/src/lib/hooks/useQIndex.js +12 -4
- package/src/lib/utils/highlightString.js +36 -20
- package/src/lib/utils/matchString.js +24 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [5.4.0](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/compare/v5.3.1...v5.4.0) (2024-02-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* EditSettingValue: refdata default sort ([9e7f530](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/commit/9e7f5301bb43050ba263b303e0e05462b1268a8a))
|
|
7
|
+
* matchString and highlightString improvements ([83f98e9](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/commit/83f98e9ebc678c3a893504a9959d35f9e1318b7b))
|
|
8
|
+
|
|
9
|
+
## [5.3.1](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/compare/v5.3.0...v5.3.1) (2024-01-26)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* Do not submit qIndex when qIndex string is empty ([a64fe51](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/commit/a64fe5122929d8ebe69b95f90938f581b93cf423))
|
|
15
|
+
|
|
1
16
|
# [5.3.0](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/compare/v5.2.3...v5.3.0) (2023-12-04)
|
|
2
17
|
|
|
3
18
|
|
|
@@ -43,6 +43,7 @@ const propTypes = {
|
|
|
43
43
|
|
|
44
44
|
// This needs to be outside of the main component for forwardRef to work properly it seems.
|
|
45
45
|
const ActionTrigger = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
46
|
+
var _action$label;
|
|
46
47
|
let {
|
|
47
48
|
action,
|
|
48
49
|
...actionTriggerProps
|
|
@@ -58,7 +59,7 @@ const ActionTrigger = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
58
59
|
ref: ref,
|
|
59
60
|
marginBottom0: true,
|
|
60
61
|
...actionTriggerProps,
|
|
61
|
-
children: action.label
|
|
62
|
+
children: (_action$label = action.label) !== null && _action$label !== void 0 ? _action$label : action.name
|
|
62
63
|
});
|
|
63
64
|
});
|
|
64
65
|
ActionTrigger.propTypes = {
|
|
@@ -70,6 +71,7 @@ ActionTrigger.propTypes = {
|
|
|
70
71
|
};
|
|
71
72
|
const NEW_ROW = 'NEW_ROW';
|
|
72
73
|
const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
74
|
+
var _fields$value$filter$, _fields$value;
|
|
73
75
|
let {
|
|
74
76
|
actionAssigner,
|
|
75
77
|
columnMapping,
|
|
@@ -108,7 +110,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
108
110
|
null for no field, string id if we are editing an existing field and
|
|
109
111
|
'NEW_ROW' for a new row
|
|
110
112
|
*/
|
|
111
|
-
const [editing, setEditing] = (0, _react.useState)((fields
|
|
113
|
+
const [editing, setEditing] = (0, _react.useState)(((_fields$value$filter$ = fields === null || fields === void 0 || (_fields$value = fields.value) === null || _fields$value === void 0 || (_fields$value = _fields$value.filter(f => f._isNewActionListRow)) === null || _fields$value === void 0 ? void 0 : _fields$value.length) !== null && _fields$value$filter$ !== void 0 ? _fields$value$filter$ : 0) > 0 ? NEW_ROW : undefined);
|
|
112
114
|
const toggleEditing = (0, _react.useCallback)(id => {
|
|
113
115
|
if (editing) {
|
|
114
116
|
setEditing();
|
|
@@ -119,11 +121,13 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
119
121
|
|
|
120
122
|
// Ensure editing doesn't get stuck in "NEW_ROW" state;
|
|
121
123
|
(0, _react.useEffect)(() => {
|
|
122
|
-
|
|
124
|
+
var _fields$value$filter$2, _fields$value2;
|
|
125
|
+
if (editing === NEW_ROW && ((_fields$value$filter$2 = fields === null || fields === void 0 || (_fields$value2 = fields.value) === null || _fields$value2 === void 0 || (_fields$value2 = _fields$value2.filter(f => f._isNewActionListRow)) === null || _fields$value2 === void 0 ? void 0 : _fields$value2.length) !== null && _fields$value$filter$2 !== void 0 ? _fields$value$filter$2 : 0) === 0) {
|
|
123
126
|
setEditing();
|
|
124
127
|
}
|
|
125
|
-
}, [editing, fields
|
|
128
|
+
}, [editing, fields === null || fields === void 0 ? void 0 : fields.value]);
|
|
126
129
|
const handleSave = index => {
|
|
130
|
+
var _actionAssigner;
|
|
127
131
|
const {
|
|
128
132
|
actionListActions: _a,
|
|
129
133
|
fieldName: _fn,
|
|
@@ -133,7 +137,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
133
137
|
} = fields.value[index];
|
|
134
138
|
|
|
135
139
|
// Find "edit" entry in actionAssigner
|
|
136
|
-
const editCallback = actionAssigner(rowData)
|
|
140
|
+
const editCallback = (_actionAssigner = actionAssigner(rowData)) === null || _actionAssigner === void 0 || (_actionAssigner = _actionAssigner.find(act => act.name === 'edit')) === null || _actionAssigner === void 0 ? void 0 : _actionAssigner.callback;
|
|
137
141
|
if (editCallback) {
|
|
138
142
|
editCallback(rowData);
|
|
139
143
|
}
|
|
@@ -169,14 +173,14 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
169
173
|
const widthsObject = {};
|
|
170
174
|
visibleFields.forEach(f => {
|
|
171
175
|
if (f !== 'actionListActions') {
|
|
172
|
-
widthsObject[f] =
|
|
176
|
+
widthsObject[f] = "".concat(staticWidth, "%");
|
|
173
177
|
}
|
|
174
178
|
});
|
|
175
|
-
widthsObject.actionListActions = editing ?
|
|
179
|
+
widthsObject.actionListActions = editing ? "".concat(EDITING_ACTIONS_WIDTH, "%") : "".concat(NON_EDITING_ACTIONS_WIDTH, "%");
|
|
176
180
|
return widthsObject;
|
|
177
181
|
};
|
|
178
182
|
const renderActionButtons = data => {
|
|
179
|
-
const fieldName =
|
|
183
|
+
const fieldName = "contentData[".concat(data.rowIndex, "]");
|
|
180
184
|
const {
|
|
181
185
|
actionListActions: actions,
|
|
182
186
|
...rest
|
|
@@ -184,7 +188,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
184
188
|
if (data.id === editing || !data.id && editing === NEW_ROW) {
|
|
185
189
|
// Render the save/cancel buttons
|
|
186
190
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
187
|
-
id:
|
|
191
|
+
id: "action-button-parent-".concat(data.rowIndex + 1),
|
|
188
192
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
189
193
|
buttonStyle: "primary",
|
|
190
194
|
disabled: hasValidationErrors || submitting || pristine,
|
|
@@ -204,9 +208,9 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
204
208
|
type: "submit",
|
|
205
209
|
children: kintIntl.formatKintMessage({
|
|
206
210
|
id: 'save',
|
|
207
|
-
overrideValue: labelOverrides
|
|
211
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.save
|
|
208
212
|
})
|
|
209
|
-
},
|
|
213
|
+
}, "save[".concat(data.rowIndex, "]")), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
210
214
|
"data-type-button": "cancel",
|
|
211
215
|
marginBottom0: true,
|
|
212
216
|
onClick: () => {
|
|
@@ -220,14 +224,14 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
220
224
|
},
|
|
221
225
|
children: kintIntl.formatKintMessage({
|
|
222
226
|
id: 'cancel',
|
|
223
|
-
overrideValue: labelOverrides
|
|
227
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.cancel
|
|
224
228
|
})
|
|
225
|
-
},
|
|
229
|
+
}, "cancel[".concat(data.rowIndex, "]"))]
|
|
226
230
|
});
|
|
227
231
|
}
|
|
228
232
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
229
|
-
id:
|
|
230
|
-
children: actions
|
|
233
|
+
id: "action-button-parent-".concat(data.rowIndex + 1),
|
|
234
|
+
children: actions === null || actions === void 0 ? void 0 : actions.map(action => {
|
|
231
235
|
let actionFunction;
|
|
232
236
|
if (action.callback) {
|
|
233
237
|
actionFunction = () => action.callback(rest);
|
|
@@ -237,25 +241,25 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
237
241
|
if (action.name === 'edit') {
|
|
238
242
|
actionFunction = () => toggleEditing(data.id);
|
|
239
243
|
}
|
|
240
|
-
let ariaLabel =
|
|
241
|
-
if (action
|
|
244
|
+
let ariaLabel = "action-".concat(action.name, "[").concat(data.rowIndex, "]");
|
|
245
|
+
if (action !== null && action !== void 0 && action.ariaLabel) {
|
|
242
246
|
if (typeof action.ariaLabel === 'function') {
|
|
243
247
|
ariaLabel = action.ariaLabel(data);
|
|
244
248
|
} else if (typeof action.ariaLabel === 'string') {
|
|
245
249
|
ariaLabel = action.ariaLabel;
|
|
246
250
|
} else {
|
|
247
|
-
throw new Error(
|
|
251
|
+
throw new Error("Provided ariaLabel for action \"".concat(action.name, "\" must be a function or a string."));
|
|
248
252
|
}
|
|
249
253
|
}
|
|
250
254
|
let tooltip;
|
|
251
255
|
let tooltipSub;
|
|
252
|
-
if (action
|
|
256
|
+
if (action !== null && action !== void 0 && action.tooltip) {
|
|
253
257
|
if (typeof action.tooltip === 'function') {
|
|
254
258
|
tooltip = action.tooltip(data);
|
|
255
259
|
} else {
|
|
256
260
|
tooltip = action.tooltip;
|
|
257
261
|
}
|
|
258
|
-
if (action
|
|
262
|
+
if (action !== null && action !== void 0 && action.tooltipSub) {
|
|
259
263
|
if (typeof action.tooltipSub === 'function') {
|
|
260
264
|
tooltipSub = action.tooltipSub(data);
|
|
261
265
|
} else {
|
|
@@ -267,7 +271,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
267
271
|
// If a tooltip is declared, render that around the actionButton
|
|
268
272
|
if (tooltip) {
|
|
269
273
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
270
|
-
id:
|
|
274
|
+
id: "action-".concat(action.name, "[").concat(data.rowIndex, "]-tooltip"),
|
|
271
275
|
sub: tooltipSub,
|
|
272
276
|
text: tooltip,
|
|
273
277
|
children: _ref3 => {
|
|
@@ -289,7 +293,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
289
293
|
return null;
|
|
290
294
|
},
|
|
291
295
|
to: action.to
|
|
292
|
-
},
|
|
296
|
+
}, "action-".concat(action.name, "[").concat(data.rowIndex, "]"));
|
|
293
297
|
}
|
|
294
298
|
});
|
|
295
299
|
}
|
|
@@ -307,7 +311,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
307
311
|
return null;
|
|
308
312
|
},
|
|
309
313
|
to: action.to
|
|
310
|
-
},
|
|
314
|
+
}, "action-".concat(action.name, "[").concat(data.rowIndex, "]"));
|
|
311
315
|
})
|
|
312
316
|
});
|
|
313
317
|
};
|
|
@@ -339,16 +343,17 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
339
343
|
const editingRow = cd.id === editing || !cd.id;
|
|
340
344
|
|
|
341
345
|
// Default to the passed formatter values
|
|
342
|
-
let returnValue = formatter
|
|
346
|
+
let returnValue = formatter !== null && formatter !== void 0 && formatter[key] ? formatter[key](cd) : cd[key];
|
|
343
347
|
|
|
344
348
|
// If editing, replace values with fields
|
|
345
349
|
if (editingRow) {
|
|
350
|
+
var _editableFields$key, _creatableFields$key;
|
|
346
351
|
/*
|
|
347
352
|
Check if the property is a visible field.
|
|
348
353
|
If it is not then we don't allow editing in this component.
|
|
349
354
|
*/
|
|
350
|
-
const editFunction = editableFields[key]
|
|
351
|
-
const createFunction = creatableFields[key]
|
|
355
|
+
const editFunction = (_editableFields$key = editableFields[key]) !== null && _editableFields$key !== void 0 ? _editableFields$key : () => true;
|
|
356
|
+
const createFunction = (_creatableFields$key = creatableFields[key]) !== null && _creatableFields$key !== void 0 ? _creatableFields$key : () => true;
|
|
352
357
|
/*
|
|
353
358
|
Next check if this is a new row, if so we should run the createableField function with the data.
|
|
354
359
|
If it is not a new row, then we run the editableField function with the data,
|
|
@@ -359,19 +364,19 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
359
364
|
if (!cd.id && createFunction(cd) || !!cd.id && editFunction(cd)) {
|
|
360
365
|
const passedObject = {
|
|
361
366
|
allValues: values,
|
|
362
|
-
index: cd
|
|
367
|
+
index: cd === null || cd === void 0 ? void 0 : cd.fieldIndex,
|
|
363
368
|
key,
|
|
364
|
-
name:
|
|
369
|
+
name: "".concat(cd.fieldName, ".").concat(key),
|
|
365
370
|
rowFieldName: cd.fieldName
|
|
366
371
|
};
|
|
367
|
-
const validateFunction = validateFields
|
|
372
|
+
const validateFunction = validateFields !== null && validateFields !== void 0 && validateFields[key] ? validateFields === null || validateFields === void 0 ? void 0 : validateFields[key](passedObject) : null;
|
|
368
373
|
returnValue = fieldComponents[key] ? fieldComponents[key](passedObject) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
369
374
|
ariaLabel: key // TODO at the moment the only way to override this is passing in an entire fieldComponent.
|
|
370
375
|
,
|
|
371
376
|
autoFocus: autoFocus,
|
|
372
377
|
component: _components.TextField,
|
|
373
378
|
marginBottom0: true,
|
|
374
|
-
name:
|
|
379
|
+
name: "".concat(cd.fieldName, ".").concat(key),
|
|
375
380
|
parse: v => v,
|
|
376
381
|
validate: validateFunction
|
|
377
382
|
});
|
|
@@ -396,7 +401,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
396
401
|
onClick: handleClickCreate,
|
|
397
402
|
children: kintIntl.formatKintMessage({
|
|
398
403
|
id: 'new',
|
|
399
|
-
overrideValue: labelOverrides
|
|
404
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.new
|
|
400
405
|
})
|
|
401
406
|
})]
|
|
402
407
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, {
|
|
@@ -404,7 +409,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
404
409
|
...columnMapping,
|
|
405
410
|
actionListActions: kintIntl.formatKintMessage({
|
|
406
411
|
id: 'actions',
|
|
407
|
-
overrideValue: labelOverrides
|
|
412
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.actions
|
|
408
413
|
})
|
|
409
414
|
},
|
|
410
415
|
columnWidths: getColumnWidths(),
|
|
@@ -34,7 +34,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
34
34
|
const onToggle = (0, _react.useCallback)(() => setOpen(!open), [open, setOpen]);
|
|
35
35
|
|
|
36
36
|
// FIXME a lot of this is shared with ResponsiveButtonGroup
|
|
37
|
-
const styledDropdownButtons = (0, _react.useMemo)(() => dropdownButtons
|
|
37
|
+
const styledDropdownButtons = (0, _react.useMemo)(() => dropdownButtons === null || dropdownButtons === void 0 ? void 0 : dropdownButtons.map(button => {
|
|
38
38
|
return /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
39
39
|
buttonStyle: 'dropdownItem'
|
|
40
40
|
});
|
|
@@ -45,6 +45,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
45
45
|
children: [...styledDropdownButtons]
|
|
46
46
|
}), [styledDropdownButtons]);
|
|
47
47
|
const renderTrigger = (0, _react.useCallback)(_ref2 => {
|
|
48
|
+
var _buttonProps$buttonSt;
|
|
48
49
|
let {
|
|
49
50
|
onToggle: toggleFunc,
|
|
50
51
|
triggerRef,
|
|
@@ -57,11 +58,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
57
58
|
ref: triggerRef,
|
|
58
59
|
"aria-label": "menu",
|
|
59
60
|
buttonClass: (0, _classnames.default)(_ResponsiveButtonGroup.default.width100, _ResponsiveButtonGroup.default.dropdownButtonClass, {
|
|
60
|
-
[
|
|
61
|
+
["".concat(_ResponsiveButtonGroup.default.marginBottom)]: !marginBottom0
|
|
61
62
|
}, {
|
|
62
|
-
[
|
|
63
|
+
["".concat(_ResponsiveButtonGroup.default.marginBottom0)]: marginBottom0
|
|
63
64
|
}),
|
|
64
|
-
buttonStyle: buttonProps
|
|
65
|
+
buttonStyle: (_buttonProps$buttonSt = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.buttonStyle) !== null && _buttonProps$buttonSt !== void 0 ? _buttonProps$buttonSt : 'default',
|
|
65
66
|
onClick: toggleFunc,
|
|
66
67
|
onKeyDown: keyHandler,
|
|
67
68
|
type: "button",
|
|
@@ -73,7 +74,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
73
74
|
iconPosition: "end"
|
|
74
75
|
})
|
|
75
76
|
});
|
|
76
|
-
}, [buttonProps
|
|
77
|
+
}, [buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.buttonStyle, triggerProps, marginBottom0]);
|
|
77
78
|
let comboTrigger;
|
|
78
79
|
if (dropdownButtons.length > 0) {
|
|
79
80
|
comboTrigger = /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, {
|
|
@@ -133,7 +133,7 @@ const CustomPropertiesLookup = _ref => {
|
|
|
133
133
|
contentData: custprops,
|
|
134
134
|
formatter: {
|
|
135
135
|
primary: data => {
|
|
136
|
-
if (data
|
|
136
|
+
if (data !== null && data !== void 0 && data.primary) {
|
|
137
137
|
return kintIntl.formatKintMessage({
|
|
138
138
|
id: 'yes',
|
|
139
139
|
overrideValue: labelOverrides.yes
|
|
@@ -146,10 +146,13 @@ const CustomPropertiesLookup = _ref => {
|
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
148
|
type: data => kintIntl.formatKintMessage({
|
|
149
|
-
id:
|
|
150
|
-
overrideValue: labelOverrides
|
|
149
|
+
id: "customProperties.type.".concat(data === null || data === void 0 ? void 0 : data.type),
|
|
150
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides[data === null || data === void 0 ? void 0 : data.type]
|
|
151
151
|
}),
|
|
152
|
-
category: data =>
|
|
152
|
+
category: data => {
|
|
153
|
+
var _data$category;
|
|
154
|
+
return data === null || data === void 0 || (_data$category = data.category) === null || _data$category === void 0 ? void 0 : _data$category.desc;
|
|
155
|
+
}
|
|
153
156
|
},
|
|
154
157
|
onRowClick: onSelectCustomProperty,
|
|
155
158
|
visibleColumns: ['label', 'primary', 'ctx', 'weight', 'type', 'category'],
|
|
@@ -24,6 +24,7 @@ const VIEWING = 'view';
|
|
|
24
24
|
|
|
25
25
|
// A default option for setting up panes manually
|
|
26
26
|
const CustomPropertiesSettings = _ref => {
|
|
27
|
+
var _customProperty$label, _customProperty$label2, _customProperty$categ, _customProperty$label3, _customProperty$label4;
|
|
27
28
|
let {
|
|
28
29
|
afterQueryCalls,
|
|
29
30
|
catchQueryCalls,
|
|
@@ -68,7 +69,7 @@ const CustomPropertiesSettings = _ref => {
|
|
|
68
69
|
// empty string is all custoprop contexts
|
|
69
70
|
label: kintIntl.formatKintMessage({
|
|
70
71
|
id: 'customProperties.config.all',
|
|
71
|
-
overrideValue: labelOverrides
|
|
72
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.all
|
|
72
73
|
})
|
|
73
74
|
}];
|
|
74
75
|
}
|
|
@@ -82,7 +83,7 @@ const CustomPropertiesSettings = _ref => {
|
|
|
82
83
|
setMode(VIEWING);
|
|
83
84
|
queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
|
|
84
85
|
setCustomProperty(res);
|
|
85
|
-
if (afterQueryCalls
|
|
86
|
+
if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.put) {
|
|
86
87
|
afterQueryCalls.put(res);
|
|
87
88
|
}
|
|
88
89
|
},
|
|
@@ -90,7 +91,7 @@ const CustomPropertiesSettings = _ref => {
|
|
|
90
91
|
setMode(VIEWING);
|
|
91
92
|
queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
|
|
92
93
|
setCustomProperty(res);
|
|
93
|
-
if (afterQueryCalls
|
|
94
|
+
if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.post) {
|
|
94
95
|
afterQueryCalls.post(res);
|
|
95
96
|
}
|
|
96
97
|
},
|
|
@@ -98,7 +99,7 @@ const CustomPropertiesSettings = _ref => {
|
|
|
98
99
|
setMode(VIEWING);
|
|
99
100
|
queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
|
|
100
101
|
setCustomProperty();
|
|
101
|
-
if (afterQueryCalls
|
|
102
|
+
if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.delete) {
|
|
102
103
|
afterQueryCalls.delete(res);
|
|
103
104
|
}
|
|
104
105
|
}
|
|
@@ -111,10 +112,10 @@ const CustomPropertiesSettings = _ref => {
|
|
|
111
112
|
callout.sendCallout({
|
|
112
113
|
message: kintIntl.formatKintMessage({
|
|
113
114
|
id: 'customProperties.config.delete.errorMessage',
|
|
114
|
-
overrideValue: labelOverrides
|
|
115
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteError
|
|
115
116
|
}, {
|
|
116
|
-
error: errorResp
|
|
117
|
-
label: customProperty
|
|
117
|
+
error: errorResp === null || errorResp === void 0 ? void 0 : errorResp.message,
|
|
118
|
+
label: customProperty === null || customProperty === void 0 ? void 0 : customProperty.label
|
|
118
119
|
}),
|
|
119
120
|
type: 'error'
|
|
120
121
|
});
|
|
@@ -122,20 +123,22 @@ const CustomPropertiesSettings = _ref => {
|
|
|
122
123
|
...catchQueryCalls // Override defaults here
|
|
123
124
|
},
|
|
124
125
|
endpoint: customPropertiesEndpoint,
|
|
125
|
-
id: customProperty
|
|
126
|
+
id: customProperty === null || customProperty === void 0 ? void 0 : customProperty.id
|
|
126
127
|
});
|
|
127
128
|
const handeContextSubmit = submitData => {
|
|
129
|
+
var _submitData$ctx$0$val, _submitData$ctx;
|
|
128
130
|
return {
|
|
129
131
|
...submitData,
|
|
130
|
-
ctx: submitData
|
|
132
|
+
ctx: (_submitData$ctx$0$val = submitData === null || submitData === void 0 || (_submitData$ctx = submitData.ctx) === null || _submitData$ctx === void 0 || (_submitData$ctx = _submitData$ctx[0]) === null || _submitData$ctx === void 0 ? void 0 : _submitData$ctx.value) !== null && _submitData$ctx$0$val !== void 0 ? _submitData$ctx$0$val : ''
|
|
131
133
|
};
|
|
132
134
|
};
|
|
133
135
|
|
|
134
136
|
// When POSTing a custom property, the backend expects a shorthand "Integer" or "LocalDate"
|
|
135
137
|
// When PUTing a custom property, the backend needs the full class name
|
|
136
138
|
const handleType = submitData => {
|
|
139
|
+
var _typeRegex$exec;
|
|
137
140
|
const typeRegex = /(com\.k_int\.web\.toolkit\.custprops\.types\.CustomProperty)(.*)/g;
|
|
138
|
-
const typeMatch = typeRegex.exec(submitData
|
|
141
|
+
const typeMatch = (_typeRegex$exec = typeRegex.exec(submitData === null || submitData === void 0 ? void 0 : submitData.type)) !== null && _typeRegex$exec !== void 0 ? _typeRegex$exec : [];
|
|
139
142
|
return {
|
|
140
143
|
...submitData,
|
|
141
144
|
type: typeMatch[2]
|
|
@@ -152,7 +155,7 @@ const CustomPropertiesSettings = _ref => {
|
|
|
152
155
|
,
|
|
153
156
|
children: kintIntl.formatKintMessage({
|
|
154
157
|
id: 'new',
|
|
155
|
-
overrideValue: labelOverrides
|
|
158
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.new
|
|
156
159
|
})
|
|
157
160
|
}),
|
|
158
161
|
paneTitle: kintIntl.formatKintMessage({
|
|
@@ -182,10 +185,10 @@ const CustomPropertiesSettings = _ref => {
|
|
|
182
185
|
icon: "edit",
|
|
183
186
|
children: kintIntl.formatKintMessage({
|
|
184
187
|
id: 'edit',
|
|
185
|
-
overrideValue: labelOverrides
|
|
188
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.edit
|
|
186
189
|
})
|
|
187
190
|
})
|
|
188
|
-
},
|
|
191
|
+
}, "".concat(customProperty.name, "-action-edit")));
|
|
189
192
|
}
|
|
190
193
|
if (deleteCondition) {
|
|
191
194
|
actionsArray.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
@@ -199,12 +202,12 @@ const CustomPropertiesSettings = _ref => {
|
|
|
199
202
|
icon: "trash",
|
|
200
203
|
children: kintIntl.formatKintMessage({
|
|
201
204
|
id: 'delete',
|
|
202
|
-
overrideValue: labelOverrides
|
|
205
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
|
|
203
206
|
})
|
|
204
207
|
})
|
|
205
|
-
},
|
|
208
|
+
}, "".concat(customProperty.name, "-action-delete")));
|
|
206
209
|
}
|
|
207
|
-
return actionsArray
|
|
210
|
+
return actionsArray !== null && actionsArray !== void 0 && actionsArray.length ? actionsArray : null;
|
|
208
211
|
},
|
|
209
212
|
defaultWidth: "fill",
|
|
210
213
|
dismissible: true,
|
|
@@ -212,10 +215,10 @@ const CustomPropertiesSettings = _ref => {
|
|
|
212
215
|
onClose: () => setCustomProperty(),
|
|
213
216
|
paneTitle: kintIntl.formatKintMessage({
|
|
214
217
|
id: 'customProperties.config.viewPaneTitle',
|
|
215
|
-
overrideValue: labelOverrides
|
|
216
|
-
fallbackMessage: customProperty
|
|
218
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.viewPaneTitle,
|
|
219
|
+
fallbackMessage: (_customProperty$label = customProperty === null || customProperty === void 0 ? void 0 : customProperty.label) !== null && _customProperty$label !== void 0 ? _customProperty$label : customProperty === null || customProperty === void 0 ? void 0 : customProperty.name
|
|
217
220
|
}, {
|
|
218
|
-
name: customProperty
|
|
221
|
+
name: (_customProperty$label2 = customProperty === null || customProperty === void 0 ? void 0 : customProperty.label) !== null && _customProperty$label2 !== void 0 ? _customProperty$label2 : customProperty === null || customProperty === void 0 ? void 0 : customProperty.name
|
|
219
222
|
}),
|
|
220
223
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyView.default, {
|
|
221
224
|
customProperty: customProperty,
|
|
@@ -232,22 +235,22 @@ const CustomPropertiesSettings = _ref => {
|
|
|
232
235
|
defaultInternal: true
|
|
233
236
|
} : {
|
|
234
237
|
...customProperty,
|
|
235
|
-
ctx: customProperty
|
|
238
|
+
ctx: customProperty !== null && customProperty !== void 0 && customProperty.ctx ? [{
|
|
236
239
|
value: customProperty.ctx,
|
|
237
240
|
label: customProperty.ctx
|
|
238
241
|
}] : null,
|
|
239
|
-
category: customProperty
|
|
242
|
+
category: customProperty !== null && customProperty !== void 0 && customProperty.category ? customProperty === null || customProperty === void 0 || (_customProperty$categ = customProperty.category) === null || _customProperty$categ === void 0 ? void 0 : _customProperty$categ.id : null
|
|
240
243
|
},
|
|
241
244
|
modalProps: {
|
|
242
245
|
dismissible: true,
|
|
243
246
|
label: mode === CREATING ? kintIntl.formatKintMessage({
|
|
244
247
|
id: 'customProperties.config.newModal',
|
|
245
|
-
overrideValue: labelOverrides
|
|
248
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.newModalTitle
|
|
246
249
|
}) : kintIntl.formatKintMessage({
|
|
247
250
|
id: 'customProperties.config.editModal',
|
|
248
|
-
overrideValue: labelOverrides
|
|
251
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.editModalTitle
|
|
249
252
|
}, {
|
|
250
|
-
name: customProperty
|
|
253
|
+
name: (_customProperty$label3 = customProperty === null || customProperty === void 0 ? void 0 : customProperty.label) !== null && _customProperty$label3 !== void 0 ? _customProperty$label3 : customProperty === null || customProperty === void 0 ? void 0 : customProperty.name
|
|
251
254
|
}),
|
|
252
255
|
onClose: () => setMode(VIEWING),
|
|
253
256
|
open: mode === CREATING || mode === EDITING
|
|
@@ -268,22 +271,22 @@ const CustomPropertiesSettings = _ref => {
|
|
|
268
271
|
buttonStyle: "danger",
|
|
269
272
|
confirmLabel: kintIntl.formatKintMessage({
|
|
270
273
|
id: 'delete',
|
|
271
|
-
overrideValue: labelOverrides
|
|
274
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
|
|
272
275
|
}),
|
|
273
276
|
heading: kintIntl.formatKintMessage({
|
|
274
277
|
id: 'customProperties.config.delete.confirmHeading',
|
|
275
|
-
overrideValue: labelOverrides
|
|
278
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.confirmHeading
|
|
276
279
|
}),
|
|
277
280
|
id: "delete-custprop-confirmation",
|
|
278
281
|
message: kintIntl.formatKintMessage({
|
|
279
282
|
id: 'customProperties.config.delete.confirmMessage',
|
|
280
|
-
overrideValue: labelOverrides
|
|
283
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.confirmMessage
|
|
281
284
|
}, {
|
|
282
|
-
name: customProperty
|
|
285
|
+
name: (_customProperty$label4 = customProperty === null || customProperty === void 0 ? void 0 : customProperty.label) !== null && _customProperty$label4 !== void 0 ? _customProperty$label4 : customProperty === null || customProperty === void 0 ? void 0 : customProperty.name
|
|
283
286
|
}),
|
|
284
287
|
onCancel: () => setDeleteModal(false),
|
|
285
288
|
onConfirm: () => {
|
|
286
|
-
deleteCustProp(customProperty
|
|
289
|
+
deleteCustProp(customProperty === null || customProperty === void 0 ? void 0 : customProperty.id);
|
|
287
290
|
setCustomProperty();
|
|
288
291
|
setDeleteModal(false);
|
|
289
292
|
},
|