@hisptz/dhis2-analytics 2.0.1 → 2.0.3

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 (103) hide show
  1. package/dist/components/Map/DHIS2Map.js +1 -0
  2. package/dist/components/Map/DHIS2Map.js.map +1 -1
  3. package/dist/components/Map/DHIS2Map.stories.js +35 -13
  4. package/dist/components/Map/DHIS2Map.stories.js.map +1 -1
  5. package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.js +17 -7
  6. package/dist/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.js.map +1 -1
  7. package/dist/components/Map/components/MapLayer/components/BoundaryLayer/index.js +8 -2
  8. package/dist/components/Map/components/MapLayer/components/BoundaryLayer/index.js.map +1 -1
  9. package/dist/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +0 -2
  10. package/dist/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css.map +1 -1
  11. package/dist/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +16 -4
  12. package/dist/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js.map +1 -1
  13. package/dist/components/Map/components/MapLayer/components/LegendArea/index.js +18 -7
  14. package/dist/components/Map/components/MapLayer/components/LegendArea/index.js.map +1 -1
  15. package/dist/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +16 -3
  16. package/dist/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js.map +1 -1
  17. package/dist/components/Map/components/MapLayer/components/PointLayer/index.js +16 -1
  18. package/dist/components/Map/components/MapLayer/components/PointLayer/index.js.map +1 -1
  19. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +10 -2
  20. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js.map +1 -1
  21. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +1 -1
  22. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js.map +1 -1
  23. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +10 -2
  24. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js.map +1 -1
  25. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +4 -2
  26. package/dist/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js.map +1 -1
  27. package/dist/components/Map/components/MapLayer/components/ThematicLayer/index.js +12 -1
  28. package/dist/components/Map/components/MapLayer/components/ThematicLayer/index.js.map +1 -1
  29. package/dist/components/Map/components/MapLayer/interfaces/index.js.map +1 -1
  30. package/dist/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +0 -1
  31. package/dist/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js.map +1 -1
  32. package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.js +6 -3
  33. package/dist/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.js.map +1 -1
  34. package/dist/components/Map/constants/colors.js +1613 -152
  35. package/dist/components/Map/constants/colors.js.map +1 -1
  36. package/dist/components/Map/utils/colors.js +1 -35
  37. package/dist/components/Map/utils/colors.js.map +1 -1
  38. package/dist/components/Visualization/components/AnalyticsDataProvider/index.js +0 -3
  39. package/dist/components/Visualization/components/AnalyticsDataProvider/index.js.map +1 -1
  40. package/dist/esm/components/Map/DHIS2Map.js +1 -0
  41. package/dist/esm/components/Map/DHIS2Map.js.map +1 -1
  42. package/dist/esm/components/Map/DHIS2Map.stories.js +35 -13
  43. package/dist/esm/components/Map/DHIS2Map.stories.js.map +1 -1
  44. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.js +17 -7
  45. package/dist/esm/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.js.map +1 -1
  46. package/dist/esm/components/Map/components/MapLayer/components/BoundaryLayer/index.js +8 -2
  47. package/dist/esm/components/Map/components/MapLayer/components/BoundaryLayer/index.js.map +1 -1
  48. package/dist/esm/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +0 -2
  49. package/dist/esm/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css.map +1 -1
  50. package/dist/esm/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +16 -4
  51. package/dist/esm/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js.map +1 -1
  52. package/dist/esm/components/Map/components/MapLayer/components/LegendArea/index.js +18 -7
  53. package/dist/esm/components/Map/components/MapLayer/components/LegendArea/index.js.map +1 -1
  54. package/dist/esm/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +15 -3
  55. package/dist/esm/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js.map +1 -1
  56. package/dist/esm/components/Map/components/MapLayer/components/PointLayer/index.js +16 -1
  57. package/dist/esm/components/Map/components/MapLayer/components/PointLayer/index.js.map +1 -1
  58. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +10 -2
  59. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js.map +1 -1
  60. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +1 -1
  61. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js.map +1 -1
  62. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +10 -2
  63. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js.map +1 -1
  64. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +4 -2
  65. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js.map +1 -1
  66. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/index.js +12 -1
  67. package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/index.js.map +1 -1
  68. package/dist/esm/components/Map/components/MapLayer/interfaces/index.js.map +1 -1
  69. package/dist/esm/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +0 -1
  70. package/dist/esm/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js.map +1 -1
  71. package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.js +6 -3
  72. package/dist/esm/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.js.map +1 -1
  73. package/dist/esm/components/Map/constants/colors.js +1613 -153
  74. package/dist/esm/components/Map/constants/colors.js.map +1 -1
  75. package/dist/esm/components/Map/utils/colors.js +3 -36
  76. package/dist/esm/components/Map/utils/colors.js.map +1 -1
  77. package/dist/esm/components/Visualization/components/AnalyticsDataProvider/index.js +0 -3
  78. package/dist/esm/components/Visualization/components/AnalyticsDataProvider/index.js.map +1 -1
  79. package/dist/types/components/Map/DHIS2Map.d.ts.map +1 -1
  80. package/dist/types/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.d.ts.map +1 -1
  81. package/dist/types/components/Map/components/MapLayer/components/BoundaryLayer/index.d.ts.map +1 -1
  82. package/dist/types/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.d.ts.map +1 -1
  83. package/dist/types/components/Map/components/MapLayer/components/LegendArea/index.d.ts.map +1 -1
  84. package/dist/types/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.d.ts.map +1 -1
  85. package/dist/types/components/Map/components/MapLayer/components/PointLayer/index.d.ts.map +1 -1
  86. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.d.ts +12 -2
  87. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.d.ts.map +1 -1
  88. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.d.ts +11 -6
  89. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.d.ts.map +1 -1
  90. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.d.ts.map +1 -1
  91. package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/index.d.ts.map +1 -1
  92. package/dist/types/components/Map/components/MapLayer/interfaces/index.d.ts +12 -0
  93. package/dist/types/components/Map/components/MapLayer/interfaces/index.d.ts.map +1 -1
  94. package/dist/types/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.d.ts.map +1 -1
  95. package/dist/types/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.d.ts.map +1 -1
  96. package/dist/types/components/Map/constants/colors.d.ts +2 -0
  97. package/dist/types/components/Map/constants/colors.d.ts.map +1 -1
  98. package/dist/types/components/Map/interfaces/index.d.ts +9 -0
  99. package/dist/types/components/Map/interfaces/index.d.ts.map +1 -1
  100. package/dist/types/components/Map/utils/colors.d.ts +2 -2
  101. package/dist/types/components/Map/utils/colors.d.ts.map +1 -1
  102. package/dist/types/components/Visualization/components/AnalyticsDataProvider/index.d.ts.map +1 -1
  103. package/package.json +3 -3
@@ -1,4 +1,5 @@
1
1
  import { DHIS2Map } from './DHIS2Map';
2
+ import { COLOR_SCALES } from './constants/colors.js';
2
3
 
3
4
  const meta = {
4
5
  title: "DHIS2 Map",
@@ -49,7 +50,10 @@ BoundaryLayer.args = {
49
50
  userSubX2Unit: true
50
51
  },
51
52
  boundaryLayer: {
52
- enabled: true
53
+ enabled: true,
54
+ onLayerClick: (e, data) => {
55
+ console.log(e, data);
56
+ }
53
57
  }
54
58
  };
