@k-int/stripes-kint-components 2.8.2 → 3.0.1
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 +18 -3
- package/es/index.js +48 -12
- package/es/lib/ActionList/ActionList.js +11 -5
- package/es/lib/ActionList/ActionListFieldArray.js +147 -77
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +43 -31
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +17 -14
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +64 -46
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +17 -24
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +91 -70
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +53 -36
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +50 -31
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +13 -14
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +6 -0
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +8 -12
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +22 -24
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +9 -12
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +62 -13
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +12 -13
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +87 -43
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +80 -73
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +31 -32
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +26 -24
- package/es/lib/CustomProperties/Edit/testResources.js +73 -908
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +21 -29
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +12 -10
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +38 -39
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +28 -13
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +29 -44
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +6 -6
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +16 -10
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +12 -12
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +20 -11
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.test.js +4 -3
- package/es/lib/CustomProperties/Filter/testResources.js +37 -233
- package/es/lib/CustomProperties/Filter/useOperators.js +69 -27
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +3 -2
- package/es/lib/CustomProperties/Filter/useValueProps.js +7 -2
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +6 -0
- package/es/lib/CustomProperties/View/CustomPropertiesView.test.js +4 -3
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +13 -19
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +4 -10
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +34 -51
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +35 -27
- package/es/lib/EditableRefdataList/EditableRefdataList.js +41 -31
- package/es/lib/EditableSettingsList/EditableSettingsList.js +11 -1
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +10 -0
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +19 -11
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +9 -8
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +21 -9
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +1 -0
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +83 -16
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +138 -65
- package/es/lib/FormModal/FormModal.js +14 -9
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +91 -0
- package/es/lib/FormattedKintMessage/index.js +15 -0
- package/es/lib/IconSelect/IconSelect.js +18 -12
- package/es/lib/NoResultsMessage/NoResultsMessage.js +13 -2
- package/es/lib/RichSelect/RichSelect.js +13 -34
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +16 -5
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +11 -1
- package/es/lib/SettingPage/SettingPage.js +12 -13
- package/es/lib/SettingPage/SettingPagePane.js +12 -20
- package/es/lib/hooks/__mocks__/index.js +46 -0
- package/es/lib/hooks/index.js +24 -8
- package/es/lib/hooks/settingsHooks/useSettings.js +22 -17
- package/es/lib/hooks/useIntlKey.js +34 -0
- package/es/lib/hooks/useIntlKeyStore.js +84 -0
- package/es/lib/hooks/useKintIntl.js +93 -0
- package/es/lib/utils/index.js +40 -4
- package/es/lib/utils/parseErrorResponse.js +1 -1
- package/es/lib/utils/validators.js +76 -59
- package/jest.config.js +4 -1
- package/junit.xml +157 -656
- package/package.json +54 -33
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +56 -8
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +394 -64
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +10 -10
- 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 +187 -52
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesSettings.js.html +372 -87
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +293 -74
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyView.js.html +126 -54
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.html +45 -60
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEdit.js.html +23 -5
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +59 -47
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesListField.js.html +259 -97
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyField.js.html +399 -105
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyFormCard.js.html +41 -68
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.html +57 -57
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/testResources.js.html +67 -688
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilter.js.html +92 -53
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterField.js.html +103 -64
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +54 -63
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +49 -16
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesRule.js.html +69 -18
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.html +89 -89
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/testResources.js.html +33 -786
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useOperators.js.html +46 -46
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useParseActiveFilterStrings.js.html +45 -36
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useValueProps.js.html +43 -28
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesView.js.html +20 -2
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesViewCtx.js.html +50 -41
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertyCard.js.html +54 -75
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.html +24 -24
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/{hooks/useAvailableCustomProperties.js.html → CycleButton/CycleButton.js.html} +62 -50
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +664 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +264 -39
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +41 -14
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +45 -6
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +47 -11
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +65 -14
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +154 -31
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +26 -26
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +18 -18
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html +35 -17
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.html +15 -15
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/FormattedKintMessage.js.html +247 -0
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/{CustomProperties/Config/CustomPropertiesView.js.html → IconSelect/IconSelect.js.html} +158 -257
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +48 -6
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +3 -3
- 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/{CustomProperties/Config/testResources.js.html → RichSelect/RichSelect.js.html} +256 -334
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/useSelectedOption.js.html +127 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +52 -7
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/TableBody.js.html +31 -4
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +24 -27
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +47 -17
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +22 -22
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +2 -2
- 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/favicon.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +142 -97
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +13 -4
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +35 -20
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +5 -2
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useAppSettings.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +61 -22
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html +19 -22
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKey.js.html +151 -0
- package/src/artifacts/coverage-jest/lcov-report/{utils/renderHelpText.js.html → hooks/useIntlKeyStore.js.html} +71 -38
- package/src/artifacts/coverage-jest/lcov-report/hooks/useInvalidateRefdata.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKintIntl.js.html +238 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html +23 -11
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataCategory.js.html +274 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +19 -10
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/index.html +205 -130
- package/src/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/groupCustomPropertiesByCtx.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/utils/highlightString.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +34 -34
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +42 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/matchString.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/parseErrorResponse.js.html +139 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +5 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataQueryKey.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/typedownQueryKey.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/validators.js.html +128 -80
- package/src/artifacts/coverage-jest/lcov.info +2603 -2086
- package/src/index.js +11 -4
- package/src/lib/ActionList/ActionList.js +9 -3
- package/src/lib/ActionList/ActionListFieldArray.js +115 -37
- package/src/lib/ActionList/README.md +2 -1
- package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +60 -16
- package/src/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +14 -4
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +106 -33
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +16 -9
- package/src/lib/CustomProperties/Config/CustomPropertyForm.js +131 -58
- package/src/lib/CustomProperties/Config/CustomPropertyForm.test.js +52 -33
- package/src/lib/CustomProperties/Config/CustomPropertyView.js +71 -47
- package/src/lib/CustomProperties/Config/CustomPropertyView.test.js +8 -6
- package/src/lib/CustomProperties/Config/README.md +33 -28
- package/src/lib/CustomProperties/Edit/CustomPropertiesEdit.js +6 -0
- package/src/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +7 -3
- package/src/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +23 -19
- package/src/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +5 -3
- package/src/lib/CustomProperties/Edit/CustomPropertiesListField.js +65 -11
- package/src/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +10 -8
- package/src/lib/CustomProperties/Edit/CustomPropertyField.js +101 -21
- package/src/lib/CustomProperties/Edit/CustomPropertyField.test.js +59 -60
- package/src/lib/CustomProperties/Edit/CustomPropertyFormCard.js +24 -33
- package/src/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +20 -27
- package/src/lib/CustomProperties/Edit/testResources.js +46 -1047
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilter.js +22 -22
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +12 -8
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +44 -31
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +26 -13
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +33 -36
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +3 -3
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +19 -8
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +9 -12
- package/src/lib/CustomProperties/Filter/CustomPropertiesRule.js +22 -5
- package/src/lib/CustomProperties/Filter/CustomPropertiesRule.test.js +3 -1
- package/src/lib/CustomProperties/Filter/testResources.js +14 -265
- package/src/lib/CustomProperties/Filter/useOperators.js +20 -20
- package/src/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +2 -2
- package/src/lib/CustomProperties/Filter/useValueProps.js +8 -3
- package/src/lib/CustomProperties/View/CustomPropertiesView.js +6 -0
- package/src/lib/CustomProperties/View/CustomPropertiesView.test.js +2 -1
- package/src/lib/CustomProperties/View/CustomPropertiesViewCtx.js +15 -13
- package/src/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +2 -5
- package/src/lib/CustomProperties/View/CustomPropertyCard.js +36 -43
- package/src/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +45 -27
- package/src/lib/EditableRefdataList/EditableRefdataList.js +56 -32
- package/src/lib/EditableSettingsList/EditableSettingsList.js +10 -1
- package/src/lib/EditableSettingsList/EditableSettingsListFieldArray.js +14 -1
- package/src/lib/EditableSettingsList/SettingField/EditSettingValue.js +17 -5
- package/src/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +9 -8
- package/src/lib/EditableSettingsList/SettingField/RenderSettingValue.js +24 -7
- package/src/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +1 -0
- package/src/lib/EditableSettingsList/SettingField/SettingField.js +57 -16
- package/src/lib/EditableSettingsList/SettingField/SettingField.test.js +14 -19
- package/src/lib/FormModal/FormModal.js +15 -9
- package/src/lib/FormattedKintMessage/FormattedKintMessage.js +54 -0
- package/src/lib/FormattedKintMessage/index.js +1 -0
- package/src/lib/IconSelect/IconSelect.js +17 -8
- package/src/lib/NoResultsMessage/NoResultsMessage.js +15 -1
- package/src/lib/RichSelect/RichSelect.js +16 -36
- package/src/lib/SASQLookupComponent/SASQLookupComponent.js +17 -2
- package/src/lib/SASQLookupComponent/TableBody/TableBody.js +10 -1
- package/src/lib/SettingPage/SettingPage.js +12 -13
- package/src/lib/SettingPage/SettingPagePane.js +16 -6
- package/src/lib/hooks/__mocks__/index.js +17 -0
- package/src/lib/hooks/index.js +3 -1
- package/src/lib/hooks/settingsHooks/useSettings.js +25 -12
- package/src/lib/hooks/useIntlKey.js +22 -0
- package/src/lib/hooks/useIntlKeyStore.js +38 -0
- package/src/lib/hooks/useKintIntl.js +51 -0
- package/src/lib/utils/index.js +11 -1
- package/src/lib/utils/parseErrorResponse.js +1 -1
- package/src/lib/utils/validators.js +57 -41
- package/styles/RichSelect.css +7 -4
- package/test/helpers/test-implementor-translations.json +80 -0
- package/test/helpers/translationsProperties.js +6 -1
- package/test/jest/customProperties.js +166 -0
- package/test/jest/helpers/KintHarness.js +1 -1
- package/test/jest/helpers/renderWithKintHarness.js +2 -1
- package/test/jest/index.js +8 -0
- package/test/jest/refdata.js +471 -0
- package/test/jest/resolver.js +29 -0
- package/translations/stripes-kint-components/ar.json +1 -122
- package/translations/stripes-kint-components/cs_CZ.json +1 -122
- package/translations/stripes-kint-components/de.json +1 -122
- package/translations/stripes-kint-components/en.json +1 -148
- package/translations/stripes-kint-components/es.json +1 -122
- package/translations/stripes-kint-components/hi_IN.json +1 -122
- package/translations/stripes-kint-components/hu.json +1 -122
- package/translations/stripes-kint-components/it_IT.json +1 -122
- package/translations/stripes-kint-components/ja.json +1 -122
- package/translations/stripes-kint-components/ko.json +1 -122
- package/translations/stripes-kint-components/pt_PT.json +1 -122
- package/translations/stripes-kint-components/ru.json +1 -122
- package/translations/stripes-kint-components/sv.json +1 -122
- package/translations/stripes-kint-components/zh_CN.json +1 -122
- package/es/lib/CustomProperties/Config/testResources.js +0 -198
- package/es/lib/hooks/useAvailableCustomProperties.js +0 -73
- package/es/lib/utils/renderHelpText.js +0 -80
- package/src/lib/CustomProperties/Config/testResources.js +0 -236
- package/src/lib/hooks/useAvailableCustomProperties.js +0 -40
- package/src/lib/utils/renderHelpText.js +0 -27
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { FormattedMessage } from 'react-intl';
|
|
4
3
|
|
|
5
4
|
import {
|
|
6
5
|
Accordion,
|
|
@@ -8,7 +7,7 @@ import {
|
|
|
8
7
|
Layout,
|
|
9
8
|
Spinner
|
|
10
9
|
} from '@folio/stripes/components';
|
|
11
|
-
import { useCustomProperties } from '../../hooks';
|
|
10
|
+
import { useCustomProperties, useKintIntl } from '../../hooks';
|
|
12
11
|
import useParseActiveFilterStrings from './useParseActiveFilterStrings';
|
|
13
12
|
import CustomPropertiesFilterForm from './CustomPropertiesFilterForm';
|
|
14
13
|
import { MULTI_REFDATA_CLASS_NAME, REFDATA_CLASS_NAME } from '../../constants/customProperties';
|
|
@@ -20,12 +19,16 @@ const CustomPropertiesFilter = ({
|
|
|
20
19
|
},
|
|
21
20
|
customPropertiesEndpoint,
|
|
22
21
|
filterHandlers,
|
|
22
|
+
intlKey: passedIntlKey,
|
|
23
|
+
intlNS: passedIntlNS,
|
|
23
24
|
labelOverrides = {}
|
|
24
25
|
}) => {
|
|
25
26
|
const [editingFilters, setEditingFilters] = useState(false);
|
|
26
27
|
const openEditModal = () => setEditingFilters(true);
|
|
27
28
|
const closeEditModal = () => setEditingFilters(false);
|
|
28
29
|
|
|
30
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
31
|
+
|
|
29
32
|
const { data: custprops, isLoading } = useCustomProperties({
|
|
30
33
|
endpoint: customPropertiesEndpoint,
|
|
31
34
|
returnQueryObject: true,
|
|
@@ -38,21 +41,7 @@ const CustomPropertiesFilter = ({
|
|
|
38
41
|
],
|
|
39
42
|
}
|
|
40
43
|
});
|
|
41
|
-
const parsedFilterData = useParseActiveFilterStrings(custPropFilters || []);
|
|
42
|
-
|
|
43
|
-
const getFiltersApplied = () => {
|
|
44
|
-
if (labelOverrides.filtersApplied && typeof labelOverrides.filtersApplied === 'function') {
|
|
45
|
-
return labelOverrides.filtersApplied((parsedFilterData?.numberOfFilters ?? 0));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
labelOverrides.filtersApplied ??
|
|
50
|
-
<FormattedMessage
|
|
51
|
-
id="stripes-kint-components.customProperty.filtersApplied"
|
|
52
|
-
values={{ count: (parsedFilterData?.numberOfFilters ?? 0) }}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
};
|
|
44
|
+
const parsedFilterData = useParseActiveFilterStrings(custPropFilters || [], passedIntlKey, passedIntlNS, labelOverrides);
|
|
56
45
|
|
|
57
46
|
if (isLoading) {
|
|
58
47
|
return (
|
|
@@ -61,8 +50,10 @@ const CustomPropertiesFilter = ({
|
|
|
61
50
|
header={FilterAccordionHeader}
|
|
62
51
|
id="clickable-custprop-filter"
|
|
63
52
|
label={
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
kintIntl.formatKintMessage({
|
|
54
|
+
id: 'customProperties',
|
|
55
|
+
overrideValue: labelOverrides.customProperties,
|
|
56
|
+
})
|
|
66
57
|
}
|
|
67
58
|
separator={false}
|
|
68
59
|
>
|
|
@@ -104,14 +95,21 @@ const CustomPropertiesFilter = ({
|
|
|
104
95
|
header={FilterAccordionHeader}
|
|
105
96
|
id="clickable-custprop-filter"
|
|
106
97
|
label={
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
kintIntl.formatKintMessage({
|
|
99
|
+
id: 'customProperties',
|
|
100
|
+
overrideValue: labelOverrides.customProperties,
|
|
101
|
+
})
|
|
109
102
|
}
|
|
110
103
|
onClearFilter={() => filterHandlers.state({ ...restOfFilters, customProperties: [] })}
|
|
111
104
|
separator={false}
|
|
112
105
|
>
|
|
113
106
|
<Layout className="padding-bottom-gutter">
|
|
114
|
-
{
|
|
107
|
+
{
|
|
108
|
+
kintIntl.formatKintMessage({
|
|
109
|
+
id: 'customProperty.filtersApplied',
|
|
110
|
+
overrideValue: labelOverrides.filtersApplied,
|
|
111
|
+
}, { count: (parsedFilterData?.numberOfFilters ?? 0) })
|
|
112
|
+
}
|
|
115
113
|
</Layout>
|
|
116
114
|
<CustomPropertiesFilterForm
|
|
117
115
|
customProperties={custprops}
|
|
@@ -132,6 +130,8 @@ CustomPropertiesFilter.propTypes = {
|
|
|
132
130
|
activeFilters: PropTypes.object,
|
|
133
131
|
customPropertiesEndpoint: PropTypes.string,
|
|
134
132
|
filterHandlers: PropTypes.object,
|
|
133
|
+
intlKey: PropTypes.string,
|
|
134
|
+
intlNS: PropTypes.string,
|
|
135
135
|
labelOverrides: PropTypes.object
|
|
136
136
|
};
|
|
137
137
|
|
|
@@ -2,11 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import '@folio/stripes-erm-components/test/jest/__mock__';
|
|
3
3
|
import { MemoryRouter } from 'react-router-dom';
|
|
4
4
|
import { Accordion, Button } from '@folio/stripes-testing';
|
|
5
|
-
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
6
5
|
|
|
7
|
-
import { activeFilters, filterHandlers
|
|
6
|
+
import { activeFilters, filterHandlers } from './testResources';
|
|
8
7
|
import CustomPropertiesFilter from './CustomPropertiesFilter';
|
|
9
8
|
|
|
9
|
+
import translationsProperties from '../../../../test/helpers';
|
|
10
|
+
import { renderWithKintHarness } from '../../../../test/jest';
|
|
11
|
+
|
|
12
|
+
jest.mock('../../hooks');
|
|
10
13
|
jest.mock('./CustomPropertiesFilterForm', () => () => <div>CustomPropertiesFilterForm</div>);
|
|
11
14
|
|
|
12
15
|
describe('CustomPropertiesFilter', () => {
|
|
@@ -18,21 +21,22 @@ describe('CustomPropertiesFilter', () => {
|
|
|
18
21
|
activeFilters={activeFilters}
|
|
19
22
|
customPropertiesEndpoint="erm/custprops"
|
|
20
23
|
filterHandlers={filterHandlers}
|
|
21
|
-
labelOverrides={labelOverrides}
|
|
22
24
|
/>
|
|
23
|
-
</MemoryRouter
|
|
25
|
+
</MemoryRouter>,
|
|
26
|
+
{},
|
|
27
|
+
translationsProperties
|
|
24
28
|
);
|
|
25
29
|
});
|
|
26
30
|
|
|
27
|
-
test('renders the
|
|
31
|
+
test('renders the Custom properties Accordion by id', async () => {
|
|
28
32
|
await Accordion({ id: 'clickable-custprop-filter' }).exists();
|
|
29
33
|
});
|
|
30
34
|
|
|
31
|
-
test('renders the
|
|
32
|
-
await Accordion('
|
|
35
|
+
test('renders the Custom properties Accordion', async () => {
|
|
36
|
+
await Accordion('Custom properties').exists();
|
|
33
37
|
});
|
|
34
38
|
|
|
35
|
-
test('renders the edit
|
|
39
|
+
test('renders the edit custom property filters button', async () => {
|
|
36
40
|
await Button({ id: 'accordion-toggle-button-clickable-custprop-filter' }).exists();
|
|
37
41
|
});
|
|
38
42
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
|
|
3
|
-
import { FormattedMessage } from 'react-intl';
|
|
4
|
-
|
|
5
3
|
import { Field, useForm, useFormState } from 'react-final-form';
|
|
6
4
|
import { FieldArray } from 'react-final-form-arrays';
|
|
7
5
|
|
|
@@ -17,58 +15,54 @@ import { groupCustomPropertiesByCtx } from '../../utils';
|
|
|
17
15
|
import { required as requiredValidator } from '../../utils/validators';
|
|
18
16
|
|
|
19
17
|
import CustomPropertiesRule from './CustomPropertiesRule';
|
|
18
|
+
import { useKintIntl } from '../../hooks';
|
|
20
19
|
|
|
21
20
|
const CustomPropertiesFilterField = ({
|
|
22
21
|
customProperties = [],
|
|
23
22
|
fields,
|
|
24
23
|
index,
|
|
24
|
+
intlKey: passedIntlKey,
|
|
25
|
+
intlNS: passedIntlNS,
|
|
25
26
|
labelOverrides = {},
|
|
26
27
|
name,
|
|
27
28
|
}) => {
|
|
28
29
|
const groupedCustomProperties = groupCustomPropertiesByCtx(customProperties);
|
|
29
30
|
const { change, mutators: { push } } = useForm();
|
|
30
31
|
const { values } = useFormState();
|
|
31
|
-
|
|
32
|
-
// Deal with all the possible label override options
|
|
33
|
-
const getRetiredName = (customProperty) => {
|
|
34
|
-
// Label override for default card title,
|
|
35
|
-
if (labelOverrides.retiredName && typeof labelOverrides.retiredName === 'function') {
|
|
36
|
-
return (
|
|
37
|
-
labelOverrides.retiredName(customProperty.label)
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Label override for default title or finally built in default
|
|
42
|
-
return (
|
|
43
|
-
labelOverrides.retiredName ??
|
|
44
|
-
<FormattedMessage id="stripes-kint-components.customProperty.retiredName" values={{ name: customProperty.label }} />
|
|
45
|
-
);
|
|
46
|
-
};
|
|
32
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
47
33
|
|
|
48
34
|
return (
|
|
49
35
|
<>
|
|
50
36
|
<Field
|
|
51
37
|
id={`input-custprop-${index}`}
|
|
52
|
-
label={
|
|
38
|
+
label={
|
|
39
|
+
kintIntl.formatKintMessage({
|
|
40
|
+
id: 'customProperty',
|
|
41
|
+
overrideValue: labelOverrides.customProperty
|
|
42
|
+
})
|
|
43
|
+
}
|
|
53
44
|
name={`${name}.customProperty`}
|
|
54
45
|
placeholder=" "
|
|
55
46
|
render={fieldProps => {
|
|
47
|
+
const sortedGroupedCustProps = Object.entries(groupedCustomProperties)?.sort((a, b) => {
|
|
48
|
+
if (a[0] === 'isNull') return -1; // Make sure noContext is at top
|
|
49
|
+
|
|
50
|
+
if (a[0].toLowerCase() < b[0].toLowerCase()) return -1;
|
|
51
|
+
if (a[0].toLowerCase() > b[0].toLowerCase()) return 1;
|
|
52
|
+
return 0;
|
|
53
|
+
});
|
|
54
|
+
|
|
56
55
|
return (
|
|
57
56
|
<Select
|
|
58
57
|
{...fieldProps}
|
|
59
58
|
placeholder={null} // placeholder default causes issues
|
|
60
59
|
>
|
|
61
|
-
<option value=""> </option>
|
|
60
|
+
<option key="empty-option" value=""> </option>
|
|
62
61
|
{
|
|
63
|
-
|
|
64
|
-
if (a[0] === 'isNull') return -1; // Make sure noContext is at top
|
|
65
|
-
|
|
66
|
-
if (a[0].toLowerCase() < b[0].toLowerCase()) return -1;
|
|
67
|
-
if (a[0].toLowerCase() > b[0].toLowerCase()) return 1;
|
|
68
|
-
return 0;
|
|
69
|
-
}).map(([key, value]) => {
|
|
62
|
+
sortedGroupedCustProps.map(([key, value]) => {
|
|
70
63
|
return (
|
|
71
64
|
<optgroup
|
|
65
|
+
key={`custom-property-optgroup-${key}`}
|
|
72
66
|
label={key === 'isNull' ? '-' : key}
|
|
73
67
|
>
|
|
74
68
|
{value.map(v => {
|
|
@@ -77,7 +71,13 @@ const CustomPropertiesFilterField = ({
|
|
|
77
71
|
key={v.id}
|
|
78
72
|
value={v.name}
|
|
79
73
|
>
|
|
80
|
-
{v.retired ?
|
|
74
|
+
{v.retired ?
|
|
75
|
+
kintIntl.formatKintMessage({
|
|
76
|
+
id: 'customProperty.retiredName',
|
|
77
|
+
overrideValue: labelOverrides.retiredName
|
|
78
|
+
}, { name: v.label }) :
|
|
79
|
+
v.label
|
|
80
|
+
}
|
|
81
81
|
</option>
|
|
82
82
|
);
|
|
83
83
|
})}
|
|
@@ -93,6 +93,7 @@ const CustomPropertiesFilterField = ({
|
|
|
93
93
|
/>
|
|
94
94
|
{/* This next div is rendered so that it can be referred to using aria-labelledby */}
|
|
95
95
|
<div
|
|
96
|
+
data-testid={`selected-custprop-name-${index}`}
|
|
96
97
|
id={`selected-custprop-name-${index}`}
|
|
97
98
|
style={{ display: 'none' }}
|
|
98
99
|
>
|
|
@@ -102,12 +103,18 @@ const CustomPropertiesFilterField = ({
|
|
|
102
103
|
<Col xs={2} />
|
|
103
104
|
<Col xs={4}>
|
|
104
105
|
<Label id="rule-column-header-comparator" required>
|
|
105
|
-
|
|
106
|
+
{kintIntl.formatKintMessage({
|
|
107
|
+
id: 'comparator',
|
|
108
|
+
overrideValue: labelOverrides.comparator
|
|
109
|
+
})}
|
|
106
110
|
</Label>
|
|
107
111
|
</Col>
|
|
108
112
|
<Col xs={4}>
|
|
109
113
|
<Label id="rule-column-header-value" required>
|
|
110
|
-
|
|
114
|
+
{kintIntl.formatKintMessage({
|
|
115
|
+
id: 'value',
|
|
116
|
+
overrideValue: labelOverrides.value
|
|
117
|
+
})}
|
|
111
118
|
</Label>
|
|
112
119
|
</Col>
|
|
113
120
|
<Col xs={2} />
|
|
@@ -120,6 +127,7 @@ const CustomPropertiesFilterField = ({
|
|
|
120
127
|
clearRuleValue={() => change(`filters[${index}].rules[${ruleFieldIndex}].value`, '')}
|
|
121
128
|
custPropDefinition={customProperties.find(t => t.name === fields.value[index].customProperty)}
|
|
122
129
|
index={ruleFieldIndex}
|
|
130
|
+
labelOverrides={labelOverrides}
|
|
123
131
|
name={ruleFieldName}
|
|
124
132
|
onDelete={() => ruleFields.remove(ruleFieldIndex)}
|
|
125
133
|
value={values.filters[index]?.rules[ruleFieldIndex]}
|
|
@@ -131,7 +139,10 @@ const CustomPropertiesFilterField = ({
|
|
|
131
139
|
disabled={!fields.value[index]?.customProperty}
|
|
132
140
|
onClick={() => push(`${name}.rules`)}
|
|
133
141
|
>
|
|
134
|
-
|
|
142
|
+
{kintIntl.formatKintMessage({
|
|
143
|
+
id: 'addRule',
|
|
144
|
+
overrideValue: labelOverrides.addRule
|
|
145
|
+
})}
|
|
135
146
|
</Button>
|
|
136
147
|
</>
|
|
137
148
|
);
|
|
@@ -141,6 +152,8 @@ CustomPropertiesFilterField.propTypes = {
|
|
|
141
152
|
customProperties: PropTypes.arrayOf(PropTypes.object),
|
|
142
153
|
fields: PropTypes.object,
|
|
143
154
|
index: PropTypes.number,
|
|
155
|
+
intlKey: PropTypes.string,
|
|
156
|
+
intlNS: PropTypes.string,
|
|
144
157
|
labelOverrides: PropTypes.object,
|
|
145
158
|
name: PropTypes.string
|
|
146
159
|
};
|
|
@@ -1,32 +1,45 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { FieldArray } from 'react-final-form-arrays';
|
|
3
|
+
|
|
2
4
|
import '@folio/stripes-erm-components/test/jest/__mock__';
|
|
3
5
|
import { TestForm } from '@folio/stripes-erm-components/test/jest/helpers';
|
|
4
6
|
import { MemoryRouter } from 'react-router-dom';
|
|
5
|
-
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
6
7
|
|
|
7
|
-
import { customProperties, fields, labelOverrides } from './testResources';
|
|
8
8
|
import CustomPropertiesFilterField from './CustomPropertiesFilterField';
|
|
9
|
+
import customProperties from '../../../../test/jest/customProperties';
|
|
10
|
+
import { renderWithKintHarness } from '../../../../test/jest';
|
|
11
|
+
import { data } from './testResources';
|
|
9
12
|
|
|
13
|
+
jest.mock('../../hooks');
|
|
10
14
|
const onSubmit = jest.fn();
|
|
11
15
|
|
|
12
16
|
let renderComponent;
|
|
13
17
|
describe('CustomPropertiesFilterField', () => {
|
|
14
18
|
renderComponent = renderWithKintHarness(
|
|
15
19
|
<MemoryRouter>
|
|
16
|
-
<TestForm
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
<TestForm
|
|
21
|
+
initialValues={{
|
|
22
|
+
filters: data.filters
|
|
23
|
+
}}
|
|
24
|
+
onSubmit={onSubmit}
|
|
25
|
+
>
|
|
26
|
+
<FieldArray name="filters">
|
|
27
|
+
{({ fields }) => fields.map((name, index) => (
|
|
28
|
+
<CustomPropertiesFilterField
|
|
29
|
+
key={`custom-property-filter-field-${name}[${index}]`}
|
|
30
|
+
customProperties={customProperties}
|
|
31
|
+
fields={fields}
|
|
32
|
+
index={index}
|
|
33
|
+
name={name}
|
|
34
|
+
/>
|
|
35
|
+
))}
|
|
36
|
+
</FieldArray>
|
|
24
37
|
</TestForm>
|
|
25
38
|
</MemoryRouter>
|
|
26
39
|
);
|
|
27
40
|
|
|
28
|
-
test('displays the
|
|
29
|
-
const {
|
|
30
|
-
expect(
|
|
41
|
+
test('displays the Custom property label', () => {
|
|
42
|
+
const { getByTestId } = renderComponent;
|
|
43
|
+
expect(getByTestId('selected-custprop-name-0')).toHaveTextContent('Author Identification');
|
|
31
44
|
});
|
|
32
45
|
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
|
|
3
|
-
import { FormattedMessage } from 'react-intl';
|
|
4
|
-
|
|
5
3
|
import { useForm } from 'react-final-form';
|
|
6
4
|
import { FieldArray } from 'react-final-form-arrays';
|
|
7
5
|
|
|
@@ -14,49 +12,34 @@ import {
|
|
|
14
12
|
} from '@folio/stripes/components';
|
|
15
13
|
|
|
16
14
|
import CustomPropertiesFilterField from './CustomPropertiesFilterField';
|
|
15
|
+
import { useKintIntl } from '../../hooks';
|
|
17
16
|
|
|
18
17
|
const CustomPropertiesFilterFieldArray = ({
|
|
19
18
|
customProperties,
|
|
19
|
+
intlKey: passedIntlKey,
|
|
20
|
+
intlNS: passedIntlNS,
|
|
20
21
|
labelOverrides = {},
|
|
21
22
|
}) => {
|
|
22
23
|
const { mutators: { push } } = useForm();
|
|
24
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
23
25
|
|
|
24
|
-
const getCardTitle = (index) => {
|
|
25
|
-
if (labelOverrides.customPropertyFilter && typeof labelOverrides.customPropertyFilter === 'function') {
|
|
26
|
-
return labelOverrides.customPropertyFilter(index);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
labelOverrides.customPropertyFilter ??
|
|
31
|
-
<FormattedMessage id="stripes-kint-components.customProperty.filterIndex" values={{ index: index + 1 }} />
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const getTooltipText = (index) => {
|
|
36
|
-
if (labelOverrides.removeFilter && typeof labelOverrides.removeFilter === 'function') {
|
|
37
|
-
return labelOverrides.removeFilter(index);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
labelOverrides.removeFilter ??
|
|
42
|
-
<FormattedMessage
|
|
43
|
-
id="stripes-kint-components.customProperty.removeFilter"
|
|
44
|
-
values={{ number: index + 1 }}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
26
|
return (
|
|
49
27
|
<>
|
|
50
28
|
<FieldArray name="filters">
|
|
51
29
|
{({ fields }) => fields.map((name, index) => {
|
|
52
30
|
return (
|
|
53
|
-
|
|
31
|
+
<div key={`custom-property-filter-card[${index}]-container`}>
|
|
54
32
|
<Card
|
|
55
33
|
key={`custom-property-filter-card[${index}]`}
|
|
56
34
|
headerEnd={
|
|
57
35
|
<Tooltip
|
|
58
36
|
id={`custom-property-filter-card-delete-[${index}]-tooltip`}
|
|
59
|
-
text={
|
|
37
|
+
text={
|
|
38
|
+
kintIntl.formatKintMessage({
|
|
39
|
+
id: 'customProperty.removeFilter',
|
|
40
|
+
overrideValue: labelOverrides.removeFilter
|
|
41
|
+
}, { index: index + 1 })
|
|
42
|
+
}
|
|
60
43
|
>
|
|
61
44
|
{({ ref, ariaIds }) => (
|
|
62
45
|
<IconButton
|
|
@@ -71,12 +54,18 @@ const CustomPropertiesFilterFieldArray = ({
|
|
|
71
54
|
}
|
|
72
55
|
headerStart={
|
|
73
56
|
<strong>
|
|
74
|
-
{
|
|
57
|
+
{
|
|
58
|
+
kintIntl.formatKintMessage({
|
|
59
|
+
id: 'customProperty.filterIndex',
|
|
60
|
+
overrideValue: labelOverrides.customPropertyFilter
|
|
61
|
+
}, { index: index + 1 })
|
|
62
|
+
}
|
|
75
63
|
</strong>
|
|
76
64
|
}
|
|
77
65
|
marginBottom0={index !== fields.length - 1}
|
|
78
66
|
>
|
|
79
67
|
<CustomPropertiesFilterField
|
|
68
|
+
key={`custom-property-filter-field-${name}[${index}]`}
|
|
80
69
|
customProperties={customProperties}
|
|
81
70
|
fields={fields}
|
|
82
71
|
index={index}
|
|
@@ -85,21 +74,27 @@ const CustomPropertiesFilterFieldArray = ({
|
|
|
85
74
|
/>
|
|
86
75
|
</Card>
|
|
87
76
|
{index < fields.value.length - 1 && (
|
|
88
|
-
<Layout
|
|
89
|
-
|
|
77
|
+
<Layout
|
|
78
|
+
key={`custom-property-filter[${index}]-AND`}
|
|
79
|
+
className="textCentered"
|
|
80
|
+
>
|
|
81
|
+
{kintIntl.formatKintMessage({
|
|
82
|
+
id: 'AND',
|
|
83
|
+
overrideValue: labelOverrides.AND
|
|
84
|
+
})}
|
|
90
85
|
</Layout>
|
|
91
86
|
)}
|
|
92
|
-
|
|
87
|
+
</div>
|
|
93
88
|
);
|
|
94
89
|
})}
|
|
95
90
|
</FieldArray>
|
|
96
91
|
<Button
|
|
97
92
|
onClick={() => push('filters', { rules: [{}] })}
|
|
98
93
|
>
|
|
99
|
-
{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
94
|
+
{kintIntl.formatKintMessage({
|
|
95
|
+
id: 'customProperty.addFilter',
|
|
96
|
+
overrideValue: labelOverrides.addFilter
|
|
97
|
+
})}
|
|
103
98
|
</Button>
|
|
104
99
|
</>
|
|
105
100
|
);
|
|
@@ -107,6 +102,8 @@ const CustomPropertiesFilterFieldArray = ({
|
|
|
107
102
|
|
|
108
103
|
CustomPropertiesFilterFieldArray.propTypes = {
|
|
109
104
|
customProperties: PropTypes.arrayOf(PropTypes.object),
|
|
105
|
+
intlKey: PropTypes.string,
|
|
106
|
+
intlNS: PropTypes.string,
|
|
110
107
|
labelOverrides: PropTypes.object
|
|
111
108
|
};
|
|
112
109
|
|
|
@@ -4,11 +4,12 @@ import { TestForm } from '@folio/stripes-erm-components/test/jest/helpers';
|
|
|
4
4
|
import { waitFor } from '@testing-library/react';
|
|
5
5
|
import { Button } from '@folio/stripes-testing';
|
|
6
6
|
import { FieldArray } from 'react-final-form-arrays';
|
|
7
|
-
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
8
7
|
|
|
9
|
-
import { customProperties, labelOverrides } from '../Edit/testResources';
|
|
10
8
|
import CustomPropertiesFilterFieldArray from './CustomPropertiesFilterFieldArray';
|
|
9
|
+
import customProperties from '../../../../test/jest/customProperties';
|
|
10
|
+
import { renderWithKintHarness } from '../../../../test/jest';
|
|
11
11
|
|
|
12
|
+
jest.mock('../../hooks');
|
|
12
13
|
jest.mock('./CustomPropertiesFilterField', () => () => <div>CustomPropertiesFilterField</div>);
|
|
13
14
|
const onSubmit = jest.fn();
|
|
14
15
|
|
|
@@ -22,7 +23,6 @@ describe('CustomPropertiesFilterFieldArray', () => {
|
|
|
22
23
|
<FieldArray
|
|
23
24
|
component={CustomPropertiesFilterFieldArray}
|
|
24
25
|
customProperties={customProperties}
|
|
25
|
-
labelOverrides={labelOverrides}
|
|
26
26
|
name="customProperties"
|
|
27
27
|
/>
|
|
28
28
|
</TestForm>
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
|
|
3
|
-
import { FormattedMessage } from 'react-intl';
|
|
4
|
-
|
|
5
3
|
import arrayMutators from 'final-form-arrays';
|
|
6
4
|
|
|
7
5
|
import {
|
|
@@ -10,6 +8,7 @@ import {
|
|
|
10
8
|
|
|
11
9
|
import FormModal from '../../FormModal';
|
|
12
10
|
import CustomPropertiesFilterFieldArray from './CustomPropertiesFilterFieldArray';
|
|
11
|
+
import { useKintIntl } from '../../hooks';
|
|
13
12
|
|
|
14
13
|
const CustomPropertyFiltersForm = ({
|
|
15
14
|
customProperties,
|
|
@@ -19,30 +18,40 @@ const CustomPropertyFiltersForm = ({
|
|
|
19
18
|
closeEditModal,
|
|
20
19
|
openEditModal,
|
|
21
20
|
},
|
|
21
|
+
intlKey: passedIntlKey,
|
|
22
|
+
intlNS: passedIntlNS,
|
|
22
23
|
labelOverrides = {},
|
|
23
24
|
onSubmit,
|
|
24
25
|
}) => {
|
|
26
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
27
|
+
|
|
25
28
|
return (
|
|
26
29
|
<>
|
|
27
30
|
<Button
|
|
28
31
|
onClick={openEditModal}
|
|
29
32
|
>
|
|
30
33
|
{
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
kintIntl.formatKintMessage({
|
|
35
|
+
id: 'customProperty.editCustomPropertyFilters',
|
|
36
|
+
overrideValue: labelOverrides.editCustomPropertyFilters
|
|
37
|
+
})
|
|
33
38
|
}
|
|
34
39
|
</Button>
|
|
35
40
|
<FormModal
|
|
36
41
|
initialValues={{ filters: filters.length ? filters : [{ rules: [{}] }] }}
|
|
37
42
|
labelOverrides={{
|
|
38
|
-
|
|
43
|
+
saveAndClose: kintIntl.formatKintMessage({
|
|
44
|
+
id: 'apply',
|
|
45
|
+
overrideValue: labelOverrides.apply
|
|
46
|
+
})
|
|
39
47
|
}}
|
|
40
48
|
modalProps={{
|
|
41
49
|
dismissible: true,
|
|
42
50
|
enforceFocus: false,
|
|
43
|
-
label:
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
label: kintIntl.formatKintMessage({
|
|
52
|
+
id: 'customProperty.filterBuilder',
|
|
53
|
+
overrideValue: labelOverrides.filterBuilder
|
|
54
|
+
}),
|
|
46
55
|
onClose: closeEditModal,
|
|
47
56
|
open: editingFilters,
|
|
48
57
|
size: 'medium'
|
|
@@ -67,6 +76,8 @@ CustomPropertyFiltersForm.propTypes = {
|
|
|
67
76
|
closeEditModal: PropTypes.func.isRequired,
|
|
68
77
|
openEditModal: PropTypes.func.isRequired
|
|
69
78
|
}),
|
|
79
|
+
intlKey: PropTypes.string,
|
|
80
|
+
intlNS: PropTypes.string,
|
|
70
81
|
labelOverrides: PropTypes.object,
|
|
71
82
|
onSubmit: PropTypes.func.isRequired
|
|
72
83
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@folio/stripes-erm-components/test/jest/__mock__';
|
|
3
3
|
import { Button } from '@folio/stripes-testing';
|
|
4
|
-
import { TestForm } from '@folio/stripes-erm-components/test/jest/helpers';
|
|
5
4
|
import CustomPropertyFiltersForm from './CustomPropertiesFilterForm';
|
|
6
5
|
|
|
7
|
-
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
8
6
|
import { data } from './testResources';
|
|
7
|
+
import { renderWithKintHarness } from '../../../../test/jest';
|
|
9
8
|
|
|
9
|
+
jest.mock('../../hooks');
|
|
10
10
|
jest.mock('./CustomPropertiesFilterFieldArray', () => () => <div>CustomPropertiesFilterFieldArray</div>);
|
|
11
11
|
|
|
12
12
|
const onSubmit = jest.fn();
|
|
@@ -15,13 +15,10 @@ describe('CustomPropertyFiltersForm', () => {
|
|
|
15
15
|
let renderComponent;
|
|
16
16
|
beforeEach(() => {
|
|
17
17
|
renderComponent = renderWithKintHarness(
|
|
18
|
-
<
|
|
18
|
+
<CustomPropertyFiltersForm
|
|
19
19
|
onSubmit={onSubmit}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{...data}
|
|
23
|
-
/>
|
|
24
|
-
</TestForm>
|
|
20
|
+
{...data}
|
|
21
|
+
/>
|
|
25
22
|
);
|
|
26
23
|
});
|
|
27
24
|
|
|
@@ -30,11 +27,11 @@ describe('CustomPropertyFiltersForm', () => {
|
|
|
30
27
|
expect(getByText('CustomPropertiesFilterFieldArray')).toBeInTheDocument();
|
|
31
28
|
});
|
|
32
29
|
|
|
33
|
-
test('renders the
|
|
34
|
-
await Button('
|
|
30
|
+
test('renders the apply button (disabled)', async () => {
|
|
31
|
+
await Button('Apply').has({ disabled: true });
|
|
35
32
|
});
|
|
36
33
|
|
|
37
|
-
test('renders the Edit
|
|
38
|
-
await Button('Edit
|
|
34
|
+
test('renders the Edit custom property filters button', async () => {
|
|
35
|
+
await Button('Edit custom property filters').exists();
|
|
39
36
|
});
|
|
40
37
|
});
|