@k-int/stripes-kint-components 5.1.1 → 5.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/es/lib/ActionList/ActionListFieldArray.js +29 -32
- package/es/lib/ComboButton/ComboButton.js +5 -6
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +4 -7
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +29 -32
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +2 -2
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +32 -33
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +3 -3
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +5 -10
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +20 -26
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +5 -5
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -2
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
- package/es/lib/CustomProperties/Edit/testResources.js +11 -12
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +6 -11
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +20 -28
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +8 -8
- package/es/lib/CustomProperties/Filter/testResources.js +1 -2
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +1 -2
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +18 -26
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +7 -11
- package/es/lib/CycleButton/CycleButton.js +1 -1
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +21 -32
- package/es/lib/EditableRefdataList/EditableRefdataList.js +26 -33
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +1 -1
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +5 -5
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +10 -12
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +4 -4
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +4 -7
- package/es/lib/IconSelect/IconSelect.js +5 -9
- package/es/lib/NoResultsMessage/NoResultsMessage.js +4 -4
- package/es/lib/RefdataButtons/RefdataButtons.js +3 -3
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +21 -28
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +5 -6
- package/es/lib/RichSelect/RichSelect.js +14 -19
- package/es/lib/RichSelect/useSelectedOption.js +1 -2
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +14 -17
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +4 -6
- package/es/lib/SASQRoute/SASQRoute.js +2 -2
- package/es/lib/SASQViewComponent/SASQViewComponent.js +5 -9
- package/es/lib/SettingPage/SettingPagePane.js +2 -2
- package/es/lib/SettingsFormContainer/SettingsFormContainer.js +2 -2
- package/es/lib/Typedown/Typedown.js +19 -26
- package/es/lib/hooks/typedownHooks/useTypedown.js +2 -2
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
- package/es/lib/hooks/useActiveElement.js +1 -1
- package/es/lib/hooks/useCustomProperties.js +2 -2
- package/es/lib/hooks/useHelperApp.js +6 -6
- package/es/lib/hooks/useIntlKeyStore.js +4 -7
- package/es/lib/hooks/useKintIntl.js +5 -11
- package/es/lib/hooks/useKiwtSASQuery.js +1 -1
- package/es/lib/hooks/useModConfigEntries.js +2 -2
- package/es/lib/hooks/useMutateCustomProperties.js +8 -8
- package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
- package/es/lib/hooks/useMutateRefdataCategory.js +4 -4
- package/es/lib/hooks/useMutateRefdataValue.js +6 -6
- package/es/lib/hooks/useQIndex.js +5 -5
- package/es/lib/hooks/useRefdata.js +3 -3
- package/es/lib/hooks/useTemplates.js +4 -4
- package/es/lib/settingsHooks/useAppSettings.js +7 -11
- package/es/lib/settingsHooks/useSettingSection.js +2 -2
- package/es/lib/settingsHooks/useSettings.js +3 -3
- package/es/lib/utils/buildUrl.js +2 -3
- package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +6 -6
- package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
- package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +4 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
- package/es/lib/utils/generateKiwtQueryParams.js +28 -37
- package/es/lib/utils/groupCustomPropertiesByCtx.js +2 -3
- package/es/lib/utils/matchString.js +1 -1
- package/es/lib/utils/parseErrorResponse.js +2 -3
- package/es/lib/utils/selectorSafe.js +2 -3
- package/es/lib/utils/sortByLabel.js +2 -3
- package/es/lib/validators/validators.js +3 -3
- package/package.json +1 -1
- package/src/lib/CustomProperties/Edit/CustomPropertyField.js +4 -2
|
@@ -29,9 +29,9 @@ const CustomPropertyForm = _ref => {
|
|
|
29
29
|
change
|
|
30
30
|
} = (0, _reactFinalForm.useForm)();
|
|
31
31
|
const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
32
|
-
const booleanToString = booleanValue => booleanValue
|
|
32
|
+
const booleanToString = booleanValue => booleanValue?.toString();
|
|
33
33
|
const stringToBoolean = stringValue => stringValue === 'true';
|
|
34
|
-
const [contextOptions, setContextOptions] = (0, _react.useState)(contextFilterOptions
|
|
34
|
+
const [contextOptions, setContextOptions] = (0, _react.useState)(contextFilterOptions?.filter(ctx => ctx.value !== '' && ctx?.value !== 'isNull'));
|
|
35
35
|
const addCtx = _ref2 => {
|
|
36
36
|
let {
|
|
37
37
|
_r,
|
|
@@ -55,7 +55,7 @@ const CustomPropertyForm = _ref => {
|
|
|
55
55
|
} else {
|
|
56
56
|
return kintIntl.formatKintMessage({
|
|
57
57
|
id: 'customProperties.ctx.addContext',
|
|
58
|
-
overrideValue: labelOverrides
|
|
58
|
+
overrideValue: labelOverrides?.addCtx
|
|
59
59
|
}, {
|
|
60
60
|
value: filterValue
|
|
61
61
|
});
|
|
@@ -65,7 +65,7 @@ const CustomPropertyForm = _ref => {
|
|
|
65
65
|
if (allValues.primary && allValues.retired) {
|
|
66
66
|
return kintIntl.formatKintMessage({
|
|
67
67
|
id: 'customProperties.errors.primaryRetired',
|
|
68
|
-
overrideValue: labelOverrides
|
|
68
|
+
overrideValue: labelOverrides?.primaryRetired
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
return null;
|
|
@@ -81,48 +81,48 @@ const CustomPropertyForm = _ref => {
|
|
|
81
81
|
value: ''
|
|
82
82
|
}, {
|
|
83
83
|
label: kintIntl.formatKintMessage({
|
|
84
|
-
id:
|
|
85
|
-
overrideValue: labelOverrides
|
|
84
|
+
id: `customProperties.type.${_customProperties.DECIMAL_CLASS_NAME}`,
|
|
85
|
+
overrideValue: labelOverrides?.[_customProperties.DECIMAL_CLASS_NAME]
|
|
86
86
|
}),
|
|
87
87
|
value: _customProperties.DECIMAL_CLASS_NAME
|
|
88
88
|
}, {
|
|
89
89
|
label: kintIntl.formatKintMessage({
|
|
90
|
-
id:
|
|
91
|
-
overrideValue: labelOverrides
|
|
90
|
+
id: `customProperties.type.${_customProperties.INTEGER_CLASS_NAME}`,
|
|
91
|
+
overrideValue: labelOverrides?.[_customProperties.INTEGER_CLASS_NAME]
|
|
92
92
|
}),
|
|
93
93
|
value: _customProperties.INTEGER_CLASS_NAME
|
|
94
94
|
}, {
|
|
95
95
|
label: kintIntl.formatKintMessage({
|
|
96
|
-
id:
|
|
97
|
-
overrideValue: labelOverrides
|
|
96
|
+
id: `customProperties.type.${_customProperties.TEXT_CLASS_NAME}`,
|
|
97
|
+
overrideValue: labelOverrides?.[_customProperties.TEXT_CLASS_NAME]
|
|
98
98
|
}),
|
|
99
99
|
value: _customProperties.TEXT_CLASS_NAME
|
|
100
100
|
}, {
|
|
101
101
|
label: kintIntl.formatKintMessage({
|
|
102
|
-
id:
|
|
103
|
-
overrideValue: labelOverrides
|
|
102
|
+
id: `customProperties.type.${_customProperties.REFDATA_CLASS_NAME}`,
|
|
103
|
+
overrideValue: labelOverrides?.[_customProperties.REFDATA_CLASS_NAME]
|
|
104
104
|
}),
|
|
105
105
|
value: _customProperties.REFDATA_CLASS_NAME
|
|
106
106
|
}, {
|
|
107
107
|
label: kintIntl.formatKintMessage({
|
|
108
|
-
id:
|
|
109
|
-
overrideValue: labelOverrides
|
|
108
|
+
id: `customProperties.type.${_customProperties.MULTI_REFDATA_CLASS_NAME}`,
|
|
109
|
+
overrideValue: labelOverrides?.[_customProperties.MULTI_REFDATA_CLASS_NAME]
|
|
110
110
|
}),
|
|
111
111
|
value: _customProperties.MULTI_REFDATA_CLASS_NAME
|
|
112
112
|
}, {
|
|
113
113
|
label: kintIntl.formatKintMessage({
|
|
114
|
-
id:
|
|
115
|
-
overrideValue: labelOverrides
|
|
114
|
+
id: `customProperties.type.${_customProperties.DATE_CLASS_NAME}`,
|
|
115
|
+
overrideValue: labelOverrides?.[_customProperties.DATE_CLASS_NAME]
|
|
116
116
|
}),
|
|
117
117
|
value: _customProperties.DATE_CLASS_NAME
|
|
118
118
|
}],
|
|
119
|
-
disabled: !!
|
|
119
|
+
disabled: !!values?.id,
|
|
120
120
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
121
121
|
children: [kintIntl.formatKintMessage({
|
|
122
122
|
id: 'customProperties.type',
|
|
123
|
-
overrideValue: labelOverrides
|
|
124
|
-
}), helpPopovers
|
|
125
|
-
content: helpPopovers
|
|
123
|
+
overrideValue: labelOverrides?.type
|
|
124
|
+
}), helpPopovers?.type ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
125
|
+
content: helpPopovers?.type
|
|
126
126
|
}) : null]
|
|
127
127
|
}),
|
|
128
128
|
name: "type",
|
|
@@ -131,19 +131,19 @@ const CustomPropertyForm = _ref => {
|
|
|
131
131
|
})
|
|
132
132
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
133
133
|
xs: 6,
|
|
134
|
-
children: (
|
|
134
|
+
children: (values?.type === _customProperties.REFDATA_CLASS_NAME || values?.type === _customProperties.MULTI_REFDATA_CLASS_NAME) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
135
135
|
component: _components.Select,
|
|
136
136
|
dataOptions: [{
|
|
137
137
|
label: '',
|
|
138
138
|
value: ''
|
|
139
139
|
}, ...refdata],
|
|
140
|
-
disabled: !!
|
|
140
|
+
disabled: !!values?.id,
|
|
141
141
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
142
142
|
children: [kintIntl.formatKintMessage({
|
|
143
143
|
id: 'customProperties.category',
|
|
144
|
-
overrideValue: labelOverrides
|
|
145
|
-
}), helpPopovers
|
|
146
|
-
content: helpPopovers
|
|
144
|
+
overrideValue: labelOverrides?.category
|
|
145
|
+
}), helpPopovers?.category ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
146
|
+
content: helpPopovers?.category
|
|
147
147
|
}) : null]
|
|
148
148
|
}),
|
|
149
149
|
name: "category",
|
|
@@ -160,9 +160,9 @@ const CustomPropertyForm = _ref => {
|
|
|
160
160
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
161
161
|
children: [kintIntl.formatKintMessage({
|
|
162
162
|
id: 'customProperties.label',
|
|
163
|
-
overrideValue: labelOverrides
|
|
164
|
-
}), helpPopovers
|
|
165
|
-
content: helpPopovers
|
|
163
|
+
overrideValue: labelOverrides?.label
|
|
164
|
+
}), helpPopovers?.label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
165
|
+
content: helpPopovers?.label
|
|
166
166
|
}) : null]
|
|
167
167
|
}),
|
|
168
168
|
name: "label",
|
|
@@ -177,9 +177,9 @@ const CustomPropertyForm = _ref => {
|
|
|
177
177
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
178
178
|
children: [kintIntl.formatKintMessage({
|
|
179
179
|
id: 'customProperties.name',
|
|
180
|
-
overrideValue: labelOverrides
|
|
181
|
-
}), helpPopovers
|
|
182
|
-
content: helpPopovers
|
|
180
|
+
overrideValue: labelOverrides?.name
|
|
181
|
+
}), helpPopovers?.name ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
182
|
+
content: helpPopovers?.name
|
|
183
183
|
}) : null]
|
|
184
184
|
}),
|
|
185
185
|
name: "name",
|
|
@@ -188,7 +188,7 @@ const CustomPropertyForm = _ref => {
|
|
|
188
188
|
if (v && v.length) {
|
|
189
189
|
return /^[a-z][a-z0-9]*$/i.test(v) ? undefined : kintIntl.formatKintMessage({
|
|
190
190
|
id: 'errors.hasNonAlphaName',
|
|
191
|
-
overrideValue: labelOverrides
|
|
191
|
+
overrideValue: labelOverrides?.hasNonAlphaName
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
return (0, _validators.required)(v);
|
|
@@ -204,9 +204,9 @@ const CustomPropertyForm = _ref => {
|
|
|
204
204
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
205
205
|
children: [kintIntl.formatKintMessage({
|
|
206
206
|
id: 'customProperties.description',
|
|
207
|
-
overrideValue: labelOverrides
|
|
208
|
-
}), helpPopovers
|
|
209
|
-
content: helpPopovers
|
|
207
|
+
overrideValue: labelOverrides?.description
|
|
208
|
+
}), helpPopovers?.description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
209
|
+
content: helpPopovers?.description
|
|
210
210
|
}) : null]
|
|
211
211
|
}),
|
|
212
212
|
name: "description",
|
|
@@ -226,20 +226,20 @@ const CustomPropertyForm = _ref => {
|
|
|
226
226
|
dataOptions: contextOptions,
|
|
227
227
|
emptyMessage: kintIntl.formatKintMessage({
|
|
228
228
|
id: 'customProperties.noCtxFound',
|
|
229
|
-
overrideValue: labelOverrides
|
|
229
|
+
overrideValue: labelOverrides?.noCtxFound
|
|
230
230
|
}),
|
|
231
231
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
232
232
|
children: [kintIntl.formatKintMessage({
|
|
233
233
|
id: 'customProperties.ctx',
|
|
234
|
-
overrideValue: labelOverrides
|
|
235
|
-
}), helpPopovers
|
|
236
|
-
content: helpPopovers
|
|
234
|
+
overrideValue: labelOverrides?.ctx
|
|
235
|
+
}), helpPopovers?.ctx ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
236
|
+
content: helpPopovers?.ctx
|
|
237
237
|
}) : null]
|
|
238
238
|
}),
|
|
239
239
|
name: "ctx",
|
|
240
240
|
onChange: selectedItems => {
|
|
241
241
|
if (selectedItems.length) {
|
|
242
|
-
change('ctx', [selectedItems
|
|
242
|
+
change('ctx', [selectedItems?.[selectedItems?.length - 1]]);
|
|
243
243
|
} else {
|
|
244
244
|
change('ctx', undefined);
|
|
245
245
|
}
|
|
@@ -255,9 +255,9 @@ const CustomPropertyForm = _ref => {
|
|
|
255
255
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
256
256
|
children: [kintIntl.formatKintMessage({
|
|
257
257
|
id: 'customProperties.weight',
|
|
258
|
-
overrideValue: labelOverrides
|
|
259
|
-
}), helpPopovers
|
|
260
|
-
content: helpPopovers
|
|
258
|
+
overrideValue: labelOverrides?.weight
|
|
259
|
+
}), helpPopovers?.weight ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
260
|
+
content: helpPopovers?.weight
|
|
261
261
|
}) : null]
|
|
262
262
|
}),
|
|
263
263
|
name: "weight",
|
|
@@ -272,13 +272,13 @@ const CustomPropertyForm = _ref => {
|
|
|
272
272
|
dataOptions: [{
|
|
273
273
|
label: kintIntl.formatKintMessage({
|
|
274
274
|
id: 'yes',
|
|
275
|
-
overrideValue: labelOverrides
|
|
275
|
+
overrideValue: labelOverrides?.yes
|
|
276
276
|
}),
|
|
277
277
|
value: 'true'
|
|
278
278
|
}, {
|
|
279
279
|
label: kintIntl.formatKintMessage({
|
|
280
280
|
id: 'no',
|
|
281
|
-
overrideValue: labelOverrides
|
|
281
|
+
overrideValue: labelOverrides?.no
|
|
282
282
|
}),
|
|
283
283
|
value: 'false'
|
|
284
284
|
}],
|
|
@@ -286,9 +286,9 @@ const CustomPropertyForm = _ref => {
|
|
|
286
286
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
287
287
|
children: [kintIntl.formatKintMessage({
|
|
288
288
|
id: 'customProperties.primary',
|
|
289
|
-
overrideValue: labelOverrides
|
|
290
|
-
}), helpPopovers
|
|
291
|
-
content: helpPopovers
|
|
289
|
+
overrideValue: labelOverrides?.primary
|
|
290
|
+
}), helpPopovers?.primary ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
291
|
+
content: helpPopovers?.primary
|
|
292
292
|
}) : null]
|
|
293
293
|
}),
|
|
294
294
|
name: "primary",
|
|
@@ -303,13 +303,13 @@ const CustomPropertyForm = _ref => {
|
|
|
303
303
|
dataOptions: [{
|
|
304
304
|
label: kintIntl.formatKintMessage({
|
|
305
305
|
id: 'yes',
|
|
306
|
-
overrideValue: labelOverrides
|
|
306
|
+
overrideValue: labelOverrides?.yes
|
|
307
307
|
}),
|
|
308
308
|
value: 'true'
|
|
309
309
|
}, {
|
|
310
310
|
label: kintIntl.formatKintMessage({
|
|
311
311
|
id: 'no',
|
|
312
|
-
overrideValue: labelOverrides
|
|
312
|
+
overrideValue: labelOverrides?.no
|
|
313
313
|
}),
|
|
314
314
|
value: 'false'
|
|
315
315
|
}],
|
|
@@ -317,9 +317,9 @@ const CustomPropertyForm = _ref => {
|
|
|
317
317
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
318
318
|
children: [kintIntl.formatKintMessage({
|
|
319
319
|
id: 'customProperties.retired',
|
|
320
|
-
overrideValue: labelOverrides
|
|
321
|
-
}), helpPopovers
|
|
322
|
-
content: helpPopovers
|
|
320
|
+
overrideValue: labelOverrides?.retired
|
|
321
|
+
}), helpPopovers?.retired ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
322
|
+
content: helpPopovers?.retired
|
|
323
323
|
}) : null]
|
|
324
324
|
}),
|
|
325
325
|
name: "retired",
|
|
@@ -334,13 +334,13 @@ const CustomPropertyForm = _ref => {
|
|
|
334
334
|
dataOptions: [{
|
|
335
335
|
label: kintIntl.formatKintMessage({
|
|
336
336
|
id: 'customProperties.internalTrue',
|
|
337
|
-
overrideValue: labelOverrides
|
|
337
|
+
overrideValue: labelOverrides?.internalTrue
|
|
338
338
|
}),
|
|
339
339
|
value: 'true'
|
|
340
340
|
}, {
|
|
341
341
|
label: kintIntl.formatKintMessage({
|
|
342
342
|
id: 'customProperties.internalFalse',
|
|
343
|
-
overrideValue: labelOverrides
|
|
343
|
+
overrideValue: labelOverrides?.internalFalse
|
|
344
344
|
}),
|
|
345
345
|
value: 'false'
|
|
346
346
|
}],
|
|
@@ -348,9 +348,9 @@ const CustomPropertyForm = _ref => {
|
|
|
348
348
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
349
349
|
children: [kintIntl.formatKintMessage({
|
|
350
350
|
id: 'customProperties.defaultVisibility',
|
|
351
|
-
overrideValue: labelOverrides
|
|
352
|
-
}), helpPopovers
|
|
353
|
-
content: helpPopovers
|
|
351
|
+
overrideValue: labelOverrides?.defaultVisibility
|
|
352
|
+
}), helpPopovers?.defaultVisibility ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
353
|
+
content: helpPopovers?.defaultVisibility
|
|
354
354
|
}) : null]
|
|
355
355
|
}),
|
|
356
356
|
name: "defaultInternal",
|
|
@@ -9,7 +9,7 @@ var _jest = require("../../../../test/jest");
|
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const initialValues = {
|
|
12
|
-
...
|
|
12
|
+
..._customProperties.default?.find(cp => cp.name === 'test'),
|
|
13
13
|
// Just massage the type/ctx value to be of the shape the form expects
|
|
14
14
|
type: 'Decimal',
|
|
15
15
|
ctx: [{
|
|
@@ -140,7 +140,7 @@ describe('CustomPropertyForm', () => {
|
|
|
140
140
|
name: 'Primary'
|
|
141
141
|
})).toHaveDisplayValue('Yes');
|
|
142
142
|
});
|
|
143
|
-
['Decimal', 'Refdata (multi-select)', 'Refdata', 'Text', 'Integer'].forEach(type => it(
|
|
143
|
+
['Decimal', 'Refdata (multi-select)', 'Refdata', 'Text', 'Integer'].forEach(type => it(`Displays expected ${type} option`, () => {
|
|
144
144
|
const {
|
|
145
145
|
getByText
|
|
146
146
|
} = renderComponent;
|
|
@@ -12,7 +12,6 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
// A default option for CustProp view pane, with the ability to override labels for fields
|
|
14
14
|
const CustomPropertyView = _ref => {
|
|
15
|
-
var _customProperty$ctx, _customProperty$categ, _customProperty$categ2;
|
|
16
15
|
let {
|
|
17
16
|
customProperty,
|
|
18
17
|
helpPopovers,
|
|
@@ -29,12 +28,12 @@ const CustomPropertyView = _ref => {
|
|
|
29
28
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
30
29
|
children: [kintIntl.formatKintMessage({
|
|
31
30
|
id: 'customProperties.label',
|
|
32
|
-
overrideValue: labelOverrides
|
|
33
|
-
}), helpPopovers
|
|
34
|
-
content: helpPopovers
|
|
31
|
+
overrideValue: labelOverrides?.label
|
|
32
|
+
}), helpPopovers?.label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
33
|
+
content: helpPopovers?.label
|
|
35
34
|
}) : null]
|
|
36
35
|
}),
|
|
37
|
-
value: customProperty
|
|
36
|
+
value: customProperty?.label
|
|
38
37
|
})
|
|
39
38
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
40
39
|
xs: 6,
|
|
@@ -42,12 +41,12 @@ const CustomPropertyView = _ref => {
|
|
|
42
41
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
43
42
|
children: [kintIntl.formatKintMessage({
|
|
44
43
|
id: 'customProperties.name',
|
|
45
|
-
overrideValue: labelOverrides
|
|
46
|
-
}), helpPopovers
|
|
47
|
-
content: helpPopovers
|
|
44
|
+
overrideValue: labelOverrides?.name
|
|
45
|
+
}), helpPopovers?.name ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
46
|
+
content: helpPopovers?.name
|
|
48
47
|
}) : null]
|
|
49
48
|
}),
|
|
50
|
-
value: customProperty
|
|
49
|
+
value: customProperty?.name
|
|
51
50
|
})
|
|
52
51
|
})]
|
|
53
52
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Row, {
|
|
@@ -56,9 +55,9 @@ const CustomPropertyView = _ref => {
|
|
|
56
55
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
57
56
|
label: kintIntl.formatKintMessage({
|
|
58
57
|
id: 'customProperties.description',
|
|
59
|
-
overrideValue: labelOverrides
|
|
58
|
+
overrideValue: labelOverrides?.description
|
|
60
59
|
}),
|
|
61
|
-
value: customProperty
|
|
60
|
+
value: customProperty?.description
|
|
62
61
|
})
|
|
63
62
|
})
|
|
64
63
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Row, {
|
|
@@ -67,11 +66,11 @@ const CustomPropertyView = _ref => {
|
|
|
67
66
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
68
67
|
label: kintIntl.formatKintMessage({
|
|
69
68
|
id: 'customProperties.primary',
|
|
70
|
-
overrideValue: labelOverrides
|
|
69
|
+
overrideValue: labelOverrides?.primary
|
|
71
70
|
}),
|
|
72
71
|
value: kintIntl.formatKintMessage({
|
|
73
|
-
id: customProperty
|
|
74
|
-
overrideValue: customProperty
|
|
72
|
+
id: customProperty?.primary ? 'yes' : 'no',
|
|
73
|
+
overrideValue: customProperty?.primary ? labelOverrides.yes : labelOverrides.no
|
|
75
74
|
})
|
|
76
75
|
})
|
|
77
76
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
@@ -79,11 +78,11 @@ const CustomPropertyView = _ref => {
|
|
|
79
78
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
80
79
|
label: kintIntl.formatKintMessage({
|
|
81
80
|
id: 'customProperties.retired',
|
|
82
|
-
overrideValue: labelOverrides
|
|
81
|
+
overrideValue: labelOverrides?.retired
|
|
83
82
|
}),
|
|
84
83
|
value: kintIntl.formatKintMessage({
|
|
85
|
-
id: customProperty
|
|
86
|
-
overrideValue: customProperty
|
|
84
|
+
id: customProperty?.retired ? 'yes' : 'no',
|
|
85
|
+
overrideValue: customProperty?.retired ? labelOverrides.yes : labelOverrides.no
|
|
87
86
|
})
|
|
88
87
|
})
|
|
89
88
|
})]
|
|
@@ -93,20 +92,20 @@ const CustomPropertyView = _ref => {
|
|
|
93
92
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
94
93
|
label: kintIntl.formatKintMessage({
|
|
95
94
|
id: 'customProperties.weight',
|
|
96
|
-
overrideValue: labelOverrides
|
|
95
|
+
overrideValue: labelOverrides?.weight
|
|
97
96
|
}),
|
|
98
|
-
value: customProperty
|
|
97
|
+
value: customProperty?.weight
|
|
99
98
|
})
|
|
100
99
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
101
100
|
xs: 6,
|
|
102
101
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
103
102
|
label: kintIntl.formatKintMessage({
|
|
104
103
|
id: 'customProperties.defaultVisibility',
|
|
105
|
-
overrideValue: labelOverrides
|
|
104
|
+
overrideValue: labelOverrides?.defaultVisibility
|
|
106
105
|
}),
|
|
107
106
|
value: kintIntl.formatKintMessage({
|
|
108
|
-
id: customProperty
|
|
109
|
-
overrideValue: customProperty
|
|
107
|
+
id: customProperty?.defaultInternal ? 'customProperties.internalTrue' : 'customProperties.internalFalse',
|
|
108
|
+
overrideValue: customProperty?.defaultInternal ? labelOverrides.internalTrue : labelOverrides.internalFalse
|
|
110
109
|
})
|
|
111
110
|
})
|
|
112
111
|
})]
|
|
@@ -117,35 +116,35 @@ const CustomPropertyView = _ref => {
|
|
|
117
116
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
118
117
|
children: [kintIntl.formatKintMessage({
|
|
119
118
|
id: 'customProperties.ctx',
|
|
120
|
-
overrideValue: labelOverrides
|
|
121
|
-
}), helpPopovers
|
|
122
|
-
content: helpPopovers
|
|
119
|
+
overrideValue: labelOverrides?.ctx
|
|
120
|
+
}), helpPopovers?.ctx ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
121
|
+
content: helpPopovers?.ctx
|
|
123
122
|
}) : null]
|
|
124
123
|
}),
|
|
125
|
-
value:
|
|
124
|
+
value: customProperty?.ctx ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.NoValue, {})
|
|
126
125
|
})
|
|
127
126
|
})
|
|
128
127
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Row, {
|
|
129
128
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
130
129
|
xs: 6,
|
|
131
|
-
children:
|
|
130
|
+
children: customProperty?.type && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
132
131
|
label: kintIntl.formatKintMessage({
|
|
133
132
|
id: 'customProperties.type',
|
|
134
|
-
overrideValue: labelOverrides
|
|
133
|
+
overrideValue: labelOverrides?.type
|
|
135
134
|
}),
|
|
136
135
|
value: kintIntl.formatKintMessage({
|
|
137
|
-
id:
|
|
138
|
-
overrideValue: labelOverrides
|
|
136
|
+
id: `customProperties.type.${customProperty?.type}`,
|
|
137
|
+
overrideValue: labelOverrides?.[customProperty?.type]
|
|
139
138
|
})
|
|
140
139
|
})
|
|
141
140
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
142
141
|
xs: 6,
|
|
143
|
-
children: (
|
|
142
|
+
children: (customProperty?.type === _customProperties.REFDATA_CLASS_NAME || customProperty?.type === _customProperties.MULTI_REFDATA_CLASS_NAME) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
144
143
|
label: kintIntl.formatKintMessage({
|
|
145
144
|
id: 'customProperties.category',
|
|
146
|
-
overrideValue: labelOverrides
|
|
145
|
+
overrideValue: labelOverrides?.category
|
|
147
146
|
}),
|
|
148
|
-
value:
|
|
147
|
+
value: customProperty?.category?.desc ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.NoValue, {})
|
|
149
148
|
})
|
|
150
149
|
})]
|
|
151
150
|
})]
|
|
@@ -13,7 +13,7 @@ describe('CustomPropertyView', () => {
|
|
|
13
13
|
beforeEach(() => {
|
|
14
14
|
(0, _jest.renderWithKintHarness)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
15
15
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyView.default, {
|
|
16
|
-
customProperty: _customProperties.default
|
|
16
|
+
customProperty: _customProperties.default?.find(cp => cp.name === 'Eligible authors')
|
|
17
17
|
})
|
|
18
18
|
}));
|
|
19
19
|
});
|
|
@@ -26,7 +26,7 @@ const CustomPropertiesEdit = _ref => {
|
|
|
26
26
|
intlNS: passedIntlNS,
|
|
27
27
|
labelOverrides,
|
|
28
28
|
nameOverride
|
|
29
|
-
},
|
|
29
|
+
}, `customPropertiesEdit-${ctx}`));
|
|
30
30
|
};
|
|
31
31
|
CustomPropertiesEdit.propTypes = {
|
|
32
32
|
contexts: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
@@ -35,7 +35,7 @@ const CustomPropertiesEditCtx = _ref => {
|
|
|
35
35
|
// Chain formatKintMessages together using provided fallbackMessage to
|
|
36
36
|
// allow for "If override or translation exists, use it, else use default"
|
|
37
37
|
return kintIntl.formatKintMessage({
|
|
38
|
-
id:
|
|
38
|
+
id: `customProperties.ctx.${ctx}`,
|
|
39
39
|
overrideValue: labelOverrides[ctx],
|
|
40
40
|
fallbackMessage: kintIntl.formatKintMessage({
|
|
41
41
|
id: 'customProperties.defaultTitle',
|
|
@@ -66,7 +66,7 @@ const CustomPropertiesEditCtx = _ref => {
|
|
|
66
66
|
return null;
|
|
67
67
|
}
|
|
68
68
|
return custprops.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Accordion, {
|
|
69
|
-
id:
|
|
69
|
+
id: `${id}-accordion-${ctx}`,
|
|
70
70
|
label: getAccordionLabel(),
|
|
71
71
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesListField.default, {
|
|
72
72
|
ctx: ctx,
|
|
@@ -74,7 +74,7 @@ const CustomPropertiesEditCtx = _ref => {
|
|
|
74
74
|
intlKey: passedIntlKey,
|
|
75
75
|
intlNS: passedIntlNS,
|
|
76
76
|
labelOverrides: labelOverrides,
|
|
77
|
-
name: nameOverride
|
|
77
|
+
name: nameOverride ?? 'customProperties'
|
|
78
78
|
})
|
|
79
79
|
});
|
|
80
80
|
};
|
|
@@ -46,8 +46,7 @@ const CustomPropertiesList = _ref => {
|
|
|
46
46
|
}
|
|
47
47
|
}, [availableCustomProperties, dirtying, pristine, value]);
|
|
48
48
|
const handleDeleteCustomProperty = (customProperty, i) => {
|
|
49
|
-
|
|
50
|
-
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 : {};
|
|
49
|
+
const currentValue = value[customProperty.value]?.[0] ?? {};
|
|
51
50
|
const newCustomProperties = [...customProperties];
|
|
52
51
|
newCustomProperties.splice(i, 1);
|
|
53
52
|
setCustomProperties(newCustomProperties);
|
|
@@ -82,7 +81,7 @@ const CustomPropertiesList = _ref => {
|
|
|
82
81
|
onChange,
|
|
83
82
|
setCustomProperties,
|
|
84
83
|
value
|
|
85
|
-
},
|
|
84
|
+
}, `customPropertyField-${customProperty.value}-${index}`);
|
|
86
85
|
}).filter(cp => cp !== undefined);
|
|
87
86
|
};
|
|
88
87
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -143,9 +142,8 @@ const CustomPropertiesListField = _ref2 => {
|
|
|
143
142
|
const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
144
143
|
|
|
145
144
|
// Map customProperties to bring together the options and the definition values
|
|
146
|
-
const availableCustomProperties = customProperties
|
|
147
|
-
|
|
148
|
-
let options = customProperty === null || customProperty === void 0 || (_customProperty$categ = customProperty.category) === null || _customProperty$categ === void 0 ? void 0 : _customProperty$categ.values;
|
|
145
|
+
const availableCustomProperties = customProperties?.map(customProperty => {
|
|
146
|
+
let options = customProperty?.category?.values;
|
|
149
147
|
if (options) {
|
|
150
148
|
options = [{
|
|
151
149
|
label: kintIntl.formatKintMessage({
|
|
@@ -182,10 +180,7 @@ const CustomPropertiesListField = _ref2 => {
|
|
|
182
180
|
// IMPORTANT -- All customproperty ctx sections are adding to the same "initialValue" field
|
|
183
181
|
// Ensure that we don't already have initialValues for this particular set before setting them,
|
|
184
182
|
// to ensure no looping behaviour
|
|
185
|
-
if (Object.keys(cps).every(key => {
|
|
186
|
-
var _initialValues$custom;
|
|
187
|
-
return ((_initialValues$custom = initialValues.customProperties) === null || _initialValues$custom === void 0 ? void 0 : _initialValues$custom[key]) !== undefined;
|
|
188
|
-
})) {
|
|
183
|
+
if (Object.keys(cps).every(key => initialValues.customProperties?.[key] !== undefined)) {
|
|
189
184
|
return initialValues.customProperties;
|
|
190
185
|
}
|
|
191
186
|
|