@jupytergis/base 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/lib/annotations/components/Annotation.d.ts +2 -2
  2. package/lib/annotations/components/Annotation.js +3 -3
  3. package/lib/annotations/components/AnnotationFloater.d.ts +1 -1
  4. package/lib/annotations/components/AnnotationFloater.js +2 -2
  5. package/lib/annotations/components/Message.d.ts +2 -1
  6. package/lib/annotations/components/Message.js +3 -3
  7. package/lib/annotations/model.js +5 -5
  8. package/lib/commands/BaseCommandIDs.d.ts +32 -0
  9. package/lib/commands/BaseCommandIDs.js +43 -0
  10. package/lib/{commands.d.ts → commands/index.d.ts} +1 -1
  11. package/lib/{commands.js → commands/index.js} +59 -99
  12. package/lib/console/consoleview.d.ts +3 -3
  13. package/lib/console/consoleview.js +5 -5
  14. package/lib/constants.d.ts +2 -36
  15. package/lib/constants.js +5 -47
  16. package/lib/dialogs/ProcessingFormDialog.d.ts +4 -4
  17. package/lib/dialogs/ProcessingFormDialog.js +9 -11
  18. package/lib/dialogs/layerBrowserDialog.d.ts +1 -1
  19. package/lib/dialogs/layerBrowserDialog.js +7 -7
  20. package/lib/dialogs/layerCreationFormDialog.d.ts +4 -4
  21. package/lib/dialogs/layerCreationFormDialog.js +6 -6
  22. package/lib/dialogs/symbology/components/color_ramp/CanvasSelectComponent.d.ts +1 -1
  23. package/lib/dialogs/symbology/components/color_ramp/CanvasSelectComponent.js +3 -3
  24. package/lib/dialogs/symbology/components/color_ramp/ColorRamp.d.ts +3 -2
  25. package/lib/dialogs/symbology/components/color_ramp/ColorRamp.js +6 -7
  26. package/lib/dialogs/symbology/components/color_ramp/ColorRampEntry.d.ts +1 -1
  27. package/lib/dialogs/symbology/components/color_ramp/ColorRampEntry.js +1 -1
  28. package/lib/dialogs/symbology/components/color_ramp/ModeSelectRow.d.ts +1 -1
  29. package/lib/dialogs/symbology/components/color_ramp/ModeSelectRow.js +1 -1
  30. package/lib/dialogs/symbology/components/color_stops/StopContainer.d.ts +2 -2
  31. package/lib/dialogs/symbology/components/color_stops/StopContainer.js +4 -4
  32. package/lib/dialogs/symbology/components/color_stops/StopRow.d.ts +3 -3
  33. package/lib/dialogs/symbology/components/color_stops/StopRow.js +2 -2
  34. package/lib/dialogs/symbology/hooks/useGetBandInfo.js +5 -5
  35. package/lib/dialogs/symbology/hooks/useGetProperties.d.ts +1 -1
  36. package/lib/dialogs/symbology/hooks/useGetProperties.js +4 -4
  37. package/lib/dialogs/symbology/symbologyDialog.d.ts +8 -0
  38. package/lib/dialogs/symbology/symbologyDialog.js +1 -1
  39. package/lib/dialogs/symbology/symbologyUtils.js +38 -31
  40. package/lib/dialogs/symbology/tiff_layer/TiffRendering.d.ts +2 -2
  41. package/lib/dialogs/symbology/tiff_layer/TiffRendering.js +2 -2
  42. package/lib/dialogs/symbology/tiff_layer/components/BandRow.d.ts +2 -2
  43. package/lib/dialogs/symbology/tiff_layer/components/BandRow.js +4 -4
  44. package/lib/dialogs/symbology/tiff_layer/types/MultibandColor.d.ts +2 -2
  45. package/lib/dialogs/symbology/tiff_layer/types/MultibandColor.js +30 -20
  46. package/lib/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.d.ts +2 -2
  47. package/lib/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.js +23 -21
  48. package/lib/dialogs/symbology/vector_layer/VectorRendering.d.ts +2 -2
  49. package/lib/dialogs/symbology/vector_layer/VectorRendering.js +81 -39
  50. package/lib/dialogs/symbology/vector_layer/components/ValueSelect.d.ts +1 -1
  51. package/lib/dialogs/symbology/vector_layer/components/ValueSelect.js +1 -1
  52. package/lib/dialogs/symbology/vector_layer/types/Canonical.d.ts +4 -0
  53. package/lib/dialogs/symbology/vector_layer/types/Canonical.js +66 -0
  54. package/lib/dialogs/symbology/vector_layer/types/Categorized.d.ts +2 -2
  55. package/lib/dialogs/symbology/vector_layer/types/Categorized.js +142 -47
  56. package/lib/dialogs/symbology/vector_layer/types/Graduated.d.ts +2 -2
  57. package/lib/dialogs/symbology/vector_layer/types/Graduated.js +193 -99
  58. package/lib/dialogs/symbology/vector_layer/types/Heatmap.d.ts +2 -2
  59. package/lib/dialogs/symbology/vector_layer/types/Heatmap.js +7 -6
  60. package/lib/dialogs/symbology/vector_layer/types/SimpleSymbol.d.ts +2 -2
  61. package/lib/dialogs/symbology/vector_layer/types/SimpleSymbol.js +33 -30
  62. package/lib/formbuilder/creationform.js +3 -3
  63. package/lib/formbuilder/editform.js +3 -3
  64. package/lib/formbuilder/formselectors.d.ts +1 -1
  65. package/lib/formbuilder/formselectors.js +2 -2
  66. package/lib/formbuilder/objectform/baseform.d.ts +5 -4
  67. package/lib/formbuilder/objectform/baseform.js +16 -14
  68. package/lib/formbuilder/objectform/fileselectorwidget.d.ts +1 -1
  69. package/lib/formbuilder/objectform/fileselectorwidget.js +5 -5
  70. package/lib/formbuilder/objectform/layer/heatmapLayerForm.js +2 -2
  71. package/lib/formbuilder/objectform/layer/hillshadeLayerForm.js +1 -1
  72. package/lib/formbuilder/objectform/layer/layerform.d.ts +1 -1
  73. package/lib/formbuilder/objectform/layer/layerform.js +3 -2
  74. package/lib/formbuilder/objectform/process/dissolveProcessForm.d.ts +1 -1
  75. package/lib/formbuilder/objectform/process/dissolveProcessForm.js +5 -5
  76. package/lib/formbuilder/objectform/source/geojsonsource.js +4 -4
  77. package/lib/formbuilder/objectform/source/geotiffsource.js +4 -4
  78. package/lib/formbuilder/objectform/source/pathbasedsource.js +6 -6
  79. package/lib/formbuilder/objectform/source/sourceform.d.ts +1 -1
  80. package/lib/formbuilder/objectform/source/sourceform.js +1 -1
  81. package/lib/formbuilder/objectform/source/tilesourceform.js +3 -3
  82. package/lib/gdal.js +2 -2
  83. package/lib/icons.js +29 -29
  84. package/lib/index.d.ts +4 -3
  85. package/lib/index.js +4 -3
  86. package/lib/mainview/CollaboratorPointers.d.ts +1 -1
  87. package/lib/mainview/CollaboratorPointers.js +5 -5
  88. package/lib/mainview/FollowIndicator.d.ts +2 -2
  89. package/lib/mainview/FollowIndicator.js +3 -3
  90. package/lib/mainview/TemporalSlider.d.ts +1 -1
  91. package/lib/mainview/TemporalSlider.js +7 -7
  92. package/lib/mainview/mainView.d.ts +4 -2
  93. package/lib/mainview/mainView.js +232 -137
  94. package/lib/menus.d.ts +1 -1
  95. package/lib/menus.js +7 -7
  96. package/lib/panelview/annotationPanel.d.ts +2 -2
  97. package/lib/panelview/annotationPanel.js +1 -1
  98. package/lib/panelview/components/filter-panel/Filter.d.ts +2 -2
  99. package/lib/panelview/components/filter-panel/Filter.js +5 -5
  100. package/lib/panelview/components/filter-panel/FilterRow.d.ts +2 -2
  101. package/lib/panelview/components/identify-panel/IdentifyPanel.d.ts +1 -1
  102. package/lib/panelview/components/identify-panel/IdentifyPanel.js +5 -5
  103. package/lib/panelview/components/layers.d.ts +1 -1
  104. package/lib/panelview/components/layers.js +12 -12
  105. package/lib/panelview/leftpanel.d.ts +4 -2
  106. package/lib/panelview/leftpanel.js +24 -6
  107. package/lib/panelview/model.d.ts +1 -1
  108. package/lib/panelview/objectproperties.d.ts +1 -1
  109. package/lib/panelview/objectproperties.js +3 -3
  110. package/lib/panelview/rightpanel.d.ts +2 -1
  111. package/lib/panelview/rightpanel.js +13 -5
  112. package/lib/{processing.d.ts → processing/index.d.ts} +4 -4
  113. package/lib/{processing.js → processing/index.js} +19 -24
  114. package/lib/processing/processingCommands.d.ts +6 -0
  115. package/lib/processing/processingCommands.js +47 -0
  116. package/lib/processing/processingFormToParam.d.ts +2 -0
  117. package/lib/processing/processingFormToParam.js +15 -0
  118. package/lib/shared/components/Badge.d.ts +7 -0
  119. package/lib/shared/components/Badge.js +19 -0
  120. package/lib/shared/components/Button.d.ts +9 -0
  121. package/lib/shared/components/Button.js +20 -0
  122. package/lib/shared/components/Calendar.d.ts +47 -0
  123. package/lib/shared/components/Calendar.js +184 -0
  124. package/lib/shared/components/Checkbox.d.ts +4 -0
  125. package/lib/shared/components/Checkbox.js +25 -0
  126. package/lib/shared/components/DropdownMenu.d.ts +27 -0
  127. package/lib/shared/components/DropdownMenu.js +92 -0
  128. package/lib/shared/components/Pagination.d.ts +25 -0
  129. package/lib/shared/components/Pagination.js +68 -0
  130. package/lib/shared/components/Popover.d.ts +7 -0
  131. package/lib/shared/components/Popover.js +32 -0
  132. package/lib/shared/components/Tabs.d.ts +7 -0
  133. package/lib/shared/components/Tabs.js +31 -0
  134. package/lib/shared/components/ToggleGroup.d.ts +12 -0
  135. package/lib/shared/components/ToggleGroup.js +52 -0
  136. package/lib/shared/components/loading.d.ts +12 -0
  137. package/lib/shared/components/loading.js +6 -0
  138. package/lib/shared/components/utils.d.ts +2 -0
  139. package/lib/shared/components/utils.js +4 -0
  140. package/lib/shared/hooks/useIsFirstRender.d.ts +2 -0
  141. package/lib/shared/hooks/useIsFirstRender.js +10 -0
  142. package/lib/stacBrowser/StacBrowser.d.ts +7 -0
  143. package/lib/stacBrowser/StacBrowser.js +16 -0
  144. package/lib/stacBrowser/StacPanel.d.ts +14 -0
  145. package/lib/stacBrowser/StacPanel.js +16 -0
  146. package/lib/stacBrowser/components/StacFilterSection.d.ts +23 -0
  147. package/lib/stacBrowser/components/StacFilterSection.js +49 -0
  148. package/lib/stacBrowser/components/StacPanelFilters.d.ts +14 -0
  149. package/lib/stacBrowser/components/StacPanelFilters.js +65 -0
  150. package/lib/stacBrowser/components/StacPanelResults.d.ts +13 -0
  151. package/lib/stacBrowser/components/StacPanelResults.js +48 -0
  152. package/lib/stacBrowser/components/StacPanelView.d.ts +7 -0
  153. package/lib/stacBrowser/components/StacPanelView.js +20 -0
  154. package/lib/stacBrowser/constants.d.ts +25 -0
  155. package/lib/stacBrowser/constants.js +197 -0
  156. package/lib/stacBrowser/hooks/useStacSearch.d.ts +30 -0
  157. package/lib/stacBrowser/hooks/useStacSearch.js +221 -0
  158. package/lib/stacBrowser/index.d.ts +1 -0
  159. package/lib/stacBrowser/index.js +1 -0
  160. package/lib/stacBrowser/types/types.d.ts +124 -0
  161. package/lib/stacBrowser/types/types.js +1 -0
  162. package/lib/statusbar/StatusBar.d.ts +1 -1
  163. package/lib/statusbar/StatusBar.js +3 -3
  164. package/lib/toolbar/index.d.ts +0 -1
  165. package/lib/toolbar/index.js +0 -1
  166. package/lib/toolbar/widget.js +15 -15
  167. package/lib/tools.d.ts +29 -4
  168. package/lib/tools.js +74 -69
  169. package/lib/types.d.ts +2 -0
  170. package/lib/widget.d.ts +1 -1
  171. package/lib/widget.js +5 -5
  172. package/package.json +22 -8
  173. package/style/base.css +26 -0
  174. package/style/layerBrowser.css +10 -0
  175. package/style/shared/badge.css +61 -0
  176. package/style/shared/button.css +164 -0
  177. package/style/shared/calendar.css +274 -0
  178. package/style/shared/checkbox.css +28 -0
  179. package/style/shared/dropdownMenu.css +240 -0
  180. package/style/shared/pagination.css +167 -0
  181. package/style/shared/popover.css +53 -0
  182. package/style/shared/tabs.css +57 -0
  183. package/style/shared/toggle.css +85 -0
  184. package/style/stacBrowser.css +74 -0
  185. package/style/symbologyDialog.css +0 -7
  186. package/lib/mainview/spinner.d.ts +0 -6
  187. package/lib/mainview/spinner.js +0 -5
  188. package/lib/toolbar/usertoolbaritem.d.ts +0 -19
  189. package/lib/toolbar/usertoolbaritem.js +0 -59
