@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,15 +1,19 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import { FormattedMessage } from 'react-intl';
|
|
3
2
|
import { Col, InfoPopover, KeyValue, NoValue, Row } from '@folio/stripes/components';
|
|
4
3
|
|
|
4
|
+
import { useKintIntl } from '../../hooks';
|
|
5
5
|
import { MULTI_REFDATA_CLASS_NAME, REFDATA_CLASS_NAME } from '../../constants/customProperties';
|
|
6
6
|
|
|
7
7
|
// A default option for CustProp view pane, with the ability to override labels for fields
|
|
8
8
|
const CustomPropertyView = ({
|
|
9
9
|
customProperty,
|
|
10
10
|
helpPopovers,
|
|
11
|
+
intlKey: passedIntlKey,
|
|
12
|
+
intlNS: passedIntlNS,
|
|
11
13
|
labelOverrides = {}
|
|
12
14
|
}) => {
|
|
15
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
16
|
+
|
|
13
17
|
return (
|
|
14
18
|
<>
|
|
15
19
|
<Row>
|
|
@@ -17,8 +21,12 @@ const CustomPropertyView = ({
|
|
|
17
21
|
<KeyValue
|
|
18
22
|
label={
|
|
19
23
|
<div>
|
|
20
|
-
{
|
|
21
|
-
|
|
24
|
+
{
|
|
25
|
+
kintIntl.formatKintMessage({
|
|
26
|
+
id: 'customProperties.label',
|
|
27
|
+
overrideValue: labelOverrides?.label
|
|
28
|
+
})
|
|
29
|
+
}
|
|
22
30
|
{helpPopovers?.label ?
|
|
23
31
|
<InfoPopover
|
|
24
32
|
content={helpPopovers?.label}
|
|
@@ -32,8 +40,12 @@ const CustomPropertyView = ({
|
|
|
32
40
|
<KeyValue
|
|
33
41
|
label={
|
|
34
42
|
<div>
|
|
35
|
-
{
|
|
36
|
-
|
|
43
|
+
{
|
|
44
|
+
kintIntl.formatKintMessage({
|
|
45
|
+
id: 'customProperties.name',
|
|
46
|
+
overrideValue: labelOverrides?.name
|
|
47
|
+
})
|
|
48
|
+
}
|
|
37
49
|
{helpPopovers?.name ?
|
|
38
50
|
<InfoPopover
|
|
39
51
|
content={helpPopovers?.name}
|
|
@@ -48,8 +60,10 @@ const CustomPropertyView = ({
|
|
|
48
60
|
<Col xs={12}>
|
|
49
61
|
<KeyValue
|
|
50
62
|
label={
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
kintIntl.formatKintMessage({
|
|
64
|
+
id: 'customProperties.description',
|
|
65
|
+
overrideValue: labelOverrides?.description
|
|
66
|
+
})
|
|
53
67
|
}
|
|
54
68
|
value={customProperty?.description}
|
|
55
69
|
/>
|
|
@@ -59,38 +73,32 @@ const CustomPropertyView = ({
|
|
|
59
73
|
<Col xs={6}>
|
|
60
74
|
<KeyValue
|
|
61
75
|
label={
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
kintIntl.formatKintMessage({
|
|
77
|
+
id: 'customProperties.primary',
|
|
78
|
+
overrideValue: labelOverrides?.primary
|
|
79
|
+
})
|
|
66
80
|
}
|
|
67
81
|
value={
|
|
68
|
-
|
|
69
|
-
id
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
: 'stripes-kint-components.no'
|
|
73
|
-
}
|
|
74
|
-
/>
|
|
82
|
+
kintIntl.formatKintMessage({
|
|
83
|
+
id: customProperty?.primary ? 'yes' : 'no',
|
|
84
|
+
overrideValue: customProperty?.primary ? labelOverrides.yes : labelOverrides.no,
|
|
85
|
+
})
|
|
75
86
|
}
|
|
76
87
|
/>
|
|
77
88
|
</Col>
|
|
78
89
|
<Col xs={6}>
|
|
79
90
|
<KeyValue
|
|
80
91
|
label={
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
92
|
+
kintIntl.formatKintMessage({
|
|
93
|
+
id: 'customProperties.retired',
|
|
94
|
+
overrideValue: labelOverrides?.retired
|
|
95
|
+
})
|
|
85
96
|
}
|
|
86
97
|
value={
|
|
87
|
-
|
|
88
|
-
id
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
: 'stripes-kint-components.no'
|
|
92
|
-
}
|
|
93
|
-
/>
|
|
98
|
+
kintIntl.formatKintMessage({
|
|
99
|
+
id: customProperty?.retired ? 'yes' : 'no',
|
|
100
|
+
overrideValue: customProperty?.retired ? labelOverrides.yes : labelOverrides.no,
|
|
101
|
+
})
|
|
94
102
|
}
|
|
95
103
|
/>
|
|
96
104
|
</Col>
|
|
@@ -99,8 +107,10 @@ const CustomPropertyView = ({
|
|
|
99
107
|
<Col xs={6}>
|
|
100
108
|
<KeyValue
|
|
101
109
|
label={
|
|
102
|
-
|
|
103
|
-
|
|
110
|
+
kintIntl.formatKintMessage({
|
|
111
|
+
id: 'customProperties.weight',
|
|
112
|
+
overrideValue: labelOverrides?.weight
|
|
113
|
+
})
|
|
104
114
|
}
|
|
105
115
|
value={customProperty?.weight}
|
|
106
116
|
/>
|
|
@@ -108,17 +118,16 @@ const CustomPropertyView = ({
|
|
|
108
118
|
<Col xs={6}>
|
|
109
119
|
<KeyValue
|
|
110
120
|
label={
|
|
111
|
-
|
|
112
|
-
|
|
121
|
+
kintIntl.formatKintMessage({
|
|
122
|
+
id: 'customProperties.defaultVisibility',
|
|
123
|
+
overrideValue: labelOverrides?.defaultVisibility
|
|
124
|
+
})
|
|
113
125
|
}
|
|
114
126
|
value={
|
|
115
|
-
|
|
116
|
-
id
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
: 'stripes-kint-components.customProperties.internalFalse'
|
|
120
|
-
}
|
|
121
|
-
/>
|
|
127
|
+
kintIntl.formatKintMessage({
|
|
128
|
+
id: customProperty?.defaultInternal ? 'customProperties.internalTrue' : 'customProperties.internalFalse',
|
|
129
|
+
overrideValue: customProperty?.defaultInternal ? labelOverrides.internalTrue : labelOverrides.internalFalse,
|
|
130
|
+
})
|
|
122
131
|
}
|
|
123
132
|
/>
|
|
124
133
|
</Col>
|
|
@@ -128,8 +137,12 @@ const CustomPropertyView = ({
|
|
|
128
137
|
<KeyValue
|
|
129
138
|
label={
|
|
130
139
|
<div>
|
|
131
|
-
{
|
|
132
|
-
|
|
140
|
+
{
|
|
141
|
+
kintIntl.formatKintMessage({
|
|
142
|
+
id: 'customProperties.ctx',
|
|
143
|
+
overrideValue: labelOverrides?.ctx
|
|
144
|
+
})
|
|
145
|
+
}
|
|
133
146
|
{helpPopovers?.ctx ?
|
|
134
147
|
<InfoPopover
|
|
135
148
|
content={helpPopovers?.ctx}
|
|
@@ -145,10 +158,17 @@ const CustomPropertyView = ({
|
|
|
145
158
|
{customProperty?.type && (
|
|
146
159
|
<KeyValue
|
|
147
160
|
label={
|
|
148
|
-
|
|
149
|
-
|
|
161
|
+
kintIntl.formatKintMessage({
|
|
162
|
+
id: 'customProperties.type',
|
|
163
|
+
overrideValue: labelOverrides?.type
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
value={
|
|
167
|
+
kintIntl.formatKintMessage({
|
|
168
|
+
id: `customProperties.type.${customProperty?.type}`,
|
|
169
|
+
overrideValue: labelOverrides?.[customProperty?.type]
|
|
170
|
+
})
|
|
150
171
|
}
|
|
151
|
-
value={labelOverrides?.[customProperty?.type] ?? <FormattedMessage id={`stripes-kint-components.customProperties.type.${customProperty?.type}`} />}
|
|
152
172
|
/>
|
|
153
173
|
)}
|
|
154
174
|
</Col>
|
|
@@ -156,8 +176,10 @@ const CustomPropertyView = ({
|
|
|
156
176
|
{(customProperty?.type === REFDATA_CLASS_NAME || customProperty?.type === MULTI_REFDATA_CLASS_NAME) && (
|
|
157
177
|
<KeyValue
|
|
158
178
|
label={
|
|
159
|
-
|
|
160
|
-
|
|
179
|
+
kintIntl.formatKintMessage({
|
|
180
|
+
id: 'customProperties.category',
|
|
181
|
+
overrideValue: labelOverrides?.category
|
|
182
|
+
})
|
|
161
183
|
}
|
|
162
184
|
value={customProperty?.category?.desc ?? <NoValue />}
|
|
163
185
|
/>
|
|
@@ -186,6 +208,8 @@ CustomPropertyView.propTypes = {
|
|
|
186
208
|
|
|
187
209
|
}),
|
|
188
210
|
helpPopovers: PropTypes.object,
|
|
211
|
+
intlKey: PropTypes.string,
|
|
212
|
+
intlNS: PropTypes.string,
|
|
189
213
|
labelOverrides: PropTypes.object
|
|
190
214
|
};
|
|
191
215
|
|
|
@@ -2,17 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import '@folio/stripes-erm-components/test/jest/__mock__';
|
|
3
3
|
import { MemoryRouter } from 'react-router-dom';
|
|
4
4
|
import { KeyValue } from '@folio/stripes-testing';
|
|
5
|
-
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
6
5
|
|
|
7
|
-
import { custPropView } from './testResources';
|
|
8
6
|
import CustomPropertyView from './CustomPropertyView';
|
|
7
|
+
import customProperties from '../../../../test/jest/customProperties';
|
|
8
|
+
import { renderWithKintHarness } from '../../../../test/jest';
|
|
9
|
+
|
|
10
|
+
jest.mock('../../hooks');
|
|
9
11
|
|
|
10
12
|
describe('CustomPropertyView', () => {
|
|
11
13
|
beforeEach(() => {
|
|
12
14
|
renderWithKintHarness(
|
|
13
15
|
<MemoryRouter>
|
|
14
16
|
<CustomPropertyView
|
|
15
|
-
{
|
|
17
|
+
customProperty={customProperties?.find(cp => cp.name === 'Eligible authors')}
|
|
16
18
|
/>
|
|
17
19
|
</MemoryRouter>
|
|
18
20
|
);
|
|
@@ -33,11 +35,11 @@ describe('CustomPropertyView', () => {
|
|
|
33
35
|
await KeyValue('Primary').has({ value: 'Yes' });
|
|
34
36
|
});
|
|
35
37
|
|
|
36
|
-
test('displays expected
|
|
37
|
-
await KeyValue('
|
|
38
|
+
test('displays expected Retired value', async () => {
|
|
39
|
+
await KeyValue('Retired').has({ value: 'No' });
|
|
38
40
|
});
|
|
39
41
|
|
|
40
|
-
test('displays expected
|
|
42
|
+
test('displays expected Weight value', async () => {
|
|
41
43
|
await KeyValue('Order weight').has({ value: '0' });
|
|
42
44
|
});
|
|
43
45
|
|
|
@@ -4,32 +4,37 @@
|
|
|
4
4
|
These components, namely CustomPropertiesSettings, and its constituent components CustomPropertiesLookup, CustomPropertiesForm and CustomPropertyView are designed for use in a FOLIO settings context, as a way to search through, view, create and edit custom properties.
|
|
5
5
|
|
|
6
6
|
## LabelOverrides
|
|
7
|
-
|
|
7
|
+
The default behaviour for translations as of v3.0.0 is that Stripes-Kint-Components will attempt to read a top level intlKey from the store, say `ui-agreements`, and then build a standard translation which the implementing library is expected to then provide. This allows us to keep translations existing within the FOLIO sphere of influence.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
primaryRetired |
|
|
31
|
-
retired |
|
|
32
|
-
searchAriaLabel |
|
|
33
|
-
type |
|
|
34
|
-
viewPaneTitle |
|
|
35
|
-
weight |
|
|
9
|
+
However, these components can all be provided with a prop `labelOverrides` to allow the overriding of this default behaviour. These values must be of type `String`, either referring to an intl translation key `ui-agreements.test.intl.key` or the string to display.
|
|
10
|
+
|
|
11
|
+
In the case where a key is provided, for some translations the library will present values the resulting translation can read from.
|
|
12
|
+
|
|
13
|
+
In some very rare cases, a fallback is provided by default by the library, meaning no intl or labelOverride is necessary.
|
|
14
|
+
|
|
15
|
+
The default translation keys, their corresponding `labelOverrides` value, and any passed information are described below.
|
|
16
|
+
|
|
17
|
+
LabelOverrides key | Default key | Description | Values provided | FallbackMessage |
|
|
18
|
+
--- | --- | --- | --- | ---
|
|
19
|
+
category | `<moduleIntlKey>.customProperties.category` | Override for the display of field "category" | | |
|
|
20
|
+
confirmHeading | `<moduleIntlKey>.customProperties.config.delete.confirmHeading` | Override for the title of the confirmation modal which pops up on attempting to delete a custom property | | |
|
|
21
|
+
confirmMessage | `<moduleIntlKey>.customProperties.config.delete.confirmMessage` | Override for the message displayed in the confirmation modal on trying to delete a custom property. Accepts a function which will be provided the custom property object in question. | name: The label of the custom property, falling back to name |
|
|
22
|
+
ctx | `<moduleIntlKey>.customProperties.ctx` | Override for the display of field "ctx" | | |
|
|
23
|
+
deleteError | `<moduleIntlKey>customProperties.config.delete.errorMessage` | Override for the default callout message shown when a custom property fails to delete. Accepts a function to which it will provide the error message and the customProperty in question. | error; The error on delete, label: The label of the custom property |
|
|
24
|
+
defaultVisibility | `<moduleIntlKey>.customProperties.defaultVisibility` | Override for the display of field "defaultVisibility" | | |
|
|
25
|
+
description | `<moduleIntlKey>.customProperties.description` | Override for the display of field "description" | | |
|
|
26
|
+
editModalTitle | `<moduleIntlKey>.customProperties.config.editModal` | Override for the modal header on editing a custom property | name: Label of custom property, falling back to name. |
|
|
27
|
+
label | `<moduleIntlKey>.customProperties.label` | Override for the display of field "label" | | |
|
|
28
|
+
name | `<moduleIntlKey>.customProperties.name` | Override for the display of field "name" | | |newModalTitle | `<moduleIntlKey>.customProperties.config.newModal` | Override for the modal header on attempting to create a custom property | "Edit custom property" |
|
|
29
|
+
paneTitle | `<moduleIntlKey>.customProperties` | Override for the pane title displayed in the main lookup section. | | |
|
|
30
|
+
primary | `<moduleIntlKey>.customProperties.primary` | Override for the display of field "primary" | | |primaryRetired | `<moduleIntlKey>.customProperties.errors.primaryRetired` | Override for the warning message on validation, preventing a custom property being set both as primary AND as retired | | |
|
|
31
|
+
retired | `<moduleIntlKey>.customProperties.retired` | Override for the display of field "retired" | | |
|
|
32
|
+
searchAriaLabel | `<moduleIntlKey>.customProperties.config.searchAriaLabel` | Override for the aria label provided by the search field in the main custom property lookup section | | 'custom-property-search-field' |
|
|
33
|
+
type | `<moduleIntlKey>.customProperties.type` | Override for the display of field "type" | | |
|
|
34
|
+
viewPaneTitle | `<moduleIntlKey>.customProperties.config.viewPaneTitle` | Label override for the title of the custom property view pane once one has been selected. | label: customProperty label if exists, falls back to customProperty name | customProperty label if exists, falls back to customProperty name |
|
|
35
|
+
weight | `<moduleIntlKey>.customProperties.weight` | Override for the display of field "weight" | | |DATE_CLASS_NAME (See customPropertyConstants) | `<moduleIntlKey>.customProperties.type.${DATE_CLASS_NAME}` | Override for the "Date" type custom property display. | | |
|
|
36
|
+
DECIMAL_CLASS_NAME (See customPropertyConstants) | `<moduleIntlKey>.customProperties.type.${DECIMAL_CLASS_NAME}` | Override for the "Decimal" type custom property display. | | |
|
|
37
|
+
INTEGER_CLASS_NAME (See customPropertyConstants) | `<moduleIntlKey>.customProperties.type.${INTEGER_CLASS_NAME}` | Override for the "Integer" type custom property display. | | |
|
|
38
|
+
MULTI_REFDATA_CLASS_NAME (See customPropertyConstants) | `<moduleIntlKey>.customProperties.type.${MULTI_REFDATA_CLASS_NAME}` | Override for the "MultiRefdata" type custom property display. | | |
|
|
39
|
+
REFDATA_CLASS_NAME (See customPropertyConstants) | `<moduleIntlKey>.customProperties.type.${REFDATA_CLASS_NAME}` | Override for the "Refdata" type custom property display. | | |
|
|
40
|
+
TEXT_CLASS_NAME (See customPropertyConstants) | `<moduleIntlKey>.customProperties.type.${TEXT_CLASS_NAME}` | Override for the "Text" type custom property display. | | |
|
|
@@ -5,6 +5,8 @@ const CustomPropertiesEdit = ({
|
|
|
5
5
|
contexts = [],
|
|
6
6
|
customPropertiesEndpoint,
|
|
7
7
|
id,
|
|
8
|
+
intlKey: passedIntlKey,
|
|
9
|
+
intlNS: passedIntlNS,
|
|
8
10
|
labelOverrides = {},
|
|
9
11
|
nameOverride
|
|
10
12
|
}) => {
|
|
@@ -16,6 +18,8 @@ const CustomPropertiesEdit = ({
|
|
|
16
18
|
ctx,
|
|
17
19
|
customPropertiesEndpoint,
|
|
18
20
|
id,
|
|
21
|
+
intlKey: passedIntlKey,
|
|
22
|
+
intlNS: passedIntlNS,
|
|
19
23
|
labelOverrides,
|
|
20
24
|
nameOverride
|
|
21
25
|
}}
|
|
@@ -28,6 +32,8 @@ CustomPropertiesEdit.propTypes = {
|
|
|
28
32
|
contexts: PropTypes.arrayOf(PropTypes.string),
|
|
29
33
|
customPropertiesEndpoint: PropTypes.string,
|
|
30
34
|
id: PropTypes.string,
|
|
35
|
+
intlKey: PropTypes.string,
|
|
36
|
+
intlNS: PropTypes.string,
|
|
31
37
|
labelOverrides: PropTypes.object,
|
|
32
38
|
nameOverride: PropTypes.string
|
|
33
39
|
};
|
|
@@ -3,10 +3,9 @@ import '@folio/stripes-erm-components/test/jest/__mock__';
|
|
|
3
3
|
import { waitFor } from '@testing-library/react';
|
|
4
4
|
|
|
5
5
|
import { MemoryRouter } from 'react-router-dom';
|
|
6
|
-
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
7
6
|
|
|
8
|
-
import { custPropEdit } from './testResources';
|
|
9
7
|
import CustomPropertiesEdit from './CustomPropertiesEdit';
|
|
8
|
+
import { renderWithKintHarness } from '../../../../test/jest';
|
|
10
9
|
|
|
11
10
|
jest.mock('./CustomPropertiesEditCtx', () => () => <div>CustomPropertiesEditCtx</div>);
|
|
12
11
|
|
|
@@ -16,7 +15,12 @@ describe('CustomPropertiesEdit', () => {
|
|
|
16
15
|
renderComponent = renderWithKintHarness(
|
|
17
16
|
<MemoryRouter>
|
|
18
17
|
<CustomPropertiesEdit
|
|
19
|
-
{
|
|
18
|
+
contexts={[
|
|
19
|
+
'isNull',
|
|
20
|
+
'OpenAccess'
|
|
21
|
+
]}
|
|
22
|
+
customPropertiesEndpoint="erm/custprops"
|
|
23
|
+
id="supplementaryProperties"
|
|
20
24
|
/>
|
|
21
25
|
</MemoryRouter>
|
|
22
26
|
);
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import { FormattedMessage } from 'react-intl';
|
|
3
2
|
import { Accordion } from '@folio/stripes/components';
|
|
4
3
|
|
|
5
4
|
import CustomPropertiesListField from './CustomPropertiesListField';
|
|
6
|
-
import { useCustomProperties } from '../../hooks';
|
|
5
|
+
import { useCustomProperties, useKintIntl } from '../../hooks';
|
|
7
6
|
|
|
8
7
|
const CustomPropertiesEditCtx = ({
|
|
9
8
|
ctx,
|
|
10
9
|
customPropertiesEndpoint,
|
|
11
10
|
id,
|
|
11
|
+
intlKey: passedIntlKey,
|
|
12
|
+
intlNS: passedIntlNS,
|
|
12
13
|
labelOverrides = {},
|
|
13
14
|
nameOverride
|
|
14
15
|
}) => {
|
|
16
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
17
|
+
|
|
15
18
|
// Deal with all the possible label override options
|
|
16
19
|
const getAccordionLabel = () => {
|
|
17
20
|
// Special case for null context
|
|
18
21
|
if (ctx === 'isNull') {
|
|
19
22
|
return (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// Label overrides for specific contexts
|
|
26
|
-
if (labelOverrides[ctx]) {
|
|
27
|
-
return labelOverrides[ctx];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Label override for default title, taking ctx into account
|
|
31
|
-
if (labelOverrides.defaultTitle && typeof labelOverrides.defaultTitle === 'function') {
|
|
32
|
-
return (
|
|
33
|
-
labelOverrides.defaultTitle(ctx)
|
|
23
|
+
kintIntl.formatKintMessage({
|
|
24
|
+
id: 'customProperties',
|
|
25
|
+
overrideValue: labelOverrides.noContext
|
|
26
|
+
})
|
|
34
27
|
);
|
|
35
28
|
}
|
|
36
29
|
|
|
37
|
-
//
|
|
30
|
+
// Chain formatKintMessages together using provided fallbackMessage to
|
|
31
|
+
// allow for "If override or translation exists, use it, else use default"
|
|
38
32
|
return (
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
kintIntl.formatKintMessage({
|
|
34
|
+
id: `customProperties.ctx.${ctx}`,
|
|
35
|
+
overrideValue: labelOverrides[ctx],
|
|
36
|
+
fallbackMessage: kintIntl.formatKintMessage({
|
|
37
|
+
id: 'customProperties.defaultTitle',
|
|
38
|
+
overrideValue: labelOverrides.defaultTitle
|
|
39
|
+
}, { ctx })
|
|
40
|
+
}, { ctx })
|
|
41
41
|
);
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -67,6 +67,8 @@ const CustomPropertiesEditCtx = ({
|
|
|
67
67
|
<CustomPropertiesListField
|
|
68
68
|
ctx={ctx}
|
|
69
69
|
customProperties={custprops}
|
|
70
|
+
intlKey={passedIntlKey}
|
|
71
|
+
intlNS={passedIntlNS}
|
|
70
72
|
labelOverrides={labelOverrides}
|
|
71
73
|
name={nameOverride ?? 'customProperties'}
|
|
72
74
|
/>
|
|
@@ -78,6 +80,8 @@ CustomPropertiesEditCtx.propTypes = {
|
|
|
78
80
|
ctx: PropTypes.string,
|
|
79
81
|
customPropertiesEndpoint: PropTypes.string,
|
|
80
82
|
id: PropTypes.string,
|
|
83
|
+
intlKey: PropTypes.string,
|
|
84
|
+
intlNS: PropTypes.string,
|
|
81
85
|
labelOverrides: PropTypes.object,
|
|
82
86
|
nameOverride: PropTypes.string
|
|
83
87
|
};
|
|
@@ -3,12 +3,12 @@ import '@folio/stripes-erm-components/test/jest/__mock__';
|
|
|
3
3
|
import { waitFor } from '@testing-library/react';
|
|
4
4
|
|
|
5
5
|
import { MemoryRouter } from 'react-router-dom';
|
|
6
|
-
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
7
6
|
|
|
8
|
-
import { custPropEditCtx } from './testResources';
|
|
9
7
|
import CustomPropertiesEditCtx from './CustomPropertiesEditCtx';
|
|
8
|
+
import { renderWithKintHarness } from '../../../../test/jest';
|
|
10
9
|
|
|
11
10
|
jest.mock('./CustomPropertiesListField', () => () => <div>CustomPropertiesListField</div>);
|
|
11
|
+
jest.mock('../../hooks');
|
|
12
12
|
|
|
13
13
|
describe('CustomPropertiesEditCtx', () => {
|
|
14
14
|
let renderComponent;
|
|
@@ -16,7 +16,9 @@ describe('CustomPropertiesEditCtx', () => {
|
|
|
16
16
|
renderComponent = renderWithKintHarness(
|
|
17
17
|
<MemoryRouter>
|
|
18
18
|
<CustomPropertiesEditCtx
|
|
19
|
-
|
|
19
|
+
ctx="OpenAccess"
|
|
20
|
+
customPropertiesEndpoint="erm/custprops"
|
|
21
|
+
id="supplementaryProperties"
|
|
20
22
|
/>
|
|
21
23
|
</MemoryRouter>
|
|
22
24
|
);
|
|
@@ -2,9 +2,8 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Field, useFormState } from 'react-final-form';
|
|
4
4
|
|
|
5
|
-
import { Button, KeyValue } from '@folio/stripes/components';
|
|
6
|
-
import {
|
|
7
|
-
import { useAvailableCustomProperties } from '../../hooks';
|
|
5
|
+
import { Button, Headline, KeyValue } from '@folio/stripes/components';
|
|
6
|
+
import { useKintIntl } from '../../hooks';
|
|
8
7
|
import CustomPropertyFormCard from './CustomPropertyFormCard';
|
|
9
8
|
|
|
10
9
|
const CustomPropertiesList = ({
|
|
@@ -14,11 +13,15 @@ const CustomPropertiesList = ({
|
|
|
14
13
|
onChange,
|
|
15
14
|
value
|
|
16
15
|
},
|
|
16
|
+
intlKey: passedIntlKey,
|
|
17
|
+
intlNS: passedIntlNS,
|
|
17
18
|
labelOverrides = {},
|
|
18
19
|
meta: {
|
|
19
20
|
pristine
|
|
20
21
|
},
|
|
21
22
|
}) => {
|
|
23
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
24
|
+
|
|
22
25
|
const [customProperties, setCustomProperties] = useState([]); // This is the list of customProperties we're currently displaying for edit.
|
|
23
26
|
const [dirtying, setDirtying] = useState(false);
|
|
24
27
|
|
|
@@ -78,6 +81,8 @@ const CustomPropertiesList = ({
|
|
|
78
81
|
handleDeleteCustomProperty,
|
|
79
82
|
index,
|
|
80
83
|
internalPropertyCounter,
|
|
84
|
+
intlKey: passedIntlKey,
|
|
85
|
+
intlNS: passedIntlNS,
|
|
81
86
|
labelOverrides,
|
|
82
87
|
name,
|
|
83
88
|
onChange,
|
|
@@ -94,14 +99,28 @@ const CustomPropertiesList = ({
|
|
|
94
99
|
{
|
|
95
100
|
availableCustomProperties.some((customProperty = {}) => customProperty.primary) &&
|
|
96
101
|
<KeyValue
|
|
97
|
-
label={
|
|
102
|
+
label={
|
|
103
|
+
<Headline margin="x-small" size="large" tag="h4">
|
|
104
|
+
{kintIntl.formatKintMessage({
|
|
105
|
+
id: 'customProperties.primaryProperties',
|
|
106
|
+
overrideValue: labelOverrides.primaryProperties
|
|
107
|
+
})}
|
|
108
|
+
</Headline>
|
|
109
|
+
}
|
|
98
110
|
value={renderCustomProperties('primary')}
|
|
99
111
|
/>
|
|
100
112
|
}
|
|
101
113
|
{
|
|
102
114
|
availableCustomProperties.some((customProperty = {}) => !customProperty.primary) &&
|
|
103
115
|
<KeyValue
|
|
104
|
-
label={
|
|
116
|
+
label={
|
|
117
|
+
<Headline margin="x-small" size="large" tag="h4">
|
|
118
|
+
{kintIntl.formatKintMessage({
|
|
119
|
+
id: 'customProperties.optionalProperties',
|
|
120
|
+
overrideValue: labelOverrides.optionalProperties
|
|
121
|
+
})}
|
|
122
|
+
</Headline>
|
|
123
|
+
}
|
|
105
124
|
value={renderCustomProperties('optional')}
|
|
106
125
|
/>
|
|
107
126
|
}
|
|
@@ -114,10 +133,10 @@ const CustomPropertiesList = ({
|
|
|
114
133
|
setDirtying(true);
|
|
115
134
|
}}
|
|
116
135
|
>
|
|
117
|
-
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
136
|
+
{kintIntl.formatKintMessage({
|
|
137
|
+
id: 'customProperties.addProperty',
|
|
138
|
+
overrideValue: labelOverrides.addProperty
|
|
139
|
+
})}
|
|
121
140
|
</Button>
|
|
122
141
|
}
|
|
123
142
|
</>
|
|
@@ -127,11 +146,40 @@ const CustomPropertiesList = ({
|
|
|
127
146
|
const CustomPropertiesListField = ({
|
|
128
147
|
ctx,
|
|
129
148
|
customProperties,
|
|
130
|
-
|
|
149
|
+
intlKey: passedIntlKey,
|
|
150
|
+
intlNS: passedIntlNS,
|
|
151
|
+
labelOverrides = {},
|
|
131
152
|
...fieldProps
|
|
132
153
|
}) => {
|
|
133
154
|
const fieldRef = useRef();
|
|
134
|
-
const
|
|
155
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
156
|
+
|
|
157
|
+
// Map customProperties to bring together the options and the definition values
|
|
158
|
+
const availableCustomProperties = customProperties?.map(customProperty => {
|
|
159
|
+
let options = customProperty?.category?.values;
|
|
160
|
+
if (options) {
|
|
161
|
+
options = [
|
|
162
|
+
{
|
|
163
|
+
label: kintIntl.formatKintMessage({
|
|
164
|
+
id: 'notSet',
|
|
165
|
+
overrideValue: labelOverrides.notSet
|
|
166
|
+
}),
|
|
167
|
+
value: '',
|
|
168
|
+
},
|
|
169
|
+
...options,
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return {
|
|
174
|
+
description: customProperty.description,
|
|
175
|
+
label: customProperty.label,
|
|
176
|
+
primary: customProperty.primary,
|
|
177
|
+
type: customProperty.type,
|
|
178
|
+
options,
|
|
179
|
+
value: customProperty.name,
|
|
180
|
+
defaultInternal: customProperty.defaultInternal,
|
|
181
|
+
};
|
|
182
|
+
});
|
|
135
183
|
|
|
136
184
|
const { initialValues } = useFormState();
|
|
137
185
|
const getInitialValue = () => {
|
|
@@ -163,6 +211,8 @@ const CustomPropertiesListField = ({
|
|
|
163
211
|
ref={fieldRef}
|
|
164
212
|
availableCustomProperties={availableCustomProperties}
|
|
165
213
|
ctx={ctx}
|
|
214
|
+
intlKey={passedIntlKey}
|
|
215
|
+
intlNS={passedIntlNS}
|
|
166
216
|
labelOverrides={labelOverrides}
|
|
167
217
|
{...p}
|
|
168
218
|
/>
|
|
@@ -175,6 +225,8 @@ const CustomPropertiesListField = ({
|
|
|
175
225
|
CustomPropertiesListField.propTypes = {
|
|
176
226
|
ctx: PropTypes.string,
|
|
177
227
|
customProperties: PropTypes.arrayOf(PropTypes.object),
|
|
228
|
+
intlKey: PropTypes.string,
|
|
229
|
+
intlNS: PropTypes.string,
|
|
178
230
|
labelOverrides: PropTypes.object,
|
|
179
231
|
};
|
|
180
232
|
|
|
@@ -186,6 +238,8 @@ CustomPropertiesList.propTypes = {
|
|
|
186
238
|
value: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
187
239
|
onChange: PropTypes.func,
|
|
188
240
|
}),
|
|
241
|
+
intlKey: PropTypes.string,
|
|
242
|
+
intlNS: PropTypes.string,
|
|
189
243
|
labelOverrides: PropTypes.object,
|
|
190
244
|
meta: PropTypes.object,
|
|
191
245
|
};
|