@k-int/stripes-kint-components 5.25.2 → 5.26.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/es/__mocks__/@folio/stripes/components.js +7 -3
  3. package/es/__mocks__/@folio/stripes/core.js +6 -4
  4. package/es/__mocks__/@folio/stripes/smart-components.js +6 -4
  5. package/es/__mocks__/react-query.js +6 -4
  6. package/es/__mocks__/react-router-dom.js +6 -6
  7. package/es/lib/ActionList/ActionList.js +33 -26
  8. package/es/lib/ActionList/ActionListFieldArray.js +119 -103
  9. package/es/lib/ComboButton/ComboButton.js +47 -42
  10. package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +17 -11
  11. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +46 -42
  12. package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
  13. package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +8 -4
  14. package/es/lib/CustomProperties/Config/CustomPropertyView.js +33 -32
  15. package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
  16. package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +1 -1
  17. package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +3 -3
  18. package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +35 -29
  19. package/es/lib/CustomProperties/Edit/CustomPropertyField.js +59 -61
  20. package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +20 -20
  21. package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -2
  22. package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
  23. package/es/lib/CustomProperties/Edit/testResources.js +12 -11
  24. package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +33 -22
  25. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +35 -23
  26. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
  27. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
  28. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +6 -3
  29. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +8 -4
  30. package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +17 -14
  31. package/es/lib/CustomProperties/Filter/testResources.js +2 -1
  32. package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +2 -1
  33. package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
  34. package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +26 -18
  35. package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +6 -3
  36. package/es/lib/CustomProperties/View/CustomPropertyCard.js +11 -7
  37. package/es/lib/CycleButton/CycleButton.js +17 -9
  38. package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +46 -30
  39. package/es/lib/EditableRefdataList/EditableRefdataList.js +43 -33
  40. package/es/lib/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +9 -5
  41. package/es/lib/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js +6 -6
  42. package/es/lib/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js +12 -10
  43. package/es/lib/EditableSettingsList/SettingField/SettingField.js +12 -8
  44. package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +3 -3
  45. package/es/lib/FormModal/FormModal.js +32 -24
  46. package/es/lib/FormattedKintMessage/FormattedKintMessage.js +30 -23
  47. package/es/lib/IconSelect/IconSelect.js +32 -22
  48. package/es/lib/NoResultsMessage/NoResultsMessage.js +5 -4
  49. package/es/lib/NumberField/NumberField.js +25 -17
  50. package/es/lib/NumberField/NumberField.test.js +7 -6
  51. package/es/lib/QueryTypedown/QueryTypedown.js +15 -8
  52. package/es/lib/RefdataButtons/RefdataButtons.js +9 -6
  53. package/es/lib/RefdataCategoriesSettings/RefdataCategoriesSettings.js +26 -19
  54. package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +60 -48
  55. package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +6 -5
  56. package/es/lib/RichSelect/RichSelect.js +36 -31
  57. package/es/lib/RichSelect/useSelectedOption.js +2 -1
  58. package/es/lib/SASQLookupComponent/SASQLookupComponent.js +94 -91
  59. package/es/lib/SASQLookupComponent/TableBody/TableBody.js +54 -42
  60. package/es/lib/SASQRoute/SASQRoute.js +29 -25
  61. package/es/lib/SASQViewComponent/SASQViewComponent.js +76 -68
  62. package/es/lib/SearchField/SearchField.js +13 -7
  63. package/es/lib/SearchKeyControl/SearchKeyControl.js +13 -8
  64. package/es/lib/SearchKeyControl/SearchKeyControl.test.js +6 -2
  65. package/es/lib/SettingPage/SettingPagePane/SettingPagePane.js +2 -2
  66. package/es/lib/SettingsFormContainer/SettingsFormContainer.js +35 -30
  67. package/es/lib/Tags/Tags.js +8 -5
  68. package/es/lib/Tags/hooks/useTags.js +1 -1
  69. package/es/lib/Tags/hooks/useTagsEnabled.js +1 -1
  70. package/es/lib/Tags/tagsConfig.js +1 -1
  71. package/es/lib/Typedown/Typedown.js +28 -21
  72. package/es/lib/hooks/__mocks__/index.js +7 -3
  73. package/es/lib/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js +26 -20
  74. package/es/lib/hooks/intlHooks/useKintIntl/useKintIntl.js +34 -24
  75. package/es/lib/hooks/typedownHooks/useTypedown.js +2 -2
  76. package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
  77. package/es/lib/hooks/useActionListRef.js +1 -1
  78. package/es/lib/hooks/useActiveElement.js +1 -1
  79. package/es/lib/hooks/useCustomProperties.js +10 -6
  80. package/es/lib/hooks/useHelperApp.js +16 -13
  81. package/es/lib/hooks/useKiwtFieldArray.js +8 -7
  82. package/es/lib/hooks/useKiwtSASQuery.js +19 -15
  83. package/es/lib/hooks/useLocalPageStore.js +10 -7
  84. package/es/lib/hooks/useModConfigEntries.js +2 -2
  85. package/es/lib/hooks/useMutateCustomProperties/useMutateCustomProperties.js +17 -10
  86. package/es/lib/hooks/useMutateGeneric/useMutateGeneric.js +2 -2
  87. package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
  88. package/es/lib/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js +21 -15
  89. package/es/lib/hooks/useMutateRefdataValue/useMutateRefdataValue.js +23 -16
  90. package/es/lib/hooks/usePrevNextPagination.js +19 -17
  91. package/es/lib/hooks/useQIndex.js +14 -11
  92. package/es/lib/hooks/useRefdata.js +3 -3
  93. package/es/lib/hooks/useTemplates.js +4 -4
  94. package/es/lib/settingsHooks/useAppSettings/useAppSettings.js +11 -7
  95. package/es/lib/settingsHooks/useSettingSection/useSettingSection.js +18 -12
  96. package/es/lib/settingsHooks/useSettings/useSettings.js +60 -60
  97. package/es/lib/utils/buildUrl.js +3 -2
  98. package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +5 -5
  99. package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
  100. package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +5 -4
  101. package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
  102. package/es/lib/utils/generateKiwtQueryParams/generateKiwtQueryParams.js +82 -70
  103. package/es/lib/utils/groupCustomPropertiesByCtx.js +9 -5
  104. package/es/lib/utils/matchString.js +7 -5
  105. package/es/lib/utils/parseErrorResponse.js +4 -3
  106. package/es/lib/utils/selectorSafe.js +3 -2
  107. package/es/lib/utils/sortByLabel.js +3 -2
  108. package/es/lib/validators/validators.js +9 -6
  109. package/package.json +1 -1
  110. package/src/lib/CustomProperties/Edit/CustomPropertiesListField.js +1 -1
  111. package/src/lib/SASQLookupComponent/README.md +1 -0
  112. package/src/lib/SASQLookupComponent/TableBody/README.md +15 -14
  113. package/src/lib/SASQLookupComponent/TableBody/TableBody.js +8 -3
  114. package/styles/TypeDown.css +3 -1
