@k-int/stripes-kint-components 4.5.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.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 +62 -49
- package/es/lib/ActionList/ActionList.js +38 -51
- package/es/lib/ActionList/ActionListFieldArray.js +143 -167
- package/es/lib/ActionList/index.js +1 -1
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +57 -77
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +15 -19
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +111 -160
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +30 -67
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +36 -48
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +83 -121
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +9 -8
- 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 +19 -21
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +11 -16
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +29 -27
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +11 -16
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +86 -103
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +26 -63
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +123 -115
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +95 -176
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +43 -44
- 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 +13 -35
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +60 -81
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +23 -57
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +39 -54
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +17 -16
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +27 -23
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +18 -45
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +18 -20
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +23 -52
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +37 -41
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.test.js +77 -225
- package/es/lib/CustomProperties/Filter/index.js +6 -6
- package/es/lib/CustomProperties/Filter/testResources.js +12 -32
- package/es/lib/CustomProperties/Filter/useOperators.js +17 -16
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +17 -30
- package/es/lib/CustomProperties/Filter/useValueProps.js +22 -27
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +19 -21
- package/es/lib/CustomProperties/View/CustomPropertiesView.test.js +11 -16
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +49 -57
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +14 -23
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +17 -18
- package/es/lib/CustomProperties/View/index.js +3 -3
- package/es/lib/CustomProperties/View/testResources.js +4 -4
- package/es/lib/CustomProperties/index.js +18 -18
- package/es/lib/CycleButton/CycleButton.js +17 -32
- package/es/lib/CycleButton/index.js +1 -1
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +108 -150
- package/es/lib/EditableRefdataCategoryList/index.js +1 -1
- package/es/lib/EditableRefdataList/EditableRefdataList.js +127 -170
- package/es/lib/EditableRefdataList/index.js +1 -1
- package/es/lib/EditableSettingsList/EditableSettingsList.js +16 -13
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +18 -25
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +61 -90
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +21 -34
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +99 -83
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +17 -19
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +187 -275
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +74 -109
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +52 -157
- package/es/lib/EditableSettingsList/SettingField/index.js +3 -3
- package/es/lib/EditableSettingsList/index.js +3 -3
- package/es/lib/FormModal/FormModal.js +43 -46
- package/es/lib/FormModal/index.js +1 -1
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +23 -27
- package/es/lib/FormattedKintMessage/index.js +1 -1
- package/es/lib/IconSelect/IconSelect.js +48 -68
- package/es/lib/IconSelect/index.js +1 -1
- package/es/lib/NoResultsMessage/NoResultsMessage.js +18 -17
- package/es/lib/NoResultsMessage/index.js +1 -1
- package/es/lib/QueryTypedown/QueryTypedown.js +17 -38
- package/es/lib/QueryTypedown/index.js +1 -1
- package/es/lib/RefdataButtons/RefdataButtons.js +26 -29
- package/es/lib/RefdataButtons/index.js +1 -1
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +83 -88
- package/es/lib/ResponsiveButtonGroup/index.js +1 -1
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +27 -40
- package/es/lib/RichSelect/RichSelect.js +70 -86
- package/es/lib/RichSelect/index.js +2 -2
- package/es/lib/RichSelect/useSelectedOption.js +3 -12
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +115 -137
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +39 -45
- package/es/lib/SASQLookupComponent/TableBody/index.js +1 -1
- package/es/lib/SASQLookupComponent/index.js +2 -2
- package/es/lib/SASQRoute/SASQRoute.js +31 -37
- package/es/lib/SASQRoute/index.js +1 -1
- package/es/lib/SASQViewComponent/SASQViewComponent.js +38 -45
- package/es/lib/SASQViewComponent/index.js +1 -1
- package/es/lib/SearchField/SearchField.js +10 -16
- package/es/lib/SearchField/index.js +1 -1
- package/es/lib/SettingPage/SettingPage.js +21 -20
- package/es/lib/SettingPage/SettingPagePane.js +8 -6
- package/es/lib/SettingPage/index.js +2 -2
- package/es/lib/SettingsFormContainer/SettingsFormContainer.js +87 -0
- package/es/lib/SettingsFormContainer/index.js +13 -0
- package/es/lib/Typedown/Typedown.js +61 -79
- package/es/lib/Typedown/index.js +1 -1
- package/es/lib/constants/customProperties.js +11 -11
- package/es/lib/constants/endpoints.js +9 -0
- package/es/lib/constants/eventCodes.js +3 -3
- package/es/lib/contexts/SettingsContext.js +1 -1
- package/es/lib/contexts/index.js +1 -1
- package/es/lib/hooks/__mocks__/index.js +9 -29
- package/es/lib/hooks/index.js +31 -17
- package/es/lib/hooks/typedownHooks/index.js +3 -3
- package/es/lib/hooks/typedownHooks/useTypedown.js +48 -48
- package/es/lib/hooks/typedownHooks/useTypedownData.js +11 -21
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +12 -20
- package/es/lib/hooks/useActiveElement.js +8 -17
- package/es/lib/hooks/useCustomProperties.js +22 -30
- package/es/lib/hooks/useHelperApp.js +30 -49
- package/es/lib/hooks/useIntlKey.js +3 -5
- package/es/lib/hooks/useIntlKeyStore.js +44 -49
- package/es/lib/hooks/useInvalidateRefdata.js +3 -5
- package/es/lib/hooks/useKintIntl.js +28 -31
- package/es/lib/hooks/useKiwtFieldArray.js +34 -45
- package/es/lib/hooks/useKiwtSASQuery.js +38 -48
- package/es/lib/hooks/useLocalStorageState.js +6 -18
- package/es/lib/hooks/useModConfigEntries.js +49 -0
- package/es/lib/hooks/useMutateCustomProperties.js +19 -62
- package/es/lib/hooks/useMutateModConfigEntry.js +40 -0
- package/es/lib/hooks/useMutateRefdataCategory.js +19 -60
- package/es/lib/hooks/useMutateRefdataValue.js +28 -65
- package/es/lib/hooks/useQIndex.js +12 -26
- package/es/lib/hooks/useRefdata.js +17 -19
- package/es/lib/hooks/useSASQQueryMeta.js +13 -20
- package/es/lib/hooks/useTemplates.js +13 -12
- package/es/lib/settingsHooks/index.js +3 -3
- package/es/lib/settingsHooks/useAppSettings.js +18 -25
- package/es/lib/settingsHooks/useSettingSection.js +16 -17
- package/es/lib/settingsHooks/useSettings.js +58 -72
- package/es/lib/utils/buildUrl.js +5 -5
- package/es/lib/utils/generateKiwtQuery.js +3 -3
- package/es/lib/utils/generateKiwtQueryParams.js +85 -93
- package/es/lib/utils/groupCustomPropertiesByCtx.js +8 -18
- package/es/lib/utils/highlightString.js +17 -37
- package/es/lib/utils/index.js +29 -15
- package/es/lib/utils/matchString.js +4 -8
- package/es/lib/utils/modConfigEntriesQueryKey.js +24 -0
- package/es/lib/utils/parseErrorResponse.js +22 -63
- package/es/lib/utils/parseKiwtQueryGroups.js +47 -19
- package/es/lib/utils/parseKiwtQueryGroups.test.js +54 -0
- package/es/lib/utils/parseModConfigEntry.js +21 -0
- package/es/lib/utils/refdataQueryKey.js +2 -2
- package/es/lib/utils/selectorSafe.js +3 -3
- package/es/lib/utils/sortByLabel.js +3 -3
- package/es/lib/utils/toCamelCase.js +7 -12
- package/es/lib/utils/typedownQueryKey.js +2 -2
- package/es/lib/validators/index.js +1 -1
- package/es/lib/validators/validators.js +22 -29
- package/junit.xml +167 -147
- package/package.json +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +21 -21
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +17 -17
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesLookup.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesSettings.js.html +6 -6
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyView.js.html +3 -3
- 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 +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesListField.js.html +42 -42
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyField.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyFormCard.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.html +1 -1
- 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 +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterField.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesRule.js.html +4 -4
- 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 +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useParseActiveFilterStrings.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useValueProps.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesView.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesViewCtx.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertyCard.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.html +11 -11
- 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 +9 -9
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +10 -10
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +3 -3
- 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 +13 -13
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html +3 -3
- 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 +3 -3
- 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 +9 -9
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +3 -3
- 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 +15 -15
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/index.html +17 -17
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/RichSelect.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.html +17 -17
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RichSelect/useSelectedOption.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/TableBody.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +12 -12
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +13 -13
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +10 -10
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +18 -18
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingsFormContainer/SettingsFormContainer.js.html +337 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingsFormContainer/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingsFormContainer/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +11 -11
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html +12 -12
- package/src/artifacts/coverage-jest/lcov-report/constants/endpoints.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +12 -12
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +28 -13
- 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 +131 -101
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +8 -2
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +23 -23
- 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 +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKey.js.html +8 -8
- package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKeyStore.js.html +21 -21
- package/src/artifacts/coverage-jest/lcov-report/hooks/useInvalidateRefdata.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKintIntl.js.html +10 -10
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useModConfigEntries.js.html +226 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateModConfigEntry.js.html +238 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataCategory.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +9 -9
- package/src/artifacts/coverage-jest/lcov-report/hooks/useSASQQueryMeta.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/index.html +172 -157
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/index.html +23 -23
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/useAppSettings.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/useSettingSection.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/settingsHooks/useSettings.js.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +4 -4
- package/src/artifacts/coverage-jest/lcov-report/utils/groupCustomPropertiesByCtx.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/highlightString.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +48 -18
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +11 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/matchString.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/modConfigEntriesQueryKey.js.html +142 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/parseErrorResponse.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/parseKiwtQueryGroups.js.html +161 -80
- package/src/artifacts/coverage-jest/lcov-report/utils/parseModConfigEntry.js.html +130 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataQueryKey.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +2 -2
- package/src/artifacts/coverage-jest/lcov-report/utils/typedownQueryKey.js.html +2 -2
- 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 +8 -8
- package/src/artifacts/coverage-jest/lcov.info +543 -385
- package/src/index.js +6 -0
- package/src/lib/SettingsFormContainer/SettingsFormContainer.js +84 -0
- package/src/lib/SettingsFormContainer/index.js +1 -0
- package/src/lib/constants/endpoints.js +2 -0
- package/src/lib/hooks/index.js +2 -0
- package/src/lib/hooks/useModConfigEntries.js +47 -0
- package/src/lib/hooks/useMutateModConfigEntry.js +51 -0
- package/src/lib/utils/index.js +3 -0
- package/src/lib/utils/modConfigEntriesQueryKey.js +19 -0
- package/src/lib/utils/parseKiwtQueryGroups.js +39 -12
- package/src/lib/utils/parseKiwtQueryGroups.test.js +60 -0
- package/src/lib/utils/parseModConfigEntry.js +15 -0
- package/test/jest/helpers/KintHarness.js +21 -4
package/src/index.js
CHANGED
|
@@ -92,7 +92,11 @@ export {
|
|
|
92
92
|
useParseActiveFilterStrings
|
|
93
93
|
} from './lib/CustomProperties';
|
|
94
94
|
|
|
95
|
+
// DEPRECATED -- TYPO HERE, EXPORT AS BOTH FOR NOW AND REMOVE BROKEN ONE LATER
|
|
95
96
|
export * as customPropertyContants from './lib/constants/customProperties';
|
|
97
|
+
export * as customPropertyConstants from './lib/constants/customProperties';
|
|
98
|
+
|
|
99
|
+
export * as endpoints from './lib/constants/endpoints';
|
|
96
100
|
|
|
97
101
|
export { default as CycleButton } from './lib/CycleButton';
|
|
98
102
|
export { default as IconSelect } from './lib/IconSelect';
|
|
@@ -101,3 +105,5 @@ export { default as RichSelect, useSelectedOption } from './lib/RichSelect';
|
|
|
101
105
|
export { default as FormattedKintMessage } from './lib/FormattedKintMessage';
|
|
102
106
|
|
|
103
107
|
export { default as ResponsiveButtonGroup } from './lib/ResponsiveButtonGroup';
|
|
108
|
+
|
|
109
|
+
export { default as SettingsFormContainer } from './lib/SettingsFormContainer';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
|
|
3
|
+
import { useModConfigEntries, useMutateModConfigEntry } from '../hooks';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* API is similar to ConfigManager
|
|
7
|
+
*/
|
|
8
|
+
const SettingsFormContainer = ({
|
|
9
|
+
ConfigFormComponent,
|
|
10
|
+
configName,
|
|
11
|
+
getInitialValues: passedGetInitialValues,
|
|
12
|
+
moduleName,
|
|
13
|
+
scope, // We don't use this currently but it's here for future reference
|
|
14
|
+
...rest
|
|
15
|
+
}) => {
|
|
16
|
+
/*
|
|
17
|
+
* It is important to pass a namespaceAppend because the same hook could be rendered
|
|
18
|
+
* on the main App component. This means that in settings
|
|
19
|
+
* (Which is rendered inside App itself, stripes behaviour)
|
|
20
|
+
* the same query namespace would apply to the query in the config form, and also to
|
|
21
|
+
* the App level hook call, resulting in an infinite loop.
|
|
22
|
+
*
|
|
23
|
+
* We avoid this by ensuring all calls from this component have (at least) an extra namespace key item
|
|
24
|
+
*/
|
|
25
|
+
const {
|
|
26
|
+
parsedSettings,
|
|
27
|
+
settings
|
|
28
|
+
} = useModConfigEntries({
|
|
29
|
+
moduleName,
|
|
30
|
+
configName,
|
|
31
|
+
namespaceAppend: ['SettingsFormContainer']
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const { mutateAsync: editSettings } = useMutateModConfigEntry({
|
|
35
|
+
configName,
|
|
36
|
+
moduleName,
|
|
37
|
+
id: settings?.id
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const onSubmit = (values) => {
|
|
41
|
+
const setting = {
|
|
42
|
+
...settings,
|
|
43
|
+
value: JSON.stringify(values),
|
|
44
|
+
...(moduleName ?
|
|
45
|
+
{ module: moduleName, configName } :
|
|
46
|
+
{ scope, key: configName })
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
editSettings(setting);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const getInitialValues = () => {
|
|
53
|
+
let initialValues = parsedSettings;
|
|
54
|
+
if (passedGetInitialValues) {
|
|
55
|
+
initialValues = passedGetInitialValues(parsedSettings, settings);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return initialValues;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div style={{ width: '100%' }}>
|
|
63
|
+
<ConfigFormComponent
|
|
64
|
+
initialValues={getInitialValues()}
|
|
65
|
+
onSubmit={onSubmit}
|
|
66
|
+
{...rest}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
SettingsFormContainer.propTypes = {
|
|
73
|
+
ConfigFormComponent: PropTypes.oneOfType([
|
|
74
|
+
PropTypes.arrayOf(PropTypes.node),
|
|
75
|
+
PropTypes.node,
|
|
76
|
+
PropTypes.func,
|
|
77
|
+
]),
|
|
78
|
+
configName: PropTypes.string.isRequired,
|
|
79
|
+
getInitialValues: PropTypes.func,
|
|
80
|
+
moduleName: PropTypes.string.isRequired,
|
|
81
|
+
scope: PropTypes.string,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default SettingsFormContainer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SettingsFormContainer';
|
package/src/lib/hooks/index.js
CHANGED
|
@@ -15,3 +15,5 @@ export { default as useKintIntl } from './useKintIntl';
|
|
|
15
15
|
export { default as useIntlKeyStore } from './useIntlKeyStore';
|
|
16
16
|
export { default as useIntlKey } from './useIntlKey';
|
|
17
17
|
export { default as useSASQQueryMeta } from './useSASQQueryMeta';
|
|
18
|
+
export { default as useModConfigEntries } from './useModConfigEntries';
|
|
19
|
+
export { default as useMutateModConfigEntry } from './useMutateModConfigEntry';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
|
|
3
|
+
import { useQuery } from 'react-query';
|
|
4
|
+
import { useOkapiKy } from '@folio/stripes/core';
|
|
5
|
+
import { modConfigEntriesQueryKey, parseModConfigEntry } from '../utils';
|
|
6
|
+
import { MOD_SETTINGS_ENDPOINT } from '../constants/endpoints';
|
|
7
|
+
|
|
8
|
+
const useModConfigEntries = ({
|
|
9
|
+
configName,
|
|
10
|
+
moduleName,
|
|
11
|
+
namespaceAppend,
|
|
12
|
+
queryParams
|
|
13
|
+
}) => {
|
|
14
|
+
const ky = useOkapiKy();
|
|
15
|
+
|
|
16
|
+
const query = `?query=(module=${moduleName} and configName=${configName})`;
|
|
17
|
+
const path = `${MOD_SETTINGS_ENDPOINT}${query}`;
|
|
18
|
+
|
|
19
|
+
const namespace = modConfigEntriesQueryKey({
|
|
20
|
+
configName,
|
|
21
|
+
moduleName,
|
|
22
|
+
namespaceAppend
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const queryObject = useQuery(
|
|
26
|
+
namespace,
|
|
27
|
+
() => ky(path).json(),
|
|
28
|
+
queryParams
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const { data: { configs: { 0: settings = {} } = [] } = {} } = queryObject;
|
|
32
|
+
const parsedSettings = parseModConfigEntry(settings);
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
parsedSettings,
|
|
36
|
+
queryObject,
|
|
37
|
+
settings
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
useModConfigEntries.propTypes = {
|
|
42
|
+
moduleName: PropTypes.string,
|
|
43
|
+
configName: PropTypes.string,
|
|
44
|
+
queryParams: PropTypes.object,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default useModConfigEntries;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
import { useMutation, useQueryClient } from 'react-query';
|
|
3
|
+
import { useOkapiKy } from '@folio/stripes/core';
|
|
4
|
+
|
|
5
|
+
import { modConfigEntriesQueryKey } from '../utils';
|
|
6
|
+
import { MOD_SETTINGS_ENDPOINT } from '../constants/endpoints';
|
|
7
|
+
|
|
8
|
+
// This will simply take in some information and decide whether to mutate via POST or via PUT
|
|
9
|
+
const useMutateModConfigEntry = ({
|
|
10
|
+
configName,
|
|
11
|
+
moduleName,
|
|
12
|
+
id
|
|
13
|
+
}) => {
|
|
14
|
+
const ky = useOkapiKy();
|
|
15
|
+
const queryClient = useQueryClient();
|
|
16
|
+
|
|
17
|
+
const baseNamespace = modConfigEntriesQueryKey({
|
|
18
|
+
configName,
|
|
19
|
+
moduleName
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const putQueryObject = useMutation(
|
|
23
|
+
[...baseNamespace, 'putConfigEntry', id],
|
|
24
|
+
async (data) => ky.put(
|
|
25
|
+
`${MOD_SETTINGS_ENDPOINT}/${id}`,
|
|
26
|
+
{ json: data }
|
|
27
|
+
).json()
|
|
28
|
+
.then(() => {
|
|
29
|
+
queryClient.invalidateQueries(baseNamespace);
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const postQueryObject = useMutation(
|
|
34
|
+
[...baseNamespace, 'postConfigEntry'],
|
|
35
|
+
async (data) => ky.post(
|
|
36
|
+
`${MOD_SETTINGS_ENDPOINT}`,
|
|
37
|
+
{ json: data }
|
|
38
|
+
).json()
|
|
39
|
+
.then(() => {
|
|
40
|
+
queryClient.invalidateQueries(baseNamespace);
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
if (id) {
|
|
45
|
+
return putQueryObject;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return postQueryObject;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default useMutateModConfigEntry;
|
package/src/lib/utils/index.js
CHANGED
|
@@ -23,3 +23,6 @@ export { default as parseKiwtQueryGroups } from './parseKiwtQueryGroups';
|
|
|
23
23
|
|
|
24
24
|
// HTTP Utils
|
|
25
25
|
export { default as parseErrorResponse } from './parseErrorResponse';
|
|
26
|
+
|
|
27
|
+
export { default as modConfigEntriesQueryKey } from './modConfigEntriesQueryKey';
|
|
28
|
+
export { default as parseModConfigEntry } from './parseModConfigEntry';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const modConfigEntriesQueryKey = ({
|
|
2
|
+
configName,
|
|
3
|
+
moduleName,
|
|
4
|
+
namespaceAppend
|
|
5
|
+
} = {}) => {
|
|
6
|
+
const namespace = ['stripes-kint-components', 'modConfigSettings', moduleName, configName];
|
|
7
|
+
|
|
8
|
+
if (Array.isArray(namespaceAppend)) {
|
|
9
|
+
namespaceAppend.forEach(appendItem => {
|
|
10
|
+
namespace.push(appendItem);
|
|
11
|
+
});
|
|
12
|
+
} else if (namespaceAppend) {
|
|
13
|
+
namespace.push(namespaceAppend);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return namespace;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default modConfigEntriesQueryKey;
|
|
@@ -1,22 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* parseKiwtQueryGroups
|
|
3
|
+
* Given a string containing query groups like
|
|
4
|
+
* (foo == bar && (bat == baz || bat == quux))
|
|
5
|
+
* parse it into a series of nested arrys like
|
|
6
|
+
* [
|
|
7
|
+
* foo == bar, &&
|
|
8
|
+
* [
|
|
9
|
+
* bat == baz, ||, bat == quux
|
|
10
|
+
* ]
|
|
11
|
+
* ]
|
|
12
|
+
* Nested groups are parsed recursively. There are four tokens:
|
|
13
|
+
* ||
|
|
14
|
+
* &&
|
|
15
|
+
* (
|
|
16
|
+
* )
|
|
17
|
+
*
|
|
18
|
+
* @param {string} query
|
|
19
|
+
* @returns [] tokenized query as a series of nested arrays
|
|
20
|
+
* @throws Error if parens are unmatched
|
|
21
|
+
*/
|
|
1
22
|
const parseKiwtQueryGroups = (query) => {
|
|
2
|
-
// Split
|
|
3
|
-
|
|
4
|
-
//
|
|
5
|
-
|
|
23
|
+
// Split on tokens, keeping them all in tact in the correct position.
|
|
24
|
+
// This could be handled without the filter, which omits empty-string
|
|
25
|
+
// matches, using a look-behind:
|
|
26
|
+
// query.split(/(?<=\|\||&&|\(|\))|(?=\|\||&&|\(|\))/);
|
|
27
|
+
// but Webkit hasn't implemented look-behind yet so that breaks Safari.
|
|
28
|
+
// https://bugs.webkit.org/show_bug.cgi?id=174931
|
|
29
|
+
// <sigh>
|
|
30
|
+
const splitString = query.split(/(\|\||&&|\(|\))/).filter(Boolean);
|
|
6
31
|
|
|
32
|
+
// Keep track of what to skip over when we return from each level of nesting
|
|
33
|
+
let skipCount = [0];
|
|
7
34
|
|
|
8
|
-
// Ensure
|
|
9
|
-
let
|
|
35
|
+
// Ensure parens are properly closed
|
|
36
|
+
let unclosedParens = 0;
|
|
10
37
|
const groupParser = (parseArray, nestLevel = 0) => {
|
|
11
38
|
const group = [];
|
|
12
|
-
// Iterate over each element in the array, recursively calling this when hitting
|
|
39
|
+
// Iterate over each element in the array, recursively calling this when hitting parens
|
|
13
40
|
parseArray?.every((element, index) => {
|
|
14
41
|
if (skipCount[nestLevel] > 0) {
|
|
15
42
|
skipCount[nestLevel] -= 1;
|
|
16
43
|
return true; // Equivalent to BREAK -- move onto next element
|
|
17
44
|
}
|
|
18
45
|
|
|
19
|
-
//
|
|
46
|
+
// abort: dangling close-paren
|
|
20
47
|
if (nestLevel === 0 && element === ')') {
|
|
21
48
|
throw new Error('Unexpected character \')\' found, stopping parse.');
|
|
22
49
|
}
|
|
@@ -34,13 +61,13 @@ const parseKiwtQueryGroups = (query) => {
|
|
|
34
61
|
} else if (element === ')') {
|
|
35
62
|
// Remove the corresponding skipCount level because we're going down a nesting level
|
|
36
63
|
skipCount.pop();
|
|
37
|
-
|
|
64
|
+
unclosedParens -= 1;
|
|
38
65
|
|
|
39
66
|
return false; // Equivalent to BREAK -- go up a nesting level
|
|
40
67
|
} else if (element === '(') {
|
|
41
68
|
// Add next index to skipcount for the nesting
|
|
42
69
|
skipCount.push(0);
|
|
43
|
-
|
|
70
|
+
unclosedParens += 1;
|
|
44
71
|
|
|
45
72
|
group.push(groupParser(parseArray.slice(index + 1, parseArray?.length), nestLevel + 1));
|
|
46
73
|
}
|
|
@@ -54,8 +81,8 @@ const parseKiwtQueryGroups = (query) => {
|
|
|
54
81
|
|
|
55
82
|
const outputGroups = groupParser(splitString);
|
|
56
83
|
|
|
57
|
-
//
|
|
58
|
-
if (
|
|
84
|
+
// abort: dangling open-paren
|
|
85
|
+
if (unclosedParens > 0) {
|
|
59
86
|
throw new Error('Found unclosed paretheses, stopping parse.');
|
|
60
87
|
}
|
|
61
88
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import parseKiwtQueryGroups from './parseKiwtQueryGroups';
|
|
2
|
+
|
|
3
|
+
describe('parseKiwtQueryGroups', () => {
|
|
4
|
+
it('handles simple queries without parens', () => {
|
|
5
|
+
const result = parseKiwtQueryGroups('foo==bar');
|
|
6
|
+
expect(result).toEqual(['foo==bar']);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('handles simple queries with parens', () => {
|
|
10
|
+
const result = parseKiwtQueryGroups('(foo==bar)');
|
|
11
|
+
expect(result).toEqual([['foo==bar']]);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('handles conjunctions', () => {
|
|
15
|
+
const result = parseKiwtQueryGroups('(foo==bar&&bat==baz)');
|
|
16
|
+
expect(result).toEqual([['foo==bar', '&&', 'bat==baz']]);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('handles disjunctions', () => {
|
|
20
|
+
const result = parseKiwtQueryGroups('(foo==bar||bat==baz)');
|
|
21
|
+
expect(result).toEqual([['foo==bar', '||', 'bat==baz']]);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('handles nested clauses', () => {
|
|
25
|
+
const result = parseKiwtQueryGroups('(foo==bar&&(bat==baz||bat==quux))');
|
|
26
|
+
expect(result).toEqual([['foo==bar', '&&', ['bat==baz', '||', 'bat==quux']]]);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('throws on dangling (', () => {
|
|
30
|
+
try {
|
|
31
|
+
parseKiwtQueryGroups('(foo==bar');
|
|
32
|
+
} catch (e) {
|
|
33
|
+
expect(e.message).toMatch('Found unclosed paretheses, stopping parse.');
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('throws on dangling )', () => {
|
|
38
|
+
try {
|
|
39
|
+
parseKiwtQueryGroups('bat==quux)');
|
|
40
|
+
} catch (e) {
|
|
41
|
+
expect(e.message).toMatch('Unexpected character \')\' found, stopping parse.');
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('throws on nested dangling (', () => {
|
|
46
|
+
try {
|
|
47
|
+
parseKiwtQueryGroups('(foo==bar&&(bat==baz||bat==quux)');
|
|
48
|
+
} catch (e) {
|
|
49
|
+
expect(e.message).toMatch('Found unclosed paretheses, stopping parse.');
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('throws on nested dangling )', () => {
|
|
54
|
+
try {
|
|
55
|
+
parseKiwtQueryGroups('foo==bar&&(bat==baz||bat==quux))&&(monkey==bagel||thunder==chicken)');
|
|
56
|
+
} catch (e) {
|
|
57
|
+
expect(e.message).toMatch('Unexpected character \')\' found, stopping parse.');
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const parseModConfigEntry = (setting) => {
|
|
2
|
+
let parsedSettings = {};
|
|
3
|
+
if (setting.value) {
|
|
4
|
+
try {
|
|
5
|
+
parsedSettings = JSON.parse(setting.value);
|
|
6
|
+
} catch (error) {
|
|
7
|
+
// Error parsing settings JSON
|
|
8
|
+
console.error(error); // eslint-disable-line no-console
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return parsedSettings;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default parseModConfigEntry;
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { BaseHarness } from '@folio/stripes-erm-testing';
|
|
4
|
+
|
|
5
|
+
import { useIntlKeyStore } from '../../../src';
|
|
4
6
|
|
|
5
7
|
import { SettingsContext } from '../../../src/lib/contexts';
|
|
6
8
|
import translationsProperties from '../../helpers';
|
|
7
9
|
|
|
10
|
+
const InternalKintIntlHarness = ({ children, intlKey, moduleName }) => {
|
|
11
|
+
const addKey = useIntlKeyStore(state => state.addKey);
|
|
12
|
+
addKey(intlKey, moduleName);
|
|
13
|
+
|
|
14
|
+
return children;
|
|
15
|
+
};
|
|
8
16
|
|
|
9
17
|
export default function KintHarness({
|
|
10
18
|
children,
|
|
19
|
+
intlKey = 'ui-test-implementor',
|
|
20
|
+
moduleName = '@folio/test-implementor',
|
|
11
21
|
settingsValues = {
|
|
12
22
|
intlKey: 'stripes-kint-components',
|
|
13
23
|
refdataEndpoint: 'path/to/refdata',
|
|
@@ -19,12 +29,19 @@ export default function KintHarness({
|
|
|
19
29
|
}) {
|
|
20
30
|
return (
|
|
21
31
|
<SettingsContext.Provider value={settingsValues}>
|
|
22
|
-
<
|
|
32
|
+
<BaseHarness
|
|
33
|
+
intlKey={intlKey}
|
|
34
|
+
moduleName={moduleName}
|
|
23
35
|
translations={translations}
|
|
24
36
|
{...harnessProps}
|
|
25
37
|
>
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
<InternalKintIntlHarness
|
|
39
|
+
intlKey={intlKey}
|
|
40
|
+
moduleName={moduleName}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</InternalKintIntlHarness>
|
|
44
|
+
</BaseHarness>
|
|
28
45
|
</SettingsContext.Provider>
|
|
29
46
|
);
|
|
30
47
|
}
|