@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.
Files changed (82) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/lib/ActionList/ActionListFieldArray.js +29 -32
  3. package/es/lib/ComboButton/ComboButton.js +5 -6
  4. package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +4 -7
  5. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +29 -32
  6. package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
  7. package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +2 -2
  8. package/es/lib/CustomProperties/Config/CustomPropertyView.js +32 -33
  9. package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
  10. package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +1 -1
  11. package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +3 -3
  12. package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +5 -10
  13. package/es/lib/CustomProperties/Edit/CustomPropertyField.js +20 -26
  14. package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +5 -5
  15. package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -2
  16. package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
  17. package/es/lib/CustomProperties/Edit/testResources.js +11 -12
  18. package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +6 -11
  19. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +20 -28
  20. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
  21. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
  22. package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +8 -8
  23. package/es/lib/CustomProperties/Filter/testResources.js +1 -2
  24. package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +1 -2
  25. package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
  26. package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +18 -26
  27. package/es/lib/CustomProperties/View/CustomPropertyCard.js +7 -11
  28. package/es/lib/CycleButton/CycleButton.js +1 -1
  29. package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +21 -32
  30. package/es/lib/EditableRefdataList/EditableRefdataList.js +26 -33
  31. package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +1 -1
  32. package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +5 -5
  33. package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +10 -12
  34. package/es/lib/EditableSettingsList/SettingField/SettingField.js +4 -4
  35. package/es/lib/FormattedKintMessage/FormattedKintMessage.js +4 -7
  36. package/es/lib/IconSelect/IconSelect.js +5 -9
  37. package/es/lib/NoResultsMessage/NoResultsMessage.js +4 -4
  38. package/es/lib/RefdataButtons/RefdataButtons.js +3 -3
  39. package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +21 -28
  40. package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +5 -6
  41. package/es/lib/RichSelect/RichSelect.js +14 -19
  42. package/es/lib/RichSelect/useSelectedOption.js +1 -2
  43. package/es/lib/SASQLookupComponent/SASQLookupComponent.js +14 -17
  44. package/es/lib/SASQLookupComponent/TableBody/TableBody.js +4 -6
  45. package/es/lib/SASQRoute/SASQRoute.js +2 -2
  46. package/es/lib/SASQViewComponent/SASQViewComponent.js +5 -9
  47. package/es/lib/SettingPage/SettingPagePane.js +2 -2
  48. package/es/lib/SettingsFormContainer/SettingsFormContainer.js +2 -2
  49. package/es/lib/Typedown/Typedown.js +19 -26
  50. package/es/lib/hooks/typedownHooks/useTypedown.js +2 -2
  51. package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
  52. package/es/lib/hooks/useActiveElement.js +1 -1
  53. package/es/lib/hooks/useCustomProperties.js +2 -2
  54. package/es/lib/hooks/useHelperApp.js +6 -6
  55. package/es/lib/hooks/useIntlKeyStore.js +4 -7
  56. package/es/lib/hooks/useKintIntl.js +5 -11
  57. package/es/lib/hooks/useKiwtSASQuery.js +1 -1
  58. package/es/lib/hooks/useModConfigEntries.js +2 -2
  59. package/es/lib/hooks/useMutateCustomProperties.js +8 -8
  60. package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
  61. package/es/lib/hooks/useMutateRefdataCategory.js +4 -4
  62. package/es/lib/hooks/useMutateRefdataValue.js +6 -6
  63. package/es/lib/hooks/useQIndex.js +5 -5
  64. package/es/lib/hooks/useRefdata.js +3 -3
  65. package/es/lib/hooks/useTemplates.js +4 -4
  66. package/es/lib/settingsHooks/useAppSettings.js +7 -11
  67. package/es/lib/settingsHooks/useSettingSection.js +2 -2
  68. package/es/lib/settingsHooks/useSettings.js +3 -3
  69. package/es/lib/utils/buildUrl.js +2 -3
  70. package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +6 -6
  71. package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
  72. package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +4 -5
  73. package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
  74. package/es/lib/utils/generateKiwtQueryParams.js +28 -37
  75. package/es/lib/utils/groupCustomPropertiesByCtx.js +2 -3
  76. package/es/lib/utils/matchString.js +1 -1
  77. package/es/lib/utils/parseErrorResponse.js +2 -3
  78. package/es/lib/utils/selectorSafe.js +2 -3
  79. package/es/lib/utils/sortByLabel.js +2 -3
  80. package/es/lib/validators/validators.js +3 -3
  81. package/package.json +1 -1
  82. 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: "customProperties.ctx.".concat(ctx),
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: "".concat(id, "-accordion-").concat(ctx),
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
- var _Object$entries$filte, _Object$entries;
91
- return (_Object$entries$filte = (_Object$entries = Object.entries(customProperties)) === null || _Object$entries === void 0 || (_Object$entries = _Object$entries.filter(_ref2 => {
92
- var _cp$, _cp$2, _cp$3;
93
- let [_key, cp] = _ref2;
94
- return (((_cp$ = cp[0]) === null || _cp$ === void 0 || (_cp$ = _cp$.type) === null || _cp$ === void 0 ? void 0 : _cp$.ctx) === ctx || ctx === 'isNull' && !((_cp$2 = cp[0]) !== null && _cp$2 !== void 0 && (_cp$2 = _cp$2.type) !== null && _cp$2 !== void 0 && _cp$2.ctx)) &&
95
- // Either the ctx string matches, or isNull matches blank
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 = (_custprops$filter$len = custprops === null || custprops === void 0 || (_custprops$filter = custprops.filter(cp => cp.primary === true)) === null || _custprops$filter === void 0 ? void 0 : _custprops$filter.length) !== null && _custprops$filter$len !== void 0 ? _custprops$filter$len : 0;
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: "".concat(id, "-accordion-").concat(ctx),
108
+ id: `${id}-accordion-${ctx}`,
114
109
  label: getAccordionLabel(),
115
- children: custprops.map((cp, index) => {
116
- var _customProperties$cp$;
117
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyCard.default, {
118
- ctx: ctx,
119
- customProperty: customProperties === null || customProperties === void 0 || (_customProperties$cp$ = customProperties[cp.name]) === null || _customProperties$cp$ === void 0 ? void 0 : _customProperties$cp$[0],
120
- customPropertyDefinition: cp,
121
- index: index,
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 = (customProperty === null || customProperty === void 0 ? void 0 : customProperty.internal) === false || (customProperty === null || customProperty === void 0 ? void 0 : customProperty.internal) === undefined && customPropertyDefinition.defaultInternal === false;
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: (_customProperty$value = customProperty.value) === null || _customProperty$value === void 0 ? void 0 : _customProperty$value.map(item => {
46
- var _item$label;
47
- return (_item$label = item === null || item === void 0 ? void 0 : item.label) !== null && _item$label !== void 0 ? _item$label : item === null || item === void 0 ? void 0 : item.value;
48
- }),
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 (_customProperty$value2 = (_customProperty$value3 = customProperty.value) === null || _customProperty$value3 === void 0 ? void 0 : _customProperty$value3.label) !== null && _customProperty$value2 !== void 0 ? _customProperty$value2 : (_customProperty$value4 = customProperty.value) === null || _customProperty$value4 === void 0 ? void 0 : _customProperty$value4.value;
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: "customproperty-card-".concat(index),
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 !== null && customProperty !== void 0 && customProperty.note ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
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 !== null && customProperty !== void 0 && customProperty.publicNote ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
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
- }, "customPropertyCard-".concat(ctx, "[").concat(index, "]"));
131
+ }, `customPropertyCard-${ctx}[${index}]`);
136
132
  };
137
133
  CustomPropertyCard.propTypes = {
138
134
  ctx: _propTypes.default.string,
@@ -29,7 +29,7 @@ const CycleButton = _ref => {
29
29
  if (onClick) {
30
30
  onClick(e);
31
31
  }
32
- setIndex(index !== (buttons === null || buttons === void 0 ? void 0 : buttons.length) - 1 ? index + 1 : 0);
32
+ setIndex(index !== buttons?.length - 1 ? index + 1 : 0);
33
33
  }
34
34
  });
35
35
  };