@@ -12,7 +12,15 @@ var _components = require("@folio/stripes/components");
12
12
  var _hooks = require("../../hooks");
13
13
  var _CustomPropertyFormCard = _interopRequireDefault(require("./CustomPropertyFormCard"));
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
+ const _excluded = ["ctx", "customProperties", "intlKey", "intlNS", "labelOverrides"];
15
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
18
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
19
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
22
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
23
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
24
  const CustomPropertiesList = _ref => {
17
25
  let {
18
26
  availableCustomProperties = [],
@@ -47,18 +55,17 @@ const CustomPropertiesList = _ref => {
47
55
  }
48
56
  }, [availableCustomProperties, dirtying, pristine, value]);
49
57
  const handleDeleteCustomProperty = (customProperty, i) => {
50
- const currentValue = value[customProperty.value]?.[0] ?? {};
58
+ var _value$customProperty, _value$customProperty2;
59
+ const currentValue = (_value$customProperty = (_value$customProperty2 = value[customProperty.value]) === null || _value$customProperty2 === void 0 ? void 0 : _value$customProperty2[0]) !== null && _value$customProperty !== void 0 ? _value$customProperty : {};
51
60
  const newCustomProperties = [...customProperties];
52
61
  newCustomProperties.splice(i, 1);
53
62
  setCustomProperties(newCustomProperties);
54
63
  setDirtying(true);
55
- onChange({
56
- ...value,
57
- [customProperty.value]: [{
58
- ...currentValue,
64
+ onChange(_objectSpread(_objectSpread({}, value), {}, {
65
+ [customProperty.value]: [_objectSpread(_objectSpread({}, currentValue), {}, {
59
66
  _delete: true
60
- }]
61
- });
67
+ })]
68
+ }));
62
69
  };
63
70
  const renderCustomProperties = customPropertyType => {
64
71
  // This is necessary to track individually since "index" will span primary/optional for a given set
@@ -82,7 +89,7 @@ const CustomPropertiesList = _ref => {
82
89
  onChange,
83
90
  setCustomProperties,
84
91
  value
85
- }, `customPropertyField-${customProperty.value}-${index}`);
92
+ }, "customPropertyField-".concat(customProperty.value));
86
93
  }).filter(cp => cp !== undefined);
87
94
  };
88
95
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
@@ -132,19 +139,20 @@ const CustomPropertiesList = _ref => {
132
139
  };