@@ -12,36 +12,43 @@ export var VectorUtils;
12
12
  if (typeof color === 'string') {
13
13
  return [];
14
14
  }
15
- const prefix = layer.parameters.type === 'circle' ? 'circle-' : '';
16
- if (!color[`${prefix}fill-color`]) {
17
- return [];
18
- }
15
+ const keys = ['fill-color', 'circle-fill-color'];
19
16
  const valueColorPairs = [];
20
- // So if it's not a string then it's an array and we parse
21
- // Color[0] is the operator used for the color expression
22
- switch (color[`${prefix}fill-color`][0]) {
23
- case 'interpolate':
24
- // First element is interpolate for linear selection
25
- // Second element is type of interpolation (ie linear)
26
- // Third is input value that stop values are compared with
27
- // Fourth and on is value:color pairs
28
- for (let i = 3; i < color[`${prefix}fill-color`].length; i += 2) {
29
- const obj = {
30
- stop: color[`${prefix}fill-color`][i],
31
- output: color[`${prefix}fill-color`][i + 1]
32
- };
33
- valueColorPairs.push(obj);
34
- }
35
- break;
36
- case 'case':
37
- for (let i = 1; i < color[`${prefix}fill-color`].length - 1; i += 2) {
38
- const obj = {
39
- stop: color[`${prefix}fill-color`][i][2],
40
- output: color[`${prefix}fill-color`][i + 1]
41
- };
42
- valueColorPairs.push(obj);
43
- }
44
- break;
17
+ const seenPairs = new Set();
18
+ for (const key of keys) {
19
+ if (!color[key]) {
20
+ continue;
21
+ }
22
+ switch (color[key][0]) {
23
+ case 'interpolate':
24
+ // First element is interpolate for linear selection
25
+ // Second element is type of interpolation (ie linear)
26
+ // Third is input value that stop values are compared with
27
+ // Fourth and on is value:color pairs
28
+ for (let i = 3; i < color[key].length; i += 2) {
29
+ const pairKey = `${color[key][i]}-${color[key][i + 1]}`;
30
+ if (!seenPairs.has(pairKey)) {
31
+ valueColorPairs.push({
32
+ stop: color[key][i],
33
+ output: color[key][i + 1],
34
+ });
35
+ seenPairs.add(pairKey);
36
+ }
37
+ }
38
+ break;
39
+ case 'case':
40
+ for (let i = 1; i < color[key].length - 1; i += 2) {
41
+ const pairKey = `${color[key][i][2]}-${color[key][i + 1]}`;
42
+ if (!seenPairs.has(pairKey)) {
43
+ valueColorPairs.push({
44
+ stop: color[key][i][2],
45
+ output: color[key][i + 1],
46
+ });
47
+ seenPairs.add(pairKey);
48
+ }
49
+ }
50
+ break;
51
+ }
45
52
  }
46
53
  return valueColorPairs;
47
54
  };
