@k-int/stripes-kint-components 4.5.1 → 4.6.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 +8 -1
- package/README.md +14 -0
- package/es/__mocks__/@folio/stripes/components.js +10 -21
- package/es/__mocks__/@folio/stripes/core.js +4 -7
- package/es/__mocks__/@folio/stripes/smart-components.js +4 -7
- package/es/__mocks__/react-query.js +4 -7
- package/es/__mocks__/react-router-dom.js +6 -7
- package/es/artifacts/coverage-jest/lcov-report/prettify.js +2 -2
- package/es/artifacts/coverage-jest/lcov-report/sorter.js +6 -6
- package/es/index.js +62 -49
- package/es/lib/ActionList/ActionList.js +38 -51
- package/es/lib/ActionList/ActionListFieldArray.js +143 -167
- package/es/lib/ActionList/index.js +1 -1
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +57 -77
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +15 -19
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +111 -160
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +30 -67
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +36 -48
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +83 -121
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +9 -8
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +48 -135
- package/es/lib/CustomProperties/Config/index.js +4 -4
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +19 -21
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +11 -16
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +29 -27
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +11 -16
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +86 -103
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +26 -63
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +123 -115
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +95 -176
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +43 -44
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +23 -27
- package/es/lib/CustomProperties/Edit/index.js +5 -5
- package/es/lib/CustomProperties/Edit/testResources.js +13 -35
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +60 -81
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +23 -57
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +39 -54
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +17 -16
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +27 -23
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +18 -45
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +18 -20
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +23 -52
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +37 -41
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.test.js +77 -225
- package/es/lib/CustomProperties/Filter/index.js +6 -6
- package/es/lib/CustomProperties/Filter/testResources.js +12 -32
- package/es/lib/CustomProperties/Filter/useOperators.js +17 -16
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +17 -30
- package/es/lib/CustomProperties/Filter/useValueProps.js +22 -27
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +19 -21
- package/es/lib/CustomProperties/View/CustomPropertiesView.test.js +11 -16
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +49 -57
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +14 -23
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +17 -18
- package/es/lib/CustomProperties/View/index.js +3 -3
- package/es/lib/CustomProperties/View/testResources.js +4 -4
- package/es/lib/CustomProperties/index.js +18 -18
- package/es/lib/CycleButton/CycleButton.js +17 -32
- package/es/lib/CycleButton/index.js +1 -1
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +108 -150
- package/es/lib/EditableRefdataCategoryList/index.js +1 -1
- package/es/lib/EditableRefdataList/EditableRefdataList.js +127 -170
- package/es/lib/EditableRefdataList/index.js +1 -1
- package/es/lib/EditableSettingsList/EditableSettingsList.js +16 -13
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +18 -25
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +61 -90
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +21 -34
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +99 -83
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +17 -19
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +187 -275
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +74 -109
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +52 -157
- package/es/lib/EditableSettingsList/SettingField/index.js +3 -3
- package/es/lib/EditableSettingsList/index.js +3 -3
- package/es/lib/FormModal/FormModal.js +43 -46
- package/es/lib/FormModal/index.js +1 -1
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +23 -27
- package/es/lib/FormattedKintMessage/index.js +1 -1
- package/es/lib/IconSelect/IconSelect.js +48 -68
- package/es/lib/IconSelect/index.js +1 -1
- package/es/lib/NoResultsMessage/NoResultsMessage.js +18 -17
- package/es/lib/NoResultsMessage/index.js +1 -1
- package/es/lib/QueryTypedown/QueryTypedown.js +17 -38
- package/es/lib/QueryTypedown/index.js +1 -1
- package/es/lib/RefdataButtons/RefdataButtons.js +26 -29
- package/es/lib/RefdataButtons/index.js +1 -1
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +83 -88
- package/es/lib/ResponsiveButtonGroup/index.js +1 -1
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +27 -40
- package/es/lib/RichSelect/RichSelect.js +70 -86
- package/es/lib/RichSelect/index.js +2 -2
- package/es/lib/RichSelect/useSelectedOption.js +3 -12
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +115 -137
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +39 -45
- package/es/lib/SASQLookupComponent/TableBody/index.js +1 -1
- package/es/lib/SASQLookupComponent/index.js +2 -2
- package/es/lib/SASQRoute/SASQRoute.js +31 -37
- package/es/lib/SASQRoute/index.js +1 -1
- package/es/lib/SASQViewComponent/SASQViewComponent.js +38 -45
- package/es/lib/SASQViewComponent/index.js +1 -1
- package/es/lib/SearchField/SearchField.js +10 -16
- package/es/lib/SearchField/index.js +1 -1
- package/es/lib/SettingPage/SettingPage.js +21 -20
- package/es/lib/SettingPage/SettingPagePane.js +8 -6
- package/es/lib/SettingPage/index.js +2 -2
- package/es/lib/SettingsFormContainer/SettingsFormContainer.js +87 -0
- package/es/lib/SettingsFormContainer/index.js +13 -0
- package/es/lib/Typedown/Typedown.js +61 -79
- package/es/lib/Typedown/index.js +1 -1
- package/es/lib/constants/customProperties.js +11 -11
- package/es/lib/constants/endpoints.js +9 -0
- package/es/lib/constants/eventCodes.js +3 -3
- package/es/lib/contexts/SettingsContext.js +1 -1
- package/es/lib/contexts/index.js +1 -1
- package/es/lib/hooks/__mocks__/index.js +9 -29
- package/es/lib/hooks/index.js +31 -17
- package/es/lib/hooks/typedownHooks/index.js +3 -3
- package/es/lib/hooks/typedownHooks/useTypedown.js +48 -48
- package/es/lib/hooks/typedownHooks/useTypedownData.js +11 -21
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +12 -20
- package/es/lib/hooks/useActiveElement.js +8 -17
- package/es/lib/hooks/useCustomProperties.js +22 -30
- package/es/lib/hooks/useHelperApp.js +30 -49
- package/es/lib/hooks/useIntlKey.js +3 -5
- package/es/lib/hooks/useIntlKeyStore.js +44 -49
- package/es/lib/hooks/useInvalidateRefdata.js +3 -5
- package/es/lib/hooks/useKintIntl.js +28 -31
- package/es/lib/hooks/useKiwtFieldArray.js +34 -45
- package/es/lib/hooks/useKiwtSASQuery.js +38 -48
- package/es/lib/hooks/useLocalStorageState.js +6 -18
- package/es/lib/hooks/useModConfigEntries.js +49 -0
- package/es/lib/hooks/useMutateCustomProperties.js +19 -62
- package/es/lib/hooks/useMutateModConfigEntry.js +40 -0
- package/es/lib/hooks/useMutateRefdataCategory.js +19 -60
- package/es/lib/hooks/useMutateRefdataValue.js +28 -65
- package/es/lib/hooks/useQIndex.js +12 -26
- package/es/lib/hooks/useRefdata.js +17 -19
- package/es/lib/hooks/useSASQQueryMeta.js +13 -20
- package/es/lib/hooks/useTemplates.js +13 -12
- package/es/lib/settingsHooks/index.js +3 -3
- package/es/lib/settingsHooks/useAppSettings.js +18 -25
- package/es/lib/settingsHooks/useSettingSection.js +16 -17
- package/es/lib/settingsHooks/useSettings.js +58 -72
- package/es/lib/utils/buildUrl.js +5 -5
- package/es/lib/utils/generateKiwtQuery.js +3 -3
- package/es/lib/utils/generateKiwtQueryParams.js +85 -93
- package/es/lib/utils/groupCustomPropertiesByCtx.js +8 -18
- package/es/lib/utils/highlightString.js +17 -37
- package/es/lib/utils/index.js +29 -15
- package/es/lib/utils/matchString.js +4 -8
- package/es/lib/utils/modConfigEntriesQueryKey.js +24 -0
- package/es/lib/utils/parseErrorResponse.js +22 -63
- package/es/lib/utils/parseKiwtQueryGroups.js +10 -10
- package/es/lib/utils/parseKiwtQueryGroups.test.js +15 -15
- package/es/lib/utils/parseModConfigEntry.js +21 -0
- package/es/lib/utils/refdataQueryKey.js +2 -2
- package/es/lib/utils/selectorSafe.js +3 -3
- package/es/lib/utils/sortByLabel.js +3 -3
- package/es/lib/utils/toCamelCase.js +7 -12
- package/es/lib/utils/typedownQueryKey.js +2 -2
- package/es/lib/validators/index.js +1 -1
- package/es/lib/validators/validators.js +22 -29
- package/junit.xml +239 -1489
- package/package.json +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +21 -21
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +17 -17
- 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 +44 -44
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesSettings.js.html +53 -53
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +59 -59
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyView.js.html +29 -29
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.html +53 -53
- 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 +19 -19
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +28 -28
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesListField.js.html +94 -94
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyField.js.html +118 -118
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyFormCard.js.html +28 -28
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.html +64 -64
- 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 +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilter.js.html +33 -33
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterField.js.html +47 -47
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +22 -22
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +19 -19
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesRule.js.html +42 -42
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.html +96 -96
- 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 +5 -5
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useOperators.js.html +35 -35
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useParseActiveFilterStrings.js.html +38 -38
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useValueProps.js.html +34 -34
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesView.js.html +16 -16
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesViewCtx.js.html +45 -45
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertyCard.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.html +36 -36
- 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/CycleButton/CycleButton.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +10 -10
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +22 -22
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +39 -39
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +64 -64
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +64 -64
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +43 -43
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +28 -28
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html +32 -32
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.html +21 -21
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/FormattedKintMessage.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/IconSelect.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +54 -54
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +21 -21
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/ResponsiveButtonGroup.js.html +15 -15
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/index.html +17 -17
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/RichSelect.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.html +17 -17
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/useSelectedOption.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/TableBody.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +12 -12
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +13 -13
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +10 -10
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +18 -18
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingsFormContainer/SettingsFormContainer.js.html +337 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingsFormContainer/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingsFormContainer/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html +12 -12
- package/src/artifacts/coverage-jest/lcov-report/constants/endpoints.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +12 -12
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +28 -13
- 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/hooks/index.html +153 -123
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +8 -2
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +23 -23
- 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 +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKey.js.html +24 -24
- package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKeyStore.js.html +21 -21
- package/src/artifacts/coverage-jest/lcov-report/hooks/useInvalidateRefdata.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKintIntl.js.html +38 -38
- 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/useModConfigEntries.js.html +226 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateModConfigEntry.js.html +238 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataCategory.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +7 -7
- 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/useSASQQueryMeta.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/index.html +257 -242
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/index.html +23 -23
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/useAppSettings.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/useSettingSection.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/useSettings.js.html +7 -7
- 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 +4 -4
- package/src/artifacts/coverage-jest/lcov-report/utils/groupCustomPropertiesByCtx.js.html +22 -22
- package/src/artifacts/coverage-jest/lcov-report/utils/highlightString.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +61 -31
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +11 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/matchString.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/modConfigEntriesQueryKey.js.html +142 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/parseErrorResponse.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/parseKiwtQueryGroups.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/parseModConfigEntry.js.html +130 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +1 -1
- 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 +16 -16
- package/src/artifacts/coverage-jest/lcov-report/utils/typedownQueryKey.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/validators/index.html +19 -19
- package/src/artifacts/coverage-jest/lcov-report/validators/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/validators/validators.js.html +32 -32
- package/src/artifacts/coverage-jest/lcov.info +1225 -1067
- package/src/index.js +6 -0
- package/src/lib/SettingsFormContainer/SettingsFormContainer.js +84 -0
- package/src/lib/SettingsFormContainer/index.js +1 -0
- package/src/lib/constants/endpoints.js +2 -0
- package/src/lib/hooks/index.js +2 -0
- package/src/lib/hooks/useModConfigEntries.js +47 -0
- package/src/lib/hooks/useMutateModConfigEntry.js +51 -0
- package/src/lib/utils/index.js +3 -0
- package/src/lib/utils/modConfigEntriesQueryKey.js +19 -0
- package/src/lib/utils/parseModConfigEntry.js +15 -0
- package/test/jest/helpers/KintHarness.js +21 -4
package/src/index.js
CHANGED
|
@@ -92,7 +92,11 @@ export {
|
|
|
92
92
|
useParseActiveFilterStrings
|
|
93
93
|
} from './lib/CustomProperties';
|
|
94
94
|
|
|
95
|
+
// DEPRECATED -- TYPO HERE, EXPORT AS BOTH FOR NOW AND REMOVE BROKEN ONE LATER
|
|
95
96
|
export * as customPropertyContants from './lib/constants/customProperties';
|
|
97
|
+
export * as customPropertyConstants from './lib/constants/customProperties';
|
|
98
|
+
|
|
99
|
+
export * as endpoints from './lib/constants/endpoints';
|
|
96
100
|
|
|
97
101
|
export { default as CycleButton } from './lib/CycleButton';
|
|
98
102
|
export { default as IconSelect } from './lib/IconSelect';
|
|
@@ -101,3 +105,5 @@ export { default as RichSelect, useSelectedOption } from './lib/RichSelect';
|
|
|
101
105
|
export { default as FormattedKintMessage } from './lib/FormattedKintMessage';
|
|
102
106
|
|
|
103
107
|
export { default as ResponsiveButtonGroup } from './lib/ResponsiveButtonGroup';
|
|
108
|
+
|
|
109
|
+
export { default as SettingsFormContainer } from './lib/SettingsFormContainer';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
|
|
3
|
+
import { useModConfigEntries, useMutateModConfigEntry } from '../hooks';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* API is similar to ConfigManager
|
|
7
|
+
*/
|
|
8
|
+
const SettingsFormContainer = ({
|
|
9
|
+
ConfigFormComponent,
|
|
10
|
+
configName,
|
|
11
|
+
getInitialValues: passedGetInitialValues,
|
|
12
|
+
moduleName,
|
|
13
|
+
scope, // We don't use this currently but it's here for future reference
|
|
14
|
+
...rest
|
|
15
|
+
}) => {
|
|
16
|
+
/*
|
|
17
|
+
* It is important to pass a namespaceAppend because the same hook could be rendered
|
|
18
|
+
* on the main App component. This means that in settings
|
|
19
|
+
* (Which is rendered inside App itself, stripes behaviour)
|
|
20
|
+
* the same query namespace would apply to the query in the config form, and also to
|
|
21
|
+
* the App level hook call, resulting in an infinite loop.
|
|
22
|
+
*
|
|
23
|
+
* We avoid this by ensuring all calls from this component have (at least) an extra namespace key item
|
|
24
|
+
*/
|
|
25
|
+
const {
|
|
26
|
+
parsedSettings,
|
|
27
|
+
settings
|
|
28
|
+
} = useModConfigEntries({
|
|
29
|
+
moduleName,
|
|
30
|
+
configName,
|
|
31
|
+
namespaceAppend: ['SettingsFormContainer']
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const { mutateAsync: editSettings } = useMutateModConfigEntry({
|
|
35
|
+
configName,
|
|
36
|
+
moduleName,
|
|
37
|
+
id: settings?.id
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const onSubmit = (values) => {
|
|
41
|
+
const setting = {
|
|
42
|
+
...settings,
|
|
43
|
+
value: JSON.stringify(values),
|
|
44
|
+
...(moduleName ?
|
|
45
|
+
{ module: moduleName, configName } :
|
|
46
|
+
{ scope, key: configName })
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
editSettings(setting);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const getInitialValues = () => {
|
|
53
|
+
let initialValues = parsedSettings;
|
|
54
|
+
if (passedGetInitialValues) {
|
|
55
|
+
initialValues = passedGetInitialValues(parsedSettings, settings);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return initialValues;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div style={{ width: '100%' }}>
|
|
63
|
+
<ConfigFormComponent
|
|
64
|
+
initialValues={getInitialValues()}
|
|
65
|
+
onSubmit={onSubmit}
|
|
66
|
+
{...rest}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
SettingsFormContainer.propTypes = {
|
|
73
|
+
ConfigFormComponent: PropTypes.oneOfType([
|
|
74
|
+
PropTypes.arrayOf(PropTypes.node),
|
|
75
|
+
PropTypes.node,
|
|
76
|
+
PropTypes.func,
|
|
77
|
+
]),
|
|
78
|
+
configName: PropTypes.string.isRequired,
|
|
79
|
+
getInitialValues: PropTypes.func,
|
|
80
|
+
moduleName: PropTypes.string.isRequired,
|
|
81
|
+
scope: PropTypes.string,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default SettingsFormContainer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SettingsFormContainer';
|
package/src/lib/hooks/index.js
CHANGED
|
@@ -15,3 +15,5 @@ export { default as useKintIntl } from './useKintIntl';
|
|
|
15
15
|
export { default as useIntlKeyStore } from './useIntlKeyStore';
|
|
16
16
|
export { default as useIntlKey } from './useIntlKey';
|
|
17
17
|
export { default as useSASQQueryMeta } from './useSASQQueryMeta';
|
|
18
|
+
export { default as useModConfigEntries } from './useModConfigEntries';
|
|
19
|
+
export { default as useMutateModConfigEntry } from './useMutateModConfigEntry';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
|
|
3
|
+
import { useQuery } from 'react-query';
|
|
4
|
+
import { useOkapiKy } from '@folio/stripes/core';
|
|
5
|
+
import { modConfigEntriesQueryKey, parseModConfigEntry } from '../utils';
|
|
6
|
+
import { MOD_SETTINGS_ENDPOINT } from '../constants/endpoints';
|
|
7
|
+
|
|
8
|
+
const useModConfigEntries = ({
|
|
9
|
+
configName,
|
|
10
|
+
moduleName,
|
|
11
|
+
namespaceAppend,
|
|
12
|
+
queryParams
|
|
13
|
+
}) => {
|
|
14
|
+
const ky = useOkapiKy();
|
|
15
|
+
|
|
16
|
+
const query = `?query=(module=${moduleName} and configName=${configName})`;
|
|
17
|
+
const path = `${MOD_SETTINGS_ENDPOINT}${query}`;
|
|
18
|
+
|
|
19
|
+
const namespace = modConfigEntriesQueryKey({
|
|
20
|
+
configName,
|
|
21
|
+
moduleName,
|
|
22
|
+
namespaceAppend
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const queryObject = useQuery(
|
|
26
|
+
namespace,
|
|
27
|
+
() => ky(path).json(),
|
|
28
|
+
queryParams
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const { data: { configs: { 0: settings = {} } = [] } = {} } = queryObject;
|
|
32
|
+
const parsedSettings = parseModConfigEntry(settings);
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
parsedSettings,
|
|
36
|
+
queryObject,
|
|
37
|
+
settings
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
useModConfigEntries.propTypes = {
|
|
42
|
+
moduleName: PropTypes.string,
|
|
43
|
+
configName: PropTypes.string,
|
|
44
|
+
queryParams: PropTypes.object,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default useModConfigEntries;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
import { useMutation, useQueryClient } from 'react-query';
|
|
3
|
+
import { useOkapiKy } from '@folio/stripes/core';
|
|
4
|
+
|
|
5
|
+
import { modConfigEntriesQueryKey } from '../utils';
|
|
6
|
+
import { MOD_SETTINGS_ENDPOINT } from '../constants/endpoints';
|
|
7
|
+
|
|
8
|
+
// This will simply take in some information and decide whether to mutate via POST or via PUT
|
|
9
|
+
const useMutateModConfigEntry = ({
|
|
10
|
+
configName,
|
|
11
|
+
moduleName,
|
|
12
|
+
id
|
|
13
|
+
}) => {
|
|
14
|
+
const ky = useOkapiKy();
|
|
15
|
+
const queryClient = useQueryClient();
|
|
16
|
+
|
|
17
|
+
const baseNamespace = modConfigEntriesQueryKey({
|
|
18
|
+
configName,
|
|
19
|
+
moduleName
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const putQueryObject = useMutation(
|
|
23
|
+
[...baseNamespace, 'putConfigEntry', id],
|
|
24
|
+
async (data) => ky.put(
|
|
25
|
+
`${MOD_SETTINGS_ENDPOINT}/${id}`,
|
|
26
|
+
{ json: data }
|
|
27
|
+
).json()
|
|
28
|
+
.then(() => {
|
|
29
|
+
queryClient.invalidateQueries(baseNamespace);
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const postQueryObject = useMutation(
|
|
34
|
+
[...baseNamespace, 'postConfigEntry'],
|
|
35
|
+
async (data) => ky.post(
|
|
36
|
+
`${MOD_SETTINGS_ENDPOINT}`,
|
|
37
|
+
{ json: data }
|
|
38
|
+
).json()
|
|
39
|
+
.then(() => {
|
|
40
|
+
queryClient.invalidateQueries(baseNamespace);
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
if (id) {
|
|
45
|
+
return putQueryObject;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return postQueryObject;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default useMutateModConfigEntry;
|
package/src/lib/utils/index.js
CHANGED
|
@@ -23,3 +23,6 @@ export { default as parseKiwtQueryGroups } from './parseKiwtQueryGroups';
|
|
|
23
23
|
|
|
24
24
|
// HTTP Utils
|
|
25
25
|
export { default as parseErrorResponse } from './parseErrorResponse';
|
|
26
|
+
|
|
27
|
+
export { default as modConfigEntriesQueryKey } from './modConfigEntriesQueryKey';
|
|
28
|
+
export { default as parseModConfigEntry } from './parseModConfigEntry';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const modConfigEntriesQueryKey = ({
|
|
2
|
+
configName,
|
|
3
|
+
moduleName,
|
|
4
|
+
namespaceAppend
|
|
5
|
+
} = {}) => {
|
|
6
|
+
const namespace = ['stripes-kint-components', 'modConfigSettings', moduleName, configName];
|
|
7
|
+
|
|
8
|
+
if (Array.isArray(namespaceAppend)) {
|
|
9
|
+
namespaceAppend.forEach(appendItem => {
|
|
10
|
+
namespace.push(appendItem);
|
|
11
|
+
});
|
|
12
|
+
} else if (namespaceAppend) {
|
|
13
|
+
namespace.push(namespaceAppend);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return namespace;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default modConfigEntriesQueryKey;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const parseModConfigEntry = (setting) => {
|
|
2
|
+
let parsedSettings = {};
|
|
3
|
+
if (setting.value) {
|
|
4
|
+
try {
|
|
5
|
+
parsedSettings = JSON.parse(setting.value);
|
|
6
|
+
} catch (error) {
|
|
7
|
+
// Error parsing settings JSON
|
|
8
|
+
console.error(error); // eslint-disable-line no-console
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return parsedSettings;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default parseModConfigEntry;
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { BaseHarness } from '@folio/stripes-erm-testing';
|
|
4
|
+
|
|
5
|
+
import { useIntlKeyStore } from '../../../src';
|
|
4
6
|
|
|
5
7
|
import { SettingsContext } from '../../../src/lib/contexts';
|
|
6
8
|
import translationsProperties from '../../helpers';
|
|
7
9
|
|
|
10
|
+
const InternalKintIntlHarness = ({ children, intlKey, moduleName }) => {
|
|
11
|
+
const addKey = useIntlKeyStore(state => state.addKey);
|
|
12
|
+
addKey(intlKey, moduleName);
|
|
13
|
+
|
|
14
|
+
return children;
|
|
15
|
+
};
|
|
8
16
|
|
|
9
17
|
export default function KintHarness({
|
|
10
18
|
children,
|
|
19
|
+
intlKey = 'ui-test-implementor',
|
|
20
|
+
moduleName = '@folio/test-implementor',
|
|
11
21
|
settingsValues = {
|
|
12
22
|
intlKey: 'stripes-kint-components',
|
|
13
23
|
refdataEndpoint: 'path/to/refdata',
|
|
@@ -19,12 +29,19 @@ export default function KintHarness({
|
|
|
19
29
|
}) {
|
|
20
30
|
return (
|
|
21
31
|
<SettingsContext.Provider value={settingsValues}>
|
|
22
|
-
<
|
|
32
|
+
<BaseHarness
|
|
33
|
+
intlKey={intlKey}
|
|
34
|
+
moduleName={moduleName}
|
|
23
35
|
translations={translations}
|
|
24
36
|
{...harnessProps}
|
|
25
37
|
>
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
<InternalKintIntlHarness
|
|
39
|
+
intlKey={intlKey}
|
|
40
|
+
moduleName={moduleName}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</InternalKintIntlHarness>
|
|
44
|
+
</BaseHarness>
|
|
28
45
|
</SettingsContext.Provider>
|
|
29
46
|
);
|
|
30
47
|
}
|