133
140
  const CustomPropertiesListField = _ref2 => {
134
141
  let {
135
- ctx,
136
- customProperties,
137
- intlKey: passedIntlKey,
138
- intlNS: passedIntlNS,
139
- labelOverrides = {},
140
- ...fieldProps
141
- } = _ref2;
142
+ ctx,
143
+ customProperties,
144
+ intlKey: passedIntlKey,
145
+ intlNS: passedIntlNS,
146
+ labelOverrides = {}
147
+ } = _ref2,
148
+ fieldProps = _objectWithoutProperties(_ref2, _excluded);
142
149
  const fieldRef = (0, _react.useRef)();
143
150
  const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
144
151
 
145
152
  // Map customProperties to bring together the options and the definition values
146
- const availableCustomProperties = customProperties?.map(customProperty => {
147
- let options = customProperty?.category?.values;
153
+ const availableCustomProperties = customProperties === null || customProperties === void 0 ? void 0 : customProperties.map(customProperty => {
154
+ var _customProperty$categ;
155
+ let options = customProperty === null || customProperty === void 0 || (_customProperty$categ = customProperty.category) === null || _customProperty$categ === void 0 ? void 0 : _customProperty$categ.values;
148
156
  if (options) {
149
157
  // order by label, add notSet option afterwards
150
158
  options = (0, _orderBy.default)(options, 'label');
@@ -183,31 +191,29 @@ const CustomPropertiesListField = _ref2 => {
183
191
  // IMPORTANT -- All customproperty ctx sections are adding to the same "initialValue" field
184
192
  // Ensure that we don't already have initialValues for this particular set before setting them,
185
193
  // to ensure no looping behaviour
186
- if (Object.keys(cps).every(key => initialValues.customProperties?.[key] !== undefined)) {
194
+ if (Object.keys(cps).every(key => {
195
+ var _initialValues$custom;
196
+ return ((_initialValues$custom = initialValues.customProperties) === null || _initialValues$custom === void 0 ? void 0 : _initialValues$custom[key]) !== undefined;
197
+ })) {
187
198
  return initialValues.customProperties;
188
199
  }
189
200
 
190
201
  // Ensure that if we already had these values in initialvalues they're not overwritten
191
- return {
192
- ...cps,
193
- ...initialValues.customProperties
194
- };
202
+ return _objectSpread(_objectSpread({}, cps), initialValues.customProperties);
195
203
  };
196
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
197
- ...fieldProps,
204
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, _objectSpread(_objectSpread({}, fieldProps), {}, {
198
205
  initialValue: getInitialValue(),
199
206
  render: p => {
200
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomPropertiesList, {
207
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomPropertiesList, _objectSpread({
201
208
  ref: fieldRef,
202
209
  availableCustomProperties: availableCustomProperties,
203
210
  ctx: ctx,
204
211
  intlKey: passedIntlKey,
205
212
  intlNS: passedIntlNS,
206
- labelOverrides: labelOverrides,
207
- ...p
208
- });
213
+ labelOverrides: labelOverrides
214
+ }, p));
209
215
  }
210
- });
216
+ }));
211
217
  };
