@k-int/stripes-kint-components 5.31.3 → 5.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- 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 +33 -26
- package/es/lib/ActionList/ActionListFieldArray.js +119 -103
- package/es/lib/ButtonTypedown/ButtonTypedown.js +72 -17
- package/es/lib/ComboButton/ComboButton.js +47 -42
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +17 -11
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +46 -42
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +8 -4
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +33 -32
- 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 +35 -29
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +59 -61
- 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 +12 -11
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +33 -22
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +37 -24
- 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 +6 -3
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +8 -4
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +19 -15
- package/es/lib/CustomProperties/Filter/testResources.js +2 -1
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +2 -1
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +26 -18
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +6 -3
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +11 -7
- package/es/lib/CycleButton/CycleButton.js +17 -9
- package/es/lib/FormModal/FormModal.js +32 -24
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +30 -23
- package/es/lib/IconSelect/IconSelect.js +32 -22
- package/es/lib/NoResultsMessage/NoResultsMessage.js +5 -4
- package/es/lib/NumberField/NumberField.js +25 -17
- package/es/lib/NumberField/NumberField.test.js +7 -6
- package/es/lib/QueryTypedown/QueryTypedown.js +15 -8
- package/es/lib/RefdataButtons/RefdataButtons.js +9 -6
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +60 -48
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +6 -5
- package/es/lib/RichSelect/RichSelect.js +36 -31
- package/es/lib/RichSelect/useSelectedOption.js +2 -1
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +94 -91
- package/es/lib/SASQLookupComponent/SASQLookupComponent.test.js +532 -0
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +58 -43
- package/es/lib/SASQLookupComponent/TableBody/TableBody.test.js +257 -0
- package/es/lib/SASQLookupComponent/__mocks__/SASQLookupComponent.js +33 -0
- package/es/lib/SASQLookupComponent/__mocks__/SASQLookupComponentRender.js +24 -0
- package/es/lib/SASQLookupComponent/__mocks__/index.js +20 -0
- package/es/lib/SASQRoute/SASQRoute.js +29 -25
- package/es/lib/SASQRoute/SASQRoute.test.js +269 -0
- package/es/lib/SASQViewComponent/SASQViewComponent.js +76 -68
- package/es/lib/SASQViewComponent/SASQViewComponent.test.js +108 -0
- package/es/lib/SASQViewComponent/__mocks__/SASQViewComponent.js +19 -0
- package/es/lib/SASQViewComponent/__mocks__/SASQViewComponentRender.js +19 -0
- package/es/lib/SASQViewComponent/__mocks__/index.js +20 -0
- package/es/lib/SearchField/SearchField.js +13 -7
- package/es/lib/SearchKeyControl/SearchKeyControl.js +13 -8
- package/es/lib/SearchKeyControl/SearchKeyControl.test.js +6 -2
- package/es/lib/Settings/EditableRefdataCategoryList/EditableRefdataCategoryList.js +46 -30
- package/es/lib/Settings/EditableRefdataList/EditableRefdataList.js +43 -33
- package/es/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +12 -8
- package/es/lib/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js +20 -13
- package/es/lib/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js +12 -10
- package/es/lib/Settings/EditableSettingsList/SettingField/SettingField.js +15 -10
- package/es/lib/Settings/EditableSettingsList/SettingField/SettingField.test.js +3 -3
- package/es/lib/Settings/RefdataCategoriesSettings/RefdataCategoriesSettings.js +26 -19
- package/es/lib/Settings/SettingPage/SettingPagePane/SettingPagePane.js +2 -2
- package/es/lib/Settings/Settings/Settings.js +158 -0
- package/es/lib/Settings/Settings/index.js +13 -0
- package/es/lib/Settings/SettingsFormContainer/SettingsFormContainer.js +35 -30
- package/es/lib/Settings/StaticSettingsField/StaticSettingsField.js +8 -5
- package/es/lib/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js +22 -18
- 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 +7 -3
- package/es/lib/Settings/hooks/useAppSettings/useAppSettings.js +11 -7
- package/es/lib/Settings/hooks/useSettingSection/useSettingSection.js +22 -16
- package/es/lib/Settings/hooks/useSettings/useSettings.js +69 -63
- package/es/lib/Tags/Tags.js +8 -5
- package/es/lib/Tags/hooks/useTags.js +1 -1
- package/es/lib/Tags/hooks/useTagsEnabled.js +3 -2
- package/es/lib/Tags/tagsConfig.js +1 -1
- package/es/lib/Typedown/Typedown.js +31 -21
- package/es/lib/hooks/__mocks__/index.js +7 -3
- package/es/lib/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js +26 -20
- package/es/lib/hooks/intlHooks/useKintIntl/useKintIntl.js +34 -24
- package/es/lib/hooks/typedownHooks/useTypedown.js +12 -11
- 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 +10 -6
- package/es/lib/hooks/useHelperApp.js +16 -13
- package/es/lib/hooks/useKiwtFieldArray.js +8 -7
- package/es/lib/hooks/useKiwtSASQuery.js +19 -15
- package/es/lib/hooks/useLocalPageStore.js +10 -7
- package/es/lib/hooks/useModConfigEntries.js +2 -2
- package/es/lib/hooks/useMutateCustomProperties/useMutateCustomProperties.js +17 -10
- package/es/lib/hooks/useMutateGeneric/useMutateGeneric.js +2 -2
- package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
- package/es/lib/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js +21 -15
- package/es/lib/hooks/useMutateRefdataValue/useMutateRefdataValue.js +23 -16
- package/es/lib/hooks/usePrevNextPagination.js +19 -17
- package/es/lib/hooks/useQIndex.js +14 -11
- package/es/lib/hooks/useRefdata.js +3 -3
- package/es/lib/hooks/useStandaloneSASQQueryParameter/useStandaloneSASQQueryParameter.js +13 -9
- package/es/lib/hooks/useTemplates.js +4 -4
- package/es/lib/utils/buildUrl.js +3 -2
- 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 +107 -94
- package/es/lib/utils/groupCustomPropertiesByCtx.js +9 -5
- package/es/lib/utils/matchString.js +7 -5
- package/es/lib/utils/parseErrorResponse.js +7 -3
- package/es/lib/utils/selectorSafe.js +3 -2
- package/es/lib/utils/sortByLabel.js +3 -2
- package/es/lib/validators/validators.js +9 -6
- package/package.json +5 -1
- package/src/artifacts/coverage-jest/ActionList/ActionList.js.html +4 -4
- package/src/artifacts/coverage-jest/ActionList/ActionListFieldArray.js.html +10 -10
- 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 +217 -25
- package/src/artifacts/coverage-jest/ButtonTypedown/index.html +17 -17
- package/src/artifacts/coverage-jest/ButtonTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/ComboButton/ComboButton.js.html +3 -3
- 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 +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesSettings.js.html +6 -6
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyForm.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyView.js.html +3 -3
- 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 +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesListField.js.html +5 -5
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyField.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyFormCard.js.html +3 -3
- 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 +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterField.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesRule.js.html +4 -4
- 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 +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Filter/useParseActiveFilterStrings.js.html +2 -2
- package/src/artifacts/coverage-jest/CustomProperties/Filter/useValueProps.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesView.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesViewCtx.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertyCard.js.html +3 -3
- 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 +3 -3
- 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 +2 -2
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +6 -6
- 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 +2 -2
- package/src/artifacts/coverage-jest/RichSelect/RichSelect.js.html +3 -3
- 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 +2 -2
- package/src/artifacts/coverage-jest/SASQLookupComponent/SASQLookupComponent.js.html +146 -149
- package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/TableBody.js.html +74 -65
- package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.html +21 -21
- package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/index.html +21 -21
- package/src/artifacts/coverage-jest/SASQLookupComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQRoute/SASQRoute.js.html +43 -43
- package/src/artifacts/coverage-jest/SASQRoute/index.html +21 -21
- package/src/artifacts/coverage-jest/SASQRoute/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQViewComponent/SASQViewComponent.js.html +42 -42
- package/src/artifacts/coverage-jest/SASQViewComponent/index.html +21 -21
- package/src/artifacts/coverage-jest/SASQViewComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SearchField/SearchField.js.html +4 -4
- 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 +3 -3
- 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 +4 -4
- 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 +4 -4
- 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 +3 -3
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js.html +5 -5
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +4 -4
- 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 +3 -3
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/SettingPagePane.js.html +3 -3
- 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 +643 -0
- package/src/artifacts/coverage-jest/Settings/Settings/index.html +131 -0
- package/src/artifacts/coverage-jest/Settings/Settings/index.js.html +88 -0
- package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/SettingsFormContainer.js.html +3 -3
- 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 +3 -3
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js.html +2 -2
- 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 +5 -5
- package/src/artifacts/coverage-jest/Settings/contexts/SettingsContext.js.html +2 -2
- 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 +2 -2
- 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 +2 -2
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useStaticSettingsSection.js.html +2 -2
- 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 +2 -2
- 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 +2 -2
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.html +12 -12
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/useSettings.js.html +33 -15
- 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 +3 -3
- 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 +2 -2
- package/src/artifacts/coverage-jest/Tags/hooks/useTagsEnabled.js.html +8 -8
- 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 +5 -5
- package/src/artifacts/coverage-jest/Typedown/Typedown.js.html +15 -6
- 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 +1006 -839
- package/src/artifacts/coverage-jest/constants/comparators.js.html +1 -1
- package/src/artifacts/coverage-jest/constants/customProperties.js.html +12 -12
- package/src/artifacts/coverage-jest/constants/endpoints.js.html +4 -4
- package/src/artifacts/coverage-jest/constants/eventCodes.js.html +4 -4
- package/src/artifacts/coverage-jest/constants/index.html +1 -1
- package/src/artifacts/coverage-jest/constants/pagination.js.html +6 -6
- package/src/artifacts/coverage-jest/hooks/index.html +51 -51
- 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 +8 -8
- 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 +12 -12
- 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 +10 -10
- 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 +2 -2
- package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownData.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownToggle.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useActionListRef.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useActiveElement.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useCustomProperties.js.html +3 -3
- package/src/artifacts/coverage-jest/hooks/useHelperApp.js.html +2 -2
- 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 +2 -2
- package/src/artifacts/coverage-jest/hooks/useKiwtSASQuery.js.html +48 -48
- package/src/artifacts/coverage-jest/hooks/useLocalPageStore.js.html +3 -3
- package/src/artifacts/coverage-jest/hooks/useLocalStorageState.js.html +22 -22
- package/src/artifacts/coverage-jest/hooks/useModConfigEntries.js.html +3 -3
- 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 +2 -2
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.js.html +5 -2
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/useMutateGeneric.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useMutateModConfigEntry.js.html +2 -2
- 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 +2 -2
- 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 +2 -2
- package/src/artifacts/coverage-jest/hooks/usePrevNextPagination.js.html +68 -68
- package/src/artifacts/coverage-jest/hooks/useQIndex.js.html +28 -28
- package/src/artifacts/coverage-jest/hooks/useRefdata.js.html +3 -3
- package/src/artifacts/coverage-jest/hooks/useSASQQueryMeta.js.html +2 -2
- 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 +2 -2
- package/src/artifacts/coverage-jest/hooks/useTemplates.js.html +2 -2
- package/src/artifacts/coverage-jest/index.html +115 -100
- package/src/artifacts/coverage-jest/utils/buildUrl.js.html +34 -34
- 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 +67 -67
- 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/highlightString.js.html +3 -3
- package/src/artifacts/coverage-jest/utils/index.html +22 -22
- package/src/artifacts/coverage-jest/utils/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/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/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 +8 -8
- package/src/lib/ButtonTypedown/ButtonTypedown.js +77 -13
- package/src/lib/SASQLookupComponent/SASQLookupComponent.js +3 -4
- package/src/lib/SASQLookupComponent/SASQLookupComponent.test.js +495 -0
- package/src/lib/SASQLookupComponent/TableBody/TableBody.js +6 -3
- package/src/lib/SASQLookupComponent/TableBody/TableBody.test.js +247 -0
- package/src/lib/SASQLookupComponent/__mocks__/SASQLookupComponent.js +31 -0
- package/src/lib/SASQLookupComponent/__mocks__/SASQLookupComponentRender.js +20 -0
- package/src/lib/SASQLookupComponent/__mocks__/index.js +2 -0
- package/src/lib/SASQRoute/SASQRoute.test.js +281 -0
- package/src/lib/SASQViewComponent/SASQViewComponent.test.js +114 -0
- package/src/lib/SASQViewComponent/__mocks__/SASQViewComponent.js +13 -0
- package/src/lib/SASQViewComponent/__mocks__/SASQViewComponentRender.js +17 -0
- package/src/lib/SASQViewComponent/__mocks__/index.js +2 -0
- package/src/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +1 -1
- package/src/lib/Settings/Settings/Settings.js +186 -0
- package/src/lib/Settings/Settings/index.js +1 -0
- package/src/lib/Settings/hooks/useSettings/useSettings.js +13 -7
- package/src/lib/Typedown/Typedown.js +4 -1
- package/src/lib/hooks/useMutateGeneric/index.js +1 -1
- package/styles/TypeDown.css +2 -2
- package/test/helpers/test-implementor-translations.json +2 -1
- package/test/helpers/translationsProperties.js +1 -1
- package/test/jest/setupTests.js +1 -1
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = require("react");
|
|
4
|
+
var _reactRouterDom = require("react-router-dom");
|
|
5
|
+
var _react2 = require("@folio/jest-config-stripes/testing-library/react");
|
|
6
|
+
var _components = require("@folio/stripes/components");
|
|
7
|
+
var _stripesErmTesting = require("@folio/stripes-erm-testing");
|
|
8
|
+
var _jest = require("../../../test/jest");
|
|
9
|
+
var _SASQRoute = _interopRequireDefault(require("./SASQRoute"));
|
|
10
|
+
var _SASQLookupComponent = require("../SASQLookupComponent");
|
|
11
|
+
var _SASQViewComponent = require("../SASQViewComponent");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
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
|
|
19
|
+
// Using Manual mocks
|
|
20
|
+
jest.mock('../SASQLookupComponent');
|
|
21
|
+
jest.mock('../SASQViewComponent');
|
|
22
|
+
const testFetchParametersOnClick = jest.fn();
|
|
23
|
+
let theRef;
|
|
24
|
+
describe('SASQRoute', () => {
|
|
25
|
+
describe.each([{
|
|
26
|
+
testLabel: 'default behaviour on path /testPath',
|
|
27
|
+
props: {
|
|
28
|
+
fetchParameters: {
|
|
29
|
+
SASQ_MAP: {}
|
|
30
|
+
},
|
|
31
|
+
path: '/testPath'
|
|
32
|
+
},
|
|
33
|
+
expectedPath: '/testPath',
|
|
34
|
+
expectedViewPath: '/testPath/testId',
|
|
35
|
+
expectedFetchParameters: {
|
|
36
|
+
SASQ_MAP: {
|
|
37
|
+
perPage: 25,
|
|
38
|
+
stats: true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
lookupComponentText: 'SASQLookupComponent',
|
|
42
|
+
viewComponentText: 'SASQViewComponent'
|
|
43
|
+
}, {
|
|
44
|
+
testLabel: 'with passed getPathLookup and getPathView',
|
|
45
|
+
props: {
|
|
46
|
+
fetchParameters: {
|
|
47
|
+
SASQ_MAP: {}
|
|
48
|
+
},
|
|
49
|
+
getPathLookup: () => '/wibble/:id?',
|
|
50
|
+
getPathView: () => '/wibble/extra-param/:id'
|
|
51
|
+
// path: '/testPath' // FIXME it turns out if you pass a path in then that gets used by parent Switch
|
|
52
|
+
// In addition one can't easily set just the view path since it needs to be rendered within the lookup path...
|
|
53
|
+
// not the most helpful props to be honest -- see ILL SharedIndexRoute for the current only usage
|
|
54
|
+
},
|
|
55
|
+
expectedPath: '/wibble',
|
|
56
|
+
expectedViewPath: '/wibble/extra-param/testId',
|
|
57
|
+
expectedFetchParameters: {
|
|
58
|
+
SASQ_MAP: {
|
|
59
|
+
perPage: 25,
|
|
60
|
+
stats: true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
lookupComponentText: 'SASQLookupComponent',
|
|
64
|
+
viewComponentText: 'SASQViewComponent'
|
|
65
|
+
}, {
|
|
66
|
+
testLabel: 'with passed SASQLookupComponent',
|
|
67
|
+
props: {
|
|
68
|
+
fetchParameters: {
|
|
69
|
+
SASQ_MAP: {}
|
|
70
|
+
},
|
|
71
|
+
path: '/testPath'
|
|
72
|
+
},
|
|
73
|
+
expectedPath: '/testPath',
|
|
74
|
+
expectedViewPath: '/testPath/testId',
|
|
75
|
+
expectedFetchParameters: {
|
|
76
|
+
SASQ_MAP: {
|
|
77
|
+
perPage: 25,
|
|
78
|
+
stats: true
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
lookupComponentText: 'Special Test Lookup Component',
|
|
82
|
+
viewComponentText: 'SASQViewComponent',
|
|
83
|
+
mockLookupComponent: _ref => {
|
|
84
|
+
let {
|
|
85
|
+
children
|
|
86
|
+
} = _ref;
|
|
87
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
88
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
89
|
+
children: "Special Test Lookup Component"
|
|
90
|
+
}), children]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
testLabel: 'with passed SASQViewComponent',
|
|
95
|
+
props: {
|
|
96
|
+
fetchParameters: {
|
|
97
|
+
SASQ_MAP: {}
|
|
98
|
+
},
|
|
99
|
+
path: '/testPath'
|
|
100
|
+
},
|
|
101
|
+
expectedPath: '/testPath',
|
|
102
|
+
expectedViewPath: '/testPath/testId',
|
|
103
|
+
expectedFetchParameters: {
|
|
104
|
+
SASQ_MAP: {
|
|
105
|
+
perPage: 25,
|
|
106
|
+
stats: true
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
lookupComponentText: 'SASQLookupComponent',
|
|
110
|
+
viewComponentText: 'Special Test View Component',
|
|
111
|
+
mockViewComponent: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
112
|
+
children: "Special Test View Component"
|
|
113
|
+
})
|
|
114
|
+
}, {
|
|
115
|
+
testLabel: 'with passed fetchParameters',
|
|
116
|
+
props: {
|
|
117
|
+
fetchParameters: {
|
|
118
|
+
wibble: 3,
|
|
119
|
+
// Test that fetchParams don't get lost
|
|
120
|
+
SASQ_MAP: {
|
|
121
|
+
wobble: 'igneous',
|
|
122
|
+
// Test that fetchParams.SASQ_MAP params don't get lost
|
|
123
|
+
perPage: 20,
|
|
124
|
+
// Test that fetchParams.SASQ_MAP.perPage is only defaulted, not overridden
|
|
125
|
+
stats: false // This tests that stats gets overridden
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
path: '/testPath'
|
|
129
|
+
},
|
|
130
|
+
expectedPath: '/testPath',
|
|
131
|
+
expectedViewPath: '/testPath/testId',
|
|
132
|
+
expectedFetchParameters: {
|
|
133
|
+
wibble: 3,
|
|
134
|
+
SASQ_MAP: {
|
|
135
|
+
wobble: 'igneous',
|
|
136
|
+
perPage: 20,
|
|
137
|
+
stats: true
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
lookupComponentText: 'SASQLookupComponent',
|
|
141
|
+
viewComponentText: 'SASQViewComponent'
|
|
142
|
+
}])('Testing $testLabel', _ref2 => {
|
|
143
|
+
let {
|
|
144
|
+
expectedPath,
|
|
145
|
+
expectedViewPath,
|
|
146
|
+
expectedFetchParameters,
|
|
147
|
+
props,
|
|
148
|
+
lookupComponentText,
|
|
149
|
+
viewComponentText,
|
|
150
|
+
mockLookupComponent,
|
|
151
|
+
mockViewComponent
|
|
152
|
+
} = _ref2;
|
|
153
|
+
let renderComponent;
|
|
154
|
+
beforeEach(() => {
|
|
155
|
+
testFetchParametersOnClick.mockClear();
|
|
156
|
+
|
|
157
|
+
// Set up a ref we can pass around -- new per test (block)
|
|
158
|
+
theRef = /*#__PURE__*/(0, _react.createRef)();
|
|
159
|
+
|
|
160
|
+
// EXAMPLE we set up a special "mockResetToDefault" on the manual mock objects specifically
|
|
161
|
+
// to return to the original implementation
|
|
162
|
+
// We could potentially have used jest spyOn and restore, but this already took me too long to figure out...
|
|
163
|
+
if (mockLookupComponent) {
|
|
164
|
+
_SASQLookupComponent.SASQLookupComponentRender.mockImplementation(mockLookupComponent);
|
|
165
|
+
} else {
|
|
166
|
+
_SASQLookupComponent.SASQLookupComponentRender.mockResetToDefault();
|
|
167
|
+
}
|
|
168
|
+
if (mockViewComponent) {
|
|
169
|
+
_SASQViewComponent.SASQViewComponentRender.mockImplementation(mockViewComponent);
|
|
170
|
+
} else {
|
|
171
|
+
_SASQViewComponent.SASQViewComponentRender.mockResetToDefault();
|
|
172
|
+
}
|
|
173
|
+
renderComponent = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.MemoryRouter, {
|
|
174
|
+
initialEntries: ['/hello'],
|
|
175
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
176
|
+
to: expectedPath,
|
|
177
|
+
children: "SASQRouteButton"
|
|
178
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
179
|
+
to: expectedViewPath,
|
|
180
|
+
children: "SASQViewButton"
|
|
181
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.Switch, {
|
|
182
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
183
|
+
path: "/hello",
|
|
184
|
+
children: "Hello world"
|
|
185
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQRoute.default, _objectSpread({
|
|
186
|
+
ref: theRef
|
|
187
|
+
// Allow for testing of fetch parameters
|
|
188
|
+
,
|
|
189
|
+
testFetchParametersOnClick: testFetchParametersOnClick
|
|
190
|
+
}, props))]
|
|
191
|
+
})]
|
|
192
|
+
}));
|
|
193
|
+
});
|
|
194
|
+
test('does not render SASQRoute on /hello', () => {
|
|
195
|
+
const {
|
|
196
|
+
queryByText
|
|
197
|
+
} = renderComponent;
|
|
198
|
+
expect(queryByText(lookupComponentText)).not.toBeInTheDocument();
|
|
199
|
+
});
|
|
200
|
+
test('renders hello world text', () => {
|
|
201
|
+
const {
|
|
202
|
+
getByText
|
|
203
|
+
} = renderComponent;
|
|
204
|
+
expect(getByText('Hello world')).toBeInTheDocument();
|
|
205
|
+
});
|
|
206
|
+
test('ref is unset', () => {
|
|
207
|
+
expect(theRef.current).toEqual(null);
|
|
208
|
+
});
|
|
209
|
+
describe("navigating to ".concat(expectedPath), () => {
|
|
210
|
+
beforeEach(async () => {
|
|
211
|
+
await (0, _react2.waitFor)(async () => {
|
|
212
|
+
await (0, _stripesErmTesting.Button)('SASQRouteButton').click();
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
test('no longer renders hello world text', () => {
|
|
216
|
+
const {
|
|
217
|
+
queryByText
|
|
218
|
+
} = renderComponent;
|
|
219
|
+
expect(queryByText('Hello world')).not.toBeInTheDocument();
|
|
220
|
+
});
|
|
221
|
+
test("renders SASQRoute lookup component on ".concat(expectedPath), () => {
|
|
222
|
+
const {
|
|
223
|
+
getByText
|
|
224
|
+
} = renderComponent;
|
|
225
|
+
expect(getByText(lookupComponentText)).toBeInTheDocument();
|
|
226
|
+
});
|
|
227
|
+
test("does not render SASQRoute view component on ".concat(expectedPath), () => {
|
|
228
|
+
const {
|
|
229
|
+
queryByText
|
|
230
|
+
} = renderComponent;
|
|
231
|
+
expect(queryByText(viewComponentText)).not.toBeInTheDocument();
|
|
232
|
+
});
|
|
233
|
+
test('ref has gained lookup component ref data', () => {
|
|
234
|
+
expect(theRef.current).toEqual({
|
|
235
|
+
lookupRefData: 'mocked lookup data'
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
describe('testing fetchParameters', () => {
|
|
239
|
+
beforeEach(async () => {
|
|
240
|
+
await (0, _react2.waitFor)(async () => {
|
|
241
|
+
await (0, _stripesErmTesting.Button)('Test fetchParameters').click();
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
test('testFetchParametersOnClick was called with expected values', () => {
|
|
245
|
+
expect(testFetchParametersOnClick).toHaveBeenCalledWith(expectedFetchParameters);
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
describe("navigating to ".concat(expectedViewPath), () => {
|
|
249
|
+
beforeEach(async () => {
|
|
250
|
+
await (0, _react2.waitFor)(async () => {
|
|
251
|
+
await (0, _stripesErmTesting.Button)('SASQViewButton').click();
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
test("renders SASQRoute view component on ".concat(expectedViewPath), () => {
|
|
255
|
+
const {
|
|
256
|
+
getByText
|
|
257
|
+
} = renderComponent;
|
|
258
|
+
expect(getByText(viewComponentText)).toBeInTheDocument();
|
|
259
|
+
});
|
|
260
|
+
test('ref has gained view component ref data', () => {
|
|
261
|
+
expect(theRef.current).toEqual({
|
|
262
|
+
lookupRefData: 'mocked lookup data',
|
|
263
|
+
viewRefData: 'mocked view data'
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
});
|
|
@@ -9,86 +9,94 @@ 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"];
|
|
12
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
|
+
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; }
|
|
13
22
|
const SASQViewComponent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
23
|
+
var _fetchParameters$item, _match$params, _match$params3;
|
|
14
24
|
let {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
fetchParameters,
|
|
26
|
+
history,
|
|
27
|
+
id,
|
|
28
|
+
location,
|
|
29
|
+
match,
|
|
30
|
+
path,
|
|
31
|
+
viewQueryPromise = _ref2 => {
|
|
32
|
+
let {
|
|
33
|
+
endpoint,
|
|
34
|
+
ky,
|
|
35
|
+
resourceId
|
|
36
|
+
} = _ref2;
|
|
37
|
+
return ky.get("".concat(endpoint, "/").concat(resourceId)).json();
|
|
38
|
+
},
|
|
39
|
+
viewResponseTransform = response => response,
|
|
40
|
+
ViewComponent,
|
|
41
|
+
viewQueryNamespaceGenerator = _ref3 => {
|
|
42
|
+
let {
|
|
43
|
+
namespace,
|
|
44
|
+
componentId,
|
|
45
|
+
id: passedId
|
|
46
|
+
} = _ref3;
|
|
47
|
+
const queryNamespace = [namespace, 'SASQ'];
|
|
48
|
+
if (componentId) {
|
|
49
|
+
queryNamespace.push(componentId);
|
|
50
|
+
}
|
|
51
|
+
queryNamespace.push('view');
|
|
52
|
+
queryNamespace.push(passedId);
|
|
53
|
+
return queryNamespace;
|
|
40
54
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return queryNamespace;
|
|
44
|
-
},
|
|
45
|
-
...props
|
|
46
|
-
} = _ref;
|
|
55
|
+
} = _ref,
|
|
56
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
47
57
|
const {
|
|
48
58
|
0: namespace
|
|
49
59
|
} = (0, _core.useNamespace)();
|
|
50
60
|
|
|
51
61
|
// If itemEndpoint is available, use that, otherwise use standard endpoint
|
|
52
|
-
const endpoint = fetchParameters
|
|
62
|
+
const endpoint = (_fetchParameters$item = fetchParameters === null || fetchParameters === void 0 ? void 0 : fetchParameters.itemEndpoint) !== null && _fetchParameters$item !== void 0 ? _fetchParameters$item : fetchParameters === null || fetchParameters === void 0 ? void 0 : fetchParameters.endpoint;
|
|
53
63
|
const ky = (0, _core.useOkapiKy)();
|
|
54
|
-
const {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
const _useQuery = (0, _reactQuery.useQuery)(viewQueryNamespaceGenerator({
|
|
65
|
+
componentId: id,
|
|
66
|
+
namespace,
|
|
67
|
+
endpoint,
|
|
68
|
+
id: match === null || match === void 0 || (_match$params = match.params) === null || _match$params === void 0 ? void 0 : _match$params.id,
|
|
69
|
+
match
|
|
70
|
+
}), () => {
|
|
71
|
+
var _match$params2;
|
|
72
|
+
return viewQueryPromise({
|
|
73
|
+
ky,
|
|
74
|
+
resourceId: match === null || match === void 0 || (_match$params2 = match.params) === null || _match$params2 === void 0 ? void 0 : _match$params2.id,
|
|
75
|
+
endpoint
|
|
76
|
+
});
|
|
77
|
+
}, {
|
|
78
|
+
enabled: !!(match !== null && match !== void 0 && (_match$params3 = match.params) !== null && _match$params3 !== void 0 && _match$params3.id),
|
|
79
|
+
// select is a parameter supported by useQuery to transform the response
|
|
80
|
+
// Could be possible to instead pass this down along with the queryOptions
|
|
81
|
+
// Additionally this is assuming the viewResponseTransform is a func as opposed to an object
|
|
82
|
+
select: selectData => {
|
|
83
|
+
return viewResponseTransform(selectData);
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
{
|
|
87
|
+
data = {}
|
|
88
|
+
} = _useQuery,
|
|
89
|
+
rest = _objectWithoutProperties(_useQuery, _excluded2);
|
|
78
90
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
79
|
-
queryProps: {
|
|
80
|
-
data
|
|
81
|
-
|
|
82
|
-
}
|
|
91
|
+
queryProps: _objectSpread({
|
|
92
|
+
data
|
|
93
|
+
}, rest)
|
|
83
94
|
}));
|
|
84
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewComponent, {
|
|
85
|
-
onClose: () => history.push(
|
|
86
|
-
queryProps: {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
resource: data,
|
|
90
|
-
...props
|
|
91
|
-
});
|
|
95
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewComponent, _objectSpread({
|
|
96
|
+
onClose: () => history.push("".concat(path).concat(location.search)),
|
|
97
|
+
queryProps: _objectSpread({}, rest),
|
|
98
|
+
resource: data
|
|
99
|
+
}, props));
|
|
92
100
|
});
|
|
93
101
|
SASQViewComponent.propTypes = {
|
|
94
102
|
fetchParameters: _propTypes.default.object,
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ViewComponentRender = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactRouterDom = require("react-router-dom");
|
|
9
|
+
var _react2 = require("@folio/jest-config-stripes/testing-library/react");
|
|
10
|
+
var _stripesErmTesting = require("@folio/stripes-erm-testing");
|
|
11
|
+
var _jest = require("../../../test/jest");
|
|
12
|
+
var _SASQViewComponent = _interopRequireDefault(require("./SASQViewComponent"));
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
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
|
+
const ViewComponentRender = exports.ViewComponentRender = jest.fn();
|
|
21
|
+
const MockViewComponent = jest.fn(props => {
|
|
22
|
+
ViewComponentRender(props);
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
24
|
+
children: ["SASQViewComponent", /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
25
|
+
onClick: props.onClose,
|
|
26
|
+
type: "button",
|
|
27
|
+
children: "Close"
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe('SASQViewComponent', () => {
|
|
32
|
+
let theRef;
|
|
33
|
+
let historyPush;
|
|
34
|
+
describe.each([{
|
|
35
|
+
testLabel: 'default behaviour',
|
|
36
|
+
startingLocation: '/testPath/testId',
|
|
37
|
+
expectedPath: '/testPath',
|
|
38
|
+
expectedSearch: ''
|
|
39
|
+
}, {
|
|
40
|
+
testLabel: 'with query params',
|
|
41
|
+
startingLocation: '/testPath/testId?filters=test&page=1',
|
|
42
|
+
expectedPath: '/testPath',
|
|
43
|
+
expectedSearch: '?filters=test&page=1'
|
|
44
|
+
}])('Testing $testLabel', _ref => {
|
|
45
|
+
let {
|
|
46
|
+
startingLocation,
|
|
47
|
+
expectedPath,
|
|
48
|
+
expectedSearch
|
|
49
|
+
} = _ref;
|
|
50
|
+
let renderResult;
|
|
51
|
+
beforeEach(() => {
|
|
52
|
+
ViewComponentRender.mockClear();
|
|
53
|
+
MockViewComponent.mockClear();
|
|
54
|
+
historyPush = jest.fn();
|
|
55
|
+
theRef = /*#__PURE__*/(0, _react.createRef)();
|
|
56
|
+
renderResult = (0, _jest.renderWithKintHarness)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
57
|
+
initialEntries: [startingLocation],
|
|
58
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
59
|
+
path: "/testPath/:id",
|
|
60
|
+
render: routeProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQViewComponent.default, _objectSpread(_objectSpread({}, routeProps), {}, {
|
|
61
|
+
ref: theRef,
|
|
62
|
+
fetchParameters: {
|
|
63
|
+
endpoint: '/test',
|
|
64
|
+
itemEndpoint: '/test'
|
|
65
|
+
},
|
|
66
|
+
history: {
|
|
67
|
+
push: historyPush
|
|
68
|
+
},
|
|
69
|
+
id: "sasq-test",
|
|
70
|
+
path: "/testPath",
|
|
71
|
+
ViewComponent: MockViewComponent
|
|
72
|
+
}))
|
|
73
|
+
})
|
|
74
|
+
}));
|
|
75
|
+
});
|
|
76
|
+
test('renders the view component', async () => {
|
|
77
|
+
const {
|
|
78
|
+
getByText
|
|
79
|
+
} = renderResult;
|
|
80
|
+
await (0, _react2.waitFor)(() => {
|
|
81
|
+
expect(getByText('SASQViewComponent')).toBeInTheDocument();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
test('calls the ViewComponent', async () => {
|
|
85
|
+
await (0, _react2.waitFor)(() => {
|
|
86
|
+
expect(ViewComponentRender).toHaveBeenCalled();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
test('onClose navigates back to list path', async () => {
|
|
90
|
+
await (0, _react2.waitFor)(async () => {
|
|
91
|
+
await (0, _stripesErmTesting.Button)('Close').click();
|
|
92
|
+
});
|
|
93
|
+
expect(historyPush).toHaveBeenCalledWith("".concat(expectedPath).concat(expectedSearch));
|
|
94
|
+
});
|
|
95
|
+
test('ref exposes onClose function', async () => {
|
|
96
|
+
await (0, _react2.waitFor)(() => {
|
|
97
|
+
expect(theRef.current).toBeTruthy();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
test('ref exposes queryProps', async () => {
|
|
101
|
+
await (0, _react2.waitFor)(() => {
|
|
102
|
+
expect(theRef.current).toBeTruthy();
|
|
103
|
+
});
|
|
104
|
+
expect(theRef.current.queryProps).toBeDefined();
|
|
105
|
+
expect(theRef.current.queryProps.data).toBeDefined();
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _SASQViewComponentRender = _interopRequireDefault(require("./SASQViewComponentRender"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const SASQViewComponent = /*#__PURE__*/(0, _react.forwardRef)((_props, ref) => {
|
|
12
|
+
// Use useImperativeHandle to expose a mock object
|
|
13
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
14
|
+
// This is the object the ref will point to
|
|
15
|
+
viewRefData: 'mocked view data'
|
|
16
|
+
}));
|
|
17
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQViewComponentRender.default, {});
|
|
18
|
+
});
|
|
19
|
+
var _default = exports.default = SASQViewComponent;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
// We deal with the render part separately to the forwardRef part so that we might mock them separately as well
|
|
9
|
+
// Store the original implementation so we can restore it with a single call on the mock
|
|
10
|
+
const originalRenderImplementation = () => {
|
|
11
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
12
|
+
children: "SASQViewComponent"
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
const SASQViewComponentRender = jest.fn(originalRenderImplementation);
|
|
16
|
+
SASQViewComponentRender.mockResetToDefault = () => {
|
|
17
|
+
SASQViewComponentRender.mockImplementation(originalRenderImplementation);
|
|
18
|
+
};
|
|
19
|
+
var _default = exports.default = SASQViewComponentRender;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "SASQViewComponentRender", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _SASQViewComponentRender.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "default", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _SASQViewComponent.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _SASQViewComponent = _interopRequireDefault(require("./SASQViewComponent"));
|
|
19
|
+
var _SASQViewComponentRender = _interopRequireDefault(require("./SASQViewComponentRender"));
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -9,8 +9,15 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _components = require("@folio/stripes/components");
|
|
10
10
|
var _SearchField = _interopRequireDefault(require("../../../styles/SearchField.css"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
const _excluded = ["ariaLabel"]; // Accepts the same props as TextField
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
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); }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
14
21
|
const propTypes = {
|
|
15
22
|
ariaLabel: _propTypes.default.string,
|
|
16
23
|
clearSearchId: _propTypes.default.string,
|
|
@@ -19,23 +26,22 @@ const propTypes = {
|
|
|
19
26
|
};
|
|
20
27
|
const SearchField = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
21
28
|
const {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
ariaLabel
|
|
30
|
+
} = props,
|
|
31
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
25
32
|
const searchIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
26
33
|
icon: "search",
|
|
27
34
|
iconClassName: _SearchField.default.searchIcon,
|
|
28
35
|
size: "small"
|
|
29
36
|
});
|
|
30
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextField, {
|
|
31
|
-
...rest,
|
|
37
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextField, _objectSpread(_objectSpread({}, rest), {}, {
|
|
32
38
|
"aria-label": rest['aria-label'] || ariaLabel,
|
|
33
39
|
focussedclass: _SearchField.default.isFocused,
|
|
34
40
|
hasClearIcon: true,
|
|
35
41
|
inputRef: ref,
|
|
36
42
|
startControl: searchIcon,
|
|
37
43
|
type: "search"
|
|
38
|
-
});
|
|
44
|
+
}));
|
|
39
45
|
});
|
|
40
46
|
SearchField.propTypes = propTypes;
|
|
41
47
|
var _default = exports.default = SearchField;
|