@k-int/stripes-kint-components 5.8.0 → 5.8.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 +14 -0
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +1 -1
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +2 -2
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +1 -1
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +1 -1
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +5 -5
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.test.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesView.test.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +1 -1
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +3 -3
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +1 -1
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +8 -8
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +12 -12
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +1 -1
- package/es/lib/NumberField/NumberField.js +12 -2
- package/package.json +2 -2
- package/src/lib/EditableSettingsList/SettingField/EditSettingValue.js +1 -1
- package/src/lib/NumberField/NumberField.js +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [5.8.2](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/compare/v5.8.1...v5.8.2) (2024-09-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* NumberField blur ([54ed21f](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/commit/54ed21f60e89ec2035ea2b42c1f9b158c657c0be))
|
|
7
|
+
|
|
8
|
+
## [5.8.1](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/compare/v5.8.0...v5.8.1) (2024-07-22)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* NumberField treating 0 as undefined ([75bd7d3](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/commit/75bd7d33c77f103df6dd0efdde059b90dc3a9b8f))
|
|
14
|
+
|
|
1
15
|
# [5.8.0](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/compare/v5.7.1...v5.8.0) (2024-06-27)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -13,7 +13,7 @@ jest.mock('../../SearchField', () => () => /*#__PURE__*/(0, _jsxRuntime.jsx)("di
|
|
|
13
13
|
describe('CustomPropertiesLookup', () => {
|
|
14
14
|
let renderComponent;
|
|
15
15
|
beforeEach(() => {
|
|
16
|
-
renderComponent = (0, _renderWithKintHarness.default)(
|
|
16
|
+
renderComponent = (0, _renderWithKintHarness.default)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
17
17
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesLookup.default, {
|
|
18
18
|
contextFilterOptions: [{
|
|
19
19
|
'value': '',
|
|
@@ -174,7 +174,7 @@ const CustomPropertiesSettings = _ref => {
|
|
|
174
174
|
} = _ref2;
|
|
175
175
|
const actionsArray = [];
|
|
176
176
|
if (editCondition) {
|
|
177
|
-
actionsArray.push(
|
|
177
|
+
actionsArray.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
178
178
|
buttonStyle: "dropdownItem",
|
|
179
179
|
marginBottom0: true,
|
|
180
180
|
onClick: () => setMode(EDITING),
|
|
@@ -188,7 +188,7 @@ const CustomPropertiesSettings = _ref => {
|
|
|
188
188
|
}, `${customProperty.name}-action-edit`));
|
|
189
189
|
}
|
|
190
190
|
if (deleteCondition) {
|
|
191
|
-
actionsArray.push(
|
|
191
|
+
actionsArray.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
192
192
|
buttonStyle: "dropdownItem",
|
|
193
193
|
marginBottom0: true,
|
|
194
194
|
onClick: () => {
|
|
@@ -17,7 +17,7 @@ jest.mock('./CustomPropertiesLookup', () => () => /*#__PURE__*/(0, _jsxRuntime.j
|
|
|
17
17
|
describe('CustomPropertiesSettings', () => {
|
|
18
18
|
let renderComponent;
|
|
19
19
|
beforeEach(() => {
|
|
20
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
20
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
21
21
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesSettings.default, {
|
|
22
22
|
contextFilterOptions: [{
|
|
23
23
|
'value': '',
|
|
@@ -22,7 +22,7 @@ jest.mock('../../hooks');
|
|
|
22
22
|
describe('CustomPropertyForm', () => {
|
|
23
23
|
let renderComponent;
|
|
24
24
|
beforeEach(() => {
|
|
25
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
25
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
26
26
|
initialValues: initialValues,
|
|
27
27
|
onSubmit: onSubmit,
|
|
28
28
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyForm.default, {
|
|
@@ -11,7 +11,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
11
11
|
jest.mock('../../hooks');
|
|
12
12
|
describe('CustomPropertyView', () => {
|
|
13
13
|
beforeEach(() => {
|
|
14
|
-
(0, _jest.renderWithKintHarness)(
|
|
14
|
+
(0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
15
15
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyView.default, {
|
|
16
16
|
customProperty: _customProperties.default?.find(cp => cp.name === 'Eligible authors')
|
|
17
17
|
})
|
|
@@ -13,7 +13,7 @@ jest.mock('./CustomPropertiesEditCtx', () => () => /*#__PURE__*/(0, _jsxRuntime.
|
|
|
13
13
|
describe('CustomPropertiesEdit', () => {
|
|
14
14
|
let renderComponent;
|
|
15
15
|
beforeEach(() => {
|
|
16
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
16
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
17
17
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesEdit.default, {
|
|
18
18
|
contexts: ['isNull', 'OpenAccess'],
|
|
19
19
|
customPropertiesEndpoint: "erm/custprops",
|
|
@@ -14,7 +14,7 @@ jest.mock('../../hooks');
|
|
|
14
14
|
describe('CustomPropertiesEditCtx', () => {
|
|
15
15
|
let renderComponent;
|
|
16
16
|
beforeEach(() => {
|
|
17
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
17
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
18
18
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesEditCtx.default, {
|
|
19
19
|
ctx: "OpenAccess",
|
|
20
20
|
customPropertiesEndpoint: "erm/custprops",
|
|
@@ -16,7 +16,7 @@ jest.mock('./CustomPropertyFormCard', () => () => /*#__PURE__*/(0, _jsxRuntime.j
|
|
|
16
16
|
describe('CustomPropertiesListField', () => {
|
|
17
17
|
let renderComponent;
|
|
18
18
|
beforeEach(() => {
|
|
19
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
19
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
20
20
|
initialValues: _testResources.initialValues,
|
|
21
21
|
onSubmit: onSubmit,
|
|
22
22
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesListField.default, {
|
|
@@ -30,7 +30,7 @@ describe('CustomPropertyField', () => {
|
|
|
30
30
|
let renderComponent;
|
|
31
31
|
describe('CustomPropertyField', () => {
|
|
32
32
|
beforeEach(() => {
|
|
33
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
33
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
34
34
|
initialValues: _testResources.initialValues,
|
|
35
35
|
onSubmit: onSubmit,
|
|
36
36
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, {
|
|
@@ -82,7 +82,7 @@ describe('CustomPropertyField', () => {
|
|
|
82
82
|
});
|
|
83
83
|
describe('Decimal field', () => {
|
|
84
84
|
beforeEach(() => {
|
|
85
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
85
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
86
86
|
initialValues: _testResources.initialValues,
|
|
87
87
|
onSubmit: onSubmit,
|
|
88
88
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, {
|
|
@@ -100,7 +100,7 @@ describe('CustomPropertyField', () => {
|
|
|
100
100
|
});
|
|
101
101
|
describe('Integer field', () => {
|
|
102
102
|
beforeEach(() => {
|
|
103
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
103
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
104
104
|
initialValues: _testResources.initialValues,
|
|
105
105
|
onSubmit: onSubmit,
|
|
106
106
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, {
|
|
@@ -120,7 +120,7 @@ describe('CustomPropertyField', () => {
|
|
|
120
120
|
});
|
|
121
121
|
describe('Refdata multi-select field', () => {
|
|
122
122
|
beforeEach(() => {
|
|
123
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
123
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
124
124
|
initialValues: _testResources.initialValues,
|
|
125
125
|
onSubmit: onSubmit,
|
|
126
126
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, {
|
|
@@ -147,7 +147,7 @@ describe('CustomPropertyField', () => {
|
|
|
147
147
|
});
|
|
148
148
|
describe('Date field', () => {
|
|
149
149
|
beforeEach(() => {
|
|
150
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
150
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
151
151
|
initialValues: _testResources.initialValues,
|
|
152
152
|
onSubmit: onSubmit,
|
|
153
153
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyField.default, {
|
|
@@ -18,7 +18,7 @@ const setCustomProperties = jest.fn();
|
|
|
18
18
|
describe('CustomPropertyFormCard', () => {
|
|
19
19
|
let renderComponent;
|
|
20
20
|
beforeEach(() => {
|
|
21
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
21
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyFormCard.default, {
|
|
22
22
|
availableCustomProperties: _customProperties.availableCustomProperties,
|
|
23
23
|
customProperties: _customProperties.default,
|
|
24
24
|
customProperty: customProperty,
|
|
@@ -16,7 +16,7 @@ jest.mock('./CustomPropertiesFilterForm', () => () => /*#__PURE__*/(0, _jsxRunti
|
|
|
16
16
|
describe('CustomPropertiesFilter', () => {
|
|
17
17
|
let renderComponent;
|
|
18
18
|
beforeEach(() => {
|
|
19
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
19
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
20
20
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesFilter.default, {
|
|
21
21
|
activeFilters: _testResources.activeFilters,
|
|
22
22
|
customPropertiesEndpoint: "erm/custprops",
|
|
@@ -14,7 +14,7 @@ jest.mock('../../hooks');
|
|
|
14
14
|
const onSubmit = jest.fn();
|
|
15
15
|
let renderComponent;
|
|
16
16
|
describe('CustomPropertiesFilterField', () => {
|
|
17
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
17
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
18
18
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
19
19
|
initialValues: {
|
|
20
20
|
filters: _testResources.data.filters
|
|
@@ -16,7 +16,7 @@ const onSubmit = jest.fn();
|
|
|
16
16
|
let renderComponent;
|
|
17
17
|
describe('CustomPropertiesFilterFieldArray', () => {
|
|
18
18
|
beforeEach(() => {
|
|
19
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
19
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
20
20
|
onSubmit: onSubmit,
|
|
21
21
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, {
|
|
22
22
|
component: _CustomPropertiesFilterFieldArray.default,
|
|
@@ -15,7 +15,7 @@ const onSubmit = jest.fn();
|
|
|
15
15
|
describe('CustomPropertyFiltersForm', () => {
|
|
16
16
|
let renderComponent;
|
|
17
17
|
beforeEach(() => {
|
|
18
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
18
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesFilterForm.default, {
|
|
19
19
|
onSubmit: onSubmit,
|
|
20
20
|
..._testResources.data
|
|
21
21
|
}));
|
|
@@ -13,7 +13,7 @@ jest.mock('../../hooks');
|
|
|
13
13
|
const clearRuleValue = () => {};
|
|
14
14
|
describe('CustomPropertiesRule', () => {
|
|
15
15
|
beforeEach(() => {
|
|
16
|
-
(0, _jest.renderWithKintHarness)(
|
|
16
|
+
(0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
17
17
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
18
18
|
onSubmit: onSubmit,
|
|
19
19
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesRule.default, {
|
|
@@ -15,7 +15,7 @@ jest.mock('./CustomPropertiesViewCtx', () => () => /*#__PURE__*/(0, _jsxRuntime.
|
|
|
15
15
|
describe('CustomPropertiesView', () => {
|
|
16
16
|
let renderComponent;
|
|
17
17
|
beforeEach(() => {
|
|
18
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
18
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
19
19
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesView.default, {
|
|
20
20
|
contexts: _testResources.contexts,
|
|
21
21
|
customProperties: _testResources.customProperties,
|
|
@@ -15,7 +15,7 @@ jest.mock('./CustomPropertyCard', () => () => /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
|
15
15
|
describe('CustomPropertiesViewCtx', () => {
|
|
16
16
|
let renderComponent;
|
|
17
17
|
beforeEach(() => {
|
|
18
|
-
renderComponent = (0, _jest.renderWithKintHarness)(
|
|
18
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
19
19
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesViewCtx.default, {
|
|
20
20
|
..._testResources.data
|
|
21
21
|
})
|
|
@@ -44,7 +44,7 @@ describe('EditableSettingsListFieldArray', () => {
|
|
|
44
44
|
describe('with empty initial values', () => {
|
|
45
45
|
let renderComponent;
|
|
46
46
|
beforeEach(async () => {
|
|
47
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
47
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
48
48
|
initialValues: {},
|
|
49
49
|
onSubmit: onSubmit,
|
|
50
50
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, {
|
|
@@ -63,7 +63,7 @@ describe('EditableSettingsListFieldArray', () => {
|
|
|
63
63
|
describe('with initial value set', () => {
|
|
64
64
|
let renderComponent;
|
|
65
65
|
beforeEach(async () => {
|
|
66
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
66
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
67
67
|
initialValues: {
|
|
68
68
|
settings
|
|
69
69
|
},
|
|
@@ -84,7 +84,7 @@ describe('EditableSettingsListFieldArray', () => {
|
|
|
84
84
|
describe('with multiple initial values set', () => {
|
|
85
85
|
let renderComponent;
|
|
86
86
|
beforeEach(async () => {
|
|
87
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
87
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
88
88
|
initialValues: {
|
|
89
89
|
settings: multipleSettings
|
|
90
90
|
},
|
|
@@ -32,7 +32,7 @@ const EditSettingValue = props => {
|
|
|
32
32
|
|
|
33
33
|
// Adding default sort to refdata object in ascending order by label
|
|
34
34
|
const sortByLabel = (a, b) => a.label.localeCompare(b.label);
|
|
35
|
-
const sortedRefdata = refdata
|
|
35
|
+
const sortedRefdata = refdata?.sort(sortByLabel);
|
|
36
36
|
switch (setting.settingType) {
|
|
37
37
|
case 'Refdata':
|
|
38
38
|
// Grab refdata values corresponding to setting
|
|
@@ -79,7 +79,7 @@ describe('EditSettingValue', () => {
|
|
|
79
79
|
describe('with no initial value', () => {
|
|
80
80
|
let renderComponent;
|
|
81
81
|
beforeEach(() => {
|
|
82
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
82
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
83
83
|
initialValues: {},
|
|
84
84
|
onSubmit: onSubmit,
|
|
85
85
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditSettingValue.default, {
|
|
@@ -102,7 +102,7 @@ describe('EditSettingValue', () => {
|
|
|
102
102
|
describe('with initial value', () => {
|
|
103
103
|
let renderComponent;
|
|
104
104
|
beforeEach(() => {
|
|
105
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
105
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
106
106
|
initialValues: {
|
|
107
107
|
test: {
|
|
108
108
|
value: stringSetting.value
|
|
@@ -134,7 +134,7 @@ describe('EditSettingValue', () => {
|
|
|
134
134
|
describe('with no initial value for refdata with <4 options', () => {
|
|
135
135
|
let renderComponent;
|
|
136
136
|
beforeEach(() => {
|
|
137
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
137
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
138
138
|
initialValues: {},
|
|
139
139
|
onSubmit: onSubmit,
|
|
140
140
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditSettingValue.default, {
|
|
@@ -178,7 +178,7 @@ describe('EditSettingValue', () => {
|
|
|
178
178
|
describe('with initial value for refdata with <4 options', () => {
|
|
179
179
|
let renderComponent;
|
|
180
180
|
beforeEach(() => {
|
|
181
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
181
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
182
182
|
initialValues: {
|
|
183
183
|
test: {
|
|
184
184
|
value: refdataSetting.value
|
|
@@ -226,7 +226,7 @@ describe('EditSettingValue', () => {
|
|
|
226
226
|
describe('with no initial value for refdata with >4 options', () => {
|
|
227
227
|
let renderComponent;
|
|
228
228
|
beforeEach(() => {
|
|
229
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
229
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
230
230
|
initialValues: {},
|
|
231
231
|
onSubmit: onSubmit,
|
|
232
232
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditSettingValue.default, {
|
|
@@ -273,7 +273,7 @@ describe('EditSettingValue', () => {
|
|
|
273
273
|
describe('with initial value for refdata with >4 options', () => {
|
|
274
274
|
let renderComponent;
|
|
275
275
|
beforeEach(() => {
|
|
276
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
276
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
277
277
|
initialValues: {
|
|
278
278
|
test: {
|
|
279
279
|
value: refdataSetting.value
|
|
@@ -326,7 +326,7 @@ describe('EditSettingValue', () => {
|
|
|
326
326
|
describe('with no initial value', () => {
|
|
327
327
|
let renderComponent;
|
|
328
328
|
beforeEach(() => {
|
|
329
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
329
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
330
330
|
initialValues: {},
|
|
331
331
|
onSubmit: onSubmit,
|
|
332
332
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditSettingValue.default, {
|
|
@@ -372,7 +372,7 @@ describe('EditSettingValue', () => {
|
|
|
372
372
|
describe('with initial value', () => {
|
|
373
373
|
let renderComponent;
|
|
374
374
|
beforeEach(() => {
|
|
375
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
375
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
376
376
|
initialValues: {
|
|
377
377
|
test: {
|
|
378
378
|
value: templateSetting.value
|
|
@@ -108,7 +108,7 @@ describe('RenderSettingValue', () => {
|
|
|
108
108
|
describe('render a string setting', () => {
|
|
109
109
|
let renderComponent;
|
|
110
110
|
beforeEach(async () => {
|
|
111
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
111
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderSettingValue.default, {
|
|
112
112
|
currentSetting: stringSetting,
|
|
113
113
|
input: {
|
|
114
114
|
name: 'test'
|
|
@@ -125,7 +125,7 @@ describe('RenderSettingValue', () => {
|
|
|
125
125
|
describe('render a string setting without a value', () => {
|
|
126
126
|
let renderComponent;
|
|
127
127
|
beforeEach(async () => {
|
|
128
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
128
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderSettingValue.default, {
|
|
129
129
|
currentSetting: stringSettingNoValue,
|
|
130
130
|
input: {
|
|
131
131
|
name: 'test'
|
|
@@ -142,7 +142,7 @@ describe('RenderSettingValue', () => {
|
|
|
142
142
|
describe('render a string setting without a value or default', () => {
|
|
143
143
|
let renderComponent;
|
|
144
144
|
beforeEach(async () => {
|
|
145
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
145
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderSettingValue.default, {
|
|
146
146
|
currentSetting: stringSettingNoValueOrDefault,
|
|
147
147
|
input: {
|
|
148
148
|
name: 'test'
|
|
@@ -161,7 +161,7 @@ describe('RenderSettingValue', () => {
|
|
|
161
161
|
describe('render a refdata setting', () => {
|
|
162
162
|
let renderComponent;
|
|
163
163
|
beforeEach(async () => {
|
|
164
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
164
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderSettingValue.default, {
|
|
165
165
|
currentSetting: refdataSetting,
|
|
166
166
|
input: {
|
|
167
167
|
name: 'test'
|
|
@@ -179,7 +179,7 @@ describe('RenderSettingValue', () => {
|
|
|
179
179
|
describe('render a refdata setting without a value', () => {
|
|
180
180
|
let renderComponent;
|
|
181
181
|
beforeEach(async () => {
|
|
182
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
182
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderSettingValue.default, {
|
|
183
183
|
currentSetting: refdataSettingNoValue,
|
|
184
184
|
input: {
|
|
185
185
|
name: 'test'
|
|
@@ -197,7 +197,7 @@ describe('RenderSettingValue', () => {
|
|
|
197
197
|
describe('render a refdata setting without a value or default', () => {
|
|
198
198
|
let renderComponent;
|
|
199
199
|
beforeEach(async () => {
|
|
200
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
200
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderSettingValue.default, {
|
|
201
201
|
currentSetting: refdataSettingNoValueOrDefault,
|
|
202
202
|
input: {
|
|
203
203
|
name: 'test'
|
|
@@ -217,7 +217,7 @@ describe('RenderSettingValue', () => {
|
|
|
217
217
|
describe('render a password setting', () => {
|
|
218
218
|
let renderComponent;
|
|
219
219
|
beforeEach(async () => {
|
|
220
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
220
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderSettingValue.default, {
|
|
221
221
|
currentSetting: passwordSetting,
|
|
222
222
|
input: {
|
|
223
223
|
name: 'test'
|
|
@@ -234,7 +234,7 @@ describe('RenderSettingValue', () => {
|
|
|
234
234
|
describe('render a password setting without a value', () => {
|
|
235
235
|
let renderComponent;
|
|
236
236
|
beforeEach(async () => {
|
|
237
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
237
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderSettingValue.default, {
|
|
238
238
|
currentSetting: passwordSettingNoValue,
|
|
239
239
|
input: {
|
|
240
240
|
name: 'test'
|
|
@@ -251,7 +251,7 @@ describe('RenderSettingValue', () => {
|
|
|
251
251
|
describe('render a password setting without a value or default', () => {
|
|
252
252
|
let renderComponent;
|
|
253
253
|
beforeEach(async () => {
|
|
254
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
254
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderSettingValue.default, {
|
|
255
255
|
currentSetting: passwordSettingNoValueOrDefault,
|
|
256
256
|
input: {
|
|
257
257
|
name: 'test'
|
|
@@ -270,7 +270,7 @@ describe('RenderSettingValue', () => {
|
|
|
270
270
|
describe('render a template setting', () => {
|
|
271
271
|
let renderComponent;
|
|
272
272
|
beforeEach(async () => {
|
|
273
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
273
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderSettingValue.default, {
|
|
274
274
|
currentSetting: templateSetting,
|
|
275
275
|
input: {
|
|
276
276
|
name: 'test'
|
|
@@ -288,7 +288,7 @@ describe('RenderSettingValue', () => {
|
|
|
288
288
|
describe('render a template setting without a value', () => {
|
|
289
289
|
let renderComponent;
|
|
290
290
|
beforeEach(async () => {
|
|
291
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
291
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderSettingValue.default, {
|
|
292
292
|
currentSetting: templateSettingNoValue,
|
|
293
293
|
input: {
|
|
294
294
|
name: 'test'
|
|
@@ -306,7 +306,7 @@ describe('RenderSettingValue', () => {
|
|
|
306
306
|
describe('render a template setting without a value or default', () => {
|
|
307
307
|
let renderComponent;
|
|
308
308
|
beforeEach(async () => {
|
|
309
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
309
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RenderSettingValue.default, {
|
|
310
310
|
currentSetting: templateSettingNoValueOrDefault,
|
|
311
311
|
input: {
|
|
312
312
|
name: 'test'
|
|
@@ -27,7 +27,7 @@ const setting = {
|
|
|
27
27
|
describe('SettingField', () => {
|
|
28
28
|
let renderComponent;
|
|
29
29
|
beforeEach(async () => {
|
|
30
|
-
renderComponent = (0, _helpers.renderWithKintHarness)(
|
|
30
|
+
renderComponent = (0, _helpers.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_stripesErmTesting.TestForm, {
|
|
31
31
|
initialValues: {},
|
|
32
32
|
onSubmit: onSubmit,
|
|
33
33
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
@@ -4,14 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _noop = _interopRequireDefault(require("lodash/noop"));
|
|
10
10
|
var _components = require("@folio/stripes/components");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
const NumberField = props => {
|
|
14
14
|
const {
|
|
15
|
+
onBlur: passedOnBlur = _noop.default,
|
|
15
16
|
onChange: passedOnChange = _noop.default,
|
|
16
17
|
input,
|
|
17
18
|
value,
|
|
@@ -55,7 +56,7 @@ const NumberField = props => {
|
|
|
55
56
|
const parsedValue = parseFloat(e.target.value);
|
|
56
57
|
|
|
57
58
|
// ReturnValue needed for contorlled components
|
|
58
|
-
if (parsedValue) {
|
|
59
|
+
if (parsedValue || parsedValue === 0) {
|
|
59
60
|
setNumValue(parsedValue);
|
|
60
61
|
changeField(parsedValue);
|
|
61
62
|
} else {
|
|
@@ -68,6 +69,13 @@ const NumberField = props => {
|
|
|
68
69
|
ref: userInputRef,
|
|
69
70
|
...rest,
|
|
70
71
|
// Keep an eye on this
|
|
72
|
+
onBlur: event => {
|
|
73
|
+
// Make sure blur propogates to input
|
|
74
|
+
if (input.onBlur) {
|
|
75
|
+
input.onBlur(event);
|
|
76
|
+
}
|
|
77
|
+
passedOnBlur(event);
|
|
78
|
+
},
|
|
71
79
|
onChange: handleUserChange,
|
|
72
80
|
type: "number",
|
|
73
81
|
value: forceControl
|
|
@@ -82,9 +90,11 @@ const NumberField = props => {
|
|
|
82
90
|
});
|
|
83
91
|
};
|
|
84
92
|
NumberField.propTypes = {
|
|
93
|
+
onBlur: _propTypes.default.func,
|
|
85
94
|
onChange: _propTypes.default.func,
|
|
86
95
|
input: _propTypes.default.shape({
|
|
87
96
|
onChange: _propTypes.default.func.isRequired,
|
|
97
|
+
onBlur: _propTypes.default.func,
|
|
88
98
|
value: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
89
99
|
}),
|
|
90
100
|
value: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k-int/stripes-kint-components",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.2",
|
|
4
4
|
"description": "Stripes Component library for K-Int specific applications",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"lint": "eslint src --resolve-plugins-relative-to ./node_modules/@folio/eslint-config-stripes/",
|
|
11
11
|
"test": "yarn run test:jest",
|
|
12
|
-
"test:jest": "jest --ci --coverage",
|
|
12
|
+
"test:jest": "jest --ci --coverage --maxWorkers=50%",
|
|
13
13
|
"build:es": "rm -rf ./es && babel --extensions .js --ignore ./src/**/tests/**/* ./src --out-dir es",
|
|
14
14
|
"build": "yarn build:es",
|
|
15
15
|
"clean": "rm -rf ./node_modules ./*/node_modules ./yarn.lock && yarn install --ignore-scripts",
|
|
@@ -29,7 +29,7 @@ const EditSettingValue = (props) => {
|
|
|
29
29
|
|
|
30
30
|
// Adding default sort to refdata object in ascending order by label
|
|
31
31
|
const sortByLabel = (a, b) => (a.label.localeCompare(b.label));
|
|
32
|
-
const sortedRefdata = refdata
|
|
32
|
+
const sortedRefdata = refdata?.sort(sortByLabel);
|
|
33
33
|
|
|
34
34
|
switch (setting.settingType) {
|
|
35
35
|
case 'Refdata':
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
1
2
|
import {
|
|
2
3
|
useEffect,
|
|
3
4
|
useRef,
|
|
4
5
|
useState
|
|
5
6
|
} from 'react';
|
|
6
|
-
|
|
7
|
+
|
|
7
8
|
import noop from 'lodash/noop';
|
|
8
9
|
|
|
9
10
|
import {
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
|
|
15
16
|
const NumberField = (props) => {
|
|
16
17
|
const {
|
|
18
|
+
onBlur: passedOnBlur = noop,
|
|
17
19
|
onChange: passedOnChange = noop,
|
|
18
20
|
input,
|
|
19
21
|
value,
|
|
@@ -65,7 +67,7 @@ const NumberField = (props) => {
|
|
|
65
67
|
const parsedValue = parseFloat(e.target.value);
|
|
66
68
|
|
|
67
69
|
// ReturnValue needed for contorlled components
|
|
68
|
-
if (parsedValue) {
|
|
70
|
+
if (parsedValue || parsedValue === 0) {
|
|
69
71
|
setNumValue(parsedValue);
|
|
70
72
|
changeField(parsedValue);
|
|
71
73
|
} else {
|
|
@@ -79,6 +81,13 @@ const NumberField = (props) => {
|
|
|
79
81
|
<TextField
|
|
80
82
|
ref={userInputRef}
|
|
81
83
|
{...rest} // Keep an eye on this
|
|
84
|
+
onBlur={(event) => {
|
|
85
|
+
// Make sure blur propogates to input
|
|
86
|
+
if (input.onBlur) {
|
|
87
|
+
input.onBlur(event);
|
|
88
|
+
}
|
|
89
|
+
passedOnBlur(event);
|
|
90
|
+
}}
|
|
82
91
|
onChange={handleUserChange}
|
|
83
92
|
type="number"
|
|
84
93
|
value={forceControl}
|
|
@@ -96,9 +105,11 @@ const NumberField = (props) => {
|
|
|
96
105
|
};
|
|
97
106
|
|
|
98
107
|
NumberField.propTypes = {
|
|
108
|
+
onBlur: PropTypes.func,
|
|
99
109
|
onChange: PropTypes.func,
|
|
100
110
|
input: PropTypes.shape({
|
|
101
111
|
onChange: PropTypes.func.isRequired,
|
|
112
|
+
onBlur: PropTypes.func,
|
|
102
113
|
value: PropTypes.oneOfType([
|
|
103
114
|
PropTypes.number,
|
|
104
115
|
PropTypes.string
|