212
218
  CustomPropertiesListField.propTypes = {
213
219
  ctx: _propTypes.default.string,
@@ -14,6 +14,11 @@ var _NumberField = _interopRequireDefault(require("../../NumberField"));
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
15
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
16
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
20
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
21
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
17
22
  const CustomPropertyField = _ref => {
18
23
  let {
19
24
  availableCustomProperties,
@@ -32,11 +37,12 @@ const CustomPropertyField = _ref => {
32
37
  const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
33
38
  // Set up the validator for the customProperty
34
39
  const customPropertyValidator = (fieldValue, allValues) => {
40
+ var _allValues$customProp, _allValues$customProp2;
35
41
  const {
36
42
  note,
37
43
  publicNote,
38
44
  value: currentValue
39
- } = allValues?.customProperties?.[customProperty?.value]?.[0] ?? {};
45
+ } = (_allValues$customProp = allValues === null || allValues === void 0 || (_allValues$customProp2 = allValues.customProperties) === null || _allValues$customProp2 === void 0 || (_allValues$customProp2 = _allValues$customProp2[customProperty === null || customProperty === void 0 ? void 0 : customProperty.value]) === null || _allValues$customProp2 === void 0 ? void 0 : _allValues$customProp2[0]) !== null && _allValues$customProp !== void 0 ? _allValues$customProp : {};
40
46
  if (note && !currentValue || publicNote && !currentValue) {
41
47
  if (customProperty.type === CUSTOM_PROPERTY_TYPES.DECIMAL_CLASS_NAME || customProperty.type === CUSTOM_PROPERTY_TYPES.INTEGER_CLASS_NAME) {
42
48
  return kintIntl.formatKintMessage({
@@ -79,7 +85,9 @@ const CustomPropertyField = _ref => {
79
85
  return availableCustomProperties.find(cp => cp.value === customPropertyValue);
80
86
  };
81
87
  const renderCustomPropertyName = () => {
88
+ var _customPropertyValue$;
82
89
  const unsetCustomProperties = availableCustomProperties.filter(t => {
90
+ var _custPropValue$;
83
91
  // Only optional properties can be set
84
92
  if (t.primary) return false;
85
93
  const custPropValue = value[t.value];
@@ -88,16 +96,16 @@ const CustomPropertyField = _ref => {
88
96
  if (custPropValue === undefined) return true;
89
97
 
90
98
  // The customProperty is set but is marked for deletion. Allow reuse.
91
- if (custPropValue[0]?._delete) return true;
99
+ if ((_custPropValue$ = custPropValue[0]) !== null && _custPropValue$ !== void 0 && _custPropValue$._delete) return true;
92
100
  return false;
93
101
  });
94
102
  const customPropertyValue = value[customProperty.value];
95
- const id = customPropertyValue?.[0]?.id;
103
+ const id = customPropertyValue === null || customPropertyValue === void 0 || (_customPropertyValue$ = customPropertyValue[0]) === null || _customPropertyValue$ === void 0 ? void 0 : _customPropertyValue$.id;
96
104
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Select, {
97
105
  autoFocus: !id,
98
106
  dataOptions: [customProperty, ...unsetCustomProperties] // The selected customProperty, and the available unset customProperties
99
107
  ,
100
- id: `edit-customproperty-${index}-name`,
108
+ id: "edit-customproperty-".concat(index, "-name"),
101
109
  label: kintIntl.formatKintMessage({
102
110
  id: 'customProperties.name',
103
111
  overrideValue: labelOverrides.name
@@ -115,35 +123,33 @@ const CustomPropertyField = _ref => {
115
123
  // We do this by 1) marking the current customProperty for deletion and 2) initing
116
124
  // the new customProperty to an empty object.
117
125
  const currentValue = value[customProperty.value] ? value[customProperty.value][0] : {};
118
- onChange({
119
- ...value,
126
+ onChange(_objectSpread(_objectSpread({}, value), {}, {
120
127
  [customProperty.value]: [{
121
128
  id: currentValue.id,
122
129
  _delete: true
123
130
  }],
124
131
  [newValue]: [{}]
125
- });
132
+ }));
126
133
  },
127
134
  required: true,
128
135
  value: customProperty.value
129
136
  });
130
137
  };
131
138
  const renderCustomPropertyValue = () => {
139
+ var _customProperty$optio;
132
140
  const currentValue = value[customProperty.value] ? value[customProperty.value][0] : {};
133
141
  const min = Number.MIN_SAFE_INTEGER;
134
142
  const max = Number.MAX_SAFE_INTEGER;
135
143
 
136
144
  // Default change handler
137
145
  let handleChange = e => {
138
- onChange({
139
- ...value,
140
- [customProperty.value]: [{
141
- ...currentValue,
146
+ onChange(_objectSpread(_objectSpread({}, value), {}, {
147
+ [customProperty.value]: [_objectSpread(_objectSpread({}, currentValue), {}, {
142
148
  _delete: e.target.value === '',
143
149
  // Delete customProperty if removing the value.
144
150
  value: e.target.value // send down the number for integers and decimal types
145
- }]
146
- });
151
+ })]
152
+ }));
147
153
  };
148
154
  // Figure out which component we're rendering and specify its unique props.
149
155
  let fieldProps;
@@ -153,27 +159,25 @@ const CustomPropertyField = _ref => {
153
159
  component: _components.Select,
154
160
  // don't order dataOptions here, notSet should always be first in list
155
161
  dataOptions: customProperty.options,
156
- format: v => v?.value
162
+ format: v => v === null || v === void 0 ? void 0 : v.value
157
163
  };
158
164
  break;
159
165
  case CUSTOM_PROPERTY_TYPES.MULTI_REFDATA_CLASS_NAME:
160
166
  fieldProps = {
161
167
  component: _components.MultiSelection,
162
168
  // The "not set" value is not relevant for a multi select
163
- dataOptions: (0, _orderBy.default)(customProperty.options?.filter(opt => !!opt?.value), 'label'),
169
+ dataOptions: (0, _orderBy.default)((_customProperty$optio = customProperty.options) === null || _customProperty$optio === void 0 ? void 0 : _customProperty$optio.filter(opt => !!(opt !== null && opt !== void 0 && opt.value)), 'label'),
164
170
  renderToOverlay: true // FIXME Switch to usePortal for stripes v10
165
171
  };
166
172
  // MultiSelection passes the changed array as a value not an event
167
173
  handleChange = refdataArray => {
168
- onChange({
169
- ...value,
170
- [customProperty.value]: [{
171
- ...currentValue,
172
- _delete: refdataArray?.length === 0 ? true : undefined,
174
+ onChange(_objectSpread(_objectSpread({}, value), {}, {
175
+ [customProperty.value]: [_objectSpread(_objectSpread({}, currentValue), {}, {
176
+ _delete: (refdataArray === null || refdataArray === void 0 ? void 0 : refdataArray.length) === 0 ? true : undefined,
173
177
  // Delete customProperty if removing all values.
174
178
  value: refdataArray
175
- }]
176
- });
179
+ })]
180
+ }));
177
181
  };
178
182
  break;
179
183
  case CUSTOM_PROPERTY_TYPES.INTEGER_CLASS_NAME:
@@ -185,15 +189,13 @@ const CustomPropertyField = _ref => {
185
189
  step: 'any'
186
190
  };
187
191
  handleChange = e => {
188
- onChange({
189
- ...value,
190
- [customProperty.value]: [{
191
- ...currentValue,
192
+ onChange(_objectSpread(_objectSpread({}, value), {}, {
193
+ [customProperty.value]: [_objectSpread(_objectSpread({}, currentValue), {}, {
192
194
  _delete: e.target.value === '' ? true : undefined,
193
195
  // Delete customProperty if removing the value.
194
196
  value: e.target.value
195
- }]
196
- });
197
+ })]
198
+ }));
197
199
  };
198
200
  break;
199
201
  case CUSTOM_PROPERTY_TYPES.TEXT_CLASS_NAME:
@@ -216,30 +218,28 @@ const CustomPropertyField = _ref => {
216
218
  };
217
219
  break;
218
220
  }
219
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
221
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, _objectSpread({
220
222
  "data-test-customproperty-value": true,
221
- id: `edit-customproperty-${index}-value`,
223
+ id: "edit-customproperty-".concat(index, "-value"),
222
224
  label: kintIntl.formatKintMessage({
223
225
  id: 'customProperties.value',
224
226
  overrideValue: labelOverrides.value
225
227
  }),
226
- name: `${name}.${customProperty.value}[0].value`,
228
+ name: "".concat(name, ".").concat(customProperty.value, "[0].value"),
227
229
  onChange: handleChange,
228
230
  required: !customProperty.primary,
229
- validate: (fieldValue, allValues) => customPropertyValidator(fieldValue, allValues),
230
- ...fieldProps
231
- });
231
+ validate: (fieldValue, allValues) => customPropertyValidator(fieldValue, allValues)
232
+ }, fieldProps));
232
233
  };
233
234
  const renderCustomPropertyVisibility = () => {
234
- const customPropertyObject = value[customProperty.value]?.[0] ?? {};
235
+ var _value$customProperty, _value$customProperty2, _customPropertyObject;
236
+ const customPropertyObject = (_value$customProperty = (_value$customProperty2 = value[customProperty.value]) === null || _value$customProperty2 === void 0 ? void 0 : _value$customProperty2[0]) !== null && _value$customProperty !== void 0 ? _value$customProperty : {};
235
237
  const handleChange = e => {
236
- onChange({
237
- ...value,
238
- [customProperty.value]: [{
239
- ...customPropertyObject,
238
+ onChange(_objectSpread(_objectSpread({}, value), {}, {
239
+ [customProperty.value]: [_objectSpread(_objectSpread({}, customPropertyObject), {}, {
240
240
  internal: e.target.value
241
- }]
242
- });
241
+ })]
242
+ }));
243
243
  };
244
244
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Select, {
245
245
  "data-test-customproperty-visibility": true,
@@ -256,57 +256,55 @@ const CustomPropertyField = _ref => {
256
256
  overrideValue: labelOverrides.internalFalse
257
257
  })
258
258
  }],
259
- id: `edit-customproperty-${index}-visibility`,
259
+ id: "edit-customproperty-".concat(index, "-visibility"),
260
260
  label: kintIntl.formatKintMessage({
261
261
  id: 'customProperties.visibility',
262
262
  overrideValue: labelOverrides.visibility
263
263
  }),
264
264
  onChange: handleChange,
265
- value: customPropertyObject?.internal ?? customProperty.defaultInternal
265
+ value: (_customPropertyObject = customPropertyObject === null || customPropertyObject === void 0 ? void 0 : customPropertyObject.internal) !== null && _customPropertyObject !== void 0 ? _customPropertyObject : customProperty.defaultInternal
266
266
  });
267
267
  };
268
268
  const renderCustomPropertyNoteInternal = () => {
269
- const customPropertyObject = value[customProperty.value]?.[0] ?? {};
269
+ var _value$customProperty3, _value$customProperty4;
270
+ const customPropertyObject = (_value$customProperty3 = (_value$customProperty4 = value[customProperty.value]) === null || _value$customProperty4 === void 0 ? void 0 : _value$customProperty4[0]) !== null && _value$customProperty3 !== void 0 ? _value$customProperty3 : {};
270
271
  const handleChange = e => {
271
- onChange({
272
- ...value,
273
- [customProperty.value]: [{
274
- ...customPropertyObject,
272
+ onChange(_objectSpread(_objectSpread({}, value), {}, {
273
+ [customProperty.value]: [_objectSpread(_objectSpread({}, customPropertyObject), {}, {
275
274
  note: e.target.value
276
- }]
277
- });
275
+ })]
276
+ }));
278
277
  };
279
278
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextArea, {
280
279
  "data-test-customproperty-note": true,
281
- id: `edit-customproperty-${index}-internal-note`,
280
+ id: "edit-customproperty-".concat(index, "-internal-note"),
282
281
  label: kintIntl.formatKintMessage({
283
282
  id: 'customProperties.internalNote',
284
283
  overrideValue: labelOverrides.internalNote
285
284
  }),
286
285
  onChange: handleChange,
287
- value: customPropertyObject?.note
286
+ value: customPropertyObject === null || customPropertyObject === void 0 ? void 0 : customPropertyObject.note
288
287
  });
289
288
  };
290
289
  const renderCustomPropertyNotePublic = () => {
291
- const customPropertyObject = value[customProperty.value]?.[0] ?? {};
290
+ var _value$customProperty5, _value$customProperty6;
291
+ const customPropertyObject = (_value$customProperty5 = (_value$customProperty6 = value[customProperty.value]) === null || _value$customProperty6 === void 0 ? void 0 : _value$customProperty6[0]) !== null && _value$customProperty5 !== void 0 ? _value$customProperty5 : {};
292
292
  const handleChange = e => {
293
- onChange({
294
- ...value,
295
- [customProperty.value]: [{
296
- ...customPropertyObject,
293
+ onChange(_objectSpread(_objectSpread({}, value), {}, {
294
+ [customProperty.value]: [_objectSpread(_objectSpread({}, customPropertyObject), {}, {
297
295
  publicNote: e.target.value
298
- }]
299
- });
296
+ })]
297
+ }));
300
298
  };
301
299
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextArea, {
302
300
  "data-test-customproperty-public-note": true,
303
- id: `edit-customproperty-${index}-public-note`,
301
+ id: "edit-customproperty-".concat(index, "-public-note"),
304
302
  label: kintIntl.formatKintMessage({
305
303
  id: 'customProperties.publicNote',
306
304
  overrideValue: labelOverrides.publicNote
307
305
  }),
308
306
  onChange: handleChange,
309
- value: customPropertyObject?.publicNote
307
+ value: customPropertyObject === null || customPropertyObject === void 0 ? void 0 : customPropertyObject.publicNote
310
308
  });
311
309
  };
