@k-int/stripes-kint-components 1.3.0 → 1.7.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 +34 -2
- package/es/artifacts/coverage-jest/lcov-report/block-navigation.js +109 -0
- package/es/artifacts/coverage-jest/lcov-report/prettify.js +998 -0
- package/es/artifacts/coverage-jest/lcov-report/sorter.js +238 -0
- package/es/index.js +69 -17
- package/es/lib/ActionList/ActionList.js +63 -24
- package/es/lib/ActionList/ActionListFieldArray.js +158 -96
- package/es/lib/ActionList/index.js +7 -3
- package/es/lib/EditableRefdataList/EditableRefdataList.js +69 -24
- package/es/lib/EditableRefdataList/index.js +7 -3
- package/es/lib/EditableSettingsList/EditableSettingsList.js +90 -0
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +90 -0
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +181 -0
- package/es/lib/{Settings → EditableSettingsList/SettingField}/EditSettingValue.js +72 -9
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +447 -0
- package/es/lib/{Settings → EditableSettingsList/SettingField}/RenderSettingValue.js +45 -7
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +495 -0
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +187 -0
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +180 -0
- package/es/lib/EditableSettingsList/SettingField/index.js +35 -0
- package/es/lib/EditableSettingsList/index.js +35 -0
- package/es/lib/NoResultsMessage/NoResultsMessage.js +122 -0
- package/es/lib/NoResultsMessage/index.js +19 -0
- package/es/lib/QueryTypedown/QueryTypedown.js +48 -9
- package/es/lib/QueryTypedown/index.js +6 -2
- package/es/lib/RefdataButtons/RefdataButtons.js +143 -0
- package/es/lib/RefdataButtons/index.js +19 -0
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +202 -131
- package/es/lib/SASQLookupComponent/index.js +6 -2
- package/es/lib/SASQRoute/SASQRoute.js +55 -18
- package/es/lib/SASQRoute/index.js +6 -2
- package/es/lib/SASQViewComponent/SASQViewComponent.js +50 -11
- package/es/lib/SASQViewComponent/index.js +6 -2
- package/es/lib/SearchField/SearchField.js +48 -13
- package/es/lib/SearchField/index.js +6 -2
- package/es/lib/SettingPage/SettingPage.js +99 -0
- package/es/lib/SettingPage/SettingPagePane.js +83 -0
- package/es/lib/SettingPage/index.js +27 -0
- package/es/lib/TypeDown/TypeDown.js +143 -101
- package/es/lib/TypeDown/index.js +6 -2
- package/es/lib/Typedown/Typedown.js +140 -96
- package/es/lib/Typedown/index.js +6 -2
- package/es/lib/constants/eventCodes.js +31 -1
- package/es/lib/contexts/SettingsContext.js +41 -0
- package/es/lib/contexts/index.js +19 -0
- package/es/lib/hooks/index.js +42 -8
- package/es/lib/hooks/settingsHooks/index.js +27 -0
- package/es/lib/hooks/settingsHooks/useSettingSection.js +74 -0
- package/es/lib/hooks/settingsHooks/useSettings.js +175 -0
- package/es/lib/hooks/typedownHooks/index.js +8 -28
- package/es/lib/hooks/typedownHooks/useTypedown.js +129 -12
- package/es/lib/hooks/typedownHooks/useTypedownData.js +35 -2
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +39 -6
- package/es/lib/hooks/useActiveElement.js +33 -2
- package/es/lib/hooks/useHelperApp.js +51 -12
- package/es/lib/hooks/useKiwtFieldArray.js +142 -0
- package/es/lib/hooks/useKiwtSASQuery.js +62 -7
- package/es/lib/hooks/useLocalStorageState.js +37 -4
- package/es/lib/hooks/useMutateRefdataValue.js +42 -9
- package/es/lib/hooks/useQIndex.js +108 -0
- package/es/lib/hooks/useRefdata.js +56 -12
- package/es/lib/hooks/useTemplates.js +36 -3
- package/es/lib/utils/buildUrl.js +43 -10
- package/es/lib/utils/generateKiwtQuery.js +31 -108
- package/es/lib/utils/generateKiwtQueryParams.js +154 -0
- package/es/lib/utils/index.js +55 -3
- package/es/lib/utils/refdataOptions.js +43 -0
- package/es/lib/utils/renderHelpText.js +109 -0
- package/es/lib/utils/selectorSafe.js +31 -2
- package/es/lib/utils/sortByLabel.js +55 -0
- package/es/lib/utils/toCamelCase.js +48 -0
- package/jest.config.js +15 -1
- package/junit.xml +79 -0
- package/package.json +17 -10
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +256 -0
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +799 -0
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +376 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +223 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +211 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +376 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +262 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +436 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +161 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +319 -0
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +184 -0
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +370 -0
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +949 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +274 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +250 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +214 -0
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +211 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +178 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/TypeDown.js.html +769 -0
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +790 -0
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/base.css +224 -0
- package/src/artifacts/coverage-jest/lcov-report/block-navigation.js +87 -0
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +116 -0
- package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +97 -0
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +251 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +115 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +163 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +403 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +161 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +520 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +163 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +163 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +157 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +283 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +274 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +178 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +136 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +301 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +208 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +268 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +166 -0
- package/src/artifacts/coverage-jest/lcov-report/index.html +401 -0
- package/src/artifacts/coverage-jest/lcov-report/prettify.css +1 -0
- package/src/artifacts/coverage-jest/lcov-report/prettify.js +2 -0
- package/src/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/sorter.js +196 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +193 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +109 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +286 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +236 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +121 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +106 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/renderHelpText.js.html +166 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +103 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +130 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +127 -0
- package/src/artifacts/coverage-jest/lcov.info +1999 -0
- package/src/index.js +21 -6
- package/src/lib/ActionList/ActionList.js +5 -2
- package/src/lib/ActionList/ActionListFieldArray.js +20 -8
- package/src/lib/ActionList/README.md +1 -0
- package/src/lib/ActionList/index.js +1 -1
- package/src/lib/EditableRefdataList/EditableRefdataList.js +10 -5
- package/src/lib/EditableRefdataList/index.js +1 -1
- package/src/lib/{Settings → EditableSettingsList}/EditableSettingsList.js +0 -0
- package/src/lib/{Settings → EditableSettingsList}/EditableSettingsListFieldArray.js +2 -2
- package/src/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +111 -0
- package/src/lib/{Settings → EditableSettingsList/SettingField}/EditSettingValue.js +24 -1
- package/src/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +379 -0
- package/src/lib/{Settings → EditableSettingsList/SettingField}/RenderSettingValue.js +2 -1
- package/src/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +368 -0
- package/src/lib/{Settings → EditableSettingsList/SettingField}/SettingField.js +7 -7
- package/src/lib/EditableSettingsList/SettingField/SettingField.test.js +80 -0
- package/src/lib/EditableSettingsList/SettingField/index.js +3 -0
- package/src/lib/EditableSettingsList/index.js +3 -0
- package/src/lib/NoResultsMessage/NoResultsMessage.js +78 -0
- package/src/lib/NoResultsMessage/index.js +1 -0
- package/src/lib/{Settings → RefdataButtons}/RefdataButtons.js +1 -1
- package/src/lib/RefdataButtons/index.js +1 -0
- package/src/lib/SASQLookupComponent/SASQLookupComponent.js +36 -8
- package/src/lib/SASQRoute/README.md +1 -1
- package/src/lib/{Settings → SettingPage}/SettingPage.js +5 -5
- package/src/lib/{Settings → SettingPage}/SettingPagePane.js +12 -2
- package/src/lib/SettingPage/index.js +2 -0
- package/src/lib/TypeDown/README.md +1 -115
- package/src/lib/TypeDown/TypeDown.js +4 -2
- package/src/lib/Typedown/Typedown.js +2 -1
- package/src/lib/{Settings → contexts}/SettingsContext.js +1 -1
- package/src/lib/contexts/index.js +2 -0
- package/src/lib/hooks/README.md +107 -0
- package/src/lib/hooks/index.js +3 -0
- package/src/lib/hooks/settingsHooks/index.js +2 -0
- package/src/lib/{Settings → hooks/settingsHooks}/useSettingSection.js +0 -0
- package/src/lib/{Settings → hooks/settingsHooks}/useSettings.js +14 -6
- package/src/lib/hooks/typedownHooks/index.js +0 -3
- package/src/lib/hooks/typedownHooks/useTypedown.js +93 -11
- package/src/lib/hooks/useHelperApp.js +5 -1
- package/src/lib/hooks/useKiwtFieldArray.js +63 -0
- package/src/lib/hooks/useKiwtSASQuery.js +9 -1
- package/src/lib/hooks/useQIndex.js +41 -0
- package/src/lib/hooks/useRefdata.js +17 -6
- package/src/lib/utils/README.md +39 -1
- package/src/lib/utils/generateKiwtQuery.js +3 -62
- package/src/lib/utils/generateKiwtQueryParams.js +67 -0
- package/src/lib/utils/index.js +10 -0
- package/src/lib/utils/refdataOptions.js +7 -0
- package/src/lib/{Settings/utils → utils}/renderHelpText.js +1 -1
- package/src/lib/{Settings/utils → utils}/sortByLabel.js +1 -1
- package/src/lib/{Settings/utils → utils}/toCamelCase.js +0 -0
- package/styles/NoResultsMessage.css +38 -0
- package/test/helpers/index.js +1 -0
- package/test/helpers/translationsProperties.js +40 -0
- package/test/jest/helpers/KintHarness.js +36 -0
- package/test/jest/helpers/index.js +2 -0
- package/test/jest/helpers/renderWithKintHarness.js +15 -0
- package/test/jest/jest-transformer.js +4 -0
- package/test/jest/setupTests.js +1 -0
- package/translations/stripes-kint-components/en.json +4 -1
- package/babelOptions.js +0 -30
- package/es/lib/Settings/EditableSettingsList.js +0 -57
- package/es/lib/Settings/EditableSettingsListFieldArray.js +0 -59
- package/es/lib/Settings/RefdataButtons.js +0 -100
- package/es/lib/Settings/SettingField.js +0 -144
- package/es/lib/Settings/SettingPage.js +0 -64
- package/es/lib/Settings/SettingPagePane.js +0 -43
- package/es/lib/Settings/SettingsContext.js +0 -18
- package/es/lib/Settings/index.js +0 -71
- package/es/lib/Settings/useSettingSection.js +0 -41
- package/es/lib/Settings/useSettings.js +0 -126
- package/es/lib/Settings/utils/index.js +0 -31
- package/es/lib/Settings/utils/renderHelpText.js +0 -57
- package/es/lib/Settings/utils/sortByLabel.js +0 -26
- package/es/lib/Settings/utils/toCamelCase.js +0 -19
- package/es/lib/hooks/typedownHooks/useTypedownFooter.js +0 -47
- package/es/lib/hooks/typedownHooks/useTypedownList.js +0 -45
- package/es/lib/hooks/typedownHooks/useTypedownSearchField.js +0 -47
- package/es/lib/utils/getFocusableElements.js +0 -132
- package/src/lib/Settings/index.js +0 -8
- package/src/lib/Settings/utils/index.js +0 -3
- package/src/lib/hooks/typedownHooks/useTypedownFooter.js +0 -43
- package/src/lib/hooks/typedownHooks/useTypedownList.js +0 -36
- package/src/lib/hooks/typedownHooks/useTypedownSearchField.js +0 -39
- package/src/lib/utils/getFocusableElements.js +0 -99
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@folio/stripes-erm-components/test/jest/__mock__';
|
|
3
|
+
import RenderSettingValue from './RenderSettingValue';
|
|
4
|
+
|
|
5
|
+
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const stringSetting = {
|
|
9
|
+
id: '12345',
|
|
10
|
+
key: 'testSettingKey',
|
|
11
|
+
section: 'testSettingSection',
|
|
12
|
+
settingType: 'String',
|
|
13
|
+
value: 'diku-shared',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const stringSettingNoValue = {
|
|
17
|
+
id: '12345',
|
|
18
|
+
key: 'testSettingKey',
|
|
19
|
+
section: 'testSettingSection',
|
|
20
|
+
settingType: 'String',
|
|
21
|
+
defValue: 'diku-shared',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const stringSettingNoValueOrDefault = {
|
|
25
|
+
id: '12345',
|
|
26
|
+
key: 'testSettingKey',
|
|
27
|
+
section: 'testSettingSection',
|
|
28
|
+
settingType: 'String'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const passwordSetting = {
|
|
32
|
+
id: '12345',
|
|
33
|
+
key: 'testSettingKey',
|
|
34
|
+
section: 'testSettingSection',
|
|
35
|
+
settingType: 'Password',
|
|
36
|
+
value: 'secret password',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const passwordSettingNoValue = {
|
|
40
|
+
id: '12345',
|
|
41
|
+
key: 'testSettingKey',
|
|
42
|
+
section: 'testSettingSection',
|
|
43
|
+
settingType: 'Password',
|
|
44
|
+
defValue: 'secret password',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const passwordSettingNoValueOrDefault = {
|
|
48
|
+
id: '12345',
|
|
49
|
+
key: 'testSettingKey',
|
|
50
|
+
section: 'testSettingSection',
|
|
51
|
+
settingType: 'Password'
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const refdata = [
|
|
55
|
+
{
|
|
56
|
+
value: 'test_refdata_value',
|
|
57
|
+
label: 'Test refdata value'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
value: 'other_refdata_value',
|
|
61
|
+
label: 'Other refdata value'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
value: 'final_refdata_value',
|
|
65
|
+
label: 'Final refdata value'
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
const refdataSetting = {
|
|
70
|
+
id: '12345',
|
|
71
|
+
key: 'testSettingKey',
|
|
72
|
+
section: 'testSettingSection',
|
|
73
|
+
settingType: 'Refdata',
|
|
74
|
+
value: 'test_refdata_value',
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const refdataSettingNoValue = {
|
|
78
|
+
id: '12345',
|
|
79
|
+
key: 'testSettingKey',
|
|
80
|
+
section: 'testSettingSection',
|
|
81
|
+
settingType: 'Refdata',
|
|
82
|
+
defValue: 'test_refdata_value',
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const refdataSettingNoValueOrDefault = {
|
|
86
|
+
id: '12345',
|
|
87
|
+
key: 'testSettingKey',
|
|
88
|
+
section: 'testSettingSection',
|
|
89
|
+
settingType: 'Refdata'
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const templates = [
|
|
93
|
+
{
|
|
94
|
+
id: 'abcde',
|
|
95
|
+
name: 'Test template'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: '98765',
|
|
99
|
+
name: 'Red herring template'
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
const templateSetting = {
|
|
104
|
+
id: '12345',
|
|
105
|
+
key: 'testSettingKey',
|
|
106
|
+
section: 'testSettingSection',
|
|
107
|
+
settingType: 'Template',
|
|
108
|
+
value: 'abcde',
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const templateSettingNoValue = {
|
|
112
|
+
id: '12345',
|
|
113
|
+
key: 'testSettingKey',
|
|
114
|
+
section: 'testSettingSection',
|
|
115
|
+
settingType: 'Template',
|
|
116
|
+
defValue: 'abcde',
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const templateSettingNoValueOrDefault = {
|
|
120
|
+
id: '12345',
|
|
121
|
+
key: 'testSettingKey',
|
|
122
|
+
section: 'testSettingSection',
|
|
123
|
+
settingType: 'Template'
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
describe('RenderSettingValue', () => {
|
|
127
|
+
describe('render string settings', () => {
|
|
128
|
+
describe('render a string setting', () => {
|
|
129
|
+
let renderComponent;
|
|
130
|
+
beforeEach(async () => {
|
|
131
|
+
renderComponent = renderWithKintHarness(
|
|
132
|
+
<RenderSettingValue
|
|
133
|
+
currentSetting={stringSetting}
|
|
134
|
+
input={{
|
|
135
|
+
name: 'test'
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('renders the value', () => {
|
|
142
|
+
const { getByText } = renderComponent;
|
|
143
|
+
expect(getByText('diku-shared')).toBeInTheDocument();
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
describe('render a string setting without a value', () => {
|
|
148
|
+
let renderComponent;
|
|
149
|
+
beforeEach(async () => {
|
|
150
|
+
renderComponent = renderWithKintHarness(
|
|
151
|
+
<RenderSettingValue
|
|
152
|
+
currentSetting={stringSettingNoValue}
|
|
153
|
+
input={{
|
|
154
|
+
name: 'test'
|
|
155
|
+
}}
|
|
156
|
+
/>
|
|
157
|
+
);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('renders the default value', () => {
|
|
161
|
+
const { getByText } = renderComponent;
|
|
162
|
+
expect(getByText('[default] diku-shared')).toBeInTheDocument();
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
describe('render a string setting without a value or default', () => {
|
|
167
|
+
let renderComponent;
|
|
168
|
+
beforeEach(async () => {
|
|
169
|
+
renderComponent = renderWithKintHarness(
|
|
170
|
+
<RenderSettingValue
|
|
171
|
+
currentSetting={stringSettingNoValueOrDefault}
|
|
172
|
+
input={{
|
|
173
|
+
name: 'test'
|
|
174
|
+
}}
|
|
175
|
+
/>
|
|
176
|
+
);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it('renders the empty message', () => {
|
|
180
|
+
const { getByText } = renderComponent;
|
|
181
|
+
expect(getByText('No current value')).toBeInTheDocument();
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
describe('render refdata settings', () => {
|
|
187
|
+
describe('render a refdata setting', () => {
|
|
188
|
+
let renderComponent;
|
|
189
|
+
beforeEach(async () => {
|
|
190
|
+
renderComponent = renderWithKintHarness(
|
|
191
|
+
<RenderSettingValue
|
|
192
|
+
currentSetting={refdataSetting}
|
|
193
|
+
input={{
|
|
194
|
+
name: 'test'
|
|
195
|
+
}}
|
|
196
|
+
refdata={refdata}
|
|
197
|
+
/>
|
|
198
|
+
);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('renders the value', () => {
|
|
202
|
+
const { getByText } = renderComponent;
|
|
203
|
+
expect(getByText('Test refdata value')).toBeInTheDocument();
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
describe('render a refdata setting without a value', () => {
|
|
208
|
+
let renderComponent;
|
|
209
|
+
beforeEach(async () => {
|
|
210
|
+
renderComponent = renderWithKintHarness(
|
|
211
|
+
<RenderSettingValue
|
|
212
|
+
currentSetting={refdataSettingNoValue}
|
|
213
|
+
input={{
|
|
214
|
+
name: 'test'
|
|
215
|
+
}}
|
|
216
|
+
refdata={refdata}
|
|
217
|
+
/>
|
|
218
|
+
);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('renders the default value', () => {
|
|
222
|
+
const { getByText } = renderComponent;
|
|
223
|
+
expect(getByText('[default] Test refdata value')).toBeInTheDocument();
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
describe('render a refdata setting without a value or default', () => {
|
|
228
|
+
let renderComponent;
|
|
229
|
+
beforeEach(async () => {
|
|
230
|
+
renderComponent = renderWithKintHarness(
|
|
231
|
+
<RenderSettingValue
|
|
232
|
+
currentSetting={refdataSettingNoValueOrDefault}
|
|
233
|
+
input={{
|
|
234
|
+
name: 'test'
|
|
235
|
+
}}
|
|
236
|
+
refdata={refdata}
|
|
237
|
+
/>
|
|
238
|
+
);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('renders the empty message', () => {
|
|
242
|
+
const { getByText } = renderComponent;
|
|
243
|
+
expect(getByText('No current value')).toBeInTheDocument();
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
describe('render password settings', () => {
|
|
249
|
+
describe('render a password setting', () => {
|
|
250
|
+
let renderComponent;
|
|
251
|
+
beforeEach(async () => {
|
|
252
|
+
renderComponent = renderWithKintHarness(
|
|
253
|
+
<RenderSettingValue
|
|
254
|
+
currentSetting={passwordSetting}
|
|
255
|
+
input={{
|
|
256
|
+
name: 'test'
|
|
257
|
+
}}
|
|
258
|
+
/>
|
|
259
|
+
);
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it('renders the value', () => {
|
|
263
|
+
const { getByText } = renderComponent;
|
|
264
|
+
expect(getByText('********')).toBeInTheDocument();
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
describe('render a password setting without a value', () => {
|
|
269
|
+
let renderComponent;
|
|
270
|
+
beforeEach(async () => {
|
|
271
|
+
renderComponent = renderWithKintHarness(
|
|
272
|
+
<RenderSettingValue
|
|
273
|
+
currentSetting={passwordSettingNoValue}
|
|
274
|
+
input={{
|
|
275
|
+
name: 'test'
|
|
276
|
+
}}
|
|
277
|
+
/>
|
|
278
|
+
);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('renders the default value', () => {
|
|
282
|
+
const { getByText } = renderComponent;
|
|
283
|
+
expect(getByText('[default] ********')).toBeInTheDocument();
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
describe('render a password setting without a value or default', () => {
|
|
288
|
+
let renderComponent;
|
|
289
|
+
beforeEach(async () => {
|
|
290
|
+
renderComponent = renderWithKintHarness(
|
|
291
|
+
<RenderSettingValue
|
|
292
|
+
currentSetting={passwordSettingNoValueOrDefault}
|
|
293
|
+
input={{
|
|
294
|
+
name: 'test'
|
|
295
|
+
}}
|
|
296
|
+
/>
|
|
297
|
+
);
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
it('renders the empty message', () => {
|
|
301
|
+
const { getByText } = renderComponent;
|
|
302
|
+
expect(getByText('No current value')).toBeInTheDocument();
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
describe('render template settings', () => {
|
|
308
|
+
describe('render a template setting', () => {
|
|
309
|
+
let renderComponent;
|
|
310
|
+
beforeEach(async () => {
|
|
311
|
+
renderComponent = renderWithKintHarness(
|
|
312
|
+
<RenderSettingValue
|
|
313
|
+
currentSetting={templateSetting}
|
|
314
|
+
input={{
|
|
315
|
+
name: 'test'
|
|
316
|
+
}}
|
|
317
|
+
templates={templates}
|
|
318
|
+
/>
|
|
319
|
+
);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
it('renders the value', () => {
|
|
323
|
+
const { getByText } = renderComponent;
|
|
324
|
+
expect(getByText('Test template')).toBeInTheDocument();
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
describe('render a template setting without a value', () => {
|
|
329
|
+
let renderComponent;
|
|
330
|
+
beforeEach(async () => {
|
|
331
|
+
renderComponent = renderWithKintHarness(
|
|
332
|
+
<RenderSettingValue
|
|
333
|
+
currentSetting={templateSettingNoValue}
|
|
334
|
+
input={{
|
|
335
|
+
name: 'test'
|
|
336
|
+
}}
|
|
337
|
+
templates={templates}
|
|
338
|
+
/>
|
|
339
|
+
);
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
it('renders the default value', () => {
|
|
343
|
+
const { getByText } = renderComponent;
|
|
344
|
+
expect(getByText('Test template')).toBeInTheDocument(); // TODO this doesn't currently have a [default] marking on it
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
describe('render a template setting without a value or default', () => {
|
|
349
|
+
let renderComponent;
|
|
350
|
+
beforeEach(async () => {
|
|
351
|
+
renderComponent = renderWithKintHarness(
|
|
352
|
+
<RenderSettingValue
|
|
353
|
+
currentSetting={templateSettingNoValueOrDefault}
|
|
354
|
+
input={{
|
|
355
|
+
name: 'test'
|
|
356
|
+
}}
|
|
357
|
+
templates={templates}
|
|
358
|
+
/>
|
|
359
|
+
);
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
it('renders the empty message', () => {
|
|
363
|
+
const { getByText } = renderComponent;
|
|
364
|
+
expect(getByText('No current value')).toBeInTheDocument();
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
});
|
|
@@ -9,9 +9,10 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import EditSettingValue from './EditSettingValue';
|
|
11
11
|
import RenderSettingValue from './RenderSettingValue';
|
|
12
|
-
import SettingsContext from '
|
|
13
|
-
import { useRefdata, useTemplates } from '
|
|
14
|
-
import { renderHelpText, toCamelCase } from '
|
|
12
|
+
import { SettingsContext } from '../../contexts';
|
|
13
|
+
import { useRefdata, useTemplates } from '../../hooks';
|
|
14
|
+
import { renderHelpText, toCamelCase } from '../../utils';
|
|
15
|
+
|
|
15
16
|
|
|
16
17
|
const SettingField = (settingFieldProps) => {
|
|
17
18
|
const {
|
|
@@ -33,7 +34,7 @@ const SettingField = (settingFieldProps) => {
|
|
|
33
34
|
endpoint: refdataEndpoint,
|
|
34
35
|
desc: currentSetting.vocab,
|
|
35
36
|
queryParams: {
|
|
36
|
-
enabled: !!currentSetting?.vocab
|
|
37
|
+
enabled: !!currentSetting?.vocab && currentSetting.settingType === 'Refdata'
|
|
37
38
|
}
|
|
38
39
|
});
|
|
39
40
|
|
|
@@ -41,7 +42,7 @@ const SettingField = (settingFieldProps) => {
|
|
|
41
42
|
context: currentSetting.vocab,
|
|
42
43
|
endpoint: templateEndpoint,
|
|
43
44
|
queryParams: {
|
|
44
|
-
enabled: !!currentSetting?.vocab
|
|
45
|
+
enabled: !!currentSetting?.vocab && currentSetting.settingType === 'Template'
|
|
45
46
|
}
|
|
46
47
|
});
|
|
47
48
|
|
|
@@ -85,7 +86,7 @@ const SettingField = (settingFieldProps) => {
|
|
|
85
86
|
{settingName}
|
|
86
87
|
</>
|
|
87
88
|
);
|
|
88
|
-
}
|
|
89
|
+
};
|
|
89
90
|
|
|
90
91
|
return (
|
|
91
92
|
<Card
|
|
@@ -99,7 +100,6 @@ const SettingField = (settingFieldProps) => {
|
|
|
99
100
|
templates={templates}
|
|
100
101
|
{...settingFieldProps}
|
|
101
102
|
/>
|
|
102
|
-
|
|
103
103
|
</Card>
|
|
104
104
|
);
|
|
105
105
|
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import '@folio/stripes-erm-components/test/jest/__mock__';
|
|
4
|
+
import { TestForm } from '@folio/stripes-erm-components/test/jest/helpers';
|
|
5
|
+
import { Button } from '@folio/stripes-testing';
|
|
6
|
+
import { Field } from 'react-final-form';
|
|
7
|
+
import SettingField from './SettingField';
|
|
8
|
+
|
|
9
|
+
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
10
|
+
|
|
11
|
+
const onSubmit = jest.fn();
|
|
12
|
+
const onSave = jest.fn().mockResolvedValue();
|
|
13
|
+
|
|
14
|
+
jest.mock('./EditSettingValue', () => () => <div>EditSettingValue</div>);
|
|
15
|
+
jest.mock('./RenderSettingValue', () => () => <div>RenderSettingValue</div>);
|
|
16
|
+
|
|
17
|
+
jest.mock('../../hooks', () => ({
|
|
18
|
+
useRefdata: () => [],
|
|
19
|
+
useTemplates: () => [],
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const setting = {
|
|
24
|
+
id: 'ff8081817d94374a017d94449a660049',
|
|
25
|
+
key: 'S3BucketName',
|
|
26
|
+
section: 'fileStorage',
|
|
27
|
+
settingType: 'String',
|
|
28
|
+
value: 'diku-shared'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
describe('SettingField', () => {
|
|
32
|
+
let renderComponent;
|
|
33
|
+
beforeEach(async () => {
|
|
34
|
+
renderComponent = renderWithKintHarness(
|
|
35
|
+
<TestForm
|
|
36
|
+
initialValues={{}}
|
|
37
|
+
onSubmit={onSubmit}
|
|
38
|
+
>
|
|
39
|
+
<Field
|
|
40
|
+
component={SettingField}
|
|
41
|
+
name="test"
|
|
42
|
+
onSave={onSave}
|
|
43
|
+
settingData={{
|
|
44
|
+
currentSetting: setting
|
|
45
|
+
}}
|
|
46
|
+
/>
|
|
47
|
+
</TestForm>
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('renders RenderSettingValue', () => {
|
|
52
|
+
const { getByText } = renderComponent;
|
|
53
|
+
expect(getByText('RenderSettingValue')).toBeInTheDocument();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('renders the edit button', () => {
|
|
57
|
+
Button('Edit').exists();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('clicking edit/save works as expected', async () => {
|
|
61
|
+
const { getByRole, findByText } = renderComponent;
|
|
62
|
+
|
|
63
|
+
// before clicking on edit button, we should be rendering setting value
|
|
64
|
+
expect(await findByText('RenderSettingValue')).toBeInTheDocument();
|
|
65
|
+
|
|
66
|
+
// Clicking edit button
|
|
67
|
+
const editButton = getByRole('button', { name: /Edit/i });
|
|
68
|
+
expect(editButton).toBeInTheDocument();
|
|
69
|
+
userEvent.click(editButton);
|
|
70
|
+
// Should be rendering the "edit" for a setting value
|
|
71
|
+
expect(await findByText('EditSettingValue')).toBeInTheDocument();
|
|
72
|
+
|
|
73
|
+
// Clicking finish editing button
|
|
74
|
+
const finishEditing = getByRole('button', { name: /Finish editing/i });
|
|
75
|
+
expect(finishEditing).toBeInTheDocument();
|
|
76
|
+
userEvent.click(finishEditing);
|
|
77
|
+
// Should be rendering the setting value again
|
|
78
|
+
expect(await findByText('RenderSettingValue')).toBeInTheDocument();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
import { Button, Icon } from '@folio/stripes/components';
|
|
5
|
+
import css from '../../../styles/NoResultsMessage.css';
|
|
6
|
+
|
|
7
|
+
const NoResultsMessage = ({
|
|
8
|
+
icon: userIcon,
|
|
9
|
+
isLoading,
|
|
10
|
+
isError,
|
|
11
|
+
error,
|
|
12
|
+
filterPaneIsVisible,
|
|
13
|
+
label: userLabel,
|
|
14
|
+
searchTerm,
|
|
15
|
+
toggleFilterPane,
|
|
16
|
+
}) => {
|
|
17
|
+
let icon = 'search';
|
|
18
|
+
let label = <FormattedMessage id="stripes-smart-components.sas.noResults.default" values={{ searchTerm }} />;
|
|
19
|
+
|
|
20
|
+
// No search term but no results
|
|
21
|
+
if (!searchTerm) {
|
|
22
|
+
icon = 'search';
|
|
23
|
+
label = <FormattedMessage id="stripes-smart-components.sas.noResults.noResults" />;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Loading results
|
|
27
|
+
if (isLoading) {
|
|
28
|
+
icon = 'spinner-ellipsis';
|
|
29
|
+
label = <FormattedMessage id="stripes-smart-components.sas.noResults.loading" />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Request failure
|
|
33
|
+
if (isError) {
|
|
34
|
+
icon = 'exclamation-circle';
|
|
35
|
+
label = error?.message;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className={css.noResultsMessage}>
|
|
40
|
+
<div className={css.noResultsMessageLabelWrap}>
|
|
41
|
+
{(icon || userIcon) &&
|
|
42
|
+
<Icon
|
|
43
|
+
icon={userIcon ?? icon}
|
|
44
|
+
iconRootClass={css.noResultsMessageIcon}
|
|
45
|
+
/>
|
|
46
|
+
}
|
|
47
|
+
<span className={css.noResultsMessageLabel}>{userLabel ?? label}</span>
|
|
48
|
+
</div>
|
|
49
|
+
{/* If the filter pane is closed we show a button that toggles filter pane */}
|
|
50
|
+
{!filterPaneIsVisible && (
|
|
51
|
+
<Button
|
|
52
|
+
buttonClass={css.noResultsMessageButton}
|
|
53
|
+
marginBottom0
|
|
54
|
+
onClick={toggleFilterPane}
|
|
55
|
+
>
|
|
56
|
+
<FormattedMessage id="stripes-kint-components.noResultsMessage.showFilters" />
|
|
57
|
+
</Button>
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
NoResultsMessage.propTypes = {
|
|
64
|
+
error: PropTypes.object,
|
|
65
|
+
filterPaneIsVisible: PropTypes.bool.isRequired,
|
|
66
|
+
icon: PropTypes.string,
|
|
67
|
+
isLoading: PropTypes.bool,
|
|
68
|
+
isError: PropTypes.bool,
|
|
69
|
+
label: PropTypes.oneOfType(
|
|
70
|
+
PropTypes.string,
|
|
71
|
+
PropTypes.node,
|
|
72
|
+
PropTypes.func
|
|
73
|
+
),
|
|
74
|
+
searchTerm: PropTypes.string.isRequired,
|
|
75
|
+
toggleFilterPane: PropTypes.func.isRequired,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default NoResultsMessage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './NoResultsMessage';
|
|
@@ -27,7 +27,7 @@ const RefdataButtons = (props) => {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
|
-
<Col xs={dynamicColumnWidth ? (12 / numberOfButtons) : (12 / maximumColumns)}
|
|
30
|
+
<Col key={`${input.name}:${option.id}`} xs={dynamicColumnWidth ? (12 / numberOfButtons) : (12 / maximumColumns)}>
|
|
31
31
|
<RadioButton
|
|
32
32
|
{...buttonProps}
|
|
33
33
|
/>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './RefdataButtons';
|
|
@@ -20,15 +20,18 @@ import {
|
|
|
20
20
|
MultiColumnList,
|
|
21
21
|
Pane,
|
|
22
22
|
PaneMenu,
|
|
23
|
-
SearchField
|
|
23
|
+
SearchField,
|
|
24
24
|
} from '@folio/stripes/components';
|
|
25
|
+
import NoResultsMessage from '../NoResultsMessage';
|
|
25
26
|
|
|
26
27
|
import { generateKiwtQuery } from '../utils';
|
|
27
28
|
import { useKiwtSASQuery, useLocalStorageState } from '../hooks';
|
|
28
29
|
|
|
30
|
+
|
|
29
31
|
const SASQLookupComponent = ({
|
|
30
32
|
children,
|
|
31
33
|
fetchParameters = {},
|
|
34
|
+
FilterPaneHeaderComponent = () => null,
|
|
32
35
|
FilterComponent = () => null,
|
|
33
36
|
history,
|
|
34
37
|
id,
|
|
@@ -55,7 +58,15 @@ const SASQLookupComponent = ({
|
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
const [filterPaneVisible, setFilterPaneVisible] = useLocalStorageState(filterPaneVisibileKey, true);
|
|
58
|
-
const
|
|
61
|
+
const toggleFilterPane = () => setFilterPaneVisible(!filterPaneVisible);
|
|
62
|
+
|
|
63
|
+
const {
|
|
64
|
+
data: totalData = {},
|
|
65
|
+
error,
|
|
66
|
+
isError,
|
|
67
|
+
isLoading,
|
|
68
|
+
fetchNextPage,
|
|
69
|
+
} = useInfiniteQuery(
|
|
59
70
|
[namespace, id, 'data', query],
|
|
60
71
|
fetchPageData
|
|
61
72
|
);
|
|
@@ -88,13 +99,13 @@ const SASQLookupComponent = ({
|
|
|
88
99
|
fetchNextPage({ pageParam: index });
|
|
89
100
|
};
|
|
90
101
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
// Build the map of column definitions
|
|
103
|
+
const columnMapping = Object.fromEntries(
|
|
104
|
+
resultColumns.map(e => [e.propertyPath, e.label])
|
|
105
|
+
);
|
|
95
106
|
|
|
96
|
-
|
|
97
|
-
|
|
107
|
+
// Build the list of visible columns
|
|
108
|
+
const visibleColumns = resultColumns.map(e => e.propertyPath);
|
|
98
109
|
|
|
99
110
|
return (
|
|
100
111
|
<SearchAndSortQuery
|
|
@@ -126,6 +137,18 @@ const SASQLookupComponent = ({
|
|
|
126
137
|
autosize
|
|
127
138
|
columnMapping={columnMapping}
|
|
128
139
|
contentData={data?.results}
|
|
140
|
+
isEmptyMessage={
|
|
141
|
+
<NoResultsMessage
|
|
142
|
+
{...{
|
|
143
|
+
error,
|
|
144
|
+
isError,
|
|
145
|
+
isLoading,
|
|
146
|
+
filterPaneIsVisible: filterPaneVisible,
|
|
147
|
+
searchTerm: query.query,
|
|
148
|
+
toggleFilterPane
|
|
149
|
+
}}
|
|
150
|
+
/>
|
|
151
|
+
}
|
|
129
152
|
isSelected={({ item }) => item.id === match?.params?.id}
|
|
130
153
|
onHeaderClick={onSort}
|
|
131
154
|
onNeedMoreData={onNeedMoreData}
|
|
@@ -163,6 +186,7 @@ const SASQLookupComponent = ({
|
|
|
163
186
|
paneTitle={<FormattedMessage id="stripes-smart-components.searchAndFilter" />}
|
|
164
187
|
>
|
|
165
188
|
<form onSubmit={onSubmitSearch}>
|
|
189
|
+
<FilterPaneHeaderComponent />
|
|
166
190
|
{!noSearchField &&
|
|
167
191
|
<>
|
|
168
192
|
<SearchField
|
|
@@ -240,6 +264,10 @@ SASQLookupComponent.propTypes = {
|
|
|
240
264
|
PropTypes.func,
|
|
241
265
|
PropTypes.node
|
|
242
266
|
]),
|
|
267
|
+
FilterPaneHeaderComponent: PropTypes.oneOfType([
|
|
268
|
+
PropTypes.func,
|
|
269
|
+
PropTypes.node
|
|
270
|
+
]),
|
|
243
271
|
history: PropTypes.object,
|
|
244
272
|
id: PropTypes.string.isRequired,
|
|
245
273
|
location: PropTypes.object,
|
|
@@ -6,7 +6,7 @@ A component designed to speed up the basic 3-pane layout setup process, SASQRout
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl';
|
|
8
8
|
|
|
9
|
-
import SASQRoute from '@k-int/stripes-kint-components
|
|
9
|
+
import { SASQRoute } from '@k-int/stripes-kint-components';
|
|
10
10
|
import ActionItem from '../components/ActionItem';
|
|
11
11
|
|
|
12
12
|
const ActionedRoute = ({ path }) => {
|