@@ -59,7 +66,7 @@ export var VectorUtils;
59
66
  for (let i = 3; i < color['circle-radius'].length; i += 2) {
60
67
  const obj = {
61
68
  stop: color['circle-radius'][i],
62
- output: color['circle-radius'][i + 1]
69
+ output: color['circle-radius'][i + 1],
63
70
  };
64
71
  stopOutputPairs.push(obj);
65
72
  }
@@ -72,7 +79,7 @@ export var Utils;
72
79
  let colorMap = colormap({
73
80
  colormap: selectedRamp,
74
81
  nshades: nClasses > 9 ? nClasses : 9,
75
- format: 'rgba'
82
+ format: 'rgba',
76
83
  });
77
84
  const valueColorPairs = [];
78
85
  // colormap requires 9 classes to generate the ramp
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { ISymbologyDialogProps } from '../symbologyDialog';
3
- declare const TiffRendering: ({ model, state, okSignalPromise, cancel, layerId }: ISymbologyDialogProps) => React.JSX.Element | undefined;
2
+ import { ISymbologyDialogProps } from "../symbologyDialog";
3
+ declare const TiffRendering: React.FC<ISymbologyDialogProps>;
4
4
  export default TiffRendering;
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import SingleBandPseudoColor from './types/SingleBandPseudoColor';
3
2
  import MultibandColor from './types/MultibandColor';