312
310
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
@@ -7,15 +7,20 @@ var _jest = require("../../../../test/jest");
7
7
  var _testResources = require("./testResources");
8
8
  var _jsxRuntime = require("react/jsx-runtime");
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
14
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
15
  const onSubmit = jest.fn();
11
16
  jest.mock('../../hooks');
12
17
  const onChange = () => {};
13
18
  const setCustomProperties = () => {};
14
- const authIdentCustom = _jest.availableCustomProperties?.find(cp => cp.value === 'AuthorIdentification');
15
- const decimalCustProp = _jest.availableCustomProperties?.find(cp => cp.value === 'decimal');
16
- const integerCustProp = _jest.availableCustomProperties?.find(cp => cp.value === 'integer');
17
- const dateCustProp = _jest.availableCustomProperties?.find(cp => cp.value === 'date');
18
- const multiRefdataCustProp = _jest.availableCustomProperties?.find(cp => cp.value === 'MultiRefdata');
19
+ const authIdentCustom = _jest.availableCustomProperties === null || _jest.availableCustomProperties === void 0 ? void 0 : _jest.availableCustomProperties.find(cp => cp.value === 'AuthorIdentification');
20
+ const decimalCustProp = _jest.availableCustomProperties === null || _jest.availableCustomProperties === void 0 ? void 0 : _jest.availableCustomProperties.find(cp => cp.value === 'decimal');
21
+ const integerCustProp = _jest.availableCustomProperties === null || _jest.availableCustomProperties === void 0 ? void 0 : _jest.availableCustomProperties.find(cp => cp.value === 'integer');
22
+ const dateCustProp = _jest.availableCustomProperties === null || _jest.availableCustomProperties === void 0 ? void 0 : _jest.availableCustomProperties.find(cp => cp.value === 'date');
23
+ const multiRefdataCustProp = _jest.availableCustomProperties === null || _jest.availableCustomProperties === void 0 ? void 0 : _jest.availableCustomProperties.find(cp => cp.value === 'MultiRefdata');
19
24
  const defaultProps = {
20
25
  availableCustomProperties: _jest.availableCustomProperties,
21
26
  customProperties: _jest.customProperties,
@@ -33,11 +38,10 @@ describe('CustomPropertyField', () => {
33
38
  renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
34
39
  initialValues: _testResources.initialValues,
35
40
  onSubmit: onSubmit,
36
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, {
37
- ...defaultProps,
41
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, _objectSpread(_objectSpread({}, defaultProps), {}, {
38
42
  customProperty: authIdentCustom,
39
43
  index: 0
40
- })
44
+ }))
41
45
  }));
