@k-int/stripes-kint-components 5.29.0 → 5.30.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 +14 -0
- package/es/__mocks__/@folio/stripes/components.js +3 -7
- package/es/__mocks__/@folio/stripes/core.js +4 -6
- package/es/__mocks__/@folio/stripes/smart-components.js +4 -6
- package/es/__mocks__/react-query.js +4 -6
- package/es/__mocks__/react-router-dom.js +6 -6
- package/es/lib/ActionList/ActionList.js +26 -33
- package/es/lib/ActionList/ActionListFieldArray.js +103 -119
- package/es/lib/ComboButton/ComboButton.js +42 -47
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +11 -17
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +42 -46
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +4 -8
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +32 -33
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +3 -3
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +29 -35
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +61 -59
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +20 -20
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -2
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
- package/es/lib/CustomProperties/Edit/testResources.js +11 -12
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +22 -33
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +23 -35
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +3 -6
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +4 -8
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +14 -17
- package/es/lib/CustomProperties/Filter/testResources.js +1 -2
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +1 -2
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +18 -26
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +3 -6
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +7 -11
- package/es/lib/CycleButton/CycleButton.js +9 -17
- package/es/lib/FormModal/FormModal.js +24 -32
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +23 -30
- package/es/lib/IconSelect/IconSelect.js +22 -32
- package/es/lib/NoResultsMessage/NoResultsMessage.js +4 -5
- package/es/lib/NumberField/NumberField.js +17 -25
- package/es/lib/NumberField/NumberField.test.js +6 -7
- package/es/lib/QueryTypedown/QueryTypedown.js +8 -15
- package/es/lib/RefdataButtons/RefdataButtons.js +6 -9
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +48 -60
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +5 -6
- package/es/lib/RichSelect/RichSelect.js +31 -36
- package/es/lib/RichSelect/useSelectedOption.js +1 -2
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +91 -94
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +42 -52
- package/es/lib/SASQRoute/SASQRoute.js +25 -29
- package/es/lib/SASQViewComponent/SASQViewComponent.js +68 -76
- package/es/lib/SearchField/SearchField.js +7 -13
- package/es/lib/SearchKeyControl/SearchKeyControl.js +8 -13
- package/es/lib/SearchKeyControl/SearchKeyControl.test.js +2 -6
- package/es/lib/Settings/EditableRefdataCategoryList/EditableRefdataCategoryList.js +30 -46
- package/es/lib/Settings/EditableRefdataList/EditableRefdataList.js +33 -43
- package/es/lib/Settings/EditableSettingsList/EditableSettingsList.js +26 -8
- package/es/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +31 -33
- package/es/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.test.js +8 -2
- package/es/lib/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js +17 -23
- package/es/lib/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.test.js +29 -44
- package/es/lib/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js +10 -12
- package/es/lib/Settings/EditableSettingsList/SettingField/SettingField.js +50 -29
- package/es/lib/Settings/EditableSettingsList/SettingField/SettingField.test.js +5 -3
- package/es/lib/Settings/RefdataCategoriesSettings/RefdataCategoriesSettings.js +19 -26
- package/es/lib/Settings/SettingPage/SettingPage.js +3 -0
- package/es/lib/Settings/SettingPage/SettingPagePane/SettingPagePane.js +2 -2
- package/es/lib/Settings/SettingsFormContainer/SettingsFormContainer.js +30 -35
- package/es/lib/Settings/StaticSettingsField/StaticSettingsField.js +8 -65
- package/es/lib/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js +60 -0
- package/es/lib/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.js +13 -0
- package/es/lib/Settings/StaticSettingsField/index.js +8 -1
- package/es/lib/Settings/constants/queryKeys.js +10 -1
- package/es/lib/Settings/hooks/staticSettingsPages/useSettingCallout/useSettingCallout.js +2 -2
- package/es/lib/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/useSettingsSectionInitalValues.js +1 -1
- package/es/lib/Settings/hooks/staticSettingsPages/useStaticSettingsSection.js +3 -7
- package/es/lib/Settings/hooks/useAppSettings/useAppSettings.js +7 -11
- package/es/lib/Settings/hooks/useSettingSection/useSettingSection.js +17 -17
- package/es/lib/Settings/hooks/useSettings/useSettings.js +60 -60
- package/es/lib/Settings/index.js +9 -2
- package/es/lib/Tags/Tags.js +5 -8
- package/es/lib/Tags/hooks/useTags.js +1 -1
- package/es/lib/Tags/hooks/useTagsEnabled.js +34 -4
- package/es/lib/Tags/tagsConfig.js +1 -1
- package/es/lib/Typedown/Typedown.js +21 -28
- package/es/lib/constants/endpoints.js +7 -2
- package/es/lib/hooks/__mocks__/index.js +3 -7
- package/es/lib/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js +20 -26
- package/es/lib/hooks/intlHooks/useKintIntl/useKintIntl.js +24 -34
- package/es/lib/hooks/typedownHooks/useTypedown.js +2 -2
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
- package/es/lib/hooks/useActionListRef.js +1 -1
- package/es/lib/hooks/useActiveElement.js +1 -1
- package/es/lib/hooks/useCustomProperties.js +6 -10
- package/es/lib/hooks/useHelperApp.js +13 -16
- package/es/lib/hooks/useKiwtFieldArray.js +7 -8
- package/es/lib/hooks/useKiwtSASQuery.js +15 -19
- package/es/lib/hooks/useLocalPageStore.js +7 -10
- package/es/lib/hooks/useModConfigEntries.js +2 -2
- package/es/lib/hooks/useMutateCustomProperties/useMutateCustomProperties.js +10 -17
- package/es/lib/hooks/useMutateGeneric/useMutateGeneric.js +2 -2
- package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
- package/es/lib/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js +15 -21
- package/es/lib/hooks/useMutateRefdataValue/useMutateRefdataValue.js +16 -23
- package/es/lib/hooks/usePrevNextPagination.js +17 -19
- package/es/lib/hooks/useQIndex.js +11 -14
- package/es/lib/hooks/useRefdata.js +3 -3
- package/es/lib/hooks/useStandaloneSASQQueryParameter/useStandaloneSASQQueryParameter.js +9 -13
- package/es/lib/hooks/useTemplates.js +4 -4
- package/es/lib/utils/buildUrl.js +2 -3
- package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +5 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
- package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +4 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
- package/es/lib/utils/generateKiwtQueryParams/generateKiwtQueryParams.js +94 -107
- package/es/lib/utils/groupCustomPropertiesByCtx.js +5 -9
- package/es/lib/utils/matchString.js +5 -7
- package/es/lib/utils/parseErrorResponse.js +3 -7
- package/es/lib/utils/selectorSafe.js +2 -3
- package/es/lib/utils/sortByLabel.js +2 -3
- package/es/lib/validators/validators.js +6 -9
- package/package.json +1 -1
- package/src/artifacts/coverage-jest/ActionList/ActionList.js.html +1 -1
- package/src/artifacts/coverage-jest/ActionList/ActionListFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/ActionList/index.html +1 -1
- package/src/artifacts/coverage-jest/ActionList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/ComboButton/ComboButton.js.html +1 -1
- package/src/artifacts/coverage-jest/ComboButton/index.html +1 -1
- package/src/artifacts/coverage-jest/ComboButton/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesLookup.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyForm.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyView.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEdit.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesListField.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyField.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyFormCard.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilter.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterField.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesRule.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/useOperators.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/useParseActiveFilterStrings.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/useValueProps.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesView.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesViewCtx.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertyCard.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CycleButton/CycleButton.js.html +1 -1
- package/src/artifacts/coverage-jest/CycleButton/index.html +1 -1
- package/src/artifacts/coverage-jest/CycleButton/index.js.html +1 -1
- package/src/artifacts/coverage-jest/FieldLabel/FieldLabel.js.html +1 -1
- package/src/artifacts/coverage-jest/FieldLabel/index.html +1 -1
- package/src/artifacts/coverage-jest/FieldLabel/index.js.html +1 -1
- package/src/artifacts/coverage-jest/FormModal/FormModal.js.html +1 -1
- package/src/artifacts/coverage-jest/FormModal/index.html +1 -1
- package/src/artifacts/coverage-jest/FormModal/index.js.html +1 -1
- package/src/artifacts/coverage-jest/FormattedKintMessage/FormattedKintMessage.js.html +1 -1
- package/src/artifacts/coverage-jest/FormattedKintMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/FormattedKintMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/IconSelect/IconSelect.js.html +1 -1
- package/src/artifacts/coverage-jest/IconSelect/index.html +1 -1
- package/src/artifacts/coverage-jest/IconSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/NoResultsMessage/NoResultsMessage.js.html +1 -1
- package/src/artifacts/coverage-jest/NoResultsMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/NoResultsMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/NumberField/NumberField.js.html +1 -1
- package/src/artifacts/coverage-jest/NumberField/index.html +1 -1
- package/src/artifacts/coverage-jest/NumberField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/QueryTypedown/QueryTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/QueryTypedown/index.html +1 -1
- package/src/artifacts/coverage-jest/QueryTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/RefdataButtons/RefdataButtons.js.html +1 -1
- package/src/artifacts/coverage-jest/RefdataButtons/index.html +1 -1
- package/src/artifacts/coverage-jest/RefdataButtons/index.js.html +1 -1
- package/src/artifacts/coverage-jest/ResponsiveButtonGroup/ResponsiveButtonGroup.js.html +1 -1
- package/src/artifacts/coverage-jest/ResponsiveButtonGroup/index.html +1 -1
- package/src/artifacts/coverage-jest/ResponsiveButtonGroup/index.js.html +1 -1
- package/src/artifacts/coverage-jest/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js.html +1 -1
- package/src/artifacts/coverage-jest/RichSelect/RichSelect.js.html +1 -1
- package/src/artifacts/coverage-jest/RichSelect/index.html +1 -1
- package/src/artifacts/coverage-jest/RichSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/RichSelect/useSelectedOption.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/SASQLookupComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/TableBody.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQRoute/SASQRoute.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQRoute/index.html +1 -1
- package/src/artifacts/coverage-jest/SASQRoute/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQViewComponent/SASQViewComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQViewComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/SASQViewComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SearchField/SearchField.js.html +1 -1
- package/src/artifacts/coverage-jest/SearchField/index.html +1 -1
- package/src/artifacts/coverage-jest/SearchField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SearchKeyControl/SearchKeyControl.js.html +1 -1
- package/src/artifacts/coverage-jest/SearchKeyControl/index.html +1 -1
- package/src/artifacts/coverage-jest/SearchKeyControl/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataList/EditableRefdataList.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataList/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsList.js.html +94 -28
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js.html +50 -44
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.html +19 -19
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js.html +20 -11
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.html +5 -5
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/SettingField.js.html +118 -31
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.html +19 -19
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.html +15 -15
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/RefdataCategoriesSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPage.js.html +5 -2
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/SettingPagePane.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/SettingsFormContainer.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsField.js.html +18 -198
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js.html +211 -0
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.html +131 -0
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.js.html +88 -0
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.html +19 -19
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.js.html +6 -3
- package/src/artifacts/coverage-jest/Settings/constants/index.html +17 -17
- package/src/artifacts/coverage-jest/Settings/constants/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/constants/queryKeys.js.html +43 -10
- package/src/artifacts/coverage-jest/Settings/contexts/SettingsContext.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/contexts/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/contexts/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/useSettingCallout.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/useSettingsSectionInitalValues.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useStaticSettingsSection.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/useAppSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.html +13 -13
- package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/useSettingSection.js.html +21 -9
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/useSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/index.js.html +2 -2
- package/src/artifacts/coverage-jest/Tags/Tags.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/hooks/index.html +15 -15
- package/src/artifacts/coverage-jest/Tags/hooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/hooks/useTags.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/hooks/useTagsEnabled.js.html +150 -12
- package/src/artifacts/coverage-jest/Tags/index.html +1 -1
- package/src/artifacts/coverage-jest/Tags/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/tagsConfig.js.html +1 -1
- package/src/artifacts/coverage-jest/Typedown/Typedown.js.html +1 -1
- package/src/artifacts/coverage-jest/Typedown/index.html +1 -1
- package/src/artifacts/coverage-jest/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/cobertura-coverage.xml +231 -156
- package/src/artifacts/coverage-jest/constants/comparators.js.html +1 -1
- package/src/artifacts/coverage-jest/constants/customProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/constants/endpoints.js.html +23 -5
- package/src/artifacts/coverage-jest/constants/eventCodes.js.html +1 -1
- package/src/artifacts/coverage-jest/constants/index.html +5 -5
- package/src/artifacts/coverage-jest/constants/pagination.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/useIntlKey.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/useKintIntl.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/typedownHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/typedownHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownData.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useActionListRef.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useActiveElement.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useCustomProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useHelperApp.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/useInvalidateRefdata.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useKiwtFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useKiwtSASQuery.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useLocalPageStore.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useLocalStorageState.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useModConfigEntries.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/useMutateCustomProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/useMutateGeneric.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateModConfigEntry.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/useMutateRefdataValue.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/usePrevNextPagination.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useQIndex.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useRefdata.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useSASQQueryMeta.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/useStandaloneSASQQueryParameter.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useTemplates.js.html +1 -1
- package/src/artifacts/coverage-jest/index.html +89 -74
- package/src/artifacts/coverage-jest/utils/buildUrl.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/deparseKiwtQueryFilters.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/index.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryFilters.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryGroups.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryString.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/generateKiwtQuery.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/generateKiwtQueryParams.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.html +1 -1
- package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/groupCustomPropertiesByCtx.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/highlightString.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/index.html +1 -1
- package/src/artifacts/coverage-jest/utils/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/matchString.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/modConfigEntriesQueryKey.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/parseErrorResponse.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/parseModConfigEntry.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/refdataOptions.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/refdataQueryKey/index.html +1 -1
- package/src/artifacts/coverage-jest/utils/refdataQueryKey/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/refdataQueryKey/refdataQueryKey.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/selectorSafe.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/sortByLabel.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/toCamelCase.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/typedownQueryKey.js.html +1 -1
- package/src/artifacts/coverage-jest/validators/index.html +1 -1
- package/src/artifacts/coverage-jest/validators/index.js.html +1 -1
- package/src/artifacts/coverage-jest/validators/validators.js.html +1 -1
- package/src/lib/Settings/EditableSettingsList/EditableSettingsList.js +42 -20
- package/src/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +27 -25
- package/src/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.test.js +2 -0
- package/src/lib/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js +9 -6
- package/src/lib/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.test.js +29 -44
- package/src/lib/Settings/EditableSettingsList/SettingField/SettingField.js +49 -20
- package/src/lib/Settings/EditableSettingsList/SettingField/SettingField.test.js +2 -0
- package/src/lib/Settings/SettingPage/SettingPage.js +1 -0
- package/src/lib/Settings/StaticSettingsField/StaticSettingsField.js +8 -68
- package/src/lib/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js +42 -0
- package/src/lib/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.js +1 -0
- package/src/lib/Settings/StaticSettingsField/index.js +2 -1
- package/src/lib/Settings/constants/queryKeys.js +12 -1
- package/src/lib/Settings/hooks/useSettingSection/useSettingSection.js +6 -2
- package/src/lib/Settings/index.js +1 -1
- package/src/lib/Tags/hooks/useTagsEnabled.js +51 -5
- package/src/lib/constants/endpoints.js +7 -1
|
@@ -1,78 +1,18 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
|
|
3
3
|
import { Field } from 'react-final-form';
|
|
4
|
-
import {
|
|
5
|
-
Select,
|
|
6
|
-
TextField,
|
|
7
|
-
} from '@folio/stripes/components';
|
|
8
4
|
|
|
9
|
-
import
|
|
5
|
+
import StaticSettingsFieldComponent from './StaticSettingsFieldComponent';
|
|
10
6
|
|
|
11
7
|
// This is pretty much EXACTLY equivalent to the EditSettingValue in EditableSettingsList,
|
|
12
8
|
// but slightly tweaked to be more accommodating
|
|
13
|
-
const StaticSettingsField = ({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const sortByLabel = (a, b) => (a.label.localeCompare(b.label));
|
|
21
|
-
const sortedRefdata = refdata?.sort(sortByLabel);
|
|
22
|
-
|
|
23
|
-
switch (setting.settingType) {
|
|
24
|
-
case 'Refdata':
|
|
25
|
-
// Grab refdata values corresponding to setting
|
|
26
|
-
// eslint-disable-next-line no-case-declarations
|
|
27
|
-
let RefdataComponent = Select;
|
|
28
|
-
if (refdata.length > 0 && refdata.length <= 4) {
|
|
29
|
-
RefdataComponent = RefdataButtons;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<Field
|
|
34
|
-
component={RefdataComponent}
|
|
35
|
-
dataOptions={sortedRefdata}
|
|
36
|
-
{...fieldProps}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
case 'Password':
|
|
41
|
-
return (
|
|
42
|
-
<Field
|
|
43
|
-
component={TextField}
|
|
44
|
-
parse={v => v} // Lets us send an empty string instead of 'undefined'
|
|
45
|
-
type="password"
|
|
46
|
-
{...fieldProps}
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
case 'Template': {
|
|
50
|
-
// Grab template values corresponding to setting
|
|
51
|
-
// eslint-disable-next-line no-case-declarations
|
|
52
|
-
const selectTemplateValues = [
|
|
53
|
-
{ value: '', label: '' },
|
|
54
|
-
...templates.map(t => ({ value: t.id, label: t.name }))
|
|
55
|
-
];
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<Field
|
|
59
|
-
component={Select}
|
|
60
|
-
dataOptions={selectTemplateValues}
|
|
61
|
-
parse={v => v}
|
|
62
|
-
{...fieldProps}
|
|
63
|
-
/>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
default:
|
|
67
|
-
// If in doubt, go with String
|
|
68
|
-
return (
|
|
69
|
-
<Field
|
|
70
|
-
component={TextField}
|
|
71
|
-
parse={v => v} // Lets us send an empty string instead of 'undefined'
|
|
72
|
-
{...fieldProps}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
9
|
+
const StaticSettingsField = (props) => {
|
|
10
|
+
return (
|
|
11
|
+
<Field
|
|
12
|
+
component={StaticSettingsFieldComponent}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
76
16
|
};
|
|
77
17
|
|
|
78
18
|
StaticSettingsField.propTypes = {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Select, TextField } from '@folio/stripes/components';
|
|
4
|
+
import RefdataButtons from '../../../RefdataButtons';
|
|
5
|
+
|
|
6
|
+
const StaticSettingsFieldComponent = ({
|
|
7
|
+
refdata,
|
|
8
|
+
setting = {},
|
|
9
|
+
templates,
|
|
10
|
+
...fieldProps // Anything else will be passed directly onto the <Field> component
|
|
11
|
+
}) => {
|
|
12
|
+
// Adding default sort to refdata object in ascending order by label
|
|
13
|
+
const sortByLabel = useCallback((a, b) => (a.label.localeCompare(b.label)), []);
|
|
14
|
+
const sortedRefdata = useMemo(() => refdata?.sort(sortByLabel), [refdata, sortByLabel]);
|
|
15
|
+
|
|
16
|
+
switch (setting.settingType) {
|
|
17
|
+
case 'Refdata':
|
|
18
|
+
// Grab refdata values corresponding to setting
|
|
19
|
+
// eslint-disable-next-line no-case-declarations
|
|
20
|
+
let RefdataComponent = Select;
|
|
21
|
+
if (refdata.length > 0 && refdata.length <= 4) {
|
|
22
|
+
RefdataComponent = RefdataButtons;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return <RefdataComponent {...fieldProps} dataOptions={sortedRefdata} />;
|
|
26
|
+
case 'Password':
|
|
27
|
+
return <TextField {...fieldProps} type="password" />;
|
|
28
|
+
case 'Template':
|
|
29
|
+
// Grab template values corresponding to setting
|
|
30
|
+
// eslint-disable-next-line no-case-declarations
|
|
31
|
+
const selectTemplateValues = [
|
|
32
|
+
{ value: '', label: '' },
|
|
33
|
+
...templates.map(t => ({ value: t.id, label: t.name }))
|
|
34
|
+
];
|
|
35
|
+
return <Select {...fieldProps} dataOptions={selectTemplateValues} />;
|
|
36
|
+
default:
|
|
37
|
+
// If in doubt, go with String
|
|
38
|
+
return <TextField {...fieldProps} />;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default StaticSettingsFieldComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './StaticSettingsFieldComponent';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from './StaticSettingsField';
|
|
1
|
+
export { default as StaticSettingsField } from './StaticSettingsField';
|
|
2
|
+
export { default as StaticSettingsFieldComponent } from './StaticSettingsFieldComponent';
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
export const BASE_APP_SETTING_QUERY_KEY = ['stripes-kint-components', 'useSetting', 'appSettings'];
|
|
2
|
-
export const GET_SETTING_SECTION_QUERY_KEY = (queryParams, sectionName) =>
|
|
2
|
+
export const GET_SETTING_SECTION_QUERY_KEY = (queryParams, sectionName) => {
|
|
3
|
+
const queryNamespace = [...BASE_APP_SETTING_QUERY_KEY];
|
|
4
|
+
if (sectionName) {
|
|
5
|
+
queryNamespace.push(sectionName);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (queryParams) {
|
|
9
|
+
queryNamespace.push(queryParams);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return [...BASE_APP_SETTING_QUERY_KEY, sectionName, queryParams];
|
|
13
|
+
};
|
|
3
14
|
|
|
4
15
|
export const BASE_APP_SETTING_MUTATE_KEY = ['stripes-kint-components', 'useSetting', 'putSetting'];
|
|
5
16
|
export const GET_SETTING_SECTION_MUTATE_KEY = (sectionName) => [...BASE_APP_SETTING_MUTATE_KEY, sectionName];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMutation, useQuery } from 'react-query';
|
|
1
|
+
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
2
2
|
import { useOkapiKy } from '@folio/stripes/core';
|
|
3
3
|
import { generateKiwtQueryParams } from '../../../utils';
|
|
4
4
|
|
|
@@ -11,6 +11,7 @@ const useSettingSection = ({
|
|
|
11
11
|
getMutateNamespaceGenerator = () => GET_SETTING_SECTION_MUTATE_KEY(sectionName)
|
|
12
12
|
}) => {
|
|
13
13
|
const ky = useOkapiKy();
|
|
14
|
+
const queryClient = useQueryClient();
|
|
14
15
|
const queryParams = generateKiwtQueryParams({
|
|
15
16
|
filters: [
|
|
16
17
|
{
|
|
@@ -34,7 +35,10 @@ const useSettingSection = ({
|
|
|
34
35
|
|
|
35
36
|
const { mutateAsync: putSetting, ...settingsMutate } = useMutation(
|
|
36
37
|
getMutateNamespaceGenerator(),
|
|
37
|
-
(data) => ky.put(`${settingEndpoint}${data.id ? '/' + data.id : ''}`, { json: data })
|
|
38
|
+
(data) => ky.put(`${settingEndpoint}${data.id ? '/' + data.id : ''}`, { json: data }).then(async res => {
|
|
39
|
+
await queryClient.invalidateQueries(getQueryNamespaceGenerator({ queryParams }));
|
|
40
|
+
return res;
|
|
41
|
+
})
|
|
38
42
|
);
|
|
39
43
|
|
|
40
44
|
return ({
|
|
@@ -18,7 +18,7 @@ export { default as RefdataCategoriesSettings } from './RefdataCategoriesSetting
|
|
|
18
18
|
export { default as EditableRefdataList } from './EditableRefdataList';
|
|
19
19
|
export { default as EditableRefdataCategoryList } from './EditableRefdataCategoryList';
|
|
20
20
|
|
|
21
|
-
export {
|
|
21
|
+
export { StaticSettingsField, StaticSettingsFieldComponent } from './StaticSettingsField';
|
|
22
22
|
|
|
23
23
|
// Contexts
|
|
24
24
|
export {
|
|
@@ -1,18 +1,64 @@
|
|
|
1
1
|
import { useOkapiKy } from '@folio/stripes/core';
|
|
2
2
|
import { useQuery } from 'react-query';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
CONFIG_ENDPOINT,
|
|
5
|
+
SETTINGS_ENDPOINT,
|
|
6
|
+
} from '../../constants/endpoints';
|
|
4
7
|
|
|
5
|
-
export const
|
|
8
|
+
export const TAGS_ENABLED_BASE_QUERY_KEY = ['stripes-kint-components', 'useTagsEnabled'];
|
|
6
9
|
|
|
7
|
-
const
|
|
10
|
+
const TAGS_CONFIG_QUERY =
|
|
11
|
+
'query=(module==TAGS and configName==tags_enabled)';
|
|
12
|
+
|
|
13
|
+
const TAGS_SETTINGS_QUERY =
|
|
14
|
+
'query=(scope==ui-tags.tags.manage and key==tags_enabled)';
|
|
15
|
+
|
|
16
|
+
export const TAGS_ENABLED_CONFIG_QUERY_KEY = [
|
|
17
|
+
...TAGS_ENABLED_BASE_QUERY_KEY,
|
|
18
|
+
CONFIG_ENDPOINT,
|
|
19
|
+
TAGS_CONFIG_QUERY,
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export const TAGS_ENABLED_QUERY_KEY = [
|
|
23
|
+
...TAGS_ENABLED_BASE_QUERY_KEY,
|
|
24
|
+
SETTINGS_ENDPOINT,
|
|
25
|
+
TAGS_SETTINGS_QUERY,
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
// DEPRECATED This remains for backwards compatibility but may not always be applicable, see useSettings configuration for details.
|
|
29
|
+
export const tagsEnabledQueryKey = TAGS_ENABLED_CONFIG_QUERY_KEY;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* useTagsEnabled
|
|
33
|
+
*
|
|
34
|
+
* By default uses mod-config, for backwards compatibility.
|
|
35
|
+
* Pass { useSettings: true } to use mod-settings instead.
|
|
36
|
+
*
|
|
37
|
+
* Returns:
|
|
38
|
+
* true if the setting is missing or true
|
|
39
|
+
* false if the setting is explicitly false
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
const useTagsEnabled = ({ useSettings = false } = {}) => {
|
|
8
43
|
const ky = useOkapiKy();
|
|
9
44
|
|
|
45
|
+
const endpoint = useSettings ? SETTINGS_ENDPOINT : CONFIG_ENDPOINT;
|
|
46
|
+
const query = useSettings ? TAGS_SETTINGS_QUERY : TAGS_CONFIG_QUERY;
|
|
47
|
+
const queryKey = useSettings ? TAGS_ENABLED_QUERY_KEY : TAGS_ENABLED_CONFIG_QUERY_KEY;
|
|
48
|
+
|
|
10
49
|
const queryObject = useQuery(
|
|
11
|
-
|
|
12
|
-
() => ky.get(`${
|
|
50
|
+
queryKey,
|
|
51
|
+
() => ky.get(`${endpoint}?${query}`).json()
|
|
13
52
|
);
|
|
14
53
|
|
|
54
|
+
if (useSettings) {
|
|
55
|
+
// mod-settings returns this value as a boolean instead of as a string, so the below approach !value is not applicable.
|
|
56
|
+
const value = queryObject?.data?.items?.[0]?.value;
|
|
57
|
+
return value === undefined || value === null || value;
|
|
58
|
+
}
|
|
59
|
+
|
|
15
60
|
const { data: { configs: { 0: { value } = {} } = [] } = {} } = queryObject;
|
|
61
|
+
|
|
16
62
|
return !value || value === 'true';
|
|
17
63
|
};
|
|
18
64
|
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
// eslint-disable-next-line import/prefer-default-export
|
|
2
|
-
export const
|
|
2
|
+
export const SETTINGS_ENDPOINT = 'settings/entries';
|
|
3
|
+
export const CONFIG_ENDPOINT = 'configurations/entries';
|
|
4
|
+
|
|
5
|
+
// DEPRECATED Here for backwards compatibility as we move from mod-config to what is now mod-settings
|
|
6
|
+
// This was always confusingly named, and will be removed in a future major version bump
|
|
7
|
+
export const MOD_SETTINGS_ENDPOINT = CONFIG_ENDPOINT;
|
|
8
|
+
|