@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
package/src/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Useful hooks
|
|
2
2
|
export {
|
|
3
3
|
useActiveElement,
|
|
4
|
-
useAvailableCustomProperties,
|
|
5
4
|
useCustomProperties,
|
|
6
5
|
useHelperApp,
|
|
7
6
|
useInvalidateRefdata,
|
|
@@ -14,7 +13,10 @@ export {
|
|
|
14
13
|
useRefdata,
|
|
15
14
|
useTemplates,
|
|
16
15
|
useSettings,
|
|
17
|
-
useAppSettings
|
|
16
|
+
useAppSettings,
|
|
17
|
+
useIntlKeyStore,
|
|
18
|
+
useKintIntl,
|
|
19
|
+
useIntlKey
|
|
18
20
|
} from './lib/hooks';
|
|
19
21
|
|
|
20
22
|
// Useful utility functions
|
|
@@ -32,13 +34,16 @@ export {
|
|
|
32
34
|
parseErrorResponse,
|
|
33
35
|
} from './lib/utils';
|
|
34
36
|
|
|
35
|
-
// Validators
|
|
37
|
+
// Validators
|
|
36
38
|
export {
|
|
37
39
|
composeValidators,
|
|
40
|
+
composeValidatorsWithArgs,
|
|
38
41
|
invalidNumber,
|
|
42
|
+
rangeOverflow,
|
|
43
|
+
rangeUnderflow,
|
|
39
44
|
required,
|
|
40
45
|
requiredObject,
|
|
41
|
-
} from './lib/utils
|
|
46
|
+
} from './lib/utils';
|
|
42
47
|
|
|
43
48
|
// Contexts
|
|
44
49
|
export {
|
|
@@ -127,3 +132,5 @@ export * as customPropertyContants from './lib/constants/customProperties';
|
|
|
127
132
|
export { default as CycleButton } from './lib/CycleButton';
|
|
128
133
|
export { default as IconSelect } from './lib/IconSelect';
|
|
129
134
|
export { default as RichSelect, useSelectedOption } from './lib/RichSelect';
|
|
135
|
+
|
|
136
|
+
export { default as FormattedKintMessage } from './lib/FormattedKintMessage';
|
|
@@ -9,7 +9,6 @@ import ActionListFieldArray from './ActionListFieldArray';
|
|
|
9
9
|
|
|
10
10
|
const propTypes = {
|
|
11
11
|
actionAssigner: PropTypes.func,
|
|
12
|
-
actionCalls: PropTypes.object,
|
|
13
12
|
columnMapping: PropTypes.object,
|
|
14
13
|
contentData: PropTypes.arrayOf(PropTypes.object),
|
|
15
14
|
creatableFields: PropTypes.object,
|
|
@@ -18,17 +17,19 @@ const propTypes = {
|
|
|
18
17
|
editableFields: PropTypes.object,
|
|
19
18
|
fieldComponents: PropTypes.object,
|
|
20
19
|
hideCreateButton: PropTypes.bool,
|
|
20
|
+
intlKey: PropTypes.string,
|
|
21
|
+
intlNS: PropTypes.string,
|
|
21
22
|
label: PropTypes.oneOfType([
|
|
22
23
|
PropTypes.string,
|
|
23
24
|
PropTypes.node
|
|
24
25
|
]),
|
|
26
|
+
labelOverrides: PropTypes.object,
|
|
25
27
|
validateFields: PropTypes.object,
|
|
26
28
|
visibleFields: PropTypes.arrayOf(PropTypes.string)
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
const ActionList = forwardRef(({
|
|
30
32
|
actionAssigner,
|
|
31
|
-
actionCalls = {}, // DEPRECATED
|
|
32
33
|
columnMapping,
|
|
33
34
|
contentData,
|
|
34
35
|
creatableFields = {},
|
|
@@ -37,7 +38,10 @@ const ActionList = forwardRef(({
|
|
|
37
38
|
editableFields = {},
|
|
38
39
|
fieldComponents = {},
|
|
39
40
|
hideCreateButton,
|
|
41
|
+
intlKey: passedIntlKey,
|
|
42
|
+
intlNS: passedIntlNS,
|
|
40
43
|
label,
|
|
44
|
+
labelOverrides = {},
|
|
41
45
|
validateFields,
|
|
42
46
|
visibleFields,
|
|
43
47
|
...mclProps // Assume anything left over is to directly apply to the MCL
|
|
@@ -59,7 +63,6 @@ const ActionList = forwardRef(({
|
|
|
59
63
|
<form onSubmit={e => { e.preventDefault(); }}>
|
|
60
64
|
<FieldArray
|
|
61
65
|
actionAssigner={actionAssigner}
|
|
62
|
-
actionCalls={actionCalls}
|
|
63
66
|
columnMapping={columnMapping}
|
|
64
67
|
component={ActionListFieldArrayWithRef}
|
|
65
68
|
creatableFields={creatableFields}
|
|
@@ -68,7 +71,10 @@ const ActionList = forwardRef(({
|
|
|
68
71
|
editableFields={editableFields}
|
|
69
72
|
fieldComponents={fieldComponents}
|
|
70
73
|
hideCreateButton={hideCreateButton}
|
|
74
|
+
intlKey={passedIntlKey}
|
|
75
|
+
intlNS={passedIntlNS}
|
|
71
76
|
label={label}
|
|
77
|
+
labelOverrides={labelOverrides}
|
|
72
78
|
name="contentData"
|
|
73
79
|
triggerFormSubmit={handleSubmit}
|
|
74
80
|
validateFields={validateFields}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React, { forwardRef, useImperativeHandle, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import get from 'lodash/get';
|
|
5
5
|
import cloneDeep from 'lodash/cloneDeep';
|
|
6
6
|
|
|
7
7
|
import { Field, useForm, useFormState } from 'react-final-form';
|
|
8
|
-
import { Button, Headline, IconButton, MultiColumnList, TextField } from '@folio/stripes/components';
|
|
8
|
+
import { Button, Headline, IconButton, MultiColumnList, TextField, Tooltip } from '@folio/stripes/components';
|
|
9
|
+
import { useKintIntl } from '../hooks';
|
|
10
|
+
|
|
9
11
|
import css from '../../../styles/ActionListFieldArray.css';
|
|
10
12
|
|
|
11
13
|
const EDITING_ACTIONS_WIDTH = 25;
|
|
@@ -14,7 +16,6 @@ const TOTAL_WIDTH = 100;
|
|
|
14
16
|
|
|
15
17
|
const propTypes = {
|
|
16
18
|
actionAssigner: PropTypes.func,
|
|
17
|
-
actionCalls: PropTypes.object,
|
|
18
19
|
columnMapping: PropTypes.object,
|
|
19
20
|
creatableFields: PropTypes.object,
|
|
20
21
|
createCallback: PropTypes.func,
|
|
@@ -24,18 +25,52 @@ const propTypes = {
|
|
|
24
25
|
fieldComponents: PropTypes.object,
|
|
25
26
|
formatter: PropTypes.object,
|
|
26
27
|
hideCreateButton: PropTypes.bool,
|
|
28
|
+
intlKey: PropTypes.string,
|
|
29
|
+
intlNS: PropTypes.string,
|
|
27
30
|
label: PropTypes.oneOfType([
|
|
28
31
|
PropTypes.string,
|
|
29
32
|
PropTypes.node
|
|
30
33
|
]),
|
|
34
|
+
labelOverrides: PropTypes.object,
|
|
35
|
+
onRowClick: PropTypes.func,
|
|
31
36
|
triggerFormSubmit: PropTypes.func.isRequired,
|
|
32
37
|
validateFields: PropTypes.object,
|
|
33
38
|
visibleFields: PropTypes.arrayOf(PropTypes.string)
|
|
34
39
|
};
|
|
35
40
|
|
|
41
|
+
// This needs to be outside of the main component for forwardRef to work properly it seems.
|
|
42
|
+
const ActionTrigger = forwardRef(({ action, ...actionTriggerProps }, ref) => {
|
|
43
|
+
if (action.icon) {
|
|
44
|
+
return (
|
|
45
|
+
<IconButton
|
|
46
|
+
ref={ref}
|
|
47
|
+
icon={action.icon}
|
|
48
|
+
{...actionTriggerProps}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Button
|
|
55
|
+
ref={ref}
|
|
56
|
+
marginBottom0
|
|
57
|
+
{...actionTriggerProps}
|
|
58
|
+
>
|
|
59
|
+
{action.label ?? action.name}
|
|
60
|
+
</Button>
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
ActionTrigger.propTypes = {
|
|
65
|
+
action: PropTypes.shape({
|
|
66
|
+
icon: PropTypes.string,
|
|
67
|
+
label: PropTypes.string,
|
|
68
|
+
name: PropTypes.string
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
|
|
36
72
|
const ActionListFieldArray = forwardRef(({
|
|
37
73
|
actionAssigner,
|
|
38
|
-
actionCalls, // DEPRECATED
|
|
39
74
|
columnMapping,
|
|
40
75
|
creatableFields,
|
|
41
76
|
createCallback,
|
|
@@ -44,7 +79,11 @@ const ActionListFieldArray = forwardRef(({
|
|
|
44
79
|
fields,
|
|
45
80
|
fieldComponents,
|
|
46
81
|
hideCreateButton = false,
|
|
82
|
+
intlKey: passedIntlKey,
|
|
83
|
+
intlNS: passedIntlNS,
|
|
47
84
|
label,
|
|
85
|
+
labelOverrides = {},
|
|
86
|
+
onRowClick,
|
|
48
87
|
validateFields,
|
|
49
88
|
visibleFields,
|
|
50
89
|
triggerFormSubmit,
|
|
@@ -53,7 +92,7 @@ const ActionListFieldArray = forwardRef(({
|
|
|
53
92
|
// Grab finalForm functions/values from form hooks
|
|
54
93
|
const { change } = useForm();
|
|
55
94
|
const { hasValidationErrors, initialValues, pristine, submitting, values } = useFormState();
|
|
56
|
-
|
|
95
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
57
96
|
/*
|
|
58
97
|
Keep track of which field we are editing.
|
|
59
98
|
null for no field, string id if we are editing an existing field and
|
|
@@ -81,8 +120,6 @@ const ActionListFieldArray = forwardRef(({
|
|
|
81
120
|
const editCallback = actionAssigner(rowData)?.find(act => act.name === 'edit')?.callback;
|
|
82
121
|
if (editCallback) {
|
|
83
122
|
editCallback(rowData);
|
|
84
|
-
} else {
|
|
85
|
-
actionCalls.edit(rowData); // DEPRECATED
|
|
86
123
|
}
|
|
87
124
|
};
|
|
88
125
|
|
|
@@ -96,8 +133,6 @@ const ActionListFieldArray = forwardRef(({
|
|
|
96
133
|
|
|
97
134
|
if (createCallback) {
|
|
98
135
|
createCallback(rowData);
|
|
99
|
-
} else {
|
|
100
|
-
actionCalls.create(rowData); // DEPRECATED
|
|
101
136
|
}
|
|
102
137
|
};
|
|
103
138
|
|
|
@@ -139,7 +174,7 @@ const ActionListFieldArray = forwardRef(({
|
|
|
139
174
|
if (data.id === editing || (!data.id && editing === 'NEW_ROW')) {
|
|
140
175
|
// Render the save/cancel buttons
|
|
141
176
|
return (
|
|
142
|
-
<div>
|
|
177
|
+
<div id="action-button-parent">
|
|
143
178
|
<Button
|
|
144
179
|
key={`save[${data.rowIndex}]`}
|
|
145
180
|
buttonStyle="primary"
|
|
@@ -159,7 +194,10 @@ const ActionListFieldArray = forwardRef(({
|
|
|
159
194
|
}}
|
|
160
195
|
type="submit"
|
|
161
196
|
>
|
|
162
|
-
|
|
197
|
+
{kintIntl.formatKintMessage({
|
|
198
|
+
id: 'save',
|
|
199
|
+
overrideValue: labelOverrides?.save
|
|
200
|
+
})}
|
|
163
201
|
</Button>
|
|
164
202
|
<Button
|
|
165
203
|
key={`cancel[${data.rowIndex}]`}
|
|
@@ -175,24 +213,23 @@ const ActionListFieldArray = forwardRef(({
|
|
|
175
213
|
}
|
|
176
214
|
}}
|
|
177
215
|
>
|
|
178
|
-
|
|
216
|
+
{kintIntl.formatKintMessage({
|
|
217
|
+
id: 'cancel',
|
|
218
|
+
overrideValue: labelOverrides?.cancel
|
|
219
|
+
})}
|
|
179
220
|
</Button>
|
|
180
221
|
</div>
|
|
181
222
|
);
|
|
182
223
|
}
|
|
183
224
|
|
|
184
225
|
return (
|
|
185
|
-
<div>
|
|
226
|
+
<div id="action-button-parent">
|
|
186
227
|
{actions?.map(action => {
|
|
187
228
|
let actionFunction;
|
|
188
229
|
if (action.callback) {
|
|
189
230
|
actionFunction = () => action.callback(rest);
|
|
190
231
|
}
|
|
191
232
|
|
|
192
|
-
if (!actionFunction && actionCalls[action.name]) {
|
|
193
|
-
actionFunction = () => actionCalls[action.name](rest); // DEPRECATED
|
|
194
|
-
}
|
|
195
|
-
|
|
196
233
|
// Edit has special action functionality, revealing fields etc.
|
|
197
234
|
if (action.name === 'edit') {
|
|
198
235
|
actionFunction = () => toggleEditing(data.id);
|
|
@@ -209,32 +246,58 @@ const ActionListFieldArray = forwardRef(({
|
|
|
209
246
|
}
|
|
210
247
|
}
|
|
211
248
|
|
|
212
|
-
|
|
213
|
-
|
|
249
|
+
let tooltip;
|
|
250
|
+
let tooltipSub;
|
|
251
|
+
if (action?.tooltip) {
|
|
252
|
+
if (typeof action.tooltip === 'function') {
|
|
253
|
+
tooltip = action.tooltip(data);
|
|
254
|
+
} else {
|
|
255
|
+
tooltip = action.tooltip;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (action?.tooltipSub) {
|
|
259
|
+
if (typeof action.tooltipSub === 'function') {
|
|
260
|
+
tooltipSub = action.tooltipSub(data);
|
|
261
|
+
} else {
|
|
262
|
+
tooltipSub = action.tooltipSub;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// If a tooltip is declared, render that around the actionButton
|
|
268
|
+
if (tooltip) {
|
|
214
269
|
return (
|
|
215
|
-
<
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
270
|
+
<Tooltip
|
|
271
|
+
id={`action-${action.name}[${data.rowIndex}]-tooltip`}
|
|
272
|
+
sub={tooltipSub}
|
|
273
|
+
text={tooltip}
|
|
274
|
+
>
|
|
275
|
+
{({ ref: actionTriggerRef, ariaIds }) => (
|
|
276
|
+
<ActionTrigger
|
|
277
|
+
key={`action-${action.name}[${data.rowIndex}]`}
|
|
278
|
+
ref={actionTriggerRef}
|
|
279
|
+
action={action}
|
|
280
|
+
aria-describedby={ariaIds.sub}
|
|
281
|
+
aria-labelledby={ariaIds.text}
|
|
282
|
+
disabled={editing}
|
|
283
|
+
onClick={() => (actionFunction ? actionFunction() : () => null)}
|
|
284
|
+
to={action.to}
|
|
285
|
+
/>
|
|
286
|
+
)}
|
|
287
|
+
</Tooltip>
|
|
223
288
|
);
|
|
224
289
|
}
|
|
225
290
|
|
|
226
|
-
//
|
|
291
|
+
// Finally, render the action button itself
|
|
227
292
|
return (
|
|
228
|
-
<
|
|
293
|
+
<ActionTrigger
|
|
229
294
|
key={`action-${action.name}[${data.rowIndex}]`}
|
|
295
|
+
action={action}
|
|
230
296
|
ariaLabel={ariaLabel}
|
|
231
297
|
disabled={editing}
|
|
232
|
-
marginBottom0
|
|
233
298
|
onClick={() => (actionFunction ? actionFunction() : () => null)}
|
|
234
299
|
to={action.to}
|
|
235
|
-
|
|
236
|
-
{action.label ?? action.name}
|
|
237
|
-
</Button>
|
|
300
|
+
/>
|
|
238
301
|
);
|
|
239
302
|
})}
|
|
240
303
|
</div>
|
|
@@ -323,18 +386,24 @@ const ActionListFieldArray = forwardRef(({
|
|
|
323
386
|
</Headline>
|
|
324
387
|
{!hideCreateButton &&
|
|
325
388
|
<Button
|
|
326
|
-
disabled={editing ||
|
|
389
|
+
disabled={editing || !createCallback}
|
|
327
390
|
marginBottom0
|
|
328
391
|
onClick={handleClickCreate}
|
|
329
392
|
>
|
|
330
|
-
|
|
393
|
+
{kintIntl.formatKintMessage({
|
|
394
|
+
id: 'new',
|
|
395
|
+
overrideValue: labelOverrides?.new
|
|
396
|
+
})}
|
|
331
397
|
</Button>
|
|
332
398
|
}
|
|
333
399
|
</div>
|
|
334
400
|
<MultiColumnList
|
|
335
401
|
columnMapping={{
|
|
336
402
|
...columnMapping,
|
|
337
|
-
actionListActions:
|
|
403
|
+
actionListActions: kintIntl.formatKintMessage({
|
|
404
|
+
id: 'actions',
|
|
405
|
+
overrideValue: labelOverrides?.actions
|
|
406
|
+
})
|
|
338
407
|
}}
|
|
339
408
|
columnWidths={getColumnWidths()}
|
|
340
409
|
contentData={assignActions()}
|
|
@@ -342,7 +411,16 @@ const ActionListFieldArray = forwardRef(({
|
|
|
342
411
|
actionListActions: renderActionButtons,
|
|
343
412
|
...fieldAwareFormatter()
|
|
344
413
|
}}
|
|
345
|
-
interactive={
|
|
414
|
+
interactive={!!onRowClick}
|
|
415
|
+
onRowClick={onRowClick ? (e, row) => {
|
|
416
|
+
// Make sure we ONLY fire row click from row, and not from action buttons.
|
|
417
|
+
const targetIsAction = e.target.closest('[id^=action-button-parent]') !== null;
|
|
418
|
+
|
|
419
|
+
if (!targetIsAction) {
|
|
420
|
+
const { actionListActions: _ala, ...rowWithoutActions } = row;
|
|
421
|
+
onRowClick(e, rowWithoutActions);
|
|
422
|
+
}
|
|
423
|
+
} : null}
|
|
346
424
|
visibleColumns={[...visibleFields, 'actionListActions']}
|
|
347
425
|
{...restOfMclProps}
|
|
348
426
|
/>
|
|
@@ -91,7 +91,7 @@ const myRef = useRef();
|
|
|
91
91
|
|
|
92
92
|
Name | Type | Description | default | required
|
|
93
93
|
--- | --- | --- | --- | ---
|
|
94
|
-
actionAssigner | function | A function which will be passed the entire row object, and can use that to assign an array of actions valid for that row, in the form `{ name: 'actionName', label: "Action Label", icon: 'someIcon', callback: () => null, to: toObject, ariaLabel: () => null }`. The
|
|
94
|
+
actionAssigner | function | A function which will be passed the entire row object, and can use that to assign an array of actions valid for that row, in the form `{ name: 'actionName', label: "Action Label", icon: 'someIcon', callback: () => null, to: toObject, ariaLabel: () => null, tooltip: 'tooltip', tooltipSub: 'tooltipSub' }`. The props `name` and `callback` are required, but `label`, `icon`, `to` and `tooltip`/`tooltipSub` are optional props. The `callback` prop will be prioritised ahead of the deprecated actionCalls prop. The `ariaLabel` prop, which can be either a static string or a function accepting the row data and returning a string, will give the associated icon button an aria-label. If a `to` prop is passed, then the resulting button will be rendered as a \<Link/> element, as per Stripes Button/IconButton. If a `tooltip` prop is passed, the actionButton will be rendered with a surrounding Stripes Tooltip, with text `tooltip` and sub `tooltipSub`. | | ✓ |
|
|
95
95
|
actionCalls (DEPRECATED) | object\<function> | An object with keys matching any "actions" the `actionAssigner` may have assigned (In addition to special case `create`, if relevant), and values which are functions. These functions will be handed the row as a parameter. THESE CAN NOW BE PASSED AS "callback" in the actionAssigner. | {} | ✕ |
|
|
96
96
|
columnMapping | object | An object which will act on the rendered MultiColumnList headers to map the labels for each `visibleField` | | ✕ |
|
|
97
97
|
contentData | array | An array of objects to render along with their actions | | ✓ |
|
|
@@ -102,6 +102,7 @@ editableFields | object\<function> | An object with keys from the `visibleFields
|
|
|
102
102
|
fieldComponents | object\<function> | An object with keys from the `visibleFields` array, and values of functions which take some `fieldProps` (currently only the name of the field `name`), and returns a Field component to be used in "edit mode" for the visible field specified. | | ✕ |
|
|
103
103
|
formatter | object\<function> | A "formatter" object that takes the same shape as an MCL formatter, and is used in the same way whilst a row is NOT being edited. While editing a given row, this formatter entry is ignored. | | ✕ |
|
|
104
104
|
hideCreateButton | boolean | A simple bool to hide the create button. Default behaviour without create action is disabled. | false | ✕ |
|
|
105
|
+
onRowClick | function | A function accepting an event and the row data, fired on row click. The presence of this prop will cause the MCL to take on the interactive styling | | ✕ |
|
|
105
106
|
validateFields | object\<function> | An object with keys from the `visibleFields` array, and values of functions which take the entire row object and either return a validate function for final-form, or null | | ✕ |
|
|
106
107
|
visibleFields | array\<String> | An array of strings corresponding to those fields to be displayed in the rendered MultiColumnList | | ✓ |
|
|
107
108
|
...mclProps | any | Any other props supplied to ActionList will be applied to the MCL directly. *WARNING* Some MCL props may override important functionality within ActionList | | ✕ |
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
import { FormattedMessage } from 'react-intl';
|
|
5
|
-
|
|
6
4
|
import { Col, MultiColumnList, Row, Spinner, Select, Button } from '@folio/stripes/components';
|
|
7
5
|
|
|
8
6
|
import { Form } from 'react-final-form';
|
|
9
7
|
import SearchField from '../../SearchField';
|
|
10
|
-
import { useCustomProperties } from '../../hooks';
|
|
8
|
+
import { useCustomProperties, useKintIntl } from '../../hooks';
|
|
11
9
|
|
|
12
10
|
import css from '../../../../styles/CustomProperties.css';
|
|
13
11
|
|
|
14
12
|
const CustomPropertiesLookup = ({
|
|
15
13
|
contextFilterOptions, // expects an array of the form [{value: "OpenAccess", label: "Open Access"}, {value: false, label: "None"}]
|
|
16
14
|
customPropertiesEndpoint: endpoint,
|
|
15
|
+
intlKey: passedIntlKey,
|
|
16
|
+
intlNS: passedIntlNS,
|
|
17
17
|
labelOverrides = {},
|
|
18
18
|
mclProps,
|
|
19
19
|
onSelectCustomProperty,
|
|
@@ -50,6 +50,8 @@ const CustomPropertiesLookup = ({
|
|
|
50
50
|
};
|
|
51
51
|
const [searchTerm, setSearchTerm] = useState('');
|
|
52
52
|
|
|
53
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
54
|
+
|
|
53
55
|
return (
|
|
54
56
|
<>
|
|
55
57
|
<Form
|
|
@@ -63,7 +65,13 @@ const CustomPropertiesLookup = ({
|
|
|
63
65
|
onSubmit={handleSubmit}
|
|
64
66
|
>
|
|
65
67
|
<SearchField
|
|
66
|
-
ariaLabel={
|
|
68
|
+
ariaLabel={
|
|
69
|
+
kintIntl.formatKintMessage({
|
|
70
|
+
id: 'customProperties.config.searchAriaLabel',
|
|
71
|
+
overrideValue: labelOverrides.searchAriaLabel,
|
|
72
|
+
fallbackMessage: 'custom-property-search-field'
|
|
73
|
+
})
|
|
74
|
+
}
|
|
67
75
|
className={css.lookupSearch}
|
|
68
76
|
marginBottom0
|
|
69
77
|
onChange={e => setSearchTerm(e.target.value)}
|
|
@@ -75,7 +83,10 @@ const CustomPropertiesLookup = ({
|
|
|
75
83
|
marginBottom0
|
|
76
84
|
type="submit"
|
|
77
85
|
>
|
|
78
|
-
|
|
86
|
+
{kintIntl.formatKintMessage({
|
|
87
|
+
id: 'search',
|
|
88
|
+
overrideValue: labelOverrides.search
|
|
89
|
+
})}
|
|
79
90
|
</Button>
|
|
80
91
|
</form>
|
|
81
92
|
)}
|
|
@@ -84,7 +95,12 @@ const CustomPropertiesLookup = ({
|
|
|
84
95
|
<Col xs={6}>
|
|
85
96
|
<Select
|
|
86
97
|
dataOptions={contextFilterOptions}
|
|
87
|
-
label={
|
|
98
|
+
label={
|
|
99
|
+
kintIntl.formatKintMessage({
|
|
100
|
+
id: 'customProperties.ctx',
|
|
101
|
+
overrideValue: labelOverrides.ctx
|
|
102
|
+
})
|
|
103
|
+
}
|
|
88
104
|
onChange={(e) => {
|
|
89
105
|
setSelectedContext(e.target.value);
|
|
90
106
|
}}
|
|
@@ -96,29 +112,55 @@ const CustomPropertiesLookup = ({
|
|
|
96
112
|
<Spinner /> :
|
|
97
113
|
<MultiColumnList
|
|
98
114
|
columnMapping={{
|
|
99
|
-
'label':
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
'
|
|
104
|
-
|
|
115
|
+
'label': kintIntl.formatKintMessage({
|
|
116
|
+
id: 'customProperties.label',
|
|
117
|
+
overrideValue: labelOverrides.label
|
|
118
|
+
}),
|
|
119
|
+
'primary': kintIntl.formatKintMessage({
|
|
120
|
+
id: 'customProperties.primary',
|
|
121
|
+
overrideValue: labelOverrides.primary
|
|
122
|
+
}),
|
|
123
|
+
'ctx': kintIntl.formatKintMessage({
|
|
124
|
+
id: 'customProperties.ctx',
|
|
125
|
+
overrideValue: labelOverrides.ctx
|
|
126
|
+
}),
|
|
127
|
+
'weight': kintIntl.formatKintMessage({
|
|
128
|
+
id: 'customProperties.weight',
|
|
129
|
+
overrideValue: labelOverrides.weight
|
|
130
|
+
}),
|
|
131
|
+
'type': kintIntl.formatKintMessage({
|
|
132
|
+
id: 'customProperties.type',
|
|
133
|
+
overrideValue: labelOverrides.type
|
|
134
|
+
}),
|
|
135
|
+
'category': kintIntl.formatKintMessage({
|
|
136
|
+
id: 'customProperties.category',
|
|
137
|
+
overrideValue: labelOverrides.category
|
|
138
|
+
}),
|
|
105
139
|
}}
|
|
106
140
|
contentData={custprops}
|
|
107
141
|
formatter={{
|
|
108
142
|
primary: data => {
|
|
109
143
|
if (data?.primary) {
|
|
110
144
|
return (
|
|
111
|
-
|
|
145
|
+
kintIntl.formatKintMessage({
|
|
146
|
+
id: 'yes',
|
|
147
|
+
overrideValue: labelOverrides.yes
|
|
148
|
+
})
|
|
112
149
|
);
|
|
113
150
|
} else {
|
|
114
151
|
return (
|
|
115
|
-
|
|
152
|
+
kintIntl.formatKintMessage({
|
|
153
|
+
id: 'no',
|
|
154
|
+
overrideValue: labelOverrides.no
|
|
155
|
+
})
|
|
116
156
|
);
|
|
117
157
|
}
|
|
118
158
|
},
|
|
119
159
|
type: data => (
|
|
120
|
-
|
|
121
|
-
|
|
160
|
+
kintIntl.formatKintMessage({
|
|
161
|
+
id: `customProperties.type.${data?.type}`,
|
|
162
|
+
overrideValue: labelOverrides?.[data?.type]
|
|
163
|
+
})
|
|
122
164
|
),
|
|
123
165
|
category: data => data?.category?.desc
|
|
124
166
|
}}
|
|
@@ -140,6 +182,8 @@ CustomPropertiesLookup.propTypes = {
|
|
|
140
182
|
])
|
|
141
183
|
})),
|
|
142
184
|
customPropertiesEndpoint: PropTypes.string,
|
|
185
|
+
intlKey: PropTypes.string,
|
|
186
|
+
intlNS: PropTypes.string,
|
|
143
187
|
labelOverrides: PropTypes.object,
|
|
144
188
|
mclProps: PropTypes.object,
|
|
145
189
|
onSelectCustomProperty: PropTypes.func,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@folio/stripes-erm-components/test/jest/__mock__';
|
|
3
3
|
import { MemoryRouter } from 'react-router-dom';
|
|
4
|
-
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
5
4
|
|
|
6
|
-
import { custPropLookup } from './testResources';
|
|
7
5
|
import CustomPropertiesLookup from './CustomPropertiesLookup';
|
|
6
|
+
import renderWithKintHarness from '../../../../test/jest/helpers/renderWithKintHarness';
|
|
8
7
|
|
|
8
|
+
jest.mock('../../hooks');
|
|
9
9
|
jest.mock('../../SearchField', () => () => <div>SearchField</div>);
|
|
10
10
|
|
|
11
11
|
describe('CustomPropertiesLookup', () => {
|
|
@@ -14,7 +14,18 @@ describe('CustomPropertiesLookup', () => {
|
|
|
14
14
|
renderComponent = renderWithKintHarness(
|
|
15
15
|
<MemoryRouter>
|
|
16
16
|
<CustomPropertiesLookup
|
|
17
|
-
{
|
|
17
|
+
contextFilterOptions={[
|
|
18
|
+
{
|
|
19
|
+
'value': '',
|
|
20
|
+
'label': 'All'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
'value': 'isNull',
|
|
24
|
+
'label': 'None'
|
|
25
|
+
}
|
|
26
|
+
]}
|
|
27
|
+
customPropertiesEndpoint="erm/custprops"
|
|
28
|
+
onSelectCustomProperty={() => ({})}
|
|
18
29
|
visibleColumns={['label', 'primary', 'ctx', 'weight', 'type', 'category']}
|
|
19
30
|
/>
|
|
20
31
|
</MemoryRouter>
|
|
@@ -24,7 +35,6 @@ describe('CustomPropertiesLookup', () => {
|
|
|
24
35
|
it('renders expected options', () => {
|
|
25
36
|
const { getByText } = renderComponent;
|
|
26
37
|
expect(getByText('All')).toBeInTheDocument();
|
|
27
|
-
expect(getByText('OpenAccess')).toBeInTheDocument();
|
|
28
38
|
expect(getByText('None')).toBeInTheDocument();
|
|
29
39
|
});
|
|
30
40
|
|