@k-int/stripes-kint-components 5.32.0 → 5.33.1
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/LICENSE +1 -1
- 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/ButtonTypedown/ButtonTypedown.js +25 -33
- 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 +24 -37
- 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 +15 -19
- 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 +17 -25
- 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/SASQLookupComponent.test.js +44 -36
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +42 -53
- package/es/lib/SASQLookupComponent/TableBody/TableBody.test.js +19 -23
- package/es/lib/SASQRoute/SASQRoute.js +25 -29
- package/es/lib/SASQRoute/SASQRoute.test.js +11 -13
- package/es/lib/SASQViewComponent/SASQViewComponent.js +68 -76
- package/es/lib/SASQViewComponent/SASQViewComponent.test.js +4 -8
- 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/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +7 -11
- package/es/lib/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js +13 -20
- package/es/lib/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js +10 -12
- package/es/lib/Settings/EditableSettingsList/SettingField/SettingField.js +10 -15
- package/es/lib/Settings/EditableSettingsList/SettingField/SettingField.test.js +3 -3
- package/es/lib/Settings/RefdataCategoriesSettings/RefdataCategoriesSettings.js +19 -26
- package/es/lib/Settings/SettingPage/SettingPagePane/SettingPagePane.js +2 -2
- package/es/lib/Settings/Settings/Settings.js +31 -13
- package/es/lib/Settings/SettingsFormContainer/SettingsFormContainer.js +30 -35
- package/es/lib/Settings/StaticSettingsField/StaticSettingsField.js +5 -8
- package/es/lib/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js +18 -22
- 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 +16 -22
- package/es/lib/Settings/hooks/useSettings/useSettings.js +104 -88
- package/es/lib/Settings/index.js +8 -0
- package/es/lib/Tags/Tags.js +5 -8
- package/es/lib/Tags/hooks/useTags.js +1 -1
- package/es/lib/Tags/hooks/useTagsEnabled.js +2 -3
- package/es/lib/Tags/tagsConfig.js +1 -1
- package/es/lib/Typedown/Typedown.js +21 -28
- 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 +11 -12
- 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/index.js +34 -13
- package/es/lib/utils/matchString/index.js +13 -0
- package/es/lib/utils/{matchString.js → matchString/matchString.js} +8 -9
- package/es/lib/utils/matchString/matchString.test.js +40 -0
- 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/utils/stringStyling/boldString.js +30 -0
- package/es/lib/utils/stringStyling/boldString.test.js +47 -0
- package/es/lib/utils/stringStyling/highlightString.js +30 -0
- package/es/lib/utils/stringStyling/highlightString.test.js +51 -0
- package/es/lib/utils/stringStyling/index.js +20 -0
- 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/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/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 +15 -15
- 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 +31 -31
- 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 +96 -9
- package/src/artifacts/coverage-jest/Settings/Settings/index.html +14 -14
- 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 +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.html +1 -1
- 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 +13 -13
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/useSettings.js.html +105 -69
- package/src/artifacts/coverage-jest/Settings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/index.js.html +11 -2
- 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 +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 +371 -334
- 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/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 +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 +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 +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 +63 -33
- 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/index.html +9 -39
- package/src/artifacts/coverage-jest/utils/index.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/matchString/index.html +131 -0
- package/src/artifacts/coverage-jest/utils/matchString/index.js.html +88 -0
- package/src/artifacts/coverage-jest/utils/{matchString.js.html → matchString/matchString.js.html} +82 -55
- 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/stringStyling/boldString.js.html +190 -0
- package/src/artifacts/coverage-jest/utils/stringStyling/highlightString.js.html +190 -0
- package/src/artifacts/coverage-jest/utils/stringStyling/index.html +146 -0
- package/src/artifacts/coverage-jest/utils/stringStyling/index.js.html +91 -0
- 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/Settings/Settings.js +30 -1
- package/src/lib/Settings/hooks/useSettings/README.md +49 -19
- package/src/lib/Settings/hooks/useSettings/useSettings.js +60 -48
- package/src/lib/Settings/index.js +3 -0
- package/src/lib/utils/index.js +1 -1
- package/src/lib/utils/matchString/index.js +1 -0
- package/src/lib/utils/matchString/matchString.js +44 -0
- package/src/lib/utils/matchString/matchString.test.js +68 -0
- package/src/lib/utils/stringStyling/boldString.js +35 -0
- package/src/lib/utils/stringStyling/boldString.test.js +59 -0
- package/src/lib/utils/stringStyling/highlightString.js +35 -0
- package/src/lib/utils/stringStyling/highlightString.test.js +67 -0
- package/src/lib/utils/stringStyling/index.js +2 -0
- package/styles/stringMatchStyles.css +3 -0
- package/es/lib/utils/highlightString.js +0 -45
- package/src/artifacts/coverage-jest/utils/highlightString.js.html +0 -259
- package/src/lib/utils/highlightString.js +0 -58
- package/src/lib/utils/matchString.js +0 -35
|
@@ -10,43 +10,34 @@ var _reactRouterDom = require("react-router-dom");
|
|
|
10
10
|
var _components = require("@folio/stripes/components");
|
|
11
11
|
var _NoResultsMessage = _interopRequireDefault(require("../../NoResultsMessage"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
const _excluded = ["formatter"];
|
|
14
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
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; }
|
|
16
|
-
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; }
|
|
17
|
-
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; }
|
|
18
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
|
-
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); }
|
|
20
|
-
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; }
|
|
21
|
-
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; }
|
|
22
14
|
const TableBody = _ref => {
|
|
23
|
-
var _query$sort, _match$params2;
|
|
24
15
|
let {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const sortOrder =
|
|
16
|
+
data,
|
|
17
|
+
error,
|
|
18
|
+
fetchNextPage,
|
|
19
|
+
filterPaneVisible,
|
|
20
|
+
intlKey: passedIntlKey,
|
|
21
|
+
intlNS: passedIntlNS,
|
|
22
|
+
isError,
|
|
23
|
+
isLoading,
|
|
24
|
+
labelOverrides = {},
|
|
25
|
+
match,
|
|
26
|
+
mclProps: {
|
|
27
|
+
formatter = {},
|
|
28
|
+
...mclProps
|
|
29
|
+
} = {},
|
|
30
|
+
noResultsProps = {},
|
|
31
|
+
onSort,
|
|
32
|
+
path,
|
|
33
|
+
resultColumns,
|
|
34
|
+
rowNavigation = true,
|
|
35
|
+
// Default navigation onRowClick
|
|
36
|
+
getNavigationIdentifier = row => row?.id,
|
|
37
|
+
toggleFilterPane,
|
|
38
|
+
query
|
|
39
|
+
} = _ref;
|
|
40
|
+
const sortOrder = query.sort ?? '';
|
|
50
41
|
const history = (0, _reactRouterDom.useHistory)();
|
|
51
42
|
const location = (0, _reactRouterDom.useLocation)();
|
|
52
43
|
const onNeedMoreData = (_askAmount, index) => {
|
|
@@ -61,10 +52,9 @@ const TableBody = _ref => {
|
|
|
61
52
|
// Build the list of visible columns
|
|
62
53
|
const visibleColumns = resultColumns.map(e => e.propertyPath);
|
|
63
54
|
const getRowUrl = (0, _react.useCallback)(rowData => {
|
|
64
|
-
|
|
65
|
-
const baseUrl = "".concat(path, "/").concat(getNavigationIdentifier(rowData));
|
|
55
|
+
const baseUrl = `${path}/${getNavigationIdentifier(rowData)}`;
|
|
66
56
|
return {
|
|
67
|
-
url:
|
|
57
|
+
url: `${baseUrl}${location?.search ?? ''}`,
|
|
68
58
|
path,
|
|
69
59
|
baseUrl,
|
|
70
60
|
location
|
|
@@ -74,9 +64,10 @@ const TableBody = _ref => {
|
|
|
74
64
|
const enhancedFormatter = {};
|
|
75
65
|
for (const [key, value] of Object.entries(formatter)) {
|
|
76
66
|
if (typeof value === 'function') {
|
|
77
|
-
enhancedFormatter[key] = item => value(
|
|
67
|
+
enhancedFormatter[key] = item => value({
|
|
68
|
+
...item,
|
|
78
69
|
defaultRowUrl: getRowUrl(item)
|
|
79
|
-
})
|
|
70
|
+
});
|
|
80
71
|
} else {
|
|
81
72
|
enhancedFormatter[key] = value;
|
|
82
73
|
}
|
|
@@ -92,25 +83,21 @@ const TableBody = _ref => {
|
|
|
92
83
|
return null;
|
|
93
84
|
}, [getRowUrl, history, rowNavigation]);
|
|
94
85
|
const isSelected = (0, _react.useCallback)(_ref2 => {
|
|
95
|
-
var _match$params;
|
|
96
86
|
let {
|
|
97
87
|
item
|
|
98
88
|
} = _ref2;
|
|
99
|
-
return getNavigationIdentifier(item) ===
|
|
100
|
-
}, [getNavigationIdentifier, match
|
|
101
|
-
const NoResultsComponent = (0, _react.useMemo)(() =>
|
|
102
|
-
|
|
103
|
-
return (_noResultsProps$compo = noResultsProps === null || noResultsProps === void 0 ? void 0 : noResultsProps.component) !== null && _noResultsProps$compo !== void 0 ? _noResultsProps$compo : _NoResultsMessage.default;
|
|
104
|
-
}, [noResultsProps === null || noResultsProps === void 0 ? void 0 : noResultsProps.component]);
|
|
105
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, _objectSpread({
|
|
89
|
+
return getNavigationIdentifier(item) === match?.params?.id;
|
|
90
|
+
}, [getNavigationIdentifier, match?.params?.id]);
|
|
91
|
+
const NoResultsComponent = (0, _react.useMemo)(() => noResultsProps?.component ?? _NoResultsMessage.default, [noResultsProps?.component]);
|
|
92
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, {
|
|
106
93
|
autosize: true,
|
|
107
94
|
columnMapping: columnMapping,
|
|
108
|
-
contentData: data
|
|
95
|
+
contentData: data?.results,
|
|
109
96
|
formatter: getEnhancedFormatter() // Pass enhanced formatter
|
|
110
97
|
,
|
|
111
98
|
hasMargin: true,
|
|
112
99
|
interactive: rowNavigation,
|
|
113
|
-
isEmptyMessage: /*#__PURE__*/(0, _jsxRuntime.jsx)(NoResultsComponent,
|
|
100
|
+
isEmptyMessage: /*#__PURE__*/(0, _jsxRuntime.jsx)(NoResultsComponent, {
|
|
114
101
|
error,
|
|
115
102
|
filterPaneIsVisible: filterPaneVisible,
|
|
116
103
|
intlKey: passedIntlKey,
|
|
@@ -119,8 +106,9 @@ const TableBody = _ref => {
|
|
|
119
106
|
isLoading,
|
|
120
107
|
labelOverrides,
|
|
121
108
|
searchTerm: query.query,
|
|
122
|
-
toggleFilterPane
|
|
123
|
-
|
|
109
|
+
toggleFilterPane,
|
|
110
|
+
...noResultsProps // Anything passed in directly takes precedence
|
|
111
|
+
}),
|
|
124
112
|
isSelected: isSelected,
|
|
125
113
|
onHeaderClick: onSort,
|
|
126
114
|
onNeedMoreData: onNeedMoreData,
|
|
@@ -129,8 +117,9 @@ const TableBody = _ref => {
|
|
|
129
117
|
sortDirection: sortOrder.startsWith('-') ? 'descending' : 'ascending',
|
|
130
118
|
sortOrder: sortOrder.replace(/^-/, '').replace(/,.*/, ''),
|
|
131
119
|
totalCount: data.totalRecords,
|
|
132
|
-
visibleColumns: visibleColumns
|
|
133
|
-
|
|
120
|
+
visibleColumns: visibleColumns,
|
|
121
|
+
...mclProps
|
|
122
|
+
});
|
|
134
123
|
};
|
|
135
124
|
TableBody.propTypes = {
|
|
136
125
|
data: _propTypes.default.shape({
|
|
@@ -6,20 +6,16 @@ var _jest = require("../../../../test/jest");
|
|
|
6
6
|
var _TableBody = _interopRequireDefault(require("./TableBody"));
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
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; }
|
|
10
|
-
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; }
|
|
11
|
-
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; }
|
|
12
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
13
|
-
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); }
|
|
14
9
|
const mockHistoryPush = jest.fn();
|
|
15
10
|
|
|
16
11
|
// We want to use the ACTUAL location, but to mock history push so we can inspect it
|
|
17
12
|
jest.mock('react-router-dom', () => {
|
|
18
|
-
return
|
|
13
|
+
return {
|
|
14
|
+
...jest.requireActual('react-router-dom'),
|
|
19
15
|
useHistory: () => ({
|
|
20
16
|
push: mockHistoryPush
|
|
21
17
|
})
|
|
22
|
-
}
|
|
18
|
+
};
|
|
23
19
|
});
|
|
24
20
|
const mockFetchNextPage = jest.fn();
|
|
25
21
|
const mockToggleFilterPane = jest.fn();
|
|
@@ -28,10 +24,7 @@ const nameFormatterMock = jest.fn(item => item.name);
|
|
|
28
24
|
const defaultMCLProps = {
|
|
29
25
|
formatter: {
|
|
30
26
|
name: item => item.name || '',
|
|
31
|
-
status: item =>
|
|
32
|
-
var _item$status;
|
|
33
|
-
return ((_item$status = item.status) === null || _item$status === void 0 ? void 0 : _item$status.label) || '';
|
|
34
|
-
},
|
|
27
|
+
status: item => item.status?.label || '',
|
|
35
28
|
description: item => item.description || ''
|
|
36
29
|
},
|
|
37
30
|
columnWidths: {
|
|
@@ -110,11 +103,13 @@ describe('TableBody', () => {
|
|
|
110
103
|
}, {
|
|
111
104
|
label: 'enhanced formatter check',
|
|
112
105
|
initialEntries: ['/test/items'],
|
|
113
|
-
mclProps:
|
|
114
|
-
|
|
106
|
+
mclProps: {
|
|
107
|
+
...defaultMCLProps,
|
|
108
|
+
formatter: {
|
|
109
|
+
...defaultMCLProps.formatter,
|
|
115
110
|
name: nameFormatterMock
|
|
116
|
-
}
|
|
117
|
-
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
118
113
|
checkEnhancedFormatter: true
|
|
119
114
|
}])('Testing $label', _ref => {
|
|
120
115
|
let {
|
|
@@ -132,7 +127,8 @@ describe('TableBody', () => {
|
|
|
132
127
|
initialEntries: initialEntries,
|
|
133
128
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
134
129
|
path: "/test/items/:id?",
|
|
135
|
-
render: routeProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TableBody.default,
|
|
130
|
+
render: routeProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TableBody.default, {
|
|
131
|
+
...routeProps,
|
|
136
132
|
data: mockData,
|
|
137
133
|
fetchNextPage: mockFetchNextPage,
|
|
138
134
|
filterPaneVisible: false,
|
|
@@ -146,7 +142,7 @@ describe('TableBody', () => {
|
|
|
146
142
|
resultColumns: resultColumns,
|
|
147
143
|
rowNavigation: true,
|
|
148
144
|
toggleFilterPane: mockToggleFilterPane
|
|
149
|
-
})
|
|
145
|
+
})
|
|
150
146
|
})
|
|
151
147
|
}));
|
|
152
148
|
});
|
|
@@ -161,21 +157,21 @@ describe('TableBody', () => {
|
|
|
161
157
|
}).exists();
|
|
162
158
|
});
|
|
163
159
|
if (expectedSortOrder) {
|
|
164
|
-
test(
|
|
160
|
+
test(`renders ${expectedSortOrder} header with ${expectedSortDirection} sort`, async () => {
|
|
165
161
|
await (0, _stripesErmTesting.MultiColumnListHeader)(expectedSortOrder).has({
|
|
166
162
|
sort: expectedSortDirection
|
|
167
163
|
});
|
|
168
164
|
});
|
|
169
165
|
}
|
|
170
166
|
if (selectedRowIndex !== undefined) {
|
|
171
|
-
test(
|
|
167
|
+
test(`row ${selectedRowIndex} is selected`, async () => {
|
|
172
168
|
await (0, _stripesErmTesting.MultiColumnListRow)({
|
|
173
169
|
index: selectedRowIndex
|
|
174
170
|
}).has({
|
|
175
171
|
selected: ['mclSelected']
|
|
176
172
|
});
|
|
177
173
|
});
|
|
178
|
-
test(
|
|
174
|
+
test(`row ${selectedRowIndex - 1} is not selected`, async () => {
|
|
179
175
|
await (0, _stripesErmTesting.MultiColumnListRow)({
|
|
180
176
|
index: selectedRowIndex - 1
|
|
181
177
|
}).has({
|
|
@@ -202,7 +198,7 @@ describe('TableBody', () => {
|
|
|
202
198
|
hasLabel
|
|
203
199
|
} = _ref2;
|
|
204
200
|
const expectedValue = hasLabel ? mockData.results[index][property].label : mockData.results[index][property];
|
|
205
|
-
test(
|
|
201
|
+
test(`renders expected ${property} content: ${expectedValue}`, async () => {
|
|
206
202
|
await (0, _stripesErmTesting.MultiColumnListCell)({
|
|
207
203
|
row: index,
|
|
208
204
|
columnIndex: col
|
|
@@ -249,8 +245,8 @@ describe('TableBody', () => {
|
|
|
249
245
|
columnIndex: 0
|
|
250
246
|
}).click();
|
|
251
247
|
});
|
|
252
|
-
test(
|
|
253
|
-
expect(mockHistoryPush).toHaveBeenCalledWith(
|
|
248
|
+
test(`useHistory called with expected path to ${expectedId}`, () => {
|
|
249
|
+
expect(mockHistoryPush).toHaveBeenCalledWith(`/test/items/${expectedId}${expectedPushQuery}`);
|
|
254
250
|
});
|
|
255
251
|
});
|
|
256
252
|
});
|
|
@@ -10,33 +10,28 @@ var _reactRouterDom = require("react-router-dom");
|
|
|
10
10
|
var _SASQLookupComponent = require("../SASQLookupComponent");
|
|
11
11
|
var _SASQViewComponent = _interopRequireDefault(require("../SASQViewComponent"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
const _excluded = ["children", "fetchParameters", "getPathLookup", "getPathView", "SASQLookupComponent", "path", "SASQViewComponent"];
|
|
14
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
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; }
|
|
16
|
-
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; }
|
|
17
|
-
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; }
|
|
18
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
|
-
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); }
|
|
20
|
-
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; }
|
|
21
|
-
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; }
|
|
22
14
|
const SASQRoute = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
23
15
|
let {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
16
|
+
children,
|
|
17
|
+
fetchParameters,
|
|
18
|
+
getPathLookup = path => `${path}/:id?`,
|
|
19
|
+
getPathView = path => `${path}/:id`,
|
|
20
|
+
SASQLookupComponent: RouteLookupComponent = _SASQLookupComponent.SASQLookupComponent,
|
|
21
|
+
path,
|
|
22
|
+
SASQViewComponent: RouteViewComponent = _SASQViewComponent.default,
|
|
23
|
+
...props
|
|
24
|
+
} = _ref;
|
|
33
25
|
// Grab the SASQ_MAP and tweak it
|
|
34
26
|
const {
|
|
35
27
|
SASQ_MAP = {}
|
|
36
28
|
} = fetchParameters;
|
|
37
29
|
const lookupRef = (0, _react.useRef)();
|
|
38
30
|
const viewRef = (0, _react.useRef)();
|
|
39
|
-
(0, _react.useImperativeHandle)(ref, () =>
|
|
31
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
32
|
+
...lookupRef.current,
|
|
33
|
+
...viewRef.current
|
|
34
|
+
}));
|
|
40
35
|
if (!SASQ_MAP.perPage) {
|
|
41
36
|
SASQ_MAP.perPage = 25;
|
|
42
37
|
}
|
|
@@ -47,25 +42,26 @@ const SASQRoute = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
47
42
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
48
43
|
path: getPathLookup(path),
|
|
49
44
|
render: routeProps => {
|
|
50
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RouteLookupComponent,
|
|
51
|
-
ref: lookupRef
|
|
52
|
-
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RouteLookupComponent, {
|
|
46
|
+
ref: lookupRef,
|
|
47
|
+
...routeProps,
|
|
53
48
|
fetchParameters: fetchParameters,
|
|
54
|
-
path: path
|
|
55
|
-
|
|
49
|
+
path: path,
|
|
50
|
+
...props,
|
|
56
51
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.Switch, {
|
|
57
52
|
children: [children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
58
53
|
path: getPathView(path),
|
|
59
|
-
render: innerProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(RouteViewComponent,
|
|
60
|
-
ref: viewRef
|
|
61
|
-
|
|
54
|
+
render: innerProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(RouteViewComponent, {
|
|
55
|
+
ref: viewRef,
|
|
56
|
+
...innerProps,
|
|
62
57
|
fetchParameters: fetchParameters,
|
|
63
58
|
path: path,
|
|
64
|
-
ViewComponent: props.ViewComponent
|
|
65
|
-
|
|
59
|
+
ViewComponent: props.ViewComponent,
|
|
60
|
+
...props
|
|
61
|
+
})
|
|
66
62
|
})]
|
|
67
63
|
})
|
|
68
|
-
})
|
|
64
|
+
});
|
|
69
65
|
}
|
|
70
66
|
});
|
|
71
67
|
});
|
|
@@ -11,11 +11,8 @@ var _SASQLookupComponent = require("../SASQLookupComponent");
|
|
|
11
11
|
var _SASQViewComponent = require("../SASQViewComponent");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
18
|
-
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); } // We can import these special render-mocks once we manually mock the modules
|
|
14
|
+
// We can import these special render-mocks once we manually mock the modules
|
|
15
|
+
|
|
19
16
|
// Using Manual mocks
|
|
20
17
|
jest.mock('../SASQLookupComponent');
|
|
21
18
|
jest.mock('../SASQViewComponent');
|
|
@@ -182,12 +179,13 @@ describe('SASQRoute', () => {
|
|
|
182
179
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
183
180
|
path: "/hello",
|
|
184
181
|
children: "Hello world"
|
|
185
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQRoute.default,
|
|
182
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQRoute.default, {
|
|
186
183
|
ref: theRef
|
|
187
184
|
// Allow for testing of fetch parameters
|
|
188
185
|
,
|
|
189
|
-
testFetchParametersOnClick: testFetchParametersOnClick
|
|
190
|
-
|
|
186
|
+
testFetchParametersOnClick: testFetchParametersOnClick,
|
|
187
|
+
...props
|
|
188
|
+
})]
|
|
191
189
|
})]
|
|
192
190
|
}));
|
|
193
191
|
});
|
|
@@ -206,7 +204,7 @@ describe('SASQRoute', () => {
|
|
|
206
204
|
test('ref is unset', () => {
|
|
207
205
|
expect(theRef.current).toEqual(null);
|
|
208
206
|
});
|
|
209
|
-
describe(
|
|
207
|
+
describe(`navigating to ${expectedPath}`, () => {
|
|
210
208
|
beforeEach(async () => {
|
|
211
209
|
await (0, _react2.waitFor)(async () => {
|
|
212
210
|
await (0, _stripesErmTesting.Button)('SASQRouteButton').click();
|
|
@@ -218,13 +216,13 @@ describe('SASQRoute', () => {
|
|
|
218
216
|
} = renderComponent;
|
|
219
217
|
expect(queryByText('Hello world')).not.toBeInTheDocument();
|
|
220
218
|
});
|
|
221
|
-
test(
|
|
219
|
+
test(`renders SASQRoute lookup component on ${expectedPath}`, () => {
|
|
222
220
|
const {
|
|
223
221
|
getByText
|
|
224
222
|
} = renderComponent;
|
|
225
223
|
expect(getByText(lookupComponentText)).toBeInTheDocument();
|
|
226
224
|
});
|
|
227
|
-
test(
|
|
225
|
+
test(`does not render SASQRoute view component on ${expectedPath}`, () => {
|
|
228
226
|
const {
|
|
229
227
|
queryByText
|
|
230
228
|
} = renderComponent;
|
|
@@ -245,13 +243,13 @@ describe('SASQRoute', () => {
|
|
|
245
243
|
expect(testFetchParametersOnClick).toHaveBeenCalledWith(expectedFetchParameters);
|
|
246
244
|
});
|
|
247
245
|
});
|
|
248
|
-
describe(
|
|
246
|
+
describe(`navigating to ${expectedViewPath}`, () => {
|
|
249
247
|
beforeEach(async () => {
|
|
250
248
|
await (0, _react2.waitFor)(async () => {
|
|
251
249
|
await (0, _stripesErmTesting.Button)('SASQViewButton').click();
|
|
252
250
|
});
|
|
253
251
|
});
|
|
254
|
-
test(
|
|
252
|
+
test(`renders SASQRoute view component on ${expectedViewPath}`, () => {
|
|
255
253
|
const {
|
|
256
254
|
getByText
|
|
257
255
|
} = renderComponent;
|
|
@@ -9,94 +9,86 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _reactQuery = require("react-query");
|
|
10
10
|
var _core = require("@folio/stripes/core");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
const _excluded = ["fetchParameters", "history", "id", "location", "match", "path", "viewQueryPromise", "viewResponseTransform", "ViewComponent", "viewQueryNamespaceGenerator"],
|
|
13
|
-
_excluded2 = ["data"];
|
|
14
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
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; }
|
|
16
|
-
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; }
|
|
17
|
-
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; }
|
|
18
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
|
-
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); }
|
|
20
|
-
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; }
|
|
21
|
-
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; }
|
|
22
13
|
const SASQViewComponent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
23
|
-
var _fetchParameters$item, _match$params, _match$params3;
|
|
24
14
|
let {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
queryNamespace.push('view');
|
|
52
|
-
queryNamespace.push(passedId);
|
|
53
|
-
return queryNamespace;
|
|
15
|
+
fetchParameters,
|
|
16
|
+
history,
|
|
17
|
+
id,
|
|
18
|
+
location,
|
|
19
|
+
match,
|
|
20
|
+
path,
|
|
21
|
+
viewQueryPromise = _ref2 => {
|
|
22
|
+
let {
|
|
23
|
+
endpoint,
|
|
24
|
+
ky,
|
|
25
|
+
resourceId
|
|
26
|
+
} = _ref2;
|
|
27
|
+
return ky.get(`${endpoint}/${resourceId}`).json();
|
|
28
|
+
},
|
|
29
|
+
viewResponseTransform = response => response,
|
|
30
|
+
ViewComponent,
|
|
31
|
+
viewQueryNamespaceGenerator = _ref3 => {
|
|
32
|
+
let {
|
|
33
|
+
namespace,
|
|
34
|
+
componentId,
|
|
35
|
+
id: passedId
|
|
36
|
+
} = _ref3;
|
|
37
|
+
const queryNamespace = [namespace, 'SASQ'];
|
|
38
|
+
if (componentId) {
|
|
39
|
+
queryNamespace.push(componentId);
|
|
54
40
|
}
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
queryNamespace.push('view');
|
|
42
|
+
queryNamespace.push(passedId);
|
|
43
|
+
return queryNamespace;
|
|
44
|
+
},
|
|
45
|
+
...props
|
|
46
|
+
} = _ref;
|
|
57
47
|
const {
|
|
58
48
|
0: namespace
|
|
59
49
|
} = (0, _core.useNamespace)();
|
|
60
50
|
|
|
61
51
|
// If itemEndpoint is available, use that, otherwise use standard endpoint
|
|
62
|
-
const endpoint =
|
|
52
|
+
const endpoint = fetchParameters?.itemEndpoint ?? fetchParameters?.endpoint;
|
|
63
53
|
const ky = (0, _core.useOkapiKy)();
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
} = _useQuery,
|
|
89
|
-
rest = _objectWithoutProperties(_useQuery, _excluded2);
|
|
54
|
+
const {
|
|
55
|
+
data = {},
|
|
56
|
+
...rest
|
|
57
|
+
} = (0, _reactQuery.useQuery)(viewQueryNamespaceGenerator({
|
|
58
|
+
componentId: id,
|
|
59
|
+
namespace,
|
|
60
|
+
endpoint,
|
|
61
|
+
id: match?.params?.id,
|
|
62
|
+
match
|
|
63
|
+
}), () => {
|
|
64
|
+
return viewQueryPromise({
|
|
65
|
+
ky,
|
|
66
|
+
resourceId: match?.params?.id,
|
|
67
|
+
endpoint
|
|
68
|
+
});
|
|
69
|
+
}, {
|
|
70
|
+
enabled: !!match?.params?.id,
|
|
71
|
+
// select is a parameter supported by useQuery to transform the response
|
|
72
|
+
// Could be possible to instead pass this down along with the queryOptions
|
|
73
|
+
// Additionally this is assuming the viewResponseTransform is a func as opposed to an object
|
|
74
|
+
select: selectData => {
|
|
75
|
+
return viewResponseTransform(selectData);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
90
78
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
91
|
-
queryProps:
|
|
92
|
-
data
|
|
93
|
-
|
|
79
|
+
queryProps: {
|
|
80
|
+
data,
|
|
81
|
+
...rest
|
|
82
|
+
}
|
|
94
83
|
}));
|
|
95
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewComponent,
|
|
96
|
-
onClose: () => history.push(
|
|
97
|
-
queryProps:
|
|
98
|
-
|
|
99
|
-
|
|
84
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewComponent, {
|
|
85
|
+
onClose: () => history.push(`${path}${location.search}`),
|
|
86
|
+
queryProps: {
|
|
87
|
+
...rest
|
|
88
|
+
},
|
|
89
|
+
resource: data,
|
|
90
|
+
...props
|
|
91
|
+
});
|
|
100
92
|
});
|
|
101
93
|
SASQViewComponent.propTypes = {
|
|
102
94
|
fetchParameters: _propTypes.default.object,
|
|
@@ -12,11 +12,6 @@ var _jest = require("../../../test/jest");
|
|
|
12
12
|
var _SASQViewComponent = _interopRequireDefault(require("./SASQViewComponent"));
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
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; }
|
|
16
|
-
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; }
|
|
17
|
-
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; }
|
|
18
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
|
-
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); }
|
|
20
15
|
const ViewComponentRender = exports.ViewComponentRender = jest.fn();
|
|
21
16
|
const MockViewComponent = jest.fn(props => {
|
|
22
17
|
ViewComponentRender(props);
|
|
@@ -57,7 +52,8 @@ describe('SASQViewComponent', () => {
|
|
|
57
52
|
initialEntries: [startingLocation],
|
|
58
53
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
59
54
|
path: "/testPath/:id",
|
|
60
|
-
render: routeProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQViewComponent.default,
|
|
55
|
+
render: routeProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQViewComponent.default, {
|
|
56
|
+
...routeProps,
|
|
61
57
|
ref: theRef,
|
|
62
58
|
fetchParameters: {
|
|
63
59
|
endpoint: '/test',
|
|
@@ -69,7 +65,7 @@ describe('SASQViewComponent', () => {
|
|
|
69
65
|
id: "sasq-test",
|
|
70
66
|
path: "/testPath",
|
|
71
67
|
ViewComponent: MockViewComponent
|
|
72
|
-
})
|
|
68
|
+
})
|
|
73
69
|
})
|
|
74
70
|
}));
|
|
75
71
|
});
|
|
@@ -90,7 +86,7 @@ describe('SASQViewComponent', () => {
|
|
|
90
86
|
await (0, _react2.waitFor)(async () => {
|
|
91
87
|
await (0, _stripesErmTesting.Button)('Close').click();
|
|
92
88
|
});
|
|
93
|
-
expect(historyPush).toHaveBeenCalledWith(
|
|
89
|
+
expect(historyPush).toHaveBeenCalledWith(`${expectedPath}${expectedSearch}`);
|
|
94
90
|
});
|
|
95
91
|
test('ref exposes onClose function', async () => {
|
|
96
92
|
await (0, _react2.waitFor)(() => {
|