4
- const TiffRendering = ({ model, state, okSignalPromise, cancel, layerId }) => {
3
+ import SingleBandPseudoColor from './types/SingleBandPseudoColor';
4
+ const TiffRendering = ({ model, state, okSignalPromise, cancel, layerId, }) => {
5
5
  const renderTypes = ['Singleband Pseudocolor', 'Multiband Color'];
6
6
  const [selectedRenderType, setSelectedRenderType] = useState();
7
7
  const [componentToRender, setComponentToRender] = useState(null);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { IBandRow } from '../../hooks/useGetBandInfo';
2
+ import { IBandRow } from "../../hooks/useGetBandInfo";
3
3
  interface IBandRowProps {
4
4
  label: string;
5
5
  index: number;
@@ -19,5 +19,5 @@ interface IBandRowProps {
19
19
  * @param setBandRows Function to update band rows in parent
20
20
  * @param isMultibandColor Used to hide min/max input and add 'Unset' option to drop down menu for MultiBand symbology
21
21
  */
22
- declare const BandRow: ({ label, index, bandRow, bandRows, setSelectedBand, setBandRows, isMultibandColor }: IBandRowProps) => React.JSX.Element;
22
+ declare const BandRow: React.FC<IBandRowProps>;
23
23
  export default BandRow;
@@ -9,7 +9,7 @@ import React, { useState } from 'react';
9
9
  * @param setBandRows Function to update band rows in parent
10
10
  * @param isMultibandColor Used to hide min/max input and add 'Unset' option to drop down menu for MultiBand symbology
11
11
  */
12
- const BandRow = ({ label, index, bandRow, bandRows, setSelectedBand, setBandRows, isMultibandColor }) => {
12
+ const BandRow = ({ label, index, bandRow, bandRows, setSelectedBand, setBandRows, isMultibandColor, }) => {
13
13
  const [minValue, setMinValue] = useState(bandRow === null || bandRow === void 0 ? void 0 : bandRow.stats.minimum);
14
14
  const [maxValue, setMaxValue] = useState(bandRow === null || bandRow === void 0 ? void 0 : bandRow.stats.maximum);
15
15
  const handleMinValueChange = (event) => {
@@ -36,12 +36,12 @@ const BandRow = ({ label, index, bandRow, bandRows, setSelectedBand, setBandRows
36
36
  bandRows.map((band, bandIndex) => (React.createElement("option", { key: bandIndex, value: band.band, selected: band.band === (bandRow === null || bandRow === void 0 ? void 0 : bandRow.band), className: "jp-mod-styled" }, band.colorInterpretation
37
37
  ? `Band ${band.band} (${band.colorInterpretation})`
38
38
  : `Band ${band.band}`))),
39
- isMultibandColor ? (React.createElement("option", { key: 'unset', value: 0, selected: !bandRow, className: "jp-mod-styled" }, "Unset")) : null))),
39
+ isMultibandColor ? (React.createElement("option", { key: 'unset', value: -1, selected: !bandRow, className: "jp-mod-styled" }, "Unset")) : null))),
40
40
  isMultibandColor ? null : (React.createElement("div", { className: "jp-gis-symbology-row", style: { gap: '0.5rem' } },
41
41
  React.createElement("div", { style: {
42
42
  display: 'flex',
43
43
  justifyContent: 'space-between',
44
- width: '50%'
44
+ width: '50%',
45
45
  } },
46
46
  React.createElement("label", { htmlFor: "band-min", style: { alignSelf: 'center' } }, "Min"),
47
47
  React.createElement("input", { type: "number", className: "jp-mod-styled", style: { marginRight: 15 }, value: minValue, onChange: handleMinValueChange })),
@@ -49,7 +49,7 @@ const BandRow = ({ label, index, bandRow, bandRows, setSelectedBand, setBandRows
49
49
  display: 'flex',
50
50
  justifyContent: 'space-between',
51
51
  width: '50%',
52
- paddingRight: '2px'
52
+ paddingRight: '2px',
53
53
  } },
54
54
  React.createElement("label", { htmlFor: "band-max", style: { alignSelf: 'center' } }, "Max"),
55
55
  React.createElement("input", { type: "number", className: "jp-mod-styled",
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { ISymbologyDialogProps } from '../../symbologyDialog';
3
- declare const MultibandColor: ({ model, okSignalPromise, cancel, layerId }: ISymbologyDialogProps) => React.JSX.Element | undefined;
2
+ import { ISymbologyDialogProps } from "../../symbologyDialog";
3
+ declare const MultibandColor: React.FC<ISymbologyDialogProps>;
4
4
  export default MultibandColor;
@@ -1,8 +1,8 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
- import { Spinner } from '../../../../mainview/spinner';
3
- import useGetBandInfo from '../../hooks/useGetBandInfo';
4
- import BandRow from '../components/BandRow';
5
- const MultibandColor = ({ model, okSignalPromise, cancel, layerId }) => {
2
+ import useGetBandInfo from "../../hooks/useGetBandInfo";
3
+ import BandRow from "../components/BandRow";
4
+ import { LoadingOverlay } from "../../../../shared/components/loading";
5
+ const MultibandColor = ({ model, okSignalPromise, cancel, layerId, }) => {
6
6
  if (!layerId) {
7
7
  return;
8
8
  }
@@ -14,13 +14,15 @@ const MultibandColor = ({ model, okSignalPromise, cancel, layerId }) => {
14
14
  const [selectedBands, setSelectedBands] = useState({
15
15
  red: 1,
16
16
  green: 2,
17
- blue: 3
17
+ blue: 3,
18
+ alpha: 4,
18
19
  });
19
20
  const numOfBandsRef = useRef(0);
20
21
  const selectedBandsRef = useRef({
21
22
  red: selectedBands.red,
22
23
  green: selectedBands.green,
23
- blue: selectedBands.blue
24
+ blue: selectedBands.blue,
25
+ alpha: selectedBands.alpha,
24
26
  });
25
27
  useEffect(() => {
26
28
  populateOptions();
@@ -40,12 +42,13 @@ const MultibandColor = ({ model, okSignalPromise, cancel, layerId }) => {
40
42
  selectedBandsRef.current = selectedBands;
41
43
  }, [selectedBands]);
42
44
  const populateOptions = async () => {
43
- var _a, _b, _c, _d, _e, _f;
45
+ var _a, _b, _c, _d, _e, _f, _g, _h;
44
46
  const layerParams = layer.parameters;
45
47
  const red = (_b = (_a = layerParams.symbologyState) === null || _a === void 0 ? void 0 : _a.redBand) !== null && _b !== void 0 ? _b : 1;
46
48
  const green = (_d = (_c = layerParams.symbologyState) === null || _c === void 0 ? void 0 : _c.greenBand) !== null && _d !== void 0 ? _d : 2;
47
49
  const blue = (_f = (_e = layerParams.symbologyState) === null || _e === void 0 ? void 0 : _e.blueBand) !== null && _f !== void 0 ? _f : 3;
48
- setSelectedBands({ red, green, blue });
50
+ const alpha = (_h = (_g = layerParams.symbologyState) === null || _g === void 0 ? void 0 : _g.alphaBand) !== null && _h !== void 0 ? _h : 4;
51
+ setSelectedBands({ red, green, blue, alpha });
49
52
  };
50
53
  const updateBand = (color, value) => {
51
54
  setSelectedBands(prevBands => (Object.assign(Object.assign({}, prevBands), { [color]: value })));
@@ -56,19 +59,24 @@ const MultibandColor = ({ model, okSignalPromise, cancel, layerId }) => {
56
59
  return;
57
60
  }
58
61
  const colorExpr = ['array'];
59
- const rgb = ['red', 'green', 'blue'];
60
- rgb.forEach(color => {
62
+ const colors = ['red', 'green', 'blue'];
63
+ colors.forEach(color => {
61
64
  const bandValue = selectedBandsRef.current[color];
62
65
  colorExpr.push(bandValue !== 0 ? ['band', bandValue] : 0);
63
66
  });
64
- // Array expression expects 4 values
65
- // Last band should be alpha band added by OpenLayers
66
- colorExpr.push(['band', numOfBandsRef.current + 1]);
67
+ // Push alpha if selected, else default to 0
68
+ if (selectedBandsRef.current.alpha) {
69
+ colorExpr.push(['band', selectedBandsRef.current.alpha]);
70
+ }
71
+ else {
72
+ colorExpr.push(['band', numOfBandsRef.current + 1]);
73
+ }
67
74
  const symbologyState = {
68
75
  renderType: 'Multiband Color',
69
- redBand: selectedBandsRef.current['red'],
70
- greenBand: selectedBandsRef.current['green'],
71
- blueBand: selectedBandsRef.current['blue']
76
+ redBand: selectedBandsRef.current.red,
77
+ greenBand: selectedBandsRef.current.green,
78
+ blueBand: selectedBandsRef.current.blue,
79
+ alphaBand: selectedBandsRef.current.alpha,
72
80
  };
73
81
  layer.parameters.symbologyState = symbologyState;
74
82
  layer.parameters.color = colorExpr;
@@ -77,9 +85,11 @@ const MultibandColor = ({ model, okSignalPromise, cancel, layerId }) => {
77
85
  cancel();
78
86
  };
79
87
  return (React.createElement("div", { className: "jp-gis-layer-symbology-container" },
80
- React.createElement("div", { className: "jp-gis-band-container" }, loading ? (React.createElement(Spinner, { loading: loading })) : (React.createElement(React.Fragment, null,
81
- React.createElement(BandRow, { label: "Red Band", index: selectedBands['red'] - 1, bandRow: bandRows[selectedBands['red'] - 1], bandRows: bandRows, setSelectedBand: val => updateBand('red', val), setBandRows: setBandRows, isMultibandColor: true }),
82
- React.createElement(BandRow, { label: "Green Band", index: selectedBands['green'] - 1, bandRow: bandRows[selectedBands['green'] - 1], bandRows: bandRows, setSelectedBand: val => updateBand('green', val), setBandRows: setBandRows, isMultibandColor: true }),
83
- React.createElement(BandRow, { label: "Blue Band", index: selectedBands['blue'] - 1, bandRow: bandRows[selectedBands['blue'] - 1], bandRows: bandRows, setSelectedBand: val => updateBand('blue', val), setBandRows: setBandRows, isMultibandColor: true }))))));
88
+ React.createElement("div", { className: "jp-gis-band-container" },
89
+ React.createElement(LoadingOverlay, { loading: loading }),
90
+ React.createElement(BandRow, { label: "Red Band", index: selectedBands.red - 1, bandRow: bandRows[selectedBands.red - 1], bandRows: bandRows, setSelectedBand: val => updateBand('red', val >= 0 ? val + 1 : 0), setBandRows: setBandRows, isMultibandColor: true }),
91
+ React.createElement(BandRow, { label: "Green Band", index: selectedBands.green - 1, bandRow: bandRows[selectedBands.green - 1], bandRows: bandRows, setSelectedBand: val => updateBand('green', val >= 0 ? val + 1 : 0), setBandRows: setBandRows, isMultibandColor: true }),
92
+ React.createElement(BandRow, { label: "Blue Band", index: selectedBands.blue - 1, bandRow: bandRows[selectedBands.blue - 1], bandRows: bandRows, setSelectedBand: val => updateBand('blue', val >= 0 ? val + 1 : 0), setBandRows: setBandRows, isMultibandColor: true }),
93
+ React.createElement(BandRow, { label: "Alpha Band", index: selectedBands.alpha - 1, bandRow: bandRows[selectedBands.alpha - 1], bandRows: bandRows, setSelectedBand: val => updateBand('alpha', val >= 0 ? val + 1 : 0), setBandRows: setBandRows, isMultibandColor: true }))));
84
94
  };
85
95
  export default MultibandColor;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ISymbologyDialogProps } from '../../symbologyDialog';
2
+ import { ISymbologyDialogProps } from "../../symbologyDialog";
3
3
  export type InterpolationType = 'discrete' | 'linear' | 'exact';
4
- declare const SingleBandPseudoColor: ({ model, okSignalPromise, cancel, layerId }: ISymbologyDialogProps) => React.JSX.Element | undefined;
4
+ declare const SingleBandPseudoColor: React.FC<ISymbologyDialogProps>;
5
5
  export default SingleBandPseudoColor;
@@ -1,14 +1,14 @@
1
1
  import { Button } from '@jupyterlab/ui-components';
2
2
  import React, { useEffect, useRef, useState } from 'react';
3
- import { Spinner } from '../../../../mainview/spinner';
4
- import { GlobalStateDbManager } from '../../../../store';
5
- import { GeoTiffClassifications } from '../../classificationModes';
6
- import ColorRamp from '../../components/color_ramp/ColorRamp';
7
- import StopRow from '../../components/color_stops/StopRow';
8
- import useGetBandInfo from '../../hooks/useGetBandInfo';
9
- import { Utils } from '../../symbologyUtils';
10
- import BandRow from '../components/BandRow';
11
- const SingleBandPseudoColor = ({ model, okSignalPromise, cancel, layerId }) => {
3
+ import { GeoTiffClassifications } from "../../classificationModes";
4
+ import ColorRamp from "../../components/color_ramp/ColorRamp";
5
+ import StopRow from "../../components/color_stops/StopRow";
6
+ import useGetBandInfo from "../../hooks/useGetBandInfo";
7
+ import { Utils } from "../../symbologyUtils";
8
+ import BandRow from "../components/BandRow";
9
+ import { LoadingOverlay } from "../../../../shared/components/loading";
10
+ import { GlobalStateDbManager } from "../../../../store";
11
+ const SingleBandPseudoColor = ({ model, okSignalPromise, cancel, layerId, }) => {
12
12
  if (!layerId) {
13
13
  return;
14
14
  }
@@ -86,7 +86,7 @@ const SingleBandPseudoColor = ({ model, okSignalPromise, cancel, layerId }) => {
86
86
  for (let i = 5; i < color.length; i += 2) {
87
87
  const obj = {
88
88
  stop: scaleValue(color[i], isQuantile),
89
- output: color[i + 1]
89
+ output: color[i + 1],
90
90
  };
91
91
  valueColorPairs.push(obj);
92
92
  }
@@ -103,7 +103,7 @@ const SingleBandPseudoColor = ({ model, okSignalPromise, cancel, layerId }) => {
103
103
  for (let i = 3; i < color.length - 1; i += 2) {
104
104
  const obj = {
105
105
  stop: scaleValue(color[i][2], isQuantile),
106
- output: color[i + 1]
106
+ output: color[i + 1],
107
107
  };
108
108
  valueColorPairs.push(obj);
109
109
  }
@@ -157,7 +157,7 @@ const SingleBandPseudoColor = ({ model, okSignalPromise, cancel, layerId }) => {
157
157
  colorExpr.push([
158
158
  '<=',
159
159
  ['band', selectedBand],
160
- unscaleValue(stop.stop, isQuantile)
160
+ unscaleValue(stop.stop, isQuantile),
161
161
  ]);
162
162
  colorExpr.push(stop.output);
163
163
  });
@@ -174,7 +174,7 @@ const SingleBandPseudoColor = ({ model, okSignalPromise, cancel, layerId }) => {
174
174
  colorExpr.push([
175
175
  '==',
176
176
  ['band', selectedBand],
177
- unscaleValue(stop.stop, isQuantile)
177
+ unscaleValue(stop.stop, isQuantile),
178
178
  ]);
179
179
  colorExpr.push(stop.output);
180
180
  });
@@ -189,7 +189,7 @@ const SingleBandPseudoColor = ({ model, okSignalPromise, cancel, layerId }) => {
189
189
  interpolation: selectedFunctionRef.current,
190
190
  colorRamp: (_f = colorRampOptionsRef.current) === null || _f === void 0 ? void 0 : _f.selectedRamp,
191
191
  nClasses: (_g = colorRampOptionsRef.current) === null || _g === void 0 ? void 0 : _g.numberOfShades,
192
- mode: (_h = colorRampOptionsRef.current) === null || _h === void 0 ? void 0 : _h.selectedMode
192
+ mode: (_h = colorRampOptionsRef.current) === null || _h === void 0 ? void 0 : _h.selectedMode,
193
193
  };
194
194
  layer.parameters.symbologyState = symbologyState;
195
195
  layer.parameters.color = colorExpr;
@@ -201,9 +201,9 @@ const SingleBandPseudoColor = ({ model, okSignalPromise, cancel, layerId }) => {
201
201
  setStopRows([
202
202
  {
203
203
  stop: 0,
204
- output: [0, 0, 0, 1]
204
+ output: [0, 0, 0, 1],
205
205
  },
206
- ...stopRows
206
+ ...stopRows,
207
207
  ]);
208
208
  };
209
209
  const deleteStopRow = (index) => {
@@ -217,7 +217,7 @@ const SingleBandPseudoColor = ({ model, okSignalPromise, cancel, layerId }) => {
217
217
  setColorRampOptions({
218
218
  selectedRamp,
219
219
  numberOfShades,
220
- selectedMode
220
+ selectedMode,
221
221
  });
222
222
  let stops = [];
223
223
  const currentBand = bandRows[selectedBand - 1];
@@ -259,16 +259,18 @@ const SingleBandPseudoColor = ({ model, okSignalPromise, cancel, layerId }) => {
259
259
  return (value * (1 - 0) - min * (1 - 0)) / (max - min);
260
260
  };
261
261
  return (React.createElement("div", { className: "jp-gis-layer-symbology-container" },
262
- React.createElement("div", { className: "jp-gis-band-container" }, loading ? (React.createElement(Spinner, { loading: loading })) : (React.createElement(BandRow, { label: "Band",
263
- // Band numbers are 1 indexed
264
- index: selectedBand - 1, bandRow: bandRows[selectedBand - 1], bandRows: bandRows, setSelectedBand: setSelectedBand, setBandRows: setBandRows }))),
262
+ React.createElement("div", { className: "jp-gis-band-container" },
263
+ React.createElement(LoadingOverlay, { loading: loading }),
264
+ React.createElement(BandRow, { label: "Band",
265
+ // Band numbers are 1 indexed
266
+ index: selectedBand - 1, bandRow: bandRows[selectedBand - 1], bandRows: bandRows, setSelectedBand: setSelectedBand, setBandRows: setBandRows })),
265
267
  React.createElement("div", { className: "jp-gis-symbology-row" },
266
268
  React.createElement("label", { htmlFor: "function-select" }, "Interpolation:"),
267
269
  React.createElement("div", { className: "jp-select-wrapper" },
268
270
  React.createElement("select", { name: "function-select", id: "function-select", className: "jp-mod-styled", value: selectedFunction, style: { textTransform: 'capitalize' }, onChange: event => {
269
271
  setSelectedFunction(event.target.value);
270
272
  } }, functions.map((func, funcIndex) => (React.createElement("option", { key: func, value: func, style: { textTransform: 'capitalize' } }, func)))))),
271
- bandRows.length > 0 && (React.createElement(ColorRamp, { layerParams: layer.parameters, modeOptions: modeOptions, classifyFunc: buildColorInfoFromClassification, showModeRow: true })),
273
+ bandRows.length > 0 && (React.createElement(ColorRamp, { layerParams: layer.parameters, modeOptions: modeOptions, classifyFunc: buildColorInfoFromClassification, showModeRow: true, showRampSelector: true })),
272
274
  React.createElement("div", { className: "jp-gis-stop-container" },
273
275
  React.createElement("div", { className: "jp-gis-stop-labels", style: { display: 'flex', gap: 6 } },
274
276
  React.createElement("span", { style: { flex: '0 0 18%' } },
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { ISymbologyDialogProps } from '../symbologyDialog';
3
- declare const VectorRendering: ({ model, state, okSignalPromise, cancel, layerId }: ISymbologyDialogProps) => React.JSX.Element | undefined;
2
+ import { ISymbologyDialogProps } from "../symbologyDialog";
3
+ declare const VectorRendering: React.FC<ISymbologyDialogProps>;
4
4
  export default VectorRendering;
@@ -1,15 +1,63 @@
1
1
  import React, { useEffect, useState } from 'react';
2
+ import { useGetProperties } from "../hooks/useGetProperties";
3
+ import { getColorCodeFeatureAttributes, getNumericFeatureAttributes, objectEntries, } from "../../../tools";
4
+ import Canonical from './types/Canonical';
2
5
  import Categorized from './types/Categorized';
3
6
  import Graduated from './types/Graduated';
4
7
  import Heatmap from './types/Heatmap';
5
8
  import SimpleSymbol from './types/SimpleSymbol';
6
- const VectorRendering = ({ model, state, okSignalPromise, cancel, layerId }) => {
7
- const [selectedRenderType, setSelectedRenderType] = useState('');
8
- const [componentToRender, setComponentToRender] = useState(null);
9
- const [renderTypeOptions, setRenderTypeOptions] = useState([
10
- 'Single Symbol'
9
+ const RENDER_TYPE_OPTIONS = {
10
+ 'Single Symbol': {
11
+ component: SimpleSymbol,
12
+ supportedLayerTypes: ['VectorLayer', 'VectorTileLayer', 'HeatmapLayer'],
13
+ isTabbed: true,
14
+ },
15
+ Canonical: {
16
+ component: Canonical,
17
+ attributeChecker: getColorCodeFeatureAttributes,
18
+ supportedLayerTypes: ['VectorLayer', 'HeatmapLayer'],
19
+ isTabbed: false,
20
+ },
21
+ Graduated: {
22
+ component: Graduated,
23
+ attributeChecker: getNumericFeatureAttributes,
24
+ supportedLayerTypes: ['VectorLayer', 'HeatmapLayer'],
25
+ isTabbed: true,
26
+ },
27
+ Categorized: {
28
+ component: Categorized,
29
+ attributeChecker: getNumericFeatureAttributes,
30
+ supportedLayerTypes: ['VectorLayer', 'HeatmapLayer'],
31
+ isTabbed: true,
32
+ },
33
+ Heatmap: {
34
+ component: Heatmap,
35
+ supportedLayerTypes: ['VectorLayer', 'HeatmapLayer'],
36
+ isTabbed: false,
37
+ },
38
+ };
39
+ const getSelectableRenderTypes = (featureProperties, layerType) => {
40
+ const entries = objectEntries(RENDER_TYPE_OPTIONS).map(([renderType, renderTypeProps]) => [
41
+ renderType,
42
+ Object.assign(Object.assign(Object.assign({}, renderTypeProps), (renderTypeProps.attributeChecker
43
+ ? {
44
+ selectableAttributesAndValues: renderTypeProps.attributeChecker(featureProperties),
45
+ }
46
+ : {})), { layerTypeSupported: renderTypeProps.supportedLayerTypes.includes(layerType) }),
11
47
  ]);
12
- let RenderComponent;
48
+ return Object.fromEntries(entries);
49
+ };
50
+ const useLayerRenderType = (layer, setSelectedRenderType) => useEffect(() => {
51
+ var _a, _b;
52
+ let renderType = (_b = (_a = layer.parameters) === null || _a === void 0 ? void 0 : _a.symbologyState) === null || _b === void 0 ? void 0 : _b.renderType;
53
+ if (!renderType) {
54
+ renderType = layer.type === 'HeatmapLayer' ? 'Heatmap' : 'Single Symbol';
55
+ }
56
+ setSelectedRenderType(renderType);
57
+ }, []);
58
+ const VectorRendering = ({ model, state, okSignalPromise, cancel, layerId, }) => {
59
+ const [selectedRenderType, setSelectedRenderType] = useState();
60
+ const [symbologyTab, setSymbologyTab] = useState('color');
13
61
  if (!layerId) {
14
62
  return;
15
63
  }
@@ -17,41 +65,35 @@ const VectorRendering = ({ model, state, okSignalPromise, cancel, layerId }) =>
17
65
  if (!(layer === null || layer === void 0 ? void 0 : layer.parameters)) {
18
66
  return;
19
67
  }
20
- useEffect(() => {
21
- var _a, _b;
22
- let renderType = (_b = (_a = layer.parameters) === null || _a === void 0 ? void 0 : _a.symbologyState) === null || _b === void 0 ? void 0 : _b.renderType;
23
- if (!renderType) {
24
- renderType = layer.type === 'HeatmapLayer' ? 'Heatmap' : 'Single Symbol';
25
- }
26
- setSelectedRenderType(renderType);
27
- const options = ['Single Symbol', 'Graduated', 'Categorized', 'Heatmap'];
28
- setRenderTypeOptions(options);
29
- }, []);
30
- useEffect(() => {
31
- switch (selectedRenderType) {
32
- case 'Single Symbol':
33
- RenderComponent = (React.createElement(SimpleSymbol, { model: model, state: state, okSignalPromise: okSignalPromise, cancel: cancel, layerId: layerId }));
34
- break;
35
- case 'Graduated':
36
- RenderComponent = (React.createElement(Graduated, { model: model, state: state, okSignalPromise: okSignalPromise, cancel: cancel, layerId: layerId }));
37
- break;
38
- case 'Categorized':
39
- RenderComponent = (React.createElement(Categorized, { model: model, state: state, okSignalPromise: okSignalPromise, cancel: cancel, layerId: layerId }));
40
- break;
41
- case 'Heatmap':
42
- RenderComponent = (React.createElement(Heatmap, { model: model, state: state, okSignalPromise: okSignalPromise, cancel: cancel, layerId: layerId }));
43
- break;
44
- default:
45
- RenderComponent = React.createElement("div", null, "Select a render type");
46
- }
47
- setComponentToRender(RenderComponent);
48
- }, [selectedRenderType]);
68
+ const { featureProperties, isLoading: featuresLoading } = useGetProperties({
69
+ layerId,
70
+ model: model,
71
+ });
72
+ useLayerRenderType(layer, setSelectedRenderType);
73
+ if (featuresLoading) {
74
+ return React.createElement("p", null, "Loading...");
75
+ }
76
+ if (selectedRenderType === undefined) {
77
+ // typeguard
78
+ return;
79
+ }
80
+ const selectableRenderTypes = getSelectableRenderTypes(featureProperties, layer.type);
81
+ const selectedRenderTypeProps = selectableRenderTypes[selectedRenderType];
49
82
  return (React.createElement(React.Fragment, null,
83
+ selectedRenderTypeProps.isTabbed && (React.createElement("div", { className: "jp-gis-symbology-tabs" }, ['color', 'radius'].map(tab => (React.createElement("button", { key: tab, className: `jp-gis-tab ${symbologyTab === tab ? 'active' : ''}`, onClick: () => setSymbologyTab(tab) }, tab.charAt(0).toUpperCase() + tab.slice(1)))))),
50
84
  React.createElement("div", { className: "jp-gis-symbology-row" },
51
85
  React.createElement("label", { htmlFor: "render-type-select" }, "Render Type:"),
52
- React.createElement("select", { name: "render-type-select", id: "render-type-select", value: selectedRenderType, onChange: event => {
53
- setSelectedRenderType(event.target.value);
54
- } }, renderTypeOptions.map((func, funcIndex) => (React.createElement("option", { key: func, value: func }, func))))),
55
- componentToRender));
86
+ React.createElement("div", { className: "jp-select-wrapper" },
87
+ React.createElement("select", { name: "render-type-select", id: "render-type-select", className: "jp-mod-styled", value: selectedRenderType, onChange: event => {
88
+ setSelectedRenderType(event.target.value);
89
+ } }, objectEntries(selectableRenderTypes)
90
+ .filter(([renderType, renderTypeProps]) => renderTypeProps.layerTypeSupported &&
91
+ !(renderType === 'Heatmap' && symbologyTab === 'radius'))
92
+ .map(([renderType, _]) => (React.createElement("option", { key: renderType, value: renderType }, renderType)))))),
93
+ React.createElement(selectedRenderTypeProps.component, Object.assign({ model: model, state: state, okSignalPromise: okSignalPromise, cancel: cancel, layerId: layerId }, (selectedRenderTypeProps.isTabbed ? { symbologyTab } : {}), (selectedRenderTypeProps.selectableAttributesAndValues
94
+ ? {
95
+ selectableAttributesAndValues: selectedRenderTypeProps.selectableAttributesAndValues,
96
+ }
97
+ : {})))));
56
98
  };
57
99
  export default VectorRendering;
@@ -4,5 +4,5 @@ interface IValueSelectProps {
4
4
  selectedValue: string;
5
5
  setSelectedValue: (value: string) => void;
6
6
  }
7
- declare const ValueSelect: ({ featureProperties, selectedValue, setSelectedValue }: IValueSelectProps) => React.JSX.Element;
7
+ declare const ValueSelect: React.FC<IValueSelectProps>;
8
8
  export default ValueSelect;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- const ValueSelect = ({ featureProperties, selectedValue, setSelectedValue }) => {
2
+ const ValueSelect = ({ featureProperties, selectedValue, setSelectedValue, }) => {
3
3
  return (React.createElement("div", { className: "jp-gis-symbology-row" },
4
4
  React.createElement("label", { htmlFor: 'vector-value-select' }, "Value:"),
5
5
  React.createElement("select", { name: 'vector-value-select', onChange: event => setSelectedValue(event.target.value), className: "jp-mod-styled" }, Object.keys(featureProperties).map((feature, index) => (React.createElement("option", { key: index, value: feature, selected: feature === selectedValue, className: "jp-mod-styled" }, feature))))));
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ISymbologyDialogWithAttributesProps } from '../../symbologyDialog';
3
+ declare const Canonical: React.FC<ISymbologyDialogWithAttributesProps>;
4
+ export default Canonical;
@@ -0,0 +1,66 @@
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import ValueSelect from "../components/ValueSelect";
3
+ const Canonical = ({ model, state, okSignalPromise, cancel, layerId, selectableAttributesAndValues, }) => {
4
+ const selectedValueRef = useRef();
5
+ const [selectedValue, setSelectedValue] = useState('');
6
+ if (!layerId) {
7
+ return;
8
+ }
9
+ const layer = model.getLayer(layerId);
10
+ if (!(layer === null || layer === void 0 ? void 0 : layer.parameters)) {
11
+ return;
12
+ }
13
+ useEffect(() => {
14
+ okSignalPromise.promise.then(okSignal => {
15
+ okSignal.connect(handleOk, this);
16
+ });
17
+ return () => {
18
+ okSignalPromise.promise.then(okSignal => {
19
+ okSignal.disconnect(handleOk, this);
20
+ });
21
+ };
22
+ }, [selectedValue]);
23
+ useEffect(() => {
24
+ var _a, _b;
25
+ const layerParams = layer.parameters;
26
+ const value = (_b = (_a = layerParams.symbologyState) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : Object.keys(selectableAttributesAndValues)[0];
27
+ setSelectedValue(value);
28
+ }, [selectableAttributesAndValues]);
29
+ useEffect(() => {
30
+ selectedValueRef.current = selectedValue;
31
+ }, [selectedValue]);
32
+ const handleOk = () => {
33
+ if (!layer.parameters) {
34
+ return;
35
+ }
36
+ const colorExpr = ['get', selectedValue];
37
+ const newStyle = Object.assign({}, layer.parameters.color);
38
+ newStyle['fill-color'] = colorExpr;
39
+ newStyle['stroke-color'] = colorExpr;
40
+ newStyle['circle-fill-color'] = colorExpr;
41
+ const symbologyState = {
42
+ renderType: 'Canonical',
43
+ value: selectedValueRef.current,
44
+ };
45
+ layer.parameters.symbologyState = symbologyState;
46
+ layer.parameters.color = newStyle;
47
+ if (layer.type === 'HeatmapLayer') {
48
+ layer.type = 'VectorLayer';
49
+ }
50
+ model.sharedModel.updateLayer(layerId, layer);
51
+ cancel();
52
+ };
53
+ const body = (() => {
54
+ var _a;
55
+ if (((_a = Object.keys(selectableAttributesAndValues)) === null || _a === void 0 ? void 0 : _a.length) === 0) {
56
+ return (React.createElement("p", { className: "errors" }, "This symbology type is not available; no attributes contain a hex color code."));
57
+ }
58
+ else {
59
+ return (React.createElement(ValueSelect, { featureProperties: selectableAttributesAndValues, selectedValue: selectedValue, setSelectedValue: setSelectedValue }));
60
+ }
61
+ })();
62
+ return (React.createElement("div", { className: "jp-gis-layer-symbology-container" },
63
+ React.createElement("p", null, "Color features based on an attribute containing a hex color code."),
64
+ body));
65
+ };
66
+ export default Canonical;