55
59
  const BoundaryLayerWithLevels = {
@@ -91,7 +95,11 @@ ChoroplethThematicLayer.args = {
91
95
  dataItem: {
92
96
  id: "Uvn6LCg7dVU",
93
97
  displayName: "ANC 1 Coverage",
94
- type: "indicator"
98
+ type: "indicator",
99
+ legendConfig: {
100
+ colorClass: COLOR_SCALES[0],
101
+ scale: 5
102
+ }
95
103
  },
96
104
  control: {
97
105
  enabled: true,
@@ -100,7 +108,7 @@ ChoroplethThematicLayer.args = {
100
108
  }
101
109
  ],
102
110
  periodSelection: {
103
- periods: ["2022"]
111
+ periods: ["2023"]
104
112
  },
105
113
  legends: {
106
114
  enabled: true,
@@ -114,7 +122,7 @@ BubbleThematicLayer.args = {
114
122
  orgUnits: [],
115
123
  userOrgUnit: true,
116
124
  userSubUnit: true,
117
- userSubX2Unit: true
125
+ userSubX2Unit: false
118
126
  },
119
127
  boundaryLayer: {
120
128
  enabled: true
@@ -127,7 +135,11 @@ BubbleThematicLayer.args = {
127
135
  dataItem: {
128
136
  id: "Uvn6LCg7dVU",
129
137
  displayName: "ANC 1 Coverage",
130
- type: "indicator"
138
+ type: "indicator",
139
+ legendConfig: {
140
+ colorClass: COLOR_SCALES[0],
141
+ scale: 5
142
+ }
131
143
  },
132
144
  control: {
133
145
  enabled: true,
@@ -145,7 +157,7 @@ BubbleThematicLayer.args = {
145
157
  collapsible: true
146
158
  },
147
159
  periodSelection: {
148
- periods: ["2022"]
160
+ periods: ["2023"]
149
161
  },
150
162
  controls: [
151
163
  {
@@ -170,6 +182,9 @@ AllThematicLayers.args = {
170
182
  type: "choropleth",
171
183
  id: "ReUHfIn0pTQ",
172
184
  enabled: true,
185
+ onLayerClick: (e, data) => {
186
+ console.log(e, data);
187
+ },
173
188
  dataItem: {
174
189
  id: "ReUHfIn0pTQ",
175
190
  displayName: "ANC 1-3 Dropout Rate",
@@ -182,13 +197,17 @@ AllThematicLayers.args = {
182
197
  }
183
198
  },
184
199
  {
185
- type: "choropleth",
200
+ type: "bubble",
186
201
  id: "Uvn6LCg7dVU",
187
202
  enabled: true,
188
203
  dataItem: {
189
204
  id: "Uvn6LCg7dVU",
190
205
  displayName: "ANC 1 Coverage",
191
- type: "indicator"
206
+ type: "indicator",
207
+ legendConfig: {
208
+ colorClass: COLOR_SCALES[0],
209
+ scale: 5
210
+ }
192
211
  },
193
212
  control: {
194
213
  enabled: true,
@@ -202,7 +221,7 @@ AllThematicLayers.args = {
202
221
  collapsible: true
203
222
  },
204
223
  periodSelection: {
205
- periods: ["2022"]
224
+ periods: ["2023"]
206
225
  },
207
226
  controls: [
208
227
  {
@@ -258,7 +277,7 @@ ChoroplethThematicLayerWithLevels.args = {
258
277
  collapsible: true
259
278
  },
260
279
  periodSelection: {
261
- periods: ["2022"]
280
+ periods: ["2023"]
262
281
  },
263
282
  controls: [
264
283
  {
@@ -297,14 +316,17 @@ PointLayer.args = {
297
316
  }
298
317
  ],
299
318
  periodSelection: {
300
- periods: ["2022"]
319
+ periods: ["2023"]
301
320
  },
302
321
  pointLayer: {
303
322
  enabled: true,
304
323
  label: "Facilities",
305
324
  level: "m9lBJogzE95",
306
325
  style: {
307
- groupSet: "J5jldMd8OHv"
326
+ icon: "hospital_negative"
327
+ },
328
+ onLayerClick: (e, data) => {
329
+ console.log(e, data);
308
330
  }
309
331
  }
310
332
  };
@@ -318,7 +340,7 @@ GoogleEarthEngineLayers.args = {
318
340
  },
319
341
  thematicLayers: [],
320
342
  periodSelection: {
321
- periods: ["2022"]
343
+ periods: ["2023"]
322
344
  },
323
345
  earthEngineLayers: [
324
346
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Map/DHIS2Map.stories.tsx"],"names":[],"mappings":"AACA,SAAS,gBAAgB;AAEzB,MAAM,OAA8B;AAAA,EACnC,OAAO;AAAA,EACP,WAAW;AACZ;AACA,IAAO,2BAAQ;AAGR,MAAM,UAAiB;AAAA,EAC7B,MAAM;AACP;AACA,QAAQ,OAAO;AAAA,EACd,kBAAkB;AAAA,IACjB,UAAU,CAAC;AAAA,IACX,aAAa;AAAA,IACb,aAAa;AAAA,IACb,eAAe;AAAA,EAChB;AACD;AAEO,MAAM,WAAkB;AAAA,EAC9B,MAAM;AACP;AACA,SAAS,OAAO;AAAA,EACf,kBAAkB;AAAA,IACjB,UAAU,CAAC;AAAA,IACX,aAAa;AAAA,IACb,aAAa;AAAA,IACb,eAAe;AAAA,EAChB;AAAA,EACA,UAAU;AAAA,IACT;AAA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AAA,MACA,cAAc,CAAC,OAAO,MAAM;AAAA,MAC5B,SAAS;AAAA,QACR,QAAQ;AAAA,MACT;AAAA,IACD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,cAAc,CAAC,OAAO;AAAA,MACtB,SAAS;AAAA,IACV;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,cAAc,CAAC,YAAY;AAAA,IAC5B;AAAA,EACD;AAAA,EACA,YAAY;AAAA,IACX,SAAS;AAAA,IACT,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD","sourcesContent":["import { Meta, StoryObj } from \"@storybook/react\";\nimport { DHIS2Map } from \"./DHIS2Map\";\n\nconst meta: Meta<typeof DHIS2Map> = {\n\ttitle: \"DHIS2 Map\",\n\tcomponent: DHIS2Map,\n};\nexport default meta;\n\ntype Story = StoryObj<typeof DHIS2Map>;\nexport const BaseMap: Story = {\n\tname: \"Base map\",\n};\nBaseMap.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: true,\n\t},\n};\n\nexport const Controls: Story = {\n\tname: \"Controls\",\n};\nControls.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: true,\n\t},\n\tcontrols: [\n\t\t{\n\t\t\ttype: \"print\",\n\t\t\tposition: \"topleft\",\n\t\t\toptions: {\n\t\t\t\thidden: false,\n\t\t\t\thideControlContainer: true,\n\t\t\t\tsizeModes: [\"A4Landscape\", \"A4Portrait\", \"Current\"],\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport const BoundaryLayer: Story = {\n\tname: \"Boundary layer\",\n};\nBoundaryLayer.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: true,\n\t},\n\tboundaryLayer: {\n\t\tenabled: true,\n\t},\n};\n\nexport const BoundaryLayerWithLevels: Story = {\n\tname: \"Boundary layer with levels\",\n};\nBoundaryLayerWithLevels.args = {\n\torgUnitSelection: {\n\t\torgUnits: [\n\t\t\t{\n\t\t\t\tid: \"ImspTQPwCqd\",\n\t\t\t\tdisplayName: \"Sierra Leone\",\n\t\t\t\tname: \"Sierra Leone\",\n\t\t\t\tpath: \"/ImspTQPwCqd\",\n\t\t\t\tchildren: [],\n\t\t\t},\n\t\t],\n\t\tlevels: [\"2\"],\n\t},\n\tboundaryLayer: {\n\t\tenabled: true,\n\t},\n};\n\nexport const ChoroplethThematicLayer: Story = {};\nChoroplethThematicLayer.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: false,\n\t},\n\tboundaryLayer: {\n\t\tenabled: true,\n\t},\n\tthematicLayers: [\n\t\t{\n\t\t\ttype: \"choropleth\",\n\t\t\tid: \"choropleth\",\n\t\t\tenabled: true,\n\t\t\tdataItem: {\n\t\t\t\tid: \"Uvn6LCg7dVU\",\n\t\t\t\tdisplayName: \"ANC 1 Coverage\",\n\t\t\t\ttype: \"indicator\",\n\t\t\t},\n\t\t\tcontrol: {\n\t\t\t\tenabled: true,\n\t\t\t\tposition: \"topright\",\n\t\t\t},\n\t\t},\n\t],\n\tperiodSelection: {\n\t\tperiods: [\"2022\"],\n\t},\n\tlegends: {\n\t\tenabled: true,\n\t\tposition: \"topright\",\n\t\tcollapsible: true,\n\t},\n};\n\nexport const BubbleThematicLayer: Story = {};\nBubbleThematicLayer.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: true,\n\t},\n\tboundaryLayer: {\n\t\tenabled: true,\n\t},\n\tthematicLayers: [\n\t\t{\n\t\t\ttype: \"bubble\",\n\t\t\tid: \"bubble\",\n\t\t\tenabled: true,\n\t\t\tdataItem: {\n\t\t\t\tid: \"Uvn6LCg7dVU\",\n\t\t\t\tdisplayName: \"ANC 1 Coverage\",\n\t\t\t\ttype: \"indicator\",\n\t\t\t},\n\t\t\tcontrol: {\n\t\t\t\tenabled: true,\n\t\t\t\tposition: \"topright\",\n\t\t\t},\n\t\t\tradius: {\n\t\t\t\tmin: 0,\n\t\t\t\tmax: 40,\n\t\t\t},\n\t\t},\n\t],\n\tlegends: {\n\t\tenabled: true,\n\t\tposition: \"topright\",\n\t\tcollapsible: true,\n\t},\n\tperiodSelection: {\n\t\tperiods: [\"2022\"],\n\t},\n\tcontrols: [\n\t\t{\n\t\t\ttype: \"fullscreen\",\n\t\t\tposition: \"topleft\",\n\t\t},\n\t],\n};\n\nexport const AllThematicLayers: Story = {};\nAllThematicLayers.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: true,\n\t},\n\tboundaryLayer: {\n\t\tenabled: true,\n\t},\n\tthematicLayers: [\n\t\t{\n\t\t\ttype: \"choropleth\",\n\t\t\tid: \"ReUHfIn0pTQ\",\n\t\t\tenabled: true,\n\t\t\tdataItem: {\n\t\t\t\tid: \"ReUHfIn0pTQ\",\n\t\t\t\tdisplayName: \"ANC 1-3 Dropout Rate\",\n\t\t\t\ttype: \"indicator\",\n\t\t\t\tlegendSet: \"fqs276KXCXi\",\n\t\t\t},\n\t\t\tcontrol: {\n\t\t\t\tenabled: true,\n\t\t\t\tposition: \"topright\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: \"choropleth\",\n\t\t\tid: \"Uvn6LCg7dVU\",\n\t\t\tenabled: true,\n\t\t\tdataItem: {\n\t\t\t\tid: \"Uvn6LCg7dVU\",\n\t\t\t\tdisplayName: \"ANC 1 Coverage\",\n\t\t\t\ttype: \"indicator\",\n\t\t\t},\n\t\t\tcontrol: {\n\t\t\t\tenabled: true,\n\t\t\t\tposition: \"topright\",\n\t\t\t},\n\t\t},\n\t],\n\tlegends: {\n\t\tenabled: true,\n\t\tposition: \"topright\",\n\t\tcollapsible: true,\n\t},\n\tperiodSelection: {\n\t\tperiods: [\"2022\"],\n\t},\n\tcontrols: [\n\t\t{\n\t\t\ttype: \"scale\",\n\t\t\tposition: \"bottomleft\",\n\t\t\toptions: {\n\t\t\t\timperial: false,\n\t\t\t\tmetric: true,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: \"fullscreen\",\n\t\t\tposition: \"bottomleft\",\n\t\t},\n\t],\n};\n\nexport const ChoroplethThematicLayerWithLevels: Story = {};\nChoroplethThematicLayerWithLevels.args = {\n\torgUnitSelection: {\n\t\torgUnits: [\n\t\t\t{\n\t\t\t\tid: \"ImspTQPwCqd\",\n\t\t\t\tdisplayName: \"Sierra Leone\",\n\t\t\t\tname: \"Sierra Leone\",\n\t\t\t\tpath: \"/ImspTQPwCqd\",\n\t\t\t\tchildren: [],\n\t\t\t},\n\t\t],\n\t\tlevels: [\"3\"],\n\t},\n\tboundaryLayer: {\n\t\tenabled: true,\n\t},\n\tthematicLayers: [\n\t\t{\n\t\t\ttype: \"choropleth\",\n\t\t\tid: \"choropleth\",\n\t\t\tenabled: true,\n\t\t\tdataItem: {\n\t\t\t\tid: \"Uvn6LCg7dVU\",\n\t\t\t\tdisplayName: \"ANC 1 Coverage\",\n\t\t\t\ttype: \"indicator\",\n\t\t\t},\n\t\t\tcontrol: {\n\t\t\t\tenabled: true,\n\t\t\t\tposition: \"topright\",\n\t\t\t},\n\t\t},\n\t],\n\tlegends: {\n\t\tenabled: true,\n\t\tposition: \"topright\",\n\t\tcollapsible: true,\n\t},\n\tperiodSelection: {\n\t\tperiods: [\"2022\"],\n\t},\n\tcontrols: [\n\t\t{\n\t\t\ttype: \"print\",\n\t\t\tposition: \"topleft\",\n\t\t\toptions: {\n\t\t\t\thidden: false,\n\t\t\t\thideControlContainer: true,\n\t\t\t\tsizeModes: [\"A4Landscape\", \"A4Portrait\", \"Current\"],\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport const PointLayer: Story = {};\nPointLayer.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: false,\n\t},\n\tthematicLayers: [\n\t\t{\n\t\t\ttype: \"choropleth\",\n\t\t\tid: \"choropleth\",\n\t\t\tenabled: true,\n\t\t\tdataItem: {\n\t\t\t\tid: \"Uvn6LCg7dVU\",\n\t\t\t\tdisplayName: \"ANC 1 Coverage\",\n\t\t\t\ttype: \"indicator\",\n\t\t\t},\n\t\t\tcontrol: {\n\t\t\t\tenabled: true,\n\t\t\t\tposition: \"topright\",\n\t\t\t},\n\t\t},\n\t],\n\tperiodSelection: {\n\t\tperiods: [\"2022\"],\n\t},\n\tpointLayer: {\n\t\tenabled: true,\n\t\tlabel: \"Facilities\",\n\t\tlevel: \"m9lBJogzE95\",\n\t\tstyle: {\n\t\t\tgroupSet: \"J5jldMd8OHv\",\n\t\t},\n\t},\n};\n\nexport const GoogleEarthEngineLayers: Story = {};\nGoogleEarthEngineLayers.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: false,\n\t},\n\tthematicLayers: [],\n\tperiodSelection: {\n\t\tperiods: [\"2022\"],\n\t},\n\tearthEngineLayers: [\n\t\t{\n\t\t\tname: \"Population\",\n\t\t\ttype: \"population\",\n\t\t\tid: \"population\",\n\t\t\tenabled: false,\n\t\t\tparams: {\n\t\t\t\tmin: 0,\n\t\t\t\tmax: 10,\n\t\t\t\tpalette:\n\t\t\t\t\t\"#f7fbff,#deebf7,#c6dbef,#9ecae1,#6baed6,#4292c6,#2171b5,#08519c,#08306b\",\n\t\t\t},\n\t\t\taggregations: [\"sum\", \"mean\"],\n\t\t\tfilters: {\n\t\t\t\tperiod: \"2020\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Footprints\",\n\t\t\ttype: \"footprints\",\n\t\t\tid: \"footprints\",\n\t\t\taggregations: [\"count\"],\n\t\t\tenabled: false,\n\t\t},\n\t\t{\n\t\t\tname: \"Land Cover\",\n\t\t\ttype: \"landCover\",\n\t\t\tid: \"landCover\",\n\t\t\tenabled: true,\n\t\t\taggregations: [\"percentage\"],\n\t\t},\n\t],\n\tpointLayer: {\n\t\tenabled: false,\n\t\tlabel: \"Facilities\",\n\t\tlevel: \"m9lBJogzE95\",\n\t\tstyle: {\n\t\t\tgroupSet: \"J5jldMd8OHv\",\n\t\t},\n\t},\n};\n"]}
1
+ {"version":3,"sources":["../../../../src/components/Map/DHIS2Map.stories.tsx"],"names":[],"mappings":"AACA,SAAS,gBAAgB;AAEzB,SAAS,oBAAoB;AAE7B,MAAM,OAA8B;AAAA,EACnC,OAAO;AAAA,EACP,WAAW;AACZ;AACA,IAAO,2BAAQ;AAGR,MAAM,UAAiB;AAAA,EAC7B,MAAM;AACP;AACA,QAAQ,OAAO;AAAA,EACd,kBAAkB;AAAA,IACjB,UAAU,CAAC;AAAA,IACX,aAAa;AAAA,IACb,aAAa;AAAA,IACb,eAAe;AAAA,EAChB;AACD;AAEO,MAAM,WAAkB;AAAA,EAC9B,MAAM;AACP;AACA,SAAS,OAAO;AAAA,EACf,kBAAkB;AAAA,IACjB,UAAU,CAAC;AAAA,IACX,aAAa;AAAA,IACb,aAAa;AAAA,IACb,eAAe;AAAA,EAChB;AAAA,EACA,UAAU;AAAA,IACT;AAAA,MACC,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,QACR,QAAQ;AAAA,QACR,sBAAsB;AAAA,QACtB,WAAW,CAAC,eAAe,cAAc,SAAS;AAAA,MACnD;AAAA,IACD;AAAA,EACD;AACD;AAEO,MAAM,gBAAuB;AAAA,EACnC,MA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AAAA,EACA,gBAAgB,CAAC;AAAA,EACjB,iBAAiB;AAAA,IAChB,SAAS,CAAC,MAAM;AAAA,EACjB;AAAA,EACA,mBAAmB;AAAA,IAClB;AAAA,MACC,MAAM;AAAA,MACN,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,QAAQ;AAAA,QACP,KAAK;AAAA,QACL,KAAK;AAAA,QACL,SACC;AAAA,MACF;AAAA,MACA,cAAc,CAAC,OAAO,MAAM;AAAA,MAC5B,SAAS;AAAA,QACR,QAAQ;AAAA,MACT;AAAA,IACD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,cAAc,CAAC,OAAO;AAAA,MACtB,SAAS;AAAA,IACV;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,cAAc,CAAC,YAAY;AAAA,IAC5B;AAAA,EACD;AAAA,EACA,YAAY;AAAA,IACX,SAAS;AAAA,IACT,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD","sourcesContent":["import { Meta, StoryObj } from \"@storybook/react\";\nimport { DHIS2Map } from \"./DHIS2Map\";\n\nimport { COLOR_SCALES } from \"./constants/colors.js\";\n\nconst meta: Meta<typeof DHIS2Map> = {\n\ttitle: \"DHIS2 Map\",\n\tcomponent: DHIS2Map,\n};\nexport default meta;\n\ntype Story = StoryObj<typeof DHIS2Map>;\nexport const BaseMap: Story = {\n\tname: \"Base map\",\n};\nBaseMap.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: true,\n\t},\n};\n\nexport const Controls: Story = {\n\tname: \"Controls\",\n};\nControls.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: true,\n\t},\n\tcontrols: [\n\t\t{\n\t\t\ttype: \"print\",\n\t\t\tposition: \"topleft\",\n\t\t\toptions: {\n\t\t\t\thidden: false,\n\t\t\t\thideControlContainer: true,\n\t\t\t\tsizeModes: [\"A4Landscape\", \"A4Portrait\", \"Current\"],\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport const BoundaryLayer: Story = {\n\tname: \"Boundary layer\",\n};\nBoundaryLayer.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: true,\n\t},\n\tboundaryLayer: {\n\t\tenabled: true,\n\t\tonLayerClick: (e, data) => {\n\t\t\tconsole.log(e, data);\n\t\t},\n\t},\n};\n\nexport const BoundaryLayerWithLevels: Story = {\n\tname: \"Boundary layer with levels\",\n};\nBoundaryLayerWithLevels.args = {\n\torgUnitSelection: {\n\t\torgUnits: [\n\t\t\t{\n\t\t\t\tid: \"ImspTQPwCqd\",\n\t\t\t\tdisplayName: \"Sierra Leone\",\n\t\t\t\tname: \"Sierra Leone\",\n\t\t\t\tpath: \"/ImspTQPwCqd\",\n\t\t\t\tchildren: [],\n\t\t\t},\n\t\t],\n\t\tlevels: [\"2\"],\n\t},\n\tboundaryLayer: {\n\t\tenabled: true,\n\t},\n};\n\nexport const ChoroplethThematicLayer: Story = {};\nChoroplethThematicLayer.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: false,\n\t},\n\tboundaryLayer: {\n\t\tenabled: true,\n\t},\n\tthematicLayers: [\n\t\t{\n\t\t\ttype: \"choropleth\",\n\t\t\tid: \"choropleth\",\n\t\t\tenabled: true,\n\t\t\tdataItem: {\n\t\t\t\tid: \"Uvn6LCg7dVU\",\n\t\t\t\tdisplayName: \"ANC 1 Coverage\",\n\t\t\t\ttype: \"indicator\",\n\t\t\t\tlegendConfig: {\n\t\t\t\t\tcolorClass: COLOR_SCALES[0],\n\t\t\t\t\tscale: 5,\n\t\t\t\t},\n\t\t\t},\n\t\t\tcontrol: {\n\t\t\t\tenabled: true,\n\t\t\t\tposition: \"topright\",\n\t\t\t},\n\t\t},\n\t],\n\tperiodSelection: {\n\t\tperiods: [\"2023\"],\n\t},\n\tlegends: {\n\t\tenabled: true,\n\t\tposition: \"topright\",\n\t\tcollapsible: true,\n\t},\n};\n\nexport const BubbleThematicLayer: Story = {};\nBubbleThematicLayer.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: false,\n\t},\n\tboundaryLayer: {\n\t\tenabled: true,\n\t},\n\tthematicLayers: [\n\t\t{\n\t\t\ttype: \"bubble\",\n\t\t\tid: \"bubble\",\n\t\t\tenabled: true,\n\n\t\t\tdataItem: {\n\t\t\t\tid: \"Uvn6LCg7dVU\",\n\t\t\t\tdisplayName: \"ANC 1 Coverage\",\n\t\t\t\ttype: \"indicator\",\n\t\t\t\tlegendConfig: {\n\t\t\t\t\tcolorClass: COLOR_SCALES[0],\n\t\t\t\t\tscale: 5,\n\t\t\t\t},\n\t\t\t},\n\t\t\tcontrol: {\n\t\t\t\tenabled: true,\n\t\t\t\tposition: \"topright\",\n\t\t\t},\n\t\t\tradius: {\n\t\t\t\tmin: 0,\n\t\t\t\tmax: 40,\n\t\t\t},\n\t\t},\n\t],\n\tlegends: {\n\t\tenabled: true,\n\t\tposition: \"topright\",\n\t\tcollapsible: true,\n\t},\n\tperiodSelection: {\n\t\tperiods: [\"2023\"],\n\t},\n\tcontrols: [\n\t\t{\n\t\t\ttype: \"fullscreen\",\n\t\t\tposition: \"topleft\",\n\t\t},\n\t],\n};\n\nexport const AllThematicLayers: Story = {};\nAllThematicLayers.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: true,\n\t},\n\tboundaryLayer: {\n\t\tenabled: true,\n\t},\n\tthematicLayers: [\n\t\t{\n\t\t\ttype: \"choropleth\",\n\t\t\tid: \"ReUHfIn0pTQ\",\n\t\t\tenabled: true,\n\t\t\tonLayerClick: (e, data) => {\n\t\t\t\tconsole.log(e, data);\n\t\t\t},\n\t\t\tdataItem: {\n\t\t\t\tid: \"ReUHfIn0pTQ\",\n\t\t\t\tdisplayName: \"ANC 1-3 Dropout Rate\",\n\t\t\t\ttype: \"indicator\",\n\t\t\t\tlegendSet: \"fqs276KXCXi\",\n\t\t\t},\n\t\t\tcontrol: {\n\t\t\t\tenabled: true,\n\t\t\t\tposition: \"topright\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: \"bubble\",\n\t\t\tid: \"Uvn6LCg7dVU\",\n\t\t\tenabled: true,\n\t\t\tdataItem: {\n\t\t\t\tid: \"Uvn6LCg7dVU\",\n\t\t\t\tdisplayName: \"ANC 1 Coverage\",\n\t\t\t\ttype: \"indicator\",\n\t\t\t\tlegendConfig: {\n\t\t\t\t\tcolorClass: COLOR_SCALES[0],\n\t\t\t\t\tscale: 5,\n\t\t\t\t},\n\t\t\t},\n\t\t\tcontrol: {\n\t\t\t\tenabled: true,\n\t\t\t\tposition: \"topright\",\n\t\t\t},\n\t\t},\n\t],\n\tlegends: {\n\t\tenabled: true,\n\t\tposition: \"topright\",\n\t\tcollapsible: true,\n\t},\n\tperiodSelection: {\n\t\tperiods: [\"2023\"],\n\t},\n\tcontrols: [\n\t\t{\n\t\t\ttype: \"scale\",\n\t\t\tposition: \"bottomleft\",\n\t\t\toptions: {\n\t\t\t\timperial: false,\n\t\t\t\tmetric: true,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: \"fullscreen\",\n\t\t\tposition: \"bottomleft\",\n\t\t},\n\t],\n};\n\nexport const ChoroplethThematicLayerWithLevels: Story = {};\nChoroplethThematicLayerWithLevels.args = {\n\torgUnitSelection: {\n\t\torgUnits: [\n\t\t\t{\n\t\t\t\tid: \"ImspTQPwCqd\",\n\t\t\t\tdisplayName: \"Sierra Leone\",\n\t\t\t\tname: \"Sierra Leone\",\n\t\t\t\tpath: \"/ImspTQPwCqd\",\n\t\t\t\tchildren: [],\n\t\t\t},\n\t\t],\n\t\tlevels: [\"3\"],\n\t},\n\tboundaryLayer: {\n\t\tenabled: true,\n\t},\n\tthematicLayers: [\n\t\t{\n\t\t\ttype: \"choropleth\",\n\t\t\tid: \"choropleth\",\n\t\t\tenabled: true,\n\t\t\tdataItem: {\n\t\t\t\tid: \"Uvn6LCg7dVU\",\n\t\t\t\tdisplayName: \"ANC 1 Coverage\",\n\t\t\t\ttype: \"indicator\",\n\t\t\t},\n\t\t\tcontrol: {\n\t\t\t\tenabled: true,\n\t\t\t\tposition: \"topright\",\n\t\t\t},\n\t\t},\n\t],\n\tlegends: {\n\t\tenabled: true,\n\t\tposition: \"topright\",\n\t\tcollapsible: true,\n\t},\n\tperiodSelection: {\n\t\tperiods: [\"2023\"],\n\t},\n\tcontrols: [\n\t\t{\n\t\t\ttype: \"print\",\n\t\t\tposition: \"topleft\",\n\t\t\toptions: {\n\t\t\t\thidden: false,\n\t\t\t\thideControlContainer: true,\n\t\t\t\tsizeModes: [\"A4Landscape\", \"A4Portrait\", \"Current\"],\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport const PointLayer: Story = {};\nPointLayer.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: false,\n\t},\n\tthematicLayers: [\n\t\t{\n\t\t\ttype: \"choropleth\",\n\t\t\tid: \"choropleth\",\n\t\t\tenabled: true,\n\t\t\tdataItem: {\n\t\t\t\tid: \"Uvn6LCg7dVU\",\n\t\t\t\tdisplayName: \"ANC 1 Coverage\",\n\t\t\t\ttype: \"indicator\",\n\t\t\t},\n\t\t\tcontrol: {\n\t\t\t\tenabled: true,\n\t\t\t\tposition: \"topright\",\n\t\t\t},\n\t\t},\n\t],\n\tperiodSelection: {\n\t\tperiods: [\"2023\"],\n\t},\n\tpointLayer: {\n\t\tenabled: true,\n\t\tlabel: \"Facilities\",\n\t\tlevel: \"m9lBJogzE95\",\n\t\tstyle: {\n\t\t\ticon: \"hospital_negative\",\n\t\t},\n\t\tonLayerClick: (e, data) => {\n\t\t\tconsole.log(e, data);\n\t\t},\n\t},\n};\n\nexport const GoogleEarthEngineLayers: Story = {};\nGoogleEarthEngineLayers.args = {\n\torgUnitSelection: {\n\t\torgUnits: [],\n\t\tuserOrgUnit: true,\n\t\tuserSubUnit: true,\n\t\tuserSubX2Unit: false,\n\t},\n\tthematicLayers: [],\n\tperiodSelection: {\n\t\tperiods: [\"2023\"],\n\t},\n\tearthEngineLayers: [\n\t\t{\n\t\t\tname: \"Population\",\n\t\t\ttype: \"population\",\n\t\t\tid: \"population\",\n\t\t\tenabled: false,\n\t\t\tparams: {\n\t\t\t\tmin: 0,\n\t\t\t\tmax: 10,\n\t\t\t\tpalette:\n\t\t\t\t\t\"#f7fbff,#deebf7,#c6dbef,#9ecae1,#6baed6,#4292c6,#2171b5,#08519c,#08306b\",\n\t\t\t},\n\t\t\taggregations: [\"sum\", \"mean\"],\n\t\t\tfilters: {\n\t\t\t\tperiod: \"2020\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Footprints\",\n\t\t\ttype: \"footprints\",\n\t\t\tid: \"footprints\",\n\t\t\taggregations: [\"count\"],\n\t\t\tenabled: false,\n\t\t},\n\t\t{\n\t\t\tname: \"Land Cover\",\n\t\t\ttype: \"landCover\",\n\t\t\tid: \"landCover\",\n\t\t\tenabled: true,\n\t\t\taggregations: [\"percentage\"],\n\t\t},\n\t],\n\tpointLayer: {\n\t\tenabled: false,\n\t\tlabel: \"Facilities\",\n\t\tlevel: \"m9lBJogzE95\",\n\t\tstyle: {\n\t\t\tgroupSet: \"J5jldMd8OHv\",\n\t\t},\n\t},\n};\n"]}
@@ -12,13 +12,23 @@ function EarthEngineLayerConfiguration({
12
12
  form,
13
13
  excluded
14
14
  }) {
15
- return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(FormProvider, { ...form, children: /* @__PURE__ */ jsxs("div", { className: "column gap-16", children: [
16
- /* @__PURE__ */ jsx(TypeField, { excluded }),
17
- /* @__PURE__ */ jsx(Name, {}),
18
- /* @__PURE__ */ jsx(AggregationSelector, {}),
19
- /* @__PURE__ */ jsx(PeriodSelector, {}),
20
- /* @__PURE__ */ jsx(StylesConfig, {})
21
- ] }) }) });
15
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(FormProvider, { ...form, children: /* @__PURE__ */ jsxs(
16
+ "div",
17
+ {
18
+ style: {
19
+ display: "flex",
20
+ flexDirection: "column",
21
+ gap: 16
22
+ },
23
+ children: [
24
+ /* @__PURE__ */ jsx(TypeField, { excluded }),
25
+ /* @__PURE__ */ jsx(Name, {}),
26
+ /* @__PURE__ */ jsx(AggregationSelector, {}),
27
+ /* @__PURE__ */ jsx(PeriodSelector, {}),
28
+ /* @__PURE__ */ jsx(StylesConfig, {})
29
+ ]
30
+ }
31
+ ) }) });
22
32
  }
23
33
 
24
34
  export { EarthEngineLayerConfiguration };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.tsx"],"names":[],"mappings":"AAyBI,SACC,KADD;AAxBJ,SAAS,oBAAmC;AAE5C,SAAS,oBAAoB;AAC7B,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,aAAa,2BAA2B;AAEjD,MAAM,cAAc,IAAI,YAAY;AAQ7B,SAAS,8BAA8B;AAAA,EAC7C;AAAA,EACA;AACD,GAAuC;AACtC,SACC,oBAAC,uBAAoB,QAAQ,aAC5B,8BAAC,gBAAc,GAAG,MACjB,+BAAC,SAAI,WAAU,iBACd;AAAA,wBAAC,aAAU,UAAoB;AAAA,IAC/B,oBAAC,QAAK;AAAA,IACN,oBAAC,uBAAoB;AAAA,IACrB,oBAAC,kBAAe;AAAA,IAChB,oBAAC,gBAAa;AAAA,KACf,GACD,GACD;AAEF","sourcesContent":["import { EarthEngineLayerConfig } from \"../MapLayer/interfaces\";\nimport { FormProvider, UseFormReturn } from \"react-hook-form\";\nimport React from \"react\";\nimport { StylesConfig } from \"./components/StylesConfig.js\";\nimport { Name } from \"./components/Name.js\";\nimport { TypeField } from \"./components/TypeField.js\";\nimport { AggregationSelector } from \"./components/AggregationSelector.js\";\nimport { PeriodSelector } from \"./components/PeriodSelector.js\";\nimport { QueryClient, QueryClientProvider } from \"react-query\";\n\nconst queryClient = new QueryClient();\nexport interface EarthEngineLayerConfigurationProps {\n\tform: UseFormReturn<EarthEngineLayerConfig>;\n\texcluded?: string[];\n\n\t[key: string]: any;\n}\n\nexport function EarthEngineLayerConfiguration({\n\tform,\n\texcluded,\n}: EarthEngineLayerConfigurationProps) {\n\treturn (\n\t\t<QueryClientProvider client={queryClient}>\n\t\t\t<FormProvider {...form}>\n\t\t\t\t<div className=\"column gap-16\">\n\t\t\t\t\t<TypeField excluded={excluded} />\n\t\t\t\t\t<Name />\n\t\t\t\t\t<AggregationSelector />\n\t\t\t\t\t<PeriodSelector />\n\t\t\t\t\t<StylesConfig />\n\t\t\t\t</div>\n\t\t\t</FormProvider>\n\t\t</QueryClientProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../../../../../../src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.tsx"],"names":[],"mappings":"AA0BI,SAOC,KAPD;AAzBJ,SAAS,oBAAmC;AAE5C,SAAS,oBAAoB;AAC7B,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,aAAa,2BAA2B;AAEjD,MAAM,cAAc,IAAI,YAAY;AAS7B,SAAS,8BAA8B;AAAA,EAC7C;AAAA,EACA;AACD,GAAuC;AACtC,SACC,oBAAC,uBAAoB,QAAQ,aAC5B,8BAAC,gBAAc,GAAG,MACjB;AAAA,IAAC;AAAA;AAAA,MACA,OAAO;AAAA,QACN,SAAS;AAAA,QACT,eAAe;AAAA,QACf,KAAK;AAAA,MACN;AAAA,MAEA;AAAA,4BAAC,aAAU,UAAoB;AAAA,QAC/B,oBAAC,QAAK;AAAA,QACN,oBAAC,uBAAoB;AAAA,QACrB,oBAAC,kBAAe;AAAA,QAChB,oBAAC,gBAAa;AAAA;AAAA;AAAA,EACf,GACD,GACD;AAEF","sourcesContent":["import { EarthEngineLayerConfig } from \"../MapLayer/interfaces\";\nimport { FormProvider, UseFormReturn } from \"react-hook-form\";\nimport React from \"react\";\nimport { StylesConfig } from \"./components/StylesConfig.js\";\nimport { Name } from \"./components/Name.js\";\nimport { TypeField } from \"./components/TypeField.js\";\nimport { AggregationSelector } from \"./components/AggregationSelector.js\";\nimport { PeriodSelector } from \"./components/PeriodSelector.js\";\nimport { QueryClient, QueryClientProvider } from \"react-query\";\n\nconst queryClient = new QueryClient();\n\nexport interface EarthEngineLayerConfigurationProps {\n\tform: UseFormReturn<EarthEngineLayerConfig>;\n\texcluded?: string[];\n\n\t[key: string]: any;\n}\n\nexport function EarthEngineLayerConfiguration({\n\tform,\n\texcluded,\n}: EarthEngineLayerConfigurationProps) {\n\treturn (\n\t\t<QueryClientProvider client={queryClient}>\n\t\t\t<FormProvider {...form}>\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\t\tflexDirection: \"column\",\n\t\t\t\t\t\tgap: 16,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<TypeField excluded={excluded} />\n\t\t\t\t\t<Name />\n\t\t\t\t\t<AggregationSelector />\n\t\t\t\t\t<PeriodSelector />\n\t\t\t\t\t<StylesConfig />\n\t\t\t\t</div>\n\t\t\t</FormProvider>\n\t\t</QueryClientProvider>\n\t);\n}\n"]}
@@ -18,7 +18,7 @@ const highlightStyle = {
18
18
  fillOpacity: 0.1
19
19
  };
20
20
  function BoundaryLayer(props) {
21
- const { enabled } = props ?? {};
21
+ const { enabled, customEventHandlers, onLayerClick } = props ?? {};
22
22
  const orgUnits = useBoundaryData();
23
23
  return /* @__PURE__ */ jsx(LayersControl.Overlay, { checked: enabled, name: i18n.t("Boundaries"), children: /* @__PURE__ */ jsx(LayerGroup, { children: orgUnits?.map((area) => {
24
24
  return /* @__PURE__ */ jsxs(
@@ -28,7 +28,13 @@ function BoundaryLayer(props) {
28
28
  interactive: true,
29
29
  eventHandlers: {
30
30
  mouseover: (e) => highlightFeature(e, highlightStyle),
31
- mouseout: (e) => resetHighlight(e, defaultStyle)
31
+ mouseout: (e) => resetHighlight(e, defaultStyle),
32
+ ...customEventHandlers ?? {},
33
+ mousedown: (e) => {
34
+ if (onLayerClick) {
35
+ onLayerClick(e, { orgUnit: area });
36
+ }
37
+ }
32
38
  },
33
39
  pathOptions: defaultStyle,
34
40
  children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/BoundaryLayer/index.tsx"],"names":[],"mappings":"AAiDO,cAGC,YAHD;AAjDP,OAAO,UAAU;AACjB,SAAS,cAAc;AAEvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,SAAS,kBAAkB,sBAAsB;AAEjD,SAAS,uBAAuB;AAEzB,MAAM,eAAe;AAAA,EAC3B,QAAQ;AAAA,EACR,OAAO,OAAO;AAAA,EACd,WAAW,OAAO;AAAA,EAClB,aAAa;AACd;AACO,MAAM,iBAAiB;AAAA,EAC7B,QAAQ;AAAA,EACR,OAAO,OAAO;AAAA,EACd,WAAW;AAAA,EACX,aAAa;AACd;AAEe,SAAR,cAA+B,OAA+B;AACpE,QAAM,EAAE,QAAQ,IAAI,SAAS,CAAC;AAC9B,QAAM,WAAW,gBAAgB;AAEjC,SACC,oBAAC,cAAc,SAAd,EAAsB,SAAS,SAAS,MAAM,KAAK,EAAE,YAAY,GACjE,8BAAC,cACC,oBAAU,IAAI,CAAC,SAAqB;AACpC,WACC;AAAA,MAAC;AAAA;AAAA,QACA,MAAM,KAAK;AAAA,QACX,aAAW;AAAA,QACX,eAAe;AAAA,UACd,WAAW,CAAC,MACX,iBAAiB,GAAG,cAAc;AAAA,UACnC,UAAU,CAAC,MACV,eAAe,GAAG,YAAY;AAAA,QAChC;AAAA,QAEA,aAAa;AAAA,QAEb;AAAA,8BAAC,WAAS,eAAK,MAAK;AAAA,UACpB,qBAAC,SAAM,UAAU,IAChB;AAAA,gCAAC,QAAI,eAAK,MAAK;AAAA,YACf,qBAAC,SACA;AAAA,kCAAC,OAAE,qBAAO;AAAA,cACT,KAAK;AAAA,eACP;AAAA,aACD;AAAA;AAAA;AAAA,MAVK,GAAG,KAAK,EAAE;AAAA,IAWhB;AAAA,EAEF,CAAC,GACF,GACD;AAEF","sourcesContent":["import i18n from \"@dhis2/d2-i18n\";\nimport { colors } from \"@dhis2/ui\";\nimport React from \"react\";\nimport {\n\tGeoJSON,\n\tLayerGroup,\n\tLayersControl,\n\tPopup,\n\tTooltip,\n} from \"react-leaflet\";\nimport { MapOrgUnit } from \"../../../../interfaces/index.js\";\nimport { highlightFeature, resetHighlight } from \"../../../../utils/map.js\";\nimport { CustomBoundaryLayer as BoundaryLayerInterface } from \"../../interfaces/index.js\";\nimport { useBoundaryData } from \"./hooks/useBoundaryData.js\";\n\nexport const defaultStyle = {\n\tweight: 1,\n\tcolor: colors.grey900,\n\tfillColor: colors.grey900,\n\tfillOpacity: 0.0,\n};\nexport const highlightStyle = {\n\tweight: 2,\n\tcolor: colors.grey900,\n\tdashArray: \"\",\n\tfillOpacity: 0.1,\n};\n\nexport default function BoundaryLayer(props: BoundaryLayerInterface) {\n\tconst { enabled } = props ?? {};\n\tconst orgUnits = useBoundaryData();\n\n\treturn (\n\t\t<LayersControl.Overlay checked={enabled} name={i18n.t(\"Boundaries\")}>\n\t\t\t<LayerGroup>\n\t\t\t\t{orgUnits?.map((area: MapOrgUnit) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<GeoJSON\n\t\t\t\t\t\t\tdata={area.geoJSON}\n\t\t\t\t\t\t\tinteractive\n\t\t\t\t\t\t\teventHandlers={{\n\t\t\t\t\t\t\t\tmouseover: (e) =>\n\t\t\t\t\t\t\t\t\thighlightFeature(e, highlightStyle),\n\t\t\t\t\t\t\t\tmouseout: (e) =>\n\t\t\t\t\t\t\t\t\tresetHighlight(e, defaultStyle),\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tkey={`${area.id}-polygon`}\n\t\t\t\t\t\t\tpathOptions={defaultStyle}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip>{area.name}</Tooltip>\n\t\t\t\t\t\t\t<Popup minWidth={80}>\n\t\t\t\t\t\t\t\t<h3>{area.name}</h3>\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<b>Level: </b>\n\t\t\t\t\t\t\t\t\t{area.level}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</Popup>\n\t\t\t\t\t\t</GeoJSON>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</LayerGroup>\n\t\t</LayersControl.Overlay>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/BoundaryLayer/index.tsx"],"names":[],"mappings":"AAuDO,cAGC,YAHD;AAvDP,OAAO,UAAU;AACjB,SAAS,cAAc;AAEvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,SAAS,kBAAkB,sBAAsB;AAEjD,SAAS,uBAAuB;AAEzB,MAAM,eAAe;AAAA,EAC3B,QAAQ;AAAA,EACR,OAAO,OAAO;AAAA,EACd,WAAW,OAAO;AAAA,EAClB,aAAa;AACd;AACO,MAAM,iBAAiB;AAAA,EAC7B,QAAQ;AAAA,EACR,OAAO,OAAO;AAAA,EACd,WAAW;AAAA,EACX,aAAa;AACd;AAEe,SAAR,cAA+B,OAA+B;AACpE,QAAM,EAAE,SAAS,qBAAqB,aAAa,IAAI,SAAS,CAAC;AACjE,QAAM,WAAW,gBAAgB;AAEjC,SACC,oBAAC,cAAc,SAAd,EAAsB,SAAS,SAAS,MAAM,KAAK,EAAE,YAAY,GACjE,8BAAC,cACC,oBAAU,IAAI,CAAC,SAAqB;AACpC,WACC;AAAA,MAAC;AAAA;AAAA,QACA,MAAM,KAAK;AAAA,QACX,aAAW;AAAA,QACX,eAAe;AAAA,UACd,WAAW,CAAC,MACX,iBAAiB,GAAG,cAAc;AAAA,UACnC,UAAU,CAAC,MACV,eAAe,GAAG,YAAY;AAAA,UAC/B,GAAI,uBAAuB,CAAC;AAAA,UAC5B,WAAW,CAAC,MAAM;AACjB,gBAAI,cAAc;AACjB,2BAAa,GAAG,EAAE,SAAS,KAAK,CAAC;AAAA,YAClC;AAAA,UACD;AAAA,QACD;AAAA,QAEA,aAAa;AAAA,QAEb;AAAA,8BAAC,WAAS,eAAK,MAAK;AAAA,UACpB,qBAAC,SAAM,UAAU,IAChB;AAAA,gCAAC,QAAI,eAAK,MAAK;AAAA,YACf,qBAAC,SACA;AAAA,kCAAC,OAAE,qBAAO;AAAA,cACT,KAAK;AAAA,eACP;AAAA,aACD;AAAA;AAAA;AAAA,MAVK,GAAG,KAAK,EAAE;AAAA,IAWhB;AAAA,EAEF,CAAC,GACF,GACD;AAEF","sourcesContent":["import i18n from \"@dhis2/d2-i18n\";\nimport { colors } from \"@dhis2/ui\";\nimport React from \"react\";\nimport {\n\tGeoJSON,\n\tLayerGroup,\n\tLayersControl,\n\tPopup,\n\tTooltip,\n} from \"react-leaflet\";\nimport { MapOrgUnit } from \"../../../../interfaces/index.js\";\nimport { highlightFeature, resetHighlight } from \"../../../../utils/map.js\";\nimport { CustomBoundaryLayer as BoundaryLayerInterface } from \"../../interfaces/index.js\";\nimport { useBoundaryData } from \"./hooks/useBoundaryData.js\";\n\nexport const defaultStyle = {\n\tweight: 1,\n\tcolor: colors.grey900,\n\tfillColor: colors.grey900,\n\tfillOpacity: 0.0,\n};\nexport const highlightStyle = {\n\tweight: 2,\n\tcolor: colors.grey900,\n\tdashArray: \"\",\n\tfillOpacity: 0.1,\n};\n\nexport default function BoundaryLayer(props: BoundaryLayerInterface) {\n\tconst { enabled, customEventHandlers, onLayerClick } = props ?? {};\n\tconst orgUnits = useBoundaryData();\n\n\treturn (\n\t\t<LayersControl.Overlay checked={enabled} name={i18n.t(\"Boundaries\")}>\n\t\t\t<LayerGroup>\n\t\t\t\t{orgUnits?.map((area: MapOrgUnit) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<GeoJSON\n\t\t\t\t\t\t\tdata={area.geoJSON}\n\t\t\t\t\t\t\tinteractive\n\t\t\t\t\t\t\teventHandlers={{\n\t\t\t\t\t\t\t\tmouseover: (e) =>\n\t\t\t\t\t\t\t\t\thighlightFeature(e, highlightStyle),\n\t\t\t\t\t\t\t\tmouseout: (e) =>\n\t\t\t\t\t\t\t\t\tresetHighlight(e, defaultStyle),\n\t\t\t\t\t\t\t\t...(customEventHandlers ?? {}),\n\t\t\t\t\t\t\t\tmousedown: (e) => {\n\t\t\t\t\t\t\t\t\tif (onLayerClick) {\n\t\t\t\t\t\t\t\t\t\tonLayerClick(e, { orgUnit: area });\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tkey={`${area.id}-polygon`}\n\t\t\t\t\t\t\tpathOptions={defaultStyle}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip>{area.name}</Tooltip>\n\t\t\t\t\t\t\t<Popup minWidth={80}>\n\t\t\t\t\t\t\t\t<h3>{area.name}</h3>\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<b>Level: </b>\n\t\t\t\t\t\t\t\t\t{area.level}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</Popup>\n\t\t\t\t\t\t</GeoJSON>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</LayerGroup>\n\t\t</LayersControl.Overlay>\n\t);\n}\n"]}
@@ -5,6 +5,4 @@
5
5
  line-height: 17px;
6
6
  z-index: 1000000 !important;
7
7
  }
8
- [data-test=dhi2-uicore-popper] {
9
- }
10
8
  /*# sourceMappingURL=LegendArea.module.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css"],"sourcesContent":[".map-tooltip {\n padding: 4px 6px;\n border-radius: 3px;\n font-size: 13px;\n line-height: 17px;\n z-index: 1000000 !important;\n}\n\n[data-test=\"dhi2-uicore-popper\"] {\n\n}\n\n"],"mappings":"AAAA,CAAC;AACG,WAAS,IAAI;AACb,iBAAe;AACf,aAAW;AACX,eAAa;AACb,WAAS;AACb;AAEA,CAAC;AAED;","names":[]}
1
+ {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css"],"sourcesContent":[".map-tooltip {\n padding: 4px 6px;\n border-radius: 3px;\n font-size: 13px;\n line-height: 17px;\n z-index: 1000000 !important;\n}\n\n"],"mappings":"AAAA,CAAC;AACG,WAAS,IAAI;AACb,iBAAe;AACf,aAAW;AACX,eAAa;AACb,WAAS;AACb;","names":[]}
@@ -6,10 +6,22 @@ function LegendCardHeader({
6
6
  collapsible,
7
7
  onCollapse
8
8
  }) {
9
- return /* @__PURE__ */ jsxs("div", { className: "row w-100 space-between align-items-center", children: [
10
- /* @__PURE__ */ jsx("h4", { style: { margin: 0 }, className: "legend-header", children: title }),
11
- collapsible && /* @__PURE__ */ jsx("div", { onClick: onCollapse, children: /* @__PURE__ */ jsx(IconLaunch16, {}) })
12
- ] });
9
+ return /* @__PURE__ */ jsxs(
10
+ "div",
11
+ {
12
+ style: {
13
+ display: "flex",
14
+ width: "100%",
15
+ justifyContent: "space-between",
16
+ alignItems: "center",
17
+ padding: 8
18
+ },
19
+ children: [
20
+ /* @__PURE__ */ jsx("h4", { style: { margin: 0 }, className: "legend-header", children: title }),
21
+ collapsible && /* @__PURE__ */ jsx("div", { onClick: onCollapse, children: /* @__PURE__ */ jsx(IconLaunch16, {}) })
22
+ ]
23
+ }
24
+ );
13
25
  }
14
26
 
15
27
  export { LegendCardHeader as default };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../../src/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.tsx"],"names":[],"mappings":"AAaE,SACC,KADD;AAbF,SAAS,oBAAoB;AAGd,SAAR,iBAAkC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AACD,GAIG;AACF,SACC,qBAAC,SAAI,WAAU,8CACd;AAAA,wBAAC,QAAG,OAAO,EAAE,QAAQ,EAAE,GAAG,WAAU,iBAClC,iBACF;AAAA,IACC,eACA,oBAAC,SAAI,SAAS,YACb,8BAAC,gBAAa,GACf;AAAA,KAEF;AAEF","sourcesContent":["import { IconLaunch16 } from \"@dhis2/ui\";\nimport React from \"react\";\n\nexport default function LegendCardHeader({\n\ttitle,\n\tcollapsible,\n\tonCollapse,\n}: {\n\ttitle: string;\n\tonCollapse?: () => void;\n\tcollapsible?: boolean;\n}) {\n\treturn (\n\t\t<div className=\"row w-100 space-between align-items-center\">\n\t\t\t<h4 style={{ margin: 0 }} className=\"legend-header\">\n\t\t\t\t{title}\n\t\t\t</h4>\n\t\t\t{collapsible && (\n\t\t\t\t<div onClick={onCollapse}>\n\t\t\t\t\t<IconLaunch16 />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../../../../../../../../../../src/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.tsx"],"names":[],"mappings":"AAaE,SASC,KATD;AAbF,SAAS,oBAAoB;AAGd,SAAR,iBAAkC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AACD,GAIG;AACF,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAO;AAAA,QACN,SAAS;AAAA,QACT,OAAO;AAAA,QACP,gBAAgB;AAAA,QAChB,YAAY;AAAA,QACZ,SAAS;AAAA,MACV;AAAA,MAEA;AAAA,4BAAC,QAAG,OAAO,EAAE,QAAQ,EAAE,GAAG,WAAU,iBAClC,iBACF;AAAA,QACC,eACA,oBAAC,SAAI,SAAS,YACb,8BAAC,gBAAa,GACf;AAAA;AAAA;AAAA,EAEF;AAEF","sourcesContent":["import { IconLaunch16 } from \"@dhis2/ui\";\nimport React from \"react\";\n\nexport default function LegendCardHeader({\n\ttitle,\n\tcollapsible,\n\tonCollapse,\n}: {\n\ttitle: string;\n\tonCollapse?: () => void;\n\tcollapsible?: boolean;\n}) {\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\twidth: \"100%\",\n\t\t\t\tjustifyContent: \"space-between\",\n\t\t\t\talignItems: \"center\",\n\t\t\t\tpadding: 8,\n\t\t\t}}\n\t\t>\n\t\t\t<h4 style={{ margin: 0 }} className=\"legend-header\">\n\t\t\t\t{title}\n\t\t\t</h4>\n\t\t\t{collapsible && (\n\t\t\t\t<div onClick={onCollapse}>\n\t\t\t\t\t<IconLaunch16 />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"]}
@@ -164,14 +164,25 @@ function LegendArea({
164
164
  layers.filter((layer) => layer.enabled).map(getLegendComponent)
165
165
  );
166
166
  const { position, collapsible } = legendConfig ?? {};
167
- return /* @__PURE__ */ jsx(CustomControl, { position, children: /* @__PURE__ */ jsx("div", { className: "column gap-16 align-items-end", children: legends?.map((legend, index) => /* @__PURE__ */ jsx(
168
- Legend,
167
+ return /* @__PURE__ */ jsx(CustomControl, { position, children: /* @__PURE__ */ jsx(
168
+ "div",
169
169
  {
170
- collapsible: collapsible ?? true,
171
- children: legend
172
- },
173
- `${index}-map-legend`
174
- )) }) });
170
+ style: {
171
+ display: "flex",
172
+ flexDirection: "column",
173
+ gap: 16,
174
+ alignItems: "flex-end"
175
+ },
176
+ children: legends?.map((legend, index) => /* @__PURE__ */ jsx(
177
+ Legend,
178
+ {
179
+ collapsible: collapsible ?? true,
180
+ children: legend
181
+ },
182
+ `${index}-map-legend`
183
+ ))
184
+ }
185
+ ) });
175
186
  }
176
187
 
177
188
  export { LegendArea as default };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/LegendArea/index.tsx"],"names":[],"mappings":"AA0BS,cAkGP,YAlGO;AA1BT,SAAS,QAAQ,cAAc,QAAQ,cAAc;AAErD,SAAS,SAAS,YAAY;AAC9B,OAAO,SAAS,WAAW,QAAQ,gBAAgB;AAEnD,SAAS,qBAAqB;AAC9B;AAAA,EAKC;AAAA,OACM;AACP,OAAO,iBAAiB;AACxB,OAAO,kBAAkB;AACzB,OAAO,sBAAsB;AAC7B,OAAO,uBAAuB;AAC9B,OAAO,aAAa;AACpB,SAAS,qBAAqB;AAE9B,MAAM,iBAAiB;AAEvB,SAAS,mBACR,OACC;AACD,MAAI,MAAM,SAAS,SAAS;AAC3B,WAAO,oBAAC,eAAY,MAAM,MAAM,OAAO;AAAA,EACxC;AAEA,MAAI,8BAA8B,SAAS,MAAM,IAAI,GAAG;AACvD,WACC;AAAA,MAAC;AAAA;AAAA,QACA,MAAM,MAAM,QAAQ;AAAA,QACpB;AAAA;AAAA,IACD;AAAA,EAEF;AAEA,QAAM,EAAE,MAAM,SAAS,SAAS,UAAU,MAAM,MAAM,QAAQ,IAC5D,SAAiC,CAAC;AAEpC,MAAI,CAAC,WAAW,CAAC,SAAS;AACzB,WAAO;AAAA,EACR;AACA,UAAQ,MAAM;AAAA,IACb,KAAK;AACJ,aACC;AAAA,QAAC;AAAA;AAAA,UACA,QACE,OAA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;AACV,GAMG;AACF,QAAM,UAAyB;AAAA,IAC9B,OAAO,OAAO,CAAC,UAAU,MAAM,OAAO,EAAE,IAAI,kBAAkB;AAAA,EAC/D;AACA,QAAM,EAAE,UAAU,YAAY,IAAI,gBAAgB,CAAC;AAEnD,SACC,oBAAC,iBAAc,UACd,8BAAC,SAAI,WAAU,iCACb,mBAAS,IAAI,CAAC,QAAa,UAC3B;AAAA,IAAC;AAAA;AAAA,MACA,aAAa,eAAe;AAAA,MAG3B;AAAA;AAAA,IAFI,GAAG,KAAK;AAAA,EAGd,CACA,GACF,GACD;AAEF","sourcesContent":["import { colors, IconLegend24, Popper, Portal } from \"@dhis2/ui\";\nimport { ControlPosition } from \"leaflet\";\nimport { compact, head } from \"lodash\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { MapLegendConfig } from \"../../../MapArea/interfaces/index.js\";\nimport { CustomControl } from \"../../../MapControls/components/CustomControl/index.js\";\nimport {\n\tCustomBubbleLayer,\n\tCustomGoogleEngineLayer,\n\tCustomPointLayer,\n\tCustomThematicLayer,\n\tSUPPORTED_EARTH_ENGINE_LAYERS,\n} from \"../../interfaces/index.js\";\nimport PointLegend from \"../PointLayer/components/PointLegend/index.js\";\nimport BubbleLegend from \"../ThematicLayer/components/Bubble/components/BubbleLegend/index.js\";\nimport ChoroplethLegend from \"../ThematicLayer/components/Choropleth/components/ChoroplethLegend.js\";\nimport EarthEngineLegend from \"../GoogleEngineLayer/components/EarthEngineLegend.js\";\nimport classes from \"./LegendArea.module.css\";\nimport { usePrintMedia } from \"../../../../hooks/map.js\";\n\nconst TOOLTIP_OFFSET = 4;\n\nfunction getLegendComponent(\n\tlayer: CustomThematicLayer | CustomPointLayer | CustomGoogleEngineLayer,\n) {\n\tif (layer.type === \"point\") {\n\t\treturn <PointLegend name={layer.label} />;\n\t}\n\n\tif (SUPPORTED_EARTH_ENGINE_LAYERS.includes(layer.type)) {\n\t\treturn (\n\t\t\t<EarthEngineLegend\n\t\t\t\tname={layer.name ?? \"\"}\n\t\t\t\tlayer={layer as CustomGoogleEngineLayer}\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst { type, enabled, control, dataItem, name, data, legends } =\n\t\t(layer as CustomThematicLayer) ?? {};\n\n\tif (!enabled || !control) {\n\t\treturn null;\n\t}\n\tswitch (type) {\n\t\tcase \"bubble\":\n\t\t\treturn (\n\t\t\t\t<BubbleLegend\n\t\t\t\t\tradius={\n\t\t\t\t\t\t(layer as CustomBubbleLayer)?.radius ?? {\n\t\t\t\t\t\t\tmin: 0,\n\t\t\t\t\t\t\tmax: 50,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlegends={legends ?? []}\n\t\t\t\t\tname={name ?? dataItem.displayName}\n\t\t\t\t\tdata={data}\n\t\t\t\t\tdataItem={head(data)?.dataItem ?? dataItem}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"choropleth\":\n\t\t\treturn (\n\t\t\t\t<ChoroplethLegend\n\t\t\t\t\tlegends={legends ?? []}\n\t\t\t\t\tname={name ?? dataItem.displayName}\n\t\t\t\t\tdata={data}\n\t\t\t\t\tdataItem={head(data)?.dataItem ?? dataItem}\n\t\t\t\t/>\n\t\t\t);\n\t}\n}\n\nfunction CollapsedLegendIcon({\n\tonCollapse,\n\tname,\n}: {\n\tname: string;\n\tonCollapse: () => void;\n}) {\n\tconst openDelay = 200;\n\tconst closeDelay = 200;\n\tconst [openTooltip, setOpenTooltip] = useState(false);\n\tconst openTimerRef = useRef<any>(null);\n\tconst closeTimerRef = useRef<any>(null);\n\tconst ref = useRef<HTMLDivElement>(null);\n\n\tconst hideModifier = { name: \"hide\" };\n\tconst offsetModifier = {\n\t\tname: \"offset\",\n\t\toptions: {\n\t\t\toffset: [0, TOOLTIP_OFFSET],\n\t\t},\n\t};\n\n\tconst flipModifier = {\n\t\tname: \"flip\",\n\t\toptions: { altBoundary: true },\n\t};\n\n\tconst onMouseOver = () => {\n\t\tclearTimeout(closeTimerRef.current);\n\n\t\topenTimerRef.current = setTimeout(() => {\n\t\t\tsetOpenTooltip(true);\n\t\t}, openDelay);\n\t};\n\n\tconst onMouseOut = () => {\n\t\tclearTimeout(openTimerRef.current);\n\n\t\tcloseTimerRef.current = setTimeout(() => {\n\t\t\tsetOpenTooltip(false);\n\t\t}, closeDelay);\n\t};\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tclearTimeout(openTimerRef.current);\n\t\t\tclearTimeout(closeTimerRef.current);\n\t\t},\n\t\t[],\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tonMouseOver={onMouseOver}\n\t\t\tonMouseOut={onMouseOut}\n\t\t\tonClick={onCollapse}\n\t\t\tstyle={{ width: 28, height: 28 }}\n\t\t\tclassName=\"legend-card collapsed\"\n\t\t>\n\t\t\t<IconLegend24 />\n\t\t\t{openTooltip && (\n\t\t\t\t<Portal\n\t\t\t\t\t/*\n\t\t\t // @ts-ignore */\n\t\t\t\t\tclassName={classes[\"map-tooltip\"]}\n\t\t\t\t>\n\t\t\t\t\t<Popper\n\t\t\t\t\t\tclassName={classes[\"map-tooltip\"]}\n\t\t\t\t\t\treference={ref}\n\t\t\t\t\t\t/*\n // @ts-ignore */\n\t\t\t\t\t\tmodifiers={[offsetModifier, flipModifier, hideModifier]}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tbackgroundColor: `${colors.grey900}`,\n\t\t\t\t\t\t\t\tborderRadius: 3,\n\t\t\t\t\t\t\t\tcolor: `${colors.white}`,\n\t\t\t\t\t\t\t\tpadding: \"4px 6px\",\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tdata-test={`content`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{name}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Popper>\n\t\t\t\t</Portal>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nfunction Legend({\n\tchildren,\n\tcollapsible,\n}: {\n\tchildren: React.ReactElement;\n\tcollapsible: boolean;\n}) {\n\tconst [collapsed, setCollapsed] = useState(collapsible);\n\tconst inPrintMode = usePrintMedia();\n\tconst onCollapse = () => {\n\t\tif (collapsible) {\n\t\t\tsetCollapsed((prevState) => !prevState);\n\t\t}\n\t};\n\n\tconst name = head(React.Children.toArray(children) as React.ReactElement[])\n\t\t?.props.name;\n\n\tconst shouldCollapse = collapsed && !inPrintMode;\n\n\treturn (\n\t\t<div className=\"w-100\">\n\t\t\t{shouldCollapse ? (\n\t\t\t\t<CollapsedLegendIcon name={name} onCollapse={onCollapse} />\n\t\t\t) : (\n\t\t\t\tReact.Children.map(children, (child) =>\n\t\t\t\t\tReact.cloneElement(child, { collapsible, onCollapse }),\n\t\t\t\t)\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nexport default function LegendArea({\n\tlayers,\n\tlegends: legendConfig,\n}: {\n\tlayers: Array<\n\t\tCustomThematicLayer | CustomPointLayer | CustomGoogleEngineLayer\n\t>;\n\tposition: ControlPosition;\n\tlegends?: MapLegendConfig;\n}) {\n\tconst legends: JSX.Element[] = compact(\n\t\tlayers.filter((layer) => layer.enabled).map(getLegendComponent),\n\t);\n\tconst { position, collapsible } = legendConfig ?? {};\n\n\treturn (\n\t\t<CustomControl position={position}>\n\t\t\t<div className=\"column gap-16 align-items-end\">\n\t\t\t\t{legends?.map((legend: any, index) => (\n\t\t\t\t\t<Legend\n\t\t\t\t\t\tcollapsible={collapsible ?? true}\n\t\t\t\t\t\tkey={`${index}-map-legend`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{legend}\n\t\t\t\t\t</Legend>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t</CustomControl>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/LegendArea/index.tsx"],"names":[],"mappings":"AA0BS,cAkGP,YAlGO;AA1BT,SAAS,QAAQ,cAAc,QAAQ,cAAc;AAErD,SAAS,SAAS,YAAY;A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dhis2/ui\";\nimport { ControlPosition } from \"leaflet\";\nimport { compact, head } from \"lodash\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { MapLegendConfig } from \"../../../MapArea/interfaces/index.js\";\nimport { CustomControl } from \"../../../MapControls/components/CustomControl/index.js\";\nimport {\n\tCustomBubbleLayer,\n\tCustomGoogleEngineLayer,\n\tCustomPointLayer,\n\tCustomThematicLayer,\n\tSUPPORTED_EARTH_ENGINE_LAYERS,\n} from \"../../interfaces/index.js\";\nimport PointLegend from \"../PointLayer/components/PointLegend/index.js\";\nimport BubbleLegend from \"../ThematicLayer/components/Bubble/components/BubbleLegend/index.js\";\nimport ChoroplethLegend from \"../ThematicLayer/components/Choropleth/components/ChoroplethLegend.js\";\nimport EarthEngineLegend from \"../GoogleEngineLayer/components/EarthEngineLegend.js\";\nimport classes from \"./LegendArea.module.css\";\nimport { usePrintMedia } from \"../../../../hooks/map.js\";\n\nconst TOOLTIP_OFFSET = 4;\n\nfunction getLegendComponent(\n\tlayer: CustomThematicLayer | CustomPointLayer | CustomGoogleEngineLayer,\n) {\n\tif (layer.type === \"point\") {\n\t\treturn <PointLegend name={layer.label} />;\n\t}\n\n\tif (SUPPORTED_EARTH_ENGINE_LAYERS.includes(layer.type)) {\n\t\treturn (\n\t\t\t<EarthEngineLegend\n\t\t\t\tname={layer.name ?? \"\"}\n\t\t\t\tlayer={layer as CustomGoogleEngineLayer}\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst { type, enabled, control, dataItem, name, data, legends } =\n\t\t(layer as CustomThematicLayer) ?? {};\n\n\tif (!enabled || !control) {\n\t\treturn null;\n\t}\n\tswitch (type) {\n\t\tcase \"bubble\":\n\t\t\treturn (\n\t\t\t\t<BubbleLegend\n\t\t\t\t\tradius={\n\t\t\t\t\t\t(layer as CustomBubbleLayer)?.radius ?? {\n\t\t\t\t\t\t\tmin: 0,\n\t\t\t\t\t\t\tmax: 50,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlegends={legends ?? []}\n\t\t\t\t\tname={name ?? dataItem.displayName}\n\t\t\t\t\tdata={data}\n\t\t\t\t\tdataItem={head(data)?.dataItem ?? dataItem}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"choropleth\":\n\t\t\treturn (\n\t\t\t\t<ChoroplethLegend\n\t\t\t\t\tlegends={legends ?? []}\n\t\t\t\t\tname={name ?? dataItem.displayName}\n\t\t\t\t\tdata={data}\n\t\t\t\t\tdataItem={head(data)?.dataItem ?? dataItem}\n\t\t\t\t/>\n\t\t\t);\n\t}\n}\n\nfunction CollapsedLegendIcon({\n\tonCollapse,\n\tname,\n}: {\n\tname: string;\n\tonCollapse: () => void;\n}) {\n\tconst openDelay = 200;\n\tconst closeDelay = 200;\n\tconst [openTooltip, setOpenTooltip] = useState(false);\n\tconst openTimerRef = useRef<any>(null);\n\tconst closeTimerRef = useRef<any>(null);\n\tconst ref = useRef<HTMLDivElement>(null);\n\n\tconst hideModifier = { name: \"hide\" };\n\tconst offsetModifier = {\n\t\tname: \"offset\",\n\t\toptions: {\n\t\t\toffset: [0, TOOLTIP_OFFSET],\n\t\t},\n\t};\n\n\tconst flipModifier = {\n\t\tname: \"flip\",\n\t\toptions: { altBoundary: true },\n\t};\n\n\tconst onMouseOver = () => {\n\t\tclearTimeout(closeTimerRef.current);\n\n\t\topenTimerRef.current = setTimeout(() => {\n\t\t\tsetOpenTooltip(true);\n\t\t}, openDelay);\n\t};\n\n\tconst onMouseOut = () => {\n\t\tclearTimeout(openTimerRef.current);\n\n\t\tcloseTimerRef.current = setTimeout(() => {\n\t\t\tsetOpenTooltip(false);\n\t\t}, closeDelay);\n\t};\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tclearTimeout(openTimerRef.current);\n\t\t\tclearTimeout(closeTimerRef.current);\n\t\t},\n\t\t[],\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tonMouseOver={onMouseOver}\n\t\t\tonMouseOut={onMouseOut}\n\t\t\tonClick={onCollapse}\n\t\t\tstyle={{ width: 28, height: 28 }}\n\t\t\tclassName=\"legend-card collapsed\"\n\t\t>\n\t\t\t<IconLegend24 />\n\t\t\t{openTooltip && (\n\t\t\t\t<Portal\n\t\t\t\t\t/*\n\t\t\t // @ts-ignore */\n\t\t\t\t\tclassName={classes[\"map-tooltip\"]}\n\t\t\t\t>\n\t\t\t\t\t<Popper\n\t\t\t\t\t\tclassName={classes[\"map-tooltip\"]}\n\t\t\t\t\t\treference={ref}\n\t\t\t\t\t\t/*\n // @ts-ignore */\n\t\t\t\t\t\tmodifiers={[offsetModifier, flipModifier, hideModifier]}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tbackgroundColor: `${colors.grey900}`,\n\t\t\t\t\t\t\t\tborderRadius: 3,\n\t\t\t\t\t\t\t\tcolor: `${colors.white}`,\n\t\t\t\t\t\t\t\tpadding: \"4px 6px\",\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tdata-test={`content`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{name}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Popper>\n\t\t\t\t</Portal>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nfunction Legend({\n\tchildren,\n\tcollapsible,\n}: {\n\tchildren: React.ReactElement;\n\tcollapsible: boolean;\n}) {\n\tconst [collapsed, setCollapsed] = useState(collapsible);\n\tconst inPrintMode = usePrintMedia();\n\tconst onCollapse = () => {\n\t\tif (collapsible) {\n\t\t\tsetCollapsed((prevState) => !prevState);\n\t\t}\n\t};\n\n\tconst name = head(React.Children.toArray(children) as React.ReactElement[])\n\t\t?.props.name;\n\n\tconst shouldCollapse = collapsed && !inPrintMode;\n\n\treturn (\n\t\t<div className=\"w-100\">\n\t\t\t{shouldCollapse ? (\n\t\t\t\t<CollapsedLegendIcon name={name} onCollapse={onCollapse} />\n\t\t\t) : (\n\t\t\t\tReact.Children.map(children, (child) =>\n\t\t\t\t\tReact.cloneElement(child, { collapsible, onCollapse }),\n\t\t\t\t)\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nexport default function LegendArea({\n\tlayers,\n\tlegends: legendConfig,\n}: {\n\tlayers: Array<\n\t\tCustomThematicLayer | CustomPointLayer | CustomGoogleEngineLayer\n\t>;\n\tposition: ControlPosition;\n\tlegends?: MapLegendConfig;\n}) {\n\tconst legends: JSX.Element[] = compact(\n\t\tlayers.filter((layer) => layer.enabled).map(getLegendComponent),\n\t);\n\tconst { position, collapsible } = legendConfig ?? {};\n\n\treturn (\n\t\t<CustomControl position={position}>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\tflexDirection: \"column\",\n\t\t\t\t\tgap: 16,\n\t\t\t\t\talignItems: \"flex-end\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{legends?.map((legend: any, index) => (\n\t\t\t\t\t<Legend\n\t\t\t\t\t\tcollapsible={collapsible ?? true}\n\t\t\t\t\t\tkey={`${index}-map-legend`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{legend}\n\t\t\t\t\t</Legend>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t</CustomControl>\n\t);\n}\n"]}
@@ -5,6 +5,7 @@ import { forwardRef } from 'react';
5
5
  import { getIconUrl } from '../../../../../../utils/helpers.js';
6
6
  import LegendCardHeader from '../../../LegendArea/components/LegendCardHeader/index.js';
7
7
  import { usePointLayer } from '../../hooks/index.js';
8
+ import i18n from '@dhis2/d2-i18n';
8
9
 
9
10
  function PointLegends({
10
11
  orgUnitGroups,
@@ -15,12 +16,23 @@ function PointLegends({
15
16
  return /* @__PURE__ */ jsxs(
16
17
  "div",
17
18
  {
18
- style: { minWidth: 100, alignItems: "flex-start" },
19
- className: "w-100 p-8 legend-list column",
19
+ style: {
20
+ minWidth: 100,
21
+ alignItems: "flex-start",
22
+ width: "100%",
23
+ padding: 8,
24
+ display: "flex",
25
+ flexDirection: "column"
26
+ },
20
27
  children: [
21
28
  icon && /* @__PURE__ */ jsxs(
22
29
  "div",
23
30
  {
31
+ style: {
32
+ display: "flex",
33
+ gap: 16,
34
+ alignItems: "center"
35
+ },
24
36
  className: "row gap-16 align-items-center",
25
37
  children: [
26
38
  /* @__PURE__ */ jsx(
@@ -71,7 +83,7 @@ function PointLegend({ collapsible, onCollapse }, ref) {
71
83
  {
72
84
  collapsible,
73
85
  onCollapse,
74
- title: label ?? "Points"
86
+ title: label ?? i18n.t("Points")
75
87
  }
76
88
  ),
77
89
  /* @__PURE__ */ jsx(Divider, { margin: "0" }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../../src/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.tsx"],"names":["name"],"mappings":"AAwBI,SAIC,KAJD;AAxBJ,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAgB,kBAAkB;AAClC,SAAS,kBAAkB;AAC3B,OAAO,sBAAsB;AAC7B,SAAS,qBAAqB;AAE9B,SAAS,aAAa;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AACD,GAIG;AACF,QAAM,EAAE,QAAQ,IAAI,UAAU;AAE9B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAO,EAAE,UAAU,KAAK,YAAY,aAAa;AAAA,MACjD,WAAU;AAAA,MAET;AAAA,gBACA;AAAA,UAAC;AAAA;AAAA,YAEA,WAAU;AAAA,YAEV;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACA,QAAQ;AAAA,kBACR,OAAO;AAAA,kBACP,KAAK,GAAG,IAAI;AAAA,kBACZ,KAAK,WAAW,MAAM,EAAE,QAAQ,CAAC;AAAA;AAAA,cAClC;AAAA,cACA,oBAAC,OAAG,iBAAM;AAAA;AAAA;AAAA,UATL,GAAG,IAAI;AAAA,QAUb;AAAA,QAEA,cAAc,IAAI,CAAC,EAAE,MAAAA,OAAM,OAAO,MAAM;AACxC,iBACC;AAAA,YAAC;AAAA;AAAA,cAEA,WAAU;AAAA,cAEV;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACA,QAAQ;AAAA,oBACR,OAAO;AAAA,oBACP,KAAK,GAAGA,KAAI;AAAA,oBACZ,KAAK,WAAW,UAAU,IAAI,EAAE,QAAQ,CAAC;AAAA;AAAA,gBAC1C;AAAA,gBACA,oBAAC,OAAG,UAAAA,OAAK;AAAA;AAAA;AAAA,YATJ,GAAGA,KAAI;AAAA,UAUb;AAAA,QAEF,CAAC;AAAA;AAAA;AAAA,EACF;AAEF;AAEA,SAAS,YACR,EAAE,aAAa,WAAW,GAC1B,KACC;AACD,QAAM,aAAa,cAAc;AACjC,QAAM,EAAE,OAAO,MAAM,IAAI,cAAc,CAAC;AAExC,SACC,qBAAC,SAAI,KAAU,WAAU,eACxB;AAAA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO,SAAS;AAAA;AAAA,IACjB;AAAA,IACA,oBAAC,WAAQ,QAAQ,KAAK;AAAA,IACtB;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,eAAe,OAAO,iBAAiB,CAAC;AAAA,QACxC,MAAM,OAAO;AAAA;AAAA,IACd;AAAA,KACD;AAEF;AAEA,IAAO,sBAAQ,WAAW,WAAW","sourcesContent":["import { useConfig } from \"@dhis2/app-runtime\";\nimport { Divider } from \"@dhis2/ui\";\nimport React, { forwardRef } from \"react\";\nimport { getIconUrl } from \"../../../../../../utils/helpers.js\";\nimport LegendCardHeader from \"../../../LegendArea/components/LegendCardHeader/index.js\";\nimport { usePointLayer } from \"../../hooks/index.js\";\n\nfunction PointLegends({\n\torgUnitGroups,\n\ticon,\n\tlabel,\n}: {\n\torgUnitGroups: { name: string; symbol: string }[];\n\ticon?: string;\n\tlabel?: string;\n}) {\n\tconst { baseUrl } = useConfig();\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{ minWidth: 100, alignItems: \"flex-start\" }}\n\t\t\tclassName=\"w-100 p-8 legend-list column\"\n\t\t>\n\t\t\t{icon && (\n\t\t\t\t<div\n\t\t\t\t\tkey={`${icon}-legend`}\n\t\t\t\t\tclassName=\"row gap-16 align-items-center\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\theight={20}\n\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\talt={`${name}-icon`}\n\t\t\t\t\t\tsrc={getIconUrl(icon, { baseUrl })}\n\t\t\t\t\t/>\n\t\t\t\t\t<p>{label}</p>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{orgUnitGroups.map(({ name, symbol }) => {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={`${name}-legend`}\n\t\t\t\t\t\tclassName=\"row gap-16 align-items-center\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\t\talt={`${name}-icon`}\n\t\t\t\t\t\t\tsrc={getIconUrl(symbol ?? \"\", { baseUrl })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<p>{name}</p>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t})}\n\t\t</div>\n\t);\n}\n\nfunction PointLegend(\n\t{ collapsible, onCollapse }: any,\n\tref: React.LegacyRef<HTMLDivElement>,\n) {\n\tconst pointLayer = usePointLayer();\n\tconst { label, style } = pointLayer ?? {};\n\n\treturn (\n\t\t<div ref={ref} className=\"legend-card\">\n\t\t\t<LegendCardHeader\n\t\t\t\tcollapsible={collapsible}\n\t\t\t\tonCollapse={onCollapse}\n\t\t\t\ttitle={label ?? \"Points\"}\n\t\t\t/>\n\t\t\t<Divider margin={\"0\"} />\n\t\t\t<PointLegends\n\t\t\t\tlabel={label}\n\t\t\t\torgUnitGroups={style?.orgUnitGroups ?? []}\n\t\t\t\ticon={style?.icon}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default forwardRef(PointLegend);\n"]}
1
+ {"version":3,"sources":["../../../../../../../../../../src/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.tsx"],"names":["name"],"mappings":"AA+BI,SASC,KATD;AA/BJ,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAgB,kBAAkB;AAClC,SAAS,kBAAkB;AAC3B,OAAO,sBAAsB;AAC7B,SAAS,qBAAqB;AAC9B,OAAO,UAAU;AAEjB,SAAS,aAAa;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AACD,GAIG;AACF,QAAM,EAAE,QAAQ,IAAI,UAAU;AAE9B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAO;AAAA,QACN,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,OAAO;AAAA,QACP,SAAS;AAAA,QACT,SAAS;AAAA,QACT,eAAe;AAAA,MAChB;AAAA,MAEC;AAAA,gBACA;AAAA,UAAC;AAAA;AAAA,YAEA,OAAO;AAAA,cACN,SAAS;AAAA,cACT,KAAK;AAAA,cACL,YAAY;AAAA,YACb;AAAA,YACA,WAAU;AAAA,YAEV;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACA,QAAQ;AAAA,kBACR,OAAO;AAAA,kBACP,KAAK,GAAG,IAAI;AAAA,kBACZ,KAAK,WAAW,MAAM,EAAE,QAAQ,CAAC;AAAA;AAAA,cAClC;AAAA,cACA,oBAAC,OAAG,iBAAM;AAAA;AAAA;AAAA,UAdL,GAAG,IAAI;AAAA,QAeb;AAAA,QAEA,cAAc,IAAI,CAAC,EAAE,MAAAA,OAAM,OAAO,MAAM;AACxC,iBACC;AAAA,YAAC;AAAA;AAAA,cAEA,WAAU;AAAA,cAEV;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACA,QAAQ;AAAA,oBACR,OAAO;AAAA,oBACP,KAAK,GAAGA,KAAI;AAAA,oBACZ,KAAK,WAAW,UAAU,IAAI,EAAE,QAAQ,CAAC;AAAA;AAAA,gBAC1C;AAAA,gBACA,oBAAC,OAAG,UAAAA,OAAK;AAAA;AAAA;AAAA,YATJ,GAAGA,KAAI;AAAA,UAUb;AAAA,QAEF,CAAC;AAAA;AAAA;AAAA,EACF;AAEF;AAEA,SAAS,YACR,EAAE,aAAa,WAAW,GAC1B,KACC;AACD,QAAM,aAAa,cAAc;AACjC,QAAM,EAAE,OAAO,MAAM,IAAI,cAAc,CAAC;AAExC,SACC,qBAAC,SAAI,KAAU,WAAU,eACxB;AAAA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO,SAAS,KAAK,EAAE,QAAQ;AAAA;AAAA,IAChC;AAAA,IACA,oBAAC,WAAQ,QAAQ,KAAK;AAAA,IACtB;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,eAAe,OAAO,iBAAiB,CAAC;AAAA,QACxC,MAAM,OAAO;AAAA;AAAA,IACd;AAAA,KACD;AAEF;AAEA,IAAO,sBAAQ,WAAW,WAAW","sourcesContent":["import { useConfig } from \"@dhis2/app-runtime\";\nimport { Divider } from \"@dhis2/ui\";\nimport React, { forwardRef } from \"react\";\nimport { getIconUrl } from \"../../../../../../utils/helpers.js\";\nimport LegendCardHeader from \"../../../LegendArea/components/LegendCardHeader/index.js\";\nimport { usePointLayer } from \"../../hooks/index.js\";\nimport i18n from \"@dhis2/d2-i18n\";\n\nfunction PointLegends({\n\torgUnitGroups,\n\ticon,\n\tlabel,\n}: {\n\torgUnitGroups: { name: string; symbol: string }[];\n\ticon?: string;\n\tlabel?: string;\n}) {\n\tconst { baseUrl } = useConfig();\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tminWidth: 100,\n\t\t\t\talignItems: \"flex-start\",\n\t\t\t\twidth: \"100%\",\n\t\t\t\tpadding: 8,\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tflexDirection: \"column\",\n\t\t\t}}\n\t\t>\n\t\t\t{icon && (\n\t\t\t\t<div\n\t\t\t\t\tkey={`${icon}-legend`}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\t\tgap: 16,\n\t\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\t}}\n\t\t\t\t\tclassName=\"row gap-16 align-items-center\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\theight={20}\n\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\talt={`${name}-icon`}\n\t\t\t\t\t\tsrc={getIconUrl(icon, { baseUrl })}\n\t\t\t\t\t/>\n\t\t\t\t\t<p>{label}</p>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{orgUnitGroups.map(({ name, symbol }) => {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={`${name}-legend`}\n\t\t\t\t\t\tclassName=\"row gap-16 align-items-center\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\twidth={20}\n\t\t\t\t\t\t\talt={`${name}-icon`}\n\t\t\t\t\t\t\tsrc={getIconUrl(symbol ?? \"\", { baseUrl })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<p>{name}</p>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t})}\n\t\t</div>\n\t);\n}\n\nfunction PointLegend(\n\t{ collapsible, onCollapse }: any,\n\tref: React.LegacyRef<HTMLDivElement>,\n) {\n\tconst pointLayer = usePointLayer();\n\tconst { label, style } = pointLayer ?? {};\n\n\treturn (\n\t\t<div ref={ref} className=\"legend-card\">\n\t\t\t<LegendCardHeader\n\t\t\t\tcollapsible={collapsible}\n\t\t\t\tonCollapse={onCollapse}\n\t\t\t\ttitle={label ?? i18n.t(\"Points\")}\n\t\t\t/>\n\t\t\t<Divider margin={\"0\"} />\n\t\t\t<PointLegends\n\t\t\t\tlabel={label}\n\t\t\t\torgUnitGroups={style?.orgUnitGroups ?? []}\n\t\t\t\ticon={style?.icon}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default forwardRef(PointLegend);\n"]}
@@ -8,7 +8,14 @@ import { usePointLayer } from './hooks/index.js';
8
8
 
9
9
  function PointLayer() {
10
10
  const pointLayer = usePointLayer();
11
- const { enabled, label, points: orgUnits, style } = pointLayer ?? {};
11
+ const {
12
+ enabled,
13
+ label,
14
+ points: orgUnits,
15
+ style,
16
+ customEventHandlers,
17
+ onLayerClick
18
+ } = pointLayer ?? {};
12
19
  const { baseUrl } = useConfig();
13
20
  return /* @__PURE__ */ jsx(
14
21
  LayersControl.Overlay,
@@ -29,6 +36,14 @@ function PointLayer() {
29
36
  )
30
37
  });
31
38
  },
39
+ eventHandlers: {
40
+ ...customEventHandlers ?? {},
41
+ mousedown: (e) => {
42
+ if (onLayerClick) {
43
+ onLayerClick(e, { orgUnit: area });
44
+ }
45
+ }
46
+ },
32
47
  data: area.geoJSON,
33
48
  interactive: true,
34
49
  children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/PointLayer/index.tsx"],"names":[],"mappings":"AA2BM,SAeC,KAfD;AA3BN,SAAS,iBAAiB;AAC1B,OAAO,UAAU;AACjB,OAAO,OAAO;AAEd;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,SAAS,SAAS,kBAAkB;AACpC,SAAS,qBAAqB;AAEvB,SAAS,aAAa;AAC5B,QAAM,aAAa,cAAc;AACjC,QAAM,EAAE,SAAS,OAAO,QAAQ,UAAU,MAAM,IAAI,cAAc,CAAC;AACnE,QAAM,EAAE,QAAQ,IAAI,UAAU;AAC9B,SACC;AAAA,IAAC,cAAc;AAAA,IAAd;AAAA,MACA,SAAS;AAAA,MACT,MAAM,SAAS,KAAK,EAAE,QAAQ;AAAA,MAE9B,8BAAC,cACC,oBAAU,IAAI,CAAC,SAAuB;AACtC,eACC;AAAA,UAAC;AAAA;AAAA,YACA,cAAc,CAAC,GAAG,gBAAgB;AACjC,qBAAO,EAAE,OAAO,aAAa;AAAA,gBAC5B,MAAM;AAAA,kBACL;AAAA,oBACC,KAAK,KAAK,QAAQ,OAAO;AAAA,oBACzB,EAAE,QAAQ;AAAA,kBACX;AAAA,gBACD;AAAA,cACD,CAAC;AAAA,YACF;AAAA,YACA,MAAM,KAAK;AAAA,YACX,aAAW;AAAA,YAGX;AAAA,kCAAC,WAAS,eAAK,MAAK;AAAA,cACpB,oBAAC,SAAM,UAAU,IAChB,8BAAC,QAAI,eAAK,MAAK,GAChB;AAAA;AAAA;AAAA,UALK,GAAG,KAAK,EAAE;AAAA,QAMhB;AAAA,MAEF,CAAC,GACF;AAAA;AAAA,EACD;AAEF","sourcesContent":["import { useConfig } from \"@dhis2/app-runtime\";\nimport i18n from \"@dhis2/d2-i18n\";\nimport L from \"leaflet\";\nimport React from \"react\";\nimport {\n\tGeoJSON,\n\tLayerGroup,\n\tLayersControl,\n\tPopup,\n\tTooltip,\n} from \"react-leaflet\";\nimport { PointOrgUnit } from \"../../../../interfaces/index.js\";\nimport { getIcon, getIconUrl } from \"../../../../utils/helpers.js\";\nimport { usePointLayer } from \"./hooks/index.js\";\n\nexport function PointLayer() {\n\tconst pointLayer = usePointLayer();\n\tconst { enabled, label, points: orgUnits, style } = pointLayer ?? {};\n\tconst { baseUrl } = useConfig();\n\treturn (\n\t\t<LayersControl.Overlay\n\t\t\tchecked={enabled}\n\t\t\tname={label ?? i18n.t(\"Points\")}\n\t\t>\n\t\t\t<LayerGroup>\n\t\t\t\t{orgUnits?.map((area: PointOrgUnit) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<GeoJSON\n\t\t\t\t\t\t\tpointToLayer={(_, coordinates) => {\n\t\t\t\t\t\t\t\treturn L.marker(coordinates, {\n\t\t\t\t\t\t\t\t\ticon: getIcon(\n\t\t\t\t\t\t\t\t\t\tgetIconUrl(\n\t\t\t\t\t\t\t\t\t\t\tarea.icon.icon ?? style?.icon,\n\t\t\t\t\t\t\t\t\t\t\t{ baseUrl },\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tdata={area.geoJSON}\n\t\t\t\t\t\t\tinteractive\n\t\t\t\t\t\t\tkey={`${area.id}-polygon`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip>{area.name}</Tooltip>\n\t\t\t\t\t\t\t<Popup minWidth={80}>\n\t\t\t\t\t\t\t\t<h3>{area.name}</h3>\n\t\t\t\t\t\t\t</Popup>\n\t\t\t\t\t\t</GeoJSON>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</LayerGroup>\n\t\t</LayersControl.Overlay>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../../../../../../../../src/components/Map/components/MapLayer/components/PointLayer/index.tsx"],"names":[],"mappings":"AAkCM,SAuBC,KAvBD;AAlCN,SAAS,iBAAiB;AAC1B,OAAO,UAAU;AACjB,OAAO,OAAO;AAEd;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,SAAS,SAAS,kBAAkB;AACpC,SAAS,qBAAqB;AAEvB,SAAS,aAAa;AAC5B,QAAM,aAAa,cAAc;AACjC,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,cAAc,CAAC;AACnB,QAAM,EAAE,QAAQ,IAAI,UAAU;AAC9B,SACC;AAAA,IAAC,cAAc;AAAA,IAAd;AAAA,MACA,SAAS;AAAA,MACT,MAAM,SAAS,KAAK,EAAE,QAAQ;AAAA,MAE9B,8BAAC,cACC,oBAAU,IAAI,CAAC,SAAuB;AACtC,eACC;AAAA,UAAC;AAAA;AAAA,YACA,cAAc,CAAC,GAAG,gBAAgB;AACjC,qBAAO,EAAE,OAAO,aAAa;AAAA,gBAC5B,MAAM;AAAA,kBACL;AAAA,oBACC,KAAK,KAAK,QAAQ,OAAO;AAAA,oBACzB,EAAE,QAAQ;AAAA,kBACX;AAAA,gBACD;AAAA,cACD,CAAC;AAAA,YACF;AAAA,YACA,eAAe;AAAA,cACd,GAAI,uBAAuB,CAAC;AAAA,cAC5B,WAAW,CAAC,MAAM;AACjB,oBAAI,cAAc;AACjB,+BAAa,GAAG,EAAE,SAAS,KAAK,CAAC;AAAA,gBAClC;AAAA,cACD;AAAA,YACD;AAAA,YACA,MAAM,KAAK;AAAA,YACX,aAAW;AAAA,YAGX;AAAA,kCAAC,WAAS,eAAK,MAAK;AAAA,cACpB,oBAAC,SAAM,UAAU,IAChB,8BAAC,QAAI,eAAK,MAAK,GAChB;AAAA;AAAA;AAAA,UALK,GAAG,KAAK,EAAE;AAAA,QAMhB;AAAA,MAEF,CAAC,GACF;AAAA;AAAA,EACD;AAEF","sourcesContent":["import { useConfig } from \"@dhis2/app-runtime\";\nimport i18n from \"@dhis2/d2-i18n\";\nimport L from \"leaflet\";\nimport React from \"react\";\nimport {\n\tGeoJSON,\n\tLayerGroup,\n\tLayersControl,\n\tPopup,\n\tTooltip,\n} from \"react-leaflet\";\nimport { PointOrgUnit } from \"../../../../interfaces/index.js\";\nimport { getIcon, getIconUrl } from \"../../../../utils/helpers.js\";\nimport { usePointLayer } from \"./hooks/index.js\";\n\nexport function PointLayer() {\n\tconst pointLayer = usePointLayer();\n\tconst {\n\t\tenabled,\n\t\tlabel,\n\t\tpoints: orgUnits,\n\t\tstyle,\n\t\tcustomEventHandlers,\n\t\tonLayerClick,\n\t} = pointLayer ?? {};\n\tconst { baseUrl } = useConfig();\n\treturn (\n\t\t<LayersControl.Overlay\n\t\t\tchecked={enabled}\n\t\t\tname={label ?? i18n.t(\"Points\")}\n\t\t>\n\t\t\t<LayerGroup>\n\t\t\t\t{orgUnits?.map((area: PointOrgUnit) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<GeoJSON\n\t\t\t\t\t\t\tpointToLayer={(_, coordinates) => {\n\t\t\t\t\t\t\t\treturn L.marker(coordinates, {\n\t\t\t\t\t\t\t\t\ticon: getIcon(\n\t\t\t\t\t\t\t\t\t\tgetIconUrl(\n\t\t\t\t\t\t\t\t\t\t\tarea.icon.icon ?? style?.icon,\n\t\t\t\t\t\t\t\t\t\t\t{ baseUrl },\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\teventHandlers={{\n\t\t\t\t\t\t\t\t...(customEventHandlers ?? {}),\n\t\t\t\t\t\t\t\tmousedown: (e) => {\n\t\t\t\t\t\t\t\t\tif (onLayerClick) {\n\t\t\t\t\t\t\t\t\t\tonLayerClick(e, { orgUnit: area });\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tdata={area.geoJSON}\n\t\t\t\t\t\t\tinteractive\n\t\t\t\t\t\t\tkey={`${area.id}-polygon`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip>{area.name}</Tooltip>\n\t\t\t\t\t\t\t<Popup minWidth={80}>\n\t\t\t\t\t\t\t\t<h3>{area.name}</h3>\n\t\t\t\t\t\t\t</Popup>\n\t\t\t\t\t\t</GeoJSON>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</LayerGroup>\n\t\t</LayersControl.Overlay>\n\t);\n}\n"]}
@@ -16,7 +16,9 @@ function Bubble({
16
16
  data,
17
17
  highestData,
18
18
  legends,
19
- radius
19
+ radius,
20
+ customEventHandlers,
21
+ onLayerClick
20
22
  }) {
21
23
  const { orgUnit, data: value } = data ?? {};
22
24
  const geoJSONObject = orgUnit.geoJSON;
@@ -30,7 +32,13 @@ function Bubble({
30
32
  interactive: true,
31
33
  eventHandlers: {
32
34
  mouseover: (e) => highlightFeature(e, highlightStyle),
33
- mouseout: (e) => resetHighlight(e, defaultStyle)
35
+ mouseout: (e) => resetHighlight(e, defaultStyle),
36
+ ...customEventHandlers ?? {},
37
+ mousedown: (e) => {
38
+ if (onLayerClick) {
39
+ onLayerClick(e, data);
40
+ }
41
+ }
34
42
  },
35
43
  pathOptions: {
36
44
  fillColor: getColorFromLegendSet(legends, data.data),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../../src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.tsx"],"names":[],"mappings":"AAyCE,mBAgBE,WAhBF;AAzCF,SAAS,cAAc;AAEvB,SAAS,eAAe;AACxB,SAAgB,eAAe;AAC/B,SAAS,oBAAoB;AAC7B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,OAAO,mBAAmB;AAE1B,MAAM,eAAe;AAAA,EACpB,QAAQ;AACT;AACA,MAAM,iBAAiB;AAAA,EACtB,QAAQ;AACT;AAEe,SAAR,OAAwB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAKG;AACF,QAAM,EAAE,SAAS,MAAM,MAAM,IAAI,QAAQ,CAAC;AAE1C,QAAM,gBAAgB,QAAQ;AAC9B,QAAM,SAAS,QAAQ,aAAa,EAAE,UAAU,EAAE,UAAU;AAE5D,QAAM,eAAe,QAAQ,MAAM;AAClC,YAAS,SAAS,MAAM,QAAQ,OAAO,MAAO;AAAA,EAC/C,GAAG,CAAC,QAAQ,MAAM,WAAW,CAAC;AAE9B,SACC,gCACC;AAAA,IAAC;AAAA;AAAA,MACA,aAAW;AAAA,MACX,eAAe;AAAA,QACd,WAAW,CAAC,MAAM,iBAAiB,GAAG,cAAc;AAAA,QACpD,UAAU,CAAC,MAAM,eAAe,GAAG,YAAY;AAAA,MAChD;AAAA,MACA,aAAa;AAAA,QACZ,WAAW,sBAAsB,SAAS,KAAK,IAAI;AAAA,QACnD,aAAa;AAAA,QACb,OAAO,OAAO;AAAA,QACd,QAAQ;AAAA,MACT;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MAEA,8BAAC,iBAAc,MAAY;AAAA;AAAA,EAC5B,GACD;AAEF","sourcesContent":["import { colors } from \"@dhis2/ui\";\nimport type { Legend } from \"@hisptz/dhis2-utils\";\nimport { geoJSON } from \"leaflet\";\nimport React, { useMemo } from \"react\";\nimport { CircleMarker } from \"react-leaflet\";\nimport {\n\tgetColorFromLegendSet,\n\thighlightFeature,\n\tresetHighlight,\n} from \"../../../../../../utils/map.js\";\nimport { ThematicLayerData } from \"../../../../interfaces/index.js\";\nimport CustomTooltip from \"../CustomTooltip/index.js\";\n\nconst defaultStyle = {\n\tweight: 1,\n};\nconst highlightStyle = {\n\tweight: 2,\n};\n\nexport default function Bubble({\n\tdata,\n\thighestData,\n\tlegends,\n\tradius,\n}: {\n\tdata: ThematicLayerData;\n\thighestData: number;\n\tlegends: Legend[];\n\tradius?: { min: number; max: number };\n}) {\n\tconst { orgUnit, data: value } = data ?? {};\n\n\tconst geoJSONObject = orgUnit.geoJSON;\n\tconst center = geoJSON(geoJSONObject).getBounds().getCenter();\n\n\tconst circleRadius = useMemo(() => {\n\t\treturn ((value ?? 0) * (radius?.max ?? 50)) / highestData;\n\t}, [radius, data, highestData]);\n\n\treturn (\n\t\t<>\n\t\t\t<CircleMarker\n\t\t\t\tinteractive\n\t\t\t\teventHandlers={{\n\t\t\t\t\tmouseover: (e) => highlightFeature(e, highlightStyle),\n\t\t\t\t\tmouseout: (e) => resetHighlight(e, defaultStyle),\n\t\t\t\t}}\n\t\t\t\tpathOptions={{\n\t\t\t\t\tfillColor: getColorFromLegendSet(legends, data.data),\n\t\t\t\t\tfillOpacity: 1,\n\t\t\t\t\tcolor: colors.grey900,\n\t\t\t\t\tweight: 1,\n\t\t\t\t}}\n\t\t\t\tradius={circleRadius}\n\t\t\t\tcenter={center}\n\t\t\t>\n\t\t\t\t<CustomTooltip data={data} />\n\t\t\t</CircleMarker>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../../../../../../../../../../src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.tsx"],"names":[],"mappings":"AA2D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n\tgeoJSON,\n\ttype LeafletEventHandlerFnMap,\n\ttype LeafletMouseEvent,\n} from \"leaflet\";\nimport React, { useMemo } from \"react\";\nimport { CircleMarker } from \"react-leaflet\";\nimport {\n\tgetColorFromLegendSet,\n\thighlightFeature,\n\tresetHighlight,\n} from \"../../../../../../utils/map.js\";\nimport {\n\tThematicLayerData,\n\tThematicLayerDataItem,\n} from \"../../../../interfaces/index.js\";\nimport CustomTooltip from \"../CustomTooltip/index.js\";\nimport { MapOrgUnit } from \"../../../../../../interfaces/index.js\";\n\nconst defaultStyle = {\n\tweight: 1,\n};\nconst highlightStyle = {\n\tweight: 2,\n};\n\ninterface LayerData {\n\torgUnit: MapOrgUnit;\n\tdata?: number;\n\tdataItem: ThematicLayerDataItem;\n}\n\nexport default function Bubble({\n\tdata,\n\thighestData,\n\tlegends,\n\tradius,\n\tcustomEventHandlers,\n\tonLayerClick,\n}: {\n\tdata: ThematicLayerData;\n\thighestData: number;\n\tlegends: Legend[];\n\tradius?: { min: number; max: number };\n\tcustomEventHandlers?: LeafletEventHandlerFnMap;\n\tonLayerClick?: (e: LeafletMouseEvent, data: LayerData) => void;\n}) {\n\tconst { orgUnit, data: value } = data ?? {};\n\n\tconst geoJSONObject = orgUnit.geoJSON;\n\tconst center = geoJSON(geoJSONObject).getBounds().getCenter();\n\n\tconst circleRadius = useMemo(() => {\n\t\treturn ((value ?? 0) * (radius?.max ?? 50)) / highestData;\n\t}, [radius, data, highestData]);\n\n\treturn (\n\t\t<>\n\t\t\t<CircleMarker\n\t\t\t\tinteractive\n\t\t\t\teventHandlers={{\n\t\t\t\t\tmouseover: (e) => highlightFeature(e, highlightStyle),\n\t\t\t\t\tmouseout: (e) => resetHighlight(e, defaultStyle),\n\t\t\t\t\t...(customEventHandlers ?? {}),\n\t\t\t\t\tmousedown: (e) => {\n\t\t\t\t\t\tif (onLayerClick) {\n\t\t\t\t\t\t\tonLayerClick(e, data);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}}\n\t\t\t\tpathOptions={{\n\t\t\t\t\tfillColor: getColorFromLegendSet(legends, data.data),\n\t\t\t\t\tfillOpacity: 1,\n\t\t\t\t\tcolor: colors.grey900,\n\t\t\t\t\tweight: 1,\n\t\t\t\t}}\n\t\t\t\tradius={circleRadius}\n\t\t\t\tcenter={center}\n\t\t\t>\n\t\t\t\t<CustomTooltip data={data} />\n\t\t\t</CircleMarker>\n\t\t</>\n\t);\n}\n"]}
@@ -39,7 +39,7 @@ function ChoroplethLegend({
39
39
  }
40
40
  ),
41
41
  /* @__PURE__ */ jsx(Divider, { margin: "0" }),
42
- /* @__PURE__ */ jsx("div", { className: "legend-list pt-8", children: legends?.map((legend) => /* @__PURE__ */ jsx(
42
+ /* @__PURE__ */ jsx("div", { style: { paddingTop: 8 }, className: "legend-list", children: legends?.map((legend) => /* @__PURE__ */ jsx(
43
43
  LegendItem,
44
44
  {
45
45
  legend,