@k-int/stripes-kint-components 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -1
- package/es/index.js +26 -0
- package/es/lib/ActionList/ActionList.js +4 -1
- package/es/lib/ActionList/ActionListFieldArray.js +5 -2
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +1 -0
- package/es/lib/CustomProperties/Config/CustomPropertiesView.js +22 -9
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +88 -44
- package/es/lib/FormModal/FormModal.js +2 -7
- package/es/lib/utils/validators.js +101 -0
- package/junit.xml +38 -38
- package/package.json +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +11 -2
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +25 -13
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesLookup.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesSettings.js.html +5 -2
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesView.js.html +75 -9
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +195 -33
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.html +10 -10
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html +7 -22
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/index.html +27 -27
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +16 -10
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +24 -9
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/renderHelpText.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/validators.js.html +202 -0
- package/src/artifacts/coverage-jest/lcov.info +366 -296
- package/src/index.js +8 -0
- package/src/lib/ActionList/ActionList.js +3 -0
- package/src/lib/ActionList/ActionListFieldArray.js +14 -10
- package/src/lib/ActionList/README.md +1 -0
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +1 -0
- package/src/lib/CustomProperties/Config/CustomPropertiesView.js +28 -6
- package/src/lib/CustomProperties/Config/CustomPropertyForm.js +77 -23
- package/src/lib/FormModal/FormModal.js +2 -7
- package/src/lib/utils/generateKiwtQueryParams.js +2 -2
- package/src/lib/utils/validators.js +39 -0
- package/translations/stripes-kint-components/en.json +6 -1
package/src/index.js
CHANGED
|
@@ -22,6 +22,14 @@ export {
|
|
|
22
22
|
selectorSafe
|
|
23
23
|
} from './lib/utils';
|
|
24
24
|
|
|
25
|
+
// Validators (Some/all copied from stripes-erm-components but this gives another way to acquire them)
|
|
26
|
+
export {
|
|
27
|
+
composeValidators,
|
|
28
|
+
invalidNumber,
|
|
29
|
+
required,
|
|
30
|
+
requiredObject,
|
|
31
|
+
} from './lib/utils/validators';
|
|
32
|
+
|
|
25
33
|
// Contexts
|
|
26
34
|
export {
|
|
27
35
|
SettingsContext,
|
|
@@ -15,6 +15,7 @@ const propTypes = {
|
|
|
15
15
|
creatableFields: PropTypes.object,
|
|
16
16
|
editableFields: PropTypes.object,
|
|
17
17
|
fieldComponents: PropTypes.object,
|
|
18
|
+
hideCreateButton: PropTypes.bool,
|
|
18
19
|
visibleFields: PropTypes.arrayOf(PropTypes.string)
|
|
19
20
|
};
|
|
20
21
|
|
|
@@ -26,6 +27,7 @@ const ActionList = ({
|
|
|
26
27
|
creatableFields = {},
|
|
27
28
|
editableFields = {},
|
|
28
29
|
fieldComponents = {},
|
|
30
|
+
hideCreateButton,
|
|
29
31
|
visibleFields,
|
|
30
32
|
...mclProps // Assume anything left over is to directly apply to the MCL
|
|
31
33
|
}) => {
|
|
@@ -48,6 +50,7 @@ const ActionList = ({
|
|
|
48
50
|
creatableFields={creatableFields}
|
|
49
51
|
editableFields={editableFields}
|
|
50
52
|
fieldComponents={fieldComponents}
|
|
53
|
+
hideCreateButton={hideCreateButton}
|
|
51
54
|
name="contentData"
|
|
52
55
|
visibleFields={visibleFields}
|
|
53
56
|
{...mclProps}
|
|
@@ -20,6 +20,7 @@ const propTypes = {
|
|
|
20
20
|
fields: PropTypes.object,
|
|
21
21
|
fieldComponents: PropTypes.object,
|
|
22
22
|
formatter: PropTypes.object,
|
|
23
|
+
hideCreateButton: PropTypes.bool,
|
|
23
24
|
visibleFields: PropTypes.arrayOf(PropTypes.string)
|
|
24
25
|
};
|
|
25
26
|
|
|
@@ -31,6 +32,7 @@ const ActionListFieldArray = ({
|
|
|
31
32
|
editableFields,
|
|
32
33
|
fields,
|
|
33
34
|
fieldComponents,
|
|
35
|
+
hideCreateButton = false,
|
|
34
36
|
visibleFields,
|
|
35
37
|
...mclProps // Assume anything left over is to directly apply to the MCL
|
|
36
38
|
}) => {
|
|
@@ -242,16 +244,18 @@ const ActionListFieldArray = ({
|
|
|
242
244
|
|
|
243
245
|
return (
|
|
244
246
|
<>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
247
|
+
{!hideCreateButton &&
|
|
248
|
+
<Button
|
|
249
|
+
buttonClass={css.buttonRight}
|
|
250
|
+
disabled={!actionCalls.create}
|
|
251
|
+
onClick={() => {
|
|
252
|
+
toggleEditing('NEW_ROW');
|
|
253
|
+
fields.push({});
|
|
254
|
+
}}
|
|
255
|
+
>
|
|
256
|
+
<FormattedMessage id="stripes-kint-components.actionList.create" />
|
|
257
|
+
</Button>
|
|
258
|
+
}
|
|
255
259
|
<MultiColumnList
|
|
256
260
|
columnMapping={{
|
|
257
261
|
...columnMapping,
|
|
@@ -65,5 +65,6 @@ creatableFields | object<function> | An object with keys from the `visibleFields
|
|
|
65
65
|
editableFields | object<function> | An object with keys from the `visibleFields` array, and values of functions which take the entire row object and return a boolean indicating whether that field is editable or not. No key for a given field will be interpreted as () => true, so a field is editable by default. | | ✕ |
|
|
66
66
|
fieldComponents | object<function> | An object with keys from the `visibleFields` array, and values of functions which take some `fieldProps` (currently only the name of the field `name`), and returns a Field component to be used in "edit mode" for the visible field specified. | | ✕ |
|
|
67
67
|
formatter | object<function> | A "formatter" object that takes the same shape as an MCL formatter, and is used in the same way whilst a row is NOT being edited. While editing a given row, this formatter entry is ignored. | | ✕ |
|
|
68
|
+
hideCreateButton | boolean | A simple bool to hide the create button. Default behaviour without create action is disabled. | false | ✕ |
|
|
68
69
|
visibleFields | array<String> | An array of strings corresponding to those fields to be displayed in the rendered MultiColumnList | | ✓ |
|
|
69
70
|
...mclProps | any | Any other props supplied to ActionList will be applied to the MCL directly. *WARNING* Some MCL props may override important functionality within ActionList | | ✕ |
|
|
@@ -46,24 +46,34 @@ const CustomPropertiesView = ({
|
|
|
46
46
|
<Col xs={6}>
|
|
47
47
|
<KeyValue
|
|
48
48
|
label={
|
|
49
|
-
labelOverrides?.
|
|
50
|
-
<FormattedMessage
|
|
49
|
+
labelOverrides?.primary ??
|
|
50
|
+
<FormattedMessage
|
|
51
|
+
id="stripes-kint-components.customProperties.primary"
|
|
52
|
+
/>
|
|
53
|
+
}
|
|
54
|
+
value={
|
|
55
|
+
<FormattedMessage
|
|
56
|
+
id={
|
|
57
|
+
customProperty?.primary
|
|
58
|
+
? 'stripes-kint-components.yes'
|
|
59
|
+
: 'stripes-kint-components.no'
|
|
60
|
+
}
|
|
61
|
+
/>
|
|
51
62
|
}
|
|
52
|
-
value={customProperty?.weight}
|
|
53
63
|
/>
|
|
54
64
|
</Col>
|
|
55
65
|
<Col xs={6}>
|
|
56
66
|
<KeyValue
|
|
57
67
|
label={
|
|
58
|
-
labelOverrides?.
|
|
68
|
+
labelOverrides?.retired ??
|
|
59
69
|
<FormattedMessage
|
|
60
|
-
id="stripes-kint-components.customProperties.
|
|
70
|
+
id="stripes-kint-components.customProperties.retired"
|
|
61
71
|
/>
|
|
62
72
|
}
|
|
63
73
|
value={
|
|
64
74
|
<FormattedMessage
|
|
65
75
|
id={
|
|
66
|
-
customProperty?.
|
|
76
|
+
customProperty?.retired
|
|
67
77
|
? 'stripes-kint-components.yes'
|
|
68
78
|
: 'stripes-kint-components.no'
|
|
69
79
|
}
|
|
@@ -73,6 +83,15 @@ const CustomPropertiesView = ({
|
|
|
73
83
|
</Col>
|
|
74
84
|
</Row>
|
|
75
85
|
<Row>
|
|
86
|
+
<Col xs={6}>
|
|
87
|
+
<KeyValue
|
|
88
|
+
label={
|
|
89
|
+
labelOverrides?.weight ??
|
|
90
|
+
<FormattedMessage id="stripes-kint-components.customProperties.weight" />
|
|
91
|
+
}
|
|
92
|
+
value={customProperty?.weight}
|
|
93
|
+
/>
|
|
94
|
+
</Col>
|
|
76
95
|
<Col xs={6}>
|
|
77
96
|
<KeyValue
|
|
78
97
|
label={
|
|
@@ -90,6 +109,8 @@ const CustomPropertiesView = ({
|
|
|
90
109
|
}
|
|
91
110
|
/>
|
|
92
111
|
</Col>
|
|
112
|
+
</Row>
|
|
113
|
+
<Row>
|
|
93
114
|
<Col xs={6}>
|
|
94
115
|
<KeyValue
|
|
95
116
|
label={
|
|
@@ -136,6 +157,7 @@ CustomPropertiesView.propTypes = {
|
|
|
136
157
|
description: PropTypes.string,
|
|
137
158
|
weight: PropTypes.number,
|
|
138
159
|
primary: PropTypes.bool,
|
|
160
|
+
retired: PropTypes.bool,
|
|
139
161
|
defaultInternal: PropTypes.bool,
|
|
140
162
|
ctx: PropTypes.string,
|
|
141
163
|
type: PropTypes.string,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
TextArea,
|
|
13
13
|
TextField
|
|
14
14
|
} from '@folio/stripes/components';
|
|
15
|
-
import { requiredValidator } from '
|
|
15
|
+
import { required as requiredValidator, composeValidators } from '../../utils/validators';
|
|
16
16
|
|
|
17
17
|
const CustomPropertyForm = ({
|
|
18
18
|
contextFilterOptions,
|
|
@@ -43,6 +43,14 @@ const CustomPropertyForm = ({
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
const primaryRetiredValidator = (_v, allValues) => {
|
|
47
|
+
if (allValues.primary && allValues.retired) {
|
|
48
|
+
return labelOverrides?.primaryRetired ??
|
|
49
|
+
<FormattedMessage id="stripes-kint-components.errors.primaryRetired" />;
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
};
|
|
53
|
+
|
|
46
54
|
return (
|
|
47
55
|
<>
|
|
48
56
|
<Row>
|
|
@@ -90,7 +98,7 @@ const CustomPropertyForm = ({
|
|
|
90
98
|
</Col>
|
|
91
99
|
</Row>
|
|
92
100
|
<Row>
|
|
93
|
-
<Col xs={
|
|
101
|
+
<Col xs={9}>
|
|
94
102
|
<Field
|
|
95
103
|
component={TextArea}
|
|
96
104
|
label={labelOverrides?.description ??
|
|
@@ -106,6 +114,26 @@ const CustomPropertyForm = ({
|
|
|
106
114
|
validate={requiredValidator}
|
|
107
115
|
/>
|
|
108
116
|
</Col>
|
|
117
|
+
<Col xs={3}>
|
|
118
|
+
<Field
|
|
119
|
+
actions={[{ onSelect: addCtx, render: renderAddCtx }]}
|
|
120
|
+
component={MultiSelection}
|
|
121
|
+
dataOptions={contextOptions}
|
|
122
|
+
emptyMessage={intl.formatMessage({ id: 'stripes-kint-components.customProperties.noCtxFound' })}
|
|
123
|
+
label={labelOverrides?.ctx ??
|
|
124
|
+
<FormattedMessage id="stripes-kint-components.customProperties.ctx" />
|
|
125
|
+
}
|
|
126
|
+
name="ctx"
|
|
127
|
+
onChange={(selectedItems) => {
|
|
128
|
+
if (selectedItems.length) {
|
|
129
|
+
change('ctx', [selectedItems?.[selectedItems?.length - 1]]);
|
|
130
|
+
} else {
|
|
131
|
+
change('ctx', undefined);
|
|
132
|
+
}
|
|
133
|
+
}}
|
|
134
|
+
validate={value => (value?.length > 1 ? <FormattedMessage id="stripes-kint-components.customProperties.ctx.error.moreThanOne" /> : null)}
|
|
135
|
+
/>
|
|
136
|
+
</Col>
|
|
109
137
|
</Row>
|
|
110
138
|
<Row>
|
|
111
139
|
<Col xs={3}>
|
|
@@ -156,7 +184,47 @@ const CustomPropertyForm = ({
|
|
|
156
184
|
content={helpPopovers?.primary}
|
|
157
185
|
/> : null
|
|
158
186
|
}
|
|
159
|
-
validate={
|
|
187
|
+
validate={composeValidators(
|
|
188
|
+
requiredValidator,
|
|
189
|
+
primaryRetiredValidator
|
|
190
|
+
)}
|
|
191
|
+
/>
|
|
192
|
+
</Col>
|
|
193
|
+
<Col xs={3}>
|
|
194
|
+
<Field
|
|
195
|
+
component={Select}
|
|
196
|
+
dataOptions={[
|
|
197
|
+
{
|
|
198
|
+
label: intl.formatMessage({
|
|
199
|
+
id: 'stripes-kint-components.yes',
|
|
200
|
+
}),
|
|
201
|
+
value: 'true',
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
label: intl.formatMessage({
|
|
205
|
+
id: 'stripes-kint-components.no',
|
|
206
|
+
}),
|
|
207
|
+
value: 'false',
|
|
208
|
+
},
|
|
209
|
+
]}
|
|
210
|
+
format={booleanToString}
|
|
211
|
+
label={labelOverrides?.retired ??
|
|
212
|
+
<FormattedMessage
|
|
213
|
+
id="stripes-kint-components.customProperties.retired"
|
|
214
|
+
/>
|
|
215
|
+
}
|
|
216
|
+
name="retired"
|
|
217
|
+
parse={stringToBoolean}
|
|
218
|
+
required
|
|
219
|
+
startControl={helpPopovers?.primary ?
|
|
220
|
+
<InfoPopover
|
|
221
|
+
content={helpPopovers?.primary}
|
|
222
|
+
/> : null
|
|
223
|
+
}
|
|
224
|
+
validate={composeValidators(
|
|
225
|
+
requiredValidator,
|
|
226
|
+
primaryRetiredValidator
|
|
227
|
+
)}
|
|
160
228
|
/>
|
|
161
229
|
</Col>
|
|
162
230
|
<Col xs={3}>
|
|
@@ -193,26 +261,6 @@ const CustomPropertyForm = ({
|
|
|
193
261
|
validate={requiredValidator}
|
|
194
262
|
/>
|
|
195
263
|
</Col>
|
|
196
|
-
<Col xs={3}>
|
|
197
|
-
<Field
|
|
198
|
-
actions={[{ onSelect: addCtx, render: renderAddCtx }]}
|
|
199
|
-
component={MultiSelection}
|
|
200
|
-
dataOptions={contextOptions}
|
|
201
|
-
emptyMessage={intl.formatMessage({ id: 'stripes-kint-components.customProperties.noCtxFound' })}
|
|
202
|
-
label={labelOverrides?.ctx ??
|
|
203
|
-
<FormattedMessage id="stripes-kint-components.customProperties.ctx" />
|
|
204
|
-
}
|
|
205
|
-
name="ctx"
|
|
206
|
-
onChange={(selectedItems) => {
|
|
207
|
-
if (selectedItems.length) {
|
|
208
|
-
change('ctx', [selectedItems?.[selectedItems?.length - 1]]);
|
|
209
|
-
} else {
|
|
210
|
-
change('ctx', undefined);
|
|
211
|
-
}
|
|
212
|
-
}}
|
|
213
|
-
validate={value => (value?.length > 1 ? <FormattedMessage id="stripes-kint-components.customProperties.ctx.error.moreThanOne" /> : null)}
|
|
214
|
-
/>
|
|
215
|
-
</Col>
|
|
216
264
|
</Row>
|
|
217
265
|
{/* Users can only configure the type of a custom property when creating it, not when editing it */}
|
|
218
266
|
{!values?.id && (
|
|
@@ -246,6 +294,12 @@ const CustomPropertyForm = ({
|
|
|
246
294
|
}),
|
|
247
295
|
value: 'Refdata',
|
|
248
296
|
},
|
|
297
|
+
{
|
|
298
|
+
label: intl.formatMessage({
|
|
299
|
+
id: 'stripes-kint-components.customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyLocalDate',
|
|
300
|
+
}),
|
|
301
|
+
value: 'LocalDate',
|
|
302
|
+
},
|
|
249
303
|
]
|
|
250
304
|
}
|
|
251
305
|
label={labelOverrides?.type ??
|
|
@@ -16,16 +16,11 @@ const FormModal = ({ children, modalProps: { onClose, ...modalProps }, onSubmit,
|
|
|
16
16
|
restart();
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const handleSubmitAndClear = () => {
|
|
20
|
-
handleSubmit();
|
|
21
|
-
restart();
|
|
22
|
-
};
|
|
23
|
-
|
|
24
19
|
const renderFooter = () => (
|
|
25
20
|
<ModalFooter>
|
|
26
21
|
<Button
|
|
27
22
|
buttonStyle="primary"
|
|
28
|
-
onClick={
|
|
23
|
+
onClick={handleSubmit}
|
|
29
24
|
>
|
|
30
25
|
<FormattedMessage id="stripes-kint-components.save" />
|
|
31
26
|
</Button>
|
|
@@ -39,7 +34,7 @@ const FormModal = ({ children, modalProps: { onClose, ...modalProps }, onSubmit,
|
|
|
39
34
|
|
|
40
35
|
return (
|
|
41
36
|
<form
|
|
42
|
-
onSubmit={
|
|
37
|
+
onSubmit={handleSubmit}
|
|
43
38
|
>
|
|
44
39
|
<Modal
|
|
45
40
|
enforceFocus={false}
|
|
@@ -61,7 +61,7 @@ const generateKiwtQueryParams = (options, nsValues) => {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
if (filters) {
|
|
66
66
|
const filterMap = {};
|
|
67
67
|
filters.split(',').forEach(filter => {
|
|
@@ -95,7 +95,7 @@ const generateKiwtQueryParams = (options, nsValues) => {
|
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
if (sort) {
|
|
100
100
|
paramsArray.push(...sort.trim()?.split(',').map(sortKey => {
|
|
101
101
|
const descending = sortKey.startsWith('-');
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// This is a copy of stripes-erm-components, to avoid necessitating that as a dependency
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
|
|
4
|
+
const invalidNumber = value => (
|
|
5
|
+
(value || value === 0) ? undefined : <FormattedMessage id="stripes-kint-components.errors.invalidNumber" />
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
const required = value => {
|
|
9
|
+
const blankString = /^\s+$/;
|
|
10
|
+
if ((value && !blankString.test(value)) || value === false || value === 0) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
return <FormattedMessage id="stripes-core.label.missingRequiredField" />;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const requiredObject = (formValue = {}) => {
|
|
17
|
+
// withKiwtFieldArray sets the _delete property on new objects by default
|
|
18
|
+
// eslint-disable-next-line no-unused-vars
|
|
19
|
+
const { _delete, ...value } = formValue;
|
|
20
|
+
if (Object.keys(value).length === 0) {
|
|
21
|
+
return <FormattedMessage id="stripes-core.label.missingRequiredField" />;
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const composeValidators = (...validators) => (
|
|
27
|
+
(value, allValues, meta) => (
|
|
28
|
+
validators.reduce((error, validator) => (
|
|
29
|
+
error || validator(value, allValues, meta)
|
|
30
|
+
), undefined)
|
|
31
|
+
)
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
composeValidators,
|
|
36
|
+
invalidNumber,
|
|
37
|
+
required,
|
|
38
|
+
requiredObject,
|
|
39
|
+
};
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
"customProperties.label": "Label",
|
|
38
38
|
"customProperties.primary": "Primary",
|
|
39
|
+
"customProperties.retired": "Retired",
|
|
39
40
|
"customProperties.ctx": "Context",
|
|
40
41
|
"customProperties.ctx.addContext": "Add context {value}",
|
|
41
42
|
"customProperties.weight": "Order weight",
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
"customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyRefdata": "Refdata",
|
|
60
61
|
"customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyRefdataDefinition": "Refdata definition",
|
|
61
62
|
"customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyText": "Text",
|
|
63
|
+
"customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyLocalDate": "Date",
|
|
62
64
|
|
|
63
65
|
"customProperties.delete.confirmLabel": "Delete",
|
|
64
66
|
"customProperties.delete.confirmHeading": "Delete custom property",
|
|
@@ -66,5 +68,8 @@
|
|
|
66
68
|
|
|
67
69
|
"search": "Search",
|
|
68
70
|
"yes": "Yes",
|
|
69
|
-
"no": "No"
|
|
71
|
+
"no": "No",
|
|
72
|
+
|
|
73
|
+
"errors.invalidNumber": "Please enter a valid number to continue",
|
|
74
|
+
"errors.primaryRetired": "A custom property cannot be both primary and retired"
|
|
70
75
|
}
|