@k-int/stripes-kint-components 5.0.0 → 5.1.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/es/__mocks__/@folio/stripes/components.js +10 -21
- package/es/__mocks__/@folio/stripes/core.js +4 -7
- package/es/__mocks__/@folio/stripes/smart-components.js +4 -7
- package/es/__mocks__/react-query.js +4 -7
- package/es/__mocks__/react-router-dom.js +6 -7
- package/es/artifacts/coverage-jest/lcov-report/prettify.js +2 -2
- package/es/artifacts/coverage-jest/lcov-report/sorter.js +6 -6
- package/es/index.js +56 -49
- package/es/lib/ActionList/ActionList.js +39 -53
- package/es/lib/ActionList/ActionListFieldArray.js +144 -169
- package/es/lib/ActionList/index.js +1 -1
- package/es/lib/ComboButton/ComboButton.js +73 -91
- package/es/lib/ComboButton/index.js +1 -1
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +58 -79
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +15 -19
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +112 -162
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +30 -67
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +37 -50
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +83 -121
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +10 -10
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +48 -135
- package/es/lib/CustomProperties/Config/index.js +4 -4
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +20 -23
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +11 -16
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +30 -29
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +11 -16
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +87 -105
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +26 -63
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +124 -117
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +101 -179
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +44 -46
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +23 -27
- package/es/lib/CustomProperties/Edit/index.js +5 -5
- package/es/lib/CustomProperties/Edit/testResources.js +14 -38
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +61 -83
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +23 -57
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +40 -56
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +17 -16
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +28 -25
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +19 -47
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +19 -22
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +23 -52
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +38 -43
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.test.js +94 -226
- package/es/lib/CustomProperties/Filter/index.js +6 -6
- package/es/lib/CustomProperties/Filter/testResources.js +13 -36
- package/es/lib/CustomProperties/Filter/useOperators.js +18 -18
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +18 -32
- package/es/lib/CustomProperties/Filter/useValueProps.js +23 -29
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +20 -23
- package/es/lib/CustomProperties/View/CustomPropertiesView.test.js +11 -16
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +50 -59
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +14 -23
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +18 -20
- package/es/lib/CustomProperties/View/index.js +3 -3
- package/es/lib/CustomProperties/View/testResources.js +5 -9
- package/es/lib/CustomProperties/index.js +18 -18
- package/es/lib/CycleButton/CycleButton.js +18 -34
- package/es/lib/CycleButton/index.js +1 -1
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +109 -152
- package/es/lib/EditableRefdataCategoryList/index.js +1 -1
- package/es/lib/EditableRefdataList/EditableRefdataList.js +128 -172
- package/es/lib/EditableRefdataList/index.js +1 -1
- package/es/lib/EditableSettingsList/EditableSettingsList.js +17 -15
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +19 -27
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +61 -90
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +22 -36
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +99 -83
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +18 -21
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +187 -275
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +75 -111
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +55 -168
- package/es/lib/EditableSettingsList/SettingField/index.js +3 -3
- package/es/lib/EditableSettingsList/index.js +3 -3
- package/es/lib/FormModal/FormModal.js +44 -48
- package/es/lib/FormModal/index.js +1 -1
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +25 -29
- package/es/lib/FormattedKintMessage/index.js +1 -1
- package/es/lib/IconSelect/IconSelect.js +50 -70
- package/es/lib/IconSelect/index.js +1 -1
- package/es/lib/NoResultsMessage/NoResultsMessage.js +19 -19
- package/es/lib/NoResultsMessage/index.js +1 -1
- package/es/lib/QueryTypedown/QueryTypedown.js +18 -40
- package/es/lib/QueryTypedown/index.js +1 -1
- package/es/lib/RefdataButtons/RefdataButtons.js +27 -31
- package/es/lib/RefdataButtons/index.js +1 -1
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +84 -90
- package/es/lib/ResponsiveButtonGroup/index.js +1 -1
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +28 -42
- package/es/lib/RichSelect/RichSelect.js +71 -88
- package/es/lib/RichSelect/index.js +2 -2
- package/es/lib/RichSelect/useSelectedOption.js +4 -14
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +116 -139
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +40 -47
- package/es/lib/SASQLookupComponent/TableBody/index.js +1 -1
- package/es/lib/SASQLookupComponent/index.js +2 -2
- package/es/lib/SASQRoute/SASQRoute.js +32 -39
- package/es/lib/SASQRoute/index.js +1 -1
- package/es/lib/SASQViewComponent/SASQViewComponent.js +39 -47
- package/es/lib/SASQViewComponent/index.js +1 -1
- package/es/lib/SearchField/SearchField.js +12 -18
- package/es/lib/SearchField/index.js +1 -1
- package/es/lib/SettingPage/SettingPage.js +22 -22
- package/es/lib/SettingPage/SettingPagePane.js +9 -8
- package/es/lib/SettingPage/index.js +2 -2
- package/es/lib/SettingsFormContainer/SettingsFormContainer.js +51 -55
- package/es/lib/SettingsFormContainer/index.js +1 -1
- package/es/lib/Typedown/Typedown.js +62 -81
- package/es/lib/Typedown/index.js +1 -1
- package/es/lib/constants/comparators.js +7 -0
- package/es/lib/constants/customProperties.js +11 -22
- package/es/lib/constants/endpoints.js +1 -2
- package/es/lib/constants/eventCodes.js +3 -6
- package/es/lib/contexts/SettingsContext.js +2 -3
- package/es/lib/contexts/index.js +1 -1
- package/es/lib/hooks/__mocks__/index.js +9 -29
- package/es/lib/hooks/index.js +19 -19
- package/es/lib/hooks/typedownHooks/index.js +3 -3
- package/es/lib/hooks/typedownHooks/useTypedown.js +49 -50
- package/es/lib/hooks/typedownHooks/useTypedownData.js +12 -23
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +13 -22
- package/es/lib/hooks/useActiveElement.js +9 -19
- package/es/lib/hooks/useCustomProperties.js +23 -32
- package/es/lib/hooks/useHelperApp.js +31 -51
- package/es/lib/hooks/useIntlKey.js +4 -7
- package/es/lib/hooks/useIntlKeyStore.js +44 -51
- package/es/lib/hooks/useInvalidateRefdata.js +4 -7
- package/es/lib/hooks/useKintIntl.js +29 -33
- package/es/lib/hooks/useKiwtFieldArray.js +35 -47
- package/es/lib/hooks/useKiwtSASQuery.js +38 -51
- package/es/lib/hooks/useLocalStorageState.js +7 -20
- package/es/lib/hooks/useModConfigEntries.js +27 -27
- package/es/lib/hooks/useMutateCustomProperties.js +20 -64
- package/es/lib/hooks/useMutateModConfigEntry.js +22 -61
- package/es/lib/hooks/useMutateRefdataCategory.js +20 -62
- package/es/lib/hooks/useMutateRefdataValue.js +29 -67
- package/es/lib/hooks/useQIndex.js +13 -28
- package/es/lib/hooks/useRefdata.js +18 -21
- package/es/lib/hooks/useSASQQueryMeta.js +14 -22
- package/es/lib/hooks/useTemplates.js +14 -14
- package/es/lib/settingsHooks/index.js +3 -3
- package/es/lib/settingsHooks/useAppSettings.js +19 -27
- package/es/lib/settingsHooks/useSettingSection.js +17 -19
- package/es/lib/settingsHooks/useSettings.js +59 -74
- package/es/lib/utils/buildUrl.js +6 -8
- package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +36 -0
- package/es/lib/utils/filterParsers/index.js +48 -0
- package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +47 -0
- package/es/lib/utils/{parseKiwtQueryGroups.js → filterParsers/parseKiwtQueryGroups.js} +12 -13
- package/es/lib/utils/{parseKiwtQueryGroups.test.js → filterParsers/parseKiwtQueryGroups.test.js} +15 -15
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +34 -0
- package/es/lib/utils/generateKiwtQuery.js +4 -5
- package/es/lib/utils/generateKiwtQueryParams.js +93 -99
- package/es/lib/utils/groupCustomPropertiesByCtx.js +9 -20
- package/es/lib/utils/highlightString.js +17 -37
- package/es/lib/utils/index.js +49 -19
- package/es/lib/utils/matchString.js +5 -10
- package/es/lib/utils/modConfigEntriesQueryKey.js +9 -9
- package/es/lib/utils/parseErrorResponse.js +23 -65
- package/es/lib/utils/parseModConfigEntry.js +3 -4
- package/es/lib/utils/refdataOptions.js +2 -3
- package/es/lib/utils/refdataQueryKey.js +3 -4
- package/es/lib/utils/selectorSafe.js +5 -6
- package/es/lib/utils/sortByLabel.js +4 -5
- package/es/lib/utils/toCamelCase.js +8 -14
- package/es/lib/utils/typedownQueryKey.js +3 -4
- package/es/lib/validators/index.js +1 -1
- package/es/lib/validators/validators.js +22 -29
- package/junit.xml +161 -161
- package/package.json +5 -5
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionTrigger.js.html +418 -0
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ComboButton/ComboButton.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ComboButton/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ComboButton/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesLookup.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyView.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEdit.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesListField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyField.js.html +10 -10
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyFormCard.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.html +15 -15
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilter.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesRule.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useOperators.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useParseActiveFilterStrings.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useValueProps.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesView.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesViewCtx.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertyCard.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/CycleButton.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/FormattedKintMessage.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/IconSelect.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/ResponsiveButtonGroup.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/RichSelect.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/useSelectedOption.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/TableBody.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingsActionList/EditSettingValue.js.html +514 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingsActionList/RenderSettingValue.js.html +358 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingsActionList/SettingsActionList.js.html +736 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingsActionList/index.html +161 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingsActionList/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingsFormContainer/SettingsFormContainer.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingsFormContainer/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingsFormContainer/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/comparators.js.html +121 -0
- package/src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/endpoints.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +16 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +161 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useAppSettings.js.html +292 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +214 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +463 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKey.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKeyStore.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useInvalidateRefdata.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKintIntl.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useModConfigEntries.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateModConfigEntry.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataCategory.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useSASQQueryMeta.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/index.html +41 -26
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/useAppSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/useSettingSection.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/useSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +6 -18
- package/src/artifacts/coverage-jest/lcov-report/utils/filterParsers/deparseKiwtQueryFilters.js.html +181 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/filterParsers/index.html +176 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/filterParsers/index.js.html +124 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/filterParsers/parseKiwtQueryFilters.js.html +211 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/filterParsers/parseKiwtQueryGroups.js.html +367 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/filterParsers/parseKiwtQueryString.js.html +184 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +13 -7
- package/src/artifacts/coverage-jest/lcov-report/utils/groupCustomPropertiesByCtx.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/highlightString.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +13 -28
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +24 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/matchString.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/modConfigEntriesQueryKey.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/parseErrorResponse.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/parseKiwtQueryGroups.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/parseModConfigEntry.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataQueryKey.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/typedownQueryKey.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/validators.js.html +370 -0
- package/src/artifacts/coverage-jest/lcov-report/validators/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/validators/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/validators/validators.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov.info +352 -228
- package/src/index.js +1 -0
- package/src/lib/CustomProperties/Edit/CustomPropertyField.test.js +9 -5
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +1 -4
- package/src/lib/CustomProperties/Filter/CustomPropertiesRule.test.js +26 -10
- package/src/lib/constants/comparators.js +13 -0
- package/src/lib/hooks/useKiwtSASQuery.js +1 -1
- package/src/lib/utils/buildUrl.js +1 -5
- package/src/lib/utils/filterParsers/deparseKiwtQueryFilters.js +32 -0
- package/src/lib/utils/filterParsers/index.js +13 -0
- package/src/lib/utils/filterParsers/parseKiwtQueryFilters.js +42 -0
- package/src/lib/utils/{parseKiwtQueryGroups.js → filterParsers/parseKiwtQueryGroups.js} +3 -1
- package/src/lib/utils/filterParsers/parseKiwtQueryString.js +33 -0
- package/src/lib/utils/generateKiwtQueryParams.js +6 -4
- package/src/lib/utils/index.js +8 -1
- /package/src/lib/utils/{parseKiwtQueryGroups.test.js → filterParsers/parseKiwtQueryGroups.test.js} +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { waitFor } from '@folio/jest-config-stripes/testing-library/react';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Datepicker,
|
|
5
5
|
MultiSelect,
|
|
6
6
|
TextArea,
|
|
7
7
|
TextInput,
|
|
8
|
-
TestForm
|
|
8
|
+
TestForm,
|
|
9
|
+
Select
|
|
9
10
|
} from '@folio/stripes-erm-testing';
|
|
10
11
|
|
|
11
12
|
import CustomPropertyField from './CustomPropertyField';
|
|
@@ -76,8 +77,9 @@ describe('CustomPropertyField', () => {
|
|
|
76
77
|
await TextArea('Internal note').has({ value: 'this is an internal note' });
|
|
77
78
|
});
|
|
78
79
|
|
|
79
|
-
test('Displays expected visibilities
|
|
80
|
-
|
|
80
|
+
test('Displays expected visibilities dropdown values ', async () => {
|
|
81
|
+
await Select('Visibility').choose('Internal');
|
|
82
|
+
await Select('Visibility').choose('Public');
|
|
81
83
|
});
|
|
82
84
|
|
|
83
85
|
it('Displays expected Public note label ', () => {
|
|
@@ -158,7 +160,9 @@ describe('CustomPropertyField', () => {
|
|
|
158
160
|
});
|
|
159
161
|
|
|
160
162
|
test('renders multi-select Refdata values', async () => {
|
|
161
|
-
await
|
|
163
|
+
await waitFor(async () => {
|
|
164
|
+
await MultiSelect('Value(s)').select(['Future', 'Current', 'Historical', 'Does not apply']);
|
|
165
|
+
});
|
|
162
166
|
});
|
|
163
167
|
});
|
|
164
168
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { TestForm } from '@folio/stripes-erm-testing';
|
|
1
|
+
import { Button, TestForm } from '@folio/stripes-erm-testing';
|
|
4
2
|
import { waitFor } from '@folio/jest-config-stripes/testing-library/react';
|
|
5
|
-
import { Button } from '@folio/stripes-erm-testing';
|
|
6
3
|
import { FieldArray } from 'react-final-form-arrays';
|
|
7
4
|
|
|
8
5
|
import CustomPropertiesFilterFieldArray from './CustomPropertiesFilterFieldArray';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
1
|
import { MemoryRouter } from 'react-router-dom';
|
|
2
|
+
|
|
3
|
+
import { waitFor } from '@folio/jest-config-stripes/testing-library/react';
|
|
4
4
|
import { Select, TestForm } from '@folio/stripes-erm-testing';
|
|
5
5
|
|
|
6
6
|
import CustomPropertiesRule from './CustomPropertiesRule';
|
|
@@ -32,7 +32,9 @@ describe('CustomPropertiesRule', () => {
|
|
|
32
32
|
|
|
33
33
|
describe('select Is set operator from comparator dropdown', () => {
|
|
34
34
|
beforeEach(async () => {
|
|
35
|
-
await
|
|
35
|
+
await waitFor(async () => {
|
|
36
|
+
await Select().choose('Is set');
|
|
37
|
+
});
|
|
36
38
|
});
|
|
37
39
|
|
|
38
40
|
it('renders expected Is set operator', async () => {
|
|
@@ -42,7 +44,9 @@ describe('CustomPropertiesRule', () => {
|
|
|
42
44
|
|
|
43
45
|
describe('select Is not set operator from comparator dropdown', () => {
|
|
44
46
|
beforeEach(async () => {
|
|
45
|
-
await
|
|
47
|
+
await waitFor(async () => {
|
|
48
|
+
await Select().choose('Is not set');
|
|
49
|
+
});
|
|
46
50
|
});
|
|
47
51
|
|
|
48
52
|
it('renders expected is not set operator in comparator dropdown', async () => {
|
|
@@ -52,7 +56,9 @@ describe('CustomPropertiesRule', () => {
|
|
|
52
56
|
|
|
53
57
|
describe('select Equals from comparator dropdown', () => {
|
|
54
58
|
beforeEach(async () => {
|
|
55
|
-
await
|
|
59
|
+
await waitFor(async () => {
|
|
60
|
+
await Select().choose('Equals');
|
|
61
|
+
});
|
|
56
62
|
});
|
|
57
63
|
|
|
58
64
|
it('renders expected Equals operator', async () => {
|
|
@@ -62,7 +68,9 @@ describe('CustomPropertiesRule', () => {
|
|
|
62
68
|
|
|
63
69
|
describe('select not equal operator from comparator dropdown', () => {
|
|
64
70
|
beforeEach(async () => {
|
|
65
|
-
await
|
|
71
|
+
await waitFor(async () => {
|
|
72
|
+
await Select().choose('Does not equal');
|
|
73
|
+
});
|
|
66
74
|
});
|
|
67
75
|
|
|
68
76
|
it('renders expected Does not equal operator in comparator dropdown', async () => {
|
|
@@ -72,7 +80,9 @@ describe('CustomPropertiesRule', () => {
|
|
|
72
80
|
|
|
73
81
|
describe('select Is greater than or equal to operator from comparator dropdown', () => {
|
|
74
82
|
beforeEach(async () => {
|
|
75
|
-
await
|
|
83
|
+
await waitFor(async () => {
|
|
84
|
+
await Select().choose('Is greater than or equal to');
|
|
85
|
+
});
|
|
76
86
|
});
|
|
77
87
|
|
|
78
88
|
it('renders expected Is greater than or equal to operator in comparator dropdown', async () => {
|
|
@@ -82,7 +92,9 @@ describe('CustomPropertiesRule', () => {
|
|
|
82
92
|
|
|
83
93
|
describe('select Is less than or equal to operator from comparator dropdown', () => {
|
|
84
94
|
beforeEach(async () => {
|
|
85
|
-
await
|
|
95
|
+
await waitFor(async () => {
|
|
96
|
+
await Select().choose('Is less than or equal to');
|
|
97
|
+
});
|
|
86
98
|
});
|
|
87
99
|
|
|
88
100
|
it('renders expected Is less than or equal to operator in comparator dropdown', async () => {
|
|
@@ -92,7 +104,9 @@ describe('CustomPropertiesRule', () => {
|
|
|
92
104
|
|
|
93
105
|
describe('select Is operator from comparator dropdown', () => {
|
|
94
106
|
beforeEach(async () => {
|
|
95
|
-
await
|
|
107
|
+
await waitFor(async () => {
|
|
108
|
+
await Select().choose('Is');
|
|
109
|
+
});
|
|
96
110
|
});
|
|
97
111
|
|
|
98
112
|
it('renders expected is operator', async () => {
|
|
@@ -102,7 +116,9 @@ describe('CustomPropertiesRule', () => {
|
|
|
102
116
|
|
|
103
117
|
describe('select Is not operator form comparator dropdown', () => {
|
|
104
118
|
beforeEach(async () => {
|
|
105
|
-
await
|
|
119
|
+
await waitFor(async () => {
|
|
120
|
+
await Select().choose('Is not');
|
|
121
|
+
});
|
|
106
122
|
});
|
|
107
123
|
|
|
108
124
|
it('renders expected is not operator ', async () => {
|
|
@@ -7,10 +7,6 @@ import {
|
|
|
7
7
|
forOwn,
|
|
8
8
|
} from 'lodash';
|
|
9
9
|
|
|
10
|
-
function getLocationQuery(location) {
|
|
11
|
-
return location.query ? location.query : queryString.parse(location.search);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
10
|
function removeEmpty(obj) {
|
|
15
11
|
const cleanObj = {};
|
|
16
12
|
|
|
@@ -22,7 +18,7 @@ function removeEmpty(obj) {
|
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
export default function buildUrl(location, values, basePath) {
|
|
25
|
-
const locationQuery =
|
|
21
|
+
const locationQuery = location?.query ?? queryString.parse(location.search);
|
|
26
22
|
let url = values._path || basePath || location.pathname;
|
|
27
23
|
const params = removeEmpty(Object.assign(locationQuery, values));
|
|
28
24
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Does not validate object... make sure you pass it the right thing
|
|
2
|
+
export const deparseKiwtQueryFiltersObject = (queryObject) => {
|
|
3
|
+
let returnString = `${queryObject.path} ${queryObject.comparator}`;
|
|
4
|
+
if (queryObject.value) {
|
|
5
|
+
returnString += ` ${queryObject.value}`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return returnString;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// Takes an Array of the shape defined by parseKiwtQuery and restructures that into an equivalent KIWT queryString
|
|
12
|
+
const deparseKiwtQueryFilters = (queryArray) => {
|
|
13
|
+
if (Array.isArray(queryArray)) {
|
|
14
|
+
let returnString = '';
|
|
15
|
+
queryArray.forEach(qa => {
|
|
16
|
+
if (Array.isArray(qa)) {
|
|
17
|
+
returnString += ` (${deparseKiwtQueryFilters(qa)})`;
|
|
18
|
+
} else if (typeof qa === 'string') {
|
|
19
|
+
returnString += ` ${qa}`;
|
|
20
|
+
} else {
|
|
21
|
+
// Assuming object at this stage
|
|
22
|
+
returnString += ` ${deparseKiwtQueryFiltersObject(qa)}`;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return returnString.trim();
|
|
27
|
+
} else {
|
|
28
|
+
throw new Error(`deparseKiwtQuery expects a parameter of type Array, passed: ${queryArray}`);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default deparseKiwtQueryFilters;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as parseKiwtQueryGroups } from './parseKiwtQueryGroups';
|
|
2
|
+
|
|
3
|
+
export { default as parseKiwtQueryString } from './parseKiwtQueryString';
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
default as parseKiwtQueryFilters,
|
|
7
|
+
parseKiwtQueryFiltersRecursive
|
|
8
|
+
} from './parseKiwtQueryFilters';
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
default as deparseKiwtQueryFilters,
|
|
12
|
+
deparseKiwtQueryFiltersObject
|
|
13
|
+
} from './deparseKiwtQueryFilters';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import parseKiwtQueryGroups from './parseKiwtQueryGroups';
|
|
2
|
+
import parseKiwtQueryString from './parseKiwtQueryString';
|
|
3
|
+
|
|
4
|
+
// This is an amalgam of parseKiwtQueryGroups, which splits up grouped queries
|
|
5
|
+
// and parseKiwtQueryString, which figures out comparator vs attribute, etc
|
|
6
|
+
|
|
7
|
+
// This will handle the nested recursion logic, switching between String and Array
|
|
8
|
+
export const parseKiwtQueryFiltersRecursive = (query) => {
|
|
9
|
+
if (Array.isArray(query)) {
|
|
10
|
+
return query.map(q => parseKiwtQueryFiltersRecursive(q));
|
|
11
|
+
} else if (typeof query === 'string') {
|
|
12
|
+
if (query === '&&' || query === '||') {
|
|
13
|
+
return query;
|
|
14
|
+
} else {
|
|
15
|
+
return parseKiwtQueryString(query);
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
throw new Error(`Unexpected query type: ${query}`);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// This accepts a STRING only
|
|
23
|
+
const parseKiwtQueryFilters = (queryString) => {
|
|
24
|
+
if (typeof queryString === 'string') {
|
|
25
|
+
// parseKiwtQueryGroups already recurses, so we know is the right shape all the way down
|
|
26
|
+
const queryGroups = parseKiwtQueryGroups(queryString);
|
|
27
|
+
|
|
28
|
+
return parseKiwtQueryFiltersRecursive(queryGroups);
|
|
29
|
+
} else {
|
|
30
|
+
throw new Error(`parseKiwtQuery expects a parameter of type String, passed: ${queryString}`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/* RETURN SHAPE
|
|
35
|
+
* This will return nested arrays of Objects, Strings and Arrays.
|
|
36
|
+
* Each array refers to a bracketed group
|
|
37
|
+
* Each object is a single query value (attribute, comparator and value)
|
|
38
|
+
* Each string should be boolean && or ||
|
|
39
|
+
* To be read from left to right
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
export default parseKiwtQueryFilters;
|
|
@@ -27,7 +27,9 @@ const parseKiwtQueryGroups = (query) => {
|
|
|
27
27
|
// but Webkit hasn't implemented look-behind yet so that breaks Safari.
|
|
28
28
|
// https://bugs.webkit.org/show_bug.cgi?id=174931
|
|
29
29
|
// <sigh>
|
|
30
|
-
const splitString = query.split(/(\|\||&&|\(|\))/)
|
|
30
|
+
const splitString = query.split(/(\|\||&&|\(|\))/)
|
|
31
|
+
.map(ss => ss.trim())
|
|
32
|
+
.filter(Boolean);
|
|
31
33
|
|
|
32
34
|
// Keep track of what to skip over when we return from each level of nesting
|
|
33
35
|
let skipCount = [0];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import comparators from '../../constants/comparators';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* This is designed to take a SINGLE query string of the form
|
|
5
|
+
* attribute == value, or attribute isEmpty, or attribute ~= value, etc
|
|
6
|
+
*
|
|
7
|
+
* Will return an object: {path: 'attribute', comparator: '==', value: 'value'}
|
|
8
|
+
*/
|
|
9
|
+
// No magic numbers sonarlint -.-
|
|
10
|
+
const FIRST = 0;
|
|
11
|
+
const SECOND = 1;
|
|
12
|
+
const THIRD = 2;
|
|
13
|
+
|
|
14
|
+
const parseKiwtQueryString = (queryString) => {
|
|
15
|
+
const comparatorMatch = new RegExp(`(${comparators.join('|')})`);
|
|
16
|
+
// See parseKiwtQueryGroups for breakdown of why this filter is needed
|
|
17
|
+
const splitString = queryString.split(comparatorMatch)
|
|
18
|
+
.map(ss => ss.trim())
|
|
19
|
+
.filter(Boolean);
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* As far as I can tell, with input of a SINGLE query string at a time,
|
|
23
|
+
* with 2 entries we will have a special case comparator, with 3 we
|
|
24
|
+
* have a comparator, attribute and value.. value can be null in those cases
|
|
25
|
+
*/
|
|
26
|
+
return ({
|
|
27
|
+
path: splitString[FIRST],
|
|
28
|
+
comparator: splitString[SECOND],
|
|
29
|
+
value: splitString[THIRD]
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default parseKiwtQueryString;
|
|
@@ -6,6 +6,8 @@ const conditionalEncodeURIComponent = (str, encode = true) => {
|
|
|
6
6
|
return str;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
// TODO might be nice to allow for filterOptions to be of the shape of parsedKiwtQueryFilters,
|
|
10
|
+
// so we can make use of the deparser there optionally for built in query grouping
|
|
9
11
|
const buildFilterOptionBlock = (opf, isNested = false, encode = true) => {
|
|
10
12
|
if (opf?.groupValues) {
|
|
11
13
|
const groupValues = opf.groupValues;
|
|
@@ -96,7 +98,7 @@ const generateKiwtQueryParams = (options, nsValues, encode = true) => {
|
|
|
96
98
|
const paramsArray = [];
|
|
97
99
|
|
|
98
100
|
if (query) {
|
|
99
|
-
paramsArray.push(...(qindex || searchKey)
|
|
101
|
+
paramsArray.push(...((qindex || searchKey)?.split(',') ?? []).map(m => `match=${conditionalEncodeURIComponent(m, encode)}`));
|
|
100
102
|
paramsArray.push(`term=${conditionalEncodeURIComponent(query, encode)}`);
|
|
101
103
|
}
|
|
102
104
|
|
|
@@ -113,7 +115,7 @@ const generateKiwtQueryParams = (options, nsValues, encode = true) => {
|
|
|
113
115
|
if (filters) {
|
|
114
116
|
const filterMap = {};
|
|
115
117
|
filters.split(',').forEach(filter => {
|
|
116
|
-
const [filterName, ...filterRest] = filter.trim()?.split('.');
|
|
118
|
+
const [filterName, ...filterRest] = filter.trim()?.split('.') ?? [];
|
|
117
119
|
const filterValue = filterRest.join('.');
|
|
118
120
|
|
|
119
121
|
if (filterMap[filterName] === undefined) filterMap[filterName] = [];
|
|
@@ -134,7 +136,7 @@ const generateKiwtQueryParams = (options, nsValues, encode = true) => {
|
|
|
134
136
|
paramsArray.push(`filters=${conditionalEncodeURIComponent(filterString, encode)}`);
|
|
135
137
|
} else if (!filterKey) {
|
|
136
138
|
// These filters have no key mapping so we just pass the values to the backend as-is.
|
|
137
|
-
paramsArray.push(...filterValues
|
|
139
|
+
paramsArray.push(...(filterValues ?? []).map(f => `filters=${conditionalEncodeURIComponent(f, encode)}`));
|
|
138
140
|
} else {
|
|
139
141
|
const filterString = filterValues.map(v => `${filterKey}==${v}`).join('||');
|
|
140
142
|
paramsArray.push(`filters=${conditionalEncodeURIComponent(filterString, encode)}`);
|
|
@@ -154,7 +156,7 @@ const generateKiwtQueryParams = (options, nsValues, encode = true) => {
|
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
if (sort) {
|
|
157
|
-
paramsArray.push(...sort.trim()?.split(',').map(sortKey => {
|
|
159
|
+
paramsArray.push(...(sort.trim()?.split(',') ?? []).map(sortKey => {
|
|
158
160
|
const descending = sortKey.startsWith('-');
|
|
159
161
|
let term = sortKey.replace('-', '');
|
|
160
162
|
|
package/src/lib/utils/index.js
CHANGED
|
@@ -19,7 +19,14 @@ export { default as toCamelCase } from './toCamelCase'; // I hate that this exis
|
|
|
19
19
|
export { default as matchString } from './matchString';
|
|
20
20
|
export { boldString, highlightString } from './highlightString';
|
|
21
21
|
|
|
22
|
-
export {
|
|
22
|
+
export {
|
|
23
|
+
parseKiwtQueryGroups,
|
|
24
|
+
parseKiwtQueryString,
|
|
25
|
+
parseKiwtQueryFilters,
|
|
26
|
+
parseKiwtQueryFiltersRecursive,
|
|
27
|
+
deparseKiwtQueryFilters,
|
|
28
|
+
deparseKiwtQueryFiltersObject
|
|
29
|
+
} from './filterParsers';
|
|
23
30
|
|
|
24
31
|
// HTTP Utils
|
|
25
32
|
export { default as parseErrorResponse } from './parseErrorResponse';
|
/package/src/lib/utils/{parseKiwtQueryGroups.test.js → filterParsers/parseKiwtQueryGroups.test.js}
RENAMED
|
File without changes
|