@@ -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
- var _refdata$sort;
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 !== null && afterQueryCalls !== void 0 && afterQueryCalls.delete) {
90
+ if (afterQueryCalls?.delete) {
93
91
  afterQueryCalls.delete(json);
94
92
  }
95
93
  },
96
94
  post: json => {
97
- if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.post) {
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteError
108
+ overrideValue: labelOverrides?.deleteError
112
109
  }, {
113
- label: deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata = deleteModal.refdata) === null || _deleteModal$refdata === void 0 ? void 0 : _deleteModal$refdata.label,
114
- error: errorResp === null || errorResp === void 0 ? void 0 : errorResp.message
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 === null || refdata === void 0 ? void 0 : refdata.id,
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 (!(rowData !== null && rowData !== void 0 && (_rowData$values = rowData.values) !== null && _rowData$values !== void 0 && _rowData$values.length) && deleteCondition) {
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteAriaLabel
151
+ overrideValue: labelOverrides?.deleteAriaLabel
156
152
  }, {
157
- label: data === null || data === void 0 ? void 0 : data.label
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.refdataCategory
165
+ overrideValue: labelOverrides?.refdataCategory
170
166
  }),
171
167
  values: kintIntl.formatKintMessage({
172
168
  id: 'refdataCategory.noOfValues',
173
- overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.noOfValues
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 || !(contentData !== null && contentData !== void 0 && contentData.find(cd => {
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
190
+ overrideValue: labelOverrides?.delete
201
191
  }),
202
192
  heading: kintIntl.formatKintMessage({
203
193
  id: 'refdataCategory.deleteRefdataCategory',
204
- overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteRefdataCategory
194
+ overrideValue: labelOverrides?.deleteRefdataCategory
205
195
  }),
206
196
  message: kintIntl.formatKintMessage({
207
197
  id: 'refdataCategory.deleteRefdataCategory.confirmMessage',
208
- overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteRefdataCategoryMessage
198
+ overrideValue: labelOverrides?.deleteRefdataCategoryMessage
209
199
  }, {
210
- name: deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata2 = deleteModal.refdata) === null || _deleteModal$refdata2 === void 0 ? void 0 : _deleteModal$refdata2.desc
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
- var _deleteModal$refdata3;
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 === null || deleteModal === void 0 ? void 0 : deleteModal.visible
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
- var _refdata$values$sort, _refdata$values;
92
- setContentData((_refdata$values$sort = refdata === null || refdata === void 0 || (_refdata$values = refdata.values) === null || _refdata$values === void 0 ? void 0 : _refdata$values.sort(sortByLabel)) !== null && _refdata$values$sort !== void 0 ? _refdata$values$sort : []);
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
- var _json$values$sort, _json$values;
104
- setContentData((_json$values$sort = json === null || json === void 0 || (_json$values = json.values) === null || _json$values === void 0 ? void 0 : _json$values.sort(sortByLabel)) !== null && _json$values$sort !== void 0 ? _json$values$sort : []);
105
- if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.delete) {
101
+ setContentData(json?.values?.sort(sortByLabel) ?? []);
102
+ if (afterQueryCalls?.delete) {
106
103
  afterQueryCalls.delete(json);
107
104
  }
108
105
  },
109
106
  put: json => {
110
- var _json$values$sort2, _json$values2;
111
- setContentData((_json$values$sort2 = json === null || json === void 0 || (_json$values2 = json.values) === null || _json$values2 === void 0 ? void 0 : _json$values2.sort(sortByLabel)) !== null && _json$values$sort2 !== void 0 ? _json$values$sort2 : []);
112
- if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.put) {
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteError
121
+ overrideValue: labelOverrides?.deleteError
127
122
  }, {
128
- label: deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata = deleteModal.refdata) === null || _deleteModal$refdata === void 0 ? void 0 : _deleteModal$refdata.label,
129
- error: errorResp === null || errorResp === void 0 ? void 0 : errorResp.message
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 === null || refdata === void 0 ? void 0 : refdata.id,
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.edit
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.editAriaLabel
161
+ overrideValue: labelOverrides?.editAriaLabel
167
162
  }, {
168
- label: data === null || data === void 0 ? void 0 : data.label
163
+ label: data?.label
169
164
  })
170
165
  });
