@mapsight/ui 7.0.3 → 7.1.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/dist/components/app.d.ts +2 -2
- package/dist/components/app.d.ts.map +1 -1
- package/dist/components/app.js +7 -7
- package/dist/components/app.js.map +1 -1
- package/dist/components/feature-details-content/feature-details-content.js +2 -2
- package/dist/components/feature-details-content/feature-details-content.js.map +1 -1
- package/dist/components/feature-details-content/index.d.ts +3 -5
- package/dist/components/feature-details-content/index.js +6 -7
- package/dist/components/feature-details-content/index.js.map +1 -1
- package/dist/components/feature-list/filter.js +2 -2
- package/dist/components/feature-list/filter.js.map +1 -1
- package/dist/components/feature-list/hooks/useFeatureListState.d.ts.map +1 -1
- package/dist/components/feature-list/hooks/useFeatureListState.js +7 -2
- package/dist/components/feature-list/hooks/useFeatureListState.js.map +1 -1
- package/dist/components/feature-list/hooks/useRestoreDocumentScroll.js +1 -1
- package/dist/components/feature-list/hooks/useRestoreDocumentScroll.js.map +1 -1
- package/dist/components/feature-list/hooks/useSelectFeature.js +6 -6
- package/dist/components/feature-list/hooks/useSelectFeature.js.map +1 -1
- package/dist/components/feature-list/index.js +4 -4
- package/dist/components/feature-list/index.js.map +1 -1
- package/dist/components/feature-list-cycling/index.d.ts +3 -5
- package/dist/components/feature-list-cycling/index.js +1 -1
- package/dist/components/feature-list-cycling/index.js.map +1 -1
- package/dist/components/feature-list-sorting/index.d.ts +4 -16
- package/dist/components/feature-list-sorting/index.d.ts.map +1 -1
- package/dist/components/feature-list-sorting/index.js +6 -7
- package/dist/components/feature-list-sorting/index.js.map +1 -1
- package/dist/components/feature-selection-info/index.js +2 -2
- package/dist/components/feature-selection-info/index.js.map +1 -1
- package/dist/components/feature-selection-info/with-sticky-header.d.ts +10 -7
- package/dist/components/feature-selection-info/with-sticky-header.d.ts.map +1 -1
- package/dist/components/feature-selection-info/with-sticky-header.js +4 -4
- package/dist/components/feature-selection-info/with-sticky-header.js.map +1 -1
- package/dist/components/helping/app-context.d.ts +1 -1
- package/dist/components/helping/app-context.d.ts.map +1 -1
- package/dist/components/layer-switcher/GroupedLayerSwitcher.js +1 -1
- package/dist/components/layer-switcher/GroupedLayerSwitcher.js.map +1 -1
- package/dist/components/layer-switcher/LayerSwitcher.d.ts +12 -11
- package/dist/components/layer-switcher/LayerSwitcher.d.ts.map +1 -1
- package/dist/components/layer-switcher/LayerSwitcher.js +1 -1
- package/dist/components/layer-switcher/LayerSwitcher.js.map +1 -1
- package/dist/components/layer-switcher/LayerSwitcherContainer.d.ts +15 -0
- package/dist/components/layer-switcher/LayerSwitcherContainer.d.ts.map +1 -0
- package/dist/components/layer-switcher/{LayerSwticherContainer.js → LayerSwitcherContainer.js} +5 -9
- package/dist/components/layer-switcher/LayerSwitcherContainer.js.map +1 -0
- package/dist/components/layer-switcher/LayerSwitcherEntry.d.ts +28 -12
- package/dist/components/layer-switcher/LayerSwitcherEntry.d.ts.map +1 -1
- package/dist/components/layer-switcher/LayerSwitcherEntry.js +33 -35
- package/dist/components/layer-switcher/LayerSwitcherEntry.js.map +1 -1
- package/dist/components/layer-switcher/index.d.ts +9 -2
- package/dist/components/layer-switcher/index.d.ts.map +1 -1
- package/dist/components/layer-switcher/index.js +12 -21
- package/dist/components/layer-switcher/index.js.map +1 -1
- package/dist/components/layout/wrapper.js +1 -1
- package/dist/components/layout/wrapper.js.map +1 -1
- package/dist/components/main-panel/context.d.ts +6 -5
- package/dist/components/main-panel/context.d.ts.map +1 -1
- package/dist/components/main-panel/context.js +5 -13
- package/dist/components/main-panel/context.js.map +1 -1
- package/dist/components/main-panel/list-toggle-button.js +2 -2
- package/dist/components/main-panel/list-toggle-button.js.map +1 -1
- package/dist/components/map-overlay/attribution.js +1 -1
- package/dist/components/map-overlay/attribution.js.map +1 -1
- package/dist/components/map-overlay/info-overlay-left.js +2 -2
- package/dist/components/map-overlay/info-overlay-left.js.map +1 -1
- package/dist/components/map-overlay/info-overlay-right.js +2 -2
- package/dist/components/map-overlay/info-overlay-right.js.map +1 -1
- package/dist/components/map-overlay/legend.js +1 -1
- package/dist/components/map-overlay/legend.js.map +1 -1
- package/dist/components/map-overlay/measure-distance-button.js +1 -1
- package/dist/components/map-overlay/measure-distance-button.js.map +1 -1
- package/dist/components/map-overlay/mini-legend.js +2 -2
- package/dist/components/map-overlay/mini-legend.js.map +1 -1
- package/dist/components/map-overlay/region-selector.js +2 -2
- package/dist/components/map-overlay/region-selector.js.map +1 -1
- package/dist/components/map-overlay/search-overlay.js +1 -1
- package/dist/components/map-overlay/search-overlay.js.map +1 -1
- package/dist/components/map-overlay/share-position-link-button.js +1 -1
- package/dist/components/map-overlay/share-position-link-button.js.map +1 -1
- package/dist/components/map-synced-interlay/index.d.ts +2 -5
- package/dist/components/map-synced-interlay/index.d.ts.map +1 -1
- package/dist/components/map-synced-interlay/index.js +5 -6
- package/dist/components/map-synced-interlay/index.js.map +1 -1
- package/dist/components/map-synced-interlay/map-synced-interlay.js +1 -1
- package/dist/components/map-synced-interlay/map-synced-interlay.js.map +1 -1
- package/dist/components/map-synced-interlay/tooltip.js +1 -1
- package/dist/components/map-synced-interlay/tooltip.js.map +1 -1
- package/dist/components/map.d.ts +6 -5
- package/dist/components/map.d.ts.map +1 -1
- package/dist/components/map.js +15 -5
- package/dist/components/map.js.map +1 -1
- package/dist/components/search/index.js +2 -2
- package/dist/components/search/index.js.map +1 -1
- package/dist/components/search/result-entry.js +1 -1
- package/dist/components/search/result-entry.js.map +1 -1
- package/dist/components/search/result.js +1 -1
- package/dist/components/search/result.js.map +1 -1
- package/dist/components/switcher/SwitcherEntry.d.ts +21 -3
- package/dist/components/switcher/SwitcherEntry.d.ts.map +1 -1
- package/dist/components/switcher/SwitcherEntry.js +8 -9
- package/dist/components/switcher/SwitcherEntry.js.map +1 -1
- package/dist/components/tag-switcher/TagSwitcher.d.ts +2 -2
- package/dist/components/tag-switcher/TagSwitcher.d.ts.map +1 -1
- package/dist/components/tag-switcher/TagSwitcher.js.map +1 -1
- package/dist/components/tag-switcher/createTagSwitcherEntry.d.ts +13 -11
- package/dist/components/tag-switcher/createTagSwitcherEntry.d.ts.map +1 -1
- package/dist/components/tag-switcher/createTagSwitcherEntry.js +6 -12
- package/dist/components/tag-switcher/createTagSwitcherEntry.js.map +1 -1
- package/dist/components/tag-switcher/createTagSwitcherHeader.d.ts +12 -10
- package/dist/components/tag-switcher/createTagSwitcherHeader.d.ts.map +1 -1
- package/dist/components/tag-switcher/createTagSwitcherHeader.js +5 -5
- package/dist/components/tag-switcher/createTagSwitcherHeader.js.map +1 -1
- package/dist/components/tag-switcher/index.d.ts +2 -5
- package/dist/components/tag-switcher/index.d.ts.map +1 -1
- package/dist/components/tag-switcher/index.js +6 -7
- package/dist/components/tag-switcher/index.js.map +1 -1
- package/dist/components/view-toggle-button/index.d.ts +6 -5
- package/dist/components/view-toggle-button/index.d.ts.map +1 -1
- package/dist/components/view-toggle-button/index.js +8 -8
- package/dist/components/view-toggle-button/index.js.map +1 -1
- package/dist/components/view-toggle-button/mobile-button.d.ts +1 -1
- package/dist/components/view-toggle-button/mobile-button.d.ts.map +1 -1
- package/dist/components/view-toggle-button/mobile-button.js.map +1 -1
- package/dist/components/view-toggle-button/view-toggle-button.js +1 -1
- package/dist/components/view-toggle-button/view-toggle-button.js.map +1 -1
- package/dist/components/view-toggle-button/viewport-button.d.ts +1 -1
- package/dist/components/view-toggle-button/viewport-button.d.ts.map +1 -1
- package/dist/components/view-toggle-button/viewport-button.js.map +1 -1
- package/dist/helpers/components.d.ts +1 -1
- package/dist/helpers/components.d.ts.map +1 -1
- package/dist/helpers/create-action-watcher.d.ts +1 -1
- package/dist/helpers/create-action-watcher.d.ts.map +1 -1
- package/dist/helpers/create-action-watcher.js +1 -1
- package/dist/helpers/create-action-watcher.js.map +1 -1
- package/dist/hooks/useMountable.d.ts +2 -2
- package/dist/hooks/useMountable.d.ts.map +1 -1
- package/dist/hooks/useMountable.js +6 -0
- package/dist/hooks/useMountable.js.map +1 -1
- package/dist/hooks/useStickyHeader.d.ts +3 -3
- package/dist/hooks/useStickyHeader.d.ts.map +1 -1
- package/dist/hooks/useStickyHeader.js +3 -3
- package/dist/hooks/useStickyHeader.js.map +1 -1
- package/dist/hooks/useUpdateMapSizeCallback.d.ts +1 -1
- package/dist/hooks/useUpdateMapSizeCallback.d.ts.map +1 -1
- package/dist/hooks/useUpdateMapSizeOnRender.d.ts +1 -1
- package/dist/hooks/useUpdateMapSizeOnRender.d.ts.map +1 -1
- package/dist/hooks/useUpdateMapSizeOnTransitionEnd.d.ts +1 -1
- package/dist/hooks/useUpdateMapSizeOnTransitionEnd.d.ts.map +1 -1
- package/dist/hooks/useUpdateMapSizeOnViewChange.d.ts +1 -1
- package/dist/hooks/useUpdateMapSizeOnViewChange.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/plugins/browser/app-title.d.ts +1 -1
- package/dist/plugins/browser/app-title.d.ts.map +1 -1
- package/dist/plugins/browser/feature-deep-link.d.ts +1 -1
- package/dist/plugins/browser/feature-deep-link.d.ts.map +1 -1
- package/dist/plugins/browser/feature-deep-link.js.map +1 -1
- package/dist/plugins/browser/local-storage.d.ts +1 -1
- package/dist/plugins/browser/local-storage.d.ts.map +1 -1
- package/dist/plugins/browser/native-fullscreen.d.ts +2 -2
- package/dist/plugins/browser/native-fullscreen.d.ts.map +1 -1
- package/dist/plugins/browser/no-scroll.d.ts +3 -4
- package/dist/plugins/browser/no-scroll.d.ts.map +1 -1
- package/dist/plugins/browser/no-scroll.js.map +1 -1
- package/dist/plugins/browser/partial-content-changed-event.d.ts +1 -1
- package/dist/plugins/browser/partial-content-changed-event.d.ts.map +1 -1
- package/dist/plugins/browser/piwik-track-feature-selection-event.d.ts +1 -1
- package/dist/plugins/browser/piwik-track-feature-selection-event.d.ts.map +1 -1
- package/dist/plugins/browser/piwik-track-fullscreen-toggle-event.d.ts +1 -1
- package/dist/plugins/browser/piwik-track-fullscreen-toggle-event.d.ts.map +1 -1
- package/dist/plugins/browser/search.d.ts +1 -1
- package/dist/plugins/browser/search.d.ts.map +1 -1
- package/dist/plugins/browser/share-position-link.d.ts +1 -1
- package/dist/plugins/browser/share-position-link.d.ts.map +1 -1
- package/dist/plugins/browser/share-position-link.js +1 -1
- package/dist/plugins/browser/share-position-link.js.map +1 -1
- package/dist/plugins/browser/toggle-mobile-views.d.ts +1 -1
- package/dist/plugins/browser/toggle-mobile-views.d.ts.map +1 -1
- package/dist/plugins/browser/user-geolocation.d.ts +1 -1
- package/dist/plugins/browser/user-geolocation.d.ts.map +1 -1
- package/dist/plugins/browser/user-geolocation.js +7 -6
- package/dist/plugins/browser/user-geolocation.js.map +1 -1
- package/dist/plugins/browser/views.d.ts +1 -1
- package/dist/plugins/browser/views.d.ts.map +1 -1
- package/dist/plugins/browser-defaults.d.ts +13 -13
- package/dist/plugins/browser-defaults.d.ts.map +1 -1
- package/dist/plugins/browser-defaults.js +13 -13
- package/dist/plugins/browser-defaults.js.map +1 -1
- package/dist/plugins/common/feature-selection-details-url.d.ts +1 -1
- package/dist/plugins/common/feature-selection-details-url.d.ts.map +1 -1
- package/dist/plugins/common/measure-distance.d.ts +1 -1
- package/dist/plugins/common/measure-distance.d.ts.map +1 -1
- package/dist/plugins/common/measure-distance.js +1 -1
- package/dist/plugins/common/measure-distance.js.map +1 -1
- package/dist/plugins/common/ol-proxy.d.ts +1 -1
- package/dist/plugins/common/ol-proxy.d.ts.map +1 -1
- package/dist/plugins/common/render-await-feature-details-loaded.d.ts +1 -1
- package/dist/plugins/common/render-await-feature-details-loaded.d.ts.map +1 -1
- package/dist/plugins/common/render-await-feature-details-loaded.js +2 -1
- package/dist/plugins/common/render-await-feature-details-loaded.js.map +1 -1
- package/dist/plugins/common/render-await-list-feature-sources-loaded.d.ts +1 -1
- package/dist/plugins/common/render-await-list-feature-sources-loaded.d.ts.map +1 -1
- package/dist/plugins/common/render-await-list-feature-sources-loaded.js +2 -1
- package/dist/plugins/common/render-await-list-feature-sources-loaded.js.map +1 -1
- package/dist/plugins/server/feature-deep-link.d.ts +1 -1
- package/dist/plugins/server/feature-deep-link.d.ts.map +1 -1
- package/dist/plugins/server-defaults.d.ts +4 -4
- package/dist/plugins/server-defaults.d.ts.map +1 -1
- package/dist/plugins/server-defaults.js +4 -4
- package/dist/plugins/server-defaults.js.map +1 -1
- package/dist/renderer/browser-dom.d.ts.map +1 -1
- package/dist/renderer/browser-dom.js +6 -2
- package/dist/renderer/browser-dom.js.map +1 -1
- package/dist/renderer/server-string.js +2 -2
- package/dist/renderer/server-string.js.map +1 -1
- package/dist/store/actions.d.ts +4 -2
- package/dist/store/actions.d.ts.map +1 -1
- package/dist/store/actions.js +1 -1
- package/dist/store/actions.js.map +1 -1
- package/dist/store/reducers.d.ts +222 -9
- package/dist/store/reducers.d.ts.map +1 -1
- package/dist/store/reducers.js +1 -1
- package/dist/store/reducers.js.map +1 -1
- package/dist/store/selectors.d.ts +274 -243
- package/dist/store/selectors.d.ts.map +1 -1
- package/dist/store/selectors.js +49 -68
- package/dist/store/selectors.js.map +1 -1
- package/dist/types.d.ts +50 -35
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -8
- package/src/js/components/{app.jsx → app.tsx} +9 -14
- package/src/js/components/feature-details-content/feature-details-content.jsx +2 -2
- package/src/js/components/feature-details-content/index.js +7 -11
- package/src/js/components/feature-list/filter.jsx +2 -2
- package/src/js/components/feature-list/hooks/useAutoloadFeatureSource.ts +1 -1
- package/src/js/components/feature-list/hooks/useFeatureListState.ts +17 -9
- package/src/js/components/feature-list/hooks/useRestoreDocumentScroll.js +1 -1
- package/src/js/components/feature-list/hooks/useSelectFeature.js +6 -6
- package/src/js/components/feature-list/index.jsx +4 -4
- package/src/js/components/feature-list-cycling/index.js +1 -1
- package/src/js/components/feature-list-sorting/index.js +6 -9
- package/src/js/components/feature-selection-info/index.tsx +3 -3
- package/src/js/components/feature-selection-info/{with-sticky-header.jsx → with-sticky-header.tsx} +23 -8
- package/src/js/components/helping/app-context.tsx +1 -1
- package/src/js/components/layer-switcher/GroupedLayerSwitcher.js +1 -1
- package/src/js/components/layer-switcher/{LayerSwitcher.js → LayerSwitcher.ts} +11 -4
- package/src/js/components/layer-switcher/{LayerSwticherContainer.jsx → LayerSwitcherContainer.tsx} +22 -14
- package/src/js/components/layer-switcher/LayerSwitcherEntry.ts +152 -0
- package/src/js/components/layer-switcher/index.ts +42 -0
- package/src/js/components/layout/wrapper.jsx +1 -1
- package/src/js/components/main-panel/context.tsx +71 -0
- package/src/js/components/main-panel/list-toggle-button.jsx +2 -2
- package/src/js/components/map-overlay/attribution.tsx +1 -1
- package/src/js/components/map-overlay/info-overlay-left.jsx +2 -2
- package/src/js/components/map-overlay/info-overlay-right.jsx +2 -2
- package/src/js/components/map-overlay/legend.tsx +1 -1
- package/src/js/components/map-overlay/measure-distance-button.tsx +1 -1
- package/src/js/components/map-overlay/mini-legend.jsx +2 -2
- package/src/js/components/map-overlay/region-selector.jsx +2 -2
- package/src/js/components/map-overlay/search-overlay.jsx +1 -1
- package/src/js/components/map-overlay/share-position-link-button.tsx +1 -1
- package/src/js/components/map-synced-interlay/index.ts +15 -0
- package/src/js/components/map-synced-interlay/map-synced-interlay.jsx +1 -1
- package/src/js/components/map-synced-interlay/tooltip.tsx +1 -1
- package/src/js/components/map.tsx +55 -0
- package/src/js/components/search/index.jsx +2 -2
- package/src/js/components/search/result-entry.jsx +1 -1
- package/src/js/components/search/result.jsx +1 -1
- package/src/js/components/switcher/{SwitcherEntry.jsx → SwitcherEntry.tsx} +47 -26
- package/src/js/components/tag-switcher/{TagSwitcher.jsx → TagSwitcher.tsx} +1 -2
- package/src/js/components/tag-switcher/{createTagSwitcherEntry.js → createTagSwitcherEntry.ts} +14 -16
- package/src/js/components/tag-switcher/createTagSwitcherHeader.ts +47 -0
- package/src/js/components/tag-switcher/index.ts +17 -0
- package/src/js/components/view-toggle-button/{index.js → index.ts} +13 -10
- package/src/js/components/view-toggle-button/view-toggle-button.jsx +1 -1
- package/src/js/helpers/components.ts +1 -1
- package/src/js/helpers/create-action-watcher.ts +3 -3
- package/src/js/hooks/useMountable.ts +10 -1
- package/src/js/hooks/useStickyHeader.ts +7 -8
- package/src/js/hooks/useUpdateMapSizeCallback.ts +1 -1
- package/src/js/hooks/useUpdateMapSizeOnRender.ts +1 -1
- package/src/js/hooks/useUpdateMapSizeOnTransitionEnd.ts +1 -1
- package/src/js/hooks/useUpdateMapSizeOnViewChange.ts +1 -1
- package/src/js/index.ts +4 -3
- package/src/js/plugins/browser/app-title.ts +1 -1
- package/src/js/plugins/browser/feature-deep-link.ts +4 -3
- package/src/js/plugins/browser/local-storage.ts +1 -1
- package/src/js/plugins/browser/native-fullscreen.ts +2 -2
- package/src/js/plugins/browser/no-scroll.ts +3 -2
- package/src/js/plugins/browser/partial-content-changed-event.ts +1 -1
- package/src/js/plugins/browser/piwik-track-feature-selection-event.ts +1 -1
- package/src/js/plugins/browser/piwik-track-fullscreen-toggle-event.ts +1 -1
- package/src/js/plugins/browser/search.ts +1 -1
- package/src/js/plugins/browser/share-position-link.ts +2 -2
- package/src/js/plugins/browser/toggle-mobile-views.ts +1 -1
- package/src/js/plugins/browser/user-geolocation.ts +20 -12
- package/src/js/plugins/browser/views.ts +1 -1
- package/src/js/plugins/browser-defaults.ts +14 -14
- package/src/js/plugins/common/feature-selection-details-url.ts +1 -1
- package/src/js/plugins/common/measure-distance.ts +4 -4
- package/src/js/plugins/common/ol-proxy.ts +1 -1
- package/src/js/plugins/common/render-await-feature-details-loaded.ts +3 -2
- package/src/js/plugins/common/render-await-list-feature-sources-loaded.ts +3 -2
- package/src/js/plugins/server/feature-deep-link.ts +1 -1
- package/src/js/plugins/server-defaults.ts +5 -5
- package/src/js/renderer/browser-dom.tsx +8 -4
- package/src/js/renderer/server-string.tsx +2 -2
- package/src/js/store/actions.ts +24 -10
- package/src/js/store/reducers.ts +3 -3
- package/src/js/store/selectors.ts +192 -158
- package/src/js/types.ts +65 -41
- package/dist/components/layer-switcher/LayerSwticherContainer.d.ts +0 -4
- package/dist/components/layer-switcher/LayerSwticherContainer.d.ts.map +0 -1
- package/dist/components/layer-switcher/LayerSwticherContainer.js.map +0 -1
- package/src/js/components/layer-switcher/LayerSwitcherEntry.js +0 -132
- package/src/js/components/layer-switcher/index.js +0 -47
- package/src/js/components/main-panel/context.jsx +0 -62
- package/src/js/components/map-synced-interlay/index.js +0 -17
- package/src/js/components/map.jsx +0 -37
- package/src/js/components/tag-switcher/createTagSwitcherHeader.js +0 -34
- package/src/js/components/tag-switcher/index.js +0 -20
- package/src/js/global.d.ts +0 -7
- /package/src/js/components/view-toggle-button/{mobile-button.jsx → mobile-button.tsx} +0 -0
- /package/src/js/components/view-toggle-button/{viewport-button.jsx → viewport-button.tsx} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {Store} from "
|
|
1
|
+
import type {Store} from "@reduxjs/toolkit";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
deselectAll,
|
|
@@ -15,8 +15,9 @@ import {VIEW_MAP_ONLY} from "../../config/constants/app";
|
|
|
15
15
|
import * as c from "../../config/constants/controllers";
|
|
16
16
|
import {FEATURE_SELECTION_SELECT} from "../../config/feature/selections";
|
|
17
17
|
import {setView} from "../../store/actions";
|
|
18
|
+
import type {RootStateSlice} from "../../store/selectors";
|
|
18
19
|
import {isViewMobile, viewSelector} from "../../store/selectors";
|
|
19
|
-
import type {PluginInstance
|
|
20
|
+
import type {PluginInstance} from "../../types";
|
|
20
21
|
|
|
21
22
|
const defaultFeatureSelectionsController = c.FEATURE_SELECTIONS;
|
|
22
23
|
const defaultFeatureSelection = FEATURE_SELECTION_SELECT;
|
|
@@ -40,7 +41,7 @@ function selectFeature(
|
|
|
40
41
|
|
|
41
42
|
if (
|
|
42
43
|
setMapOnlyViewInMobile &&
|
|
43
|
-
isViewMobile(viewSelector(store.getState() as
|
|
44
|
+
isViewMobile(viewSelector(store.getState() as RootStateSlice))
|
|
44
45
|
) {
|
|
45
46
|
store.dispatch(setView(VIEW_MAP_ONLY));
|
|
46
47
|
}
|
|
@@ -7,7 +7,7 @@ import type {State} from "@mapsight/core/types";
|
|
|
7
7
|
import pickPaths from "@mapsight/lib-js/object/pickPaths";
|
|
8
8
|
import {createStorage} from "@mapsight/lib-redux/local-storage";
|
|
9
9
|
|
|
10
|
-
import type {PluginInstance} from "../../types
|
|
10
|
+
import type {PluginInstance} from "../../types";
|
|
11
11
|
|
|
12
12
|
const defaultLocalStorageKey = "mapsight--v3-ui";
|
|
13
13
|
const defaultLocalStoragePaths = [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {observeState} from "@mapsight/lib-redux/observe-state";
|
|
2
2
|
|
|
3
|
-
import type {View} from "../../config/constants/app
|
|
3
|
+
import type {View} from "../../config/constants/app";
|
|
4
4
|
import {viewSelector} from "../../store/selectors";
|
|
5
|
-
import type {PluginInstance} from "../../types
|
|
5
|
+
import type {PluginInstance} from "../../types";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* This plugin will request native fullscreen when entering one of the
|
|
@@ -3,8 +3,9 @@ import type {State} from "@mapsight/core/types";
|
|
|
3
3
|
import {getAndObserveState} from "@mapsight/lib-redux/observe-state";
|
|
4
4
|
|
|
5
5
|
import {VIEW_FULLSCREEN, VIEW_MAP_ONLY} from "../../config/constants/app";
|
|
6
|
+
import type {RootStateSlice} from "../../store/selectors";
|
|
6
7
|
import {viewSelector} from "../../store/selectors";
|
|
7
|
-
import type {PluginInstance
|
|
8
|
+
import type {PluginInstance} from "../../types";
|
|
8
9
|
|
|
9
10
|
function onTouchMoveNoScroll(e: TouchEvent) {
|
|
10
11
|
e.preventDefault();
|
|
@@ -39,7 +40,7 @@ export function createNoScrollHandler(
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export const defaultNoScrollHandler = createNoScrollHandler(
|
|
42
|
-
(state:
|
|
43
|
+
(state: RootStateSlice) => {
|
|
43
44
|
const view = viewSelector(state);
|
|
44
45
|
return view === VIEW_MAP_ONLY || view === VIEW_FULLSCREEN;
|
|
45
46
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {APP_EVENT_PARTIAL_CONTENT_CHANGED} from "../../components/helping/app-channel";
|
|
2
|
-
import type {PluginInstance} from "../../types
|
|
2
|
+
import type {PluginInstance} from "../../types";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* This plugin will call the partialChangeHandler (@see {CreateOptions.partialChangeHandler}) when some partial content
|
|
@@ -8,7 +8,7 @@ import {observeState} from "@mapsight/lib-redux/observe-state";
|
|
|
8
8
|
|
|
9
9
|
import * as c from "../../config/constants/controllers";
|
|
10
10
|
import {FEATURE_SELECTION_SELECT} from "../../config/feature/selections";
|
|
11
|
-
import type {PluginInstance} from "../../types
|
|
11
|
+
import type {PluginInstance} from "../../types";
|
|
12
12
|
|
|
13
13
|
const defaultCategory = "Mapsight";
|
|
14
14
|
const defaultAction = "SelectedFeature";
|
|
@@ -2,7 +2,7 @@ import {trackEvent} from "@mapsight/lib-js/misc/piwik";
|
|
|
2
2
|
import {observeState} from "@mapsight/lib-redux/observe-state";
|
|
3
3
|
|
|
4
4
|
import {isFullscreenSelector} from "../../store/selectors";
|
|
5
|
-
import type {PluginInstance} from "../../types
|
|
5
|
+
import type {PluginInstance} from "../../types";
|
|
6
6
|
|
|
7
7
|
const defaultCategory = "Mapsight";
|
|
8
8
|
const defaultActionEnabled = "FullscreenEnabled";
|
|
@@ -2,7 +2,7 @@ import {FeatureSourcesController} from "@mapsight/core/lib/feature-sources/contr
|
|
|
2
2
|
|
|
3
3
|
import * as c from "../../config/constants/controllers";
|
|
4
4
|
import {searchResultSelectionFeatureSourceSelector} from "../../store/selectors";
|
|
5
|
-
import type {PluginInstance} from "../../types
|
|
5
|
+
import type {PluginInstance} from "../../types";
|
|
6
6
|
|
|
7
7
|
const defaultFeatureSourceId = "searchResult";
|
|
8
8
|
const defaultFeatureSourcesControllerName = c.FEATURE_SOURCES;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import {createSelector} from "@reduxjs/toolkit";
|
|
1
2
|
import proj4 from "proj4";
|
|
2
|
-
import {createSelector} from "reselect";
|
|
3
3
|
|
|
4
4
|
import {mergeAll, set} from "@mapsight/core/lib/base/actions";
|
|
5
5
|
import {createFilteredFeatureSourceSelector} from "@mapsight/core/lib/feature-sources/selectors";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from "../../config/constants/controllers";
|
|
27
27
|
import {features, metaData} from "../../config/map/layers";
|
|
28
28
|
import {translate} from "../../helpers/i18n";
|
|
29
|
-
import type {PluginInstance} from "../../types
|
|
29
|
+
import type {PluginInstance} from "../../types";
|
|
30
30
|
|
|
31
31
|
export const createActivateAction = (mapController, name) =>
|
|
32
32
|
activateInteraction(mapController, `${name}_drawInteraction`);
|
|
@@ -4,7 +4,7 @@ import {VIEW_MAP_ONLY, VIEW_MOBILE} from "../../config/constants/app";
|
|
|
4
4
|
import * as c from "../../config/constants/controllers";
|
|
5
5
|
import {setView} from "../../store/actions";
|
|
6
6
|
import {isEmbeddedMapSelector, viewSelector} from "../../store/selectors";
|
|
7
|
-
import type {PluginInstance} from "../../types
|
|
7
|
+
import type {PluginInstance} from "../../types";
|
|
8
8
|
|
|
9
9
|
const defaultMapControllerName = c.MAP;
|
|
10
10
|
const defaultToggleBrowserEvent = "click";
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {createSelector
|
|
1
|
+
import {createSelector} from "@reduxjs/toolkit";
|
|
2
2
|
|
|
3
3
|
import {set} from "@mapsight/core/lib/base/actions";
|
|
4
4
|
import {FeatureSourcesController} from "@mapsight/core/lib/feature-sources/controller";
|
|
5
5
|
import {getGeolocation} from "@mapsight/core/lib/user-geolocation/actions";
|
|
6
|
-
import {
|
|
6
|
+
import type {UserGeolocationState} from "@mapsight/core/lib/user-geolocation/selectors";
|
|
7
|
+
import createUserGeolocationIsEnabledSelector, {
|
|
7
8
|
createUserGeolocationAsFeatureSelector,
|
|
8
|
-
createUserGeolocationIsEnabledSelector,
|
|
9
9
|
geolocationStatusSelector,
|
|
10
10
|
} from "@mapsight/core/lib/user-geolocation/selectors";
|
|
11
|
+
import type {State} from "@mapsight/core/types";
|
|
11
12
|
|
|
12
13
|
import {createStorage} from "@mapsight/lib-redux/local-storage";
|
|
13
14
|
import {
|
|
@@ -16,7 +17,7 @@ import {
|
|
|
16
17
|
} from "@mapsight/lib-redux/observe-state";
|
|
17
18
|
|
|
18
19
|
import * as c from "../../config/constants/controllers";
|
|
19
|
-
import type {PluginInstance} from "../../types
|
|
20
|
+
import type {PluginInstance} from "../../types";
|
|
20
21
|
|
|
21
22
|
const defaultFeatureSourceId = "userGeolocation";
|
|
22
23
|
const defaultFeatureSourcesControllerName = c.FEATURE_SOURCES;
|
|
@@ -103,19 +104,26 @@ export default function createPlugin(
|
|
|
103
104
|
);
|
|
104
105
|
|
|
105
106
|
const geoLocStatusSelector = createSelector(
|
|
106
|
-
(state) =>
|
|
107
|
+
(state: State) =>
|
|
108
|
+
state[
|
|
109
|
+
userGeolocationControllerName
|
|
110
|
+
] as UserGeolocationState,
|
|
107
111
|
geolocationStatusSelector,
|
|
108
112
|
);
|
|
113
|
+
const alreadyRequestedSelector = createSelector(
|
|
114
|
+
geoLocStatusSelector,
|
|
115
|
+
(status) => status === "loading" || status === "error",
|
|
116
|
+
);
|
|
109
117
|
|
|
110
118
|
getAndObserveState(
|
|
111
119
|
store,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
alreadyRequested
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
),
|
|
118
|
-
|
|
120
|
+
createSelector(
|
|
121
|
+
[geoLocIsEnabledSelector, alreadyRequestedSelector],
|
|
122
|
+
(isEnabled, alreadyRequested) => ({
|
|
123
|
+
isEnabled,
|
|
124
|
+
alreadyRequested,
|
|
125
|
+
}),
|
|
126
|
+
),
|
|
119
127
|
({isEnabled, alreadyRequested}) => {
|
|
120
128
|
if (alreadyRequested) {
|
|
121
129
|
return AbortObserving;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {FEATURE_SELECTION_PRESELECT} from "../config/feature/selections";
|
|
2
|
-
import type {PluginDefinition} from "../types
|
|
3
|
-
import createAppTitlePlugin from "./browser/app-title
|
|
4
|
-
import createFeatureDeepLinkPlugin from "./browser/feature-deep-link
|
|
5
|
-
import createLocalStoragePlugin from "./browser/local-storage
|
|
6
|
-
import createNoScrollPlugin from "./browser/no-scroll
|
|
7
|
-
import createPiwikTrackFeatureSelectionEventPlugin from "./browser/piwik-track-feature-selection-event
|
|
8
|
-
import createPiwikTrackFullscreenToggleEventPlugin from "./browser/piwik-track-fullscreen-toggle-event
|
|
2
|
+
import type {PluginDefinition} from "../types";
|
|
3
|
+
import createAppTitlePlugin from "./browser/app-title";
|
|
4
|
+
import createFeatureDeepLinkPlugin from "./browser/feature-deep-link";
|
|
5
|
+
import createLocalStoragePlugin from "./browser/local-storage";
|
|
6
|
+
import createNoScrollPlugin from "./browser/no-scroll";
|
|
7
|
+
import createPiwikTrackFeatureSelectionEventPlugin from "./browser/piwik-track-feature-selection-event";
|
|
8
|
+
import createPiwikTrackFullscreenToggleEventPlugin from "./browser/piwik-track-fullscreen-toggle-event";
|
|
9
9
|
//import createQuitFullscreenOnRenderPlugin from './browser/quit-fullscreen-on-render';
|
|
10
|
-
import createSearchPlugin from "./browser/search
|
|
11
|
-
import createToggleMobileViewsPlugin from "./browser/toggle-mobile-views
|
|
12
|
-
import createUserGeolocationPlugin from "./browser/user-geolocation
|
|
13
|
-
import createViewsPlugin from "./browser/views
|
|
14
|
-
import createFeatureSelectionDetailsUrlPlugin from "./common/feature-selection-details-url
|
|
15
|
-
import createLangPlugin from "./common/lang
|
|
16
|
-
import createOlProxyPlugin from "./common/ol-proxy
|
|
10
|
+
import createSearchPlugin from "./browser/search";
|
|
11
|
+
import createToggleMobileViewsPlugin from "./browser/toggle-mobile-views";
|
|
12
|
+
import createUserGeolocationPlugin from "./browser/user-geolocation";
|
|
13
|
+
import createViewsPlugin from "./browser/views";
|
|
14
|
+
import createFeatureSelectionDetailsUrlPlugin from "./common/feature-selection-details-url";
|
|
15
|
+
import createLangPlugin from "./common/lang";
|
|
16
|
+
import createOlProxyPlugin from "./common/ol-proxy";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Create the default set of plugins for use in the browser IN ORDER!
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
MapsightUiFeature,
|
|
14
14
|
MapsightUiFeatureProperty,
|
|
15
15
|
PluginInstance,
|
|
16
|
-
} from "../../types
|
|
16
|
+
} from "../../types";
|
|
17
17
|
|
|
18
18
|
const defaultFeatureSelectionsController = c.FEATURE_SELECTIONS;
|
|
19
19
|
const defaultFeatureSourcesController = c.FEATURE_SOURCES;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {createSelector} from "reselect";
|
|
1
|
+
import {createSelector} from "@reduxjs/toolkit";
|
|
3
2
|
|
|
4
3
|
import {mergeAll} from "@mapsight/core/lib/base/actions";
|
|
5
4
|
import {createFilteredFeatureSourceSelector} from "@mapsight/core/lib/feature-sources/selectors";
|
|
@@ -14,6 +13,7 @@ import {
|
|
|
14
13
|
import type {Definition} from "@mapsight/core/ol-proxy";
|
|
15
14
|
import {di} from "@mapsight/core/ol-proxy";
|
|
16
15
|
import DrawInteraction from "@mapsight/core/ol-proxy/definitions/interaction/DrawInteraction";
|
|
16
|
+
import type {EnhancedStore} from "@mapsight/core/types";
|
|
17
17
|
|
|
18
18
|
import {observeState} from "@mapsight/lib-redux/observe-state";
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
MAP,
|
|
24
24
|
} from "../../config/constants/controllers";
|
|
25
25
|
import {getDictionary} from "../../helpers/i18n";
|
|
26
|
-
import type {PluginInstance} from "../../types
|
|
26
|
+
import type {PluginInstance} from "../../types";
|
|
27
27
|
|
|
28
28
|
export const createActivateAction = (mapController: string, name: string) =>
|
|
29
29
|
activateInteraction(mapController, `${name}_drawInteraction`);
|
|
@@ -49,7 +49,7 @@ function setupDrawInteraction({
|
|
|
49
49
|
drawStyle,
|
|
50
50
|
displayStyle,
|
|
51
51
|
}: {
|
|
52
|
-
store:
|
|
52
|
+
store: EnhancedStore;
|
|
53
53
|
name: string;
|
|
54
54
|
featureSourcesControllerName: string;
|
|
55
55
|
featureSelectionsControllerName: string;
|
|
@@ -16,7 +16,7 @@ import TileWMSSource from "@mapsight/core/ol-proxy/definitions/source/TileWMSSou
|
|
|
16
16
|
import VectorFeatureSource from "@mapsight/core/ol-proxy/definitions/source/VectorFeatureSource";
|
|
17
17
|
import VectorSource from "@mapsight/core/ol-proxy/definitions/source/VectorSource";
|
|
18
18
|
|
|
19
|
-
import type {PluginInstance} from "../../types
|
|
19
|
+
import type {PluginInstance} from "../../types";
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* This plugin will inject the ol-proxy dependencies required by default.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {compose} from "
|
|
1
|
+
import {compose} from "@reduxjs/toolkit";
|
|
2
2
|
|
|
3
3
|
import type {FeatureSelectionsState} from "@mapsight/core/lib/feature-selections/selectors";
|
|
4
4
|
import {LOAD_FEATURE_SOURCE_SUCCESS} from "@mapsight/core/lib/feature-sources/actions";
|
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
MapsightUiFeature,
|
|
22
22
|
MapsightUiFeatureProperty,
|
|
23
23
|
PluginInstance,
|
|
24
|
-
} from "../../types
|
|
24
|
+
} from "../../types";
|
|
25
25
|
|
|
26
26
|
const defaultFeatureSelection = "select";
|
|
27
27
|
const defaultFeatureSelectionsController = FEATURE_SELECTIONS;
|
|
@@ -54,6 +54,7 @@ export default function createFeatureDetailsLoadedPlugin(
|
|
|
54
54
|
|
|
55
55
|
return {
|
|
56
56
|
afterInit: function runAwaitFeatureDetailsLoadedInitPlugin(context) {
|
|
57
|
+
// @ts-expect-error TODO
|
|
57
58
|
context.storeEnhancer = context.storeEnhancer
|
|
58
59
|
? compose(
|
|
59
60
|
context.storeEnhancer,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {compose} from "
|
|
1
|
+
import {compose} from "@reduxjs/toolkit";
|
|
2
2
|
|
|
3
3
|
import type {LoadOptions} from "@mapsight/core/lib/feature-sources/actions";
|
|
4
4
|
import {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
FEATURE_SOURCES,
|
|
15
15
|
} from "../../config/constants/controllers";
|
|
16
16
|
import createActionWatcher from "../../helpers/create-action-watcher";
|
|
17
|
-
import type {MapsightUiContext, PluginInstance} from "../../types
|
|
17
|
+
import type {MapsightUiContext, PluginInstance} from "../../types";
|
|
18
18
|
|
|
19
19
|
const defaultLoadOptions: LoadOptions = {};
|
|
20
20
|
const defaultListControllerName = FEATURE_LIST;
|
|
@@ -44,6 +44,7 @@ export default function createPlugin(
|
|
|
44
44
|
afterInit: function renderAwaitListFeatureSourcesLoadedInitPlugin(
|
|
45
45
|
context,
|
|
46
46
|
) {
|
|
47
|
+
// @ts-expect-error TODO
|
|
47
48
|
context.storeEnhancer = context.storeEnhancer
|
|
48
49
|
? compose(context.storeEnhancer, actionWatcher.enhancer)
|
|
49
50
|
: actionWatcher.enhancer;
|
|
@@ -7,7 +7,7 @@ import {FEATURE_SELECTION_SELECT} from "../../config/feature/selections";
|
|
|
7
7
|
import type {
|
|
8
8
|
ExternalMapsightUiRendererProps,
|
|
9
9
|
PluginInstance,
|
|
10
|
-
} from "../../types
|
|
10
|
+
} from "../../types";
|
|
11
11
|
|
|
12
12
|
const defaultFeatureSelectionsController = c.FEATURE_SELECTIONS;
|
|
13
13
|
const defaultFeatureSelection = FEATURE_SELECTION_SELECT;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {PluginDefinition} from "../types
|
|
2
|
-
import createFeatureSelectionDetailsUrlPlugin from "./common/feature-selection-details-url
|
|
3
|
-
import createLangPlugin from "./common/lang
|
|
4
|
-
import createOlProxyPlugin from "./common/ol-proxy
|
|
5
|
-
import createFeatureDeepLinkPlugin from "./server/feature-deep-link
|
|
1
|
+
import type {PluginDefinition} from "../types";
|
|
2
|
+
import createFeatureSelectionDetailsUrlPlugin from "./common/feature-selection-details-url";
|
|
3
|
+
import createLangPlugin from "./common/lang";
|
|
4
|
+
import createOlProxyPlugin from "./common/ol-proxy";
|
|
5
|
+
import createFeatureDeepLinkPlugin from "./server/feature-deep-link";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Create the default set of plugins for use on the server IN ORDER!
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {createRoot, hydrateRoot} from "react-dom/client";
|
|
2
2
|
|
|
3
3
|
import App from "../components/app";
|
|
4
4
|
import AppContext from "../components/helping/app-context";
|
|
@@ -12,12 +12,16 @@ const mapsightUiBrowserDomRenderer: MapsightUiRenderer = (
|
|
|
12
12
|
props,
|
|
13
13
|
hydrate = false,
|
|
14
14
|
) => {
|
|
15
|
-
|
|
15
|
+
if (!container) return;
|
|
16
|
+
|
|
17
|
+
const app = (
|
|
16
18
|
<AppContext {...props}>
|
|
17
19
|
<App />
|
|
18
|
-
</AppContext
|
|
19
|
-
container,
|
|
20
|
+
</AppContext>
|
|
20
21
|
);
|
|
22
|
+
|
|
23
|
+
const root = hydrate ? hydrateRoot(container, app) : createRoot(container);
|
|
24
|
+
root.render(app);
|
|
21
25
|
};
|
|
22
26
|
|
|
23
27
|
export default mapsightUiBrowserDomRenderer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {renderToString} from "react-dom/server";
|
|
2
2
|
|
|
3
3
|
import App from "../components/app";
|
|
4
4
|
import AppContext from "../components/helping/app-context";
|
|
@@ -8,7 +8,7 @@ import type {MapsightUiRenderer} from "../types";
|
|
|
8
8
|
* Server side renderer for Node.js (renders a string)
|
|
9
9
|
*/
|
|
10
10
|
const mapsightUiServerStringRenderer: MapsightUiRenderer<string> = (_, props) =>
|
|
11
|
-
|
|
11
|
+
renderToString(
|
|
12
12
|
<AppContext {...props}>
|
|
13
13
|
<App />
|
|
14
14
|
</AppContext>,
|
package/src/js/store/actions.ts
CHANGED
|
@@ -21,7 +21,13 @@ import {
|
|
|
21
21
|
FEATURE_SELECTION_PRESELECT,
|
|
22
22
|
FEATURE_SELECTION_SELECT,
|
|
23
23
|
} from "../config/feature/selections";
|
|
24
|
-
import type {
|
|
24
|
+
import type {
|
|
25
|
+
FetchTextState,
|
|
26
|
+
FullUiState,
|
|
27
|
+
MapsightUiFeatureId,
|
|
28
|
+
UiState,
|
|
29
|
+
} from "../types";
|
|
30
|
+
import type {RootStateSlice} from "./selectors";
|
|
25
31
|
import {featureDetailsUrlSelector, regionsSelector} from "./selectors";
|
|
26
32
|
|
|
27
33
|
function ensureFullUrl(url: string) {
|
|
@@ -255,7 +261,7 @@ export function setMiniLegendLayer(layerId: string | null) {
|
|
|
255
261
|
};
|
|
256
262
|
}
|
|
257
263
|
|
|
258
|
-
export const SET_VIEW_BREAKPOINTS = "
|
|
264
|
+
export const SET_VIEW_BREAKPOINTS = "SET_VIEW_BREAKPOI";
|
|
259
265
|
|
|
260
266
|
export function setViewBreakpoints(value: FullUiState["viewBreakpoints"]) {
|
|
261
267
|
return {
|
|
@@ -367,13 +373,18 @@ export function fetchTextSuccess(key: string, data: unknown) {
|
|
|
367
373
|
};
|
|
368
374
|
}
|
|
369
375
|
|
|
376
|
+
export type FETCH_TEXT_STATUS =
|
|
377
|
+
| typeof FETCH_TEXT_STATUS_LOADING
|
|
378
|
+
| typeof FETCH_TEXT_STATUS_ERROR
|
|
379
|
+
| typeof FETCH_TEXT_STATUS_SUCCESS;
|
|
380
|
+
|
|
370
381
|
export const FETCH_TEXT_STATUS_LOADING = "loading";
|
|
371
382
|
export const FETCH_TEXT_STATUS_ERROR = "error";
|
|
372
383
|
export const FETCH_TEXT_STATUS_SUCCESS = "success";
|
|
373
384
|
|
|
374
385
|
export function fetchText(key: string, url: string): ThunkAction {
|
|
375
|
-
return function (dispatch, getState) {
|
|
376
|
-
const selectState = () => (getState().app as
|
|
386
|
+
return function (dispatch, getState: () => RootStateSlice) {
|
|
387
|
+
const selectState = () => (getState().app[key] as FetchTextState) || {};
|
|
377
388
|
|
|
378
389
|
// do not fetch again if already running
|
|
379
390
|
const state = selectState();
|
|
@@ -462,6 +473,11 @@ export function fetchJsonReset(key: string) {
|
|
|
462
473
|
};
|
|
463
474
|
}
|
|
464
475
|
|
|
476
|
+
export type FETCH_JSON_STATUS =
|
|
477
|
+
| typeof FETCH_JSON_STATUS_LOADING
|
|
478
|
+
| typeof FETCH_JSON_STATUS_ERROR
|
|
479
|
+
| typeof FETCH_JSON_STATUS_SUCCESS;
|
|
480
|
+
|
|
465
481
|
export const FETCH_JSON_STATUS_LOADING = "loading";
|
|
466
482
|
export const FETCH_JSON_STATUS_ERROR = "error";
|
|
467
483
|
export const FETCH_JSON_STATUS_SUCCESS = "success";
|
|
@@ -549,10 +565,8 @@ export const selectSearchResult = (feature: MapsightUiFeatureId) => ({
|
|
|
549
565
|
|
|
550
566
|
export const setFeatureDetailsUrl =
|
|
551
567
|
(detailsUrl: string): ThunkAction =>
|
|
552
|
-
(dispatch, getState) => {
|
|
553
|
-
const currentUrl = featureDetailsUrlSelector(
|
|
554
|
-
getState() as {app: UiState},
|
|
555
|
-
);
|
|
568
|
+
(dispatch, getState: () => RootStateSlice) => {
|
|
569
|
+
const currentUrl = featureDetailsUrlSelector(getState());
|
|
556
570
|
if (currentUrl !== detailsUrl) {
|
|
557
571
|
if (detailsUrl) {
|
|
558
572
|
dispatch(fetchText(DETAILS_CONTENT_STATE_KEY, detailsUrl));
|
|
@@ -621,12 +635,12 @@ export function setSelectedRegionIdAndAnimateMap(
|
|
|
621
635
|
return setSelectedRegionId(regionId);
|
|
622
636
|
}
|
|
623
637
|
|
|
624
|
-
return (dispatch, getState) => {
|
|
638
|
+
return (dispatch, getState: () => RootStateSlice) => {
|
|
625
639
|
dispatch(setSelectedRegionId(regionId));
|
|
626
640
|
|
|
627
641
|
// TODO: use `selectedRegionSelector`, not sure if it's safe to rely on the state
|
|
628
642
|
// change here
|
|
629
|
-
const regions = regionsSelector(getState()
|
|
643
|
+
const regions = regionsSelector(getState());
|
|
630
644
|
|
|
631
645
|
if (
|
|
632
646
|
regions &&
|
package/src/js/store/reducers.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {Action, AnyAction} from "
|
|
1
|
+
import type {Action, AnyAction} from "@reduxjs/toolkit";
|
|
2
2
|
|
|
3
3
|
import getPath from "@mapsight/lib-js/object/getPath";
|
|
4
4
|
import reducers from "@mapsight/lib-redux/reducers/immutable-path";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
VIEW_MOBILE,
|
|
11
11
|
} from "../config/constants/app";
|
|
12
12
|
import {TAG_FILTER} from "../config/constants/controllers";
|
|
13
|
-
import type {UiState} from "../types
|
|
13
|
+
import type {UiState} from "../types";
|
|
14
14
|
import {
|
|
15
15
|
FETCH_JSON_FAILURE,
|
|
16
16
|
FETCH_JSON_REQUEST,
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
SET_VIEW_BREAKPOINTS,
|
|
64
64
|
SORT_LIST,
|
|
65
65
|
TOGGLE_USER_PREFERENCE_LIST_VISIBLE,
|
|
66
|
-
} from "./actions
|
|
66
|
+
} from "./actions";
|
|
67
67
|
|
|
68
68
|
function determineView(state: UiState, isMobile: boolean) {
|
|
69
69
|
const {
|