42
46
  const {
43
47
  getByTestId
@@ -85,11 +89,10 @@ describe('CustomPropertyField', () => {
85
89
  renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
86
90
  initialValues: _testResources.initialValues,
87
91
  onSubmit: onSubmit,
88
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, {
89
- ...defaultProps,
92
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, _objectSpread(_objectSpread({}, defaultProps), {}, {
90
93
  customProperty: decimalCustProp,
91
94
  index: 2
92
- })
95
+ }))
93
96
  }));
94
97
  });
95
98
  test('Displays expected Decimal field', async () => {
@@ -103,11 +106,10 @@ describe('CustomPropertyField', () => {
103
106
  renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
104
107
  initialValues: _testResources.initialValues,
105
108
  onSubmit: onSubmit,
106
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, {
107
- ...defaultProps,
109
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, _objectSpread(_objectSpread({}, defaultProps), {}, {
108
110
  customProperty: integerCustProp,
109
111
  index: 3
110
- })
112
+ }))
111
113
  }));
112
114
  });
113
115
  test('Displays expected integer Field', async () => {
@@ -123,11 +125,10 @@ describe('CustomPropertyField', () => {
123
125
  renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
124
126
  initialValues: _testResources.initialValues,
125
127
  onSubmit: onSubmit,
126
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, {
127
- ...defaultProps,
128
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, _objectSpread(_objectSpread({}, defaultProps), {}, {
128
129
  customProperty: multiRefdataCustProp,
129
130
  index: 4
130
- })
131
+ }))
131
132
  }));