171
166
  }
172
- if (!(refdata !== null && refdata !== void 0 && refdata.internal) && deleteCondition) {
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteAriaLabel
181
+ overrideValue: labelOverrides?.deleteAriaLabel
187
182
  }, {
188
- label: data === null || data === void 0 ? void 0 : data.label
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.label
195
+ overrideValue: labelOverrides?.label
201
196
  }),
202
197
  value: kintIntl.formatKintMessage({
203
198
  id: 'refdata.value',
204
- overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.value
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 !== null && refdata !== void 0 && refdata.internal ? null : data => {
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: (_selectorSafe = (0, _utils.selectorSafe)(data === null || data === void 0 ? void 0 : data.label)) === null || _selectorSafe === void 0 ? void 0 : _selectorSafe.replaceAll('%20', ' ')
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
229
+ overrideValue: labelOverrides?.delete
236
230
  }),
237
231
  heading: kintIntl.formatKintMessage({
238
232
  id: 'refdata.deleteRefdataValue',
239
- overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteRefdataValue
233
+ overrideValue: labelOverrides?.deleteRefdataValue
240
234
  }),
241
235
  message: kintIntl.formatKintMessage({
242
236
  id: 'refdata.deleteRefdataValue.confirmMessage',
243
- overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteRefdataValueMessage
237
+ overrideValue: labelOverrides?.deleteRefdataValueMessage
244
238
  }, {
245
- name: deleteModal === null || deleteModal === void 0 || (_deleteModal$refdata2 = deleteModal.refdata) === null || _deleteModal$refdata2 === void 0 ? void 0 : _deleteModal$refdata2.label
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
- var _deleteModal$refdata3;
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 === null || deleteModal === void 0 ? void 0 : deleteModal.visible
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": "editableSettingsListFieldArray[".concat(i, "]"),
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.valueFor
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: "".concat(input.name, ".value")
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: "".concat(input.name, ".value"),
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: "".concat(input.name, ".value"),
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: "".concat(input.name, ".value"),
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 === null || labelOverrides === void 0 ? void 0 : labelOverrides.noCurrentValue
23
+ overrideValue: labelOverrides?.noCurrentValue
24
24
  });
25
- const defaultText = "[".concat(kintIntl.formatKintMessage({
25
+ const defaultText = `[${kintIntl.formatKintMessage({
26
26
  id: 'settings.default',
27
- overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.default
28
- }), "]");
27
+ overrideValue: labelOverrides?.default
28
+ })}]`;
29
29
  switch (setting.settingType) {
30
30
  case 'Refdata':
31
31
  {
32
32
  if (setting.value) {
33
- var _refdata$filter$0$lab, _refdata$filter$;
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
- var _refdata$filter$2;
38
- const defValue = refdata === null || refdata === void 0 || (_refdata$filter$2 = refdata.filter(obj => obj.value === setting.defValue)[0]) === null || _refdata$filter$2 === void 0 ? void 0 : _refdata$filter$2.label;
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 "".concat(defaultText, " ********");
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 (templateValue === null || templateValue === void 0 ? void 0 : templateValue.name) || NoCurrentValue;
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 "".concat(defaultText, " ").concat(setting.defValue);
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: !!(currentSetting !== null && currentSetting !== void 0 && currentSetting.vocab) && currentSetting.settingType === 'Refdata'
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: !!(currentSetting !== null && currentSetting !== void 0 && currentSetting.vocab) && currentSetting.settingType === 'Template'
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 = "settings.".concat((0, _utils.toCamelCase)(currentSetting.section), ".").concat((0, _utils.toCamelCase)(currentSetting.key), ".help");
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: "settings.".concat((0, _utils.toCamelCase)(currentSetting.section), ".").concat((0, _utils.toCamelCase)(currentSetting.key))
121
+ id: `settings.${(0, _utils.toCamelCase)(currentSetting.section)}.${(0, _utils.toCamelCase)(currentSetting.key)}`
122
122
  }) : kintIntl.formatKintMessage({
123
123
  id: 'loading'
124
124
  });