@jupytergis/base 0.15.0 → 0.16.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/BaseCommandIDs.d.ts +5 -0
- package/lib/commands/BaseCommandIDs.js +5 -0
- package/lib/commands/index.js +218 -48
- package/lib/commands/operationCommands.js +2 -2
- package/lib/constants.js +9 -1
- package/lib/{panelview/annotationPanel.js → features/annotations/AnnotationsPanel.js} +1 -1
- package/lib/{annotations → features/annotations}/index.d.ts +1 -0
- package/lib/{annotations → features/annotations}/index.js +1 -0
- package/lib/{console → features/console}/consoleview.js +1 -1
- package/lib/{panelview/filter-panel → features/filter}/Filter.js +4 -4
- package/lib/{panelview/filter-panel → features/filter}/FilterRow.d.ts +3 -2
- package/lib/{panelview/filter-panel → features/filter}/FilterRow.js +2 -1
- package/lib/{panelview/identify-panel → features/identify}/IdentifyPanel.d.ts +2 -0
- package/lib/features/identify/IdentifyPanel.js +102 -0
- package/lib/features/identify/components/FeatureCard.d.ts +17 -0
- package/lib/features/identify/components/FeatureCard.js +26 -0
- package/lib/features/identify/components/FeatureCardHeader.d.ts +11 -0
- package/lib/features/identify/components/FeatureCardHeader.js +30 -0
- package/lib/features/identify/components/FeatureFloater.d.ts +7 -0
- package/lib/features/identify/components/FeatureFloater.js +19 -0
- package/lib/features/identify/components/FeaturePropertyList.d.ts +11 -0
- package/lib/features/identify/components/FeaturePropertyList.js +18 -0
- package/lib/features/identify/components/FeatureRow.d.ts +13 -0
- package/lib/features/identify/components/FeatureRow.js +25 -0
- package/lib/features/identify/components/PropertyEditors.d.ts +44 -0
- package/lib/features/identify/components/PropertyEditors.js +56 -0
- package/lib/features/identify/hooks/useIdentifyPropertyEditor.d.ts +11 -0
- package/lib/features/identify/hooks/useIdentifyPropertyEditor.js +132 -0
- package/lib/features/identify/types/editorTypes.d.ts +21 -0
- package/lib/features/identify/utils/getFeatureIdentifier.d.ts +5 -0
- package/lib/features/identify/utils/getFeatureIdentifier.js +14 -0
- package/lib/features/identify/utils/highlightLayer.d.ts +11 -0
- package/lib/features/identify/utils/highlightLayer.js +57 -0
- package/lib/features/identify/utils/highlightStyle.d.ts +7 -0
- package/lib/features/identify/utils/highlightStyle.js +40 -0
- package/lib/{dialogs/layerBrowserDialog.js → features/layer-browser/index.js} +2 -2
- package/lib/{formbuilder/objectform/layer/heatmapLayerForm.d.ts → features/layers/forms/layer/geoTiffLayerForm.d.ts} +1 -1
- package/lib/{formbuilder/objectform/layer/webGlLayerForm.js → features/layers/forms/layer/geoTiffLayerForm.js} +5 -5
- package/lib/{formbuilder/objectform → features/layers/forms}/layer/hillshadeLayerForm.js +4 -4
- package/lib/{formbuilder/objectform → features/layers/forms}/layer/index.d.ts +1 -2
- package/lib/{formbuilder/objectform → features/layers/forms}/layer/index.js +1 -2
- package/lib/{formbuilder/objectform → features/layers/forms}/layer/layerform.d.ts +1 -1
- package/lib/{formbuilder/objectform → features/layers/forms}/layer/layerform.js +4 -4
- package/lib/features/layers/forms/layer/storySegmentLayerForm.js +150 -0
- package/lib/{formbuilder/objectform → features/layers/forms}/layer/vectorlayerform.js +4 -4
- package/lib/{formbuilder/objectform → features/layers/forms}/source/geojsonsource.js +5 -5
- package/lib/features/layers/forms/source/geopackagesource.d.ts +3 -0
- package/lib/features/layers/forms/source/geopackagesource.js +93 -0
- package/lib/{formbuilder/objectform → features/layers/forms}/source/geotiffsource.js +5 -5
- package/lib/{formbuilder/objectform → features/layers/forms}/source/index.d.ts +1 -0
- package/lib/{formbuilder/objectform → features/layers/forms}/source/index.js +1 -0
- package/lib/{formbuilder/objectform → features/layers/forms}/source/pathbasedsource.js +5 -5
- package/lib/{formbuilder/objectform → features/layers/forms}/source/sourceform.d.ts +1 -1
- package/lib/{formbuilder/objectform → features/layers/forms}/source/sourceform.js +4 -4
- package/lib/{formbuilder/objectform → features/layers/forms}/source/tilesourceform.js +4 -4
- package/lib/{formbuilder/objectform → features/layers/forms}/source/wmsTileSource.d.ts +1 -1
- package/lib/{formbuilder/objectform → features/layers/forms}/source/wmsTileSource.js +6 -6
- package/lib/{dialogs → features/layers}/layerCreationFormDialog.d.ts +1 -1
- package/lib/{dialogs → features/layers}/layerCreationFormDialog.js +1 -1
- package/lib/features/layers/symbology/Grammar.d.ts +11 -0
- package/lib/features/layers/symbology/Grammar.js +316 -0
- package/lib/{dialogs → features/layers}/symbology/classificationModes.d.ts +6 -6
- package/lib/{dialogs → features/layers}/symbology/classificationModes.js +48 -44
- package/lib/{dialogs → features/layers}/symbology/colorRampUtils.d.ts +1 -0
- package/lib/{dialogs → features/layers}/symbology/colorRampUtils.js +12 -1
- package/lib/features/layers/symbology/components/MappingRow.d.ts +40 -0
- package/lib/features/layers/symbology/components/MappingRow.js +520 -0
- package/lib/features/layers/symbology/components/NumericInput.d.ts +20 -0
- package/lib/features/layers/symbology/components/NumericInput.js +44 -0
- package/lib/features/layers/symbology/components/ScaleEditor.d.ts +33 -0
- package/lib/features/layers/symbology/components/ScaleEditor.js +221 -0
- package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ColorRampControls.d.ts +1 -1
- package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ColorRampControls.js +4 -3
- package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ColorRampSelector.d.ts +2 -1
- package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ColorRampSelector.js +6 -1
- package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ModeSelectRow.d.ts +1 -1
- package/lib/{dialogs → features/layers}/symbology/components/color_ramp/RgbaColorPicker.js +39 -9
- package/lib/{dialogs → features/layers}/symbology/components/color_stops/StopContainer.js +1 -1
- package/lib/{dialogs → features/layers}/symbology/components/color_stops/StopRow.d.ts +1 -1
- package/lib/{dialogs → features/layers}/symbology/components/color_stops/StopRow.js +14 -2
- package/lib/features/layers/symbology/grammarToOLLayer.d.ts +27 -0
- package/lib/features/layers/symbology/grammarToOLLayer.js +145 -0
- package/lib/features/layers/symbology/grammarToOLStyle.d.ts +32 -0
- package/lib/features/layers/symbology/grammarToOLStyle.js +487 -0
- package/lib/{dialogs → features/layers}/symbology/hooks/useGetBandInfo.d.ts +1 -1
- package/lib/{dialogs → features/layers}/symbology/hooks/useGetBandInfo.js +1 -1
- package/lib/{dialogs → features/layers}/symbology/hooks/useGetProperties.js +1 -1
- package/lib/{dialogs → features/layers}/symbology/hooks/useGetSymbology.js +4 -2
- package/lib/features/layers/symbology/styleBuilder.d.ts +24 -0
- package/lib/features/layers/symbology/styleBuilder.js +158 -0
- package/lib/{dialogs → features/layers}/symbology/symbologyDialog.d.ts +1 -1
- package/lib/{dialogs → features/layers}/symbology/symbologyDialog.js +11 -13
- package/lib/{dialogs → features/layers}/symbology/symbologyUtils.d.ts +18 -10
- package/lib/{dialogs → features/layers}/symbology/symbologyUtils.js +0 -84
- package/lib/{panelview/objectproperties.d.ts → features/objectproperties/index.d.ts} +1 -1
- package/lib/{panelview/objectproperties.js → features/objectproperties/index.js} +5 -10
- package/lib/{dialogs → features/processing}/ProcessingFormDialog.d.ts +1 -1
- package/lib/{dialogs → features/processing}/ProcessingFormDialog.js +28 -14
- package/lib/features/processing/forms/MapExtentToggle.d.ts +13 -0
- package/lib/features/processing/forms/MapExtentToggle.js +20 -0
- package/lib/features/processing/forms/clipRasterByExtentForm.d.ts +10 -0
- package/lib/features/processing/forms/clipRasterByExtentForm.js +99 -0
- package/lib/{formbuilder/objectform/process → features/processing/forms}/dissolveProcessForm.js +5 -5
- package/lib/{formbuilder/objectform → features/processing/forms}/processingForm.d.ts +1 -1
- package/lib/{formbuilder/objectform → features/processing/forms}/processingForm.js +6 -6
- package/lib/features/processing/forms/rasterizeForm.d.ts +10 -0
- package/lib/features/processing/forms/rasterizeForm.js +75 -0
- package/lib/features/processing/forms/useMapExtent.d.ts +22 -0
- package/lib/features/processing/forms/useMapExtent.js +57 -0
- package/lib/{processing → features/processing}/index.d.ts +19 -2
- package/lib/features/processing/index.js +1246 -0
- package/lib/{processing → features/processing}/processingCommands.d.ts +1 -1
- package/lib/features/processing/processingCommands.js +168 -0
- package/lib/features/processing/serverProcessing.d.ts +51 -0
- package/lib/features/processing/serverProcessing.js +99 -0
- package/lib/{stacBrowser → features/stac-browser}/components/StacPanel.js +2 -2
- package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/QueryableComboBox.js +5 -5
- package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/QueryableRow.js +1 -1
- package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/StacFilterExtensionPanel.js +2 -2
- package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/StacQueryableFilters.js +1 -1
- package/lib/{stacBrowser → features/stac-browser}/components/geodes/StacFilterSection.js +3 -3
- package/lib/{stacBrowser → features/stac-browser}/components/shared/StacPanelResults.js +3 -3
- package/lib/{stacBrowser → features/stac-browser}/components/shared/StacSpatialExtent.js +1 -1
- package/lib/{stacBrowser → features/stac-browser}/components/shared/StacTemporalExtent.js +1 -1
- package/lib/{stacBrowser → features/stac-browser}/context/StacResultsContext.js +2 -2
- package/lib/{stacBrowser → features/stac-browser}/hooks/useGeodesSearch.js +2 -2
- package/lib/{stacBrowser → features/stac-browser}/hooks/useStacFilterExtension.js +3 -3
- package/lib/{stacBrowser → features/stac-browser}/hooks/useStacSearch.js +1 -1
- package/lib/features/stac-browser/types/types.js +1 -0
- package/lib/{panelview/story-maps → features/story}/SpectaPanel.d.ts +4 -1
- package/lib/{panelview/story-maps → features/story}/SpectaPanel.js +3 -4
- package/lib/{panelview/story-maps → features/story}/StoryEditorPanel.js +1 -1
- package/lib/{panelview/story-maps → features/story}/StoryViewerPanel.d.ts +12 -11
- package/lib/features/story/StoryViewerPanel.js +64 -0
- package/lib/features/story/__tests__/fixtures/listStoryTestItems.d.ts +9 -0
- package/lib/features/story/__tests__/fixtures/listStoryTestItems.js +21 -0
- package/lib/features/story/components/ListStoryMapOverlayPanel.d.ts +10 -0
- package/lib/features/story/components/ListStoryMapOverlayPanel.js +11 -0
- package/lib/features/story/components/ListStoryMarkdownMeasurePane.d.ts +11 -0
- package/lib/features/story/components/ListStoryMarkdownMeasurePane.js +55 -0
- package/lib/features/story/components/ListStoryOverlayMarkdown.d.ts +15 -0
- package/lib/features/story/components/ListStoryOverlayMarkdown.js +93 -0
- package/lib/features/story/components/ListStoryStageOverlay.d.ts +11 -0
- package/lib/features/story/components/ListStoryStageOverlay.js +150 -0
- package/lib/features/story/components/ListStoryTitleBar.d.ts +7 -0
- package/lib/features/story/components/ListStoryTitleBar.js +20 -0
- package/lib/features/story/components/ListStoryTitleBarDesktop.d.ts +2 -0
- package/lib/features/story/components/ListStoryTitleBarDesktop.js +55 -0
- package/lib/features/story/components/ListStoryTitleBarMobile.d.ts +2 -0
- package/lib/features/story/components/ListStoryTitleBarMobile.js +41 -0
- package/lib/features/story/components/ListStoryVirtualScrollTrack.d.ts +6 -0
- package/lib/features/story/components/ListStoryVirtualScrollTrack.js +7 -0
- package/lib/{panelview/story-maps → features/story}/components/SpectaDesktopView.d.ts +4 -2
- package/lib/features/story/components/SpectaDesktopView.js +67 -0
- package/lib/features/story/components/SpectaMobileListModeContent.d.ts +13 -0
- package/lib/features/story/components/SpectaMobileListModeContent.js +36 -0
- package/lib/features/story/components/SpectaMobileSingleModeContent.d.ts +14 -0
- package/lib/{panelview/story-maps/components/SpectaMobileView.js → features/story/components/SpectaMobileSingleModeContent.js} +4 -6
- package/lib/{panelview/story-maps → features/story}/components/SpectaMobileView.d.ts +5 -3
- package/lib/features/story/components/SpectaMobileView.js +12 -0
- package/lib/features/story/components/SpectaSingleModeContent.d.ts +18 -0
- package/lib/features/story/components/SpectaSingleModeContent.js +8 -0
- package/lib/features/story/context/ListStoryScrollTrackContext.d.ts +19 -0
- package/lib/features/story/context/ListStoryScrollTrackContext.js +186 -0
- package/lib/features/story/hooks/useCurrentSegmentIndex.d.ts +3 -0
- package/lib/features/story/hooks/useCurrentSegmentIndex.js +17 -0
- package/lib/features/story/hooks/useListStoryScroll.d.ts +15 -0
- package/lib/features/story/hooks/useListStoryScroll.js +107 -0
- package/lib/features/story/hooks/useQueuedMarkdownHeightMeasure.d.ts +19 -0
- package/lib/features/story/hooks/useQueuedMarkdownHeightMeasure.js +56 -0
- package/lib/features/story/hooks/useStoryImagePreload.d.ts +1 -0
- package/lib/features/story/hooks/useStoryImagePreload.js +24 -0
- package/lib/{panelview/story-maps → features/story}/hooks/useStoryMap.d.ts +2 -7
- package/lib/{panelview/story-maps → features/story}/hooks/useStoryMap.js +21 -60
- package/lib/features/story/hooks/useStoryScrollState.d.ts +21 -0
- package/lib/features/story/hooks/useStoryScrollState.js +39 -0
- package/lib/features/story/hooks/useStorySegmentSync.d.ts +8 -0
- package/lib/features/story/hooks/useStorySegmentSync.js +51 -0
- package/lib/features/story/types/types.d.ts +43 -0
- package/lib/features/story/types/types.js +1 -0
- package/lib/features/story/utils/computeListStoryScrollState.d.ts +14 -0
- package/lib/features/story/utils/computeListStoryScrollState.js +79 -0
- package/lib/features/story/utils/listStoryMeasureQueue.d.ts +11 -0
- package/lib/features/story/utils/listStoryMeasureQueue.js +14 -0
- package/lib/features/story/utils/listStoryScrollTrack.d.ts +17 -0
- package/lib/features/story/utils/listStoryScrollTrack.js +72 -0
- package/lib/features/story/utils/spectaPresentation.d.ts +9 -0
- package/lib/features/story/utils/spectaPresentation.js +37 -0
- package/lib/features/story/utils/storySegmentViewItems.d.ts +5 -0
- package/lib/features/story/utils/storySegmentViewItems.js +30 -0
- package/lib/index.d.ts +11 -9
- package/lib/index.js +11 -9
- package/lib/keybindings.json +5 -0
- package/lib/mainview/OpenEOTileLayer.d.ts +49 -0
- package/lib/mainview/OpenEOTileLayer.js +179 -0
- package/lib/mainview/TemporalSlider.js +11 -9
- package/lib/mainview/components/MainViewMapSurface.d.ts +15 -0
- package/lib/mainview/components/MainViewMapSurface.js +13 -0
- package/lib/mainview/components/MainViewOverlayLayer.d.ts +9 -0
- package/lib/mainview/components/MainViewOverlayLayer.js +11 -0
- package/lib/mainview/components/MainViewSidePanels.d.ts +17 -0
- package/lib/mainview/components/MainViewSidePanels.js +10 -0
- package/lib/mainview/components/MainViewSpectaPanel.d.ts +17 -0
- package/lib/mainview/components/MainViewSpectaPanel.js +8 -0
- package/lib/mainview/components/MainViewStoryStage.d.ts +13 -0
- package/lib/mainview/components/MainViewStoryStage.js +17 -0
- package/lib/mainview/components/PositionedFloater.d.ts +10 -0
- package/lib/mainview/components/PositionedFloater.js +7 -0
- package/lib/mainview/geoJsonFeaturePatch.d.ts +9 -0
- package/lib/mainview/geoJsonFeaturePatch.js +43 -0
- package/lib/mainview/mainView.d.ts +93 -14
- package/lib/mainview/mainView.js +1216 -686
- package/lib/mainview/mainviewwidget.d.ts +5 -1
- package/lib/mainview/mainviewwidget.js +4 -2
- package/lib/shared/components/Button.d.ts +1 -1
- package/lib/shared/components/DropdownMenu.d.ts +1 -0
- package/lib/shared/components/DropdownMenu.js +3 -2
- package/lib/shared/components/NativeSelect.d.ts +8 -0
- package/lib/shared/components/NativeSelect.js +29 -0
- package/lib/shared/components/Tabs.d.ts +3 -3
- package/lib/shared/components/Tabs.js +5 -5
- package/lib/{formbuilder → shared/formbuilder}/creationform.js +71 -4
- package/lib/{formbuilder → shared/formbuilder}/editform.js +1 -1
- package/lib/{formbuilder → shared/formbuilder}/formselectors.d.ts +2 -2
- package/lib/{formbuilder → shared/formbuilder}/formselectors.js +10 -7
- package/lib/shared/formbuilder/index.d.ts +4 -0
- package/lib/shared/formbuilder/index.js +4 -0
- package/lib/{formbuilder → shared/formbuilder}/objectform/SchemaForm.d.ts +1 -1
- package/lib/{formbuilder → shared/formbuilder}/objectform/StoryEditorForm.d.ts +1 -1
- package/lib/{formbuilder → shared/formbuilder}/objectform/StoryEditorForm.js +1 -1
- package/lib/{formbuilder → shared/formbuilder}/objectform/components/LayerSelect.js +1 -1
- package/lib/{formbuilder → shared/formbuilder}/objectform/components/SegmentFormSymbology.js +4 -4
- package/lib/{formbuilder → shared/formbuilder}/objectform/components/SourcePropertiesField.js +1 -1
- package/lib/{formbuilder → shared/formbuilder}/objectform/components/StorySegmentReset.js +1 -1
- package/lib/{formbuilder → shared/formbuilder}/objectform/components/WmsTileSourceUrlInput.js +4 -4
- package/lib/{formbuilder → shared/formbuilder}/objectform/fileselectorwidget.js +8 -1
- package/lib/{formbuilder → shared/formbuilder}/objectform/schemaUtils.d.ts +3 -1
- package/lib/{formbuilder → shared/formbuilder}/objectform/schemaUtils.js +11 -0
- package/lib/{formbuilder → shared/formbuilder}/objectform/useSchemaFormState.d.ts +1 -1
- package/lib/{formbuilder → shared/formbuilder}/objectform/useSchemaFormState.js +1 -1
- package/lib/{icons.d.ts → shared/icons.d.ts} +2 -0
- package/lib/{icons.js → shared/icons.js} +28 -18
- package/lib/tools.d.ts +2 -0
- package/lib/tools.js +138 -4
- package/lib/types.d.ts +6 -1
- package/lib/types.js +6 -2
- package/lib/{menus.js → workspace/menus.js} +10 -2
- package/lib/workspace/panels/components/TabbedPanel.d.ts +17 -0
- package/lib/workspace/panels/components/TabbedPanel.js +19 -0
- package/lib/{panelview → workspace/panels}/components/layers.js +63 -18
- package/lib/workspace/panels/components/legendItem.js +680 -0
- package/lib/workspace/panels/hooks/useLayerTree.d.ts +19 -0
- package/lib/workspace/panels/hooks/useLayerTree.js +103 -0
- package/lib/workspace/panels/hooks/useRightPanelOptions.d.ts +27 -0
- package/lib/workspace/panels/hooks/useRightPanelOptions.js +72 -0
- package/lib/workspace/panels/hooks/useUIState.d.ts +2 -0
- package/lib/workspace/panels/hooks/useUIState.js +25 -0
- package/lib/{panelview → workspace/panels}/index.d.ts +1 -1
- package/lib/{panelview → workspace/panels}/index.js +1 -1
- package/lib/{panelview → workspace/panels}/leftpanel.d.ts +1 -1
- package/lib/workspace/panels/leftpanel.js +70 -0
- package/lib/{panelview/rightpanel.d.ts → workspace/panels/mergedpanel.d.ts} +6 -5
- package/lib/workspace/panels/mergedpanel.js +166 -0
- package/lib/workspace/panels/rightpanel.d.ts +25 -0
- package/lib/{panelview → workspace/panels}/rightpanel.js +53 -63
- package/lib/{statusbar → workspace/statusbar}/StatusBar.js +5 -4
- package/lib/{toolbar → workspace/toolbar}/widget.d.ts +2 -0
- package/lib/{toolbar → workspace/toolbar}/widget.js +33 -5
- package/lib/{widget.d.ts → workspace/widget.d.ts} +7 -5
- package/lib/{widget.js → workspace/widget.js} +16 -7
- package/package.json +16 -4
- package/style/base.css +124 -2
- package/style/icons/geopackage.svg +95 -0
- package/style/icons/pencil_solid.svg +7 -0
- package/style/identify.css +95 -0
- package/style/layerBrowser.css +29 -1
- package/style/leftPanel.css +25 -0
- package/style/shared/button.css +12 -0
- package/style/shared/dropdownMenu.css +9 -0
- package/style/shared/nativeSelect.css +75 -0
- package/style/shared/tabs.css +1 -1
- package/style/spectaProgressBar.css +0 -1
- package/style/storyPanel.css +330 -9
- package/style/storySpectaArticleOverlay.css +129 -0
- package/style/symbologyDialog.css +522 -27
- package/lib/dialogs/symbology/tiff_layer/TiffRendering.d.ts +0 -4
- package/lib/dialogs/symbology/tiff_layer/TiffRendering.js +0 -42
- package/lib/dialogs/symbology/tiff_layer/components/BandRow.d.ts +0 -23
- package/lib/dialogs/symbology/tiff_layer/components/BandRow.js +0 -59
- package/lib/dialogs/symbology/tiff_layer/types/MultibandColor.d.ts +0 -4
- package/lib/dialogs/symbology/tiff_layer/types/MultibandColor.js +0 -92
- package/lib/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.d.ts +0 -5
- package/lib/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.js +0 -313
- package/lib/dialogs/symbology/vector_layer/VectorRendering.d.ts +0 -4
- package/lib/dialogs/symbology/vector_layer/VectorRendering.js +0 -112
- package/lib/dialogs/symbology/vector_layer/components/ValueSelect.d.ts +0 -8
- package/lib/dialogs/symbology/vector_layer/components/ValueSelect.js +0 -9
- package/lib/dialogs/symbology/vector_layer/types/Canonical.d.ts +0 -4
- package/lib/dialogs/symbology/vector_layer/types/Canonical.js +0 -130
- package/lib/dialogs/symbology/vector_layer/types/Categorized.d.ts +0 -4
- package/lib/dialogs/symbology/vector_layer/types/Categorized.js +0 -243
- package/lib/dialogs/symbology/vector_layer/types/Graduated.d.ts +0 -4
- package/lib/dialogs/symbology/vector_layer/types/Graduated.js +0 -362
- package/lib/dialogs/symbology/vector_layer/types/Heatmap.d.ts +0 -4
- package/lib/dialogs/symbology/vector_layer/types/Heatmap.js +0 -89
- package/lib/dialogs/symbology/vector_layer/types/SimpleSymbol.d.ts +0 -4
- package/lib/dialogs/symbology/vector_layer/types/SimpleSymbol.js +0 -120
- package/lib/formbuilder/index.d.ts +0 -4
- package/lib/formbuilder/index.js +0 -4
- package/lib/formbuilder/objectform/layer/heatmapLayerForm.js +0 -96
- package/lib/formbuilder/objectform/layer/storySegmentLayerForm.js +0 -95
- package/lib/formbuilder/objectform/layer/webGlLayerForm.d.ts +0 -3
- package/lib/formbuilder/objectform/process/index.d.ts +0 -1
- package/lib/formbuilder/objectform/process/index.js +0 -1
- package/lib/panelview/components/legendItem.js +0 -210
- package/lib/panelview/identify-panel/IdentifyPanel.js +0 -102
- package/lib/panelview/leftpanel.js +0 -139
- package/lib/panelview/story-maps/StoryViewerPanel.js +0 -116
- package/lib/panelview/story-maps/components/SpectaDesktopView.js +0 -49
- package/lib/processing/index.js +0 -200
- package/lib/processing/processingCommands.js +0 -67
- /package/lib/{panelview/annotationPanel.d.ts → features/annotations/AnnotationsPanel.d.ts} +0 -0
- /package/lib/{annotations → features/annotations}/components/Annotation.d.ts +0 -0
- /package/lib/{annotations → features/annotations}/components/Annotation.js +0 -0
- /package/lib/{annotations → features/annotations}/components/AnnotationFloater.d.ts +0 -0
- /package/lib/{annotations → features/annotations}/components/AnnotationFloater.js +0 -0
- /package/lib/{annotations → features/annotations}/components/Message.d.ts +0 -0
- /package/lib/{annotations → features/annotations}/components/Message.js +0 -0
- /package/lib/{annotations → features/annotations}/model.d.ts +0 -0
- /package/lib/{annotations → features/annotations}/model.js +0 -0
- /package/lib/{console → features/console}/consoleview.d.ts +0 -0
- /package/lib/{console → features/console}/index.d.ts +0 -0
- /package/lib/{console → features/console}/index.js +0 -0
- /package/lib/{panelview/filter-panel → features/filter}/Filter.d.ts +0 -0
- /package/lib/{stacBrowser/types/types.js → features/identify/types/editorTypes.js} +0 -0
- /package/lib/{dialogs/layerBrowserDialog.d.ts → features/layer-browser/index.d.ts} +0 -0
- /package/lib/{formbuilder/objectform → features/layers/forms}/layer/hillshadeLayerForm.d.ts +0 -0
- /package/lib/{formbuilder/objectform → features/layers/forms}/layer/storySegmentLayerForm.d.ts +0 -0
- /package/lib/{formbuilder/objectform → features/layers/forms}/layer/vectorlayerform.d.ts +0 -0
- /package/lib/{formbuilder/objectform → features/layers/forms}/source/geojsonsource.d.ts +0 -0
- /package/lib/{formbuilder/objectform → features/layers/forms}/source/geotiffsource.d.ts +0 -0
- /package/lib/{formbuilder/objectform → features/layers/forms}/source/pathbasedsource.d.ts +0 -0
- /package/lib/{formbuilder/objectform → features/layers/forms}/source/tilesourceform.d.ts +0 -0
- /package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ColorRampSelectorEntry.d.ts +0 -0
- /package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ColorRampSelectorEntry.js +0 -0
- /package/lib/{dialogs → features/layers}/symbology/components/color_ramp/ModeSelectRow.js +0 -0
- /package/lib/{dialogs → features/layers}/symbology/components/color_ramp/RgbaColorPicker.d.ts +0 -0
- /package/lib/{dialogs → features/layers}/symbology/components/color_ramp/cmocean.json +0 -0
- /package/lib/{dialogs → features/layers}/symbology/components/color_stops/StopContainer.d.ts +0 -0
- /package/lib/{dialogs → features/layers}/symbology/hooks/useEffectiveSymbologyParams.d.ts +0 -0
- /package/lib/{dialogs → features/layers}/symbology/hooks/useEffectiveSymbologyParams.js +0 -0
- /package/lib/{dialogs → features/layers}/symbology/hooks/useGetProperties.d.ts +0 -0
- /package/lib/{dialogs → features/layers}/symbology/hooks/useGetSymbology.d.ts +0 -0
- /package/lib/{dialogs → features/layers}/symbology/hooks/useOkSignal.d.ts +0 -0
- /package/lib/{dialogs → features/layers}/symbology/hooks/useOkSignal.js +0 -0
- /package/lib/{formbuilder/objectform/process → features/processing/forms}/dissolveProcessForm.d.ts +0 -0
- /package/lib/{processing → features/processing}/processingFormToParam.d.ts +0 -0
- /package/lib/{processing → features/processing}/processingFormToParam.js +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/components/StacPanel.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/QueryableComboBox.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/QueryableRow.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/StacFilterExtensionPanel.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/components/filter-extension/StacQueryableFilters.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/components/geodes/StacFilterSection.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/components/geodes/StacGeodesFilterPanel.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/components/geodes/StacGeodesFilterPanel.js +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/components/shared/StacPanelResults.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/components/shared/StacSpatialExtent.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/components/shared/StacTemporalExtent.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/constants.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/constants.js +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/context/StacResultsContext.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/hooks/useGeodesSearch.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/hooks/useStacFilterExtension.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/hooks/useStacSearch.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/index.d.ts +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/index.js +0 -0
- /package/lib/{stacBrowser → features/stac-browser}/types/types.d.ts +0 -0
- /package/lib/{panelview/story-maps → features/story}/StoryEditorPanel.d.ts +0 -0
- /package/lib/{panelview/story-maps → features/story}/components/PreviewModeSwitch.d.ts +0 -0
- /package/lib/{panelview/story-maps → features/story}/components/PreviewModeSwitch.js +0 -0
- /package/lib/{panelview/story-maps → features/story}/components/StoryContentSection.d.ts +0 -0
- /package/lib/{panelview/story-maps → features/story}/components/StoryContentSection.js +0 -0
- /package/lib/{panelview/story-maps → features/story}/components/StoryImageSection.d.ts +0 -0
- /package/lib/{panelview/story-maps → features/story}/components/StoryImageSection.js +0 -0
- /package/lib/{panelview/story-maps → features/story}/components/StoryNavBar.d.ts +0 -0
- /package/lib/{panelview/story-maps → features/story}/components/StoryNavBar.js +0 -0
- /package/lib/{panelview/story-maps → features/story}/components/StorySubtitleSection.d.ts +0 -0
- /package/lib/{panelview/story-maps → features/story}/components/StorySubtitleSection.js +0 -0
- /package/lib/{panelview/story-maps → features/story}/components/StoryTitleSection.d.ts +0 -0
- /package/lib/{panelview/story-maps → features/story}/components/StoryTitleSection.js +0 -0
- /package/lib/{formbuilder → shared/formbuilder}/creationform.d.ts +0 -0
- /package/lib/{formbuilder → shared/formbuilder}/editform.d.ts +0 -0
- /package/lib/{formbuilder → shared/formbuilder}/objectform/SchemaForm.js +0 -0
- /package/lib/{formbuilder → shared/formbuilder}/objectform/components/LayerSelect.d.ts +0 -0
- /package/lib/{formbuilder → shared/formbuilder}/objectform/components/OpacitySlider.d.ts +0 -0
- /package/lib/{formbuilder → shared/formbuilder}/objectform/components/OpacitySlider.js +0 -0
- /package/lib/{formbuilder → shared/formbuilder}/objectform/components/SegmentFormSymbology.d.ts +0 -0
- /package/lib/{formbuilder → shared/formbuilder}/objectform/components/SourcePropertiesField.d.ts +0 -0
- /package/lib/{formbuilder → shared/formbuilder}/objectform/components/StorySegmentReset.d.ts +0 -0
- /package/lib/{formbuilder → shared/formbuilder}/objectform/components/WmsTileSourceUrlInput.d.ts +0 -0
- /package/lib/{formbuilder → shared/formbuilder}/objectform/fileselectorwidget.d.ts +0 -0
- /package/lib/{store.d.ts → shared/store.d.ts} +0 -0
- /package/lib/{store.js → shared/store.js} +0 -0
- /package/lib/{menus.d.ts → workspace/menus.d.ts} +0 -0
- /package/lib/{panelview → workspace/panels}/components/layers.d.ts +0 -0
- /package/lib/{panelview → workspace/panels}/components/legendItem.d.ts +0 -0
- /package/lib/{panelview → workspace/panels}/header.d.ts +0 -0
- /package/lib/{panelview → workspace/panels}/header.js +0 -0
- /package/lib/{statusbar → workspace/statusbar}/SpectaPresentationProgressBar.d.ts +0 -0
- /package/lib/{statusbar → workspace/statusbar}/SpectaPresentationProgressBar.js +0 -0
- /package/lib/{statusbar → workspace/statusbar}/StatusBar.d.ts +0 -0
- /package/lib/{toolbar → workspace/toolbar}/index.d.ts +0 -0
- /package/lib/{toolbar → workspace/toolbar}/index.js +0 -0
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single grammar mapping row: field → scale → channels (fan-out tree).
|
|
3
|
+
* The scale preview spans all channel rows. Additional channels branch below.
|
|
4
|
+
* "when" predicates are shown as chips below the grid.
|
|
5
|
+
*/
|
|
6
|
+
import { faCheck, faPlus, faTrash, faXmark, } from '@fortawesome/free-solid-svg-icons';
|
|
7
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
8
|
+
import React, { useCallback, useRef, useState } from 'react';
|
|
9
|
+
import { drawColorRamp, getColorMap, } from "../colorRampUtils";
|
|
10
|
+
import { Button } from "../../../../shared/components/Button";
|
|
11
|
+
import { Input } from "../../../../shared/components/Input";
|
|
12
|
+
import { NativeSelect, NativeSelectOption, } from "../../../../shared/components/NativeSelect";
|
|
13
|
+
import { CategoricalEditor, ColorRampEditor, ConstantEditor, ScalarEditor, } from './ScaleEditor';
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Channel taxonomy
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
const RGBA_CHANNELS = [
|
|
18
|
+
'fill-color',
|
|
19
|
+
'stroke-color',
|
|
20
|
+
'circle-fill-color',
|
|
21
|
+
'circle-stroke-color',
|
|
22
|
+
];
|
|
23
|
+
const POSFLOAT_CHANNELS = [
|
|
24
|
+
'stroke-width',
|
|
25
|
+
'circle-stroke-width',
|
|
26
|
+
'circle-radius',
|
|
27
|
+
];
|
|
28
|
+
const ALL_CHANNELS = [...RGBA_CHANNELS, ...POSFLOAT_CHANNELS];
|
|
29
|
+
// Channels relevant for raster/KDE layers.
|
|
30
|
+
// pixel-color: full RGBA including alpha (label: "pixel-rgba").
|
|
31
|
+
// pixel-rgb: virtual channel — RGB only; pair with pixel-alpha for separate alpha.
|
|
32
|
+
// pixel-alpha: alpha sub-channel (0-1 scalar).
|
|
33
|
+
const PIXEL_RGBA_CHANNELS = [
|
|
34
|
+
'pixel-color',
|
|
35
|
+
'pixel-rgb',
|
|
36
|
+
'pixel-red',
|
|
37
|
+
'pixel-green',
|
|
38
|
+
'pixel-blue',
|
|
39
|
+
];
|
|
40
|
+
const PIXEL_FLOAT_CHANNELS = ['pixel-alpha'];
|
|
41
|
+
const ALL_PIXEL_CHANNELS = [...PIXEL_RGBA_CHANNELS, ...PIXEL_FLOAT_CHANNELS];
|
|
42
|
+
/** Display labels for channels that need a friendlier name. */
|
|
43
|
+
const CHANNEL_LABELS = {
|
|
44
|
+
'pixel-color': 'pixel-rgba',
|
|
45
|
+
};
|
|
46
|
+
function compatibleChannels(scale, isRaster = false) {
|
|
47
|
+
if (isRaster) {
|
|
48
|
+
switch (scale.scheme) {
|
|
49
|
+
case 'colorRamp':
|
|
50
|
+
case 'categorical':
|
|
51
|
+
case 'constant_rgba':
|
|
52
|
+
return PIXEL_RGBA_CHANNELS;
|
|
53
|
+
case 'scalar':
|
|
54
|
+
case 'constant_num':
|
|
55
|
+
return PIXEL_FLOAT_CHANNELS;
|
|
56
|
+
default:
|
|
57
|
+
return ALL_PIXEL_CHANNELS;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
switch (scale.scheme) {
|
|
61
|
+
case 'colorRamp':
|
|
62
|
+
case 'categorical':
|
|
63
|
+
case 'constant_rgba':
|
|
64
|
+
return RGBA_CHANNELS;
|
|
65
|
+
case 'scalar':
|
|
66
|
+
case 'constant_num':
|
|
67
|
+
return POSFLOAT_CHANNELS;
|
|
68
|
+
default:
|
|
69
|
+
return ALL_CHANNELS;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function defaultScaleForScheme(scheme, _currentChannels) {
|
|
73
|
+
switch (scheme) {
|
|
74
|
+
case 'constant_rgba':
|
|
75
|
+
return {
|
|
76
|
+
scheme: 'constant_rgba',
|
|
77
|
+
params: { value: [128, 128, 128, 1] },
|
|
78
|
+
};
|
|
79
|
+
case 'constant_num':
|
|
80
|
+
return {
|
|
81
|
+
scheme: 'constant_num',
|
|
82
|
+
params: { value: 1 },
|
|
83
|
+
};
|
|
84
|
+
case 'colorRamp':
|
|
85
|
+
return {
|
|
86
|
+
scheme: 'colorRamp',
|
|
87
|
+
params: {
|
|
88
|
+
name: 'viridis',
|
|
89
|
+
nShades: 9,
|
|
90
|
+
mode: 'equal interval',
|
|
91
|
+
reverse: false,
|
|
92
|
+
fallback: [0, 0, 0, 0],
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
case 'categorical':
|
|
96
|
+
return {
|
|
97
|
+
scheme: 'categorical',
|
|
98
|
+
params: {
|
|
99
|
+
colorRamp: 'schemeCategory10',
|
|
100
|
+
reverse: false,
|
|
101
|
+
fallback: [0, 0, 0, 0],
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
case 'scalar':
|
|
105
|
+
return {
|
|
106
|
+
scheme: 'scalar',
|
|
107
|
+
params: {
|
|
108
|
+
domain: [0, 100],
|
|
109
|
+
range: [1, 20],
|
|
110
|
+
mode: 'equal interval',
|
|
111
|
+
nStops: 5,
|
|
112
|
+
fallback: 1,
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
case 'identity':
|
|
116
|
+
return { scheme: 'identity' };
|
|
117
|
+
default:
|
|
118
|
+
return {
|
|
119
|
+
scheme: 'constant_num',
|
|
120
|
+
params: { value: 1 },
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
// Scheme selector options
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
const SCHEME_OPTIONS = [
|
|
128
|
+
{ value: 'constant_rgba', label: 'const (color)' },
|
|
129
|
+
{ value: 'constant_num', label: 'const (num)' },
|
|
130
|
+
{ value: 'colorRamp', label: 'colorRamp' },
|
|
131
|
+
{ value: 'categorical', label: 'categorical' },
|
|
132
|
+
{ value: 'scalar', label: 'scalar' },
|
|
133
|
+
{ value: 'identity', label: 'identity' },
|
|
134
|
+
{ value: 'expression', label: 'expression (coming soon)', disabled: true },
|
|
135
|
+
];
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
// Scale preview
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
const ColorRampPreview = ({ name, reverse, }) => {
|
|
140
|
+
const ref = useRef(null);
|
|
141
|
+
React.useEffect(() => {
|
|
142
|
+
const canvas = ref.current;
|
|
143
|
+
if (!canvas) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const colorMap = getColorMap(name);
|
|
147
|
+
if (!colorMap) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const map = reverse
|
|
151
|
+
? Object.assign(Object.assign({}, colorMap), { colors: [...colorMap.colors].reverse() }) : colorMap;
|
|
152
|
+
drawColorRamp(canvas, map);
|
|
153
|
+
}, [name, reverse]);
|
|
154
|
+
return (React.createElement("canvas", { ref: ref, width: 160, height: 14, style: {
|
|
155
|
+
borderRadius: 2,
|
|
156
|
+
flex: '0 0 80px',
|
|
157
|
+
height: 14,
|
|
158
|
+
display: 'block',
|
|
159
|
+
} }));
|
|
160
|
+
};
|
|
161
|
+
const ScalePreview = ({ scale }) => {
|
|
162
|
+
switch (scale.scheme) {
|
|
163
|
+
case 'constant_rgba': {
|
|
164
|
+
const [r, g, b, a] = scale.params.value;
|
|
165
|
+
return (React.createElement("span", { className: "jp-gis-scale-preview" },
|
|
166
|
+
React.createElement("span", { className: "jp-gis-scale-swatch", style: { background: `rgba(${r},${g},${b},${a})` } }),
|
|
167
|
+
React.createElement("span", { className: "jp-gis-scale-meta" },
|
|
168
|
+
r,
|
|
169
|
+
", ",
|
|
170
|
+
g,
|
|
171
|
+
", ",
|
|
172
|
+
b,
|
|
173
|
+
", ",
|
|
174
|
+
a)));
|
|
175
|
+
}
|
|
176
|
+
case 'constant_num':
|
|
177
|
+
return (React.createElement("span", { className: "jp-gis-scale-preview" },
|
|
178
|
+
React.createElement("span", { className: "jp-gis-scale-meta" },
|
|
179
|
+
"= ",
|
|
180
|
+
scale.params.value)));
|
|
181
|
+
case 'colorRamp': {
|
|
182
|
+
const { name, reverse, domain } = scale.params;
|
|
183
|
+
return (React.createElement("span", { className: "jp-gis-scale-preview" },
|
|
184
|
+
React.createElement(ColorRampPreview, { name: name, reverse: reverse }),
|
|
185
|
+
React.createElement("span", { className: "jp-gis-scale-meta" },
|
|
186
|
+
name,
|
|
187
|
+
domain ? ` [${domain[0]}–${domain[1]}]` : '')));
|
|
188
|
+
}
|
|
189
|
+
case 'categorical': {
|
|
190
|
+
const { colorRamp, colorStops } = scale.params;
|
|
191
|
+
if (colorStops === null || colorStops === void 0 ? void 0 : colorStops.length) {
|
|
192
|
+
return (React.createElement("span", { className: "jp-gis-scale-preview" },
|
|
193
|
+
colorStops.slice(0, 8).map((s, i) => {
|
|
194
|
+
const [r, g, b, aa] = s.color;
|
|
195
|
+
return (React.createElement("span", { key: i, className: "jp-gis-scale-dot", style: { background: `rgba(${r},${g},${b},${aa})` } }));
|
|
196
|
+
}),
|
|
197
|
+
React.createElement("span", { className: "jp-gis-scale-meta" }, colorRamp)));
|
|
198
|
+
}
|
|
199
|
+
return (React.createElement("span", { className: "jp-gis-scale-preview" },
|
|
200
|
+
React.createElement("span", { className: "jp-gis-scale-meta" }, colorRamp !== null && colorRamp !== void 0 ? colorRamp : 'categorical')));
|
|
201
|
+
}
|
|
202
|
+
case 'scalar': {
|
|
203
|
+
const { domain, range } = scale.params;
|
|
204
|
+
return (React.createElement("span", { className: "jp-gis-scale-preview" },
|
|
205
|
+
React.createElement("span", { className: "jp-gis-scale-meta" },
|
|
206
|
+
"[",
|
|
207
|
+
domain[0],
|
|
208
|
+
", ",
|
|
209
|
+
domain[1],
|
|
210
|
+
"] \u2192 [",
|
|
211
|
+
range[0],
|
|
212
|
+
", ",
|
|
213
|
+
range[1],
|
|
214
|
+
"]")));
|
|
215
|
+
}
|
|
216
|
+
case 'identity':
|
|
217
|
+
return (React.createElement("span", { className: "jp-gis-scale-preview" },
|
|
218
|
+
React.createElement("span", { className: "jp-gis-scale-meta" }, "\u2218 identity")));
|
|
219
|
+
case 'expression':
|
|
220
|
+
return (React.createElement("span", { className: "jp-gis-scale-preview" },
|
|
221
|
+
React.createElement("span", { className: "jp-gis-scale-meta" }, "expression")));
|
|
222
|
+
default:
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
// ---------------------------------------------------------------------------
|
|
227
|
+
// When-clause helpers
|
|
228
|
+
// ---------------------------------------------------------------------------
|
|
229
|
+
export function formatPredicate(pred) {
|
|
230
|
+
switch (pred.type) {
|
|
231
|
+
case 'geometryType':
|
|
232
|
+
return `geom = ${pred.value}`;
|
|
233
|
+
case 'hasField':
|
|
234
|
+
return `has: ${pred.field}`;
|
|
235
|
+
case 'fieldEquals':
|
|
236
|
+
return `${pred.field} = ${pred.value}`;
|
|
237
|
+
case 'fieldCompare':
|
|
238
|
+
return `${pred.field} ${pred.op} ${pred.value}`;
|
|
239
|
+
case 'between':
|
|
240
|
+
return `${pred.field} between ${pred.min} and ${pred.max}`;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const COMPARE_OPS = ['>', '<', '>=', '<=', '!='];
|
|
244
|
+
const EMPTY_NEW = {
|
|
245
|
+
type: 'geometryType',
|
|
246
|
+
geomValue: 'Point',
|
|
247
|
+
field: '',
|
|
248
|
+
fieldValue: '',
|
|
249
|
+
compareOp: '>',
|
|
250
|
+
betweenMin: '',
|
|
251
|
+
betweenMax: '',
|
|
252
|
+
};
|
|
253
|
+
function buildPredicate(p) {
|
|
254
|
+
switch (p.type) {
|
|
255
|
+
case 'geometryType':
|
|
256
|
+
return { type: 'geometryType', value: p.geomValue };
|
|
257
|
+
case 'hasField':
|
|
258
|
+
return p.field ? { type: 'hasField', field: p.field } : null;
|
|
259
|
+
case 'fieldEquals':
|
|
260
|
+
return p.field
|
|
261
|
+
? {
|
|
262
|
+
type: 'fieldEquals',
|
|
263
|
+
field: p.field,
|
|
264
|
+
value: isNaN(Number(p.fieldValue))
|
|
265
|
+
? p.fieldValue
|
|
266
|
+
: Number(p.fieldValue),
|
|
267
|
+
}
|
|
268
|
+
: null;
|
|
269
|
+
case 'fieldCompare': {
|
|
270
|
+
const num = Number(p.fieldValue);
|
|
271
|
+
return p.field && !isNaN(num)
|
|
272
|
+
? { type: 'fieldCompare', field: p.field, op: p.compareOp, value: num }
|
|
273
|
+
: null;
|
|
274
|
+
}
|
|
275
|
+
case 'between': {
|
|
276
|
+
const min = Number(p.betweenMin);
|
|
277
|
+
const max = Number(p.betweenMax);
|
|
278
|
+
return p.field &&
|
|
279
|
+
!isNaN(min) &&
|
|
280
|
+
!isNaN(max) &&
|
|
281
|
+
p.betweenMin !== '' &&
|
|
282
|
+
p.betweenMax !== ''
|
|
283
|
+
? { type: 'between', field: p.field, min, max }
|
|
284
|
+
: null;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
export const WhenAddForm = ({ availableFields, onAdd, onCancel, }) => {
|
|
289
|
+
const [draft, setDraft] = useState(Object.assign({}, EMPTY_NEW));
|
|
290
|
+
const patch = (p) => setDraft(prev => (Object.assign(Object.assign({}, prev), p)));
|
|
291
|
+
const built = buildPredicate(draft);
|
|
292
|
+
return (React.createElement("span", { className: "jp-gis-grammar-when-form" },
|
|
293
|
+
React.createElement(NativeSelect, { value: draft.type, onChange: e => patch({ type: e.target.value }) },
|
|
294
|
+
React.createElement(NativeSelectOption, { value: "geometryType" }, "Geometry Type"),
|
|
295
|
+
React.createElement(NativeSelectOption, { value: "hasField" }, "Has Field"),
|
|
296
|
+
React.createElement(NativeSelectOption, { value: "fieldEquals" }, "Field Equals"),
|
|
297
|
+
React.createElement(NativeSelectOption, { value: "fieldCompare" }, "Field Compare"),
|
|
298
|
+
React.createElement(NativeSelectOption, { value: "between" }, "Between")),
|
|
299
|
+
draft.type === 'geometryType' && (React.createElement(NativeSelect, { value: draft.geomValue, onChange: e => patch({
|
|
300
|
+
geomValue: e.target.value,
|
|
301
|
+
}) },
|
|
302
|
+
React.createElement(NativeSelectOption, { value: "Point" }, "Point"),
|
|
303
|
+
React.createElement(NativeSelectOption, { value: "LineString" }, "LineString"),
|
|
304
|
+
React.createElement(NativeSelectOption, { value: "Polygon" }, "Polygon"))),
|
|
305
|
+
(draft.type === 'hasField' ||
|
|
306
|
+
draft.type === 'fieldEquals' ||
|
|
307
|
+
draft.type === 'fieldCompare' ||
|
|
308
|
+
draft.type === 'between') && (React.createElement(NativeSelect, { value: draft.field, onChange: e => patch({ field: e.target.value }) },
|
|
309
|
+
React.createElement(NativeSelectOption, { value: "" }, "(field)"),
|
|
310
|
+
availableFields.map(field => (React.createElement(NativeSelectOption, { key: field, value: field }, field))))),
|
|
311
|
+
draft.type === 'fieldCompare' && (React.createElement(NativeSelect, { value: draft.compareOp, onChange: e => patch({ compareOp: e.target.value }) }, COMPARE_OPS.map(op => (React.createElement(NativeSelectOption, { key: op, value: op }, op))))),
|
|
312
|
+
(draft.type === 'fieldEquals' || draft.type === 'fieldCompare') && (React.createElement(Input, { style: { flex: '0 0 80px', minWidth: 0 }, type: draft.type === 'fieldCompare' ? 'number' : 'text', placeholder: "value", value: draft.fieldValue, onChange: e => patch({ fieldValue: e.target.value }) })),
|
|
313
|
+
draft.type === 'between' && (React.createElement(React.Fragment, null,
|
|
314
|
+
React.createElement(Input, { style: { flex: '0 0 60px', minWidth: 0 }, type: "number", placeholder: "min", value: draft.betweenMin, onChange: e => patch({ betweenMin: e.target.value }) }),
|
|
315
|
+
React.createElement("span", { style: { flex: '0 0 auto', fontSize: 'var(--jp-ui-font-size0)' } }, "\u2013"),
|
|
316
|
+
React.createElement(Input, { style: { flex: '0 0 60px', minWidth: 0 }, type: "number", placeholder: "max", value: draft.betweenMax, onChange: e => patch({ betweenMax: e.target.value }) }))),
|
|
317
|
+
React.createElement(Button, { type: "button", variant: "icon", size: "icon-md", disabled: !built, onClick: () => built && onAdd(built), title: "Add predicate" },
|
|
318
|
+
React.createElement(FontAwesomeIcon, { icon: faCheck })),
|
|
319
|
+
React.createElement(Button, { type: "button", variant: "icon", size: "icon-md", className: "jp-gis-grammar-when-form-cancel", onClick: onCancel, title: "Cancel" },
|
|
320
|
+
React.createElement(FontAwesomeIcon, { icon: faXmark }))));
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* Renders the field input area in column 1 of the grid.
|
|
324
|
+
* 0 → "(const)" label, no selection
|
|
325
|
+
* 1 → single dropdown
|
|
326
|
+
* 'any'→ chips for each selected field + add dropdown
|
|
327
|
+
*/
|
|
328
|
+
const FieldSelector = ({ fieldCount, fields, availableFields, onFieldChange, onAddField, }) => {
|
|
329
|
+
var _a;
|
|
330
|
+
if (fieldCount === 0) {
|
|
331
|
+
return (React.createElement("span", { style: {
|
|
332
|
+
gridRow: 1,
|
|
333
|
+
gridColumn: 1,
|
|
334
|
+
display: 'flex',
|
|
335
|
+
alignItems: 'center',
|
|
336
|
+
fontSize: 'var(--jp-ui-font-size1)',
|
|
337
|
+
color: 'var(--jp-ui-font-color2)',
|
|
338
|
+
paddingLeft: 4,
|
|
339
|
+
} }, "(const)"));
|
|
340
|
+
}
|
|
341
|
+
if (fieldCount === 1) {
|
|
342
|
+
const selectedField = (_a = fields[0]) !== null && _a !== void 0 ? _a : '';
|
|
343
|
+
return (React.createElement("div", { style: { gridRow: 1, gridColumn: 1 } },
|
|
344
|
+
React.createElement(NativeSelect, { value: selectedField, onChange: e => onFieldChange(0, e.target.value) },
|
|
345
|
+
React.createElement(NativeSelectOption, { value: "" }, "(none)"),
|
|
346
|
+
availableFields.map(f => (React.createElement(NativeSelectOption, { key: f, value: f }, f))))));
|
|
347
|
+
}
|
|
348
|
+
// 'any' — multi-field chips + add
|
|
349
|
+
return (React.createElement("div", { style: {
|
|
350
|
+
gridRow: 1,
|
|
351
|
+
gridColumn: 1,
|
|
352
|
+
display: 'flex',
|
|
353
|
+
flexWrap: 'wrap',
|
|
354
|
+
gap: 2,
|
|
355
|
+
alignItems: 'center',
|
|
356
|
+
} },
|
|
357
|
+
fields.map((f, i) => (React.createElement("span", { key: i, className: "jp-gis-grammar-when-chip" },
|
|
358
|
+
f,
|
|
359
|
+
React.createElement(Button, { type: "button", className: "jp-gis-grammar-when-cancel", onClick: () => onFieldChange(i, ''), title: "Remove field" },
|
|
360
|
+
React.createElement(FontAwesomeIcon, { icon: faXmark }))))),
|
|
361
|
+
React.createElement("div", { style: { minWidth: 60, flex: '0 0 auto' } },
|
|
362
|
+
React.createElement(NativeSelect, { value: "", onChange: e => {
|
|
363
|
+
if (e.target.value) {
|
|
364
|
+
onAddField(e.target.value);
|
|
365
|
+
}
|
|
366
|
+
} },
|
|
367
|
+
React.createElement(NativeSelectOption, { value: "" }, "+field"),
|
|
368
|
+
availableFields
|
|
369
|
+
.filter(f => !fields.includes(f))
|
|
370
|
+
.map(f => (React.createElement(NativeSelectOption, { key: f, value: f }, f)))))));
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* How many input fields a scale accepts.
|
|
374
|
+
* 0 — constants (no field selector shown)
|
|
375
|
+
* 1 — all single-field scales
|
|
376
|
+
* 'any' — multi-field (expression scale, sub-channel assembly)
|
|
377
|
+
*/
|
|
378
|
+
export function fieldCountForScale(scheme) {
|
|
379
|
+
switch (scheme) {
|
|
380
|
+
case 'constant_rgba':
|
|
381
|
+
case 'constant_num':
|
|
382
|
+
return 0;
|
|
383
|
+
case 'expression':
|
|
384
|
+
return 'any';
|
|
385
|
+
default:
|
|
386
|
+
return 1;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
// ---------------------------------------------------------------------------
|
|
390
|
+
// MappingRow
|
|
391
|
+
// ---------------------------------------------------------------------------
|
|
392
|
+
const MappingRow = ({ row, availableFields, featureValues, isRaster = false, onChange, onDelete, }) => {
|
|
393
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
394
|
+
const [expanded, setExpanded] = useState(false);
|
|
395
|
+
const [addingWhen, setAddingWhen] = useState(false);
|
|
396
|
+
const handleFieldChange = useCallback((index, value) => {
|
|
397
|
+
var _a;
|
|
398
|
+
const next = [...((_a = row.fields) !== null && _a !== void 0 ? _a : [])];
|
|
399
|
+
if (value) {
|
|
400
|
+
next[index] = value;
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
next.splice(index, 1);
|
|
404
|
+
}
|
|
405
|
+
onChange(Object.assign(Object.assign({}, row), { fields: next.length > 0 ? next : undefined }));
|
|
406
|
+
}, [row, onChange]);
|
|
407
|
+
const addField = useCallback((value) => {
|
|
408
|
+
var _a;
|
|
409
|
+
if (!value) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
onChange(Object.assign(Object.assign({}, row), { fields: [...((_a = row.fields) !== null && _a !== void 0 ? _a : []), value] }));
|
|
413
|
+
}, [row, onChange]);
|
|
414
|
+
const handleSchemeChange = useCallback((scheme) => {
|
|
415
|
+
var _a;
|
|
416
|
+
const newScale = defaultScaleForScheme(scheme, row.channels);
|
|
417
|
+
const compat = compatibleChannels(newScale, isRaster);
|
|
418
|
+
const filtered = row.channels.filter(ch => compat.includes(ch));
|
|
419
|
+
const newFieldCount = fieldCountForScale(scheme);
|
|
420
|
+
// Trim fields list to match new count constraint
|
|
421
|
+
const trimmedFields = newFieldCount === 0
|
|
422
|
+
? undefined
|
|
423
|
+
: newFieldCount === 1
|
|
424
|
+
? (_a = row.fields) === null || _a === void 0 ? void 0 : _a.slice(0, 1)
|
|
425
|
+
: row.fields;
|
|
426
|
+
onChange(Object.assign(Object.assign({}, row), { scale: newScale, channels: filtered.length > 0 ? filtered : [compat[0]], fields: trimmedFields }));
|
|
427
|
+
}, [row, onChange]);
|
|
428
|
+
const handleScaleChange = useCallback((scale) => onChange(Object.assign(Object.assign({}, row), { scale })), [row, onChange]);
|
|
429
|
+
const handleChannelChange = useCallback((index, ch) => {
|
|
430
|
+
const next = [...row.channels];
|
|
431
|
+
next[index] = ch;
|
|
432
|
+
onChange(Object.assign(Object.assign({}, row), { channels: next }));
|
|
433
|
+
}, [row, onChange]);
|
|
434
|
+
const removeChannel = useCallback((ch) => {
|
|
435
|
+
const next = row.channels.filter(c => c !== ch);
|
|
436
|
+
if (next.length > 0) {
|
|
437
|
+
onChange(Object.assign(Object.assign({}, row), { channels: next }));
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
onDelete();
|
|
441
|
+
}
|
|
442
|
+
}, [row, onChange, onDelete]);
|
|
443
|
+
const addChannel = useCallback((ch) => {
|
|
444
|
+
onChange(Object.assign(Object.assign({}, row), { channels: [...row.channels, ch] }));
|
|
445
|
+
}, [row, onChange]);
|
|
446
|
+
const addPredicate = useCallback((pred) => {
|
|
447
|
+
var _a;
|
|
448
|
+
onChange(Object.assign(Object.assign({}, row), { when: [...((_a = row.when) !== null && _a !== void 0 ? _a : []), pred] }));
|
|
449
|
+
setAddingWhen(false);
|
|
450
|
+
}, [row, onChange]);
|
|
451
|
+
const removePredicate = useCallback((index) => {
|
|
452
|
+
var _a;
|
|
453
|
+
const next = ((_a = row.when) !== null && _a !== void 0 ? _a : []).filter((_, i) => i !== index);
|
|
454
|
+
onChange(Object.assign(Object.assign({}, row), { when: next.length > 0 ? next : undefined }));
|
|
455
|
+
}, [row, onChange]);
|
|
456
|
+
const compat = compatibleChannels(row.scale, isRaster);
|
|
457
|
+
const availableToAdd = compat.filter(ch => !row.channels.includes(ch));
|
|
458
|
+
return (React.createElement("div", { className: "jp-gis-grammar-rule" },
|
|
459
|
+
React.createElement("div", { className: "jp-gis-grammar-rule-grid" },
|
|
460
|
+
React.createElement("div", { className: "jp-gis-grammar-section jp-gis-grammar-input-section" },
|
|
461
|
+
React.createElement(FieldSelector, { fieldCount: fieldCountForScale(row.scale.scheme), fields: (_a = row.fields) !== null && _a !== void 0 ? _a : [], availableFields: availableFields, onFieldChange: handleFieldChange, onAddField: addField })),
|
|
462
|
+
React.createElement("span", { className: "jp-gis-grammar-arrow jp-gis-grammar-arrow-input" }, "\u2192"),
|
|
463
|
+
React.createElement("div", { className: "jp-gis-grammar-section jp-gis-grammar-scale-section" },
|
|
464
|
+
React.createElement(NativeSelect, { value: row.scale.scheme, onChange: e => handleSchemeChange(e.target.value) }, SCHEME_OPTIONS.filter(({ disabled }) => !disabled).map(({ value, label }) => (React.createElement(NativeSelectOption, { key: value, value: value }, label)))),
|
|
465
|
+
React.createElement("button", { type: "button", className: "jp-gis-grammar-preview-btn", onClick: () => setExpanded(v => !v), title: expanded ? 'Collapse editor' : 'Edit scale' },
|
|
466
|
+
React.createElement(ScalePreview, { scale: row.scale }),
|
|
467
|
+
React.createElement("span", { className: "jp-gis-grammar-preview-chevron", "aria-hidden": "true" }, expanded ? '▾' : '▸'))),
|
|
468
|
+
React.createElement("span", { className: "jp-gis-grammar-arrow jp-gis-grammar-arrow-output" }, "\u2192"),
|
|
469
|
+
React.createElement("div", { className: "jp-gis-grammar-section jp-gis-grammar-output-section" },
|
|
470
|
+
row.channels.map((ch, i) => (React.createElement("div", { key: `${ch}-${i}`, className: "jp-gis-grammar-channel-row" },
|
|
471
|
+
React.createElement("div", { className: "jp-gis-grammar-channel-select" },
|
|
472
|
+
React.createElement(NativeSelect, { value: ch, onChange: e => handleChannelChange(i, e.target.value) }, compat.map(c => {
|
|
473
|
+
var _a;
|
|
474
|
+
return (React.createElement(NativeSelectOption, { key: c, value: c }, (_a = CHANNEL_LABELS[c]) !== null && _a !== void 0 ? _a : c));
|
|
475
|
+
}))),
|
|
476
|
+
React.createElement(Button, { type: "button", variant: "ghost", size: "icon-md", className: "jp-mod-styled", onClick: () => removeChannel(ch), title: row.channels.length === 1
|
|
477
|
+
? 'Remove mapping'
|
|
478
|
+
: 'Remove channel' },
|
|
479
|
+
React.createElement(FontAwesomeIcon, { icon: faTrash }))))),
|
|
480
|
+
availableToAdd.length > 0 && (React.createElement("div", { className: "jp-gis-grammar-channel-row" },
|
|
481
|
+
React.createElement("div", { className: "jp-gis-grammar-channel-select" },
|
|
482
|
+
React.createElement(NativeSelect, { value: "", onChange: e => {
|
|
483
|
+
if (e.target.value) {
|
|
484
|
+
addChannel(e.target.value);
|
|
485
|
+
}
|
|
486
|
+
} },
|
|
487
|
+
React.createElement(NativeSelectOption, { value: "" }, "(add channel)"),
|
|
488
|
+
availableToAdd.map(ch => {
|
|
489
|
+
var _a;
|
|
490
|
+
return (React.createElement(NativeSelectOption, { key: ch, value: ch }, (_a = CHANNEL_LABELS[ch]) !== null && _a !== void 0 ? _a : ch));
|
|
491
|
+
}))))))),
|
|
492
|
+
React.createElement("div", { className: "jp-gis-grammar-when-row" },
|
|
493
|
+
React.createElement("span", { className: "jp-gis-grammar-when-label" }, "when"),
|
|
494
|
+
((_c = (_b = row.when) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 1 && (React.createElement(Button, { type: "button", className: "jp-gis-grammar-when-op", onClick: () => {
|
|
495
|
+
var _a;
|
|
496
|
+
return onChange(Object.assign(Object.assign({}, row), { whenOp: ((_a = row.whenOp) !== null && _a !== void 0 ? _a : 'all') === 'all' ? 'any' : 'all' }));
|
|
497
|
+
} }, (_d = row.whenOp) !== null && _d !== void 0 ? _d : 'all')), (_e = row.when) === null || _e === void 0 ? void 0 :
|
|
498
|
+
_e.map((pred, i) => (React.createElement("span", { key: i, className: "jp-gis-grammar-when-chip" },
|
|
499
|
+
formatPredicate(pred),
|
|
500
|
+
React.createElement(Button, { type: "button", onClick: () => removePredicate(i), title: "Remove condition" },
|
|
501
|
+
React.createElement(FontAwesomeIcon, { icon: faXmark }))))),
|
|
502
|
+
addingWhen ? (React.createElement(WhenAddForm, { availableFields: availableFields, onAdd: addPredicate, onCancel: () => setAddingWhen(false) })) : (React.createElement(Button, { type: "button", className: "jp-gis-grammar-when-add-btn", onClick: () => setAddingWhen(true) },
|
|
503
|
+
React.createElement(FontAwesomeIcon, { icon: faPlus })))),
|
|
504
|
+
expanded && (React.createElement("div", { className: "jp-gis-grammar-rule-editor" },
|
|
505
|
+
(row.scale.scheme === 'constant_rgba' ||
|
|
506
|
+
row.scale.scheme === 'constant_num') && (React.createElement(ConstantEditor, { scale: row.scale, onChange: handleScaleChange })),
|
|
507
|
+
row.scale.scheme === 'colorRamp' && (React.createElement(ColorRampEditor, { scale: row.scale, field: (_f = row.fields) === null || _f === void 0 ? void 0 : _f[0], featureValues: featureValues, onChange: handleScaleChange })),
|
|
508
|
+
row.scale.scheme === 'categorical' && (React.createElement(CategoricalEditor, { scale: row.scale, field: (_g = row.fields) === null || _g === void 0 ? void 0 : _g[0], featureValues: featureValues, onChange: handleScaleChange })),
|
|
509
|
+
row.scale.scheme === 'scalar' && (React.createElement(ScalarEditor, { scale: row.scale, field: (_h = row.fields) === null || _h === void 0 ? void 0 : _h[0], featureValues: featureValues, onChange: handleScaleChange })),
|
|
510
|
+
(row.scale.scheme === 'identity' ||
|
|
511
|
+
row.scale.scheme === 'expression') && (React.createElement("p", { style: {
|
|
512
|
+
margin: 0,
|
|
513
|
+
color: 'var(--jp-ui-font-color2)',
|
|
514
|
+
fontSize: 'var(--jp-ui-font-size1)',
|
|
515
|
+
} },
|
|
516
|
+
"No configuration for ",
|
|
517
|
+
row.scale.scheme,
|
|
518
|
+
" scale."))))));
|
|
519
|
+
};
|
|
520
|
+
export default MappingRow;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A numeric text input that accepts scientific notation (e.g. 1e-5, 3.2e+10).
|
|
3
|
+
*
|
|
4
|
+
* Uses type="text" internally so the browser never rejects or silently rounds
|
|
5
|
+
* values. The parsed number is committed to the parent only on blur; while the
|
|
6
|
+
* user is typing the raw string is kept in local state.
|
|
7
|
+
*
|
|
8
|
+
* Invalid strings (non-finite after parsing) are highlighted and the field
|
|
9
|
+
* resets to the last valid value on blur.
|
|
10
|
+
*/
|
|
11
|
+
import React from 'react';
|
|
12
|
+
interface INumericInputProps {
|
|
13
|
+
value: number;
|
|
14
|
+
onChange: (v: number) => void;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
}
|
|
19
|
+
export declare const NumericInput: React.FC<INumericInputProps>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A numeric text input that accepts scientific notation (e.g. 1e-5, 3.2e+10).
|
|
3
|
+
*
|
|
4
|
+
* Uses type="text" internally so the browser never rejects or silently rounds
|
|
5
|
+
* values. The parsed number is committed to the parent only on blur; while the
|
|
6
|
+
* user is typing the raw string is kept in local state.
|
|
7
|
+
*
|
|
8
|
+
* Invalid strings (non-finite after parsing) are highlighted and the field
|
|
9
|
+
* resets to the last valid value on blur.
|
|
10
|
+
*/
|
|
11
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
12
|
+
import { Input } from "../../../../shared/components/Input";
|
|
13
|
+
export const NumericInput = ({ value, onChange, placeholder, className, style, }) => {
|
|
14
|
+
const [raw, setRaw] = useState(() => String(value));
|
|
15
|
+
const focused = useRef(false);
|
|
16
|
+
// Sync from parent when the field is not being edited and the value differs.
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!focused.current && Number(raw) !== value) {
|
|
19
|
+
setRaw(String(value));
|
|
20
|
+
}
|
|
21
|
+
}, [value]); // intentionally excludes `raw` to avoid clobbering user input
|
|
22
|
+
const commit = () => {
|
|
23
|
+
focused.current = false;
|
|
24
|
+
const trimmed = raw.trim();
|
|
25
|
+
if (trimmed === '' || trimmed === '-') {
|
|
26
|
+
// Incomplete entry — reset to last valid value.
|
|
27
|
+
setRaw(String(value));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const parsed = Number(trimmed);
|
|
31
|
+
if (Number.isFinite(parsed)) {
|
|
32
|
+
onChange(parsed);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
setRaw(String(value));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
// Highlight the field when the current string is clearly invalid.
|
|
39
|
+
const trimmed = raw.trim();
|
|
40
|
+
const isValid = trimmed === '' || trimmed === '-' || Number.isFinite(Number(trimmed));
|
|
41
|
+
return (React.createElement(Input, { className: className, style: style, type: "text", placeholder: placeholder, value: raw, "aria-invalid": !isValid, onChange: e => setRaw(e.target.value), onFocus: () => {
|
|
42
|
+
focused.current = true;
|
|
43
|
+
}, onBlur: commit }));
|
|
44
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline scale editor for one IMapping.
|
|
3
|
+
* Renders a different UI for each scale scheme.
|
|
4
|
+
*/
|
|
5
|
+
import { ICategoricalScale, IColorRampScale, IConstantNumScale, IConstantRGBAScale, IScale, IScalarScale } from '@jupytergis/schema';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
interface IConstantEditorProps {
|
|
8
|
+
scale: IConstantRGBAScale | IConstantNumScale;
|
|
9
|
+
onChange: (scale: IScale) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const ConstantEditor: React.FC<IConstantEditorProps>;
|
|
12
|
+
interface IColorRampEditorProps {
|
|
13
|
+
scale: IColorRampScale;
|
|
14
|
+
field: string | undefined;
|
|
15
|
+
featureValues: Record<string, Set<any>>;
|
|
16
|
+
onChange: (scale: IScale) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const ColorRampEditor: React.FC<IColorRampEditorProps>;
|
|
19
|
+
interface ICategoricalEditorProps {
|
|
20
|
+
scale: ICategoricalScale;
|
|
21
|
+
field: string | undefined;
|
|
22
|
+
featureValues: Record<string, Set<any>>;
|
|
23
|
+
onChange: (scale: IScale) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const CategoricalEditor: React.FC<ICategoricalEditorProps>;
|
|
26
|
+
interface IScalarEditorProps {
|
|
27
|
+
scale: IScalarScale;
|
|
28
|
+
field: string | undefined;
|
|
29
|
+
featureValues: Record<string, Set<any>>;
|
|
30
|
+
onChange: (scale: IScale) => void;
|
|
31
|
+
}
|
|
32
|
+
export declare const ScalarEditor: React.FC<IScalarEditorProps>;
|
|
33
|
+
export {};
|