@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import {
|
|
2
|
+
import { FormattedNumber } from 'react-intl';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
Card,
|
|
@@ -13,14 +13,19 @@ import {
|
|
|
13
13
|
} from '@folio/stripes/components';
|
|
14
14
|
|
|
15
15
|
import * as CUSTPROP_TYPES from '../../constants/customProperties';
|
|
16
|
+
import { useKintIntl } from '../../hooks';
|
|
16
17
|
|
|
17
18
|
const CustomPropertyCard = ({
|
|
18
19
|
ctx,
|
|
19
20
|
customProperty,
|
|
20
21
|
customPropertyDefinition = {},
|
|
21
22
|
index,
|
|
23
|
+
intlKey: passedIntlKey,
|
|
24
|
+
intlNS: passedIntlNS,
|
|
22
25
|
labelOverrides = {}
|
|
23
26
|
}) => {
|
|
27
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
28
|
+
|
|
24
29
|
// We only need to display primary and set properties
|
|
25
30
|
const toDisplay = !!(customPropertyDefinition.primary || customProperty);
|
|
26
31
|
|
|
@@ -31,41 +36,13 @@ const CustomPropertyCard = ({
|
|
|
31
36
|
const internalFalse = customProperty?.internal === false ||
|
|
32
37
|
(customProperty?.internal === undefined && customPropertyDefinition.defaultInternal === false);
|
|
33
38
|
|
|
34
|
-
// Deal with all the possible label override options
|
|
35
|
-
const getRetiredCardTitle = () => {
|
|
36
|
-
// Label override for default card title,
|
|
37
|
-
if (labelOverrides.retiredName && typeof labelOverrides.retiredName === 'function') {
|
|
38
|
-
return (
|
|
39
|
-
labelOverrides.retiredName(customPropertyDefinition.name)
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Label override for default title or finally built in default
|
|
44
|
-
return (
|
|
45
|
-
labelOverrides.retiredName ??
|
|
46
|
-
<FormattedMessage id="stripes-kint-components.customProperty.retiredName" values={{ name: customPropertyDefinition.label }} />
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const getInternalLabel = () => {
|
|
51
|
-
if (internalFalse) {
|
|
52
|
-
return (
|
|
53
|
-
labelOverrides.internalFalse ??
|
|
54
|
-
<FormattedMessage id="stripes-kint-components.customProperty.internalFalse" />
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
labelOverrides.internalTrue ??
|
|
60
|
-
<FormattedMessage id="stripes-kint-components.customProperty.internalTrue" />
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
39
|
const renderValue = () => {
|
|
65
40
|
if (!customProperty) {
|
|
66
41
|
return (
|
|
67
|
-
|
|
68
|
-
|
|
42
|
+
kintIntl.formatKintMessage({
|
|
43
|
+
id: 'notSet',
|
|
44
|
+
overrideValue: labelOverrides.notSet
|
|
45
|
+
})
|
|
69
46
|
);
|
|
70
47
|
}
|
|
71
48
|
|
|
@@ -97,7 +74,10 @@ const CustomPropertyCard = ({
|
|
|
97
74
|
<>
|
|
98
75
|
<strong>
|
|
99
76
|
{customPropertyDefinition.retired ?
|
|
100
|
-
|
|
77
|
+
(kintIntl.formatKintMessage({
|
|
78
|
+
id: 'customProperty.retiredName',
|
|
79
|
+
overrideValue: labelOverrides.retiredName
|
|
80
|
+
}, { name: customPropertyDefinition.label })) :
|
|
101
81
|
customPropertyDefinition.label
|
|
102
82
|
}
|
|
103
83
|
</strong>
|
|
@@ -114,8 +94,10 @@ const CustomPropertyCard = ({
|
|
|
114
94
|
<Col xs={6}>
|
|
115
95
|
<KeyValue
|
|
116
96
|
label={
|
|
117
|
-
|
|
118
|
-
|
|
97
|
+
kintIntl.formatKintMessage({
|
|
98
|
+
id: 'valueOrValues',
|
|
99
|
+
overrideValue: labelOverrides.valueOrValues
|
|
100
|
+
})
|
|
119
101
|
}
|
|
120
102
|
>
|
|
121
103
|
{renderValue()}
|
|
@@ -125,8 +107,10 @@ const CustomPropertyCard = ({
|
|
|
125
107
|
<Col xs={6}>
|
|
126
108
|
<KeyValue
|
|
127
109
|
label={
|
|
128
|
-
|
|
129
|
-
|
|
110
|
+
kintIntl.formatKintMessage({
|
|
111
|
+
id: 'customProperties.internalNote',
|
|
112
|
+
overrideValue: labelOverrides.internalNote
|
|
113
|
+
})
|
|
130
114
|
}
|
|
131
115
|
>
|
|
132
116
|
<span
|
|
@@ -142,19 +126,26 @@ const CustomPropertyCard = ({
|
|
|
142
126
|
<Col xs={6}>
|
|
143
127
|
<KeyValue
|
|
144
128
|
label={
|
|
145
|
-
|
|
146
|
-
|
|
129
|
+
kintIntl.formatKintMessage({
|
|
130
|
+
id: 'customProperties.visibility',
|
|
131
|
+
overrideValue: labelOverrides.visibility
|
|
132
|
+
})
|
|
147
133
|
}
|
|
148
134
|
>
|
|
149
|
-
{
|
|
135
|
+
{kintIntl.formatKintMessage({
|
|
136
|
+
id: 'customProperties.internalFalse',
|
|
137
|
+
overrideValue: labelOverrides.internalFalse
|
|
138
|
+
})}
|
|
150
139
|
</KeyValue>
|
|
151
140
|
</Col>
|
|
152
141
|
{internalFalse &&
|
|
153
142
|
<Col xs={6}>
|
|
154
143
|
<KeyValue
|
|
155
144
|
label={
|
|
156
|
-
|
|
157
|
-
|
|
145
|
+
kintIntl.formatKintMessage({
|
|
146
|
+
id: 'customProperties.publicNote',
|
|
147
|
+
overrideValue: labelOverrides.publicNote
|
|
148
|
+
})
|
|
158
149
|
}
|
|
159
150
|
>
|
|
160
151
|
{customProperty?.publicNote ? (
|
|
@@ -179,6 +170,8 @@ CustomPropertyCard.propTypes = {
|
|
|
179
170
|
customProperty: PropTypes.object,
|
|
180
171
|
customPropertyDefinition: PropTypes.object,
|
|
181
172
|
index: PropTypes.number,
|
|
173
|
+
intlKey: PropTypes.string,
|
|
174
|
+
intlNS: PropTypes.string,
|
|
182
175
|
labelOverrides: PropTypes.object,
|
|
183
176
|
};
|
|
184
177
|
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React, { useEffect, useState, useContext } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { FormattedMessage, useIntl } from 'react-intl';
|
|
4
3
|
|
|
5
4
|
import { ConfirmationModal } from '@folio/stripes/components';
|
|
6
5
|
import { CalloutContext } from '@folio/stripes/core';
|
|
7
6
|
|
|
8
|
-
import { useMutateRefdataCategory, useRefdata } from '../hooks';
|
|
7
|
+
import { useKintIntl, useMutateRefdataCategory, useRefdata } from '../hooks';
|
|
9
8
|
|
|
10
9
|
import ActionList from '../ActionList';
|
|
11
10
|
import { required } from '../utils/validators';
|
|
11
|
+
import { parseErrorResponse } from '../utils';
|
|
12
12
|
|
|
13
13
|
const propTypes = {
|
|
14
14
|
afterQueryCalls: PropTypes.object,
|
|
15
15
|
catchQueryCalls: PropTypes.object,
|
|
16
|
+
intlKey: PropTypes.string,
|
|
17
|
+
intlNS: PropTypes.string,
|
|
16
18
|
label: PropTypes.oneOfType([
|
|
17
19
|
PropTypes.string,
|
|
18
20
|
PropTypes.node
|
|
@@ -24,13 +26,15 @@ const propTypes = {
|
|
|
24
26
|
const EditableRefdataCategoryList = ({
|
|
25
27
|
afterQueryCalls,
|
|
26
28
|
catchQueryCalls,
|
|
29
|
+
intlKey: passedIntlKey,
|
|
30
|
+
intlNS: passedIntlNS,
|
|
27
31
|
label,
|
|
28
32
|
labelOverrides = {}, // An object containing translation alternatives
|
|
29
33
|
refdataEndpoint
|
|
30
34
|
}) => {
|
|
31
35
|
/* A component that allows for editing of refdata categories */
|
|
32
36
|
const callout = useContext(CalloutContext);
|
|
33
|
-
const
|
|
37
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
34
38
|
|
|
35
39
|
// fetch refdata values
|
|
36
40
|
const { data: refdata = [], isLoading: isRefdataLoading } = useRefdata({
|
|
@@ -70,17 +74,16 @@ const EditableRefdataCategoryList = ({
|
|
|
70
74
|
// Default delete behaviour is to fire a callout, either with kint-components default message
|
|
71
75
|
// or one provided in labelOverrides, which is passed the error message and refdata in question
|
|
72
76
|
delete: async (err) => {
|
|
73
|
-
const errorResp = await err.response
|
|
77
|
+
const errorResp = await parseErrorResponse(err.response);
|
|
74
78
|
callout.sendCallout({
|
|
75
|
-
message:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
),
|
|
79
|
+
message: kintIntl.formatKintMessage({
|
|
80
|
+
id: 'refdataCategory.deleteRefdataCategory.errorMessage',
|
|
81
|
+
overrideValue: labelOverrides?.deleteError
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: deleteModal?.refdata?.label,
|
|
85
|
+
error: errorResp?.message
|
|
86
|
+
}),
|
|
84
87
|
type: 'error',
|
|
85
88
|
});
|
|
86
89
|
},
|
|
@@ -109,13 +112,19 @@ const EditableRefdataCategoryList = ({
|
|
|
109
112
|
if (!rowData?.values?.length) {
|
|
110
113
|
actionArray.push({
|
|
111
114
|
name: 'delete',
|
|
112
|
-
label:
|
|
115
|
+
label: kintIntl.formatKintMessage({
|
|
116
|
+
id: 'delete',
|
|
117
|
+
overrideValue: labelOverrides?.delete
|
|
118
|
+
}),
|
|
113
119
|
icon: 'trash',
|
|
114
120
|
callback: (data) => setDeleteModal({ visible: true, refdata: data }),
|
|
115
|
-
ariaLabel: (data) =>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
ariaLabel: (data) => kintIntl.formatKintMessage(
|
|
122
|
+
{
|
|
123
|
+
id: 'refdataCategory.deleteAriaLabel',
|
|
124
|
+
overrideValue: labelOverrides?.deleteAriaLabel
|
|
125
|
+
},
|
|
126
|
+
{ label: data?.label }
|
|
127
|
+
),
|
|
119
128
|
});
|
|
120
129
|
}
|
|
121
130
|
return actionArray;
|
|
@@ -126,8 +135,14 @@ const EditableRefdataCategoryList = ({
|
|
|
126
135
|
<ActionList
|
|
127
136
|
actionAssigner={actionAssigner}
|
|
128
137
|
columnMapping={{
|
|
129
|
-
desc:
|
|
130
|
-
|
|
138
|
+
desc: kintIntl.formatKintMessage({
|
|
139
|
+
id: 'refdataCategory.refdataCategory',
|
|
140
|
+
overrideValue: labelOverrides?.refdataCategory
|
|
141
|
+
}),
|
|
142
|
+
values: kintIntl.formatKintMessage({
|
|
143
|
+
id: 'refdataCategory.noOfValues',
|
|
144
|
+
overrideValue: labelOverrides?.noOfValues
|
|
145
|
+
}),
|
|
131
146
|
}}
|
|
132
147
|
contentData={contentData}
|
|
133
148
|
creatableFields={{
|
|
@@ -145,18 +160,22 @@ const EditableRefdataCategoryList = ({
|
|
|
145
160
|
/>
|
|
146
161
|
<ConfirmationModal
|
|
147
162
|
confirmLabel={
|
|
148
|
-
|
|
163
|
+
kintIntl.formatKintMessage({
|
|
164
|
+
id: 'delete',
|
|
165
|
+
overrideValue: labelOverrides?.delete
|
|
166
|
+
})
|
|
149
167
|
}
|
|
150
168
|
heading={
|
|
151
|
-
|
|
152
|
-
|
|
169
|
+
kintIntl.formatKintMessage({
|
|
170
|
+
id: 'refdataCategory.deleteRefdataCategory',
|
|
171
|
+
overrideValue: labelOverrides?.deleteRefdataCategory
|
|
172
|
+
})
|
|
153
173
|
}
|
|
154
174
|
message={
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
/>
|
|
175
|
+
kintIntl.formatKintMessage({
|
|
176
|
+
id: 'refdataCategory.deleteRefdataCategory.confirmMessage',
|
|
177
|
+
overrideValue: labelOverrides?.deleteRefdataCategoryMessage
|
|
178
|
+
}, { name: deleteModal?.refdata?.desc })
|
|
160
179
|
}
|
|
161
180
|
onCancel={() => setDeleteModal({ visible: false, refdata: null })}
|
|
162
181
|
onConfirm={() => {
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import React, { useEffect, useState, useContext } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { FormattedMessage, useIntl } from 'react-intl';
|
|
4
3
|
|
|
5
4
|
import { ConfirmationModal } from '@folio/stripes/components';
|
|
6
5
|
import { CalloutContext } from '@folio/stripes/core';
|
|
7
6
|
|
|
8
|
-
import { useMutateRefdataValue, useRefdata } from '../hooks';
|
|
7
|
+
import { useKintIntl, useMutateRefdataValue, useRefdata } from '../hooks';
|
|
9
8
|
|
|
10
9
|
import ActionList from '../ActionList';
|
|
11
10
|
import { required } from '../utils/validators';
|
|
11
|
+
import { parseErrorResponse } from '../utils';
|
|
12
12
|
|
|
13
13
|
const propTypes = {
|
|
14
14
|
afterQueryCalls: PropTypes.object,
|
|
15
15
|
catchQueryCalls: PropTypes.object,
|
|
16
16
|
desc: PropTypes.string,
|
|
17
|
+
intlKey: PropTypes.string,
|
|
18
|
+
intlNS: PropTypes.string,
|
|
17
19
|
label: PropTypes.oneOfType([
|
|
18
20
|
PropTypes.string,
|
|
19
21
|
PropTypes.node
|
|
@@ -26,13 +28,15 @@ const EditableRefdataList = ({
|
|
|
26
28
|
afterQueryCalls,
|
|
27
29
|
catchQueryCalls,
|
|
28
30
|
desc,
|
|
31
|
+
intlKey: passedIntlKey,
|
|
32
|
+
intlNS: passedIntlNS,
|
|
29
33
|
label,
|
|
30
34
|
labelOverrides = {}, // An object containing translation alternatives
|
|
31
35
|
refdataEndpoint
|
|
32
36
|
}) => {
|
|
33
37
|
/* A component that allows for editing of refdata values */
|
|
34
38
|
const callout = useContext(CalloutContext);
|
|
35
|
-
const
|
|
39
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
36
40
|
|
|
37
41
|
// fetch refdata values
|
|
38
42
|
const { data: { 0: refdata } = {}, isLoading: isRefdataLoading } = useRefdata({
|
|
@@ -75,17 +79,16 @@ const EditableRefdataList = ({
|
|
|
75
79
|
// Default delete behaviour is to fire a callout, either with kint-components default message
|
|
76
80
|
// or one provided in labelOverrides, which is passed the error message and refdata in question
|
|
77
81
|
delete: async (err) => {
|
|
78
|
-
const errorResp = await err.response
|
|
82
|
+
const errorResp = await parseErrorResponse(err.response);
|
|
79
83
|
callout.sendCallout({
|
|
80
|
-
message:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
),
|
|
84
|
+
message: kintIntl.formatKintMessage({
|
|
85
|
+
id: 'refdata.deleteRefdataValue.errorMessage',
|
|
86
|
+
overrideValue: labelOverrides?.deleteError
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: deleteModal?.refdata?.label,
|
|
90
|
+
error: errorResp?.message
|
|
91
|
+
}),
|
|
89
92
|
type: 'error',
|
|
90
93
|
});
|
|
91
94
|
},
|
|
@@ -112,26 +115,38 @@ const EditableRefdataList = ({
|
|
|
112
115
|
const actionArray = [
|
|
113
116
|
{
|
|
114
117
|
name: 'edit',
|
|
115
|
-
label:
|
|
118
|
+
label: kintIntl.formatKintMessage({
|
|
119
|
+
id: 'edit',
|
|
120
|
+
overrideValue: labelOverrides?.edit
|
|
121
|
+
}),
|
|
116
122
|
icon: 'edit',
|
|
117
123
|
callback: (data) => editRefdataValue(data),
|
|
118
|
-
ariaLabel: (data) =>
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
ariaLabel: (data) => kintIntl.formatKintMessage(
|
|
125
|
+
{
|
|
126
|
+
id: 'refdata.editAriaLabel',
|
|
127
|
+
overrideValue: labelOverrides?.editAriaLabel
|
|
128
|
+
},
|
|
129
|
+
{ label: data?.label }
|
|
130
|
+
),
|
|
122
131
|
}
|
|
123
132
|
];
|
|
124
133
|
|
|
125
134
|
if (!refdata?.internal) {
|
|
126
135
|
actionArray.push({
|
|
127
136
|
name: 'delete',
|
|
128
|
-
label:
|
|
137
|
+
label: kintIntl.formatKintMessage({
|
|
138
|
+
id: 'delete',
|
|
139
|
+
overrideValue: labelOverrides?.delete
|
|
140
|
+
}),
|
|
129
141
|
icon: 'trash',
|
|
130
142
|
callback: (data) => setDeleteModal({ visible: true, refdata: data }),
|
|
131
|
-
ariaLabel: (data) =>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
143
|
+
ariaLabel: (data) => kintIntl.formatKintMessage(
|
|
144
|
+
{
|
|
145
|
+
id: 'refdata.deleteAriaLabel',
|
|
146
|
+
overrideValue: labelOverrides?.deleteAriaLabel
|
|
147
|
+
},
|
|
148
|
+
{ label: data?.label }
|
|
149
|
+
),
|
|
135
150
|
});
|
|
136
151
|
}
|
|
137
152
|
return actionArray;
|
|
@@ -142,8 +157,14 @@ const EditableRefdataList = ({
|
|
|
142
157
|
<ActionList
|
|
143
158
|
actionAssigner={actionAssigner}
|
|
144
159
|
columnMapping={{
|
|
145
|
-
label:
|
|
146
|
-
|
|
160
|
+
label: kintIntl.formatKintMessage({
|
|
161
|
+
id: 'refdata.label',
|
|
162
|
+
overrideValue: labelOverrides?.label
|
|
163
|
+
}),
|
|
164
|
+
value: kintIntl.formatKintMessage({
|
|
165
|
+
id: 'refdata.value',
|
|
166
|
+
overrideValue: labelOverrides?.value
|
|
167
|
+
}),
|
|
147
168
|
}}
|
|
148
169
|
contentData={contentData}
|
|
149
170
|
creatableFields={{
|
|
@@ -161,18 +182,22 @@ const EditableRefdataList = ({
|
|
|
161
182
|
/>
|
|
162
183
|
<ConfirmationModal
|
|
163
184
|
confirmLabel={
|
|
164
|
-
|
|
185
|
+
kintIntl.formatKintMessage({
|
|
186
|
+
id: 'delete',
|
|
187
|
+
overrideValue: labelOverrides?.delete
|
|
188
|
+
})
|
|
165
189
|
}
|
|
166
190
|
heading={
|
|
167
|
-
|
|
168
|
-
|
|
191
|
+
kintIntl.formatKintMessage({
|
|
192
|
+
id: 'refdata.deleteRefdataValue',
|
|
193
|
+
overrideValue: labelOverrides?.deleteRefdataValue
|
|
194
|
+
})
|
|
169
195
|
}
|
|
170
196
|
message={
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
/>
|
|
197
|
+
kintIntl.formatKintMessage({
|
|
198
|
+
id: 'refdata.deleteRefdataValue.confirmMessage',
|
|
199
|
+
overrideValue: labelOverrides?.deleteRefdataValueMessage
|
|
200
|
+
}, { name: deleteModal?.refdata?.label })
|
|
176
201
|
}
|
|
177
202
|
onCancel={() => setDeleteModal({ visible: false, refdata: null })}
|
|
178
203
|
onConfirm={() => {
|
|
@@ -9,7 +9,10 @@ import EditableSettingsListFieldArray from './EditableSettingsListFieldArray';
|
|
|
9
9
|
const EditableSettingsList = ({
|
|
10
10
|
data,
|
|
11
11
|
initialValues,
|
|
12
|
+
intlKey: passedIntlKey,
|
|
13
|
+
intlNS: passedIntlNS,
|
|
12
14
|
label,
|
|
15
|
+
labelOverrides = {},
|
|
13
16
|
onSave
|
|
14
17
|
}) => {
|
|
15
18
|
return (
|
|
@@ -27,7 +30,10 @@ const EditableSettingsList = ({
|
|
|
27
30
|
<FieldArray
|
|
28
31
|
component={EditableSettingsListFieldArray}
|
|
29
32
|
data={data}
|
|
33
|
+
intlKey={passedIntlKey}
|
|
34
|
+
intlNS={passedIntlNS}
|
|
30
35
|
label={label}
|
|
36
|
+
labelOverrides={labelOverrides}
|
|
31
37
|
name="settings"
|
|
32
38
|
onSave={onSave}
|
|
33
39
|
/>
|
|
@@ -43,11 +49,14 @@ EditableSettingsList.propTypes = {
|
|
|
43
49
|
refdatavalues: PropTypes.arrayOf(PropTypes.object)
|
|
44
50
|
}),
|
|
45
51
|
initialValues: PropTypes.object,
|
|
52
|
+
intlKey: PropTypes.string,
|
|
53
|
+
intlNS: PropTypes.string,
|
|
46
54
|
label: PropTypes.oneOfType([
|
|
47
55
|
PropTypes.string,
|
|
48
56
|
PropTypes.node,
|
|
49
57
|
PropTypes.object
|
|
50
|
-
])
|
|
58
|
+
]),
|
|
59
|
+
labelOverrides: PropTypes.object,
|
|
51
60
|
};
|
|
52
61
|
|
|
53
62
|
export default EditableSettingsList;
|
|
@@ -4,7 +4,14 @@ import { Field } from 'react-final-form';
|
|
|
4
4
|
|
|
5
5
|
import { SettingField } from './SettingField';
|
|
6
6
|
|
|
7
|
-
const EditableSettingsListFieldArray = ({
|
|
7
|
+
const EditableSettingsListFieldArray = ({
|
|
8
|
+
data,
|
|
9
|
+
fields,
|
|
10
|
+
intlKey: passedIntlKey,
|
|
11
|
+
intlNS: passedIntlNS,
|
|
12
|
+
labelOverrides = {},
|
|
13
|
+
onSave
|
|
14
|
+
}) => {
|
|
8
15
|
const handleSave = (index) => {
|
|
9
16
|
const setting = fields.value[index];
|
|
10
17
|
return onSave(setting);
|
|
@@ -17,6 +24,9 @@ const EditableSettingsListFieldArray = ({ data, fields, onSave }) => {
|
|
|
17
24
|
key={setting}
|
|
18
25
|
component={SettingField}
|
|
19
26
|
data-testid={`editableSettingsListFieldArray[${i}]`}
|
|
27
|
+
intlKey={passedIntlKey}
|
|
28
|
+
intlNS={passedIntlNS}
|
|
29
|
+
labelOverrides={labelOverrides}
|
|
20
30
|
name={setting}
|
|
21
31
|
onSave={() => handleSave(i)}
|
|
22
32
|
settingData={{
|
|
@@ -31,6 +41,9 @@ const EditableSettingsListFieldArray = ({ data, fields, onSave }) => {
|
|
|
31
41
|
|
|
32
42
|
EditableSettingsListFieldArray.propTypes = {
|
|
33
43
|
fields: PropTypes.object,
|
|
44
|
+
intlKey: PropTypes.string,
|
|
45
|
+
intlNS: PropTypes.string,
|
|
46
|
+
labelOverrides: PropTypes.object,
|
|
34
47
|
onSave: PropTypes.func,
|
|
35
48
|
data: PropTypes.shape({
|
|
36
49
|
refdatavalues: PropTypes.arrayOf(PropTypes.object)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
3
|
|
|
5
4
|
import { Field } from 'react-final-form';
|
|
6
5
|
import {
|
|
@@ -8,16 +7,25 @@ import {
|
|
|
8
7
|
TextField,
|
|
9
8
|
} from '@folio/stripes/components';
|
|
10
9
|
import RefdataButtons from '../../RefdataButtons';
|
|
10
|
+
import { useKintIntl } from '../../hooks';
|
|
11
11
|
|
|
12
12
|
const EditSettingValue = (props) => {
|
|
13
13
|
const {
|
|
14
|
-
input,
|
|
15
14
|
currentSetting: setting,
|
|
15
|
+
input,
|
|
16
|
+
intlKey: passedIntlKey,
|
|
17
|
+
intlNS: passedIntlNS,
|
|
18
|
+
labelOverrides = {},
|
|
16
19
|
refdata,
|
|
17
20
|
templates
|
|
18
21
|
} = props;
|
|
19
|
-
|
|
20
|
-
const
|
|
22
|
+
|
|
23
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
24
|
+
|
|
25
|
+
const fieldLabel = kintIntl.formatKintMessage({
|
|
26
|
+
id: 'settings.valueFor',
|
|
27
|
+
overrideValue: labelOverrides?.valueFor
|
|
28
|
+
}, { name: setting.key });
|
|
21
29
|
|
|
22
30
|
switch (setting.settingType) {
|
|
23
31
|
case 'Refdata':
|
|
@@ -82,11 +90,15 @@ const EditSettingValue = (props) => {
|
|
|
82
90
|
|
|
83
91
|
EditSettingValue.propTypes = {
|
|
84
92
|
currentSetting: PropTypes.shape({
|
|
85
|
-
settingType: PropTypes.string
|
|
93
|
+
settingType: PropTypes.string,
|
|
94
|
+
key: PropTypes.string,
|
|
86
95
|
}),
|
|
87
96
|
input: PropTypes.shape({
|
|
88
97
|
name: PropTypes.string
|
|
89
98
|
}),
|
|
99
|
+
intlKey: PropTypes.string,
|
|
100
|
+
intlNS: PropTypes.string,
|
|
101
|
+
labelOverrides: PropTypes.object,
|
|
90
102
|
refdata: PropTypes.arrayOf(PropTypes.object),
|
|
91
103
|
templates: PropTypes.arrayOf(PropTypes.shape({
|
|
92
104
|
name: PropTypes.string,
|
|
@@ -8,6 +8,7 @@ import EditSettingValue from './EditSettingValue';
|
|
|
8
8
|
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
9
9
|
|
|
10
10
|
const onSubmit = jest.fn();
|
|
11
|
+
jest.mock('../../hooks');
|
|
11
12
|
|
|
12
13
|
const stringSetting = {
|
|
13
14
|
id: '12345',
|
|
@@ -116,7 +117,7 @@ describe('EditSettingValue', () => {
|
|
|
116
117
|
});
|
|
117
118
|
test('renders the edit field', () => {
|
|
118
119
|
const { getByRole } = renderComponent;
|
|
119
|
-
expect(getByRole('textbox', { name: 'Value for setting
|
|
120
|
+
expect(getByRole('textbox', { name: 'Value for setting testSettingKey' }));
|
|
120
121
|
});
|
|
121
122
|
});
|
|
122
123
|
|
|
@@ -144,7 +145,7 @@ describe('EditSettingValue', () => {
|
|
|
144
145
|
|
|
145
146
|
test('renders the expected value in the edit field', () => {
|
|
146
147
|
const { getByRole } = renderComponent;
|
|
147
|
-
expect(getByRole('textbox', { name: 'Value for setting
|
|
148
|
+
expect(getByRole('textbox', { name: 'Value for setting testSettingKey' })).toHaveDisplayValue('diku-shared');
|
|
148
149
|
});
|
|
149
150
|
});
|
|
150
151
|
});
|
|
@@ -244,7 +245,7 @@ describe('EditSettingValue', () => {
|
|
|
244
245
|
});
|
|
245
246
|
test('renders the expected select field', () => {
|
|
246
247
|
const { getByRole } = renderComponent;
|
|
247
|
-
expect(getByRole('combobox', { name: 'Value for setting
|
|
248
|
+
expect(getByRole('combobox', { name: 'Value for setting testSettingKey' }));
|
|
248
249
|
});
|
|
249
250
|
|
|
250
251
|
test('renders the expected refdata options', () => {
|
|
@@ -293,7 +294,7 @@ describe('EditSettingValue', () => {
|
|
|
293
294
|
|
|
294
295
|
test('renders the expected value in the refdata dropdown', () => {
|
|
295
296
|
const { getByRole } = renderComponent;
|
|
296
|
-
expect(getByRole('combobox', { name: 'Value for setting
|
|
297
|
+
expect(getByRole('combobox', { name: 'Value for setting testSettingKey' })).toHaveDisplayValue('Test refdata value');
|
|
297
298
|
});
|
|
298
299
|
});
|
|
299
300
|
});
|
|
@@ -319,7 +320,7 @@ describe('EditSettingValue', () => {
|
|
|
319
320
|
});
|
|
320
321
|
test('renders the edit field', () => {
|
|
321
322
|
const { getByRole } = renderComponent;
|
|
322
|
-
expect(getByRole('combobox', { name: 'Value for setting
|
|
323
|
+
expect(getByRole('combobox', { name: 'Value for setting testSettingKey' }));
|
|
323
324
|
});
|
|
324
325
|
|
|
325
326
|
test('renders the expected template options', () => {
|
|
@@ -331,7 +332,7 @@ describe('EditSettingValue', () => {
|
|
|
331
332
|
|
|
332
333
|
test('renders expected display item in template dropdown', () => {
|
|
333
334
|
const { getByRole } = renderComponent;
|
|
334
|
-
expect(getByRole('combobox', { name: 'Value for setting
|
|
335
|
+
expect(getByRole('combobox', { name: 'Value for setting testSettingKey' })).toHaveDisplayValue('');
|
|
335
336
|
});
|
|
336
337
|
});
|
|
337
338
|
|
|
@@ -360,7 +361,7 @@ describe('EditSettingValue', () => {
|
|
|
360
361
|
|
|
361
362
|
test('renders the edit field', () => {
|
|
362
363
|
const { getByRole } = renderComponent;
|
|
363
|
-
expect(getByRole('combobox', { name: 'Value for setting
|
|
364
|
+
expect(getByRole('combobox', { name: 'Value for setting testSettingKey' }));
|
|
364
365
|
});
|
|
365
366
|
|
|
366
367
|
test('renders the expected template options', () => {
|
|
@@ -372,7 +373,7 @@ describe('EditSettingValue', () => {
|
|
|
372
373
|
|
|
373
374
|
test('renders expected display item in template dropdown', () => {
|
|
374
375
|
const { getByRole } = renderComponent;
|
|
375
|
-
expect(getByRole('combobox', { name: 'Value for setting
|
|
376
|
+
expect(getByRole('combobox', { name: 'Value for setting testSettingKey' })).toHaveDisplayValue('Test template');
|
|
376
377
|
});
|
|
377
378
|
});
|
|
378
379
|
});
|