@k-int/stripes-kint-components 4.4.0 → 4.4.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 +9 -0
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +51 -27
- package/es/lib/EditableSettingsList/EditableSettingsList.js +7 -3
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +5 -1
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +17 -11
- package/es/lib/SettingPage/SettingPage.js +5 -1
- package/es/lib/settingsHooks/useSettings.js +4 -1
- package/es/lib/utils/selectorSafe.js +16 -1
- package/package.json +1 -1
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +68 -42
- package/src/lib/CustomProperties/Config/README.md +1 -0
- package/src/lib/EditableRefdataList/README.md +1 -1
- package/src/lib/EditableSettingsList/EditableSettingsList.js +4 -1
- package/src/lib/EditableSettingsList/EditableSettingsListFieldArray.js +3 -0
- package/src/lib/EditableSettingsList/SettingField/SettingField.js +20 -15
- package/src/lib/SettingPage/SettingPage.js +3 -0
- package/src/lib/settingsHooks/useSettings.js +2 -0
- package/src/lib/utils/selectorSafe.js +15 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 4.4.2 2023-02-15
|
|
2
|
+
* selectorSafe -- Ensured better compatibility with other scripts now it's used in a user facing place.
|
|
3
|
+
|
|
4
|
+
## 4.4.1 2023-02-08
|
|
5
|
+
* CustomPropertiesSettings
|
|
6
|
+
* Added displayConditions which act in the same way as below, allowing for programatic turning on/off of access to certain actions
|
|
7
|
+
* Settings (Multiple components)
|
|
8
|
+
* Added allowEdit property, which defaults to `true`, and if false, does not render edit button for any appSetting
|
|
9
|
+
* Added allowGlobalEdit property to `useSettings` hook, which allows the programatic turning on/off of `allowEdit` for ALL settings. More granular control will currently have to be handled manually via `dynamicPageExclusions` and then manual setting up of SettingsPage components with the requisite `allowEdit` booleans controlled by the implementing software.
|
|
1
10
|
## 4.4.0 2023-02-08
|
|
2
11
|
* Removed all cyclic imports, linting
|
|
3
12
|
* ActionList
|
|
@@ -44,12 +44,24 @@ var CustomPropertiesSettings = function CustomPropertiesSettings(_ref) {
|
|
|
44
44
|
catchQueryCalls = _ref.catchQueryCalls,
|
|
45
45
|
contextFilterOptions = _ref.contextFilterOptions,
|
|
46
46
|
customPropertiesEndpoint = _ref.customPropertiesEndpoint,
|
|
47
|
+
_ref$displayCondition = _ref.displayConditions,
|
|
48
|
+
displayConditions = _ref$displayCondition === void 0 ? {
|
|
49
|
+
create: true,
|
|
50
|
+
delete: true,
|
|
51
|
+
edit: true
|
|
52
|
+
} : _ref$displayCondition,
|
|
47
53
|
helpPopovers = _ref.helpPopovers,
|
|
48
54
|
passedIntlKey = _ref.intlKey,
|
|
49
55
|
passedIntlNS = _ref.intlNS,
|
|
50
56
|
_ref$labelOverrides = _ref.labelOverrides,
|
|
51
57
|
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
52
58
|
refdataEndpoint = _ref.refdataEndpoint;
|
|
59
|
+
var _displayConditions$cr = displayConditions.create,
|
|
60
|
+
createCondition = _displayConditions$cr === void 0 ? true : _displayConditions$cr,
|
|
61
|
+
_displayConditions$de = displayConditions.delete,
|
|
62
|
+
deleteCondition = _displayConditions$de === void 0 ? true : _displayConditions$de,
|
|
63
|
+
_displayConditions$ed = displayConditions.edit,
|
|
64
|
+
editCondition = _displayConditions$ed === void 0 ? true : _displayConditions$ed;
|
|
53
65
|
var callout = (0, _react.useContext)(_core.CalloutContext);
|
|
54
66
|
var queryClient = (0, _reactQuery.useQueryClient)();
|
|
55
67
|
var _useState = (0, _react.useState)(),
|
|
@@ -175,7 +187,7 @@ var CustomPropertiesSettings = function CustomPropertiesSettings(_ref) {
|
|
|
175
187
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
|
|
176
188
|
defaultWidth: "fill",
|
|
177
189
|
id: "settings-customProperties.lookupPane",
|
|
178
|
-
lastMenu: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
190
|
+
lastMenu: createCondition && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
179
191
|
buttonStyle: "primary",
|
|
180
192
|
marginBottom0: true,
|
|
181
193
|
onClick: function onClick() {
|
|
@@ -204,34 +216,41 @@ var CustomPropertiesSettings = function CustomPropertiesSettings(_ref) {
|
|
|
204
216
|
}), customProperty && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
|
|
205
217
|
actionMenu: function actionMenu(_ref2) {
|
|
206
218
|
var onToggle = _ref2.onToggle;
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
children:
|
|
216
|
-
|
|
217
|
-
|
|
219
|
+
var actionsArray = [];
|
|
220
|
+
if (editCondition) {
|
|
221
|
+
actionsArray.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
222
|
+
buttonStyle: "dropdownItem",
|
|
223
|
+
marginBottom0: true,
|
|
224
|
+
onClick: function onClick() {
|
|
225
|
+
return setMode(EDITING);
|
|
226
|
+
},
|
|
227
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
228
|
+
icon: "edit",
|
|
229
|
+
children: kintIntl.formatKintMessage({
|
|
230
|
+
id: 'edit',
|
|
231
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.edit
|
|
232
|
+
})
|
|
218
233
|
})
|
|
219
|
-
})
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
children:
|
|
230
|
-
|
|
231
|
-
|
|
234
|
+
}, "".concat(customProperty.name, "-action-edit")));
|
|
235
|
+
}
|
|
236
|
+
if (deleteCondition) {
|
|
237
|
+
actionsArray.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
238
|
+
buttonStyle: "dropdownItem",
|
|
239
|
+
marginBottom0: true,
|
|
240
|
+
onClick: function onClick() {
|
|
241
|
+
setDeleteModal(true);
|
|
242
|
+
onToggle();
|
|
243
|
+
},
|
|
244
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
245
|
+
icon: "trash",
|
|
246
|
+
children: kintIntl.formatKintMessage({
|
|
247
|
+
id: 'delete',
|
|
248
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
|
|
249
|
+
})
|
|
232
250
|
})
|
|
233
|
-
})
|
|
234
|
-
}
|
|
251
|
+
}, "".concat(customProperty.name, "-action-delete")));
|
|
252
|
+
}
|
|
253
|
+
return actionsArray !== null && actionsArray !== void 0 && actionsArray.length ? actionsArray : null;
|
|
235
254
|
},
|
|
236
255
|
defaultWidth: "fill",
|
|
237
256
|
dismissible: true,
|
|
@@ -333,6 +352,11 @@ CustomPropertiesSettings.propTypes = {
|
|
|
333
352
|
label: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.string])
|
|
334
353
|
})),
|
|
335
354
|
customPropertiesEndpoint: _propTypes.default.string,
|
|
355
|
+
displayConditions: _propTypes.default.shape({
|
|
356
|
+
create: _propTypes.default.bool,
|
|
357
|
+
delete: _propTypes.default.bool,
|
|
358
|
+
view: _propTypes.default.bool
|
|
359
|
+
}),
|
|
336
360
|
helpPopovers: _propTypes.default.object,
|
|
337
361
|
intlKey: _propTypes.default.string,
|
|
338
362
|
intlNS: _propTypes.default.string,
|
|
@@ -13,7 +13,9 @@ var _EditableSettingsListFieldArray = _interopRequireDefault(require("./Editable
|
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
var EditableSettingsList = function EditableSettingsList(_ref) {
|
|
16
|
-
var
|
|
16
|
+
var _ref$allowEdit = _ref.allowEdit,
|
|
17
|
+
allowEdit = _ref$allowEdit === void 0 ? true : _ref$allowEdit,
|
|
18
|
+
data = _ref.data,
|
|
17
19
|
initialValues = _ref.initialValues,
|
|
18
20
|
passedIntlKey = _ref.intlKey,
|
|
19
21
|
passedIntlNS = _ref.intlNS,
|
|
@@ -36,6 +38,7 @@ var EditableSettingsList = function EditableSettingsList(_ref) {
|
|
|
36
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("form", {
|
|
37
39
|
onSubmit: handleSubmit,
|
|
38
40
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, {
|
|
41
|
+
allowEdit: allowEdit,
|
|
39
42
|
component: _EditableSettingsListFieldArray.default,
|
|
40
43
|
data: data,
|
|
41
44
|
intlKey: passedIntlKey,
|
|
@@ -50,7 +53,7 @@ var EditableSettingsList = function EditableSettingsList(_ref) {
|
|
|
50
53
|
});
|
|
51
54
|
};
|
|
52
55
|
EditableSettingsList.propTypes = {
|
|
53
|
-
|
|
56
|
+
allowEdit: _propTypes.default.bool,
|
|
54
57
|
data: _propTypes.default.shape({
|
|
55
58
|
refdatavalues: _propTypes.default.arrayOf(_propTypes.default.object)
|
|
56
59
|
}),
|
|
@@ -58,7 +61,8 @@ EditableSettingsList.propTypes = {
|
|
|
58
61
|
intlKey: _propTypes.default.string,
|
|
59
62
|
intlNS: _propTypes.default.string,
|
|
60
63
|
label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node, _propTypes.default.object]),
|
|
61
|
-
labelOverrides: _propTypes.default.object
|
|
64
|
+
labelOverrides: _propTypes.default.object,
|
|
65
|
+
onSave: _propTypes.default.func
|
|
62
66
|
};
|
|
63
67
|
var _default = EditableSettingsList;
|
|
64
68
|
exports.default = _default;
|
|
@@ -17,7 +17,9 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
17
17
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
18
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
19
|
var EditableSettingsListFieldArray = function EditableSettingsListFieldArray(_ref) {
|
|
20
|
-
var
|
|
20
|
+
var _ref$allowEdit = _ref.allowEdit,
|
|
21
|
+
allowEdit = _ref$allowEdit === void 0 ? true : _ref$allowEdit,
|
|
22
|
+
data = _ref.data,
|
|
21
23
|
fields = _ref.fields,
|
|
22
24
|
passedIntlKey = _ref.intlKey,
|
|
23
25
|
passedIntlNS = _ref.intlNS,
|
|
@@ -30,6 +32,7 @@ var EditableSettingsListFieldArray = function EditableSettingsListFieldArray(_re
|
|
|
30
32
|
};
|
|
31
33
|
return fields.map(function (setting, i) {
|
|
32
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
35
|
+
allowEdit: allowEdit,
|
|
33
36
|
component: _SettingField.SettingField,
|
|
34
37
|
"data-testid": "editableSettingsListFieldArray[".concat(i, "]"),
|
|
35
38
|
intlKey: passedIntlKey,
|
|
@@ -46,6 +49,7 @@ var EditableSettingsListFieldArray = function EditableSettingsListFieldArray(_re
|
|
|
46
49
|
});
|
|
47
50
|
};
|
|
48
51
|
EditableSettingsListFieldArray.propTypes = {
|
|
52
|
+
allowEdit: _propTypes.default.bool,
|
|
49
53
|
fields: _propTypes.default.object,
|
|
50
54
|
intlKey: _propTypes.default.string,
|
|
51
55
|
intlNS: _propTypes.default.string,
|
|
@@ -30,7 +30,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
30
30
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
31
31
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
32
|
var SettingField = function SettingField(settingFieldProps) {
|
|
33
|
-
var
|
|
33
|
+
var _settingFieldProps$al = settingFieldProps.allowEdit,
|
|
34
|
+
allowEdit = _settingFieldProps$al === void 0 ? true : _settingFieldProps$al,
|
|
35
|
+
passedIntlKey = settingFieldProps.intlKey,
|
|
34
36
|
passedIntlNS = settingFieldProps.intlNS,
|
|
35
37
|
_settingFieldProps$la = settingFieldProps.labelOverrides,
|
|
36
38
|
labelOverrides = _settingFieldProps$la === void 0 ? {} : _settingFieldProps$la,
|
|
@@ -129,16 +131,19 @@ var SettingField = function SettingField(settingFieldProps) {
|
|
|
129
131
|
}) : kintIntl.formatKintMessage({
|
|
130
132
|
id: 'edit'
|
|
131
133
|
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
e
|
|
136
|
-
|
|
137
|
-
return
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
134
|
+
if (allowEdit) {
|
|
135
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
136
|
+
marginBottom0: true,
|
|
137
|
+
onClick: function onClick(e) {
|
|
138
|
+
e.preventDefault();
|
|
139
|
+
return editing ? onSave().then(function () {
|
|
140
|
+
return setEditing(false);
|
|
141
|
+
}) : setEditing(true);
|
|
142
|
+
},
|
|
143
|
+
children: EditText
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
142
147
|
};
|
|
143
148
|
var RenderFunction;
|
|
144
149
|
if (editing === false) {
|
|
@@ -174,6 +179,7 @@ var SettingField = function SettingField(settingFieldProps) {
|
|
|
174
179
|
});
|
|
175
180
|
};
|
|
176
181
|
SettingField.propTypes = {
|
|
182
|
+
allowEdit: _propTypes.default.bool,
|
|
177
183
|
settingData: _propTypes.default.shape({
|
|
178
184
|
refdatavalues: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
179
185
|
currentSetting: _propTypes.default.object,
|
|
@@ -17,7 +17,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
17
17
|
// Importing directly here to avoid cyclic dependency
|
|
18
18
|
|
|
19
19
|
var SettingPage = function SettingPage(_ref) {
|
|
20
|
-
var
|
|
20
|
+
var _ref$allowEdit = _ref.allowEdit,
|
|
21
|
+
allowEdit = _ref$allowEdit === void 0 ? true : _ref$allowEdit,
|
|
22
|
+
passedIntlKey = _ref.intlKey,
|
|
21
23
|
passedIntlNS = _ref.intlNS,
|
|
22
24
|
_ref$labelOverrides = _ref.labelOverrides,
|
|
23
25
|
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
@@ -31,6 +33,7 @@ var SettingPage = function SettingPage(_ref) {
|
|
|
31
33
|
handleSubmit = _useSettingSection.handleSubmit,
|
|
32
34
|
settings = _useSettingSection.settings;
|
|
33
35
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditableSettingsList.EditableSettingsList, {
|
|
36
|
+
allowEdit: allowEdit,
|
|
34
37
|
initialValues: {
|
|
35
38
|
'settings': settings
|
|
36
39
|
},
|
|
@@ -43,6 +46,7 @@ var SettingPage = function SettingPage(_ref) {
|
|
|
43
46
|
});
|
|
44
47
|
};
|
|
45
48
|
SettingPage.propTypes = {
|
|
49
|
+
allowEdit: _propTypes.default.bool,
|
|
46
50
|
intlKey: _propTypes.default.string,
|
|
47
51
|
intlNS: _propTypes.default.string,
|
|
48
52
|
labelOverrides: _propTypes.default.object,
|
|
@@ -28,7 +28,9 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
28
28
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
29
29
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
30
30
|
var useSettings = function useSettings(_ref) {
|
|
31
|
-
var
|
|
31
|
+
var _ref$allowGlobalEdit = _ref.allowGlobalEdit,
|
|
32
|
+
allowGlobalEdit = _ref$allowGlobalEdit === void 0 ? true : _ref$allowGlobalEdit,
|
|
33
|
+
dynamicPageExclusions = _ref.dynamicPageExclusions,
|
|
32
34
|
passedIntlKey = _ref.intlKey,
|
|
33
35
|
passedIntlNS = _ref.intlNS,
|
|
34
36
|
_ref$labelOverrides = _ref.labelOverrides,
|
|
@@ -72,6 +74,7 @@ var useSettings = function useSettings(_ref) {
|
|
|
72
74
|
intlNS: passedIntlNS,
|
|
73
75
|
sectionName: section,
|
|
74
76
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SettingPage.SettingPage, _objectSpread({
|
|
77
|
+
allowEdit: allowGlobalEdit,
|
|
75
78
|
intlKey: passedIntlKey,
|
|
76
79
|
intlNS: passedIntlNS,
|
|
77
80
|
labelOverrides: labelOverrides,
|
|
@@ -5,7 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var selectorSafe = function selectorSafe(string) {
|
|
8
|
-
|
|
8
|
+
var _string$normalize, _string$normalize$rep;
|
|
9
|
+
// Normalise to separate diacritics from their base characters as "marks"
|
|
10
|
+
// then strip out all marks.
|
|
11
|
+
return (_string$normalize = string.normalize('NFKD')) === null || _string$normalize === void 0 ? void 0 : (_string$normalize$rep = _string$normalize.replace(/(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC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\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])/g, '')
|
|
12
|
+
// Then swap out any non-letter/number characters (Also ignore - and _) for `_`
|
|
13
|
+
) === null || _string$normalize$rep === void 0 ? void 0 : _string$normalize$rep.replace(/(?:(?![\x2D0-9A-Z_a-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\u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DD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDF50-\uDF59\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F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F]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])[\s\S])/g, '_');
|
|
9
14
|
};
|
|
10
15
|
var _default = selectorSafe;
|
|
16
|
+
/*
|
|
17
|
+
* Should transform as follows:
|
|
18
|
+
* %%&&||()_-*^%$£"!:;@'~#<>/??|\ --> _________-____________________
|
|
19
|
+
* étéaoûtçapère; --> eteaoutcapere_
|
|
20
|
+
* Wörtertschüss; --> wortertschuss_
|
|
21
|
+
* mañanaángel'brødfråłzaźlepięćkuşgöz`tŷ --> mananaangel_brødfrałzazlepieckusgoz_ty
|
|
22
|
+
* æøß --> æøß
|
|
23
|
+
* How do we handle numbers 00!1 --> how_do_we_handle_numbers_00_1
|
|
24
|
+
* This is a normal case --> this_is_a_normal_case
|
|
25
|
+
*/
|
|
11
26
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -25,12 +25,23 @@ const CustomPropertiesSettings = ({
|
|
|
25
25
|
catchQueryCalls,
|
|
26
26
|
contextFilterOptions,
|
|
27
27
|
customPropertiesEndpoint,
|
|
28
|
+
displayConditions = {
|
|
29
|
+
create: true,
|
|
30
|
+
delete: true,
|
|
31
|
+
edit: true
|
|
32
|
+
},
|
|
28
33
|
helpPopovers,
|
|
29
34
|
intlKey: passedIntlKey,
|
|
30
35
|
intlNS: passedIntlNS,
|
|
31
36
|
labelOverrides = {},
|
|
32
37
|
refdataEndpoint,
|
|
33
38
|
}) => {
|
|
39
|
+
const {
|
|
40
|
+
create: createCondition = true,
|
|
41
|
+
delete: deleteCondition = true,
|
|
42
|
+
edit: editCondition = true
|
|
43
|
+
} = displayConditions;
|
|
44
|
+
|
|
34
45
|
const callout = useContext(CalloutContext);
|
|
35
46
|
const queryClient = useQueryClient();
|
|
36
47
|
|
|
@@ -146,7 +157,7 @@ const CustomPropertiesSettings = ({
|
|
|
146
157
|
<Pane
|
|
147
158
|
defaultWidth="fill"
|
|
148
159
|
id="settings-customProperties.lookupPane"
|
|
149
|
-
lastMenu={
|
|
160
|
+
lastMenu={createCondition &&
|
|
150
161
|
<Button
|
|
151
162
|
buttonStyle="primary"
|
|
152
163
|
marginBottom0
|
|
@@ -180,47 +191,57 @@ const CustomPropertiesSettings = ({
|
|
|
180
191
|
</Pane>
|
|
181
192
|
{customProperty &&
|
|
182
193
|
<Pane
|
|
183
|
-
actionMenu={({ onToggle }) =>
|
|
184
|
-
[
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
194
|
+
actionMenu={({ onToggle }) => {
|
|
195
|
+
const actionsArray = [];
|
|
196
|
+
if (editCondition) {
|
|
197
|
+
actionsArray.push(
|
|
198
|
+
<Button
|
|
199
|
+
key={`${customProperty.name}-action-edit`}
|
|
200
|
+
buttonStyle="dropdownItem"
|
|
201
|
+
marginBottom0
|
|
202
|
+
onClick={() => setMode(EDITING)}
|
|
203
|
+
>
|
|
204
|
+
<Icon icon="edit">
|
|
205
|
+
{
|
|
206
|
+
kintIntl.formatKintMessage(
|
|
207
|
+
{
|
|
208
|
+
id: 'edit',
|
|
209
|
+
overrideValue: labelOverrides?.edit,
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
}
|
|
213
|
+
</Icon>
|
|
214
|
+
</Button>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (deleteCondition) {
|
|
219
|
+
actionsArray.push(
|
|
220
|
+
<Button
|
|
221
|
+
key={`${customProperty.name}-action-delete`}
|
|
222
|
+
buttonStyle="dropdownItem"
|
|
223
|
+
marginBottom0
|
|
224
|
+
onClick={() => {
|
|
225
|
+
setDeleteModal(true);
|
|
226
|
+
onToggle();
|
|
227
|
+
}}
|
|
228
|
+
>
|
|
229
|
+
<Icon icon="trash">
|
|
230
|
+
{
|
|
231
|
+
kintIntl.formatKintMessage(
|
|
232
|
+
{
|
|
233
|
+
id: 'delete',
|
|
234
|
+
overrideValue: labelOverrides?.delete,
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
</Icon>
|
|
239
|
+
</Button>
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return (actionsArray?.length ? actionsArray : null);
|
|
244
|
+
}}
|
|
224
245
|
defaultWidth="fill"
|
|
225
246
|
dismissible
|
|
226
247
|
id="settings-customProperties-viewPane"
|
|
@@ -349,6 +370,11 @@ CustomPropertiesSettings.propTypes = {
|
|
|
349
370
|
])
|
|
350
371
|
})),
|
|
351
372
|
customPropertiesEndpoint: PropTypes.string,
|
|
373
|
+
displayConditions: PropTypes.shape({
|
|
374
|
+
create: PropTypes.bool,
|
|
375
|
+
delete: PropTypes.bool,
|
|
376
|
+
view: PropTypes.bool,
|
|
377
|
+
}),
|
|
352
378
|
helpPopovers: PropTypes.object,
|
|
353
379
|
intlKey: PropTypes.string,
|
|
354
380
|
intlNS: PropTypes.string,
|
|
@@ -23,6 +23,7 @@ ctx | `<moduleIntlKey>.customProperties.ctx` | Override for the display of field
|
|
|
23
23
|
deleteError | `<moduleIntlKey>customProperties.config.delete.errorMessage` | Override for the default callout message shown when a custom property fails to delete. Accepts a function to which it will provide the error message and the customProperty in question. | error; The error on delete, label: The label of the custom property |
|
|
24
24
|
defaultVisibility | `<moduleIntlKey>.customProperties.defaultVisibility` | Override for the display of field "defaultVisibility" | | |
|
|
25
25
|
description | `<moduleIntlKey>.customProperties.description` | Override for the display of field "description" | | |
|
|
26
|
+
displayConditions | object | An object of the form `{delete: false, edit: true, create: true}`, with keys `delete`, `edit` and `create`, and a boolean value. These will each default to true if not specified. These booleans will act as an additional check before rendering the actions for create/delete/edit, as well as whether or not to render the action button in the view pane at all. | `{delete: true, edit: true, create: true}` | ✕ |
|
|
26
27
|
editModalTitle | `<moduleIntlKey>.customProperties.config.editModal` | Override for the modal header on editing a custom property | name: Label of custom property, falling back to name. |
|
|
27
28
|
label | `<moduleIntlKey>.customProperties.label` | Override for the display of field "label" | | |
|
|
28
29
|
name | `<moduleIntlKey>.customProperties.name` | Override for the display of field "name" | | |newModalTitle | `<moduleIntlKey>.customProperties.config.newModal` | Override for the modal header on attempting to create a custom property | "Edit custom property" |
|
|
@@ -21,6 +21,6 @@ afterQueryCalls | object | An object of the form `{delete: func1, put: func2}` w
|
|
|
21
21
|
allowSpecial | boolean | A boolean to turn off/on the stripping out of special characters and replacing them with `_`. Generally turning this on will cause problems with queries to KIWT endpoints and internally with Stripes filters, where a refdata value includes `&&`, `||`, `\` or `"`. | false | ✕ |
|
|
22
22
|
catchQueryCalls | object | An object of the form `{delete: func1, put: func2}` where `func1`/`func2` are functions to be called with a HTTPError object when the `delete`/`put` calls fail. | `{delete: <Fires a callout of the format "<strong>Error: {label}</strong> was not deleted. {error}">}` | | ✕ |
|
|
23
23
|
desc | String | A string corresponding to the refdataValue category, usually of the form `DomainClass.Field`. See `useRefdata` for more information. | | ✕ |
|
|
24
|
-
endpoint | String | A string containing the path to the endpoint for refdata | | ✓ |
|
|
25
24
|
displayConditions | object | An object of the form `{delete: false, edit: true, create: true}`, with keys `delete`, `edit` and `create`, and a boolean value. These will each default to true if not specified. These booleans will act as an additional check before rendering the actions for create/delete/edit, as well as whether or not to render the actions column at all. | `{delete: true, edit: true, create: true}` | ✕ |
|
|
25
|
+
endpoint | String | A string containing the path to the endpoint for refdata | | ✓ |
|
|
26
26
|
labelOverrides | object | An object containing translation overrides. Currently accepts: `deleteError: (err, object) => { ... output a callout message }`. | | ✕ |
|
|
@@ -7,6 +7,7 @@ import arrayMutators from 'final-form-arrays';
|
|
|
7
7
|
import EditableSettingsListFieldArray from './EditableSettingsListFieldArray';
|
|
8
8
|
|
|
9
9
|
const EditableSettingsList = ({
|
|
10
|
+
allowEdit = true, // A gloabal boolean permission to turn on/off editing of all appSettings in the frontend
|
|
10
11
|
data,
|
|
11
12
|
initialValues,
|
|
12
13
|
intlKey: passedIntlKey,
|
|
@@ -28,6 +29,7 @@ const EditableSettingsList = ({
|
|
|
28
29
|
{({ handleSubmit }) => (
|
|
29
30
|
<form onSubmit={handleSubmit}>
|
|
30
31
|
<FieldArray
|
|
32
|
+
allowEdit={allowEdit}
|
|
31
33
|
component={EditableSettingsListFieldArray}
|
|
32
34
|
data={data}
|
|
33
35
|
intlKey={passedIntlKey}
|
|
@@ -44,7 +46,7 @@ const EditableSettingsList = ({
|
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
EditableSettingsList.propTypes = {
|
|
47
|
-
|
|
49
|
+
allowEdit: PropTypes.bool,
|
|
48
50
|
data: PropTypes.shape({
|
|
49
51
|
refdatavalues: PropTypes.arrayOf(PropTypes.object)
|
|
50
52
|
}),
|
|
@@ -57,6 +59,7 @@ EditableSettingsList.propTypes = {
|
|
|
57
59
|
PropTypes.object
|
|
58
60
|
]),
|
|
59
61
|
labelOverrides: PropTypes.object,
|
|
62
|
+
onSave: PropTypes.func,
|
|
60
63
|
};
|
|
61
64
|
|
|
62
65
|
export default EditableSettingsList;
|
|
@@ -5,6 +5,7 @@ import { Field } from 'react-final-form';
|
|
|
5
5
|
import { SettingField } from './SettingField';
|
|
6
6
|
|
|
7
7
|
const EditableSettingsListFieldArray = ({
|
|
8
|
+
allowEdit = true,
|
|
8
9
|
data,
|
|
9
10
|
fields,
|
|
10
11
|
intlKey: passedIntlKey,
|
|
@@ -22,6 +23,7 @@ const EditableSettingsListFieldArray = ({
|
|
|
22
23
|
return (
|
|
23
24
|
<Field
|
|
24
25
|
key={setting}
|
|
26
|
+
allowEdit={allowEdit}
|
|
25
27
|
component={SettingField}
|
|
26
28
|
data-testid={`editableSettingsListFieldArray[${i}]`}
|
|
27
29
|
intlKey={passedIntlKey}
|
|
@@ -40,6 +42,7 @@ const EditableSettingsListFieldArray = ({
|
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
EditableSettingsListFieldArray.propTypes = {
|
|
45
|
+
allowEdit: PropTypes.bool,
|
|
43
46
|
fields: PropTypes.object,
|
|
44
47
|
intlKey: PropTypes.string,
|
|
45
48
|
intlNS: PropTypes.string,
|
|
@@ -17,6 +17,7 @@ import renderHelpTextCSS from '../../../../styles/renderHelpText.css';
|
|
|
17
17
|
|
|
18
18
|
const SettingField = (settingFieldProps) => {
|
|
19
19
|
const {
|
|
20
|
+
allowEdit = true,
|
|
20
21
|
intlKey: passedIntlKey,
|
|
21
22
|
intlNS: passedIntlNS,
|
|
22
23
|
labelOverrides = {},
|
|
@@ -81,21 +82,24 @@ const SettingField = (settingFieldProps) => {
|
|
|
81
82
|
kintIntl.formatKintMessage({
|
|
82
83
|
id: 'edit'
|
|
83
84
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
e
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
85
|
+
if (allowEdit) {
|
|
86
|
+
return (
|
|
87
|
+
<Button
|
|
88
|
+
marginBottom0
|
|
89
|
+
onClick={(e) => {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
return (
|
|
92
|
+
editing ?
|
|
93
|
+
onSave().then(() => setEditing(false)) :
|
|
94
|
+
setEditing(true)
|
|
95
|
+
);
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
{EditText}
|
|
99
|
+
</Button>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
99
103
|
};
|
|
100
104
|
|
|
101
105
|
let RenderFunction;
|
|
@@ -146,6 +150,7 @@ const SettingField = (settingFieldProps) => {
|
|
|
146
150
|
};
|
|
147
151
|
|
|
148
152
|
SettingField.propTypes = {
|
|
153
|
+
allowEdit: PropTypes.bool,
|
|
149
154
|
settingData: PropTypes.shape({
|
|
150
155
|
refdatavalues: PropTypes.arrayOf(PropTypes.object),
|
|
151
156
|
currentSetting: PropTypes.object,
|
|
@@ -7,6 +7,7 @@ import { SettingsContext } from '../contexts';
|
|
|
7
7
|
import useSettingSection from '../settingsHooks/useSettingSection';
|
|
8
8
|
|
|
9
9
|
const SettingPage = ({
|
|
10
|
+
allowEdit = true,
|
|
10
11
|
intlKey: passedIntlKey,
|
|
11
12
|
intlNS: passedIntlNS,
|
|
12
13
|
labelOverrides = {},
|
|
@@ -21,6 +22,7 @@ const SettingPage = ({
|
|
|
21
22
|
|
|
22
23
|
return (
|
|
23
24
|
<EditableSettingsList
|
|
25
|
+
allowEdit={allowEdit}
|
|
24
26
|
initialValues={{ 'settings': settings }}
|
|
25
27
|
intlKey={passedIntlKey}
|
|
26
28
|
intlNS={passedIntlNS}
|
|
@@ -33,6 +35,7 @@ const SettingPage = ({
|
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
SettingPage.propTypes = {
|
|
38
|
+
allowEdit: PropTypes.bool,
|
|
36
39
|
intlKey: PropTypes.string,
|
|
37
40
|
intlNS: PropTypes.string,
|
|
38
41
|
labelOverrides: PropTypes.object,
|
|
@@ -13,6 +13,7 @@ import { generateKiwtQueryParams, sortByLabel, toCamelCase } from '../utils';
|
|
|
13
13
|
import { useKintIntl, useIntlKey } from '../hooks';
|
|
14
14
|
|
|
15
15
|
const useSettings = ({
|
|
16
|
+
allowGlobalEdit = true,
|
|
16
17
|
dynamicPageExclusions,
|
|
17
18
|
intlKey: passedIntlKey,
|
|
18
19
|
intlNS: passedIntlNS,
|
|
@@ -56,6 +57,7 @@ const useSettings = ({
|
|
|
56
57
|
sectionName={section}
|
|
57
58
|
>
|
|
58
59
|
<SettingPage
|
|
60
|
+
allowEdit={allowGlobalEdit}
|
|
59
61
|
intlKey={passedIntlKey}
|
|
60
62
|
intlNS={passedIntlNS}
|
|
61
63
|
labelOverrides={labelOverrides}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
const selectorSafe = (string) => {
|
|
2
|
-
|
|
2
|
+
// Normalise to separate diacritics from their base characters as "marks"
|
|
3
|
+
// then strip out all marks.
|
|
4
|
+
return string.normalize('NFKD')?.replace(/\p{M}/gu, '')
|
|
5
|
+
// Then swap out any non-letter/number characters (Also ignore - and _) for `_`
|
|
6
|
+
?.replace(/[^\p{L}\p{N}\-_]/gu, '_');
|
|
3
7
|
};
|
|
4
8
|
|
|
5
9
|
export default selectorSafe;
|
|
6
10
|
|
|
11
|
+
/*
|
|
12
|
+
* Should transform as follows:
|
|
13
|
+
* %%&&||()_-*^%$£"!:;@'~#<>/??|\ --> _________-____________________
|
|
14
|
+
* étéaoûtçapère; --> eteaoutcapere_
|
|
15
|
+
* Wörtertschüss; --> wortertschuss_
|
|
16
|
+
* mañanaángel'brødfråłzaźlepięćkuşgöz`tŷ --> mananaangel_brødfrałzazlepieckusgoz_ty
|
|
17
|
+
* æøß --> æøß
|
|
18
|
+
* How do we handle numbers 00!1 --> how_do_we_handle_numbers_00_1
|
|
19
|
+
* This is a normal case --> this_is_a_normal_case
|
|
20
|
+
*/
|