@k-int/stripes-kint-components 2.8.1 → 3.0.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 +16 -1
- package/es/index.js +54 -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 +67 -47
- 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 +91 -44
- 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 +38 -28
- package/es/lib/EditableRefdataList/EditableRefdataList.js +44 -32
- 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 +48 -4
- package/es/lib/utils/parseErrorResponse.js +91 -0
- 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 +12 -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 +109 -34
- 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 +115 -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 +47 -28
- package/src/lib/EditableRefdataList/EditableRefdataList.js +58 -33
- 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 +14 -1
- package/src/lib/utils/parseErrorResponse.js +18 -0
- 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
|
@@ -9,8 +9,6 @@ var _react = require("react");
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var _reactIntl = require("react-intl");
|
|
13
|
-
|
|
14
12
|
var _components = require("@folio/stripes/components");
|
|
15
13
|
|
|
16
14
|
var _hooks = require("../../hooks");
|
|
@@ -50,13 +48,15 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
50
48
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
51
49
|
|
|
52
50
|
var CustomPropertiesFilter = function CustomPropertiesFilter(_ref) {
|
|
53
|
-
var _parsedFilterData$
|
|
51
|
+
var _parsedFilterData$num, _parsedFilterData$num2;
|
|
54
52
|
|
|
55
53
|
var _ref$activeFilters = _ref.activeFilters,
|
|
56
54
|
custPropFilters = _ref$activeFilters.customProperties,
|
|
57
55
|
restOfFilters = _objectWithoutProperties(_ref$activeFilters, _excluded),
|
|
58
56
|
customPropertiesEndpoint = _ref.customPropertiesEndpoint,
|
|
59
57
|
filterHandlers = _ref.filterHandlers,
|
|
58
|
+
passedIntlKey = _ref.intlKey,
|
|
59
|
+
passedIntlNS = _ref.intlNS,
|
|
60
60
|
_ref$labelOverrides = _ref.labelOverrides,
|
|
61
61
|
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides;
|
|
62
62
|
|
|
@@ -73,6 +73,8 @@ var CustomPropertiesFilter = function CustomPropertiesFilter(_ref) {
|
|
|
73
73
|
return setEditingFilters(false);
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
var kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
77
|
+
|
|
76
78
|
var _useCustomProperties = (0, _hooks.useCustomProperties)({
|
|
77
79
|
endpoint: customPropertiesEndpoint,
|
|
78
80
|
returnQueryObject: true,
|
|
@@ -95,34 +97,16 @@ var CustomPropertiesFilter = function CustomPropertiesFilter(_ref) {
|
|
|
95
97
|
custprops = _useCustomProperties.data,
|
|
96
98
|
isLoading = _useCustomProperties.isLoading;
|
|
97
99
|
|
|
98
|
-
var parsedFilterData = (0, _useParseActiveFilterStrings.default)(custPropFilters || []);
|
|
99
|
-
|
|
100
|
-
var getFiltersApplied = function getFiltersApplied() {
|
|
101
|
-
var _labelOverrides$filte, _parsedFilterData$num2;
|
|
102
|
-
|
|
103
|
-
if (labelOverrides.filtersApplied && typeof labelOverrides.filtersApplied === 'function') {
|
|
104
|
-
var _parsedFilterData$num;
|
|
105
|
-
|
|
106
|
-
return labelOverrides.filtersApplied((_parsedFilterData$num = parsedFilterData === null || parsedFilterData === void 0 ? void 0 : parsedFilterData.numberOfFilters) !== null && _parsedFilterData$num !== void 0 ? _parsedFilterData$num : 0);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return (_labelOverrides$filte = labelOverrides.filtersApplied) !== null && _labelOverrides$filte !== void 0 ? _labelOverrides$filte : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
110
|
-
id: "stripes-kint-components.customProperty.filtersApplied",
|
|
111
|
-
values: {
|
|
112
|
-
count: (_parsedFilterData$num2 = parsedFilterData === null || parsedFilterData === void 0 ? void 0 : parsedFilterData.numberOfFilters) !== null && _parsedFilterData$num2 !== void 0 ? _parsedFilterData$num2 : 0
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
};
|
|
100
|
+
var parsedFilterData = (0, _useParseActiveFilterStrings.default)(custPropFilters || [], passedIntlKey, passedIntlNS, labelOverrides);
|
|
116
101
|
|
|
117
102
|
if (isLoading) {
|
|
118
|
-
var _labelOverrides$custo;
|
|
119
|
-
|
|
120
103
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Accordion, {
|
|
121
104
|
closedByDefault: true,
|
|
122
105
|
header: _components.FilterAccordionHeader,
|
|
123
106
|
id: "clickable-custprop-filter",
|
|
124
|
-
label:
|
|
125
|
-
id:
|
|
107
|
+
label: kintIntl.formatKintMessage({
|
|
108
|
+
id: 'customProperties',
|
|
109
|
+
overrideValue: labelOverrides.customProperties
|
|
126
110
|
}),
|
|
127
111
|
separator: false,
|
|
128
112
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {})
|
|
@@ -156,11 +140,12 @@ var CustomPropertiesFilter = function CustomPropertiesFilter(_ref) {
|
|
|
156
140
|
|
|
157
141
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Accordion, {
|
|
158
142
|
closedByDefault: true,
|
|
159
|
-
displayClearButton: ((_parsedFilterData$
|
|
143
|
+
displayClearButton: ((_parsedFilterData$num = parsedFilterData === null || parsedFilterData === void 0 ? void 0 : parsedFilterData.numberOfFilters) !== null && _parsedFilterData$num !== void 0 ? _parsedFilterData$num : 0) > 0,
|
|
160
144
|
header: _components.FilterAccordionHeader,
|
|
161
145
|
id: "clickable-custprop-filter",
|
|
162
|
-
label:
|
|
163
|
-
id:
|
|
146
|
+
label: kintIntl.formatKintMessage({
|
|
147
|
+
id: 'customProperties',
|
|
148
|
+
overrideValue: labelOverrides.customProperties
|
|
164
149
|
}),
|
|
165
150
|
onClearFilter: function onClearFilter() {
|
|
166
151
|
return filterHandlers.state(_objectSpread(_objectSpread({}, restOfFilters), {}, {
|
|
@@ -170,7 +155,12 @@ var CustomPropertiesFilter = function CustomPropertiesFilter(_ref) {
|
|
|
170
155
|
separator: false,
|
|
171
156
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Layout, {
|
|
172
157
|
className: "padding-bottom-gutter",
|
|
173
|
-
children:
|
|
158
|
+
children: kintIntl.formatKintMessage({
|
|
159
|
+
id: 'customProperty.filtersApplied',
|
|
160
|
+
overrideValue: labelOverrides.filtersApplied
|
|
161
|
+
}, {
|
|
162
|
+
count: (_parsedFilterData$num2 = parsedFilterData === null || parsedFilterData === void 0 ? void 0 : parsedFilterData.numberOfFilters) !== null && _parsedFilterData$num2 !== void 0 ? _parsedFilterData$num2 : 0
|
|
163
|
+
})
|
|
174
164
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesFilterForm.default, {
|
|
175
165
|
customProperties: custprops,
|
|
176
166
|
editingFilters: editingFilters,
|
|
@@ -189,6 +179,8 @@ CustomPropertiesFilter.propTypes = {
|
|
|
189
179
|
activeFilters: _propTypes.default.object,
|
|
190
180
|
customPropertiesEndpoint: _propTypes.default.string,
|
|
191
181
|
filterHandlers: _propTypes.default.object,
|
|
182
|
+
intlKey: _propTypes.default.string,
|
|
183
|
+
intlNS: _propTypes.default.string,
|
|
192
184
|
labelOverrides: _propTypes.default.object
|
|
193
185
|
};
|
|
194
186
|
var _default = CustomPropertiesFilter;
|
|
@@ -10,12 +10,14 @@ var _reactRouterDom = require("react-router-dom");
|
|
|
10
10
|
|
|
11
11
|
var _stripesTesting = require("@folio/stripes-testing");
|
|
12
12
|
|
|
13
|
-
var _helpers = require("../../../../test/jest/helpers");
|
|
14
|
-
|
|
15
13
|
var _testResources = require("./testResources");
|
|
16
14
|
|
|
17
15
|
var _CustomPropertiesFilter = _interopRequireDefault(require("./CustomPropertiesFilter"));
|
|
18
16
|
|
|
17
|
+
var _helpers = _interopRequireDefault(require("../../../../test/helpers"));
|
|
18
|
+
|
|
19
|
+
var _jest = require("../../../../test/jest");
|
|
20
|
+
|
|
19
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
22
|
|
|
21
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -26,6 +28,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
26
28
|
|
|
27
29
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
28
30
|
|
|
31
|
+
jest.mock('../../hooks');
|
|
29
32
|
jest.mock('./CustomPropertiesFilterForm', function () {
|
|
30
33
|
return function () {
|
|
31
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -36,16 +39,15 @@ jest.mock('./CustomPropertiesFilterForm', function () {
|
|
|
36
39
|
describe('CustomPropertiesFilter', function () {
|
|
37
40
|
var renderComponent;
|
|
38
41
|
beforeEach(function () {
|
|
39
|
-
renderComponent = (0,
|
|
42
|
+
renderComponent = (0, _jest.renderWithKintHarness)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
40
43
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesFilter.default, {
|
|
41
44
|
activeFilters: _testResources.activeFilters,
|
|
42
45
|
customPropertiesEndpoint: "erm/custprops",
|
|
43
|
-
filterHandlers: _testResources.filterHandlers
|
|
44
|
-
labelOverrides: _testResources.labelOverrides
|
|
46
|
+
filterHandlers: _testResources.filterHandlers
|
|
45
47
|
})
|
|
46
|
-
}));
|
|
48
|
+
}), {}, _helpers.default);
|
|
47
49
|
});
|
|
48
|
-
test('renders the
|
|
50
|
+
test('renders the Custom properties Accordion by id', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
49
51
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
50
52
|
while (1) {
|
|
51
53
|
switch (_context.prev = _context.next) {
|
|
@@ -62,13 +64,13 @@ describe('CustomPropertiesFilter', function () {
|
|
|
62
64
|
}
|
|
63
65
|
}, _callee);
|
|
64
66
|
})));
|
|
65
|
-
test('renders the
|
|
67
|
+
test('renders the Custom properties Accordion', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
66
68
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
67
69
|
while (1) {
|
|
68
70
|
switch (_context2.prev = _context2.next) {
|
|
69
71
|
case 0:
|
|
70
72
|
_context2.next = 2;
|
|
71
|
-
return (0, _stripesTesting.Accordion)('
|
|
73
|
+
return (0, _stripesTesting.Accordion)('Custom properties').exists();
|
|
72
74
|
|
|
73
75
|
case 2:
|
|
74
76
|
case "end":
|
|
@@ -77,7 +79,7 @@ describe('CustomPropertiesFilter', function () {
|
|
|
77
79
|
}
|
|
78
80
|
}, _callee2);
|
|
79
81
|
})));
|
|
80
|
-
test('renders the edit
|
|
82
|
+
test('renders the edit custom property filters button', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
81
83
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
82
84
|
while (1) {
|
|
83
85
|
switch (_context3.prev = _context3.next) {
|
|
@@ -7,8 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
|
|
10
|
-
var _reactIntl = require("react-intl");
|
|
11
|
-
|
|
12
10
|
var _reactFinalForm = require("react-final-form");
|
|
13
11
|
|
|
14
12
|
var _reactFinalFormArrays = require("react-final-form-arrays");
|
|
@@ -21,6 +19,8 @@ var _validators = require("../../utils/validators");
|
|
|
21
19
|
|
|
22
20
|
var _CustomPropertiesRule = _interopRequireDefault(require("./CustomPropertiesRule"));
|
|
23
21
|
|
|
22
|
+
var _hooks = require("../../hooks");
|
|
23
|
+
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
25
|
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -44,12 +44,14 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
44
44
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
45
|
|
|
46
46
|
var CustomPropertiesFilterField = function CustomPropertiesFilterField(_ref) {
|
|
47
|
-
var
|
|
47
|
+
var _customProperties$fin, _customProperties$fin2, _fields$value$index2;
|
|
48
48
|
|
|
49
49
|
var _ref$customProperties = _ref.customProperties,
|
|
50
50
|
customProperties = _ref$customProperties === void 0 ? [] : _ref$customProperties,
|
|
51
51
|
fields = _ref.fields,
|
|
52
52
|
index = _ref.index,
|
|
53
|
+
passedIntlKey = _ref.intlKey,
|
|
54
|
+
passedIntlNS = _ref.intlNS,
|
|
53
55
|
_ref$labelOverrides = _ref.labelOverrides,
|
|
54
56
|
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
55
57
|
name = _ref.name;
|
|
@@ -60,50 +62,35 @@ var CustomPropertiesFilterField = function CustomPropertiesFilterField(_ref) {
|
|
|
60
62
|
push = _useForm.mutators.push;
|
|
61
63
|
|
|
62
64
|
var _useFormState = (0, _reactFinalForm.useFormState)(),
|
|
63
|
-
values = _useFormState.values;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var getRetiredName = function getRetiredName(customProperty) {
|
|
67
|
-
var _labelOverrides$retir;
|
|
68
|
-
|
|
69
|
-
// Label override for default card title,
|
|
70
|
-
if (labelOverrides.retiredName && typeof labelOverrides.retiredName === 'function') {
|
|
71
|
-
return labelOverrides.retiredName(customProperty.label);
|
|
72
|
-
} // Label override for default title or finally built in default
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return (_labelOverrides$retir = labelOverrides.retiredName) !== null && _labelOverrides$retir !== void 0 ? _labelOverrides$retir : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
76
|
-
id: "stripes-kint-components.customProperty.retiredName",
|
|
77
|
-
values: {
|
|
78
|
-
name: customProperty.label
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
};
|
|
65
|
+
values = _useFormState.values;
|
|
82
66
|
|
|
67
|
+
var kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
83
68
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
84
69
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
85
70
|
id: "input-custprop-".concat(index),
|
|
86
|
-
label:
|
|
87
|
-
id:
|
|
71
|
+
label: kintIntl.formatKintMessage({
|
|
72
|
+
id: 'customProperty',
|
|
73
|
+
overrideValue: labelOverrides.customProperty
|
|
88
74
|
}),
|
|
89
75
|
name: "".concat(name, ".customProperty"),
|
|
90
76
|
placeholder: " ",
|
|
91
77
|
render: function render(fieldProps) {
|
|
92
78
|
var _Object$entries;
|
|
93
79
|
|
|
80
|
+
var sortedGroupedCustProps = (_Object$entries = Object.entries(groupedCustomProperties)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.sort(function (a, b) {
|
|
81
|
+
if (a[0] === 'isNull') return -1; // Make sure noContext is at top
|
|
82
|
+
|
|
83
|
+
if (a[0].toLowerCase() < b[0].toLowerCase()) return -1;
|
|
84
|
+
if (a[0].toLowerCase() > b[0].toLowerCase()) return 1;
|
|
85
|
+
return 0;
|
|
86
|
+
});
|
|
94
87
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Select, _objectSpread(_objectSpread({}, fieldProps), {}, {
|
|
95
88
|
placeholder: null // placeholder default causes issues
|
|
96
89
|
,
|
|
97
90
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
98
91
|
value: "",
|
|
99
92
|
children: " "
|
|
100
|
-
}
|
|
101
|
-
if (a[0] === 'isNull') return -1; // Make sure noContext is at top
|
|
102
|
-
|
|
103
|
-
if (a[0].toLowerCase() < b[0].toLowerCase()) return -1;
|
|
104
|
-
if (a[0].toLowerCase() > b[0].toLowerCase()) return 1;
|
|
105
|
-
return 0;
|
|
106
|
-
}).map(function (_ref2) {
|
|
93
|
+
}, "empty-option"), sortedGroupedCustProps.map(function (_ref2) {
|
|
107
94
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
108
95
|
key = _ref3[0],
|
|
109
96
|
value = _ref3[1];
|
|
@@ -113,16 +100,22 @@ var CustomPropertiesFilterField = function CustomPropertiesFilterField(_ref) {
|
|
|
113
100
|
children: value.map(function (v) {
|
|
114
101
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
115
102
|
value: v.name,
|
|
116
|
-
children: v.retired ?
|
|
103
|
+
children: v.retired ? kintIntl.formatKintMessage({
|
|
104
|
+
id: 'customProperty.retiredName',
|
|
105
|
+
overrideValue: labelOverrides.retiredName
|
|
106
|
+
}, {
|
|
107
|
+
name: v.label
|
|
108
|
+
}) : v.label
|
|
117
109
|
}, v.id);
|
|
118
110
|
})
|
|
119
|
-
});
|
|
111
|
+
}, "custom-property-optgroup-".concat(key));
|
|
120
112
|
})]
|
|
121
113
|
}));
|
|
122
114
|
},
|
|
123
115
|
required: true,
|
|
124
116
|
validate: _validators.required
|
|
125
117
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
118
|
+
"data-testid": "selected-custprop-name-".concat(index),
|
|
126
119
|
id: "selected-custprop-name-".concat(index),
|
|
127
120
|
style: {
|
|
128
121
|
display: 'none'
|
|
@@ -140,8 +133,9 @@ var CustomPropertiesFilterField = function CustomPropertiesFilterField(_ref) {
|
|
|
140
133
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Label, {
|
|
141
134
|
id: "rule-column-header-comparator",
|
|
142
135
|
required: true,
|
|
143
|
-
children:
|
|
144
|
-
id:
|
|
136
|
+
children: kintIntl.formatKintMessage({
|
|
137
|
+
id: 'comparator',
|
|
138
|
+
overrideValue: labelOverrides.comparator
|
|
145
139
|
})
|
|
146
140
|
})
|
|
147
141
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
@@ -149,8 +143,9 @@ var CustomPropertiesFilterField = function CustomPropertiesFilterField(_ref) {
|
|
|
149
143
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Label, {
|
|
150
144
|
id: "rule-column-header-value",
|
|
151
145
|
required: true,
|
|
152
|
-
children:
|
|
153
|
-
id:
|
|
146
|
+
children: kintIntl.formatKintMessage({
|
|
147
|
+
id: 'value',
|
|
148
|
+
overrideValue: labelOverrides.value
|
|
154
149
|
})
|
|
155
150
|
})
|
|
156
151
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
@@ -172,6 +167,7 @@ var CustomPropertiesFilterField = function CustomPropertiesFilterField(_ref) {
|
|
|
172
167
|
return t.name === fields.value[index].customProperty;
|
|
173
168
|
}),
|
|
174
169
|
index: ruleFieldIndex,
|
|
170
|
+
labelOverrides: labelOverrides,
|
|
175
171
|
name: ruleFieldName,
|
|
176
172
|
onDelete: function onDelete() {
|
|
177
173
|
return ruleFields.remove(ruleFieldIndex);
|
|
@@ -186,8 +182,9 @@ var CustomPropertiesFilterField = function CustomPropertiesFilterField(_ref) {
|
|
|
186
182
|
onClick: function onClick() {
|
|
187
183
|
return push("".concat(name, ".rules"));
|
|
188
184
|
},
|
|
189
|
-
children:
|
|
190
|
-
id:
|
|
185
|
+
children: kintIntl.formatKintMessage({
|
|
186
|
+
id: 'addRule',
|
|
187
|
+
overrideValue: labelOverrides.addRule
|
|
191
188
|
})
|
|
192
189
|
})]
|
|
193
190
|
});
|
|
@@ -197,6 +194,8 @@ CustomPropertiesFilterField.propTypes = {
|
|
|
197
194
|
customProperties: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
198
195
|
fields: _propTypes.default.object,
|
|
199
196
|
index: _propTypes.default.number,
|
|
197
|
+
intlKey: _propTypes.default.string,
|
|
198
|
+
intlNS: _propTypes.default.string,
|
|
200
199
|
labelOverrides: _propTypes.default.object,
|
|
201
200
|
name: _propTypes.default.string
|
|
202
201
|
};
|
|
@@ -2,40 +2,55 @@
|
|
|
2
2
|
|
|
3
3
|
var _react = _interopRequireDefault(require("react"));
|
|
4
4
|
|
|
5
|
+
var _reactFinalFormArrays = require("react-final-form-arrays");
|
|
6
|
+
|
|
5
7
|
require("@folio/stripes-erm-components/test/jest/__mock__");
|
|
6
8
|
|
|
7
9
|
var _helpers = require("@folio/stripes-erm-components/test/jest/helpers");
|
|
8
10
|
|
|
9
11
|
var _reactRouterDom = require("react-router-dom");
|
|
10
12
|
|
|
11
|
-
var
|
|
13
|
+
var _CustomPropertiesFilterField = _interopRequireDefault(require("./CustomPropertiesFilterField"));
|
|
12
14
|
|
|
13
|
-
var
|
|
15
|
+
var _customProperties = _interopRequireDefault(require("../../../../test/jest/customProperties"));
|
|
14
16
|
|
|
15
|
-
var
|
|
17
|
+
var _jest = require("../../../../test/jest");
|
|
18
|
+
|
|
19
|
+
var _testResources = require("./testResources");
|
|
16
20
|
|
|
17
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
22
|
|
|
19
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
24
|
|
|
25
|
+
jest.mock('../../hooks');
|
|
21
26
|
var onSubmit = jest.fn();
|
|
22
27
|
var renderComponent;
|
|
23
28
|
describe('CustomPropertiesFilterField', function () {
|
|
24
|
-
renderComponent = (0,
|
|
29
|
+
renderComponent = (0, _jest.renderWithKintHarness)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
25
30
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_helpers.TestForm, {
|
|
31
|
+
initialValues: {
|
|
32
|
+
filters: _testResources.data.filters
|
|
33
|
+
},
|
|
26
34
|
onSubmit: onSubmit,
|
|
27
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, {
|
|
36
|
+
name: "filters",
|
|
37
|
+
children: function children(_ref) {
|
|
38
|
+
var fields = _ref.fields;
|
|
39
|
+
return fields.map(function (name, index) {
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesFilterField.default, {
|
|
41
|
+
customProperties: _customProperties.default,
|
|
42
|
+
fields: fields,
|
|
43
|
+
index: index,
|
|
44
|
+
name: name
|
|
45
|
+
}, "custom-property-filter-field-".concat(name, "[").concat(index, "]"));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
33
48
|
})
|
|
34
49
|
})
|
|
35
50
|
}));
|
|
36
|
-
test('displays the
|
|
51
|
+
test('displays the Custom property label', function () {
|
|
37
52
|
var _renderComponent = renderComponent,
|
|
38
|
-
|
|
39
|
-
expect(
|
|
53
|
+
getByTestId = _renderComponent.getByTestId;
|
|
54
|
+
expect(getByTestId('selected-custprop-name-0')).toHaveTextContent('Author Identification');
|
|
40
55
|
});
|
|
41
56
|
});
|
|
@@ -7,8 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
|
|
10
|
-
var _reactIntl = require("react-intl");
|
|
11
|
-
|
|
12
10
|
var _reactFinalForm = require("react-final-form");
|
|
13
11
|
|
|
14
12
|
var _reactFinalFormArrays = require("react-final-form-arrays");
|
|
@@ -17,61 +15,39 @@ var _components = require("@folio/stripes/components");
|
|
|
17
15
|
|
|
18
16
|
var _CustomPropertiesFilterField = _interopRequireDefault(require("./CustomPropertiesFilterField"));
|
|
19
17
|
|
|
18
|
+
var _hooks = require("../../hooks");
|
|
19
|
+
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
24
|
var CustomPropertiesFilterFieldArray = function CustomPropertiesFilterFieldArray(_ref) {
|
|
25
|
-
var _labelOverrides$addFi;
|
|
26
|
-
|
|
27
25
|
var customProperties = _ref.customProperties,
|
|
26
|
+
passedIntlKey = _ref.intlKey,
|
|
27
|
+
passedIntlNS = _ref.intlNS,
|
|
28
28
|
_ref$labelOverrides = _ref.labelOverrides,
|
|
29
29
|
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides;
|
|
30
30
|
|
|
31
31
|
var _useForm = (0, _reactFinalForm.useForm)(),
|
|
32
32
|
push = _useForm.mutators.push;
|
|
33
33
|
|
|
34
|
-
var
|
|
35
|
-
var _labelOverrides$custo;
|
|
36
|
-
|
|
37
|
-
if (labelOverrides.customPropertyFilter && typeof labelOverrides.customPropertyFilter === 'function') {
|
|
38
|
-
return labelOverrides.customPropertyFilter(index);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return (_labelOverrides$custo = labelOverrides.customPropertyFilter) !== null && _labelOverrides$custo !== void 0 ? _labelOverrides$custo : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
42
|
-
id: "stripes-kint-components.customProperty.filterIndex",
|
|
43
|
-
values: {
|
|
44
|
-
index: index + 1
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
var getTooltipText = function getTooltipText(index) {
|
|
50
|
-
var _labelOverrides$remov;
|
|
51
|
-
|
|
52
|
-
if (labelOverrides.removeFilter && typeof labelOverrides.removeFilter === 'function') {
|
|
53
|
-
return labelOverrides.removeFilter(index);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return (_labelOverrides$remov = labelOverrides.removeFilter) !== null && _labelOverrides$remov !== void 0 ? _labelOverrides$remov : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
57
|
-
id: "stripes-kint-components.customProperty.removeFilter",
|
|
58
|
-
values: {
|
|
59
|
-
number: index + 1
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
|
|
34
|
+
var kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
64
35
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
65
36
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, {
|
|
66
37
|
name: "filters",
|
|
67
38
|
children: function children(_ref2) {
|
|
68
39
|
var fields = _ref2.fields;
|
|
69
40
|
return fields.map(function (name, index) {
|
|
70
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
41
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
71
42
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Card, {
|
|
72
43
|
headerEnd: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
73
44
|
id: "custom-property-filter-card-delete-[".concat(index, "]-tooltip"),
|
|
74
|
-
text:
|
|
45
|
+
text: kintIntl.formatKintMessage({
|
|
46
|
+
id: 'customProperty.removeFilter',
|
|
47
|
+
overrideValue: labelOverrides.removeFilter
|
|
48
|
+
}, {
|
|
49
|
+
index: index + 1
|
|
50
|
+
}),
|
|
75
51
|
children: function children(_ref3) {
|
|
76
52
|
var ref = _ref3.ref,
|
|
77
53
|
ariaIds = _ref3.ariaIds;
|
|
@@ -87,7 +63,12 @@ var CustomPropertiesFilterFieldArray = function CustomPropertiesFilterFieldArray
|
|
|
87
63
|
}
|
|
88
64
|
}),
|
|
89
65
|
headerStart: /*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
90
|
-
children:
|
|
66
|
+
children: kintIntl.formatKintMessage({
|
|
67
|
+
id: 'customProperty.filterIndex',
|
|
68
|
+
overrideValue: labelOverrides.customPropertyFilter
|
|
69
|
+
}, {
|
|
70
|
+
index: index + 1
|
|
71
|
+
})
|
|
91
72
|
}),
|
|
92
73
|
marginBottom0: index !== fields.length - 1,
|
|
93
74
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesFilterField.default, {
|
|
@@ -96,14 +77,15 @@ var CustomPropertiesFilterFieldArray = function CustomPropertiesFilterFieldArray
|
|
|
96
77
|
index: index,
|
|
97
78
|
labelOverrides: labelOverrides,
|
|
98
79
|
name: name
|
|
99
|
-
})
|
|
80
|
+
}, "custom-property-filter-field-".concat(name, "[").concat(index, "]"))
|
|
100
81
|
}, "custom-property-filter-card[".concat(index, "]")), index < fields.value.length - 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Layout, {
|
|
101
82
|
className: "textCentered",
|
|
102
|
-
children:
|
|
103
|
-
id:
|
|
83
|
+
children: kintIntl.formatKintMessage({
|
|
84
|
+
id: 'AND',
|
|
85
|
+
overrideValue: labelOverrides.AND
|
|
104
86
|
})
|
|
105
|
-
})]
|
|
106
|
-
});
|
|
87
|
+
}, "custom-property-filter[".concat(index, "]-AND"))]
|
|
88
|
+
}, "custom-property-filter-card[".concat(index, "]-container"));
|
|
107
89
|
});
|
|
108
90
|
}
|
|
109
91
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
@@ -112,8 +94,9 @@ var CustomPropertiesFilterFieldArray = function CustomPropertiesFilterFieldArray
|
|
|
112
94
|
rules: [{}]
|
|
113
95
|
});
|
|
114
96
|
},
|
|
115
|
-
children:
|
|
116
|
-
id:
|
|
97
|
+
children: kintIntl.formatKintMessage({
|
|
98
|
+
id: 'customProperty.addFilter',
|
|
99
|
+
overrideValue: labelOverrides.addFilter
|
|
117
100
|
})
|
|
118
101
|
})]
|
|
119
102
|
});
|
|
@@ -121,6 +104,8 @@ var CustomPropertiesFilterFieldArray = function CustomPropertiesFilterFieldArray
|
|
|
121
104
|
|
|
122
105
|
CustomPropertiesFilterFieldArray.propTypes = {
|
|
123
106
|
customProperties: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
107
|
+
intlKey: _propTypes.default.string,
|
|
108
|
+
intlNS: _propTypes.default.string,
|
|
124
109
|
labelOverrides: _propTypes.default.object
|
|
125
110
|
};
|
|
126
111
|
var _default = CustomPropertiesFilterFieldArray;
|
|
@@ -14,11 +14,11 @@ var _stripesTesting = require("@folio/stripes-testing");
|
|
|
14
14
|
|
|
15
15
|
var _reactFinalFormArrays = require("react-final-form-arrays");
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _CustomPropertiesFilterFieldArray = _interopRequireDefault(require("./CustomPropertiesFilterFieldArray"));
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _customProperties = _interopRequireDefault(require("../../../../test/jest/customProperties"));
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _jest = require("../../../../test/jest");
|
|
22
22
|
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
24
|
|
|
@@ -30,6 +30,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
30
30
|
|
|
31
31
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
32
32
|
|
|
33
|
+
jest.mock('../../hooks');
|
|
33
34
|
jest.mock('./CustomPropertiesFilterField', function () {
|
|
34
35
|
return function () {
|
|
35
36
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -41,12 +42,11 @@ var onSubmit = jest.fn();
|
|
|
41
42
|
var renderComponent;
|
|
42
43
|
describe('CustomPropertiesFilterFieldArray', function () {
|
|
43
44
|
beforeEach(function () {
|
|
44
|
-
renderComponent = (0,
|
|
45
|
+
renderComponent = (0, _jest.renderWithKintHarness)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_helpers.TestForm, {
|
|
45
46
|
onSubmit: onSubmit,
|
|
46
47
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, {
|
|
47
48
|
component: _CustomPropertiesFilterFieldArray.default,
|
|
48
|
-
customProperties:
|
|
49
|
-
labelOverrides: _testResources.labelOverrides,
|
|
49
|
+
customProperties: _customProperties.default,
|
|
50
50
|
name: "customProperties"
|
|
51
51
|
})
|
|
52
52
|
}));
|