@corpsmap/corpsmap 4.0.35 → 4.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/README.md +33 -0
- package/dist/corpsmap.css +1 -0
- package/dist/corpsmap.es.js +63856 -0
- package/dist/corpsmap.umd.js +384 -0
- package/dist/vite.svg +1 -0
- package/package.json +73 -32
- package/src/App.css +42 -0
- package/src/App.jsx +12 -0
- package/src/application-bundles/_create-container-bundle.js +102 -0
- package/src/application-bundles/api-bundle.js +76 -0
- package/src/application-bundles/basic-toolbar-bundle.js +57 -0
- package/src/application-bundles/config-bundle.js +38 -0
- package/src/application-bundles/create-ol-map-bundle.jsx +278 -0
- package/src/application-bundles/export-bundle.js +125 -0
- package/src/application-bundles/identify-bundle.js +119 -0
- package/src/application-bundles/index.js +53 -0
- package/src/application-bundles/map-basemap-bundle.js +73 -0
- package/src/application-bundles/map-core-bundle.js +25 -0
- package/src/application-bundles/map-drawing-bundle.js +120 -0
- package/src/application-bundles/map-interaction-bundle.js +50 -0
- package/src/application-bundles/map-layers-bundle.js +816 -0
- package/src/application-bundles/map-proj-bundle.js +144 -0
- package/src/application-bundles/map-view-bundle.jsx +334 -0
- package/src/application-bundles/modal-window-bundle.js +5 -0
- package/src/application-bundles/notification-bundle.js +56 -0
- package/src/application-bundles/plugin-bundle.js +180 -0
- package/src/application-bundles/primary-panel-bundle.js +85 -0
- package/src/application-bundles/search-bundle.js +122 -0
- package/src/application-bundles/south-region-bundle.js +96 -0
- package/src/application-bundles/theme-bundle.js +45 -0
- package/src/application-bundles/vertical-layout-bundle.js +88 -0
- package/src/application-bundles/viewport-bundle.js +43 -0
- package/src/application-bundles/window-location-bundle.js +90 -0
- package/src/application-bundles-old/auth-bundle.js +130 -0
- package/src/application-bundles-old/config-bundle.js +29 -0
- package/src/application-bundles-old/ui-bundle.js +406 -0
- package/src/application-containers/basic-toolbar.jsx +24 -0
- package/src/application-containers/corpsmap.jsx +91 -0
- package/src/application-containers/left-sidebar.jsx +43 -0
- package/src/application-containers/lower-right-toolbar.jsx +29 -0
- package/src/application-containers/map.jsx +57 -0
- package/src/application-containers/modal-window.jsx +34 -0
- package/src/application-containers/north-region.jsx +26 -0
- package/src/application-containers/notification-pane.jsx +37 -0
- package/src/application-containers/notification-quadrant.jsx +20 -0
- package/src/application-containers/notification.jsx +91 -0
- package/src/application-containers/primary-panel.jsx +94 -0
- package/src/application-containers/right-sidebar.jsx +44 -0
- package/src/application-containers/south-region-tab.jsx +60 -0
- package/src/application-containers/south-region.jsx +75 -0
- package/src/application-containers/upper-right-toolbar.jsx +28 -0
- package/src/application-controls/basic-toolbar-button.jsx +124 -0
- package/src/application-controls/basic-toolbar-menu-divider.jsx +11 -0
- package/src/application-controls/basic-toolbar-menu-item.jsx +91 -0
- package/src/application-controls/basic-toolbar-menu-up.jsx +13 -0
- package/src/application-controls/basic-toolbar-menu.jsx +13 -0
- package/src/application-controls/basic-toolbar-submenu.jsx +14 -0
- package/src/application-controls/index.jsx +35 -0
- package/src/application-controls/loading-indicator.jsx +19 -0
- package/src/application-controls/search-input.jsx +55 -0
- package/src/application-controls/search-results-list-item.jsx +50 -0
- package/src/application-controls/search-results-list.jsx +19 -0
- package/src/application-controls/sidebar-button.jsx +69 -0
- package/src/application-controls/sidebar-panel-opener.jsx +63 -0
- package/src/application-controls/tree-list-folder.jsx +46 -0
- package/src/application-controls/tree-list-item.jsx +83 -0
- package/src/application-controls/tree-list.jsx +35 -0
- package/src/application-controls/tree-view.jsx +42 -0
- package/src/application-exports/map-provider.jsx +122 -0
- package/src/assets/react.svg +1 -0
- package/src/config/default-config.js +593 -0
- package/src/core-plugins/add-data/add-data-button.jsx +34 -0
- package/src/core-plugins/add-data/add-geojson.jsx +47 -0
- package/src/core-plugins/add-data/add-kmlfile.jsx +46 -0
- package/src/core-plugins/add-data/add-shapefile.jsx +47 -0
- package/src/core-plugins/add-data/bundle.js +226 -0
- package/src/core-plugins/add-data/index.js +15 -0
- package/src/core-plugins/basemap-switcher/basemap-switcher-button.jsx +18 -0
- package/src/core-plugins/basemap-switcher/basemap-switcher-list-item.jsx +48 -0
- package/src/core-plugins/basemap-switcher/basemap-switcher-list.jsx +37 -0
- package/src/core-plugins/basemap-switcher/index.js +13 -0
- package/src/core-plugins/bookmarks/bookmark-button.jsx +18 -0
- package/src/core-plugins/bookmarks/bookmark-list-item.jsx +79 -0
- package/src/core-plugins/bookmarks/bookmark-list.jsx +31 -0
- package/src/core-plugins/bookmarks/bookmark-panel.jsx +191 -0
- package/src/core-plugins/bookmarks/bundle.js +92 -0
- package/src/core-plugins/bookmarks/index.js +15 -0
- package/src/core-plugins/catalog/bundle.js +109 -0
- package/src/core-plugins/catalog/catalog-button.jsx +33 -0
- package/src/core-plugins/catalog/catalog-error-item.jsx +14 -0
- package/src/core-plugins/catalog/catalog-list-item-loader.jsx +12 -0
- package/src/core-plugins/catalog/catalog-list-item.jsx +118 -0
- package/src/core-plugins/catalog/catalog-list.jsx +78 -0
- package/src/core-plugins/catalog/catalog-modal-window.jsx +100 -0
- package/src/core-plugins/catalog/index.js +15 -0
- package/src/core-plugins/change-log/bundle.js +180 -0
- package/src/core-plugins/change-log/change-log-button.jsx +40 -0
- package/src/core-plugins/change-log/change-log-modal.jsx +190 -0
- package/src/core-plugins/change-log/index.js +15 -0
- package/src/core-plugins/change-log/select-district.jsx +73 -0
- package/src/core-plugins/contact-form/bundle.js +239 -0
- package/src/core-plugins/contact-form/index.js +17 -0
- package/src/core-plugins/contact-form/question-button.jsx +36 -0
- package/src/core-plugins/contact-form/question-modal.jsx +215 -0
- package/src/core-plugins/coordinate-display/bundle.jsx +269 -0
- package/src/core-plugins/coordinate-display/coordinate-display-bar.jsx +66 -0
- package/src/core-plugins/coordinate-display/coordinate-display-proj-item.jsx +60 -0
- package/src/core-plugins/coordinate-display/coordinate-display-settings.jsx +173 -0
- package/src/core-plugins/coordinate-display/coordinate-interaction-bar.jsx +60 -0
- package/src/core-plugins/coordinate-display/coordinate-lat-lon-input.jsx +35 -0
- package/src/core-plugins/coordinate-display/coordinate-popup.jsx +27 -0
- package/src/core-plugins/coordinate-display/index.js +20 -0
- package/src/core-plugins/draw-tools/create-draw-bundle.js +242 -0
- package/src/core-plugins/draw-tools/draw-button.jsx +204 -0
- package/src/core-plugins/draw-tools/draw-label-bundle.js +116 -0
- package/src/core-plugins/draw-tools/draw-modify-bundle.js +156 -0
- package/src/core-plugins/draw-tools/draw-save-bundle.jsx +181 -0
- package/src/core-plugins/draw-tools/draw-styles.js +110 -0
- package/src/core-plugins/draw-tools/draw-tool-item.jsx +67 -0
- package/src/core-plugins/draw-tools/index.js +34 -0
- package/src/core-plugins/draw-tools-old/create-draw-bundle.js +222 -0
- package/src/core-plugins/draw-tools-old/draw-button.js +189 -0
- package/src/core-plugins/draw-tools-old/draw-label-bundle.js +116 -0
- package/src/core-plugins/draw-tools-old/draw-modify-bundle.js +156 -0
- package/src/core-plugins/draw-tools-old/draw-styles.js +110 -0
- package/src/core-plugins/draw-tools-old/draw-tool-item.js +67 -0
- package/src/core-plugins/draw-tools-old/index.js +32 -0
- package/src/core-plugins/editor/bundle.js +472 -0
- package/src/core-plugins/editor/date-editor.js +63 -0
- package/src/core-plugins/editor/date-formatter.js +17 -0
- package/src/core-plugins/editor/editor-base.js +29 -0
- package/src/core-plugins/editor/editor-button.js +224 -0
- package/src/core-plugins/editor/editor-table.js +151 -0
- package/src/core-plugins/editor/index.js +15 -0
- package/src/core-plugins/editor/number-editor.js +57 -0
- package/src/core-plugins/editor/string-editor.js +42 -0
- package/src/core-plugins/geocoder/bundle.jsx +186 -0
- package/src/core-plugins/geocoder/index.js +15 -0
- package/src/core-plugins/geocoder/overlay.jsx +30 -0
- package/src/core-plugins/geocoder/search-bar.js copy.save +123 -0
- package/src/core-plugins/geocoder/search-bar.jsx +121 -0
- package/src/core-plugins/identify/bundle.jsx +709 -0
- package/src/core-plugins/identify/identify-buffer-section.jsx +52 -0
- package/src/core-plugins/identify/identify-buffer-settings.jsx +48 -0
- package/src/core-plugins/identify/identify-button.jsx +100 -0
- package/src/core-plugins/identify/identify-details-table.jsx +121 -0
- package/src/core-plugins/identify/identify-details.js +69 -0
- package/src/core-plugins/identify/identify-popup.jsx +136 -0
- package/src/core-plugins/identify/identify-sidebar-list-item.jsx +106 -0
- package/src/core-plugins/identify/identify-sidebar-list.jsx +63 -0
- package/src/core-plugins/identify/identify-sidebar.jsx +103 -0
- package/src/core-plugins/identify/identify-table-cell.jsx +49 -0
- package/src/core-plugins/identify/identify-table.jsx +319 -0
- package/src/core-plugins/identify/index.js +27 -0
- package/src/core-plugins/identify/listeners/arcgis.js +158 -0
- package/src/core-plugins/identify/listeners/geojson.jsx +164 -0
- package/src/core-plugins/identify/listeners/raster.js +89 -0
- package/src/core-plugins/identify/listeners/vector.jsx +106 -0
- package/src/core-plugins/identify-arcgis-rest/bundle.js +169 -0
- package/src/core-plugins/identify-arcgis-rest/index.js +10 -0
- package/src/core-plugins/identify-cm/bundle.js +82 -0
- package/src/core-plugins/identify-cm/index.js +10 -0
- package/src/core-plugins/identify-geojson/bundle.js +164 -0
- package/src/core-plugins/identify-geojson/index.js +10 -0
- package/src/core-plugins/identify-raster/bundle.js +89 -0
- package/src/core-plugins/identify-raster/index.js +10 -0
- package/src/core-plugins/identify-vector/bundle.jsx +135 -0
- package/src/core-plugins/identify-vector/index.js +10 -0
- package/src/core-plugins/identify-wms/bundle.js +138 -0
- package/src/core-plugins/identify-wms/index.js +10 -0
- package/src/core-plugins/legend/bundle.js +1044 -0
- package/src/core-plugins/legend/index.js +17 -0
- package/src/core-plugins/legend/legend-button.jsx +18 -0
- package/src/core-plugins/legend/legend-header.jsx +43 -0
- package/src/core-plugins/legend/legend-item-multiple.jsx +32 -0
- package/src/core-plugins/legend/legend-item.jsx +20 -0
- package/src/core-plugins/legend/legend-panel.jsx +73 -0
- package/src/core-plugins/login/index.js +13 -0
- package/src/core-plugins/login/login-button.jsx +49 -0
- package/src/core-plugins/map-loading-indicator/bundle.js +31 -0
- package/src/core-plugins/map-loading-indicator/index.js +17 -0
- package/src/core-plugins/map-loading-indicator/loading-indicator.jsx +30 -0
- package/src/core-plugins/measure-tools/bundle.js +286 -0
- package/src/core-plugins/measure-tools/index.js +15 -0
- package/src/core-plugins/measure-tools/measure-options.jsx +89 -0
- package/src/core-plugins/measure-tools/measure-tools-button.jsx +129 -0
- package/src/core-plugins/measure-tools/measure-utils.js +76 -0
- package/src/core-plugins/permalink/bundle.js +57 -0
- package/src/core-plugins/permalink/index.js +15 -0
- package/src/core-plugins/permalink/permalink-button.jsx +38 -0
- package/src/core-plugins/permalink/permalink-modal.jsx +67 -0
- package/src/core-plugins/print-map/bundle.jsx +316 -0
- package/src/core-plugins/print-map/button.jsx +17 -0
- package/src/core-plugins/print-map/index.js +17 -0
- package/src/core-plugins/resources/bundle.js +96 -0
- package/src/core-plugins/resources/index.js +15 -0
- package/src/core-plugins/resources/resources-button.jsx +40 -0
- package/src/core-plugins/resources/resources-modal.jsx +151 -0
- package/src/core-plugins/rotate-north/index.js +13 -0
- package/src/core-plugins/rotate-north/rotate-north-button.jsx +38 -0
- package/src/core-plugins/theme-switcher/bundle.js +16 -0
- package/src/core-plugins/theme-switcher/index.js +15 -0
- package/src/core-plugins/theme-switcher/theme-list-item.jsx +25 -0
- package/src/core-plugins/theme-switcher/theme-list.jsx +28 -0
- package/src/core-plugins/theme-switcher/theme-switcher-button.jsx +18 -0
- package/src/core-plugins/theme-switcher/themes.js +121 -0
- package/src/core-plugins/three-d/index.js +13 -0
- package/src/core-plugins/three-d/three-d-button.jsx +44 -0
- package/src/core-plugins/tree-view/boundary-drop-target.jsx +42 -0
- package/src/core-plugins/tree-view/bundle.js +513 -0
- package/src/core-plugins/tree-view/dataset-info-modal.jsx +141 -0
- package/src/core-plugins/tree-view/dataset-legend.jsx +122 -0
- package/src/core-plugins/tree-view/defaults-container.jsx +27 -0
- package/src/core-plugins/tree-view/download-bundle.js +156 -0
- package/src/core-plugins/tree-view/favorites-container.jsx +27 -0
- package/src/core-plugins/tree-view/index.js +25 -0
- package/src/core-plugins/tree-view/layer-subpanel/defaults-toggle.jsx +28 -0
- package/src/core-plugins/tree-view/layer-subpanel/download-layer.jsx +54 -0
- package/src/core-plugins/tree-view/layer-subpanel/favorites-toggle.jsx +28 -0
- package/src/core-plugins/tree-view/layer-subpanel/label-toggle.jsx +39 -0
- package/src/core-plugins/tree-view/layer-subpanel/layer-subpanel.jsx +179 -0
- package/src/core-plugins/tree-view/layer-subpanel/natick-rgb-options.jsx +66 -0
- package/src/core-plugins/tree-view/layer-subpanel/natick-rgb.jsx +112 -0
- package/src/core-plugins/tree-view/layer-subpanel/opacity-slider.jsx +51 -0
- package/src/core-plugins/tree-view/layer-subpanel/remove-layer.jsx +75 -0
- package/src/core-plugins/tree-view/tree-list-container.jsx +22 -0
- package/src/core-plugins/tree-view/tree-list-item-dataset.jsx +174 -0
- package/src/core-plugins/tree-view/tree-list-item-folder.jsx +161 -0
- package/src/core-plugins/tree-view/tree-list-item.jsx +35 -0
- package/src/core-plugins/tree-view/tree-list.jsx +37 -0
- package/src/core-plugins/tree-view/tree-view-button.jsx +18 -0
- package/src/core-plugins/tree-view/tree-view-panel.jsx +139 -0
- package/src/core-plugins/tree-view/tree-view-toolbar/add-all.jsx +28 -0
- package/src/core-plugins/tree-view/tree-view-toolbar/defaults.jsx +40 -0
- package/src/core-plugins/tree-view/tree-view-toolbar/favorites.jsx +40 -0
- package/src/core-plugins/tree-view/tree-view-toolbar/remove-all.jsx +28 -0
- package/src/core-plugins/tree-view/tree-view-toolbar/toggle-expand.jsx +47 -0
- package/src/core-plugins/tree-view/tree-view-toolbar/toggle-filter.jsx +39 -0
- package/src/core-plugins/vector-search/bundle.js +96 -0
- package/src/core-plugins/vector-search/index.js +10 -0
- package/src/core-plugins/zoom-home/bundle.js +77 -0
- package/src/core-plugins/zoom-home/index.js +19 -0
- package/src/core-plugins/zoom-home/zoom-home-button.jsx +57 -0
- package/src/core-plugins/zoom-in-out/index.js +23 -0
- package/src/core-plugins/zoom-in-out/zoom-in-button.jsx +28 -0
- package/src/core-plugins/zoom-in-out/zoom-out-button.jsx +28 -0
- package/src/core-plugins/zoom-level/bundle.js +35 -0
- package/src/core-plugins/zoom-level/index.js +17 -0
- package/src/core-plugins/zoom-level/zoom-indicator.jsx +34 -0
- package/src/core-plugins/zoom-to-box/bundle.js +80 -0
- package/src/core-plugins/zoom-to-box/index.jsx +15 -0
- package/src/core-plugins/zoom-to-box/zoom-to-box-button.jsx +53 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-paper.css +7606 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-paper.min.css +8083 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-simplex.min.css +7328 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-theme.css +587 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-theme.css.map +1 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-theme.min.css +6 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap-theme.min.css.map +1 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap.css +7137 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap.css.map +142 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap.min.css +7132 -0
- package/src/css/_deprecated_bootstrap/css/bootstrap.min.css.map +143 -0
- package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
- package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.svg +288 -0
- package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
- package/src/css/_deprecated_bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/src/css/_deprecated_bootstrap/js/bootstrap.js +2377 -0
- package/src/css/_deprecated_bootstrap/js/bootstrap.min.js +7 -0
- package/src/css/_deprecated_bootstrap/js/npm.js +13 -0
- package/src/css/_deprecated_maki/css/maki.css +304 -0
- package/src/css/_deprecated_maki/fonts/maki.eot +0 -0
- package/src/css/_deprecated_maki/fonts/maki.svg +98 -0
- package/src/css/_deprecated_maki/fonts/maki.ttf +0 -0
- package/src/css/_deprecated_maki/fonts/maki.woff +0 -0
- package/src/css/bg-colors.css +121 -0
- package/src/css/cm-icons/css/cm-icons.css +90 -0
- package/src/css/cm-icons/fonts/cm.eot +0 -0
- package/src/css/cm-icons/fonts/cm.svg +27 -0
- package/src/css/cm-icons/fonts/cm.ttf +0 -0
- package/src/css/cm-icons/fonts/cm.woff +0 -0
- package/src/css/corpsmap-namespaced.css +9505 -0
- package/src/css/corpsmap.css +10178 -0
- package/src/css/loading-indicator.css +109 -0
- package/src/css/mapskin/OFL.txt +94 -0
- package/src/css/mapskin/css/mapskin.css +815 -0
- package/src/css/mapskin/css/mapskin.min.css +8 -0
- package/src/css/mapskin/fonts/mapskin.eot +0 -0
- package/src/css/mapskin/fonts/mapskin.svg +282 -0
- package/src/css/mapskin/fonts/mapskin.ttf +0 -0
- package/src/css/mapskin/fonts/mapskin.woff +0 -0
- package/src/css/mdi/.github/ISSUE_TEMPLATE.md +3 -0
- package/src/css/mdi/README.md +24 -0
- package/src/css/mdi/bower.json +22 -0
- package/src/css/mdi/css/materialdesignicons.css +18654 -0
- package/src/css/mdi/css/materialdesignicons.css.map +16 -0
- package/src/css/mdi/css/materialdesignicons.min.css +3 -0
- package/src/css/mdi/css/materialdesignicons.min.css.map +16 -0
- package/src/css/mdi/fonts/materialdesignicons-webfont.eot +0 -0
- package/src/css/mdi/fonts/materialdesignicons-webfont.ttf +0 -0
- package/src/css/mdi/fonts/materialdesignicons-webfont.woff +0 -0
- package/src/css/mdi/fonts/materialdesignicons-webfont.woff2 +0 -0
- package/src/css/mdi/license.md +97 -0
- package/src/css/mdi/package.json +37 -0
- package/src/css/mdi/preview.html +717 -0
- package/src/css/mdi/scss/_animated.scss +27 -0
- package/src/css/mdi/scss/_core.scss +10 -0
- package/src/css/mdi/scss/_extras.scss +65 -0
- package/src/css/mdi/scss/_functions.scss +20 -0
- package/src/css/mdi/scss/_icons.scss +10 -0
- package/src/css/mdi/scss/_path.scss +10 -0
- package/src/css/mdi/scss/_variables.scss +4606 -0
- package/src/css/mdi/scss/materialdesignicons.scss +8 -0
- package/src/css/navigation.css +174 -0
- package/src/css/parse-css.js +26 -0
- package/src/css/reset.css +48 -0
- package/src/index.css +68 -0
- package/src/index.jsx +113 -0
- package/src/main.jsx +3 -0
- package/src/openlayers-utils/format-utilities.js +178 -0
- package/src/openlayers-utils/interaction-creator.js +31 -0
- package/src/openlayers-utils/layer-utilities.js +309 -0
- package/src/openlayers-utils/map-utils.js +25 -0
- package/src/openlayers-utils/resource-utilities.js +38 -0
- package/src/openlayers-utils/vector-style.js +131 -0
- package/src/utils/cache.js +6 -0
- package/src/utils/check-webgl.js +6 -0
- package/src/utils/error-boundary.js +26 -0
- package/src/utils/load-plugins.js +32 -0
- package/src/utils/load-plugins.test.js +36 -0
- package/src/utils/plugin-region.jsx +26 -0
- package/src/utils/redux-bundler-react.jsx +69 -0
- package/src/utils/scale-to-zoom-level.js +37 -0
- package/src/utils/vector-styles.js +7 -0
- package/.babelrc +0 -7
- package/config/basemaps.js +0 -22
- package/css/corpsmap.css +0 -7982
- package/index.js +0 -5
- package/lib/dev.js +0 -41517
- package/lib/prod.js +0 -41483
- package/rollup.config.js +0 -30
- package/src/bundles/_template-bundle-creator.js +0 -49
- package/src/bundles/create-basemap-bundle-old.js +0 -107
- package/src/bundles/create-basemap-bundle.js +0 -133
- package/src/bundles/create-ol-map-bundle.js +0 -166
- package/src/bundles/create-ol-view-bundle.js +0 -79
- package/src/bundles/map-basemap-bundle.js +0 -42
- package/src/bundles/map-bundle.js +0 -90
- package/src/bundles/map-interaction-bundle.js +0 -57
- package/src/bundles/map-measure-bundle.js +0 -61
- package/src/bundles/map-view-bundle.js +0 -34
- package/src/components/BasemapSwitcherLight/BasemapMenu.js +0 -26
- package/src/components/BasemapSwitcherLight/BasemapMenuItem.js +0 -31
- package/src/components/BasemapSwitcherLight/index.js +0 -25
- package/src/components/Control-Regions/BtnContainer.js +0 -20
- package/src/components/Control-Regions/Right.js +0 -30
- package/src/components/Control-Regions/Top.js +0 -19
- package/src/components/Control-Regions/index.js +0 -4
- package/src/components/LayerTree/index.js +0 -10
- package/src/components/Map.js +0 -56
- package/src/components/MeasureTool/Content.js +0 -38
- package/src/components/MeasureTool/index.js +0 -125
- package/src/components/MeasureTool/measure-utils.js +0 -57
- package/src/components/Zoom/index.js +0 -28
- package/src/components/index.js +0 -3
- package/src/index.js +0 -11
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import createContainerBundle from "./_create-container-bundle";
|
|
2
|
+
import { createSelector } from "redux-bundler";
|
|
3
|
+
|
|
4
|
+
export default createContainerBundle({
|
|
5
|
+
name: "primaryPanel",
|
|
6
|
+
additionalState: {
|
|
7
|
+
width: 300,
|
|
8
|
+
showClose: false,
|
|
9
|
+
showFavoritesBtn: false,
|
|
10
|
+
favoritesDB: null,
|
|
11
|
+
showUserDefaultLayersBtn: false,
|
|
12
|
+
userDefaultLayersDB: null,
|
|
13
|
+
},
|
|
14
|
+
additionalActions: [
|
|
15
|
+
"PRIMARY_PANEL_RESIZED",
|
|
16
|
+
"PRIMARY_PANEL_SHOW_CLOSE",
|
|
17
|
+
"PRIMARY_PANEL_SET_WIDTH",
|
|
18
|
+
"PRIMARY_PANEL_SHOW_FAVORITES_BTN",
|
|
19
|
+
"PRIMARY_PANEL_SHOW_USER_DEFAULT_LAYERS_BTN",
|
|
20
|
+
],
|
|
21
|
+
addons: {
|
|
22
|
+
doPrimaryPanelResize:
|
|
23
|
+
({ width }) =>
|
|
24
|
+
({ dispatch }) => {
|
|
25
|
+
dispatch({ type: "PRIMARY_PANEL_RESIZED", payload: { width: width } });
|
|
26
|
+
},
|
|
27
|
+
doPrimaryPanelSetWidth:
|
|
28
|
+
(width) =>
|
|
29
|
+
({ dispatch }) => {
|
|
30
|
+
dispatch({
|
|
31
|
+
type: "PRIMARY_PANEL_SET_WIDTH",
|
|
32
|
+
payload: { width: width },
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
doShowPrimaryPanelCloseBtn:
|
|
36
|
+
() =>
|
|
37
|
+
({ dispatch }) => {
|
|
38
|
+
dispatch({
|
|
39
|
+
type: "PRIMARY_PANEL_SHOW_CLOSE",
|
|
40
|
+
payload: { showClose: true },
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
doShowFavoritesBtn:
|
|
44
|
+
(favoritesDB) =>
|
|
45
|
+
({ dispatch }) => {
|
|
46
|
+
dispatch({
|
|
47
|
+
type: "PRIMARY_PANEL_SHOW_FAVORITES_BTN",
|
|
48
|
+
payload: { showFavoritesBtn: true, favoritesDB: favoritesDB },
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
doShowUserDefaultLayersBtn:
|
|
52
|
+
(userDefaultLayersDB) =>
|
|
53
|
+
({ dispatch }) => {
|
|
54
|
+
dispatch({
|
|
55
|
+
type: "PRIMARY_PANEL_SHOW_USER_DEFAULT_LAYERS_BTN",
|
|
56
|
+
payload: { showUserDefaultLayersBtn: true, userDefaultLayersDB: userDefaultLayersDB },
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
selectPrimaryPanelWidth: (state) => {
|
|
60
|
+
return state.primaryPanel.width;
|
|
61
|
+
},
|
|
62
|
+
selectPrimaryPanelShowClose: (state) => {
|
|
63
|
+
return state.primaryPanel.showClose;
|
|
64
|
+
},
|
|
65
|
+
selectPrimaryPanelShowFavoritesBtn: (state) => {
|
|
66
|
+
return state.primaryPanel.showFavoritesBtn;
|
|
67
|
+
},
|
|
68
|
+
selectPrimaryPanelFavoritesDB: (state) => {
|
|
69
|
+
return state.primaryPanel.favoritesDB;
|
|
70
|
+
},
|
|
71
|
+
selectPrimaryPanelShowUserDefaultLayersBtn: (state) => {
|
|
72
|
+
return state.primaryPanel.showUserDefaultLayersBtn;
|
|
73
|
+
},
|
|
74
|
+
selectPrimaryPanelUserDefaultLayersDB: (state) => {
|
|
75
|
+
return state.primaryPanel.userDefaultLayersDB;
|
|
76
|
+
},
|
|
77
|
+
selectPrimaryPanelTop: createSelector(
|
|
78
|
+
"selectComponentsBasicToolbarCount",
|
|
79
|
+
(cnt) => {
|
|
80
|
+
if (cnt > 0) return 42;
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
},
|
|
85
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import async from "async";
|
|
2
|
+
import _ from "lodash";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
name: "search",
|
|
6
|
+
|
|
7
|
+
getReducer() {
|
|
8
|
+
const initialData = {
|
|
9
|
+
shouldFireSearch: false,
|
|
10
|
+
q: "",
|
|
11
|
+
selected: null,
|
|
12
|
+
onFireSearchListeners: [],
|
|
13
|
+
results: [],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return (state = initialData, { type, payload }) => {
|
|
17
|
+
if (type.indexOf("SEARCH_") !== -1) {
|
|
18
|
+
return Object.assign({}, state, payload);
|
|
19
|
+
}
|
|
20
|
+
return state;
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
doSearchAddCollection:
|
|
25
|
+
(options) =>
|
|
26
|
+
({ dispatch, store }) => {
|
|
27
|
+
const listeners = store.selectSearchOnFireSearchListeners();
|
|
28
|
+
if (options.onFireSearch) listeners.push(options.onFireSearch);
|
|
29
|
+
dispatch({
|
|
30
|
+
type: "SEARCH_COLLECTION_ADDED",
|
|
31
|
+
payload: {
|
|
32
|
+
onFireSearchListeners: listeners,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
doSearchShouldFire:
|
|
38
|
+
() =>
|
|
39
|
+
({ dispatch }) => {
|
|
40
|
+
dispatch({ type: "SEARCH_SHOULD_FIRE", payload: { shouldFire: true } });
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
doSearchSetQuery:
|
|
44
|
+
(q) =>
|
|
45
|
+
({ dispatch, store }) => {
|
|
46
|
+
dispatch({ type: "SEARCH_SET_QUERY", payload: { q: q, results: [] } });
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
doSearchSelectItem:
|
|
50
|
+
(item) =>
|
|
51
|
+
({ dispatch }) => {
|
|
52
|
+
dispatch({ type: "SEARCH_ITEM_SELECTED", payload: { selected: item } });
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
doSearchFire:
|
|
56
|
+
() =>
|
|
57
|
+
({ dispatch, store }) => {
|
|
58
|
+
dispatch({ type: "SEARCH_START", payload: { shouldFire: false } });
|
|
59
|
+
const listeners = store.selectSearchOnFireSearchListeners();
|
|
60
|
+
|
|
61
|
+
async.parallel(listeners, (err, r) => {
|
|
62
|
+
if (err)
|
|
63
|
+
return dispatch({
|
|
64
|
+
type: "SEARCH_ERROR",
|
|
65
|
+
payload: { err: err, results: [] },
|
|
66
|
+
});
|
|
67
|
+
const results = _.flatten(r);
|
|
68
|
+
|
|
69
|
+
const sortedResultsGeo = [];
|
|
70
|
+
const sortedResultsWMS = [];
|
|
71
|
+
results.forEach((result) => {
|
|
72
|
+
if (result.provider !== "geocoder") {
|
|
73
|
+
sortedResultsWMS.push(result);
|
|
74
|
+
}
|
|
75
|
+
if (result.provider === "geocoder") {
|
|
76
|
+
sortedResultsGeo.push(result);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const sortedResults = [...sortedResultsWMS, ...sortedResultsGeo];
|
|
81
|
+
|
|
82
|
+
dispatch({
|
|
83
|
+
type: "SEARCH_SUCCESS",
|
|
84
|
+
payload: { results: sortedResults },
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
selectSearchOnFireSearchListeners: (state) => {
|
|
90
|
+
return state.search.onFireSearchListeners;
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
selectSearchQueryString: (state) => {
|
|
94
|
+
return state.search.q;
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
selectSearchResults: (state) => {
|
|
98
|
+
return state.search.results;
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
reactSearchShouldFire: (state) => {
|
|
102
|
+
if (state.search.shouldFire) return { actionCreator: "doSearchFire" };
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// => add collection, should have a name and implement the following api:
|
|
107
|
+
|
|
108
|
+
// .onFireSearch = function(callback(err, results)) => return results as an array
|
|
109
|
+
// each bundle contributing to search can listen for the following action types:
|
|
110
|
+
// 'SEARCH_SET_QUERY' => fired when user types into search bar
|
|
111
|
+
// 'SEARCH_ITEM_SELECTED' => fired when user selects a search result
|
|
112
|
+
|
|
113
|
+
// each result should fit the following schema, but can be extended by adding additional keys
|
|
114
|
+
|
|
115
|
+
// {
|
|
116
|
+
// type: 'Feature', // geojson feature
|
|
117
|
+
// provider: <string>, // optional provider of information, makes it easy to distinguish
|
|
118
|
+
// displayName: <string>,
|
|
119
|
+
// iconClass: <string>,
|
|
120
|
+
// geometry: <object>, // geojson geometry
|
|
121
|
+
// properties: <object> // geojson properties
|
|
122
|
+
// }
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// import v4 from "uuid/v4";
|
|
2
|
+
import { v4 as uuidv4 } from "uuid";
|
|
3
|
+
import { createSelector } from "redux-bundler";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: "southRegion",
|
|
7
|
+
|
|
8
|
+
getReducer: () => {
|
|
9
|
+
const initialData = {
|
|
10
|
+
children: {},
|
|
11
|
+
_shouldTryToCloseRegion: false,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return (state = initialData, { type, payload }) => {
|
|
15
|
+
switch (type) {
|
|
16
|
+
case "SOUTH_REGION_OPENED":
|
|
17
|
+
case "SOUTH_REGION_CLOSED":
|
|
18
|
+
case "SOUTH_REGION_TAB_CLOSED":
|
|
19
|
+
case "SOUTH_REGION_TRY_CLOSE":
|
|
20
|
+
return Object.assign({}, state, payload);
|
|
21
|
+
default:
|
|
22
|
+
return state;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
doSouthRegionOpen:
|
|
28
|
+
(options) =>
|
|
29
|
+
({ dispatch, store }) => {
|
|
30
|
+
const children = store.selectSouthRegionChildrenObj();
|
|
31
|
+
const uid = uuidv4();
|
|
32
|
+
options.uid = uid;
|
|
33
|
+
dispatch({
|
|
34
|
+
type: "SOUTH_REGION_OPENED",
|
|
35
|
+
payload: {
|
|
36
|
+
children: { ...children, [uid]: options },
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
doSouthRegionClose:
|
|
41
|
+
() =>
|
|
42
|
+
({ dispatch, store }) => {
|
|
43
|
+
dispatch({
|
|
44
|
+
type: "SOUTH_REGION_CLOSED",
|
|
45
|
+
payload: {
|
|
46
|
+
children: {},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
doSouthRegionCloseTab:
|
|
52
|
+
(uid) =>
|
|
53
|
+
({ dispatch, store }) => {
|
|
54
|
+
const children = store.selectSouthRegionChildrenObj();
|
|
55
|
+
delete children[uid];
|
|
56
|
+
dispatch({
|
|
57
|
+
type: "SOUTH_REGION_TAB_CLOSED",
|
|
58
|
+
payload: {
|
|
59
|
+
children: { ...children },
|
|
60
|
+
_shouldTryToCloseRegion: true,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
doSouthRegionTryClose:
|
|
66
|
+
() =>
|
|
67
|
+
({ dispatch, store }) => {
|
|
68
|
+
dispatch({
|
|
69
|
+
type: "SOUTH_REGION_TRY_CLOSE",
|
|
70
|
+
payload: { _shouldTryToCloseRegion: false },
|
|
71
|
+
});
|
|
72
|
+
const children = store.selectSouthRegionChildren();
|
|
73
|
+
if (!children.length) store.doSouthRegionClose();
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
selectSouthRegionChildrenObj: (state) => {
|
|
77
|
+
return state.southRegion.children;
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
selectSouthRegionChildren: createSelector(
|
|
81
|
+
"selectSouthRegionChildrenObj",
|
|
82
|
+
(children) => {
|
|
83
|
+
const out = [];
|
|
84
|
+
for (var key in children) {
|
|
85
|
+
out.push(children[key]);
|
|
86
|
+
out.unshift(out.pop());
|
|
87
|
+
}
|
|
88
|
+
return out;
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
|
|
92
|
+
reactSouthRegionTryToCloseRegion: (state) => {
|
|
93
|
+
if (state.southRegion._shouldTryToCloseRegion)
|
|
94
|
+
return { actionCreator: "doSouthRegionTryClose" };
|
|
95
|
+
},
|
|
96
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: "theme",
|
|
3
|
+
|
|
4
|
+
getReducer: () => {
|
|
5
|
+
const initialData = {
|
|
6
|
+
theme: "bg-blue-chambray",
|
|
7
|
+
iconSize: "default",
|
|
8
|
+
};
|
|
9
|
+
return (state = initialData, { type, payload }) => {
|
|
10
|
+
switch (type) {
|
|
11
|
+
case "THEME_CHANGED":
|
|
12
|
+
case "THEME_SET_LARGER_ICONS":
|
|
13
|
+
return Object.assign({}, state, payload);
|
|
14
|
+
default:
|
|
15
|
+
return state;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
doThemeSet: (theme) => ({ dispatch }) => {
|
|
21
|
+
dispatch({
|
|
22
|
+
type: "THEME_CHANGED",
|
|
23
|
+
payload: {
|
|
24
|
+
theme: theme,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
doThemeSetLargeIcons: () => ({ dispatch }) => {
|
|
30
|
+
dispatch({
|
|
31
|
+
type: "THEME_SET_LARGER_ICONS",
|
|
32
|
+
payload: {
|
|
33
|
+
iconSize: "large",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
selectTheme: (state) => {
|
|
39
|
+
return state.theme.theme;
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
selectThemeIconSize: (state) => {
|
|
43
|
+
return state.theme.iconSize;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: "vLayout",
|
|
3
|
+
|
|
4
|
+
getReducer: () => {
|
|
5
|
+
const initialData = {
|
|
6
|
+
height: window.innerHeight - 20,
|
|
7
|
+
hNorth: 1,
|
|
8
|
+
hSouth: 0,
|
|
9
|
+
_shouldUpdateMap: false,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
return (state = initialData, { type, payload }) => {
|
|
13
|
+
switch (type) {
|
|
14
|
+
case "VLAYOUT_UPDATE_HEIGHT":
|
|
15
|
+
case "VLAYOUT_MAP_UPDATE_START":
|
|
16
|
+
return Object.assign({}, state, payload);
|
|
17
|
+
case "SOUTH_REGION_OPENED":
|
|
18
|
+
return Object.assign({}, state, {
|
|
19
|
+
hNorth: 0.5,
|
|
20
|
+
hSouth: 0.5,
|
|
21
|
+
_shouldUpdateMap: true,
|
|
22
|
+
});
|
|
23
|
+
case "SOUTH_REGION_CLOSED":
|
|
24
|
+
return Object.assign({}, state, {
|
|
25
|
+
hNorth: 1,
|
|
26
|
+
hSouth: 0,
|
|
27
|
+
_shouldUpdateMap: true,
|
|
28
|
+
});
|
|
29
|
+
default:
|
|
30
|
+
return state;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
doVLayoutResize:
|
|
36
|
+
(hNorth, hSouth) =>
|
|
37
|
+
({ dispatch }) => {
|
|
38
|
+
dispatch({
|
|
39
|
+
type: "VLAYOUT_UPDATE_HEIGHT",
|
|
40
|
+
payload: {
|
|
41
|
+
hNorth: hNorth,
|
|
42
|
+
hSouth: hSouth,
|
|
43
|
+
_shouldUpdateMap: true,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
doVLayoutSetHeight:
|
|
49
|
+
(height) =>
|
|
50
|
+
({ dispatch }) => {
|
|
51
|
+
dispatch({
|
|
52
|
+
type: "VLAYOUT_UPDATE_HEIGHT",
|
|
53
|
+
payload: {
|
|
54
|
+
height: height,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
doVLayoutUpdateMap:
|
|
60
|
+
() =>
|
|
61
|
+
({ dispatch, store }) => {
|
|
62
|
+
dispatch({
|
|
63
|
+
type: "VLAYOUT_MAP_UPDATE_START",
|
|
64
|
+
payload: {
|
|
65
|
+
_shouldUpdateMap: false,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
const map = store.selectMap();
|
|
69
|
+
map.updateSize();
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
selectVLayoutHeight: (state) => {
|
|
73
|
+
return state.vLayout.height;
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
selectNorthHeight: (state) => {
|
|
77
|
+
return state.vLayout.height * state.vLayout.hNorth;
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
selectSouthHeight: (state) => {
|
|
81
|
+
return state.vLayout.height * state.vLayout.hSouth;
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
reactVLayoutShouldUpdateMap: (state) => {
|
|
85
|
+
if (state.vLayout._shouldUpdateMap)
|
|
86
|
+
return { actionCreator: "doVLayoutUpdateMap" };
|
|
87
|
+
},
|
|
88
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: "viewport",
|
|
5
|
+
|
|
6
|
+
getReducer() {
|
|
7
|
+
const initialData = {
|
|
8
|
+
h: window.innerHeight,
|
|
9
|
+
w: window.innerWidth,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
return (state = initialData, { type, payload }) => {
|
|
13
|
+
if (type === "WINDOW_RESIZE") {
|
|
14
|
+
return Object.assign({}, state, {
|
|
15
|
+
h: window.innerHeight,
|
|
16
|
+
w: window.innerWidth,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return state;
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
doHandleResize:
|
|
25
|
+
() =>
|
|
26
|
+
({ dispatch, store }) => {
|
|
27
|
+
const map = store.selectMap();
|
|
28
|
+
map.updateSize();
|
|
29
|
+
dispatch({ type: "WINDOW_RESIZE" });
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
selectViewportHeight: (state) => {
|
|
33
|
+
return state.viewport.h;
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
selectViewportWidth: (state) => {
|
|
37
|
+
return state.viewport.w;
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
init: (store) => {
|
|
41
|
+
window.addEventListener("resize", _.debounce(store.doHandleResize, 300));
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
function QueryStringToJSON(search) {
|
|
2
|
+
const pairs = search.slice(1).split('&');
|
|
3
|
+
const result = {};
|
|
4
|
+
pairs.forEach(function(pair) {
|
|
5
|
+
pair = pair.split('=');
|
|
6
|
+
result[pair[0]] = decodeURIComponent(pair[1] || '');
|
|
7
|
+
});
|
|
8
|
+
return JSON.parse(JSON.stringify(result));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
name: 'windowLocation',
|
|
13
|
+
|
|
14
|
+
getReducer(){
|
|
15
|
+
const initialData = {
|
|
16
|
+
shouldParse: true,
|
|
17
|
+
host: null,
|
|
18
|
+
href: null,
|
|
19
|
+
origin: null,
|
|
20
|
+
pathname: null,
|
|
21
|
+
search: null,
|
|
22
|
+
params: null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (state = initialData, { type, payload }) => {
|
|
26
|
+
switch(type){
|
|
27
|
+
case 'WINDOW_LOCATION_PARSE_START':
|
|
28
|
+
case 'WINDOW_LOCATION_PARSED':
|
|
29
|
+
return Object.assign({}, state, payload);
|
|
30
|
+
default:
|
|
31
|
+
return state;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
doWindowLocationParse: () => ({ dispatch, store }) => {
|
|
37
|
+
dispatch({
|
|
38
|
+
type: 'WINDOW_LOCATION_PARSE_START',
|
|
39
|
+
payload:{
|
|
40
|
+
shouldParse: false
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const location = window.location;
|
|
45
|
+
const host = location.host;
|
|
46
|
+
const href = location.href;
|
|
47
|
+
const origin = location.origin;
|
|
48
|
+
const pathname = location.pathname;
|
|
49
|
+
const search = location.search;
|
|
50
|
+
let params = QueryStringToJSON(search);
|
|
51
|
+
|
|
52
|
+
dispatch({ type: 'WINDOW_LOCATION_PARSED', payload: {
|
|
53
|
+
host: host,
|
|
54
|
+
href: href,
|
|
55
|
+
origin: origin,
|
|
56
|
+
pathname: pathname,
|
|
57
|
+
search: search,
|
|
58
|
+
params: params
|
|
59
|
+
}})
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
selectWindowLocationHost: (state) => {
|
|
63
|
+
return state.windowLocation.host;
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
selectWindowLocationHref: (state) => {
|
|
67
|
+
return state.windowLocation.Href;
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
selectWindowLocationOrigin: (state) => {
|
|
71
|
+
return state.windowLocation.origin;
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
selectWindowLocationPathname: (state) => {
|
|
75
|
+
return state.windowLocation.pathname;
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
selectWindowLocationSearch: (state) => {
|
|
79
|
+
return state.windowLocation.search;
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
selectWindowLocationParams: (state) => {
|
|
83
|
+
return state.windowLocation.params;
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
reactWindowShouldParseLocation: (state) => {
|
|
87
|
+
if(state.windowLocation.shouldParse) return { actionCreator: 'doWindowLocationParse' };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import xhr from 'xhr';
|
|
2
|
+
import { createSelector } from 'redux-bundler';
|
|
3
|
+
|
|
4
|
+
const getTokenPart = function(token, part){
|
|
5
|
+
const splitToken = token.split('.');
|
|
6
|
+
return splitToken[part];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
name: 'auth',
|
|
11
|
+
|
|
12
|
+
getReducer(){
|
|
13
|
+
const initialData = {
|
|
14
|
+
shouldCheckExpired: true,
|
|
15
|
+
token: '',
|
|
16
|
+
err: null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (state = initialData, {type, payload}) => {
|
|
20
|
+
|
|
21
|
+
switch(type){
|
|
22
|
+
case 'AUTH_LOGGED_IN':
|
|
23
|
+
case 'AUTH_LOGGED_ERROR':
|
|
24
|
+
case 'AUTH_CHECK_EXPIRED':
|
|
25
|
+
return Object.assign({}, state, payload);
|
|
26
|
+
case 'AUTH_LOGGED_OUT':
|
|
27
|
+
return Object.assign({}, state, {
|
|
28
|
+
token: '',
|
|
29
|
+
err: null
|
|
30
|
+
});
|
|
31
|
+
default:
|
|
32
|
+
return state;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
doLogin: () => ({dispatch, store}) => {
|
|
38
|
+
const root = store.selectApiRoot();
|
|
39
|
+
store.doSetCursor('wait');
|
|
40
|
+
let notification;
|
|
41
|
+
dispatch({type:'AUTH_LOGGING_IN'});
|
|
42
|
+
xhr.get({
|
|
43
|
+
url: `${root}/auth/login`
|
|
44
|
+
}, (err, res, body) => {
|
|
45
|
+
store.doSetCursor();
|
|
46
|
+
if(res.statusCode === 404){
|
|
47
|
+
notification = {
|
|
48
|
+
title: "Error Logging In",
|
|
49
|
+
message: `It looks like you don't have a CorpsMap account, click the button below to open the CorpsMap home page and create an account.`,
|
|
50
|
+
level: "info",
|
|
51
|
+
position: "tr",
|
|
52
|
+
autoDismiss: 0,
|
|
53
|
+
action: {
|
|
54
|
+
label: "Create Account",
|
|
55
|
+
callback: function() {
|
|
56
|
+
window.open(
|
|
57
|
+
`${root}/corpsmap/home`,
|
|
58
|
+
"_blank"
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
dispatch({type:'AUTH_USER_DOES_NOT_EXIST', payload: { notification: notification }})
|
|
64
|
+
}else if(res.statusCode === 200){
|
|
65
|
+
notification = {
|
|
66
|
+
title: 'Authentication Notificiation',
|
|
67
|
+
message: 'Successfully Logged In',
|
|
68
|
+
level: 'success'
|
|
69
|
+
}
|
|
70
|
+
dispatch({type:'AUTH_LOGGED_IN', payload: { token: JSON.parse(body), notification: notification }});
|
|
71
|
+
}else{
|
|
72
|
+
notification = {
|
|
73
|
+
title: 'Authentication Notificiation',
|
|
74
|
+
message: 'Error Logging In',
|
|
75
|
+
level: 'error'
|
|
76
|
+
}
|
|
77
|
+
dispatch({type:'AUTH_LOGIN_ERROR', payload: { err: err , notification: notification }})
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
doLogout: () => ({dispatch, store}) => {
|
|
83
|
+
dispatch({type:'AUTH_LOGGED_OUT'});
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
doAuthCheckExpired: () => ({ dispatch, store }) => {
|
|
87
|
+
dispatch({ type: 'AUTH_CHECK_EXPIRED', payload: { shouldCheckExpired: false }});
|
|
88
|
+
const isExpired = store.selectIsTokenExpired();
|
|
89
|
+
if(isExpired) store.doLogout();
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
selectIsLoggedIn: (state) => {
|
|
93
|
+
return !!state.auth.token;
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
selectTokenRaw: (state) => {
|
|
97
|
+
return state.auth.token;
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
selectIsTokenExpired: createSelector(
|
|
101
|
+
'selectIsLoggedIn',
|
|
102
|
+
'selectTokenPayload',
|
|
103
|
+
(isLoggedIn, payload) => {
|
|
104
|
+
if(!isLoggedIn) return false;
|
|
105
|
+
return payload.exp < Math.floor(Date.now()/1000);
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
|
|
109
|
+
selectTokenHeader: createSelector(
|
|
110
|
+
'selectTokenRaw',
|
|
111
|
+
(token) => {
|
|
112
|
+
if(!token) return {};
|
|
113
|
+
return JSON.parse(window.atob(getTokenPart(token, 0)));
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
|
|
117
|
+
selectTokenPayload: createSelector(
|
|
118
|
+
'selectTokenRaw',
|
|
119
|
+
(token) => {
|
|
120
|
+
if(!token) return {};
|
|
121
|
+
return JSON.parse(window.atob(getTokenPart(token, 1)));
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
|
|
125
|
+
reactAuthShouldCheckExpired: (state) => {
|
|
126
|
+
if(state.auth.shouldCheckExpired) return { actionCreator: 'doAuthCheckExpired' };
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
persistActions: ['AUTH_LOGGED_IN', 'AUTH_LOGGED_OUT']
|
|
130
|
+
}
|