132
133
  });
133
134
  test('Displays expected multi-select Refdata Field', async () => {
@@ -150,11 +151,10 @@ describe('CustomPropertyField', () => {
150
151
  renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
151
152
  initialValues: _testResources.initialValues,
152
153
  onSubmit: onSubmit,
153
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, {
154
- ...defaultProps,
154
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, _objectSpread(_objectSpread({}, defaultProps), {}, {
155
155
  customProperty: dateCustProp,
156
156
  index: 5
157
- })
157
+ }))
158
158
  }));
159
159
  });
160
160
  test('renders values DatePicker', async () => {
@@ -57,7 +57,7 @@ const CustomPropertyFormCard = _ref => {
57
57
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Card, {
58
58
  "data-testid": "custom-property-form-card",
59
59
  headerEnd: customPropertyType === 'optional' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
60
- id: `customProperty-${customProperty.value}-${index}`,
60
+ id: "customProperty-".concat(customProperty.value, "-").concat(index),
61
61
  text: getTooltipText(),
62
62
  children: _ref2 => {
63
63
  let {
@@ -68,7 +68,7 @@ const CustomPropertyFormCard = _ref => {
68
68
  ref: ref,
69
69
  "aria-labelledby": ariaIds.text,
70
70
  icon: "trash",
71
- id: `edit-customproperty-${index}-delete`,
71
+ id: "edit-customproperty-".concat(index, "-delete"),
72
72
  onClick: () => handleDeleteCustomProperty(customProperty, index)
73
73
  });
74
74
  }
@@ -11,7 +11,7 @@ jest.mock('../../hooks');
11
11
  jest.mock('./CustomPropertyField', () => () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
12
12
  children: "CustomPropertyField"
13
13
  }));
14
- const customProperty = _customProperties.availableCustomProperties?.find(cp => cp.value === 'AuthorIdentification');
14
+ const customProperty = _customProperties.availableCustomProperties === null || _customProperties.availableCustomProperties === void 0 ? void 0 : _customProperties.availableCustomProperties.find(cp => cp.value === 'AuthorIdentification');
15
15
  const onChange = jest.fn();
16
16
  const setCustomProperties = jest.fn();
17
17
  describe('CustomPropertyFormCard', () => {
@@ -5,22 +5,23 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.value = exports.initialValues = void 0;
7
7
  var _jest = require("../../../../test/jest");
8
- const agreementStatusRefdata = _jest.refdata?.find(rdc => rdc.desc === 'SubscriptionAgreement.AgreementStatus');
9
- const licenseAmendmentStatusRefdata = _jest.refdata?.find(rdc => rdc.desc === 'LicenseAmendmentStatus.Status');
8
+ var _agreementStatusRefda, _agreementStatusRefda2, _licenseAmendmentStat;
9
+ const agreementStatusRefdata = _jest.refdata === null || _jest.refdata === void 0 ? void 0 : _jest.refdata.find(rdc => rdc.desc === 'SubscriptionAgreement.AgreementStatus');
10
+ const licenseAmendmentStatusRefdata = _jest.refdata === null || _jest.refdata === void 0 ? void 0 : _jest.refdata.find(rdc => rdc.desc === 'LicenseAmendmentStatus.Status');
10
11
  const value = exports.value = {
11
12
  AuthorIdentification: [{
12
13
  id: 2,
13
14
  internal: true,
14
15
  publicNote: 'this is a public note',
15
16
  note: 'this is an internal note',
16
- value: agreementStatusRefdata?.values?.find(rdv => rdv.value === 'active'),
17
- type: _jest.customProperties?.find(cp => cp.name === 'AuthorIdentification')
17
+ value: agreementStatusRefdata === null || agreementStatusRefdata === void 0 || (_agreementStatusRefda = agreementStatusRefdata.values) === null || _agreementStatusRefda === void 0 ? void 0 : _agreementStatusRefda.find(rdv => rdv.value === 'active'),
18
+ type: _jest.customProperties === null || _jest.customProperties === void 0 ? void 0 : _jest.customProperties.find(cp => cp.name === 'AuthorIdentification')
18
19
  }],
19
20
  Test: [{
20
21
  id: 4,
21
22
  internal: true,
22
- value: agreementStatusRefdata?.values?.find(rdv => rdv.value === 'active'),
23
- type: _jest.customProperties?.find(cp => cp.name === 'Test')
23
+ value: agreementStatusRefdata === null || agreementStatusRefdata === void 0 || (_agreementStatusRefda2 = agreementStatusRefdata.values) === null || _agreementStatusRefda2 === void 0 ? void 0 : _agreementStatusRefda2.find(rdv => rdv.value === 'active'),
24
+ type: _jest.customProperties === null || _jest.customProperties === void 0 ? void 0 : _jest.customProperties.find(cp => cp.name === 'Test')
24
25
  }],
25
26
  decimal: [{
26
27
  id: 8,
@@ -28,7 +29,7 @@ const value = exports.value = {
28
29
  note: 'decimal',
29
30
  internal: true,
30
31
  value: 1,
31
- type: _jest.customProperties?.find(cp => cp.name === 'decimal')
32
+ type: _jest.customProperties === null || _jest.customProperties === void 0 ? void 0 : _jest.customProperties.find(cp => cp.name === 'decimal')
32
33
  }],
33
34
  integer: [{
34
35
  id: 6,
@@ -36,7 +37,7 @@ const value = exports.value = {
36
37
  note: 'Integer',
37
38
  internal: true,
38
39
  value: 1,
39
- type: _jest.customProperties?.find(cp => cp.name === 'integer')
40
+ type: _jest.customProperties === null || _jest.customProperties === void 0 ? void 0 : _jest.customProperties.find(cp => cp.name === 'integer')
40
41
  }],
41
42
  text: [{
42
43
  id: 7,
@@ -44,15 +45,15 @@ const value = exports.value = {
44
45
  note: 'text',
45
46
  internal: true,
46
47
  value: 'text',
47
- type: _jest.customProperties?.find(cp => cp.name === 'text')
48
+ type: _jest.customProperties === null || _jest.customProperties === void 0 ? void 0 : _jest.customProperties.find(cp => cp.name === 'text')
48
49
  }],
49
50
  Refdata: [{
50
51
  id: 5,
51
52
  publicNote: 'refdata',
52
53
  note: 'refdata',
53
54
  internal: true,
54
- value: licenseAmendmentStatusRefdata?.values?.find(rdv => rdv.value === 'current'),
55
- type: _jest.customProperties?.find(cp => cp.name === 'Refdata')
55
+ value: licenseAmendmentStatusRefdata === null || licenseAmendmentStatusRefdata === void 0 || (_licenseAmendmentStat = licenseAmendmentStatusRefdata.values) === null || _licenseAmendmentStat === void 0 ? void 0 : _licenseAmendmentStat.find(rdv => rdv.value === 'current'),
56
+ type: _jest.customProperties === null || _jest.customProperties === void 0 ? void 0 : _jest.customProperties.find(cp => cp.name === 'Refdata')
56
57
  }]
57
58
  };
58
59
  const initialValues = exports.initialValues = {