@devgateway/dvz-ui-react 1.9.12 → 1.9.14

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.
@@ -1,452 +1,463 @@
1
- import { jsx as tt } from "react/jsx-runtime";
1
+ import { jsx as rt } from "react/jsx-runtime";
2
2
  import "react";
3
- import ct from "./BaseLayer.js";
3
+ import ut from "./BaseLayer.js";
4
4
  import dt from "../data/D3MapDataProvider.js";
5
- import ut from "../data/D3MapDataConsumer.js";
6
- import * as W from "d3";
7
- import { injectIntl as ht } from "react-intl";
8
- import Z from "./BreaksStyles.js";
9
- import lt from "./GradientColors.js";
10
- const H = (D) => D ? D.toString().replace(/ /g, "_") : "", k = (D) => D ? "pattern_" + H(D) : "";
11
- class ft extends ct {
5
+ import ht from "../data/D3MapDataConsumer.js";
6
+ import * as H from "d3";
7
+ import { injectIntl as mt } from "react-intl";
8
+ import et from "./BreaksStyles.js";
9
+ import nt from "./GradientColors.js";
10
+ import { resolveOverrideColor as K, extractVariablesDeep as ft } from "./Utils.js";
11
+ const Q = (V) => V ? V.toString().replace(/ /g, "_") : "", F = (V) => V ? "pattern_" + Q(V) : "";
12
+ class gt extends ut {
12
13
  constructor() {
13
14
  super(), this.state = { geoJson: null, json: null }, this.getTooltipVariables = this.getTooltipVariables.bind(this), this.resize = this.resize.bind(this), this.createLayer = this.createLayer.bind(this), this.createCentroids = this.createCentroids.bind(this), this.createPatterns = this.createPatterns.bind(this), this.createPaths = this.createPaths.bind(this);
14
15
  }
15
- createLayer(e) {
16
- const l = this.joinData(e, this.props.app, this.props.featureJoinAttribute, this.props.data, this.props.measures, this.props.patternDiscriminator);
16
+ createLayer(r) {
17
+ const l = this.joinData(r, this.props.app, this.props.featureJoinAttribute, this.props.data, this.props.measures, this.props.patternDiscriminator);
17
18
  this.createDataLayer(l), this.props.onReady && this.props.onReady();
18
19
  }
19
20
  resize() {
20
21
  const {
21
- markerLabelSize: e,
22
+ markerLabelSize: r,
22
23
  markFillColor: l,
23
- markBorderColor: v,
24
- markSizeScale: i,
25
- measures: u,
26
- data: y,
24
+ markBorderColor: C,
25
+ markSizeScale: o,
26
+ measures: m,
27
+ data: b,
27
28
  breaks: n,
28
- gradientScheme: w,
29
+ gradientScheme: T,
29
30
  gradientReverse: s,
30
- labelFontSize: m
31
- } = this.props, o = this.props.transform ? this.props.transform.k : 1;
31
+ labelFontSize: f
32
+ } = this.props, i = this.props.transform ? this.props.transform.k : 1;
32
33
  super.resize();
33
- const c = new Z({
34
+ const u = new et({
34
35
  breaks: n,
35
36
  defaultFillColor: l,
36
- defaultBorderColor: v,
37
- defaultSize: i
37
+ defaultBorderColor: C,
38
+ defaultSize: o
38
39
  });
39
- this.g.selectAll(".centroids .point").attr("r", (p) => c.getSize(p.properties._value) * 1 / o), this.g.selectAll(".point-label").attr("font-size", (p) => e * (1 / o) + "px");
40
+ this.g.selectAll(".centroids .point").attr("r", (p) => u.getSize(p.properties._value) * 1 / i), this.g.selectAll(".point-label").attr("font-size", (p) => r * (1 / i) + "px");
40
41
  }
41
- getTooltipVariables(e) {
42
+ getTooltipVariables(r) {
42
43
  const { apiJoinAttribute: l } = this.props;
43
- return e.properties._value ? {
44
- ...e.properties,
44
+ return r.properties._value ? {
45
+ ...r.properties,
45
46
  meta: {
46
- [l]: e.properties.meta ? e.properties.meta.value : "",
47
- ...e.properties.meta,
48
- value: e.properties._value
47
+ [l]: r.properties.meta ? r.properties.meta.value : "",
48
+ ...r.properties.meta,
49
+ value: r.properties._value
49
50
  }
50
51
  } : {};
51
52
  }
52
- createDataLayer(e) {
53
+ createDataLayer(r) {
53
54
  const {
54
55
  app: l,
55
- svg: v,
56
- format: i,
57
- id: u,
58
- file: y,
56
+ svg: C,
57
+ format: o,
58
+ id: m,
59
+ file: b,
59
60
  path: n,
60
- onLayerCreated: w,
61
+ onLayerCreated: T,
61
62
  labelFilter: s = [],
62
- labelField: m,
63
- labelFontSize: o,
64
- labelColor: c,
63
+ labelField: f,
64
+ labelFontSize: i,
65
+ labelColor: u,
65
66
  fillColor: p,
66
- borderColor: g,
67
+ borderColor: _,
67
68
  tooltip: x,
68
- markFillColor: b,
69
- markLabelColor: J,
70
- markBorderColor: R,
71
- markSizeScale: G,
72
- markerLabelSize: K,
73
- featureJoinAttribute: et,
74
- apiJoinAttribute: Q,
75
- measures: $,
76
- editing: rt,
77
- data: C,
78
- patternDiscriminator: S,
79
- patternDiscriminatorLabel: X,
69
+ markFillColor: y,
70
+ markLabelColor: k,
71
+ markBorderColor: g,
72
+ markSizeScale: $,
73
+ markerLabelSize: X,
74
+ featureJoinAttribute: at,
75
+ apiJoinAttribute: Y,
76
+ measures: D,
77
+ editing: it,
78
+ data: S,
79
+ patternDiscriminator: z,
80
+ patternDiscriminatorLabel: Z,
80
81
  breaks: I,
81
82
  gradientScheme: N,
82
- gradientReverse: U,
83
- patterns: L,
84
- projection: at,
85
- useBreaks: Y,
86
- useGradients: T,
87
- useCentroidPoint: j,
83
+ gradientReverse: j,
84
+ patterns: P,
85
+ projection: ot,
86
+ useBreaks: tt,
87
+ useGradients: R,
88
+ useCentroidPoint: U,
88
89
  usePattern: q,
89
- waitForFilters: it,
90
- intl: M,
91
- patternsVisible: B = !0,
92
- togglePatterns: E,
93
- colorLayerVisible: O = !0,
94
- visible: st
90
+ waitForFilters: st,
91
+ intl: O,
92
+ patternsVisible: E = !0,
93
+ togglePatterns: G,
94
+ colorLayerVisible: M = !0,
95
+ visible: lt
95
96
  } = this.props;
96
97
  if (this.gRef && this.gRef.current) {
97
- this.g = W.select(this.gRef.current), this.g.attr("class", "base-layer");
98
- const z = e.features.filter((V) => V.properties._value != null);
99
- this.createPaths(e), j || this.createColors(z), q && this.createPatterns(e), m != "none" && this.createLabels(e), j && this.createCentroids(z);
98
+ this.g = H.select(this.gRef.current), this.g.attr("class", "base-layer");
99
+ const w = r.features.filter((J) => J.properties._value != null);
100
+ this.createPaths(r), U || this.createColors(w), q && this.createPatterns(r), f != "none" && this.createLabels(r), U && this.createCentroids(w);
100
101
  }
101
102
  }
102
- createColors(e) {
103
+ createColors(r) {
103
104
  const {
104
105
  app: l,
105
- svg: v,
106
- format: i,
107
- id: u,
108
- file: y,
106
+ svg: C,
107
+ format: o,
108
+ id: m,
109
+ file: b,
109
110
  path: n,
110
- onLayerCreated: w,
111
+ onLayerCreated: T,
111
112
  labelFilter: s = [],
112
- labelField: m,
113
- labelFontSize: o,
114
- labelColor: c,
113
+ labelField: f,
114
+ labelFontSize: i,
115
+ labelColor: u,
115
116
  fillColor: p,
116
- borderColor: g,
117
+ borderColor: _,
117
118
  tooltip: x,
118
- markFillColor: b,
119
- markLabelColor: J,
120
- markBorderColor: R,
121
- markSizeScale: G,
122
- markerLabelSize: K,
123
- featureJoinAttribute: et,
124
- apiJoinAttribute: Q,
125
- measures: $,
126
- editing: rt,
127
- data: C,
128
- patternDiscriminator: S,
129
- patternDiscriminatorLabel: X,
119
+ markFillColor: y,
120
+ markLabelColor: k,
121
+ markBorderColor: g,
122
+ markSizeScale: $,
123
+ markerLabelSize: X,
124
+ featureJoinAttribute: at,
125
+ apiJoinAttribute: Y,
126
+ measures: D,
127
+ editing: it,
128
+ data: S,
129
+ patternDiscriminator: z,
130
+ patternDiscriminatorLabel: Z,
130
131
  breaks: I,
131
132
  gradientScheme: N,
132
- gradientReverse: U,
133
- patterns: L,
134
- projection: at,
135
- useBreaks: Y,
136
- useGradients: T,
137
- useCentroidPoint: j,
133
+ gradientReverse: j,
134
+ patterns: P,
135
+ projection: ot,
136
+ useBreaks: tt,
137
+ useGradients: R,
138
+ useCentroidPoint: U,
138
139
  usePattern: q,
139
- waitForFilters: it,
140
- intl: M,
141
- patternsVisible: B = !0,
142
- togglePatterns: E,
143
- colorLayerVisible: O = !0,
144
- visible: st
145
- } = this.props, { gradientStartColor: z, gradientEndColor: V } = this.props, d = new Z({
140
+ waitForFilters: st,
141
+ intl: O,
142
+ patternsVisible: E = !0,
143
+ togglePatterns: G,
144
+ colorLayerVisible: M = !0,
145
+ visible: lt
146
+ } = this.props, { gradientStartColor: w, gradientEndColor: J } = this.props, d = new et({
146
147
  breaks: I,
147
- defaultFillColor: b,
148
- defaultBorderColor: R,
149
- defaultSize: G
150
- }), A = new lt({
151
- data: C ? C.children : [],
152
- measure: $[0],
153
- defaultFillColor: b,
148
+ defaultFillColor: y,
149
+ defaultBorderColor: g,
150
+ defaultSize: $
151
+ }), L = new nt({
152
+ data: S ? S.children : [],
153
+ measure: D[0],
154
+ defaultFillColor: y,
154
155
  gradientScheme: N,
155
- gradientReverse: U,
156
- gradientStartColor: z,
157
- gradientEndColor: V
156
+ gradientReverse: j,
157
+ gradientStartColor: w,
158
+ gradientEndColor: J
158
159
  });
159
- this.g && (this.g.selectAll("path").attr("fill", (h) => !h || !h.properties || !h.properties._value ? p : T ? A.getColor(h.properties._value) : d.getColor(h.properties._value)).attr("stroke", g).attr("id", "state-borders").attr("d", n).on("mouseenter", (h, r) => {
160
- r.properties._value && this.showToolTip(x, this.getTooltipVariables(r), T ? A.getColor(r.properties._value) : d.getColor(r.properties._value), r);
160
+ this.g && (this.g.selectAll("path").attr("fill", (h) => !h || !h.properties || !h.properties._value ? p : K(h.properties.meta, D[0]) || (R ? L.getColor(h.properties._value) : d.getColor(h.properties._value))).attr("stroke", _).attr("id", "state-borders").attr("d", n).on("mouseenter", (h, t) => {
161
+ if (t.properties._value) {
162
+ const c = K(t.properties.meta, D[0]) || (R ? L.getColor(t.properties._value) : d.getColor(t.properties._value));
163
+ this.showToolTip(x, this.getTooltipVariables(t), c, t);
164
+ }
161
165
  }).on("mouseleave", (h) => {
162
166
  this.hiddenToolTip(h);
163
167
  }).on("mousemove", (h) => {
164
168
  this.moveToolTip(h);
165
- }), O || this.g.selectAll(".borders").style("fill", this.props.fillColor), this.g.attr("transform", this.props.transform));
169
+ }), M || this.g.selectAll(".borders").style("fill", this.props.fillColor), this.g.attr("transform", this.props.transform));
166
170
  }
167
- createCentroids(e) {
171
+ createCentroids(r) {
168
172
  const {
169
173
  app: l,
170
- svg: v,
171
- format: i,
172
- id: u,
173
- file: y,
174
+ svg: C,
175
+ format: o,
176
+ id: m,
177
+ file: b,
174
178
  path: n,
175
- onLayerCreated: w,
179
+ onLayerCreated: T,
176
180
  labelFilter: s = [],
177
- labelField: m,
178
- labelFontSize: o,
179
- labelColor: c,
181
+ labelField: f,
182
+ labelFontSize: i,
183
+ labelColor: u,
180
184
  fillColor: p,
181
- borderColor: g,
185
+ borderColor: _,
182
186
  tooltip: x,
183
- markFillColor: b,
184
- markLabelColor: J,
185
- markBorderColor: R,
186
- markSizeScale: G,
187
- markerLabelSize: K,
188
- featureJoinAttribute: et,
189
- apiJoinAttribute: Q,
190
- measures: $,
191
- editing: rt,
192
- data: C,
193
- patternDiscriminator: S,
194
- patternDiscriminatorLabel: X,
187
+ markFillColor: y,
188
+ markLabelColor: k,
189
+ markBorderColor: g,
190
+ markSizeScale: $,
191
+ markerLabelSize: X,
192
+ featureJoinAttribute: at,
193
+ apiJoinAttribute: Y,
194
+ measures: D,
195
+ editing: it,
196
+ data: S,
197
+ patternDiscriminator: z,
198
+ patternDiscriminatorLabel: Z,
195
199
  breaks: I,
196
200
  gradientScheme: N,
197
- gradientReverse: U,
198
- patterns: L,
199
- projection: at,
200
- useBreaks: Y,
201
- useGradients: T,
202
- useCentroidPoint: j,
201
+ gradientReverse: j,
202
+ patterns: P,
203
+ projection: ot,
204
+ useBreaks: tt,
205
+ useGradients: R,
206
+ useCentroidPoint: U,
203
207
  usePattern: q,
204
- waitForFilters: it,
205
- intl: M,
206
- patternsVisible: B = !0,
207
- togglePatterns: E,
208
- colorLayerVisible: O = !0,
209
- visible: st
210
- } = this.props, z = new Z({
208
+ waitForFilters: st,
209
+ intl: O,
210
+ patternsVisible: E = !0,
211
+ togglePatterns: G,
212
+ colorLayerVisible: M = !0,
213
+ visible: lt
214
+ } = this.props, w = new et({
211
215
  breaks: I,
212
- defaultFillColor: b,
213
- defaultBorderColor: R,
214
- defaultSize: G
215
- }), V = (d) => new lt({
216
+ defaultFillColor: y,
217
+ defaultBorderColor: g,
218
+ defaultSize: $
219
+ }), J = (d) => new nt({
216
220
  data: d.children,
217
- measure: $[0],
218
- defaultFillColor: b,
221
+ measure: D[0],
222
+ defaultFillColor: y,
219
223
  gradientScheme: N,
220
- gradientReverse: U
224
+ gradientReverse: j
221
225
  });
222
226
  if (this.g) {
223
227
  const d = {
224
- style: i.style === "compacted" ? "decimal" : i.style,
225
- notation: i.style === "compacted" ? "compact" : "standard",
226
- currency: i.currency,
227
- minimumFractionDigits: parseInt(i.minimumFractionDigits),
228
- maximumFractionDigits: parseInt(i.maximumFractionDigits)
229
- }, A = this.props.transform ? this.props.transform.k : 1;
228
+ style: o.style === "compacted" ? "decimal" : o.style,
229
+ notation: o.style === "compacted" ? "compact" : "standard",
230
+ currency: o.currency,
231
+ minimumFractionDigits: parseInt(o.minimumFractionDigits),
232
+ maximumFractionDigits: parseInt(o.maximumFractionDigits)
233
+ }, L = this.props.transform ? this.props.transform.k : 1;
230
234
  this.g.selectAll(".centroids").remove();
231
- const h = this.g.selectAll("centroids").data(e).enter().append("g").attr("class", "centroids");
232
- h.append("circle").attr("fill", (r) => T === !0 ? V(C).getColor(r.properties._value) : z.getColor(r.properties._value, !0)).attr("stroke", R).attr("class", "point").attr("stroke-width", 2).style("vector-effect", "non-scaling-stroke").attr("cx", (r) => n.centroid(r)[0]).attr("cy", (r) => n.centroid(r)[1]).attr("r", (r) => z.getSize(r.properties._value) * 1 / A).on("mouseenter", (r, f) => {
233
- if (f.properties._value) {
234
- const t = {
235
- ...f.properties,
235
+ const h = this.g.selectAll("centroids").data(r).enter().append("g").attr("class", "centroids");
236
+ h.append("circle").attr("fill", (t) => K(t.properties.meta, D[0]) || (R === !0 ? J(S).getColor(t.properties._value) : w.getColor(t.properties._value, !0))).attr("stroke", g).attr("class", "point").attr("stroke-width", 2).style("vector-effect", "non-scaling-stroke").attr("cx", (t) => n.centroid(t)[0]).attr("cy", (t) => n.centroid(t)[1]).attr("r", (t) => w.getSize(t.properties._value) * 1 / L).on("mouseenter", (t, c) => {
237
+ if (c.properties._value) {
238
+ const e = {
239
+ ...c.properties,
236
240
  meta: {
237
- [Q]: f.properties.meta ? f.properties.meta.value : "",
238
- ...f.properties.meta,
239
- value: f.properties._value
241
+ [Y]: c.properties.meta ? c.properties.meta.value : "",
242
+ ...c.properties.meta,
243
+ value: c.properties._value
240
244
  }
241
- };
242
- this.showToolTip(x, t, T === !0 ? V(C).getColor(f.properties._value) : z.getColor(f.properties._value));
245
+ }, v = K(c.properties.meta, D[0]) || (R === !0 ? J(S).getColor(c.properties._value) : w.getColor(c.properties._value));
246
+ this.showToolTip(x, e, v);
243
247
  }
244
- }).on("mouseleave", (r) => {
248
+ }).on("mouseleave", (t) => {
245
249
  this.hiddenToolTip();
246
- }), h.append("text").attr("class", "point-label").attr("x", (r) => n.centroid(r)[0]).attr("y", (r) => n.centroid(r)[1]).attr("font-size", (r) => K * (1 / A) + "px").attr("text-anchor", "middle").attr("dominant-baseline", "middle").style("pointer-events", "none").attr("fill", J).text((r) => M.formatNumber(i.style === "percent" ? r.properties._value / 100 : r.properties._value, d)).on("mouseover", (r) => {
247
- }), O || this.g.selectAll(".centroids").style("display", "none");
250
+ }), h.append("text").attr("class", "point-label").attr("x", (t) => n.centroid(t)[0]).attr("y", (t) => n.centroid(t)[1]).attr("font-size", (t) => X * (1 / L) + "px").attr("text-anchor", "middle").attr("dominant-baseline", "middle").style("pointer-events", "none").attr("fill", k).text((t) => O.formatNumber(o.style === "percent" ? t.properties._value / 100 : t.properties._value, d)).on("mouseover", (t) => {
251
+ }), M || this.g.selectAll(".centroids").style("display", "none");
248
252
  }
249
253
  }
250
- createPatterns(e) {
254
+ createPatterns(r) {
251
255
  const {
252
256
  app: l,
253
- svg: v,
254
- format: i,
255
- id: u,
256
- file: y,
257
+ svg: C,
258
+ format: o,
259
+ id: m,
260
+ file: b,
257
261
  path: n,
258
- onLayerCreated: w,
262
+ onLayerCreated: T,
259
263
  labelFilter: s = [],
260
- labelField: m,
261
- labelFontSize: o,
262
- labelColor: c,
264
+ labelField: f,
265
+ labelFontSize: i,
266
+ labelColor: u,
263
267
  fillColor: p,
264
- borderColor: g,
268
+ borderColor: _,
265
269
  tooltip: x,
266
- markFillColor: b,
267
- markLabelColor: J,
268
- markBorderColor: R,
269
- markSizeScale: G,
270
- markerLabelSize: K,
271
- featureJoinAttribute: et,
272
- apiJoinAttribute: Q,
273
- measures: $,
274
- editing: rt,
275
- data: C,
276
- patternDiscriminator: S,
277
- patternDiscriminatorLabel: X,
270
+ markFillColor: y,
271
+ markLabelColor: k,
272
+ markBorderColor: g,
273
+ markSizeScale: $,
274
+ markerLabelSize: X,
275
+ featureJoinAttribute: at,
276
+ apiJoinAttribute: Y,
277
+ measures: D,
278
+ editing: it,
279
+ data: S,
280
+ patternDiscriminator: z,
281
+ patternDiscriminatorLabel: Z,
278
282
  breaks: I,
279
283
  gradientScheme: N,
280
- gradientReverse: U,
281
- patterns: L,
282
- projection: at,
283
- useBreaks: Y,
284
- useGradients: T,
285
- useCentroidPoint: j,
284
+ gradientReverse: j,
285
+ patterns: P,
286
+ projection: ot,
287
+ useBreaks: tt,
288
+ useGradients: R,
289
+ useCentroidPoint: U,
286
290
  usePattern: q,
287
- waitForFilters: it,
288
- intl: M,
289
- patternsVisible: B = !0,
290
- togglePatterns: E,
291
- colorLayerVisible: O = !0,
292
- visible: st
293
- } = this.props, z = new Z({
291
+ waitForFilters: st,
292
+ intl: O,
293
+ patternsVisible: E = !0,
294
+ togglePatterns: G,
295
+ colorLayerVisible: M = !0,
296
+ visible: lt
297
+ } = this.props, w = new et({
294
298
  breaks: I,
295
- defaultFillColor: b,
296
- defaultBorderColor: R,
297
- defaultSize: G
298
- }), V = this.props.transform ? this.props.transform.k : 1, d = 10 * 1 / V, A = 10 * 1 / V, h = (t) => new lt({
299
- data: t.children,
300
- measure: $[0],
301
- defaultFillColor: b,
299
+ defaultFillColor: y,
300
+ defaultBorderColor: g,
301
+ defaultSize: $
302
+ }), J = this.props.transform ? this.props.transform.k : 1, d = 10 * 1 / J, L = 10 * 1 / J, h = (e) => new nt({
303
+ data: e.children,
304
+ measure: D[0],
305
+ defaultFillColor: y,
302
306
  gradientScheme: N,
303
- gradientReverse: U,
307
+ gradientReverse: j,
304
308
  gradientStartColor,
305
309
  gradientEndColor
306
310
  });
307
- let r = [];
308
- if (l == "csv" && S != "none")
309
- r = [...new Set(C.data.map((t) => t[S]))].map((t) => ({
310
- key: t,
311
- type: L[t + "_symbol"],
312
- color: L[t + "_color"],
313
- rotation: L[t + "_rotation"]
311
+ let t = [];
312
+ if (l == "csv" && z != "none")
313
+ t = [...new Set(S.data.map((e) => e[z]))].map((e) => ({
314
+ key: e,
315
+ type: P[e + "_symbol"],
316
+ color: P[e + "_color"],
317
+ rotation: P[e + "_rotation"]
314
318
  }));
315
- else if (S != "none") {
316
- const t = C && C.metadata ? C.metadata.types.filter((F) => F.dimension == S) : [];
317
- r = t && t.length > 0 ? t[0].items.map((F) => {
318
- const _ = F.value;
319
+ else if (z != "none") {
320
+ const e = S && S.metadata ? S.metadata.types.filter((v) => v.dimension == z) : [];
321
+ t = e && e.length > 0 ? e[0].items.map((v) => {
322
+ const A = v.value;
319
323
  return {
320
- key: _,
321
- type: L[_ + "_symbol"],
322
- color: L[_ + "_color"],
323
- rotation: L[_ + "_rotation"]
324
+ key: A,
325
+ type: P[A + "_symbol"],
326
+ color: P[A + "_color"],
327
+ rotation: P[A + "_rotation"]
324
328
  };
325
329
  }) : [];
326
330
  }
327
331
  this.g.selectAll("defs").remove();
328
- const f = this.g.append("defs");
329
- if (f.selectAll("pattern").remove(), f.selectAll("pattern").data(r).enter().append("pattern").attr("id", (t) => k(t.key)).attr("patternUnits", "userSpaceOnUse").attr("width", d).attr("height", A).attr("x", 0).attr("y", 0).attr("patternTransform", (t) => `rotate(${t.rotation})`), r.forEach((t) => {
330
- t.type === "lines" && f.select("#" + k(t.key)).append("rect").attr("x", 0.05).attr("width", d / 2).attr("height", A).attr("opacity", 1).attr("fill", t.color), t.type === "squares" && f.select("#" + k(t.key)).append("rect").attr("width", d / 2).attr("height", A / 2).attr("fill", t.color).attr("opacity", 1).attr("stroke-width", 1), t.type === "dots" && f.select("#" + k(t.key)).append("circle").attr("cx", d / 2).attr("cy", A / 2).attr("r", d / 2.5).attr("fill", t.color).attr("opacity", 1).attr("stroke-width", 1), t.type === "triangle" && f.select("#" + k(t.key)).append("polygon").attr("points", `${d / 2} 0, 0 ${d}, ${d} ${d} `).attr("fill", t.color).attr("opacity", 1).attr("stroke-width", 1);
331
- }), r = r.filter((t) => t.type != null).sort((t, F) => new Intl.Collator(M.locale, { caseFirst: "upper", numeric: !0, sensitivity: "variant" }).compare(t.key, F.key)), q && e && e.features) {
332
- this.g.selectAll(".shape-pattern").remove(), B && e.features.forEach((a) => {
333
- let P = [];
334
- a.properties && a.properties.meta && (P = l != "csv" ? a.properties.meta[S] ? a.properties.meta[S] : [] : [a.properties.meta[S]], P && P.length > 0 && P.forEach((nt) => {
335
- this.g.append("path").attr("d", n(a)).datum(nt).attr("class", "shape-pattern").attr("opacity", (ot) => {
336
- if (Y)
332
+ const c = this.g.append("defs");
333
+ if (c.selectAll("pattern").remove(), c.selectAll("pattern").data(t).enter().append("pattern").attr("id", (e) => F(e.key)).attr("patternUnits", "userSpaceOnUse").attr("width", d).attr("height", L).attr("x", 0).attr("y", 0).attr("patternTransform", (e) => `rotate(${e.rotation})`), t.forEach((e) => {
334
+ e.type === "lines" && c.select("#" + F(e.key)).append("rect").attr("x", 0.05).attr("width", d / 2).attr("height", L).attr("opacity", 1).attr("fill", e.color), e.type === "squares" && c.select("#" + F(e.key)).append("rect").attr("width", d / 2).attr("height", L / 2).attr("fill", e.color).attr("opacity", 1).attr("stroke-width", 1), e.type === "dots" && c.select("#" + F(e.key)).append("circle").attr("cx", d / 2).attr("cy", L / 2).attr("r", d / 2.5).attr("fill", e.color).attr("opacity", 1).attr("stroke-width", 1), e.type === "triangle" && c.select("#" + F(e.key)).append("polygon").attr("points", `${d / 2} 0, 0 ${d}, ${d} ${d} `).attr("fill", e.color).attr("opacity", 1).attr("stroke-width", 1);
335
+ }), t = t.filter((e) => e.type != null).sort((e, v) => new Intl.Collator(O.locale, { caseFirst: "upper", numeric: !0, sensitivity: "variant" }).compare(e.key, v.key)), q && r && r.features) {
336
+ this.g.selectAll(".shape-pattern").remove(), E && r.features.forEach((a) => {
337
+ let B = [];
338
+ a.properties && a.properties.meta && (B = l != "csv" ? a.properties.meta[z] ? a.properties.meta[z] : [] : [a.properties.meta[z]], B && B.length > 0 && B.forEach((pt) => {
339
+ this.g.append("path").attr("d", n(a)).datum(pt).attr("class", "shape-pattern").attr("opacity", (W) => {
340
+ if (tt)
337
341
  return 0.7;
338
- }).attr("fill", (ot) => "transparent").attr("style", () => "none;fill:url(#" + k(nt) + ");").on("mouseenter", () => {
339
- this.showToolTip(x, this.getTooltipVariables(a), T === !0 ? h(C).getColor(a.properties._value) : z.getColor(a.properties._value));
340
- }).on("mousemove", (ot) => {
342
+ }).attr("fill", (W) => "transparent").attr("style", () => "none;fill:url(#" + F(pt) + ");").on("mouseenter", () => {
343
+ const W = K(a.properties.meta, D[0]) || (R === !0 ? h(S).getColor(a.properties._value) : w.getColor(a.properties._value));
344
+ this.showToolTip(x, this.getTooltipVariables(a), W);
345
+ }).on("mousemove", (W) => {
341
346
  this.moveToolTip();
342
- }).on("mouseleave", (ot) => {
347
+ }).on("mouseleave", (W) => {
343
348
  this.hiddenToolTip();
344
349
  });
345
350
  }));
346
- }), W.select(this.gRef.current.parentNode.parentNode).select(`.layer_${H(u)}`).select("svg").remove();
347
- const t = W.select(this.gRef.current.parentNode.parentNode).select(`.layer_${H(u)}`).append("svg");
348
- t.attr("height", 30 + r.length * 23 + "px");
349
- const F = t.append("svg").append("g"), _ = F.append("defs");
350
- _.selectAll("pattern").remove(), B && (_.selectAll("pattern").data(r).enter().append("pattern").attr("id", (a) => "l_" + k(a.key)).attr("patternUnits", "userSpaceOnUse").attr("width", 5).attr("height", 5).attr("x", 0).attr("y", 0).attr("patternTransform", (a) => `rotate(${a.rotation ? a.rotation : 0})`), r.forEach((a) => {
351
- a.type === "lines" && _.select("#l_" + k(a.key)).append("rect").attr("x", 0).attr("width", 1).attr("height", 10).attr("opacity", 0.75).attr("fill", a.color), a.type === "squares" && _.select("#l_" + k(a.key)).append("rect").attr("width", 3).attr("height", 3).attr("fill", a.color).attr("opacity", 1).attr("stroke-width", 1), a.type === "dots" && _.select("#l_" + k(a.key)).append("circle").attr("cx", 2).attr("cy", 2).attr("r", 2).attr("fill", a.color).attr("opacity", 1).attr("stroke-width", 1), a.type === "triangle" && _.select("#l_" + k(a.key)).append("polygon").attr("points", "5,0 8,8 0,5").attr("fill", a.color).attr("opacity", 1).attr("stroke-width", 1);
351
+ }), H.select(this.gRef.current.parentNode.parentNode).select(`.layer_${Q(m)}`).select("svg").remove();
352
+ const e = H.select(this.gRef.current.parentNode.parentNode).select(`.layer_${Q(m)}`).append("svg");
353
+ e.attr("height", 30 + t.length * 23 + "px");
354
+ const v = e.append("svg").append("g"), A = v.append("defs");
355
+ A.selectAll("pattern").remove(), E && (A.selectAll("pattern").data(t).enter().append("pattern").attr("id", (a) => "l_" + F(a.key)).attr("patternUnits", "userSpaceOnUse").attr("width", 5).attr("height", 5).attr("x", 0).attr("y", 0).attr("patternTransform", (a) => `rotate(${a.rotation ? a.rotation : 0})`), t.forEach((a) => {
356
+ a.type === "lines" && A.select("#l_" + F(a.key)).append("rect").attr("x", 0).attr("width", 1).attr("height", 10).attr("opacity", 0.75).attr("fill", a.color), a.type === "squares" && A.select("#l_" + F(a.key)).append("rect").attr("width", 3).attr("height", 3).attr("fill", a.color).attr("opacity", 1).attr("stroke-width", 1), a.type === "dots" && A.select("#l_" + F(a.key)).append("circle").attr("cx", 2).attr("cy", 2).attr("r", 2).attr("fill", a.color).attr("opacity", 1).attr("stroke-width", 1), a.type === "triangle" && A.select("#l_" + F(a.key)).append("polygon").attr("points", "5,0 8,8 0,5").attr("fill", a.color).attr("opacity", 1).attr("stroke-width", 1);
352
357
  }));
353
- let pt = B ? "☑ " : "☐ ";
354
- F.append("text").attr("class", "patterns-checkbox").attr("x", 10).attr("y", 20).text((a) => pt).attr("font-size", "22px").on("click", () => {
355
- E && E(u);
356
- }), F.append("text").attr("class", "patterns-title").attr("x", 25).attr("y", 7).text((a) => l === "csv" ? S : X).on("click", () => {
357
- E && E(u);
358
- }), B && (F.selectAll(".legend-squares").data(r).enter().append("rect").attr("width", 15).attr("height", 15).attr("y", (a, P) => P * 22 + 30).attr("x", 15).attr("stroke", g).attr("style", (a) => "none;fill:url(#l_" + k(a.key) + ");"), F.selectAll(".patterns-labels").data(r).enter().append("text").attr("class", "patterns-labels").attr("y", (a, P) => P * 22 + 30).attr("x", 32).text((a) => a.key));
358
+ let ct = E ? "☑ " : "☐ ";
359
+ v.append("text").attr("class", "patterns-checkbox").attr("x", 10).attr("y", 20).text((a) => ct).attr("font-size", "22px").on("click", () => {
360
+ G && G(m);
361
+ }), v.append("text").attr("class", "patterns-title").attr("x", 25).attr("y", 7).text((a) => l === "csv" ? z : Z).on("click", () => {
362
+ G && G(m);
363
+ }), E && (v.selectAll(".legend-squares").data(t).enter().append("rect").attr("width", 15).attr("height", 15).attr("y", (a, B) => B * 22 + 30).attr("x", 15).attr("stroke", _).attr("style", (a) => "none;fill:url(#l_" + F(a.key) + ");"), v.selectAll(".patterns-labels").data(t).enter().append("text").attr("class", "patterns-labels").attr("y", (a, B) => B * 22 + 30).attr("x", 32).text((a) => a.key));
359
364
  }
360
365
  }
361
- joinData(e, l, v, i, u, y) {
362
- const n = e.features.map((s) => {
363
- const m = s.properties[v];
364
- if (l != "csv" && i && i.children) {
365
- const o = i.children.filter((c) => c.value == m);
366
- if (o.length > 0) {
367
- const c = o[0][u[0]];
368
- if (s.properties.meta = o[0], s.properties._value = c, y && y != "none") {
369
- const p = o[0] && o[0].children ? o[0].children.filter((g) => g.type == y).map((g) => g.value) : [];
370
- s.properties.meta[y] = p;
366
+ joinData(r, l, C, o, m, b) {
367
+ const n = r.features.map((s) => {
368
+ const f = s.properties[C];
369
+ if (l != "csv" && o && o.children) {
370
+ const i = o.children.filter((u) => u.value == f);
371
+ if (i.length > 0) {
372
+ const u = i[0][m[0]];
373
+ if (s.properties.meta = { ...i[0], ...ft(i[0]) }, s.properties._value = u, b && b != "none") {
374
+ const p = i[0] && i[0].children ? i[0].children.filter((_) => _.type == b).map((_) => _.value) : [];
375
+ s.properties.meta[b] = p;
371
376
  }
372
377
  } else
373
378
  s.properties._value = null;
374
379
  } else if (l == "csv") {
375
- const o = i.data.filter((c) => c[i.meta.fields[0]] == m);
376
- o.length > 0 ? (s.properties.meta = o[0], s.properties._value = o[0][i.meta.fields[1]]) : s.properties._value = null;
380
+ const i = o.data.filter((u) => u[o.meta.fields[0]] == f);
381
+ i.length > 0 ? (s.properties.meta = i[0], s.properties._value = i[0][o.meta.fields[1]]) : s.properties._value = null;
377
382
  } else
378
383
  s.properties._value = null;
379
384
  return s;
380
385
  });
381
- return { ...e, features: n };
386
+ return { ...r, features: n };
382
387
  }
383
- componentDidUpdate(e, l, v) {
384
- const { app: i, file: u, featureJoinAttribute: y, data: n, measures: w, patternDiscriminator: s, editing: m, usePattern: o } = this.props;
385
- if ((m || e.data !== n || e.path !== this.props.path) && this.create(), e.visible != this.props.visible && this.g.style("display", this.props.visible ? "" : "none"), e.patternsVisible != this.props.patternsVisible) {
386
- const p = W.select(this.gRef.current.parentNode.parentNode).select(`.layer_${H(this.props.id)}`);
388
+ componentDidUpdate(r, l, C) {
389
+ const { app: o, file: m, featureJoinAttribute: b, data: n, measures: T, patternDiscriminator: s, editing: f, usePattern: i } = this.props;
390
+ if ((f || r.data !== n || r.path !== this.props.path) && this.create(), r.visible != this.props.visible && this.g.style("display", this.props.visible ? "" : "none"), r.patternsVisible != this.props.patternsVisible) {
391
+ const p = H.select(this.gRef.current.parentNode.parentNode).select(`.layer_${Q(this.props.id)}`);
387
392
  p.select(".patterns-checkbox").text(this.props.patternsVisible ? "☑ " : "☐ "), p.selectAll(".patterns-labels").style("display", this.props.patternsVisible ? "" : "none"), p.selectAll("rect").style("display", this.props.patternsVisible ? "" : "none"), p.select("svg").attr("height", this.props.patternsVisible ? 30 + (p.selectAll("rect").size() - 1) * 23 + "px" : "30px"), this.g.selectAll(".shape-pattern").style("display", this.props.patternsVisible ? "" : "none");
388
393
  }
389
- e.colorLayerVisible != this.props.colorLayerVisible && (this.g.selectAll(".borders").style("fill", (c) => this.props.colorLayerVisible ? null : this.props.fillColor), this.g.selectAll(".centroids").style("display", this.props.colorLayerVisible ? "block" : "none")), e.usePattern != this.props.usePattern && (this.props.usePattern || W.select(this.gRef.current.parentNode.parentNode).select(`.layer_${H(this.props.id)}`).select("svg").remove()), this.g && this.resize();
394
+ r.colorLayerVisible != this.props.colorLayerVisible && (this.g.selectAll(".borders").style("fill", (u) => this.props.colorLayerVisible ? null : this.props.fillColor), this.g.selectAll(".centroids").style("display", this.props.colorLayerVisible ? "block" : "none")), r.usePattern != this.props.usePattern && (this.props.usePattern || H.select(this.gRef.current.parentNode.parentNode).select(`.layer_${Q(this.props.id)}`).select("svg").remove()), this.g && this.resize();
390
395
  }
391
396
  componentDidMount() {
392
397
  super.componentDidMount();
393
398
  }
394
399
  render() {
395
400
  const {
396
- id: e,
401
+ id: r,
397
402
  file: l,
398
- path: v,
399
- zoom: i,
400
- labelFilter: u = [],
401
- labelField: y,
403
+ path: C,
404
+ zoom: o,
405
+ labelFilter: m = [],
406
+ labelField: b,
402
407
  labelFontSize: n,
403
- labelColor: w,
408
+ labelColor: T,
404
409
  fillColor: s,
405
- borderColor: m,
406
- featureJoinAttribute: o,
407
- apiJoinAttribute: c,
410
+ borderColor: f,
411
+ featureJoinAttribute: i,
412
+ apiJoinAttribute: u,
408
413
  dvzProxyDatasetId: p,
409
- editing: g
414
+ editing: _
410
415
  } = this.props;
411
- return /* @__PURE__ */ tt("g", { id: "data-" + e, className: "data " + e, ref: this.gRef });
416
+ return /* @__PURE__ */ rt("g", { id: "data-" + r, className: "data " + r, ref: this.gRef });
412
417
  }
413
418
  }
414
- const mt = (D) => {
419
+ const bt = (V) => {
415
420
  const {
416
- id: e,
421
+ id: r,
417
422
  unique: l,
418
- filters: v,
419
- csv: i,
420
- app: u,
421
- group: y = "default",
423
+ filters: C,
424
+ csv: o,
425
+ app: m,
426
+ group: b = "default",
422
427
  apiJoinAttribute: n,
423
- editing: w,
428
+ editing: T,
424
429
  patternDiscriminator: s,
425
- dvzProxyDatasetId: m,
426
- intl: o,
427
- settings: c,
428
- waitForFilters: p
429
- } = D, g = {}, x = v || {};
430
- return x && x.forEach && x.forEach((b) => {
431
- b.value != null && b.value.filter((J) => J != null && J.toString().trim() != "").length > 0 && (g[b.param] = b.value);
432
- }), m && (g.dvzProxyDatasetId = m), /* @__PURE__ */ tt(
430
+ dvzProxyDatasetId: f,
431
+ extraTooltipColumns: i,
432
+ intl: u,
433
+ settings: p,
434
+ waitForFilters: _
435
+ } = V, x = {}, y = C || {};
436
+ if (y && y.forEach && y.forEach((k) => {
437
+ k.value != null && k.value.filter((g) => g != null && g.toString().trim() != "").length > 0 && (x[k.param] = k.value);
438
+ }), f && (x.dvzProxyDatasetId = f), i && i.length > 0) {
439
+ const k = i.filter((g) => g && g !== n && g !== s);
440
+ k.length > 0 && (x.includeColumns = k.join(","));
441
+ }
442
+ return /* @__PURE__ */ rt(
433
443
  dt,
434
444
  {
435
445
  waitForFilters: !0,
436
- editing: w,
437
- params: g,
438
- app: u,
439
- csv: decodeURIComponent(i),
440
- group: y,
446
+ editing: T,
447
+ params: x,
448
+ app: m,
449
+ csv: decodeURIComponent(o),
450
+ extraTooltipColumns: i,
451
+ group: b,
441
452
  ignoreErrors: !0,
442
453
  isSvg: !0,
443
- store: [u, l, e],
454
+ store: [m, l, r],
444
455
  mySelf: "Data layer",
445
456
  source: n + (s != "none" ? "/" + s : ""),
446
- children: /* @__PURE__ */ tt(ut, { children: /* @__PURE__ */ tt(ft, { ...D }) })
457
+ children: /* @__PURE__ */ rt(ht, { children: /* @__PURE__ */ rt(gt, { ...V }) })
447
458
  }
448
459
  );
449
- }, _t = ht(mt);
460
+ }, zt = mt(bt);
450
461
  export {
451
- _t as default
462
+ zt as default
452
463
  };