@k-int/stripes-kint-components 2.8.2 → 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 +15 -3
- package/es/index.js +48 -12
- package/es/lib/ActionList/ActionList.js +11 -5
- package/es/lib/ActionList/ActionListFieldArray.js +147 -77
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +43 -31
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +17 -14
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +64 -46
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +17 -24
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +91 -70
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +53 -36
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +50 -31
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +13 -14
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +6 -0
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +8 -12
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +22 -24
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +9 -12
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +62 -13
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +12 -13
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +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 +35 -27
- package/es/lib/EditableRefdataList/EditableRefdataList.js +41 -31
- package/es/lib/EditableSettingsList/EditableSettingsList.js +11 -1
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +10 -0
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +19 -11
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +9 -8
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +21 -9
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +1 -0
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +83 -16
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +138 -65
- package/es/lib/FormModal/FormModal.js +14 -9
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +91 -0
- package/es/lib/FormattedKintMessage/index.js +15 -0
- package/es/lib/IconSelect/IconSelect.js +18 -12
- package/es/lib/NoResultsMessage/NoResultsMessage.js +13 -2
- package/es/lib/RichSelect/RichSelect.js +13 -34
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +16 -5
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +11 -1
- package/es/lib/SettingPage/SettingPage.js +12 -13
- package/es/lib/SettingPage/SettingPagePane.js +12 -20
- package/es/lib/hooks/__mocks__/index.js +46 -0
- package/es/lib/hooks/index.js +24 -8
- package/es/lib/hooks/settingsHooks/useSettings.js +22 -17
- package/es/lib/hooks/useIntlKey.js +34 -0
- package/es/lib/hooks/useIntlKeyStore.js +84 -0
- package/es/lib/hooks/useKintIntl.js +93 -0
- package/es/lib/utils/index.js +40 -4
- package/es/lib/utils/parseErrorResponse.js +1 -1
- package/es/lib/utils/validators.js +76 -59
- package/jest.config.js +4 -1
- package/junit.xml +157 -656
- package/package.json +54 -33
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +56 -8
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +394 -64
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +10 -10
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesLookup.js.html +187 -52
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesSettings.js.html +372 -87
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +293 -74
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyView.js.html +126 -54
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.html +45 -60
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEdit.js.html +23 -5
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +59 -47
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesListField.js.html +259 -97
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyField.js.html +399 -105
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyFormCard.js.html +41 -68
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.html +57 -57
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/testResources.js.html +67 -688
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilter.js.html +92 -53
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterField.js.html +103 -64
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +54 -63
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +49 -16
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesRule.js.html +69 -18
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.html +89 -89
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/testResources.js.html +33 -786
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useOperators.js.html +46 -46
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useParseActiveFilterStrings.js.html +45 -36
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useValueProps.js.html +43 -28
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesView.js.html +20 -2
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesViewCtx.js.html +50 -41
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertyCard.js.html +54 -75
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.html +24 -24
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/{hooks/useAvailableCustomProperties.js.html → CycleButton/CycleButton.js.html} +62 -50
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +664 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +264 -39
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +41 -14
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +45 -6
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +47 -11
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +65 -14
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +154 -31
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +26 -26
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +18 -18
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html +35 -17
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.html +15 -15
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/FormattedKintMessage.js.html +247 -0
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/{CustomProperties/Config/CustomPropertiesView.js.html → IconSelect/IconSelect.js.html} +158 -257
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +48 -6
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/{CustomProperties/Config/testResources.js.html → RichSelect/RichSelect.js.html} +256 -334
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/useSelectedOption.js.html +127 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +52 -7
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/TableBody.js.html +31 -4
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +24 -27
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +47 -17
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +22 -22
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +142 -97
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +13 -4
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +35 -20
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +5 -2
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useAppSettings.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +61 -22
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html +19 -22
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKey.js.html +151 -0
- package/src/artifacts/coverage-jest/lcov-report/{utils/renderHelpText.js.html → hooks/useIntlKeyStore.js.html} +71 -38
- package/src/artifacts/coverage-jest/lcov-report/hooks/useInvalidateRefdata.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKintIntl.js.html +238 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html +23 -11
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataCategory.js.html +274 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +19 -10
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/index.html +205 -130
- package/src/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/groupCustomPropertiesByCtx.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/utils/highlightString.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +34 -34
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +42 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/matchString.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/parseErrorResponse.js.html +139 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +5 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataQueryKey.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/typedownQueryKey.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/validators.js.html +128 -80
- package/src/artifacts/coverage-jest/lcov.info +2603 -2086
- package/src/index.js +11 -4
- package/src/lib/ActionList/ActionList.js +9 -3
- package/src/lib/ActionList/ActionListFieldArray.js +115 -37
- package/src/lib/ActionList/README.md +2 -1
- package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +60 -16
- package/src/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +14 -4
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +106 -33
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +16 -9
- package/src/lib/CustomProperties/Config/CustomPropertyForm.js +131 -58
- package/src/lib/CustomProperties/Config/CustomPropertyForm.test.js +52 -33
- package/src/lib/CustomProperties/Config/CustomPropertyView.js +71 -47
- package/src/lib/CustomProperties/Config/CustomPropertyView.test.js +8 -6
- package/src/lib/CustomProperties/Config/README.md +33 -28
- package/src/lib/CustomProperties/Edit/CustomPropertiesEdit.js +6 -0
- package/src/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +7 -3
- package/src/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +23 -19
- package/src/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +5 -3
- package/src/lib/CustomProperties/Edit/CustomPropertiesListField.js +65 -11
- package/src/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +10 -8
- package/src/lib/CustomProperties/Edit/CustomPropertyField.js +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 +45 -27
- package/src/lib/EditableRefdataList/EditableRefdataList.js +56 -32
- package/src/lib/EditableSettingsList/EditableSettingsList.js +10 -1
- package/src/lib/EditableSettingsList/EditableSettingsListFieldArray.js +14 -1
- package/src/lib/EditableSettingsList/SettingField/EditSettingValue.js +17 -5
- package/src/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +9 -8
- package/src/lib/EditableSettingsList/SettingField/RenderSettingValue.js +24 -7
- package/src/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +1 -0
- package/src/lib/EditableSettingsList/SettingField/SettingField.js +57 -16
- package/src/lib/EditableSettingsList/SettingField/SettingField.test.js +14 -19
- package/src/lib/FormModal/FormModal.js +15 -9
- package/src/lib/FormattedKintMessage/FormattedKintMessage.js +54 -0
- package/src/lib/FormattedKintMessage/index.js +1 -0
- package/src/lib/IconSelect/IconSelect.js +17 -8
- package/src/lib/NoResultsMessage/NoResultsMessage.js +15 -1
- package/src/lib/RichSelect/RichSelect.js +16 -36
- package/src/lib/SASQLookupComponent/SASQLookupComponent.js +17 -2
- package/src/lib/SASQLookupComponent/TableBody/TableBody.js +10 -1
- package/src/lib/SettingPage/SettingPage.js +12 -13
- package/src/lib/SettingPage/SettingPagePane.js +16 -6
- package/src/lib/hooks/__mocks__/index.js +17 -0
- package/src/lib/hooks/index.js +3 -1
- package/src/lib/hooks/settingsHooks/useSettings.js +25 -12
- package/src/lib/hooks/useIntlKey.js +22 -0
- package/src/lib/hooks/useIntlKeyStore.js +38 -0
- package/src/lib/hooks/useKintIntl.js +51 -0
- package/src/lib/utils/index.js +11 -1
- package/src/lib/utils/parseErrorResponse.js +1 -1
- package/src/lib/utils/validators.js +57 -41
- package/styles/RichSelect.css +7 -4
- package/test/helpers/test-implementor-translations.json +80 -0
- package/test/helpers/translationsProperties.js +6 -1
- package/test/jest/customProperties.js +166 -0
- package/test/jest/helpers/KintHarness.js +1 -1
- package/test/jest/helpers/renderWithKintHarness.js +2 -1
- package/test/jest/index.js +8 -0
- package/test/jest/refdata.js +471 -0
- package/test/jest/resolver.js +29 -0
- package/translations/stripes-kint-components/ar.json +1 -122
- package/translations/stripes-kint-components/cs_CZ.json +1 -122
- package/translations/stripes-kint-components/de.json +1 -122
- package/translations/stripes-kint-components/en.json +1 -148
- package/translations/stripes-kint-components/es.json +1 -122
- package/translations/stripes-kint-components/hi_IN.json +1 -122
- package/translations/stripes-kint-components/hu.json +1 -122
- package/translations/stripes-kint-components/it_IT.json +1 -122
- package/translations/stripes-kint-components/ja.json +1 -122
- package/translations/stripes-kint-components/ko.json +1 -122
- package/translations/stripes-kint-components/pt_PT.json +1 -122
- package/translations/stripes-kint-components/ru.json +1 -122
- package/translations/stripes-kint-components/sv.json +1 -122
- package/translations/stripes-kint-components/zh_CN.json +1 -122
- package/es/lib/CustomProperties/Config/testResources.js +0 -198
- package/es/lib/hooks/useAvailableCustomProperties.js +0 -73
- package/es/lib/utils/renderHelpText.js +0 -80
- package/src/lib/CustomProperties/Config/testResources.js +0 -236
- package/src/lib/hooks/useAvailableCustomProperties.js +0 -40
- package/src/lib/utils/renderHelpText.js +0 -27
|
@@ -4,12 +4,12 @@ import { Button, KeyValue } from '@folio/stripes-testing';
|
|
|
4
4
|
import { TestForm } from '@folio/stripes-erm-components/test/jest/helpers';
|
|
5
5
|
import { waitFor } from '@testing-library/react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { initialValues } from './testResources';
|
|
8
8
|
import CustomPropertiesListField from './CustomPropertiesListField';
|
|
9
|
-
import { renderWithKintHarness } from '../../../../test/jest
|
|
9
|
+
import { customProperties, renderWithKintHarness } from '../../../../test/jest';
|
|
10
10
|
|
|
11
11
|
const onSubmit = jest.fn();
|
|
12
|
-
|
|
12
|
+
jest.mock('../../hooks');
|
|
13
13
|
jest.mock('./CustomPropertyFormCard', () => () => <div>CustomPropertyFormCard</div>);
|
|
14
14
|
|
|
15
15
|
describe('CustomPropertiesListField', () => {
|
|
@@ -21,18 +21,20 @@ describe('CustomPropertiesListField', () => {
|
|
|
21
21
|
onSubmit={onSubmit}
|
|
22
22
|
>
|
|
23
23
|
<CustomPropertiesListField
|
|
24
|
-
|
|
24
|
+
ctx="isNull"
|
|
25
|
+
customProperties={customProperties}
|
|
26
|
+
name="customProperties"
|
|
25
27
|
/>
|
|
26
28
|
</TestForm>
|
|
27
29
|
);
|
|
28
30
|
});
|
|
29
31
|
|
|
30
|
-
test('displays expected
|
|
31
|
-
await KeyValue('Primary
|
|
32
|
+
test('displays expected primary properties key value', async () => {
|
|
33
|
+
await KeyValue('Primary properties').exists();
|
|
32
34
|
});
|
|
33
35
|
|
|
34
|
-
test('displays expected
|
|
35
|
-
await KeyValue('Optional
|
|
36
|
+
test('displays expected optional properties key value', async () => {
|
|
37
|
+
await KeyValue('Optional properties').exists();
|
|
36
38
|
});
|
|
37
39
|
|
|
38
40
|
it('renders CustomPropertyFormCard component ', () => {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
|
|
3
|
-
import { FormattedMessage, useIntl } from 'react-intl';
|
|
4
|
-
|
|
5
3
|
import { Field } from 'react-final-form';
|
|
6
4
|
|
|
7
5
|
import {
|
|
@@ -16,7 +14,14 @@ import {
|
|
|
16
14
|
|
|
17
15
|
import * as CUSTOM_PROPERTY_TYPES from '../../constants/customProperties';
|
|
18
16
|
|
|
19
|
-
import {
|
|
17
|
+
import { useKintIntl } from '../../hooks';
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
composeValidatorsWithArgs,
|
|
21
|
+
invalidNumber,
|
|
22
|
+
rangeOverflow,
|
|
23
|
+
rangeUnderflow
|
|
24
|
+
} from '../../utils';
|
|
20
25
|
|
|
21
26
|
const CustomPropertyField = ({
|
|
22
27
|
availableCustomProperties,
|
|
@@ -24,13 +29,67 @@ const CustomPropertyField = ({
|
|
|
24
29
|
customPropertyType,
|
|
25
30
|
customProperties,
|
|
26
31
|
index,
|
|
32
|
+
intlKey: passedIntlKey,
|
|
33
|
+
intlNS: passedIntlNS,
|
|
27
34
|
labelOverrides = {},
|
|
28
35
|
name,
|
|
29
36
|
onChange,
|
|
30
37
|
value,
|
|
31
38
|
setCustomProperties
|
|
32
39
|
}) => {
|
|
33
|
-
const
|
|
40
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
41
|
+
|
|
42
|
+
// Set up the validator for the customProperty
|
|
43
|
+
const customPropertyValidator = (fieldValue, allValues) => {
|
|
44
|
+
const { note, publicNote, value: currentValue } = allValues?.customProperties?.[customProperty?.value]?.[0] ?? {};
|
|
45
|
+
|
|
46
|
+
if ((note && !currentValue) || (publicNote && !currentValue)) {
|
|
47
|
+
if (
|
|
48
|
+
customProperty.type === CUSTOM_PROPERTY_TYPES.DECIMAL_CLASS_NAME ||
|
|
49
|
+
customProperty.type === CUSTOM_PROPERTY_TYPES.INTEGER_CLASS_NAME
|
|
50
|
+
) {
|
|
51
|
+
return (
|
|
52
|
+
kintIntl.formatKintMessage({
|
|
53
|
+
id: 'customProperties.errors.customPropertyNoteInvalidNumber',
|
|
54
|
+
overrideValue: labelOverrides.customPropertyNoteInvalidNumberError
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
} else {
|
|
58
|
+
return (
|
|
59
|
+
kintIntl.formatKintMessage({
|
|
60
|
+
id: 'customProperties.errors.customPropertyNoteWithoutValue',
|
|
61
|
+
overrideValue: labelOverrides.customPropertyNoteWithoutValueError
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (customProperty.type === CUSTOM_PROPERTY_TYPES.DECIMAL_CLASS_NAME) {
|
|
68
|
+
const regexp = /^-?[\d]*(\.[\d]{0,2})?$/;
|
|
69
|
+
return (fieldValue && !regexp.test(fieldValue)) ?
|
|
70
|
+
kintIntl.formatKintMessage({
|
|
71
|
+
id: 'errors.maxTwoDecimals',
|
|
72
|
+
overrideValue: labelOverrides.maxTwoDecimalsError
|
|
73
|
+
}) : undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (customProperty.type === CUSTOM_PROPERTY_TYPES.INTEGER_CLASS_NAME) {
|
|
77
|
+
const min = Number.MIN_SAFE_INTEGER;
|
|
78
|
+
const max = Number.MAX_SAFE_INTEGER;
|
|
79
|
+
|
|
80
|
+
return (fieldValue && !Number.isInteger(+fieldValue)) ?
|
|
81
|
+
kintIntl.formatKintMessage({
|
|
82
|
+
id: 'errors.valueNotInRange',
|
|
83
|
+
overrideValue: labelOverrides.valueNotInRangeError
|
|
84
|
+
}, { min, max }) : undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!customProperty.primary && !currentValue) {
|
|
88
|
+
return kintIntl.formatMessage({ id: 'stripes-core.label.missingRequiredField' });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return undefined;
|
|
92
|
+
};
|
|
34
93
|
|
|
35
94
|
const getCustomProperty = (customPropertyValue) => {
|
|
36
95
|
return availableCustomProperties.find(cp => cp.value === customPropertyValue);
|
|
@@ -60,8 +119,10 @@ const CustomPropertyField = ({
|
|
|
60
119
|
dataOptions={[customProperty, ...unsetCustomProperties]} // The selected customProperty, and the available unset customProperties
|
|
61
120
|
id={`edit-customproperty-${index}-name`}
|
|
62
121
|
label={
|
|
63
|
-
|
|
64
|
-
|
|
122
|
+
kintIntl.formatKintMessage({
|
|
123
|
+
id: 'customProperties.name',
|
|
124
|
+
overrideValue: labelOverrides.name
|
|
125
|
+
})
|
|
65
126
|
}
|
|
66
127
|
onChange={e => {
|
|
67
128
|
const newValue = e.target.value;
|
|
@@ -140,14 +201,25 @@ const CustomPropertyField = ({
|
|
|
140
201
|
case CUSTOM_PROPERTY_TYPES.INTEGER_CLASS_NAME:
|
|
141
202
|
case CUSTOM_PROPERTY_TYPES.DECIMAL_CLASS_NAME:
|
|
142
203
|
fieldProps = {
|
|
143
|
-
badInput: intl.formatMessage({ id: 'stripes-kint-components.errors.customPropertyInvalidNumber' }),
|
|
144
204
|
component: TextField,
|
|
145
205
|
max,
|
|
146
206
|
min,
|
|
147
|
-
rangeOverflow: intl.formatMessage({ id: 'stripes-kint-components.errors.customPropertyDecimalValueNotInRange' }, { min, max }),
|
|
148
|
-
rangeUnderflow: intl.formatMessage({ id: 'stripes-kint-components.errors.customPropertyDecimalValueNotInRange' }, { min, max }),
|
|
149
207
|
step: 'any',
|
|
150
208
|
type: 'number',
|
|
209
|
+
validate: (validateValue) => {
|
|
210
|
+
return composeValidatorsWithArgs(
|
|
211
|
+
invalidNumber,
|
|
212
|
+
rangeOverflow,
|
|
213
|
+
rangeUnderflow
|
|
214
|
+
)(
|
|
215
|
+
validateValue,
|
|
216
|
+
min,
|
|
217
|
+
max,
|
|
218
|
+
passedIntlKey,
|
|
219
|
+
passedIntlNS,
|
|
220
|
+
labelOverrides
|
|
221
|
+
);
|
|
222
|
+
}
|
|
151
223
|
};
|
|
152
224
|
handleChange = e => {
|
|
153
225
|
onChange({
|
|
@@ -184,14 +256,15 @@ const CustomPropertyField = ({
|
|
|
184
256
|
data-test-customproperty-value
|
|
185
257
|
id={`edit-customproperty-${index}-value`}
|
|
186
258
|
label={
|
|
187
|
-
|
|
188
|
-
|
|
259
|
+
kintIntl.formatKintMessage({
|
|
260
|
+
id: 'customProperties.value',
|
|
261
|
+
overrideValue: labelOverrides.value
|
|
262
|
+
})
|
|
189
263
|
}
|
|
190
264
|
name={`${name}.${customProperty.value}[0].value`}
|
|
191
265
|
onChange={handleChange}
|
|
192
266
|
required={!customProperty.primary}
|
|
193
|
-
validate={(fieldValue, allValues) => customPropertyValidator(fieldValue, allValues
|
|
194
|
-
valueMissing={intl.formatMessage({ id: 'stripes-core.label.missingRequiredField' })}
|
|
267
|
+
validate={(fieldValue, allValues) => customPropertyValidator(fieldValue, allValues)}
|
|
195
268
|
{...fieldProps}
|
|
196
269
|
/>
|
|
197
270
|
);
|
|
@@ -214,13 +287,27 @@ const CustomPropertyField = ({
|
|
|
214
287
|
<Select
|
|
215
288
|
data-test-customproperty-visibility
|
|
216
289
|
dataOptions={[
|
|
217
|
-
{
|
|
218
|
-
|
|
290
|
+
{
|
|
291
|
+
value: true,
|
|
292
|
+
label: kintIntl.formatKintMessage({
|
|
293
|
+
id: 'customProperties.internalTrue',
|
|
294
|
+
overrideValue: labelOverrides.internalTrue
|
|
295
|
+
})
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
value: false,
|
|
299
|
+
label: kintIntl.formatKintMessage({
|
|
300
|
+
id: 'customProperties.internalFalse',
|
|
301
|
+
overrideValue: labelOverrides.internalFalse
|
|
302
|
+
})
|
|
303
|
+
}
|
|
219
304
|
]}
|
|
220
305
|
id={`edit-customproperty-${index}-visibility`}
|
|
221
306
|
label={
|
|
222
|
-
|
|
223
|
-
|
|
307
|
+
kintIntl.formatKintMessage({
|
|
308
|
+
id: 'customProperties.visibility',
|
|
309
|
+
overrideValue: labelOverrides.visibility
|
|
310
|
+
})
|
|
224
311
|
}
|
|
225
312
|
onChange={handleChange}
|
|
226
313
|
value={customPropertyObject?.internal ?? customProperty.defaultInternal}
|
|
@@ -246,8 +333,11 @@ const CustomPropertyField = ({
|
|
|
246
333
|
data-test-customproperty-note
|
|
247
334
|
id={`edit-customproperty-${index}-internal-note`}
|
|
248
335
|
label={
|
|
249
|
-
|
|
250
|
-
|
|
336
|
+
kintIntl.formatKintMessage({
|
|
337
|
+
id: 'customProperties.internalNote',
|
|
338
|
+
overrideValue: labelOverrides.internalNote
|
|
339
|
+
})
|
|
340
|
+
}
|
|
251
341
|
onChange={handleChange}
|
|
252
342
|
value={customPropertyObject?.note}
|
|
253
343
|
/>
|
|
@@ -272,8 +362,10 @@ const CustomPropertyField = ({
|
|
|
272
362
|
data-test-customproperty-public-note
|
|
273
363
|
id={`edit-customproperty-${index}-public-note`}
|
|
274
364
|
label={
|
|
275
|
-
|
|
276
|
-
|
|
365
|
+
kintIntl.formatKintMessage({
|
|
366
|
+
id: 'customProperties.publicNote',
|
|
367
|
+
overrideValue: labelOverrides.publicNote
|
|
368
|
+
})
|
|
277
369
|
}
|
|
278
370
|
onChange={handleChange}
|
|
279
371
|
value={customPropertyObject?.publicNote}
|
|
@@ -321,6 +413,8 @@ CustomPropertyField.propTypes = {
|
|
|
321
413
|
customPropertyType: PropTypes.string,
|
|
322
414
|
customProperties: PropTypes.arrayOf(PropTypes.object),
|
|
323
415
|
index: PropTypes.number,
|
|
416
|
+
intlKey: PropTypes.string,
|
|
417
|
+
intlNS: PropTypes.string,
|
|
324
418
|
labelOverrides: PropTypes.object,
|
|
325
419
|
name: PropTypes.string,
|
|
326
420
|
onChange: PropTypes.func,
|
|
@@ -1,27 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@folio/stripes-erm-components/test/jest/__mock__';
|
|
3
3
|
import { TextArea, MultiSelect, TextInput, Datepicker } from '@folio/stripes-testing';
|
|
4
|
+
|
|
4
5
|
import { TestForm } from '@folio/stripes-erm-components/test/jest/helpers';
|
|
5
6
|
import CustomPropertyField from './CustomPropertyField';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
labelOverrides,
|
|
11
|
-
value,
|
|
12
|
-
initialValues,
|
|
13
|
-
dateData,
|
|
14
|
-
integerData,
|
|
15
|
-
decimalData,
|
|
16
|
-
multiSelectData,
|
|
17
|
-
} from './testResources';
|
|
18
|
-
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
7
|
+
|
|
8
|
+
import { availableCustomProperties, customProperties, renderWithKintHarness } from '../../../../test/jest';
|
|
9
|
+
|
|
10
|
+
import { value, initialValues } from './testResources';
|
|
19
11
|
|
|
20
12
|
const onSubmit = jest.fn();
|
|
13
|
+
jest.mock('../../hooks');
|
|
21
14
|
|
|
22
15
|
const onChange = () => {};
|
|
23
16
|
const setCustomProperties = () => {};
|
|
24
17
|
|
|
18
|
+
const authIdentCustom = availableCustomProperties?.find(cp => cp.value === 'AuthorIdentification');
|
|
19
|
+
const decimalCustProp = availableCustomProperties?.find(cp => cp.value === 'decimal');
|
|
20
|
+
const integerCustProp = availableCustomProperties?.find(cp => cp.value === 'integer');
|
|
21
|
+
const dateCustProp = availableCustomProperties?.find(cp => cp.value === 'date');
|
|
22
|
+
const multiRefdataCustProp = availableCustomProperties?.find(cp => cp.value === 'MultiRefdata');
|
|
23
|
+
|
|
24
|
+
const defaultProps = {
|
|
25
|
+
availableCustomProperties,
|
|
26
|
+
customProperties,
|
|
27
|
+
customPropertyType: 'primary',
|
|
28
|
+
internalPropertyCounter: 1,
|
|
29
|
+
name: 'customProperties',
|
|
30
|
+
onChange,
|
|
31
|
+
setCustomProperties,
|
|
32
|
+
value
|
|
33
|
+
};
|
|
34
|
+
|
|
25
35
|
describe('CustomPropertyField', () => {
|
|
26
36
|
let renderComponent;
|
|
27
37
|
describe('CustomPropertyField', () => {
|
|
@@ -32,17 +42,9 @@ describe('CustomPropertyField', () => {
|
|
|
32
42
|
onSubmit={onSubmit}
|
|
33
43
|
>
|
|
34
44
|
<CustomPropertyField
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
customProperty={customProperty}
|
|
38
|
-
customPropertyType="primary"
|
|
45
|
+
{...defaultProps}
|
|
46
|
+
customProperty={authIdentCustom}
|
|
39
47
|
index={0}
|
|
40
|
-
internalPropertyCounter={1}
|
|
41
|
-
labelOverrides={labelOverrides}
|
|
42
|
-
name="customProperties"
|
|
43
|
-
onChange={onChange}
|
|
44
|
-
setCustomProperties={setCustomProperties}
|
|
45
|
-
value={value}
|
|
46
48
|
/>
|
|
47
49
|
</TestForm>
|
|
48
50
|
);
|
|
@@ -50,35 +52,36 @@ describe('CustomPropertyField', () => {
|
|
|
50
52
|
expect(getByTestId('customPropertyField')).toBeInTheDocument();
|
|
51
53
|
});
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
|
|
56
|
+
it('Displays expected value(s) label ', () => {
|
|
54
57
|
const { getByText } = renderComponent;
|
|
55
58
|
expect(getByText('Value(s)')).toBeInTheDocument();
|
|
56
59
|
});
|
|
57
60
|
|
|
58
|
-
test('Displays expected
|
|
61
|
+
test('Displays expected Value(s) dropdown values ', () => {
|
|
59
62
|
MultiSelect('Value(s)').select(['Not set', 'ORCID', 'Ringgold ID', 'Email Domain', 'Over IP Range', 'FOR ID', 'Other', 'Over Institute']);
|
|
60
63
|
});
|
|
61
64
|
|
|
62
|
-
it('Displays expected Internal note
|
|
65
|
+
it('Displays expected Internal note label ', () => {
|
|
63
66
|
const { getByText } = renderComponent;
|
|
64
67
|
expect(getByText('Internal note')).toBeInTheDocument();
|
|
65
68
|
});
|
|
66
69
|
|
|
67
70
|
test('Displays expected internal note value', async () => {
|
|
68
|
-
await TextArea(
|
|
71
|
+
await TextArea('Internal note').has({ value: 'this is an internal note' });
|
|
69
72
|
});
|
|
70
73
|
|
|
71
74
|
test('Displays expected visibilities dropdwon values ', () => {
|
|
72
75
|
MultiSelect('Visibility').select(['Internal', 'Public']);
|
|
73
76
|
});
|
|
74
77
|
|
|
75
|
-
it('Displays expected Public note
|
|
78
|
+
it('Displays expected Public note label ', () => {
|
|
76
79
|
const { getByText } = renderComponent;
|
|
77
80
|
expect(getByText('Public note')).toBeInTheDocument();
|
|
78
81
|
});
|
|
79
82
|
|
|
80
83
|
test('Displays expected public note value', async () => {
|
|
81
|
-
await TextArea(
|
|
84
|
+
await TextArea('Public note').has({ value: 'this is a public note' });
|
|
82
85
|
});
|
|
83
86
|
});
|
|
84
87
|
|
|
@@ -90,10 +93,9 @@ describe('CustomPropertyField', () => {
|
|
|
90
93
|
onSubmit={onSubmit}
|
|
91
94
|
>
|
|
92
95
|
<CustomPropertyField
|
|
93
|
-
{...
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
setCustomProperties={setCustomProperties}
|
|
96
|
+
{...defaultProps}
|
|
97
|
+
customProperty={decimalCustProp}
|
|
98
|
+
index={2}
|
|
97
99
|
/>
|
|
98
100
|
</TestForm>
|
|
99
101
|
);
|
|
@@ -112,10 +114,9 @@ describe('CustomPropertyField', () => {
|
|
|
112
114
|
onSubmit={onSubmit}
|
|
113
115
|
>
|
|
114
116
|
<CustomPropertyField
|
|
115
|
-
{...
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
setCustomProperties={setCustomProperties}
|
|
117
|
+
{...defaultProps}
|
|
118
|
+
customProperty={integerCustProp}
|
|
119
|
+
index={3}
|
|
119
120
|
/>
|
|
120
121
|
</TestForm>
|
|
121
122
|
);
|
|
@@ -126,7 +127,7 @@ describe('CustomPropertyField', () => {
|
|
|
126
127
|
});
|
|
127
128
|
});
|
|
128
129
|
|
|
129
|
-
describe('
|
|
130
|
+
describe('Refdata multi-select field', () => {
|
|
130
131
|
beforeEach(() => {
|
|
131
132
|
renderComponent = renderWithKintHarness(
|
|
132
133
|
<TestForm
|
|
@@ -134,25 +135,29 @@ describe('CustomPropertyField', () => {
|
|
|
134
135
|
onSubmit={onSubmit}
|
|
135
136
|
>
|
|
136
137
|
<CustomPropertyField
|
|
137
|
-
{...
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
setCustomProperties={setCustomProperties}
|
|
138
|
+
{...defaultProps}
|
|
139
|
+
customProperty={multiRefdataCustProp}
|
|
140
|
+
index={4}
|
|
141
141
|
/>
|
|
142
142
|
</TestForm>
|
|
143
143
|
);
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
-
test('
|
|
147
|
-
await
|
|
146
|
+
test('Displays expected multi-select Refdata Field', async () => {
|
|
147
|
+
await MultiSelect('Value(s)').exists();
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
it('Displays expected value(s) label ', () => {
|
|
151
|
+
const { getByText } = renderComponent;
|
|
152
|
+
expect(getByText('Value(s)')).toBeInTheDocument();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test('renders multi-select Refdata values', async () => {
|
|
156
|
+
await MultiSelect('Value(s)').select(['Future', 'Current', 'Historical', 'Does not apply']);
|
|
152
157
|
});
|
|
153
158
|
});
|
|
154
159
|
|
|
155
|
-
describe('
|
|
160
|
+
describe('Date field', () => {
|
|
156
161
|
beforeEach(() => {
|
|
157
162
|
renderComponent = renderWithKintHarness(
|
|
158
163
|
<TestForm
|
|
@@ -160,26 +165,20 @@ describe('CustomPropertyField', () => {
|
|
|
160
165
|
onSubmit={onSubmit}
|
|
161
166
|
>
|
|
162
167
|
<CustomPropertyField
|
|
163
|
-
{...
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
setCustomProperties={setCustomProperties}
|
|
168
|
+
{...defaultProps}
|
|
169
|
+
customProperty={dateCustProp}
|
|
170
|
+
index={5}
|
|
167
171
|
/>
|
|
168
172
|
</TestForm>
|
|
169
173
|
);
|
|
170
174
|
});
|
|
171
175
|
|
|
172
|
-
test('
|
|
173
|
-
await
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it('Displays expected value(s) lable ', () => {
|
|
177
|
-
const { getByText } = renderComponent;
|
|
178
|
-
expect(getByText('Value(s)')).toBeInTheDocument();
|
|
176
|
+
test('renders values DatePicker', async () => {
|
|
177
|
+
await Datepicker('Value(s)').exists();
|
|
179
178
|
});
|
|
180
179
|
|
|
181
|
-
test('
|
|
182
|
-
await
|
|
180
|
+
test('Displays expected date Field', async () => {
|
|
181
|
+
await TextInput({ id: 'edit-customproperty-5-value' }).exists();
|
|
183
182
|
});
|
|
184
183
|
});
|
|
185
184
|
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
|
|
3
|
-
import { FormattedMessage } from 'react-intl';
|
|
4
|
-
|
|
5
3
|
import {
|
|
6
4
|
Card,
|
|
7
5
|
IconButton,
|
|
@@ -10,6 +8,7 @@ import {
|
|
|
10
8
|
} from '@folio/stripes/components';
|
|
11
9
|
|
|
12
10
|
import CustomPropertyField from './CustomPropertyField';
|
|
11
|
+
import { useKintIntl } from '../../hooks';
|
|
13
12
|
|
|
14
13
|
const CustomPropertyFormCard = ({
|
|
15
14
|
availableCustomProperties,
|
|
@@ -19,49 +18,37 @@ const CustomPropertyFormCard = ({
|
|
|
19
18
|
handleDeleteCustomProperty,
|
|
20
19
|
index,
|
|
21
20
|
internalPropertyCounter,
|
|
21
|
+
intlKey: passedIntlKey,
|
|
22
|
+
intlNS: passedIntlNS,
|
|
22
23
|
labelOverrides = {},
|
|
23
24
|
name,
|
|
24
25
|
onChange,
|
|
25
26
|
setCustomProperties,
|
|
26
27
|
value
|
|
27
28
|
}) => {
|
|
29
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
30
|
+
|
|
28
31
|
const getHeader = () => {
|
|
29
32
|
if (customPropertyType === 'optional') {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// Label override for optionalPropertyHeader or finally built in default
|
|
35
|
-
return (
|
|
36
|
-
labelOverrides.optionalPropertyHeader ??
|
|
37
|
-
<FormattedMessage
|
|
38
|
-
id="stripes-kint-components.customProperty.optionalPropertyHeader"
|
|
39
|
-
values={{ number: internalPropertyCounter }}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
33
|
+
return kintIntl.formatKintMessage({
|
|
34
|
+
id: 'customProperty.optionalPropertyHeader',
|
|
35
|
+
overrideValue: labelOverrides.optionalPropertyHeader,
|
|
36
|
+
}, { number: internalPropertyCounter, name: customProperty.value });
|
|
42
37
|
}
|
|
43
38
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
labelOverrides.primaryPropertyHeader
|
|
47
|
-
customProperty.label
|
|
48
|
-
);
|
|
39
|
+
return kintIntl.formatKintMessage({
|
|
40
|
+
id: 'customProperty.primaryPropertyHeader',
|
|
41
|
+
overrideValue: labelOverrides.primaryPropertyHeader,
|
|
42
|
+
fallbackMessage: customProperty.label
|
|
43
|
+
}, { number: internalPropertyCounter, name: customProperty.value });
|
|
49
44
|
};
|
|
50
45
|
|
|
51
|
-
const getTooltipText = () =>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
labelOverrides.remove ??
|
|
59
|
-
<FormattedMessage
|
|
60
|
-
id="stripes-kint-components.customProperty.remove"
|
|
61
|
-
values={{ number: internalPropertyCounter }}
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
46
|
+
const getTooltipText = () => (
|
|
47
|
+
kintIntl.formatKintMessage({
|
|
48
|
+
id: 'customProperty.remove',
|
|
49
|
+
overrideValue: labelOverrides.remove
|
|
50
|
+
}, { number: internalPropertyCounter, name: customProperty.value })
|
|
51
|
+
);
|
|
65
52
|
|
|
66
53
|
return (
|
|
67
54
|
<Card
|
|
@@ -103,6 +90,8 @@ const CustomPropertyFormCard = ({
|
|
|
103
90
|
customProperties,
|
|
104
91
|
index,
|
|
105
92
|
internalPropertyCounter,
|
|
93
|
+
intlKey: passedIntlKey,
|
|
94
|
+
intlNS: passedIntlNS,
|
|
106
95
|
labelOverrides,
|
|
107
96
|
name,
|
|
108
97
|
onChange,
|
|
@@ -122,6 +111,8 @@ CustomPropertyFormCard.propTypes = {
|
|
|
122
111
|
handleDeleteCustomProperty: PropTypes.func,
|
|
123
112
|
index: PropTypes.number,
|
|
124
113
|
internalPropertyCounter: PropTypes.number,
|
|
114
|
+
intlKey: PropTypes.string,
|
|
115
|
+
intlNS: PropTypes.string,
|
|
125
116
|
labelOverrides: PropTypes.object,
|
|
126
117
|
name: PropTypes.string,
|
|
127
118
|
onChange: PropTypes.func,
|
|
@@ -1,42 +1,35 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@folio/stripes-erm-components/test/jest/__mock__';
|
|
3
|
-
import { StaticRouter as Router } from 'react-router-dom';
|
|
4
3
|
|
|
5
|
-
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
availableCustomProperties,
|
|
9
|
-
customProperties,
|
|
10
|
-
customProperty,
|
|
11
|
-
labelOverrides,
|
|
12
|
-
cardFormValue
|
|
13
|
-
} from './testResources';
|
|
14
4
|
import CustomPropertyFormCard from './CustomPropertyFormCard';
|
|
15
5
|
|
|
6
|
+
import customProperties, { availableCustomProperties } from '../../../../test/jest/customProperties';
|
|
7
|
+
import { renderWithKintHarness } from '../../../../test/jest';
|
|
8
|
+
|
|
9
|
+
jest.mock('../../hooks');
|
|
16
10
|
jest.mock('./CustomPropertyField', () => () => <div>CustomPropertyField</div>);
|
|
17
11
|
|
|
18
|
-
const
|
|
19
|
-
|
|
12
|
+
const customProperty = availableCustomProperties?.find(cp => cp.value === 'AuthorIdentification');
|
|
13
|
+
|
|
14
|
+
const onChange = jest.fn();
|
|
15
|
+
const setCustomProperties = jest.fn();
|
|
20
16
|
|
|
21
17
|
describe('CustomPropertyFormCard', () => {
|
|
22
18
|
let renderComponent;
|
|
23
19
|
beforeEach(() => {
|
|
24
20
|
renderComponent = renderWithKintHarness(
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
value={cardFormValue}
|
|
38
|
-
/>
|
|
39
|
-
</Router>
|
|
21
|
+
<CustomPropertyFormCard
|
|
22
|
+
availableCustomProperties={availableCustomProperties}
|
|
23
|
+
customProperties={customProperties}
|
|
24
|
+
customProperty={customProperty}
|
|
25
|
+
customPropertyType="primary"
|
|
26
|
+
index={0}
|
|
27
|
+
internalPropertyCounter={1}
|
|
28
|
+
name="customProperties"
|
|
29
|
+
onChange={onChange}
|
|
30
|
+
setCustomProperties={setCustomProperties}
|
|
31
|
+
value={{}}
|
|
32
|
+
/>
|
|
40
33
|
);
|
|
41
34
|
});
|
|
42
35
|
|