@k-int/stripes-kint-components 5.36.0 → 5.37.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/README.md +23 -8
- package/es/__mocks__/@folio/stripes/components.js +7 -3
- package/es/__mocks__/@folio/stripes/core.js +6 -4
- package/es/__mocks__/@folio/stripes/smart-components.js +6 -4
- package/es/__mocks__/react-query.js +6 -4
- package/es/__mocks__/react-router-dom.js +6 -6
- package/es/lib/ActionList/ActionList.js +38 -30
- package/es/lib/ActionList/ActionListFieldArray.js +131 -122
- package/es/lib/ButtonTypedown/ButtonTypedown.js +39 -41
- package/es/lib/ComboButton/ComboButton.js +66 -57
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +62 -46
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +4 -6
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +153 -135
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +4 -6
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +83 -81
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +32 -40
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +39 -39
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +10 -10
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +2 -3
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +24 -26
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +2 -3
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +62 -49
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +4 -6
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +75 -79
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +30 -35
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +19 -22
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +7 -10
- package/es/lib/CustomProperties/Edit/testResources.js +12 -11
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +67 -51
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +2 -3
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +62 -47
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +4 -7
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +16 -24
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +2 -3
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +17 -16
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +10 -7
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +35 -35
- package/es/lib/CustomProperties/Filter/testResources.js +2 -1
- package/es/lib/CustomProperties/Filter/useOperators.js +6 -8
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +12 -2
- package/es/lib/CustomProperties/Filter/useValueProps.js +6 -8
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +10 -10
- package/es/lib/CustomProperties/View/CustomPropertiesView.test.js +2 -3
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +67 -52
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +8 -6
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +20 -16
- package/es/lib/CycleButton/CycleButton.js +28 -14
- package/es/lib/FieldLabel/FieldLabel.js +5 -9
- package/es/lib/Files/FileUploader/FileUploader.js +41 -40
- package/es/lib/Files/FileView/FileView.js +11 -14
- package/es/lib/Files/useFileHandlers.js +63 -68
- package/es/lib/FormModal/FormModal.js +38 -38
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +29 -24
- package/es/lib/IconSelect/IconSelect.js +60 -44
- package/es/lib/NoResultsMessage/NoResultsMessage.js +31 -31
- package/es/lib/NumberField/NumberField.js +39 -19
- package/es/lib/NumberField/NumberField.test.js +19 -10
- package/es/lib/QueryTypedown/QueryTypedown.js +34 -12
- package/es/lib/RefdataButtons/RefdataButtons.js +14 -14
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +75 -68
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +30 -16
- package/es/lib/RichSelect/RichSelect.js +74 -58
- package/es/lib/RichSelect/useSelectedOption.js +12 -2
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +195 -188
- package/es/lib/SASQLookupComponent/SASQLookupComponent.test.js +81 -95
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +68 -48
- package/es/lib/SASQLookupComponent/TableBody/TableBody.test.js +37 -34
- package/es/lib/SASQLookupComponent/__mocks__/SASQLookupComponent.js +4 -5
- package/es/lib/SASQLookupComponent/__mocks__/SASQLookupComponentRender.js +1 -3
- package/es/lib/SASQRoute/SASQRoute.js +34 -29
- package/es/lib/SASQRoute/SASQRoute.test.js +34 -42
- package/es/lib/SASQViewComponent/SASQViewComponent.js +69 -66
- package/es/lib/SASQViewComponent/SASQViewComponent.test.js +13 -12
- package/es/lib/SearchField/SearchField.js +12 -8
- package/es/lib/SearchKeyControl/SearchKeyControl.js +46 -31
- package/es/lib/SearchKeyControl/SearchKeyControl.test.js +6 -2
- package/es/lib/Settings/EditableRefdataCategoryList/EditableRefdataCategoryList.js +124 -103
- package/es/lib/Settings/EditableRefdataList/EditableRefdataList.js +120 -107
- package/es/lib/Settings/EditableSettingsList/EditableSettingsList.js +12 -16
- package/es/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +45 -31
- package/es/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.test.js +6 -9
- package/es/lib/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js +20 -14
- package/es/lib/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.test.js +32 -48
- package/es/lib/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js +19 -19
- package/es/lib/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.test.js +24 -36
- package/es/lib/Settings/EditableSettingsList/SettingField/SettingField.js +48 -45
- package/es/lib/Settings/EditableSettingsList/SettingField/SettingField.test.js +9 -12
- package/es/lib/Settings/RefdataCategoriesSettings/RefdataCategoriesSettings.js +50 -38
- package/es/lib/Settings/SettingPage/SettingPage.js +17 -19
- package/es/lib/Settings/SettingPage/SettingPagePane/SettingPagePane.js +6 -8
- package/es/lib/Settings/Settings/Settings.js +33 -42
- package/es/lib/Settings/SettingsFormContainer/SettingsFormContainer.js +47 -45
- package/es/lib/Settings/StaticSettingsField/StaticSettingsField.js +13 -5
- package/es/lib/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js +38 -19
- package/es/lib/Settings/hooks/staticSettingsPages/useSettingCallout/useSettingCallout.js +13 -17
- package/es/lib/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/useSettingsSectionInitalValues.js +6 -10
- package/es/lib/Settings/hooks/staticSettingsPages/useStaticSettingsSection.js +20 -20
- package/es/lib/Settings/hooks/useAppSettings/useAppSettings.js +18 -15
- package/es/lib/Settings/hooks/useSettingSection/useSettingSection.js +27 -26
- package/es/lib/Settings/hooks/useSettings/useSettings.js +95 -99
- package/es/lib/Tags/Tags.js +37 -38
- package/es/lib/Tags/Tags.test.js +12 -18
- package/es/lib/Tags/hooks/useTags.js +1 -1
- package/es/lib/Tags/hooks/useTagsEnabled.js +13 -14
- package/es/lib/Tags/tagsConfig.js +1 -1
- package/es/lib/Typedown/Typedown.js +128 -78
- package/es/lib/hooks/__mocks__/index.js +7 -3
- package/es/lib/hooks/__mocks__/useMutateGeneric.js +22 -0
- package/es/lib/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js +24 -20
- package/es/lib/hooks/intlHooks/useKintIntl/useKintIntl.js +33 -25
- package/es/lib/hooks/typedownHooks/useTypedown.js +55 -37
- package/es/lib/hooks/typedownHooks/useTypedownData.js +15 -7
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +15 -7
- package/es/lib/hooks/useActionListRef.js +11 -2
- package/es/lib/hooks/useActiveElement.js +11 -2
- package/es/lib/hooks/useCustProps.js +45 -37
- package/es/lib/hooks/useCustomProperties.js +21 -18
- package/es/lib/hooks/useHelperApp.js +33 -15
- package/es/lib/hooks/useKiwtFieldArray.js +22 -14
- package/es/lib/hooks/useKiwtSASQuery.js +37 -28
- package/es/lib/hooks/useLocalPageStore.js +10 -7
- package/es/lib/hooks/useLocalStorageState.js +13 -2
- package/es/lib/hooks/useModConfigEntries.js +12 -15
- package/es/lib/hooks/useMutateCustomProperties/useMutateCustomProperties.js +16 -11
- package/es/lib/hooks/useMutateCustomProperties/useMutateCustomProperties.test.js +51 -0
- package/es/lib/hooks/useMutateGeneric/useMutateGeneric.js +70 -48
- package/es/lib/hooks/useMutateGeneric/useMutateGeneric.test.js +192 -0
- package/es/lib/hooks/useMutateModConfigEntry.js +5 -7
- package/es/lib/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js +23 -16
- package/es/lib/hooks/useMutateRefdataCategory/useMutateRefdataCategory.test.js +69 -0
- package/es/lib/hooks/useMutateRefdataValue/useMutateRefdataValue.js +25 -17
- package/es/lib/hooks/useMutateRefdataValue/useMutateRefdataValue.test.js +95 -0
- package/es/lib/hooks/useMutateTemplates/useMutateTemplates.js +21 -13
- package/es/lib/hooks/useMutateTemplates/useMutateTemplates.test.js +34 -0
- package/es/lib/hooks/useParallelBatchFetch.js +61 -38
- package/es/lib/hooks/usePrevNextPagination.js +46 -32
- package/es/lib/hooks/useQIndex.js +23 -11
- package/es/lib/hooks/useRefdata.js +11 -13
- package/es/lib/hooks/useSASQQueryMeta.js +2 -3
- package/es/lib/hooks/useStandaloneSASQQueryParameter/useStandaloneSASQQueryParameter.js +18 -19
- package/es/lib/hooks/useTemplates.js +9 -12
- package/es/lib/utils/buildUrl.js +3 -2
- package/es/lib/utils/downloadBlob.js +12 -8
- 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 +5 -4
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
- package/es/lib/utils/generateKiwtQueryParams/generateKiwtQueryParams.js +78 -102
- package/es/lib/utils/generateKiwtQueryParams/generateKiwtQueryParams.test.js +322 -29
- package/es/lib/utils/groupCustomPropertiesByCtx.js +9 -5
- package/es/lib/utils/matchString/matchString.js +7 -5
- package/es/lib/utils/matchString/matchString.test.js +26 -7
- package/es/lib/utils/modConfigEntriesQueryKey.js +4 -5
- package/es/lib/utils/parseErrorResponse.js +18 -8
- package/es/lib/utils/selectorSafe.js +3 -2
- package/es/lib/utils/sortByLabel.js +3 -2
- package/es/lib/utils/stringStyling/boldString.js +13 -4
- package/es/lib/utils/stringStyling/boldString.test.js +4 -5
- package/es/lib/utils/stringStyling/highlightString.js +13 -4
- package/es/lib/utils/stringStyling/highlightString.test.js +4 -5
- package/es/lib/validators/validators.js +8 -7
- 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/ButtonTypedown/ButtonTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/ButtonTypedown/index.html +1 -1
- package/src/artifacts/coverage-jest/ButtonTypedown/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/Files/FileUploader/FileUploader.js.html +1 -1
- package/src/artifacts/coverage-jest/Files/FileUploader/index.html +1 -1
- package/src/artifacts/coverage-jest/Files/FileUploader/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Files/FileView/FileView.js.html +1 -1
- package/src/artifacts/coverage-jest/Files/FileView/index.html +1 -1
- package/src/artifacts/coverage-jest/Files/FileView/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Files/index.html +1 -1
- package/src/artifacts/coverage-jest/Files/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Files/useFileHandlers.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 +24 -9
- package/src/artifacts/coverage-jest/QueryTypedown/index.html +13 -13
- 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 +30 -30
- 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 +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.html +1 -1
- 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 +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.html +1 -1
- 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 +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.html +1 -1
- 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 +1 -1
- 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/Settings/Settings.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/Settings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/Settings/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 +23 -8
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js.html +60 -6
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.html +10 -10
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.html +13 -13
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/constants/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/constants/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/constants/queryKeys.js.html +1 -1
- 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 +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/useSettingSection.js.html +1 -1
- 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 +1 -1
- package/src/artifacts/coverage-jest/Tags/Tags.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/hooks/index.html +1 -1
- 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 +1 -1
- 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 +136 -7
- package/src/artifacts/coverage-jest/Typedown/index.html +3 -3
- package/src/artifacts/coverage-jest/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/cobertura-coverage.xml +542 -529
- 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 +1 -1
- package/src/artifacts/coverage-jest/constants/eventCodes.js.html +1 -1
- package/src/artifacts/coverage-jest/constants/index.html +1 -1
- 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 +7 -7
- 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 +6 -6
- 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 +6 -6
- 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/useCustProps.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 +2 -2
- package/src/artifacts/coverage-jest/hooks/useKiwtFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useKiwtSASQuery.js.html +9 -9
- package/src/artifacts/coverage-jest/hooks/useLocalPageStore.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useLocalStorageState.js.html +5 -5
- package/src/artifacts/coverage-jest/hooks/useModConfigEntries.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.html +17 -17
- package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/useMutateCustomProperties.js.html +16 -16
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.html +21 -21
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/useMutateGeneric.js.html +93 -93
- package/src/artifacts/coverage-jest/hooks/useMutateModConfigEntry.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.html +21 -21
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js.html +40 -40
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.html +21 -21
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/useMutateRefdataValue.js.html +44 -44
- package/src/artifacts/coverage-jest/hooks/useMutateTemplates/index.html +21 -21
- package/src/artifacts/coverage-jest/hooks/useMutateTemplates/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateTemplates/useMutateTemplates.js.html +38 -38
- package/src/artifacts/coverage-jest/hooks/useParallelBatchFetch.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/usePrevNextPagination.js.html +20 -20
- package/src/artifacts/coverage-jest/hooks/useQIndex.js.html +8 -8
- 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 +95 -95
- package/src/artifacts/coverage-jest/utils/buildUrl.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/downloadBlob.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/filterParsers/deparseKiwtQueryFilters.js.html +3 -3
- 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 +3 -3
- package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryGroups.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryString.js.html +5 -5
- package/src/artifacts/coverage-jest/utils/generateKiwtQuery.js.html +7 -7
- package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/generateKiwtQueryParams.js.html +125 -125
- package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.html +21 -21
- package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/groupCustomPropertiesByCtx.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/index.html +5 -5
- package/src/artifacts/coverage-jest/utils/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/matchString/index.html +1 -1
- package/src/artifacts/coverage-jest/utils/matchString/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/matchString/matchString.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/modConfigEntriesQueryKey.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/parseErrorResponse.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/parseModConfigEntry.js.html +2 -2
- 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 +2 -2
- package/src/artifacts/coverage-jest/utils/selectorSafe.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/sortByLabel.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/stringStyling/boldString.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/stringStyling/highlightString.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/stringStyling/index.html +1 -1
- package/src/artifacts/coverage-jest/utils/stringStyling/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/toCamelCase.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/typedownQueryKey.js.html +2 -2
- 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/QueryTypedown/QueryTypedown.js +7 -2
- package/src/lib/QueryTypedown/README.md +7 -6
- package/src/lib/Settings/StaticSettingsField/StaticSettingsField.js +6 -1
- package/src/lib/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js +18 -0
- package/src/lib/Typedown/README.md +27 -1
- package/src/lib/Typedown/Typedown.js +47 -4
- package/src/lib/hooks/__mocks__/useMutateGeneric.js +14 -0
- package/src/lib/hooks/useMutateCustomProperties/useMutateCustomProperties.test.js +65 -0
- package/src/lib/hooks/useMutateGeneric/useMutateGeneric.test.js +194 -0
- package/src/lib/hooks/useMutateRefdataCategory/useMutateRefdataCategory.test.js +76 -0
- package/src/lib/hooks/useMutateRefdataValue/useMutateRefdataValue.test.js +93 -0
- package/src/lib/hooks/useMutateTemplates/useMutateTemplates.test.js +33 -0
- package/src/lib/utils/generateKiwtQueryParams/generateKiwtQueryParams.test.js +248 -17
|
@@ -7,19 +7,28 @@ exports.default = void 0;
|
|
|
7
7
|
var _noop = _interopRequireDefault(require("lodash/noop"));
|
|
8
8
|
var _useInvalidateRefdata = _interopRequireDefault(require("../useInvalidateRefdata"));
|
|
9
9
|
var _useMutateGeneric = _interopRequireDefault(require("../useMutateGeneric"));
|
|
10
|
+
const _excluded = ["afterQueryCalls", "endpoint"];
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
18
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
11
19
|
const useMutateTemplates = _ref => {
|
|
12
|
-
let
|
|
13
|
-
afterQueryCalls:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
let _ref$afterQueryCalls = _ref.afterQueryCalls,
|
|
21
|
+
_ref$afterQueryCalls2 = _ref$afterQueryCalls === void 0 ? {} : _ref$afterQueryCalls,
|
|
22
|
+
_ref$afterQueryCalls3 = _ref$afterQueryCalls2.delete,
|
|
23
|
+
afterQueryDelete = _ref$afterQueryCalls3 === void 0 ? _noop.default : _ref$afterQueryCalls3,
|
|
24
|
+
_ref$afterQueryCalls4 = _ref$afterQueryCalls2.post,
|
|
25
|
+
afterQueryPost = _ref$afterQueryCalls4 === void 0 ? _noop.default : _ref$afterQueryCalls4,
|
|
26
|
+
_ref$afterQueryCalls5 = _ref$afterQueryCalls2.put,
|
|
27
|
+
afterQueryPut = _ref$afterQueryCalls5 === void 0 ? _noop.default : _ref$afterQueryCalls5,
|
|
28
|
+
endpoint = _ref.endpoint,
|
|
29
|
+
mutateGenericProps = _objectWithoutProperties(_ref, _excluded);
|
|
21
30
|
const invalidateRefdata = (0, _useInvalidateRefdata.default)();
|
|
22
|
-
return (0, _useMutateGeneric.default)({
|
|
31
|
+
return (0, _useMutateGeneric.default)(_objectSpread({
|
|
23
32
|
afterQueryCalls: {
|
|
24
33
|
delete: res => {
|
|
25
34
|
invalidateRefdata().then(() => {
|
|
@@ -38,8 +47,7 @@ const useMutateTemplates = _ref => {
|
|
|
38
47
|
}
|
|
39
48
|
},
|
|
40
49
|
endpoint,
|
|
41
|
-
queryKey: ['stripes-kint-components', 'useMutateTemplates']
|
|
42
|
-
|
|
43
|
-
});
|
|
50
|
+
queryKey: ['stripes-kint-components', 'useMutateTemplates']
|
|
51
|
+
}, mutateGenericProps));
|
|
44
52
|
};
|
|
45
53
|
var _default = exports.default = useMutateTemplates;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = require("@folio/jest-config-stripes/testing-library/react");
|
|
4
|
+
var _useMutateGeneric = _interopRequireDefault(require("../useMutateGeneric"));
|
|
5
|
+
var _useInvalidateRefdata = _interopRequireDefault(require("../useInvalidateRefdata"));
|
|
6
|
+
var _useMutateTemplates = _interopRequireDefault(require("./useMutateTemplates"));
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
jest.mock('../useMutateGeneric');
|
|
9
|
+
jest.mock('../useInvalidateRefdata');
|
|
10
|
+
describe('useMutateTemplates', () => {
|
|
11
|
+
const mockEndpoint = 'erm/templates';
|
|
12
|
+
const mockInvalidate = jest.fn(() => Promise.resolve());
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
jest.clearAllMocks();
|
|
15
|
+
_useInvalidateRefdata.default.mockReturnValue(mockInvalidate);
|
|
16
|
+
});
|
|
17
|
+
test('passes the correct queryKey', () => {
|
|
18
|
+
(0, _react.renderHook)(() => (0, _useMutateTemplates.default)({
|
|
19
|
+
endpoint: mockEndpoint
|
|
20
|
+
}));
|
|
21
|
+
const sentConfig = _useMutateGeneric.default.mock.calls[0][0];
|
|
22
|
+
expect(sentConfig.queryKey).toEqual(['stripes-kint-components', 'useMutateTemplates']);
|
|
23
|
+
});
|
|
24
|
+
describe('afterQueryCalls', () => {
|
|
25
|
+
test.each(['delete', 'post', 'put'])('Verb: %s calls invalidateRefdata', async verb => {
|
|
26
|
+
(0, _react.renderHook)(() => (0, _useMutateTemplates.default)({
|
|
27
|
+
endpoint: mockEndpoint
|
|
28
|
+
}));
|
|
29
|
+
const afterQueryCalls = _useMutateGeneric.default.mock.calls[0][0].afterQueryCalls;
|
|
30
|
+
await afterQueryCalls[verb]({});
|
|
31
|
+
expect(mockInvalidate).toHaveBeenCalled();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -9,6 +9,20 @@ var _reactQuery = require("react-query");
|
|
|
9
9
|
var _lodash = require("lodash");
|
|
10
10
|
var _core = require("@folio/stripes/core");
|
|
11
11
|
var _utils = require("../utils");
|
|
12
|
+
const _excluded = ["enabled"];
|
|
13
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
19
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
20
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
21
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
23
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
24
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
25
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
12
26
|
// A hook to do the same thing as batch fetching > 100 resources, but parallelising it.
|
|
13
27
|
|
|
14
28
|
// Only defining defaults to ward of "magic number" sonarlint rule -.-
|
|
@@ -19,37 +33,37 @@ const DEFAULT_BATCH_LIMIT = Infinity;
|
|
|
19
33
|
// CONCURRENT_REQUESTS and BATCH_SIZE can be tweaked here, but implementor beware
|
|
20
34
|
// They are formatted as if constants to discourage this
|
|
21
35
|
const useParallelBatchFetch = _ref => {
|
|
22
|
-
let
|
|
23
|
-
BATCH_LIMIT = DEFAULT_BATCH_LIMIT,
|
|
24
|
-
|
|
25
|
-
batchParams = {},
|
|
26
|
-
|
|
27
|
-
nsValues = {},
|
|
28
|
-
BATCH_SIZE =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
endpoint,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} = _ref;
|
|
36
|
+
let _ref$BATCH_LIMIT = _ref.BATCH_LIMIT,
|
|
37
|
+
BATCH_LIMIT = _ref$BATCH_LIMIT === void 0 ? DEFAULT_BATCH_LIMIT : _ref$BATCH_LIMIT,
|
|
38
|
+
_ref$batchParams = _ref.batchParams,
|
|
39
|
+
batchParams = _ref$batchParams === void 0 ? {} : _ref$batchParams,
|
|
40
|
+
_ref$nsValues = _ref.nsValues,
|
|
41
|
+
nsValues = _ref$nsValues === void 0 ? {} : _ref$nsValues,
|
|
42
|
+
_ref$BATCH_SIZE = _ref.BATCH_SIZE,
|
|
43
|
+
BATCH_SIZE = _ref$BATCH_SIZE === void 0 ? MAX_BATCH_SIZE : _ref$BATCH_SIZE,
|
|
44
|
+
_ref$CONCURRENT_REQUE = _ref.CONCURRENT_REQUESTS,
|
|
45
|
+
CONCURRENT_REQUESTS = _ref$CONCURRENT_REQUE === void 0 ? CONCURRENT_REQUESTS_DEFAULT : _ref$CONCURRENT_REQUE,
|
|
46
|
+
endpoint = _ref.endpoint,
|
|
47
|
+
generateQueryKey = _ref.generateQueryKey,
|
|
48
|
+
_ref$queryNamespace = _ref.queryNamespace,
|
|
49
|
+
queryNamespace = _ref$queryNamespace === void 0 ? 'stripes-kint-components' : _ref$queryNamespace,
|
|
50
|
+
_ref$queryOptions = _ref.queryOptions,
|
|
51
|
+
passedQueryOptions = _ref$queryOptions === void 0 ? {} : _ref$queryOptions;
|
|
39
52
|
const ky = (0, _core.useOkapiKy)();
|
|
40
53
|
const SAFE_BATCH_SIZE = Math.min(BATCH_SIZE, MAX_BATCH_SIZE);
|
|
41
|
-
const
|
|
54
|
+
const _useState = (0, _react.useState)(true),
|
|
55
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
56
|
+
isLoading = _useState2[0],
|
|
57
|
+
setIsLoading = _useState2[1];
|
|
42
58
|
|
|
43
59
|
// Destructure passed query options to grab enabled
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const paramsArray = (0, _react.useMemo)(() => (0, _utils.generateKiwtQueryParams)({
|
|
49
|
-
...batchParams,
|
|
60
|
+
const _passedQueryOptions$e = passedQueryOptions.enabled,
|
|
61
|
+
queryEnabled = _passedQueryOptions$e === void 0 ? true : _passedQueryOptions$e,
|
|
62
|
+
queryOptions = _objectWithoutProperties(passedQueryOptions, _excluded);
|
|
63
|
+
const paramsArray = (0, _react.useMemo)(() => (0, _utils.generateKiwtQueryParams)(_objectSpread(_objectSpread({}, batchParams), {}, {
|
|
50
64
|
perPage: SAFE_BATCH_SIZE,
|
|
51
65
|
stats: true
|
|
52
|
-
}, nsValues), [batchParams, nsValues, SAFE_BATCH_SIZE]);
|
|
66
|
+
}), nsValues), [batchParams, nsValues, SAFE_BATCH_SIZE]);
|
|
53
67
|
const getDefaultNSArray = (0, _react.useCallback)(offset => [queryNamespace, endpoint, offset, paramsArray, 'useChunkedBatchedFetch'], [queryNamespace, endpoint, paramsArray]);
|
|
54
68
|
const namespaceArray = generateQueryKey ? generateQueryKey({
|
|
55
69
|
CONCURRENT_REQUESTS,
|
|
@@ -63,13 +77,19 @@ const useParallelBatchFetch = _ref => {
|
|
|
63
77
|
}) : getDefaultNSArray(0);
|
|
64
78
|
|
|
65
79
|
// Firstly fetch page 1 to get information about totals
|
|
66
|
-
const firstFetchResult = (0, _reactQuery.useQuery)(namespaceArray, () =>
|
|
67
|
-
|
|
80
|
+
const firstFetchResult = (0, _reactQuery.useQuery)(namespaceArray, () => {
|
|
81
|
+
var _ref2;
|
|
82
|
+
return ky.get("".concat(endpoint, "?").concat((_ref2 = [...paramsArray, 'offset=0']) === null || _ref2 === void 0 ? void 0 : _ref2.join('&'))).json();
|
|
83
|
+
}, passedQueryOptions);
|
|
84
|
+
const totalRecords = (0, _react.useMemo)(() => {
|
|
85
|
+
var _firstFetchResult$dat, _firstFetchResult$dat2;
|
|
86
|
+
return (_firstFetchResult$dat = firstFetchResult === null || firstFetchResult === void 0 || (_firstFetchResult$dat2 = firstFetchResult.data) === null || _firstFetchResult$dat2 === void 0 ? void 0 : _firstFetchResult$dat2.total) !== null && _firstFetchResult$dat !== void 0 ? _firstFetchResult$dat : 0;
|
|
87
|
+
}, [firstFetchResult]);
|
|
68
88
|
|
|
69
89
|
// WAIT for initial fetch to conclude before setting up queryArray
|
|
70
90
|
// Set up query array, and only enable the first CONCURRENT_REQUESTS requests
|
|
71
91
|
const getQueryArray = (0, _react.useCallback)(() => {
|
|
72
|
-
if (!firstFetchResult
|
|
92
|
+
if (!(firstFetchResult !== null && firstFetchResult !== void 0 && firstFetchResult.isFetched)) {
|
|
73
93
|
return [];
|
|
74
94
|
}
|
|
75
95
|
const recordsToFetch = Math.min(totalRecords, BATCH_LIMIT);
|
|
@@ -78,6 +98,7 @@ const useParallelBatchFetch = _ref => {
|
|
|
78
98
|
const queryArray = [];
|
|
79
99
|
// Offset will be i * SAFE_BATCH_SIZE
|
|
80
100
|
for (let offset = SAFE_BATCH_SIZE; offset < recordsToFetch; offset += SAFE_BATCH_SIZE) {
|
|
101
|
+
var _ref3;
|
|
81
102
|
const queryKey = generateQueryKey ? generateQueryKey({
|
|
82
103
|
CONCURRENT_REQUESTS,
|
|
83
104
|
BATCH_LIMIT,
|
|
@@ -88,14 +109,13 @@ const useParallelBatchFetch = _ref => {
|
|
|
88
109
|
paramsArray,
|
|
89
110
|
passedQueryOptions
|
|
90
111
|
}) : getDefaultNSArray(offset);
|
|
91
|
-
const paramString = [...paramsArray,
|
|
92
|
-
queryArray.push({
|
|
112
|
+
const paramString = (_ref3 = [...paramsArray, "offset=".concat(offset)]) === null || _ref3 === void 0 ? void 0 : _ref3.join('&');
|
|
113
|
+
queryArray.push(_objectSpread({
|
|
93
114
|
queryKey,
|
|
94
|
-
queryFn: () => ky.get(
|
|
115
|
+
queryFn: () => ky.get("".concat(endpoint, "?").concat(paramString)).json(),
|
|
95
116
|
// Only enable once the previous slice has all been fetched
|
|
96
|
-
enabled: queryEnabled && offset / SAFE_BATCH_SIZE < CONCURRENT_REQUESTS
|
|
97
|
-
|
|
98
|
-
});
|
|
117
|
+
enabled: queryEnabled && offset / SAFE_BATCH_SIZE < CONCURRENT_REQUESTS
|
|
118
|
+
}, queryOptions));
|
|
99
119
|
}
|
|
100
120
|
return queryArray;
|
|
101
121
|
}, [BATCH_LIMIT, batchParams, CONCURRENT_REQUESTS, endpoint, firstFetchResult, generateQueryKey, getDefaultNSArray, ky, paramsArray, passedQueryOptions, queryEnabled, queryOptions, SAFE_BATCH_SIZE, totalRecords]);
|
|
@@ -108,9 +128,10 @@ const useParallelBatchFetch = _ref => {
|
|
|
108
128
|
(0, _react.useEffect)(() => {
|
|
109
129
|
const chunkedQuery = (0, _lodash.chunk)(returnItemQueries, CONCURRENT_REQUESTS);
|
|
110
130
|
chunkedQuery.forEach((q, i) => {
|
|
131
|
+
var _chunkedQuery;
|
|
111
132
|
// Check that all previous chunk are fetched,
|
|
112
133
|
// and that all of our current chunk are not fetched and not loading
|
|
113
|
-
if (i !== 0 && chunkedQuery[i - 1]
|
|
134
|
+
if (i !== 0 && (_chunkedQuery = chunkedQuery[i - 1]) !== null && _chunkedQuery !== void 0 && _chunkedQuery.every(pq => pq.isFetched === true) && q.every(req => req.isFetched === false) && q.every(req => req.isLoading === false)) {
|
|
114
135
|
// Trigger fetch for each request in the chunk
|
|
115
136
|
q.forEach(req => {
|
|
116
137
|
req.refetch();
|
|
@@ -122,7 +143,8 @@ const useParallelBatchFetch = _ref => {
|
|
|
122
143
|
// Keep easy track of whether this hook is all loaded or not
|
|
123
144
|
// (This slightly flattens the "isLoading/isFetched" distinction, but it's an ease of use prop)
|
|
124
145
|
(0, _react.useEffect)(() => {
|
|
125
|
-
|
|
146
|
+
var _returnItemQueries$le;
|
|
147
|
+
const newLoading = ((_returnItemQueries$le = returnItemQueries === null || returnItemQueries === void 0 ? void 0 : returnItemQueries.length) !== null && _returnItemQueries$le !== void 0 ? _returnItemQueries$le : 0) < 1 || (returnItemQueries === null || returnItemQueries === void 0 ? void 0 : returnItemQueries.some(uq => !uq.isFetched));
|
|
126
148
|
if (isLoading !== newLoading) {
|
|
127
149
|
setIsLoading(newLoading);
|
|
128
150
|
}
|
|
@@ -131,8 +153,9 @@ const useParallelBatchFetch = _ref => {
|
|
|
131
153
|
itemQueries: returnItemQueries,
|
|
132
154
|
isLoading,
|
|
133
155
|
// Offer all fetched orderLines in flattened array once ready
|
|
134
|
-
items: isLoading ? [] : returnItemQueries
|
|
135
|
-
|
|
156
|
+
items: isLoading ? [] : returnItemQueries === null || returnItemQueries === void 0 ? void 0 : returnItemQueries.reduce((acc, curr) => {
|
|
157
|
+
var _curr$data$results, _curr$data;
|
|
158
|
+
return [...acc, ...((_curr$data$results = curr === null || curr === void 0 || (_curr$data = curr.data) === null || _curr$data === void 0 ? void 0 : _curr$data.results) !== null && _curr$data$results !== void 0 ? _curr$data$results : [])];
|
|
136
159
|
}, []),
|
|
137
160
|
total: totalRecords
|
|
138
161
|
};
|
|
@@ -10,23 +10,34 @@ var _queryString = _interopRequireDefault(require("query-string"));
|
|
|
10
10
|
var _pagination = require("../constants/pagination");
|
|
11
11
|
var _useLocalPageStore = _interopRequireDefault(require("./useLocalPageStore"));
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
19
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
21
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
22
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
23
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
24
|
// Currently there are several places in which this hook is used twice within the same component
|
|
14
25
|
// Once in order to get the current page, and again in order to handle changes to paginations
|
|
15
26
|
// This hook should be refactored in order to resolve these issue - @EthanFreestone
|
|
16
27
|
const usePrevNextPagination = function () {
|
|
17
|
-
let {
|
|
18
|
-
count =
|
|
19
|
-
|
|
20
|
-
defaultToPageOne =
|
|
21
|
-
|
|
22
|
-
pageSize =
|
|
23
|
-
|
|
24
|
-
id =
|
|
25
|
-
|
|
26
|
-
syncToLocation =
|
|
27
|
-
|
|
28
|
-
hasNextPage =
|
|
29
|
-
|
|
28
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
29
|
+
_ref$count = _ref.count,
|
|
30
|
+
count = _ref$count === void 0 ? 0 : _ref$count,
|
|
31
|
+
_ref$defaultToPageOne = _ref.defaultToPageOne,
|
|
32
|
+
defaultToPageOne = _ref$defaultToPageOne === void 0 ? true : _ref$defaultToPageOne,
|
|
33
|
+
_ref$pageSize = _ref.pageSize,
|
|
34
|
+
pageSize = _ref$pageSize === void 0 ? _pagination.DEFAULT_PAGINATION_SIZE : _ref$pageSize,
|
|
35
|
+
_ref$id = _ref.id,
|
|
36
|
+
id = _ref$id === void 0 ? _pagination.DEFAULT_PAGE_KEY : _ref$id,
|
|
37
|
+
_ref$syncToLocation = _ref.syncToLocation,
|
|
38
|
+
syncToLocation = _ref$syncToLocation === void 0 ? true : _ref$syncToLocation,
|
|
39
|
+
_ref$hasNextPage = _ref.hasNextPage,
|
|
40
|
+
hasNextPage = _ref$hasNextPage === void 0 ? null : _ref$hasNextPage;
|
|
30
41
|
/* ------ ZUSTAND STORE ------ */
|
|
31
42
|
// For NON-SYNC-TO-LOCATION use cases, store the currentPage in a keyed store
|
|
32
43
|
const pageStore = (0, _useLocalPageStore.default)(state => state.pageStore);
|
|
@@ -48,7 +59,10 @@ const usePrevNextPagination = function () {
|
|
|
48
59
|
return initialCurrentPage;
|
|
49
60
|
}, [id, pageStore, setPage, syncToLocation]);
|
|
50
61
|
// State itself
|
|
51
|
-
const
|
|
62
|
+
const _useState = (0, _react.useState)(getInitialCurrentPage()),
|
|
63
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
64
|
+
currentPage = _useState2[0],
|
|
65
|
+
setCurrentPage = _useState2[1];
|
|
52
66
|
const location = (0, _reactRouterDom.useLocation)();
|
|
53
67
|
const history = (0, _reactRouterDom.useHistory)();
|
|
54
68
|
|
|
@@ -69,18 +83,20 @@ const usePrevNextPagination = function () {
|
|
|
69
83
|
// change the store and the currentPage will update below
|
|
70
84
|
setPage(id, newPage);
|
|
71
85
|
setCurrentPage(newPage);
|
|
72
|
-
} else if (newPage !== urlQuery
|
|
73
|
-
const newQuery = {
|
|
74
|
-
...urlQuery,
|
|
86
|
+
} else if (newPage !== (urlQuery === null || urlQuery === void 0 ? void 0 : urlQuery.page)) {
|
|
87
|
+
const newQuery = _objectSpread(_objectSpread({}, urlQuery), {}, {
|
|
75
88
|
page: newPage
|
|
76
|
-
};
|
|
89
|
+
});
|
|
77
90
|
history.push({
|
|
78
91
|
pathname: location.pathname,
|
|
79
|
-
search:
|
|
92
|
+
search: "?".concat(_queryString.default.stringify(newQuery))
|
|
80
93
|
});
|
|
81
94
|
}
|
|
82
95
|
}, [currentPage, history, id, location.pathname, location.search, setPage, syncToLocation]);
|
|
83
|
-
const
|
|
96
|
+
const _useState3 = (0, _react.useState)(false),
|
|
97
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
98
|
+
resetPageState = _useState4[0],
|
|
99
|
+
setResetPageState = _useState4[1];
|
|
84
100
|
const resetPage = (0, _react.useCallback)(() => {
|
|
85
101
|
if (syncToLocation) {
|
|
86
102
|
setResetPageState(true);
|
|
@@ -92,30 +108,28 @@ const usePrevNextPagination = function () {
|
|
|
92
108
|
(0, _react.useEffect)(() => {
|
|
93
109
|
if (syncToLocation) {
|
|
94
110
|
const urlQuery = _queryString.default.parse(location.search);
|
|
95
|
-
if (urlQuery
|
|
96
|
-
setCurrentPage(Number(urlQuery
|
|
97
|
-
} else if (!urlQuery
|
|
111
|
+
if (urlQuery !== null && urlQuery !== void 0 && urlQuery.page && currentPage !== (urlQuery === null || urlQuery === void 0 ? void 0 : urlQuery.page)) {
|
|
112
|
+
setCurrentPage(Number(urlQuery === null || urlQuery === void 0 ? void 0 : urlQuery.page));
|
|
113
|
+
} else if (!(urlQuery !== null && urlQuery !== void 0 && urlQuery.page) && defaultToPageOne) {
|
|
98
114
|
// If url query "page" is not yet set, set it to 1
|
|
99
115
|
setCurrentPage(1);
|
|
100
|
-
const newQuery = {
|
|
101
|
-
...urlQuery,
|
|
116
|
+
const newQuery = _objectSpread(_objectSpread({}, urlQuery), {}, {
|
|
102
117
|
page: 1
|
|
103
|
-
};
|
|
118
|
+
});
|
|
104
119
|
|
|
105
120
|
// We use replace instead of push for the defaulting so we don't add unnecessary history entries
|
|
106
121
|
history.replace({
|
|
107
122
|
pathname: location.pathname,
|
|
108
|
-
search:
|
|
123
|
+
search: "?".concat(_queryString.default.stringify(newQuery))
|
|
109
124
|
});
|
|
110
125
|
}
|
|
111
126
|
if (resetPageState) {
|
|
112
|
-
const newQuery = {
|
|
113
|
-
...urlQuery,
|
|
127
|
+
const newQuery = _objectSpread(_objectSpread({}, urlQuery), {}, {
|
|
114
128
|
page: 1
|
|
115
|
-
};
|
|
129
|
+
});
|
|
116
130
|
history.push({
|
|
117
131
|
pathname: location.pathname,
|
|
118
|
-
search:
|
|
132
|
+
search: "?".concat(_queryString.default.stringify(newQuery))
|
|
119
133
|
});
|
|
120
134
|
setResetPageState(false);
|
|
121
135
|
}
|
|
@@ -127,7 +141,7 @@ const usePrevNextPagination = function () {
|
|
|
127
141
|
}, [currentPage, defaultToPageOne, history, id, location, pageStore, resetPageState, syncToLocation]);
|
|
128
142
|
|
|
129
143
|
// Set up MCL specific props based on page
|
|
130
|
-
const pagingCanGoNext = hasNextPage
|
|
144
|
+
const pagingCanGoNext = hasNextPage !== null && hasNextPage !== void 0 ? hasNextPage : currentPage && currentPage < Number(count) / pageSize;
|
|
131
145
|
const pagingCanGoPrevious = currentPage && Number(currentPage) > 1;
|
|
132
146
|
const pagingOffset = currentPage ? (currentPage - 1) * pageSize : 0;
|
|
133
147
|
const onNeedMoreData = function () {
|
|
@@ -9,35 +9,47 @@ var _reactRouterDom = require("react-router-dom");
|
|
|
9
9
|
var _queryString = _interopRequireDefault(require("query-string"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
18
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
20
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
21
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
22
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
12
23
|
const useQIndex = () => {
|
|
13
24
|
const history = (0, _reactRouterDom.useHistory)();
|
|
14
25
|
const location = (0, _reactRouterDom.useLocation)();
|
|
15
26
|
const query = _queryString.default.parse(location.search);
|
|
16
|
-
const
|
|
27
|
+
const _useState = (0, _react.useState)(query === null || query === void 0 ? void 0 : query.qindex),
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
+
currentQindex = _useState2[0],
|
|
30
|
+
setCurrentQindex = _useState2[1];
|
|
17
31
|
const handleQindexChange = newQindex => {
|
|
18
32
|
setCurrentQindex(newQindex);
|
|
19
|
-
if (newQindex !== query
|
|
33
|
+
if (newQindex !== (query === null || query === void 0 ? void 0 : query.qindex)) {
|
|
20
34
|
let newQuery;
|
|
21
35
|
if (newQindex !== '') {
|
|
22
|
-
newQuery = {
|
|
23
|
-
...query,
|
|
36
|
+
newQuery = _objectSpread(_objectSpread({}, query), {}, {
|
|
24
37
|
qindex: newQindex
|
|
25
|
-
};
|
|
38
|
+
});
|
|
26
39
|
} else {
|
|
27
|
-
newQuery = {
|
|
28
|
-
...query,
|
|
40
|
+
newQuery = _objectSpread(_objectSpread({}, query), {}, {
|
|
29
41
|
qindex: undefined
|
|
30
|
-
};
|
|
42
|
+
});
|
|
31
43
|
}
|
|
32
44
|
history.push({
|
|
33
45
|
pathname: location.pathname,
|
|
34
|
-
search:
|
|
46
|
+
search: "?".concat(_queryString.default.stringify(newQuery))
|
|
35
47
|
});
|
|
36
48
|
}
|
|
37
49
|
};
|
|
38
50
|
(0, _react.useEffect)(() => {
|
|
39
|
-
if (currentQindex !== query
|
|
40
|
-
setCurrentQindex(query
|
|
51
|
+
if (currentQindex !== (query === null || query === void 0 ? void 0 : query.qindex)) {
|
|
52
|
+
setCurrentQindex(query === null || query === void 0 ? void 0 : query.qindex);
|
|
41
53
|
}
|
|
42
54
|
}, [currentQindex, history, location, query]);
|
|
43
55
|
return [currentQindex, handleQindexChange];
|
|
@@ -10,13 +10,13 @@ var _core = require("@folio/stripes/core");
|
|
|
10
10
|
var _utils = require("../utils");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
const useRefdata = _ref => {
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
options = _utils.refdataOptions,
|
|
17
|
-
queryParams,
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
let endpoint = _ref.endpoint,
|
|
14
|
+
desc = _ref.desc,
|
|
15
|
+
_ref$options = _ref.options,
|
|
16
|
+
options = _ref$options === void 0 ? _utils.refdataOptions : _ref$options,
|
|
17
|
+
queryParams = _ref.queryParams,
|
|
18
|
+
_ref$returnQueryObjec = _ref.returnQueryObject,
|
|
19
|
+
returnQueryObject = _ref$returnQueryObjec === void 0 ? false : _ref$returnQueryObjec;
|
|
20
20
|
const ky = (0, _core.useOkapiKy)();
|
|
21
21
|
const nsValues = {};
|
|
22
22
|
|
|
@@ -28,20 +28,18 @@ const useRefdata = _ref => {
|
|
|
28
28
|
|
|
29
29
|
if (Array.isArray(desc)) {
|
|
30
30
|
// If we have an array, append a desc filter for each desc given
|
|
31
|
-
nsValues.filters = desc.map(d =>
|
|
31
|
+
nsValues.filters = desc.map(d => "DescKey.".concat(d)).join(',');
|
|
32
32
|
} else if (desc) {
|
|
33
33
|
// If we just have a string, append a single desc filter
|
|
34
|
-
nsValues.filters =
|
|
34
|
+
nsValues.filters = "DescKey.".concat(desc);
|
|
35
35
|
}
|
|
36
36
|
const query = (0, _utils.generateKiwtQuery)(options, nsValues);
|
|
37
|
-
const path =
|
|
37
|
+
const path = "".concat(endpoint).concat(query);
|
|
38
38
|
const queryObject = (0, _reactQuery.useQuery)((0, _utils.refdataQueryKey)(desc), () => ky(path).json(), queryParams);
|
|
39
39
|
if (returnQueryObject) {
|
|
40
40
|
return queryObject || {};
|
|
41
41
|
}
|
|
42
|
-
const
|
|
43
|
-
data: refdata
|
|
44
|
-
} = queryObject;
|
|
42
|
+
const refdata = queryObject.data;
|
|
45
43
|
return refdata || [];
|
|
46
44
|
};
|
|
47
45
|
useRefdata.propTypes = {
|
|
@@ -7,9 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
var _reactQuery = require("react-query");
|
|
8
8
|
var _core = require("@folio/stripes/core");
|
|
9
9
|
const useSASQQueryMeta = id => {
|
|
10
|
-
const
|
|
11
|
-
0
|
|
12
|
-
} = (0, _core.useNamespace)();
|
|
10
|
+
const _useNamespace = (0, _core.useNamespace)(),
|
|
11
|
+
namespace = _useNamespace[0];
|
|
13
12
|
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
14
13
|
const queryNSBase = [namespace, 'SASQ'];
|
|
15
14
|
if (id) {
|
|
@@ -8,6 +8,11 @@ var _react = require("react");
|
|
|
8
8
|
var _reactRouter = require("react-router");
|
|
9
9
|
var _queryString = _interopRequireDefault(require("query-string"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
16
|
// !WARNING! This pattern is not recommended
|
|
12
17
|
// You likely want to make use of the filterConfig valuesMapping/filterPrefix
|
|
13
18
|
// instead so SASQ filters can be used natively
|
|
@@ -27,12 +32,9 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
27
32
|
* @returns {{ handler: function, param: string }} An object containing the update handler and the current parameter value.
|
|
28
33
|
*/
|
|
29
34
|
const useStandaloneSASQQueryParameter = _ref => {
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// This is the value that will be spun up if no value is present in the url
|
|
34
|
-
fallbackValue // This is the value that will be set if there is no value passed to handler (values[0])
|
|
35
|
-
} = _ref;
|
|
35
|
+
let name = _ref.name,
|
|
36
|
+
defaultValue = _ref.defaultValue,
|
|
37
|
+
fallbackValue = _ref.fallbackValue;
|
|
36
38
|
const location = (0, _reactRouter.useLocation)();
|
|
37
39
|
const history = (0, _reactRouter.useHistory)();
|
|
38
40
|
|
|
@@ -40,28 +42,25 @@ const useStandaloneSASQQueryParameter = _ref => {
|
|
|
40
42
|
const urlQuery = _queryString.default.parse(location.search);
|
|
41
43
|
const param = urlQuery[name];
|
|
42
44
|
const handler = _ref2 => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
values
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
[name]: values[1] ?? fallbackValue // SECOND value is the new one
|
|
50
|
-
};
|
|
45
|
+
var _values$;
|
|
46
|
+
let _name = _ref2.name,
|
|
47
|
+
values = _ref2.values;
|
|
48
|
+
const newQuery = _objectSpread(_objectSpread({}, urlQuery), {}, {
|
|
49
|
+
[name]: (_values$ = values[1]) !== null && _values$ !== void 0 ? _values$ : fallbackValue // SECOND value is the new one
|
|
50
|
+
});
|
|
51
51
|
history.push({
|
|
52
52
|
pathname: location.pathname,
|
|
53
|
-
search:
|
|
53
|
+
search: "?".concat(_queryString.default.stringify(newQuery))
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
56
|
(0, _react.useEffect)(() => {
|
|
57
57
|
if (!param) {
|
|
58
|
-
const newQuery = {
|
|
59
|
-
...urlQuery,
|
|
58
|
+
const newQuery = _objectSpread(_objectSpread({}, urlQuery), {}, {
|
|
60
59
|
[name]: defaultValue
|
|
61
|
-
};
|
|
60
|
+
});
|
|
62
61
|
history.push({
|
|
63
62
|
pathname: location.pathname,
|
|
64
|
-
search:
|
|
63
|
+
search: "?".concat(_queryString.default.stringify(newQuery))
|
|
65
64
|
});
|
|
66
65
|
}
|
|
67
66
|
}, [defaultValue, history, location.pathname, name, param, urlQuery]);
|
|
@@ -9,25 +9,22 @@ var _reactQuery = require("react-query");
|
|
|
9
9
|
var _core = require("@folio/stripes/core");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const useTemplates = _ref => {
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
sort
|
|
17
|
-
} = _ref;
|
|
12
|
+
let context = _ref.context,
|
|
13
|
+
endpoint = _ref.endpoint,
|
|
14
|
+
queryParams = _ref.queryParams,
|
|
15
|
+
sort = _ref.sort;
|
|
18
16
|
const ky = (0, _core.useOkapiKy)();
|
|
19
17
|
const extraPathItems = [];
|
|
20
18
|
if (context) {
|
|
21
|
-
extraPathItems.push(
|
|
19
|
+
extraPathItems.push("filters=context=".concat(context));
|
|
22
20
|
}
|
|
23
21
|
if (sort) {
|
|
24
|
-
extraPathItems.push(
|
|
22
|
+
extraPathItems.push("sort=".concat(sort));
|
|
25
23
|
}
|
|
26
24
|
extraPathItems.push('max=500');
|
|
27
|
-
const path =
|
|
28
|
-
const
|
|
29
|
-
data
|
|
30
|
-
} = (0, _reactQuery.useQuery)(['stripes-kint-components', 'useTemplates', 'templates', context ?? ''], () => ky(path).json(), queryParams);
|
|
25
|
+
const path = "".concat(endpoint, "?").concat(extraPathItems.join('&'));
|
|
26
|
+
const _useQuery = (0, _reactQuery.useQuery)(['stripes-kint-components', 'useTemplates', 'templates', context !== null && context !== void 0 ? context : ''], () => ky(path).json(), queryParams),
|
|
27
|
+
templates = _useQuery.data;
|
|
31
28
|
return templates || [];
|
|
32
29
|
};
|
|
33
30
|
var _default = exports.default = useTemplates;
|