@k-int/stripes-kint-components 2.4.1 → 2.5.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 +9 -1
- package/README.md +14 -1
- package/es/lib/ActionList/ActionList.js +20 -7
- package/es/lib/ActionList/ActionListFieldArray.js +86 -85
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +1 -3
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +2 -2
- package/es/lib/EditableRefdataList/EditableRefdataList.js +3 -0
- package/es/lib/EditableSettingsList/EditableSettingsList.js +4 -1
- package/es/lib/FormModal/FormModal.js +10 -1
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +3 -2
- package/es/lib/Typedown/Typedown.js +5 -7
- package/es/lib/hooks/settingsHooks/useSettingSection.js +16 -3
- package/es/lib/hooks/settingsHooks/useSettings.js +14 -7
- package/junit.xml +37 -37
- package/package.json +1 -2
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +42 -12
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +222 -93
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +12 -12
- 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 +20 -17
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyView.js.html +601 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.html +15 -15
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEdit.js.html +190 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +340 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesListField.js.html +667 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyField.js.html +982 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyFormCard.js.html +478 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.html +191 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.js.html +100 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilter.js.html +460 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterField.js.html +529 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +424 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +307 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesRule.js.html +451 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.html +236 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.js.html +103 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useOperators.js.html +250 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useParseActiveFilterStrings.js.html +190 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useValueProps.js.html +220 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesView.js.html +193 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesViewCtx.js.html +436 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertyCard.js.html +616 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.html +161 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.html +116 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.js.html +175 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +33 -18
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +5 -5
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +8 -2
- 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 +102 -24
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.html +9 -9
- 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 +14 -8
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +11 -11
- 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 +60 -153
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/TableBody.js.html +373 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +6 -3
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +2 -2
- 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 +7 -25
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html +7 -4
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +5 -5
- 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 +39 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +8 -2
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +5 -5
- 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 +57 -6
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +29 -8
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +7 -7
- 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 +26 -8
- 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/useAvailableCustomProperties.js.html +205 -0
- 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/useInvalidateRefdata.js.html +118 -0
- 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 +21 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +6 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/index.html +126 -51
- 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 +36 -9
- package/src/artifacts/coverage-jest/lcov-report/utils/groupCustomPropertiesByCtx.js.html +124 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/highlightString.js.html +211 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +95 -20
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +29 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/matchString.js.html +127 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataQueryKey.js.html +112 -0
- 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/typedownQueryKey.js.html +112 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/validators.js.html +126 -6
- package/src/artifacts/coverage-jest/lcov.info +2043 -718
- package/src/lib/ActionList/ActionList.js +12 -5
- package/src/lib/ActionList/ActionListFieldArray.js +86 -65
- package/src/lib/ActionList/README.md +19 -0
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +1 -3
- package/src/lib/CustomProperties/View/CustomPropertyCard.js +2 -2
- package/src/lib/EditableRefdataList/EditableRefdataList.js +3 -1
- package/src/lib/EditableSettingsList/EditableSettingsList.js +8 -1
- package/src/lib/FormModal/FormModal.js +6 -2
- package/src/lib/SASQLookupComponent/SASQLookupComponent.js +7 -0
- package/src/lib/Typedown/Typedown.js +4 -10
- package/src/lib/hooks/settingsHooks/useSettingSection.js +19 -2
- package/src/lib/hooks/settingsHooks/useSettings.js +12 -5
- package/src/lib/utils/matchString.js +1 -1
- package/styles/ActionListFieldArray.css +10 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
4
|
import { Form } from 'react-final-form';
|
|
@@ -17,10 +17,11 @@ const propTypes = {
|
|
|
17
17
|
editableFields: PropTypes.object,
|
|
18
18
|
fieldComponents: PropTypes.object,
|
|
19
19
|
hideCreateButton: PropTypes.bool,
|
|
20
|
+
label: PropTypes.string,
|
|
20
21
|
visibleFields: PropTypes.arrayOf(PropTypes.string)
|
|
21
22
|
};
|
|
22
23
|
|
|
23
|
-
const ActionList = ({
|
|
24
|
+
const ActionList = forwardRef(({
|
|
24
25
|
actionAssigner,
|
|
25
26
|
actionCalls = {}, // DEPRECATED
|
|
26
27
|
columnMapping,
|
|
@@ -30,9 +31,14 @@ const ActionList = ({
|
|
|
30
31
|
editableFields = {},
|
|
31
32
|
fieldComponents = {},
|
|
32
33
|
hideCreateButton,
|
|
34
|
+
label,
|
|
33
35
|
visibleFields,
|
|
34
36
|
...mclProps // Assume anything left over is to directly apply to the MCL
|
|
35
|
-
}) => {
|
|
37
|
+
}, ref) => {
|
|
38
|
+
const ActionListFieldArrayWithRef = (alfaProps) => (
|
|
39
|
+
<ActionListFieldArray ref={ref} {...alfaProps} />
|
|
40
|
+
);
|
|
41
|
+
|
|
36
42
|
return (
|
|
37
43
|
<>
|
|
38
44
|
<Form
|
|
@@ -48,12 +54,13 @@ const ActionList = ({
|
|
|
48
54
|
actionAssigner={actionAssigner}
|
|
49
55
|
actionCalls={actionCalls}
|
|
50
56
|
columnMapping={columnMapping}
|
|
51
|
-
component={
|
|
57
|
+
component={ActionListFieldArrayWithRef}
|
|
52
58
|
creatableFields={creatableFields}
|
|
53
59
|
createCallback={createCallback}
|
|
54
60
|
editableFields={editableFields}
|
|
55
61
|
fieldComponents={fieldComponents}
|
|
56
62
|
hideCreateButton={hideCreateButton}
|
|
63
|
+
label={label}
|
|
57
64
|
name="contentData"
|
|
58
65
|
visibleFields={visibleFields}
|
|
59
66
|
{...mclProps}
|
|
@@ -63,7 +70,7 @@ const ActionList = ({
|
|
|
63
70
|
</Form>
|
|
64
71
|
</>
|
|
65
72
|
);
|
|
66
|
-
};
|
|
73
|
+
});
|
|
67
74
|
|
|
68
75
|
ActionList.propTypes = propTypes;
|
|
69
76
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { forwardRef, useImperativeHandle, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { FormattedMessage } from 'react-intl';
|
|
4
4
|
import get from 'lodash/get';
|
|
5
5
|
|
|
6
6
|
import { Field, useForm, useFormState } from 'react-final-form';
|
|
7
|
-
import { Button, IconButton, MultiColumnList, TextField } from '@folio/stripes/components';
|
|
7
|
+
import { Button, Headline, IconButton, MultiColumnList, TextField } from '@folio/stripes/components';
|
|
8
8
|
import css from '../../../styles/ActionListFieldArray.css';
|
|
9
9
|
|
|
10
10
|
const EDITING_ACTIONS_WIDTH = 25;
|
|
@@ -22,10 +22,11 @@ const propTypes = {
|
|
|
22
22
|
fieldComponents: PropTypes.object,
|
|
23
23
|
formatter: PropTypes.object,
|
|
24
24
|
hideCreateButton: PropTypes.bool,
|
|
25
|
+
label: PropTypes.string,
|
|
25
26
|
visibleFields: PropTypes.arrayOf(PropTypes.string)
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
const ActionListFieldArray = ({
|
|
29
|
+
const ActionListFieldArray = forwardRef(({
|
|
29
30
|
actionAssigner,
|
|
30
31
|
actionCalls, // DEPRECATED
|
|
31
32
|
columnMapping,
|
|
@@ -35,9 +36,10 @@ const ActionListFieldArray = ({
|
|
|
35
36
|
fields,
|
|
36
37
|
fieldComponents,
|
|
37
38
|
hideCreateButton = false,
|
|
39
|
+
label,
|
|
38
40
|
visibleFields,
|
|
39
41
|
...mclProps // Assume anything left over is to directly apply to the MCL
|
|
40
|
-
}) => {
|
|
42
|
+
}, ref) => {
|
|
41
43
|
// Grab finalForm functions/values from form hooks
|
|
42
44
|
const { change } = useForm();
|
|
43
45
|
const { initialValues, pristine, submitting, values } = useFormState();
|
|
@@ -58,7 +60,12 @@ const ActionListFieldArray = ({
|
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
const handleSave = (index) => {
|
|
61
|
-
const {
|
|
63
|
+
const {
|
|
64
|
+
actionListActions: _a,
|
|
65
|
+
fieldName: _fn,
|
|
66
|
+
fieldIndex: _fi,
|
|
67
|
+
...rowData
|
|
68
|
+
} = fields.value[index];
|
|
62
69
|
|
|
63
70
|
// Find "edit" entry in actionAssigner
|
|
64
71
|
const editCallback = actionAssigner(rowData)?.find(act => act.name === 'edit')?.callback;
|
|
@@ -70,7 +77,12 @@ const ActionListFieldArray = ({
|
|
|
70
77
|
};
|
|
71
78
|
|
|
72
79
|
const handleCreate = (index) => {
|
|
73
|
-
const {
|
|
80
|
+
const {
|
|
81
|
+
actionListActions: _a,
|
|
82
|
+
fieldName: _fn,
|
|
83
|
+
fieldIndex: _fi,
|
|
84
|
+
...rowData
|
|
85
|
+
} = fields.value[index];
|
|
74
86
|
|
|
75
87
|
if (createCallback) {
|
|
76
88
|
createCallback(rowData);
|
|
@@ -79,6 +91,17 @@ const ActionListFieldArray = ({
|
|
|
79
91
|
}
|
|
80
92
|
};
|
|
81
93
|
|
|
94
|
+
const handleClickCreate = () => {
|
|
95
|
+
toggleEditing('NEW_ROW');
|
|
96
|
+
fields.push({});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// Way to go into create mode from external component, and way to tell internal editing state
|
|
100
|
+
useImperativeHandle(ref, () => ({
|
|
101
|
+
create: handleClickCreate,
|
|
102
|
+
editing
|
|
103
|
+
}));
|
|
104
|
+
|
|
82
105
|
const getColumnWidths = () => {
|
|
83
106
|
const widthNotInUseByActions = editing ?
|
|
84
107
|
TOTAL_WIDTH - EDITING_ACTIONS_WIDTH :
|
|
@@ -190,54 +213,13 @@ const ActionListFieldArray = ({
|
|
|
190
213
|
);
|
|
191
214
|
};
|
|
192
215
|
|
|
193
|
-
const
|
|
216
|
+
const assignActions = () => {
|
|
194
217
|
return (
|
|
195
218
|
fields.map((fieldName, fieldIndex) => {
|
|
196
219
|
// Fetch the content from the field Values
|
|
197
220
|
const cd = get(values, fieldName);
|
|
198
221
|
cd.actionListActions = actionAssigner(cd);
|
|
199
|
-
|
|
200
|
-
// Row is being edited if it has no id, or its id is in the editing string
|
|
201
|
-
const editingRow = cd.id === editing || !cd.id;
|
|
202
|
-
const returnObj = { ...cd };
|
|
203
|
-
|
|
204
|
-
// If editing, replace values with fields
|
|
205
|
-
if (editingRow) {
|
|
206
|
-
/*
|
|
207
|
-
Check if the property is a visible field.
|
|
208
|
-
If it is not then we don't allow editing in this component.
|
|
209
|
-
*/
|
|
210
|
-
for (const key of visibleFields) {
|
|
211
|
-
const editFunction = editableFields[key] ?? (() => true);
|
|
212
|
-
const createFunction = creatableFields[key] ?? (() => true);
|
|
213
|
-
/*
|
|
214
|
-
Next check if this is a new row, if so we should run the createableField function with the data.
|
|
215
|
-
If it is not a new row, then we run the editableField function with the data,
|
|
216
|
-
and it should return true/false
|
|
217
|
-
|
|
218
|
-
For both checks
|
|
219
|
-
true => Field, false => display value
|
|
220
|
-
*/
|
|
221
|
-
if (
|
|
222
|
-
(!cd.id && createFunction(cd)) ||
|
|
223
|
-
(editFunction(cd))
|
|
224
|
-
) {
|
|
225
|
-
returnObj[key] =
|
|
226
|
-
fieldComponents[key] ?
|
|
227
|
-
fieldComponents[key]({
|
|
228
|
-
name: `${fieldName}.${key}`
|
|
229
|
-
}) :
|
|
230
|
-
<Field
|
|
231
|
-
autoFocus={fieldIndex === 0}
|
|
232
|
-
component={TextField}
|
|
233
|
-
marginBottom0
|
|
234
|
-
name={`${fieldName}.${key}`}
|
|
235
|
-
parse={v => v}
|
|
236
|
-
/>;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return returnObj;
|
|
222
|
+
return { ...cd, fieldName, fieldIndex };
|
|
241
223
|
})
|
|
242
224
|
);
|
|
243
225
|
};
|
|
@@ -250,11 +232,46 @@ const ActionListFieldArray = ({
|
|
|
250
232
|
returnObj[key] = cd => {
|
|
251
233
|
// Row is being edited if it has no id, or its id is in the editing string
|
|
252
234
|
const editingRow = cd.id === editing || !cd.id;
|
|
253
|
-
// If not editing, use the passed formatter values
|
|
254
235
|
|
|
255
|
-
|
|
236
|
+
// Default to the passed formatter values
|
|
237
|
+
let returnValue = formatter?.[key] ? formatter[key](cd) : cd[key];
|
|
238
|
+
|
|
239
|
+
// If editing, replace values with fields
|
|
240
|
+
if (editingRow) {
|
|
241
|
+
/*
|
|
242
|
+
Check if the property is a visible field.
|
|
243
|
+
If it is not then we don't allow editing in this component.
|
|
244
|
+
*/
|
|
245
|
+
const editFunction = editableFields[key] ?? (() => true);
|
|
246
|
+
const createFunction = creatableFields[key] ?? (() => true);
|
|
247
|
+
/*
|
|
248
|
+
Next check if this is a new row, if so we should run the createableField function with the data.
|
|
249
|
+
If it is not a new row, then we run the editableField function with the data,
|
|
250
|
+
and it should return true/false
|
|
251
|
+
|
|
252
|
+
For both checks
|
|
253
|
+
true => Field, false => display value
|
|
254
|
+
*/
|
|
255
|
+
if (
|
|
256
|
+
(!cd.id && createFunction(cd)) ||
|
|
257
|
+
(editFunction(cd))
|
|
258
|
+
) {
|
|
259
|
+
returnValue =
|
|
260
|
+
fieldComponents[key] ?
|
|
261
|
+
fieldComponents[key]({
|
|
262
|
+
name: `${cd.fieldName}.${key}`
|
|
263
|
+
}) :
|
|
264
|
+
<Field
|
|
265
|
+
autoFocus={cd.fieldIndex === 0}
|
|
266
|
+
component={TextField}
|
|
267
|
+
marginBottom0
|
|
268
|
+
name={`${cd.fieldName}.${key}`}
|
|
269
|
+
parse={v => v}
|
|
270
|
+
/>;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
256
273
|
|
|
257
|
-
if (
|
|
274
|
+
if (formatter?.[key]) {
|
|
258
275
|
returnValue = formatter[key](cd);
|
|
259
276
|
}
|
|
260
277
|
|
|
@@ -266,25 +283,29 @@ const ActionListFieldArray = ({
|
|
|
266
283
|
|
|
267
284
|
return (
|
|
268
285
|
<>
|
|
269
|
-
{
|
|
270
|
-
<
|
|
271
|
-
|
|
272
|
-
disabled={(!actionCalls.create && !createCallback)} // DEPRECATED actionCalls
|
|
273
|
-
onClick={() => {
|
|
274
|
-
toggleEditing('NEW_ROW');
|
|
275
|
-
fields.push({});
|
|
276
|
-
}}
|
|
286
|
+
<div className={css.header}>
|
|
287
|
+
<Headline
|
|
288
|
+
className={css.headerText}
|
|
277
289
|
>
|
|
278
|
-
|
|
279
|
-
</
|
|
280
|
-
|
|
290
|
+
{label}
|
|
291
|
+
</Headline>
|
|
292
|
+
{!hideCreateButton &&
|
|
293
|
+
<Button
|
|
294
|
+
disabled={editing || (!actionCalls.create && !createCallback)} // DEPRECATED actionCalls
|
|
295
|
+
marginBottom0
|
|
296
|
+
onClick={handleClickCreate}
|
|
297
|
+
>
|
|
298
|
+
<FormattedMessage id="stripes-kint-components.actionList.create" />
|
|
299
|
+
</Button>
|
|
300
|
+
}
|
|
301
|
+
</div>
|
|
281
302
|
<MultiColumnList
|
|
282
303
|
columnMapping={{
|
|
283
304
|
...columnMapping,
|
|
284
305
|
actionListActions: <FormattedMessage id="stripes-kint-components.actionList.actions" />
|
|
285
306
|
}}
|
|
286
307
|
columnWidths={getColumnWidths()}
|
|
287
|
-
contentData={
|
|
308
|
+
contentData={assignActions()}
|
|
288
309
|
formatter={{
|
|
289
310
|
actionListActions: renderActionButtons,
|
|
290
311
|
...fieldAwareFormatter()
|
|
@@ -295,7 +316,7 @@ const ActionListFieldArray = ({
|
|
|
295
316
|
/>
|
|
296
317
|
</>
|
|
297
318
|
);
|
|
298
|
-
};
|
|
319
|
+
});
|
|
299
320
|
|
|
300
321
|
ActionListFieldArray.propTypes = propTypes;
|
|
301
322
|
|
|
@@ -55,6 +55,25 @@ createCallback = (data) => setContentData({
|
|
|
55
55
|
/>
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
## Inline creation trigger
|
|
59
|
+
In rare circumstances, it may be necessary to trigger the inline creation from an external component. One particular example is within a settings Pane, forcing the create button up into the pane header.
|
|
60
|
+
|
|
61
|
+
ActionList can accept a `ref`, which will provide the implementing component with a `create()` method for triggering inline create. It will also provide the internal "editing" state, which should be used to disable any create button.
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
import { useRef } from 'react';
|
|
65
|
+
import { ActionList } from '@k-int/stripes-kint-components'
|
|
66
|
+
|
|
67
|
+
const myRef = useRef();
|
|
68
|
+
|
|
69
|
+
<button disabled={myRef.editing} onClick={() => myRef?.current?.create()}>
|
|
70
|
+
create
|
|
71
|
+
</button>
|
|
72
|
+
<ActionList
|
|
73
|
+
ref={myRef}
|
|
74
|
+
/>
|
|
75
|
+
```
|
|
76
|
+
|
|
58
77
|
## Props
|
|
59
78
|
|
|
60
79
|
Name | Type | Description | default | required
|
|
@@ -7,8 +7,6 @@ import { FormattedMessage, useIntl } from 'react-intl';
|
|
|
7
7
|
|
|
8
8
|
import { useQueryClient } from 'react-query';
|
|
9
9
|
|
|
10
|
-
import SafeHTMLMessage from '@folio/react-intl-safe-html';
|
|
11
|
-
|
|
12
10
|
import { Button, ConfirmationModal, Pane } from '@folio/stripes/components';
|
|
13
11
|
|
|
14
12
|
import FormModal from '../../FormModal/FormModal';
|
|
@@ -212,7 +210,7 @@ const CustomPropertiesSettings = ({
|
|
|
212
210
|
id="delete-job-confirmation"
|
|
213
211
|
message={
|
|
214
212
|
labelOverrides?.confirmMessage ??
|
|
215
|
-
<
|
|
213
|
+
<FormattedMessage id="stripes-kint-components.customProperties.delete.confirmMessage" values={{ name: customProperty?.name }} />
|
|
216
214
|
}
|
|
217
215
|
onCancel={() => setDeleteModal(false)}
|
|
218
216
|
onConfirm={() => {
|
|
@@ -113,7 +113,7 @@ const CustomPropertyCard = ({
|
|
|
113
113
|
{renderValue()}
|
|
114
114
|
</KeyValue>
|
|
115
115
|
</Col>
|
|
116
|
-
{customProperty?.
|
|
116
|
+
{customProperty?.note ? (
|
|
117
117
|
<Col xs={6}>
|
|
118
118
|
<KeyValue
|
|
119
119
|
label={
|
|
@@ -124,7 +124,7 @@ const CustomPropertyCard = ({
|
|
|
124
124
|
<span
|
|
125
125
|
style={{ whiteSpace: 'pre-wrap' }}
|
|
126
126
|
>
|
|
127
|
-
{customProperty.
|
|
127
|
+
{customProperty.note}
|
|
128
128
|
</span>
|
|
129
129
|
</KeyValue>
|
|
130
130
|
</Col>
|
|
@@ -8,10 +8,11 @@ import ActionList from '../ActionList';
|
|
|
8
8
|
|
|
9
9
|
const propTypes = {
|
|
10
10
|
desc: PropTypes.string,
|
|
11
|
+
label: PropTypes.string,
|
|
11
12
|
refdataEndpoint: PropTypes.string
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
const EditableRefdataList = ({ desc, refdataEndpoint }) => {
|
|
15
|
+
const EditableRefdataList = ({ desc, label, refdataEndpoint }) => {
|
|
15
16
|
/* A component that allows for editing of refdata values */
|
|
16
17
|
|
|
17
18
|
// fetch refdata values
|
|
@@ -89,6 +90,7 @@ const EditableRefdataList = ({ desc, refdataEndpoint }) => {
|
|
|
89
90
|
editableFields={{
|
|
90
91
|
value: () => false
|
|
91
92
|
}}
|
|
93
|
+
label={label}
|
|
92
94
|
visibleFields={['label', 'value']}
|
|
93
95
|
/>
|
|
94
96
|
);
|
|
@@ -9,6 +9,7 @@ import EditableSettingsListFieldArray from './EditableSettingsListFieldArray';
|
|
|
9
9
|
const EditableSettingsList = ({
|
|
10
10
|
data,
|
|
11
11
|
initialValues,
|
|
12
|
+
label,
|
|
12
13
|
onSave
|
|
13
14
|
}) => {
|
|
14
15
|
return (
|
|
@@ -26,6 +27,7 @@ const EditableSettingsList = ({
|
|
|
26
27
|
<FieldArray
|
|
27
28
|
component={EditableSettingsListFieldArray}
|
|
28
29
|
data={data}
|
|
30
|
+
label={label}
|
|
29
31
|
name="settings"
|
|
30
32
|
onSave={onSave}
|
|
31
33
|
/>
|
|
@@ -40,7 +42,12 @@ EditableSettingsList.propTypes = {
|
|
|
40
42
|
data: PropTypes.shape({
|
|
41
43
|
refdatavalues: PropTypes.arrayOf(PropTypes.object)
|
|
42
44
|
}),
|
|
43
|
-
initialValues: PropTypes.object
|
|
45
|
+
initialValues: PropTypes.object,
|
|
46
|
+
label: PropTypes.oneOfType([
|
|
47
|
+
PropTypes.string,
|
|
48
|
+
PropTypes.node,
|
|
49
|
+
PropTypes.object
|
|
50
|
+
])
|
|
44
51
|
};
|
|
45
52
|
|
|
46
53
|
export default EditableSettingsList;
|
|
@@ -16,7 +16,8 @@ const FormModal = ({
|
|
|
16
16
|
onSubmit={onSubmit}
|
|
17
17
|
{...formProps}
|
|
18
18
|
>
|
|
19
|
-
{({ handleSubmit, form: { restart } }) => {
|
|
19
|
+
{({ handleSubmit, form: { getState, restart } }) => {
|
|
20
|
+
const formState = getState();
|
|
20
21
|
const handleClose = (e) => {
|
|
21
22
|
onClose(e);
|
|
22
23
|
restart();
|
|
@@ -24,15 +25,18 @@ const FormModal = ({
|
|
|
24
25
|
|
|
25
26
|
const renderFooter = () => {
|
|
26
27
|
if (footer) {
|
|
27
|
-
return footer({ handleSubmit, handleClose });
|
|
28
|
+
return footer({ formState, handleSubmit, handleClose });
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
const { invalid, pristine, submitting } = formState;
|
|
30
32
|
return (
|
|
31
33
|
<ModalFooter>
|
|
32
34
|
<Button
|
|
33
35
|
buttonStyle="primary"
|
|
36
|
+
disabled={submitting || invalid || pristine}
|
|
34
37
|
marginBottom0
|
|
35
38
|
onClick={handleSubmit}
|
|
39
|
+
type="submit"
|
|
36
40
|
>
|
|
37
41
|
{
|
|
38
42
|
labelOverrides.save ??
|
|
@@ -199,9 +199,16 @@ const SASQLookupComponent = (props) => {
|
|
|
199
199
|
>
|
|
200
200
|
<Body
|
|
201
201
|
data={data}
|
|
202
|
+
filterPaneVisible={filterPaneVisible}
|
|
202
203
|
query={query}
|
|
203
204
|
toggleFilterPane={toggleFilterPane}
|
|
204
205
|
{...restOfInfiniteQueryProps}
|
|
206
|
+
{...sasqRenderProps}
|
|
207
|
+
/*
|
|
208
|
+
* This is insane, it looks like SASQProps `initialSortState`
|
|
209
|
+
* needs to be passed through to MCL, as it relies on MCL calling the initial
|
|
210
|
+
* sort handler. Passing through SASQProps.
|
|
211
|
+
*/
|
|
205
212
|
{...sasqProps}
|
|
206
213
|
{...props}
|
|
207
214
|
/>
|
|
@@ -4,7 +4,7 @@ import classnames from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import get from 'lodash/get';
|
|
6
6
|
|
|
7
|
-
import { EndOfList, IconButton,
|
|
7
|
+
import { EndOfList, IconButton, Popper } from '@folio/stripes/components';
|
|
8
8
|
|
|
9
9
|
import SearchField from '../SearchField';
|
|
10
10
|
import css from '../../../styles/TypeDown.css';
|
|
@@ -179,10 +179,12 @@ const Typedown = ({
|
|
|
179
179
|
<SearchField
|
|
180
180
|
// Pass meta through so correct styling gets applied to the TextField
|
|
181
181
|
id={`typedown-searchField-${selectorSafe(input.name)}`}
|
|
182
|
+
label={label}
|
|
182
183
|
marginBottom0
|
|
183
184
|
meta={meta}
|
|
184
185
|
onChange={handleType}
|
|
185
186
|
onKeyDown={searchFieldKeyDownHandler}
|
|
187
|
+
required={required}
|
|
186
188
|
/>
|
|
187
189
|
</div>
|
|
188
190
|
);
|
|
@@ -195,16 +197,8 @@ const Typedown = ({
|
|
|
195
197
|
css.typedown,
|
|
196
198
|
className
|
|
197
199
|
)}
|
|
200
|
+
id={`typedown-id-${id}`}
|
|
198
201
|
>
|
|
199
|
-
{label &&
|
|
200
|
-
<Label
|
|
201
|
-
htmlFor={id}
|
|
202
|
-
id={`${id}-label`}
|
|
203
|
-
required={required}
|
|
204
|
-
>
|
|
205
|
-
{label}
|
|
206
|
-
</Label>
|
|
207
|
-
}
|
|
208
202
|
{renderSearchField()}
|
|
209
203
|
<Popper
|
|
210
204
|
key="typedown-menu-toggle"
|
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useMutation, useQuery } from 'react-query';
|
|
3
3
|
import { useOkapiKy } from '@folio/stripes/core';
|
|
4
|
+
import { generateKiwtQueryParams } from '../../utils';
|
|
4
5
|
|
|
5
6
|
const useSettingSection = ({
|
|
6
7
|
sectionName,
|
|
7
8
|
settingEndpoint
|
|
8
9
|
}) => {
|
|
9
10
|
const ky = useOkapiKy();
|
|
11
|
+
const queryParams = generateKiwtQueryParams({
|
|
12
|
+
filters: [
|
|
13
|
+
{
|
|
14
|
+
path: 'section',
|
|
15
|
+
value: sectionName
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
sort: [
|
|
19
|
+
{
|
|
20
|
+
path: 'key'
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
perPage: 100,
|
|
24
|
+
stats: false
|
|
25
|
+
}, {});
|
|
26
|
+
|
|
10
27
|
const { data: settings = [] } = useQuery(
|
|
11
|
-
['stripes-kint-components', 'useSetting', 'appSettings', sectionName],
|
|
12
|
-
() => ky(`${settingEndpoint}
|
|
28
|
+
['stripes-kint-components', 'useSetting', 'appSettings', queryParams, sectionName],
|
|
29
|
+
() => ky(`${settingEndpoint}?${queryParams?.join('&')}`).json()
|
|
13
30
|
);
|
|
14
31
|
|
|
15
32
|
const { mutateAsync: putSetting } = useMutation(
|
|
@@ -10,7 +10,7 @@ import { Settings } from '@folio/stripes/smart-components';
|
|
|
10
10
|
import { SettingPage, SettingPagePane } from '../../SettingPage';
|
|
11
11
|
import { SettingsContext } from '../../contexts';
|
|
12
12
|
|
|
13
|
-
import { sortByLabel, toCamelCase } from '../../utils';
|
|
13
|
+
import { generateKiwtQueryParams, sortByLabel, toCamelCase } from '../../utils';
|
|
14
14
|
|
|
15
15
|
const useSettings = ({
|
|
16
16
|
dynamicPageExclusions,
|
|
@@ -22,12 +22,19 @@ const useSettings = ({
|
|
|
22
22
|
}) => {
|
|
23
23
|
const ky = useOkapiKy();
|
|
24
24
|
const intl = useIntl();
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const queryParams = generateKiwtQueryParams({
|
|
26
|
+
filters: dynamicPageExclusions?.map(dpe => ({
|
|
27
|
+
path: 'section',
|
|
28
|
+
comparator: '!=',
|
|
29
|
+
value: dpe
|
|
30
|
+
})),
|
|
31
|
+
perPage: 100,
|
|
32
|
+
stats: false
|
|
33
|
+
}, {});
|
|
27
34
|
|
|
28
35
|
const { data: appSettings = [], isLoading } = useQuery(
|
|
29
|
-
['stripes-kint-components', 'useSettings', 'appSettings', settingEndpoint],
|
|
30
|
-
() => ky(`${settingEndpoint}?${
|
|
36
|
+
['stripes-kint-components', 'useSettings', 'appSettings', settingEndpoint, queryParams],
|
|
37
|
+
() => ky(`${settingEndpoint}?${queryParams?.join('&')}`).json()
|
|
31
38
|
);
|
|
32
39
|
|
|
33
40
|
const sections = [...new Set(appSettings.map(s => s.section))];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import escapeRegExp from 'lodash/escapeRegExp';
|
|
2
2
|
|
|
3
3
|
const matchString = (match, str, ignoreNull = true) => {
|
|
4
|
-
const regex = new RegExp(`${match.split(/(\s+)/).filter(h => h.trim()).map(hl => '(' + escapeRegExp(hl) + ')').join('|')}`, 'gi')
|
|
4
|
+
const regex = new RegExp(`${match.split(/(\s+)/).filter(h => h.trim()).map(hl => '(' + escapeRegExp(hl) + ')').join('|')}`, 'gi');
|
|
5
5
|
if (ignoreNull && !match) {
|
|
6
6
|
const nullRegex = /a^/gi; // Should match nothing
|
|
7
7
|
|