@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
|
@@ -8,7 +8,6 @@ var _reactQuery = require("react-query");
|
|
|
8
8
|
var _core = require("@folio/stripes/core");
|
|
9
9
|
var _utils = require("../../../utils");
|
|
10
10
|
const useAppSettings = _ref => {
|
|
11
|
-
var _ref2, _ref3, _queryObject$data2;
|
|
12
11
|
let {
|
|
13
12
|
endpoint,
|
|
14
13
|
keyName,
|
|
@@ -24,32 +23,29 @@ const useAppSettings = _ref => {
|
|
|
24
23
|
};
|
|
25
24
|
const namespaceArray = [endpoint];
|
|
26
25
|
if (sectionName) {
|
|
27
|
-
|
|
28
|
-
defaultQueryParamObject.filters = [...((_defaultQueryParamObj = defaultQueryParamObject.filters) !== null && _defaultQueryParamObj !== void 0 ? _defaultQueryParamObj : []), {
|
|
26
|
+
defaultQueryParamObject.filters = [...(defaultQueryParamObject.filters ?? []), {
|
|
29
27
|
path: 'section',
|
|
30
28
|
value: sectionName
|
|
31
29
|
}];
|
|
32
30
|
namespaceArray.push(sectionName);
|
|
33
31
|
}
|
|
34
32
|
if (keyName) {
|
|
35
|
-
|
|
36
|
-
defaultQueryParamObject.filters = [...((_defaultQueryParamObj2 = defaultQueryParamObject.filters) !== null && _defaultQueryParamObj2 !== void 0 ? _defaultQueryParamObj2 : []), {
|
|
33
|
+
defaultQueryParamObject.filters = [...(defaultQueryParamObject.filters ?? []), {
|
|
37
34
|
path: 'key',
|
|
38
35
|
value: keyName
|
|
39
36
|
}];
|
|
40
37
|
defaultQueryParamObject.perPage = 1;
|
|
41
38
|
namespaceArray.push(keyName);
|
|
42
39
|
}
|
|
43
|
-
const queryParamArray = (0, _utils.generateKiwtQueryParams)(options
|
|
40
|
+
const queryParamArray = (0, _utils.generateKiwtQueryParams)(options ?? defaultQueryParamObject, {});
|
|
44
41
|
namespaceArray.push(queryParamArray);
|
|
45
|
-
const queryObject = (0, _reactQuery.useQuery)(namespaceArray, () => ky(
|
|
42
|
+
const queryObject = (0, _reactQuery.useQuery)(namespaceArray, () => ky(`${endpoint}?${queryParamArray?.join('&')}`).json(), queryParams);
|
|
46
43
|
if (returnQueryObject) {
|
|
47
44
|
return queryObject;
|
|
48
45
|
}
|
|
49
|
-
if ((
|
|
50
|
-
|
|
51
|
-
return (_queryObject$data$ = queryObject === null || queryObject === void 0 || (_queryObject$data = queryObject.data) === null || _queryObject$data === void 0 ? void 0 : _queryObject$data[0]) !== null && _queryObject$data$ !== void 0 ? _queryObject$data$ : {};
|
|
46
|
+
if ((queryParams ?? defaultQueryParamObject)?.perPage && (queryParams ?? defaultQueryParamObject)?.perPage === 1) {
|
|
47
|
+
return queryObject?.data?.[0] ?? {};
|
|
52
48
|
}
|
|
53
|
-
return
|
|
49
|
+
return queryObject?.data ?? [];
|
|
54
50
|
};
|
|
55
51
|
var _default = exports.default = useAppSettings;
|
|
@@ -8,10 +8,6 @@ var _reactQuery = require("react-query");
|
|
|
8
8
|
var _core = require("@folio/stripes/core");
|
|
9
9
|
var _utils = require("../../../utils");
|
|
10
10
|
var _constants = require("../../constants");
|
|
11
|
-
const _excluded = ["data"],
|
|
12
|
-
_excluded2 = ["mutateAsync"];
|
|
13
|
-
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; }
|
|
14
|
-
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; }
|
|
15
11
|
const useSettingSection = _ref => {
|
|
16
12
|
let {
|
|
17
13
|
sectionName,
|
|
@@ -37,25 +33,23 @@ const useSettingSection = _ref => {
|
|
|
37
33
|
perPage: 100,
|
|
38
34
|
stats: false
|
|
39
35
|
}, {});
|
|
40
|
-
const
|
|
36
|
+
const {
|
|
37
|
+
data: settings = [],
|
|
38
|
+
...settingsQuery
|
|
39
|
+
} = (0, _reactQuery.useQuery)(getQueryNamespaceGenerator({
|
|
40
|
+
queryParams
|
|
41
|
+
}), () => ky(`${settingEndpoint}?${queryParams?.join('&')}`).json());
|
|
42
|
+
const {
|
|
43
|
+
mutateAsync: putSetting,
|
|
44
|
+
...settingsMutate
|
|
45
|
+
} = (0, _reactQuery.useMutation)(getMutateNamespaceGenerator(), data => ky.put(`${settingEndpoint}${data.id ? '/' + data.id : ''}`, {
|
|
46
|
+
json: data
|
|
47
|
+
}).then(async res => {
|
|
48
|
+
await queryClient.invalidateQueries(getQueryNamespaceGenerator({
|
|
41
49
|
queryParams
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} = _useQuery,
|
|
46
|
-
settingsQuery = _objectWithoutProperties(_useQuery, _excluded);
|
|
47
|
-
const _useMutation = (0, _reactQuery.useMutation)(getMutateNamespaceGenerator(), data => ky.put("".concat(settingEndpoint).concat(data.id ? '/' + data.id : ''), {
|
|
48
|
-
json: data
|
|
49
|
-
}).then(async res => {
|
|
50
|
-
await queryClient.invalidateQueries(getQueryNamespaceGenerator({
|
|
51
|
-
queryParams
|
|
52
|
-
}));
|
|
53
|
-
return res;
|
|
54
|
-
})),
|
|
55
|
-
{
|
|
56
|
-
mutateAsync: putSetting
|
|
57
|
-
} = _useMutation,
|
|
58
|
-
settingsMutate = _objectWithoutProperties(_useMutation, _excluded2);
|
|
50
|
+
}));
|
|
51
|
+
return res;
|
|
52
|
+
}));
|
|
59
53
|
return {
|
|
60
54
|
handleSubmit: putSetting,
|
|
61
55
|
settings,
|
|
@@ -15,18 +15,37 @@ var _utils = require("../../../utils");
|
|
|
15
15
|
var _hooks = require("../../../hooks");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
-
|
|
19
|
-
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; }
|
|
20
|
-
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; }
|
|
21
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
22
|
-
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 have swapped from the stripes-smart components settings page to our own internal one.
|
|
18
|
+
// We have swapped from the stripes-smart components settings page to our own internal one.
|
|
23
19
|
// I'd honestly prefer to redo it all but at least this way we're in control
|
|
24
20
|
// import { Settings } from '@folio/stripes/smart-components';
|
|
21
|
+
|
|
22
|
+
const InternalSettingsContextProvider = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
children,
|
|
25
|
+
contextValue
|
|
26
|
+
} = _ref;
|
|
27
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_contexts.SettingsContext.Provider, {
|
|
28
|
+
value: contextValue,
|
|
29
|
+
children: children
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
InternalSettingsContextProvider.propTypes = {
|
|
33
|
+
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
34
|
+
contextValue: _propTypes.default.object
|
|
35
|
+
};
|
|
36
|
+
|
|
25
37
|
// TODO work underway to make the settings hook more useful when trying to render multiple sections at a time
|
|
26
38
|
const useSettings = function () {
|
|
27
39
|
let settingsProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
28
40
|
const {
|
|
29
41
|
allowGlobalEdit = true,
|
|
42
|
+
// DEPRECATED This prop will eventually be set to FALSE in a breaking change.
|
|
43
|
+
// This is a LEGACY prop, which ensured each page had context pre-wrapped.
|
|
44
|
+
// This is NOT required while using Settings component within kint-components
|
|
45
|
+
// to render dynamic pages, but the dynamic pages break if context is missing with
|
|
46
|
+
// the stripes smart components model
|
|
47
|
+
// Turn this OFF if having difficulties with settings page redraws (When using SASQ in particular)
|
|
48
|
+
contextPerPage = true,
|
|
30
49
|
dynamicPageExclusions,
|
|
31
50
|
intlKey: passedIntlKey,
|
|
32
51
|
intlNS: passedIntlNS,
|
|
@@ -51,17 +70,16 @@ const useSettings = function () {
|
|
|
51
70
|
const ky = (0, _core.useOkapiKy)();
|
|
52
71
|
const stripes = (0, _core.useStripes)();
|
|
53
72
|
const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
73
|
+
const intlKey = (0, _hooks.useIntlKey)(passedIntlKey, passedIntlNS);
|
|
54
74
|
|
|
55
75
|
// Set up array of queryParams, pageLists etc etc ready for us to do all the work in a single place
|
|
56
76
|
|
|
57
77
|
const sectionMetaArray = (0, _react.useMemo)(() => {
|
|
58
|
-
var _sections$length;
|
|
59
78
|
const array = [];
|
|
60
79
|
const getSectionQueryProps = sectionProps => {
|
|
61
|
-
|
|
62
|
-
const dqp = (_sectionProps$dynamic = sectionProps.dynamicPageExclusions) !== null && _sectionProps$dynamic !== void 0 ? _sectionProps$dynamic : dynamicPageExclusions;
|
|
80
|
+
const dqp = sectionProps.dynamicPageExclusions ?? dynamicPageExclusions;
|
|
63
81
|
const queryParams = (0, _utils.generateKiwtQueryParams)({
|
|
64
|
-
filters: dqp
|
|
82
|
+
filters: dqp?.map(dpe => ({
|
|
65
83
|
path: 'section',
|
|
66
84
|
comparator: '!=',
|
|
67
85
|
value: dpe
|
|
@@ -69,68 +87,72 @@ const useSettings = function () {
|
|
|
69
87
|
perPage: 100,
|
|
70
88
|
stats: false
|
|
71
89
|
}, {});
|
|
72
|
-
const finalSettingEndpoint =
|
|
90
|
+
const finalSettingEndpoint = sectionProps.settingEndpoint ?? settingEndpoint;
|
|
73
91
|
const queryKey = ['stripes-kint-components', 'useSettings', 'appSettings', finalSettingEndpoint, queryParams];
|
|
74
|
-
const queryFn = () => ky(
|
|
92
|
+
const queryFn = () => ky(`${finalSettingEndpoint}?${queryParams?.join('&')}`).json();
|
|
75
93
|
return {
|
|
76
94
|
queryParams,
|
|
77
95
|
queryKey,
|
|
78
96
|
queryFn
|
|
79
97
|
};
|
|
80
98
|
};
|
|
81
|
-
if ((
|
|
99
|
+
if ((sections?.length ?? 0) > 0) {
|
|
82
100
|
array.push(...sections.map(section => {
|
|
83
101
|
const querySectionProps = getSectionQueryProps(section);
|
|
84
|
-
return
|
|
102
|
+
return {
|
|
103
|
+
...settingsProps,
|
|
104
|
+
// ensure these fall through to section based props
|
|
105
|
+
...querySectionProps,
|
|
106
|
+
...section // return original section object
|
|
107
|
+
};
|
|
85
108
|
}));
|
|
86
109
|
} else {
|
|
87
110
|
const querySectionProps = getSectionQueryProps(settingsProps);
|
|
88
|
-
array.push(
|
|
111
|
+
array.push({
|
|
112
|
+
...settingsProps,
|
|
113
|
+
...querySectionProps
|
|
114
|
+
});
|
|
89
115
|
}
|
|
90
116
|
return array;
|
|
91
117
|
}, [dynamicPageExclusions, ky, sections, settingEndpoint, settingsProps]);
|
|
92
|
-
const queries = (0, _react.useMemo)(() => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
};
|
|
104
|
-
})) !== null && _sectionMetaArray$map !== void 0 ? _sectionMetaArray$map : [];
|
|
105
|
-
}, [pages, preventQueries, sectionMetaArray]);
|
|
118
|
+
const queries = (0, _react.useMemo)(() => sectionMetaArray.map(sma => {
|
|
119
|
+
let enabled = true;
|
|
120
|
+
if (sma.pages || sma.preventQueries || pages || preventQueries) {
|
|
121
|
+
enabled = false;
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
queryKey: sma.queryKey,
|
|
125
|
+
queryFn: sma.queryFn,
|
|
126
|
+
enabled
|
|
127
|
+
};
|
|
128
|
+
}) ?? [], [pages, preventQueries, sectionMetaArray]);
|
|
106
129
|
const queryReturnArray = (0, _reactQuery.useQueries)(queries);
|
|
107
130
|
const [isLoading, setIsLoading] = (0, _react.useState)(true);
|
|
108
131
|
const getDynamicPages = (0, _react.useCallback)((qra, sma) => {
|
|
109
|
-
|
|
110
|
-
const pagesFromQueryReturn = [...new Set((_qra$data = qra.data) === null || _qra$data === void 0 ? void 0 : _qra$data.map(s => s.section))];
|
|
132
|
+
const pagesFromQueryReturn = [...new Set(qra.data?.map(s => s.section))];
|
|
111
133
|
const dynamic = pagesFromQueryReturn.map(page => {
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
const pageRoute = (finalSectionRoute ? "".concat(finalSectionRoute, "/") : '') + page;
|
|
134
|
+
const finalRender = sma.render ?? render;
|
|
135
|
+
const finalSectionRoute = sma.sectionRoute ?? sectionRoute;
|
|
136
|
+
const pageRoute = (finalSectionRoute ? `${finalSectionRoute}/` : '') + page;
|
|
116
137
|
return {
|
|
117
138
|
route: pageRoute,
|
|
118
139
|
label: kintIntl.formatKintMessage({
|
|
119
|
-
id:
|
|
140
|
+
id: `settings.settingsSection.${(0, _utils.toCamelCase)(page)}`,
|
|
120
141
|
fallbackMessage: page
|
|
121
142
|
}),
|
|
122
143
|
component: props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_SettingPage.SettingPagePane, {
|
|
123
144
|
intlKey: passedIntlKey,
|
|
124
145
|
intlNS: passedIntlNS,
|
|
125
146
|
sectionName: page,
|
|
126
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SettingPage.SettingPage,
|
|
147
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SettingPage.SettingPage, {
|
|
127
148
|
allowEdit: allowGlobalEdit,
|
|
128
149
|
intlKey: passedIntlKey,
|
|
129
150
|
intlNS: passedIntlNS,
|
|
130
151
|
labelOverrides: labelOverrides,
|
|
131
152
|
render: finalRender,
|
|
132
|
-
sectionName: page
|
|
133
|
-
|
|
153
|
+
sectionName: page,
|
|
154
|
+
...props
|
|
155
|
+
})
|
|
134
156
|
})
|
|
135
157
|
};
|
|
136
158
|
});
|
|
@@ -147,84 +169,78 @@ const useSettings = function () {
|
|
|
147
169
|
}, [isLoading, queryReturnArray]);
|
|
148
170
|
const finalSections = (0, _react.useMemo)(() => {
|
|
149
171
|
return sectionMetaArray.map((sma, idx) => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const contextValue = (0, _react.useMemo)(() => {
|
|
157
|
-
var _sma$intlKey, _sma$refdataEndpoint, _sma$settingEndpoint, _sma$templateEndpoint;
|
|
158
|
-
return {
|
|
159
|
-
intlKey: (_sma$intlKey = sma.intlKey) !== null && _sma$intlKey !== void 0 ? _sma$intlKey : intlKey,
|
|
160
|
-
// This is only here for backwards compatibility... is now grabbed from useIntlKey instead of what's passed in directly
|
|
161
|
-
refdataEndpoint: (_sma$refdataEndpoint = sma.refdataEndpoint) !== null && _sma$refdataEndpoint !== void 0 ? _sma$refdataEndpoint : refdataEndpoint,
|
|
162
|
-
settingEndpoint: (_sma$settingEndpoint = sma.settingEndpoint) !== null && _sma$settingEndpoint !== void 0 ? _sma$settingEndpoint : settingEndpoint,
|
|
163
|
-
templateEndpoint: (_sma$templateEndpoint = sma.templateEndpoint) !== null && _sma$templateEndpoint !== void 0 ? _sma$templateEndpoint : templateEndpoint
|
|
164
|
-
};
|
|
165
|
-
}, [intlKey]);
|
|
166
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_contexts.SettingsContext.Provider, {
|
|
167
|
-
value: contextValue,
|
|
168
|
-
children: children
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
|
-
SettingsContextProvider.propTypes = {
|
|
172
|
-
children: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node])
|
|
172
|
+
const contextValue = {
|
|
173
|
+
intlKey: sma.intlKey ?? intlKey,
|
|
174
|
+
// This is only here for backwards compatibility... is now grabbed from useIntlKey instead of what's passed in directly
|
|
175
|
+
refdataEndpoint: sma.refdataEndpoint ?? refdataEndpoint,
|
|
176
|
+
settingEndpoint: sma.settingEndpoint ?? settingEndpoint,
|
|
177
|
+
templateEndpoint: sma.templateEndpoint ?? templateEndpoint
|
|
173
178
|
};
|
|
174
|
-
const finalPermission =
|
|
179
|
+
const finalPermission = sma.sectionPermission ?? sectionPermission;
|
|
175
180
|
if (!finalPermission || stripes.hasPerm(finalPermission)) {
|
|
176
|
-
var _ref2, _sma$pages, _sma$persistentPages;
|
|
177
181
|
const dynamicPagesFromQueryReturn = getDynamicPages(queryReturnArray[idx], sma);
|
|
178
|
-
const finalPages =
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
const finalPages = sma.pages ?? pages ?? (sma.persistentPages ?? persistentPages).concat(dynamicPagesFromQueryReturn.dynamic).sort(_utils.sortByLabel).map(p => {
|
|
183
|
+
let component = p.component;
|
|
184
|
+
if (contextPerPage) {
|
|
185
|
+
component = cprops => /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalSettingsContextProvider, {
|
|
186
|
+
contextValue: contextValue,
|
|
187
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(p.component, {
|
|
188
|
+
...cprops
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
...p,
|
|
194
|
+
component,
|
|
195
|
+
Provider: InternalSettingsContextProvider,
|
|
196
|
+
contextValue
|
|
197
|
+
};
|
|
184
198
|
});
|
|
185
|
-
return
|
|
186
|
-
|
|
187
|
-
|
|
199
|
+
return {
|
|
200
|
+
...sma,
|
|
201
|
+
SettingsContextProvider: InternalSettingsContextProvider,
|
|
202
|
+
...dynamicPagesFromQueryReturn,
|
|
188
203
|
pageList: finalPages,
|
|
189
204
|
// DEPRECATED Here for backwards compatibility
|
|
190
205
|
pages: finalPages // ASSUMPTION MADE THAT INDICES REMAIN THE SAME
|
|
191
|
-
}
|
|
206
|
+
};
|
|
192
207
|
}
|
|
193
208
|
return null;
|
|
194
209
|
}).filter(Boolean);
|
|
195
|
-
}, [
|
|
196
|
-
const
|
|
210
|
+
}, [contextPerPage, getDynamicPages, intlKey, pages, persistentPages, queryReturnArray, refdataEndpoint, sectionMetaArray, sectionPermission, settingEndpoint, stripes, templateEndpoint]);
|
|
211
|
+
const outputPages = (0, _react.useMemo)(() => {
|
|
197
212
|
let finalPages = null;
|
|
198
|
-
if (finalSections
|
|
199
|
-
finalPages = pages
|
|
213
|
+
if (finalSections?.length === 1 && !renderSingleSection) {
|
|
214
|
+
finalPages = pages ?? finalSections[0].pages;
|
|
200
215
|
}
|
|
201
216
|
return finalPages;
|
|
202
217
|
}, [finalSections, pages, renderSingleSection]);
|
|
203
|
-
const
|
|
218
|
+
const outputSections = (0, _react.useMemo)(() => {
|
|
204
219
|
if (finalSections.length > 1 || finalSections.length === 1 && renderSingleSection) {
|
|
205
220
|
return finalSections;
|
|
206
221
|
}
|
|
207
222
|
return null;
|
|
208
223
|
}, [finalSections, renderSingleSection]);
|
|
209
|
-
const SettingsComponent = props => {
|
|
210
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Settings.default,
|
|
211
|
-
pages:
|
|
224
|
+
const SettingsComponent = (0, _react.useCallback)(props => {
|
|
225
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Settings.default, {
|
|
226
|
+
pages: outputPages,
|
|
212
227
|
paneTitle: kintIntl.formatKintMessage({
|
|
213
228
|
id: 'meta.title'
|
|
214
229
|
}),
|
|
215
|
-
sections:
|
|
216
|
-
|
|
217
|
-
|
|
230
|
+
sections: outputSections,
|
|
231
|
+
...props
|
|
232
|
+
});
|
|
233
|
+
}, [kintIntl, outputPages, outputSections]);
|
|
218
234
|
return {
|
|
219
235
|
isLoading,
|
|
220
|
-
pageList,
|
|
221
|
-
sections:
|
|
236
|
+
pageList: outputPages,
|
|
237
|
+
sections: outputSections,
|
|
222
238
|
SettingsComponent,
|
|
223
239
|
// This doesn't make much sense if there is more than one section, here to avoid breaking changes
|
|
224
|
-
SettingsContextProvider: finalSections
|
|
240
|
+
SettingsContextProvider: finalSections?.length === 1 ? finalSections[0].SettingsContextProvider : _ref2 => {
|
|
225
241
|
let {
|
|
226
242
|
children
|
|
227
|
-
} =
|
|
243
|
+
} = _ref2;
|
|
228
244
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
229
245
|
children: [" ", children, " "]
|
|
230
246
|
});
|
package/es/lib/Settings/index.js
CHANGED
|
@@ -7,6 +7,7 @@ var _exportNames = {
|
|
|
7
7
|
SettingsFormContainer: true,
|
|
8
8
|
SettingPage: true,
|
|
9
9
|
SettingPagePane: true,
|
|
10
|
+
Settings: true,
|
|
10
11
|
RefdataCategoriesSettings: true,
|
|
11
12
|
EditableRefdataList: true,
|
|
12
13
|
EditableRefdataCategoryList: true,
|
|
@@ -44,6 +45,12 @@ Object.defineProperty(exports, "SettingPagePane", {
|
|
|
44
45
|
return _SettingPage.SettingPagePane;
|
|
45
46
|
}
|
|
46
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "Settings", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _Settings.default;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
47
54
|
Object.defineProperty(exports, "SettingsContext", {
|
|
48
55
|
enumerable: true,
|
|
49
56
|
get: function () {
|
|
@@ -82,6 +89,7 @@ Object.keys(_hooks).forEach(function (key) {
|
|
|
82
89
|
});
|
|
83
90
|
});
|
|
84
91
|
var _SettingPage = require("./SettingPage");
|
|
92
|
+
var _Settings = _interopRequireDefault(require("./Settings"));
|
|
85
93
|
var _EditableSettingsList = require("./EditableSettingsList");
|
|
86
94
|
Object.keys(_EditableSettingsList).forEach(function (key) {
|
|
87
95
|
if (key === "default" || key === "__esModule") return;
|
package/es/lib/Tags/Tags.js
CHANGED
|
@@ -17,7 +17,6 @@ var _hooks2 = require("../hooks");
|
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
const Tags = _ref => {
|
|
20
|
-
var _entity$tags3, _entity$tags$length, _entity$tags4;
|
|
21
20
|
let {
|
|
22
21
|
invalidateLinks = [],
|
|
23
22
|
// If there are other queries that need invalidating, pass those here
|
|
@@ -60,7 +59,7 @@ const Tags = _ref => {
|
|
|
60
59
|
json: data
|
|
61
60
|
}).then(() => {
|
|
62
61
|
queryClient.invalidateQueries(link);
|
|
63
|
-
if (invalidateLinks
|
|
62
|
+
if (invalidateLinks?.length) {
|
|
64
63
|
invalidateLinks.forEach(il => queryClient.invalidateQueries(il));
|
|
65
64
|
}
|
|
66
65
|
}));
|
|
@@ -85,8 +84,7 @@ const Tags = _ref => {
|
|
|
85
84
|
// add tag to the list of entity tags
|
|
86
85
|
// istanbul ignore next
|
|
87
86
|
const saveEntityTags = tagsToSave => {
|
|
88
|
-
|
|
89
|
-
const tagListMap = ((_entity$tags = entity === null || entity === void 0 ? void 0 : entity.tags) !== null && _entity$tags !== void 0 ? _entity$tags : []).map(tag => ({
|
|
87
|
+
const tagListMap = (entity?.tags ?? []).map(tag => ({
|
|
90
88
|
'value': tag.value
|
|
91
89
|
}));
|
|
92
90
|
const tagsMap = tagsToSave.map(tag => ({
|
|
@@ -102,8 +100,7 @@ const Tags = _ref => {
|
|
|
102
100
|
saveTags(addTags);
|
|
103
101
|
};
|
|
104
102
|
const onRemove = tag => {
|
|
105
|
-
|
|
106
|
-
const tagToDelete = ((_entity$tags2 = entity === null || entity === void 0 ? void 0 : entity.tags) !== null && _entity$tags2 !== void 0 ? _entity$tags2 : []).filter(t => t.value.toLowerCase() === tag.toLowerCase());
|
|
103
|
+
const tagToDelete = (entity?.tags ?? []).filter(t => t.value.toLowerCase() === tag.toLowerCase());
|
|
107
104
|
putEntity({
|
|
108
105
|
tags: [{
|
|
109
106
|
id: tagToDelete[0].id,
|
|
@@ -111,7 +108,7 @@ const Tags = _ref => {
|
|
|
111
108
|
}]
|
|
112
109
|
});
|
|
113
110
|
};
|
|
114
|
-
const entityTags = (
|
|
111
|
+
const entityTags = (entity?.tags ?? []).map(tag => tag.value.toLowerCase());
|
|
115
112
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
|
|
116
113
|
defaultWidth: "20%",
|
|
117
114
|
dismissible: true,
|
|
@@ -121,7 +118,7 @@ const Tags = _ref => {
|
|
|
121
118
|
id: 'numberOfTags',
|
|
122
119
|
overrideValue: labelOverrides.numberOfTags
|
|
123
120
|
}, {
|
|
124
|
-
count:
|
|
121
|
+
count: entity?.tags?.length ?? 0
|
|
125
122
|
}),
|
|
126
123
|
paneTitle: kintIntl.formatKintMessage({
|
|
127
124
|
id: 'tags',
|
|
@@ -9,7 +9,7 @@ var _core = require("@folio/stripes/core");
|
|
|
9
9
|
var _tagsConfig = require("../tagsConfig");
|
|
10
10
|
const useTags = (namespaceArray, options) => {
|
|
11
11
|
const ky = (0, _core.useOkapiKy)();
|
|
12
|
-
const nsArray = namespaceArray
|
|
12
|
+
const nsArray = namespaceArray ?? _tagsConfig.tagNamespaceArray;
|
|
13
13
|
return (0, _reactQuery.useQuery)(nsArray, () => ky.get(_tagsConfig.defaultTagQuery).json(), options);
|
|
14
14
|
};
|
|
15
15
|
var _default = exports.default = useTags;
|
|
@@ -35,11 +35,10 @@ const useTagsEnabled = function () {
|
|
|
35
35
|
const endpoint = useSettings ? _endpoints.SETTINGS_ENDPOINT : _endpoints.CONFIG_ENDPOINT;
|
|
36
36
|
const query = useSettings ? TAGS_SETTINGS_QUERY : TAGS_CONFIG_QUERY;
|
|
37
37
|
const queryKey = useSettings ? TAGS_ENABLED_QUERY_KEY : TAGS_ENABLED_CONFIG_QUERY_KEY;
|
|
38
|
-
const queryObject = (0, _reactQuery.useQuery)(queryKey, () => ky.get(
|
|
38
|
+
const queryObject = (0, _reactQuery.useQuery)(queryKey, () => ky.get(`${endpoint}?${query}`).json());
|
|
39
39
|
if (useSettings) {
|
|
40
|
-
var _queryObject$data;
|
|
41
40
|
// mod-settings returns this value as a boolean instead of as a string, so the below approach !value is not applicable.
|
|
42
|
-
const value = queryObject
|
|
41
|
+
const value = queryObject?.data?.items?.[0]?.value;
|
|
43
42
|
return value === undefined || value === null || value;
|
|
44
43
|
}
|
|
45
44
|
const {
|
|
@@ -7,4 +7,4 @@ exports.tagsPath = exports.tagNamespaceArray = exports.defaultTagsParams = expor
|
|
|
7
7
|
const tagNamespaceArray = exports.tagNamespaceArray = ['tags', 'stripes-kint-components', 'Tags'];
|
|
8
8
|
const tagsPath = exports.tagsPath = 'tags';
|
|
9
9
|
const defaultTagsParams = exports.defaultTagsParams = ['limit=1000', 'query=cql.allRecords%3D1%20sortby%20label'];
|
|
10
|
-
const defaultTagQuery = exports.defaultTagQuery =
|
|
10
|
+
const defaultTagQuery = exports.defaultTagQuery = `${tagsPath}?${defaultTagsParams?.join('&')}`;
|
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var
|
|
10
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
11
11
|
var _components = require("@folio/stripes/components");
|
|
12
12
|
var _SearchField = _interopRequireDefault(require("../SearchField"));
|
|
13
13
|
var _TypeDown = _interopRequireDefault(require("../../../styles/TypeDown.css"));
|
|
@@ -44,7 +44,7 @@ const Typedown = _ref => {
|
|
|
44
44
|
// A way to pass any styles that need to be applied globally on selection
|
|
45
45
|
uniqueIdentificationPath = 'id'
|
|
46
46
|
} = _ref;
|
|
47
|
-
const selectedUniqueId = (0,
|
|
47
|
+
const selectedUniqueId = (0, _get.default)(input.value, uniqueIdentificationPath);
|
|
48
48
|
const [selectedValue, setSelectedValue] = (0, _react.useState)(input.value); // Track what's been selected in state as well
|
|
49
49
|
|
|
50
50
|
// Display data needs to be in line with data options but also able to react to default handleType
|
|
@@ -59,25 +59,18 @@ const Typedown = _ref => {
|
|
|
59
59
|
|
|
60
60
|
// Setup default handleType
|
|
61
61
|
const handleType = (0, _react.useCallback)(e => {
|
|
62
|
-
|
|
63
|
-
const regex = new RegExp("".concat(e.target.value.toLowerCase()));
|
|
62
|
+
const regex = new RegExp(`${e.target.value.toLowerCase()}`);
|
|
64
63
|
if (onType) {
|
|
65
64
|
onType(e);
|
|
66
|
-
} else if (filterPath && e
|
|
67
|
-
setDisplayData(dataOptions.filter(item =>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}));
|
|
71
|
-
} else if (e !== null && e !== void 0 && (_e$target2 = e.target) !== null && _e$target2 !== void 0 && _e$target2.value) {
|
|
72
|
-
setDisplayData(dataOptions.filter(item => {
|
|
73
|
-
var _get2;
|
|
74
|
-
return (_get2 = (0, _get3.default)(item, uniqueIdentificationPath)) === null || _get2 === void 0 || (_get2 = _get2.toLowerCase()) === null || _get2 === void 0 ? void 0 : _get2.match(regex);
|
|
75
|
-
}));
|
|
65
|
+
} else if (filterPath && e?.target?.value) {
|
|
66
|
+
setDisplayData(dataOptions.filter(item => (0, _get.default)(item, filterPath)?.toLowerCase()?.match(regex)));
|
|
67
|
+
} else if (e?.target?.value) {
|
|
68
|
+
setDisplayData(dataOptions.filter(item => (0, _get.default)(item, uniqueIdentificationPath)?.toLowerCase()?.match(regex)));
|
|
76
69
|
} else {
|
|
77
70
|
setDisplayData(dataOptions);
|
|
78
71
|
}
|
|
79
72
|
setCurrentlyTyped(e.target.value);
|
|
80
|
-
if (displayData.length === 1 && (0,
|
|
73
|
+
if (displayData.length === 1 && (0, _get.default)(displayData[0], filterPath) === e.target.value) {
|
|
81
74
|
setExactMatch(true);
|
|
82
75
|
} else {
|
|
83
76
|
setExactMatch(false);
|
|
@@ -111,7 +104,7 @@ const Typedown = _ref => {
|
|
|
111
104
|
let optionIsSelected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
112
105
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
113
106
|
className: _TypeDown.default.listItem,
|
|
114
|
-
children: renderListItem ? renderListItem(option, currentlyTyped, exactMatch, optionIsSelected, selectedValue) : (0,
|
|
107
|
+
children: renderListItem ? renderListItem(option, currentlyTyped, exactMatch, optionIsSelected, selectedValue) : (0, _get.default)(option, uniqueIdentificationPath)
|
|
115
108
|
});
|
|
116
109
|
}, [currentlyTyped, exactMatch, renderListItem, selectedValue, uniqueIdentificationPath]);
|
|
117
110
|
const handleChange = (0, _react.useCallback)(value => {
|
|
@@ -122,10 +115,10 @@ const Typedown = _ref => {
|
|
|
122
115
|
}
|
|
123
116
|
}, [input, onChange]);
|
|
124
117
|
const renderTypedownTrigger = () => {
|
|
125
|
-
const triggerComponentId =
|
|
118
|
+
const triggerComponentId = `typedown-trigger-${(0, _selectorSafe.default)(input.name)}`;
|
|
126
119
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
127
120
|
ref: triggerRef,
|
|
128
|
-
id:
|
|
121
|
+
id: `typedown-parent-${(0, _selectorSafe.default)(input.name)}-trigger`,
|
|
129
122
|
children: renderTrigger ? renderTrigger({
|
|
130
123
|
// Pass all props in that searchfield uses.
|
|
131
124
|
handleType,
|
|
@@ -152,14 +145,14 @@ const Typedown = _ref => {
|
|
|
152
145
|
const dropDown = (0, _react.useCallback)(() => {
|
|
153
146
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
154
147
|
className: _TypeDown.default.dropdownMenu,
|
|
155
|
-
id:
|
|
148
|
+
id: `typedown-parent-${(0, _selectorSafe.default)(input.name)}-menu`,
|
|
156
149
|
style: {
|
|
157
|
-
'--searchWidth':
|
|
150
|
+
'--searchWidth': `${searchWidth}px`
|
|
158
151
|
},
|
|
159
152
|
children: [renderHeader && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
160
153
|
ref: headerRef,
|
|
161
154
|
className: _TypeDown.default.header,
|
|
162
|
-
id:
|
|
155
|
+
id: `typedown-header-${(0, _selectorSafe.default)(input.name)}`,
|
|
163
156
|
children: renderHeader({
|
|
164
157
|
currentlyTyped,
|
|
165
158
|
displayData,
|
|
@@ -176,13 +169,13 @@ const Typedown = _ref => {
|
|
|
176
169
|
* This does NOT prevent item click, as e.propagation is not prevented.
|
|
177
170
|
*/,
|
|
178
171
|
onMouseDown: e => e.preventDefault(),
|
|
179
|
-
children: displayData
|
|
180
|
-
const isSelectedEval = isSelected ? isSelected(input.value, d) : (0,
|
|
181
|
-
const selectedCSS = selectedStyles
|
|
182
|
-
const uniqueButtonKey =
|
|
172
|
+
children: displayData?.length ? displayData?.map((d, _index) => {
|
|
173
|
+
const isSelectedEval = isSelected ? isSelected(input.value, d) : (0, _get.default)(input.value, uniqueIdentificationPath) === (0, _get.default)(d, uniqueIdentificationPath);
|
|
174
|
+
const selectedCSS = selectedStyles ?? _TypeDown.default.selectedMenuButton;
|
|
175
|
+
const uniqueButtonKey = `typedown-button-[${(0, _get.default)(d, uniqueIdentificationPath)}]`;
|
|
183
176
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
184
177
|
className: (0, _classnames.default)(_TypeDown.default.fullWidth, _TypeDown.default.menuButton, {
|
|
185
|
-
[
|
|
178
|
+
[`${selectedCSS}`]: isSelectedEval
|
|
186
179
|
}),
|
|
187
180
|
"data-selected": isSelectedEval,
|
|
188
181
|
id: uniqueButtonKey,
|
|
@@ -197,7 +190,7 @@ const Typedown = _ref => {
|
|
|
197
190
|
}), renderFooter && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
198
191
|
ref: footerRef,
|
|
199
192
|
className: _TypeDown.default.footer,
|
|
200
|
-
id:
|
|
193
|
+
id: `typedown-footer-${(0, _selectorSafe.default)(input.name)}`,
|
|
201
194
|
children: renderFooter(displayData, currentlyTyped, exactMatch)
|
|
202
195
|
})]
|
|
203
196
|
});
|
|
@@ -226,7 +219,7 @@ const Typedown = _ref => {
|
|
|
226
219
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
227
220
|
ref: resizeRef,
|
|
228
221
|
className: (0, _classnames.default)(_TypeDown.default.typedown, className),
|
|
229
|
-
id:
|
|
222
|
+
id: `typedown-id-${id}`,
|
|
230
223
|
children: [renderTypedownTrigger(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Popper, {
|
|
231
224
|
anchorRef: triggerRef,
|
|
232
225
|
className: (0, _classnames.default)(_TypeDown.default.dropdown, _TypeDown.default.fullWidth),
|