@devgateway/dvz-ui-react 1.9.12 → 1.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/embeddable/d3Map/DataLayer.js +1 -1
- package/dist/cjs/embeddable/d3Map/FlowLayer.js +1 -1
- package/dist/cjs/embeddable/d3Map/LatLongLayer.js +1 -1
- package/dist/cjs/embeddable/d3Map/Legends.js +1 -1
- package/dist/cjs/embeddable/d3Map/Tooltip.js +1 -1
- package/dist/cjs/embeddable/d3Map/Utils.js +1 -1
- package/dist/cjs/embeddable/data/D3MapDataProvider.js +1 -1
- package/dist/cjs/embeddable/filter/index.js +1 -1
- package/dist/cjs/embeddable/map/index.js +2 -2
- package/dist/cjs/embeddable/tabbedposts/index.js +1 -1
- package/dist/esm/embeddable/d3Map/DataLayer.js +322 -311
- package/dist/esm/embeddable/d3Map/FlowLayer.js +105 -99
- package/dist/esm/embeddable/d3Map/LatLongLayer.js +106 -100
- package/dist/esm/embeddable/d3Map/Legends.js +151 -147
- package/dist/esm/embeddable/d3Map/Tooltip.js +64 -20
- package/dist/esm/embeddable/d3Map/Utils.js +26 -12
- package/dist/esm/embeddable/data/D3MapDataProvider.js +31 -30
- package/dist/esm/embeddable/filter/index.js +123 -123
- package/dist/esm/embeddable/map/index.js +47 -47
- package/dist/esm/embeddable/tabbedposts/index.js +12 -12
- package/dist/types/embeddable/d3Map/Utils.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,452 +1,463 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as rt } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import
|
|
3
|
+
import ut from "./BaseLayer.js";
|
|
4
4
|
import dt from "../data/D3MapDataProvider.js";
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
7
|
-
import { injectIntl as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
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(
|
|
16
|
-
const l = this.joinData(
|
|
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:
|
|
22
|
+
markerLabelSize: r,
|
|
22
23
|
markFillColor: l,
|
|
23
|
-
markBorderColor:
|
|
24
|
-
markSizeScale:
|
|
25
|
-
measures:
|
|
26
|
-
data:
|
|
24
|
+
markBorderColor: C,
|
|
25
|
+
markSizeScale: o,
|
|
26
|
+
measures: m,
|
|
27
|
+
data: b,
|
|
27
28
|
breaks: n,
|
|
28
|
-
gradientScheme:
|
|
29
|
+
gradientScheme: T,
|
|
29
30
|
gradientReverse: s,
|
|
30
|
-
labelFontSize:
|
|
31
|
-
} = this.props,
|
|
31
|
+
labelFontSize: f
|
|
32
|
+
} = this.props, i = this.props.transform ? this.props.transform.k : 1;
|
|
32
33
|
super.resize();
|
|
33
|
-
const
|
|
34
|
+
const u = new et({
|
|
34
35
|
breaks: n,
|
|
35
36
|
defaultFillColor: l,
|
|
36
|
-
defaultBorderColor:
|
|
37
|
-
defaultSize:
|
|
37
|
+
defaultBorderColor: C,
|
|
38
|
+
defaultSize: o
|
|
38
39
|
});
|
|
39
|
-
this.g.selectAll(".centroids .point").attr("r", (p) =>
|
|
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(
|
|
42
|
+
getTooltipVariables(r) {
|
|
42
43
|
const { apiJoinAttribute: l } = this.props;
|
|
43
|
-
return
|
|
44
|
-
...
|
|
44
|
+
return r.properties._value ? {
|
|
45
|
+
...r.properties,
|
|
45
46
|
meta: {
|
|
46
|
-
[l]:
|
|
47
|
-
...
|
|
48
|
-
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(
|
|
53
|
+
createDataLayer(r) {
|
|
53
54
|
const {
|
|
54
55
|
app: l,
|
|
55
|
-
svg:
|
|
56
|
-
format:
|
|
57
|
-
id:
|
|
58
|
-
file:
|
|
56
|
+
svg: C,
|
|
57
|
+
format: o,
|
|
58
|
+
id: m,
|
|
59
|
+
file: b,
|
|
59
60
|
path: n,
|
|
60
|
-
onLayerCreated:
|
|
61
|
+
onLayerCreated: T,
|
|
61
62
|
labelFilter: s = [],
|
|
62
|
-
labelField:
|
|
63
|
-
labelFontSize:
|
|
64
|
-
labelColor:
|
|
63
|
+
labelField: f,
|
|
64
|
+
labelFontSize: i,
|
|
65
|
+
labelColor: u,
|
|
65
66
|
fillColor: p,
|
|
66
|
-
borderColor:
|
|
67
|
+
borderColor: _,
|
|
67
68
|
tooltip: x,
|
|
68
|
-
markFillColor:
|
|
69
|
-
markLabelColor:
|
|
70
|
-
markBorderColor:
|
|
71
|
-
markSizeScale:
|
|
72
|
-
markerLabelSize:
|
|
73
|
-
featureJoinAttribute:
|
|
74
|
-
apiJoinAttribute:
|
|
75
|
-
measures:
|
|
76
|
-
editing:
|
|
77
|
-
data:
|
|
78
|
-
patternDiscriminator:
|
|
79
|
-
patternDiscriminatorLabel:
|
|
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:
|
|
83
|
-
patterns:
|
|
84
|
-
projection:
|
|
85
|
-
useBreaks:
|
|
86
|
-
useGradients:
|
|
87
|
-
useCentroidPoint:
|
|
83
|
+
gradientReverse: j,
|
|
84
|
+
patterns: P,
|
|
85
|
+
projection: ot,
|
|
86
|
+
useBreaks: tt,
|
|
87
|
+
useGradients: R,
|
|
88
|
+
useCentroidPoint: U,
|
|
88
89
|
usePattern: q,
|
|
89
|
-
waitForFilters:
|
|
90
|
-
intl:
|
|
91
|
-
patternsVisible:
|
|
92
|
-
togglePatterns:
|
|
93
|
-
colorLayerVisible:
|
|
94
|
-
visible:
|
|
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 =
|
|
98
|
-
const
|
|
99
|
-
this.createPaths(
|
|
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(
|
|
103
|
+
createColors(r) {
|
|
103
104
|
const {
|
|
104
105
|
app: l,
|
|
105
|
-
svg:
|
|
106
|
-
format:
|
|
107
|
-
id:
|
|
108
|
-
file:
|
|
106
|
+
svg: C,
|
|
107
|
+
format: o,
|
|
108
|
+
id: m,
|
|
109
|
+
file: b,
|
|
109
110
|
path: n,
|
|
110
|
-
onLayerCreated:
|
|
111
|
+
onLayerCreated: T,
|
|
111
112
|
labelFilter: s = [],
|
|
112
|
-
labelField:
|
|
113
|
-
labelFontSize:
|
|
114
|
-
labelColor:
|
|
113
|
+
labelField: f,
|
|
114
|
+
labelFontSize: i,
|
|
115
|
+
labelColor: u,
|
|
115
116
|
fillColor: p,
|
|
116
|
-
borderColor:
|
|
117
|
+
borderColor: _,
|
|
117
118
|
tooltip: x,
|
|
118
|
-
markFillColor:
|
|
119
|
-
markLabelColor:
|
|
120
|
-
markBorderColor:
|
|
121
|
-
markSizeScale:
|
|
122
|
-
markerLabelSize:
|
|
123
|
-
featureJoinAttribute:
|
|
124
|
-
apiJoinAttribute:
|
|
125
|
-
measures:
|
|
126
|
-
editing:
|
|
127
|
-
data:
|
|
128
|
-
patternDiscriminator:
|
|
129
|
-
patternDiscriminatorLabel:
|
|
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:
|
|
133
|
-
patterns:
|
|
134
|
-
projection:
|
|
135
|
-
useBreaks:
|
|
136
|
-
useGradients:
|
|
137
|
-
useCentroidPoint:
|
|
133
|
+
gradientReverse: j,
|
|
134
|
+
patterns: P,
|
|
135
|
+
projection: ot,
|
|
136
|
+
useBreaks: tt,
|
|
137
|
+
useGradients: R,
|
|
138
|
+
useCentroidPoint: U,
|
|
138
139
|
usePattern: q,
|
|
139
|
-
waitForFilters:
|
|
140
|
-
intl:
|
|
141
|
-
patternsVisible:
|
|
142
|
-
togglePatterns:
|
|
143
|
-
colorLayerVisible:
|
|
144
|
-
visible:
|
|
145
|
-
} = this.props, { gradientStartColor:
|
|
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:
|
|
148
|
-
defaultBorderColor:
|
|
149
|
-
defaultSize:
|
|
150
|
-
}),
|
|
151
|
-
data:
|
|
152
|
-
measure:
|
|
153
|
-
defaultFillColor:
|
|
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:
|
|
156
|
-
gradientStartColor:
|
|
157
|
-
gradientEndColor:
|
|
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 :
|
|
160
|
-
|
|
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
|
-
}),
|
|
169
|
+
}), M || this.g.selectAll(".borders").style("fill", this.props.fillColor), this.g.attr("transform", this.props.transform));
|
|
166
170
|
}
|
|
167
|
-
createCentroids(
|
|
171
|
+
createCentroids(r) {
|
|
168
172
|
const {
|
|
169
173
|
app: l,
|
|
170
|
-
svg:
|
|
171
|
-
format:
|
|
172
|
-
id:
|
|
173
|
-
file:
|
|
174
|
+
svg: C,
|
|
175
|
+
format: o,
|
|
176
|
+
id: m,
|
|
177
|
+
file: b,
|
|
174
178
|
path: n,
|
|
175
|
-
onLayerCreated:
|
|
179
|
+
onLayerCreated: T,
|
|
176
180
|
labelFilter: s = [],
|
|
177
|
-
labelField:
|
|
178
|
-
labelFontSize:
|
|
179
|
-
labelColor:
|
|
181
|
+
labelField: f,
|
|
182
|
+
labelFontSize: i,
|
|
183
|
+
labelColor: u,
|
|
180
184
|
fillColor: p,
|
|
181
|
-
borderColor:
|
|
185
|
+
borderColor: _,
|
|
182
186
|
tooltip: x,
|
|
183
|
-
markFillColor:
|
|
184
|
-
markLabelColor:
|
|
185
|
-
markBorderColor:
|
|
186
|
-
markSizeScale:
|
|
187
|
-
markerLabelSize:
|
|
188
|
-
featureJoinAttribute:
|
|
189
|
-
apiJoinAttribute:
|
|
190
|
-
measures:
|
|
191
|
-
editing:
|
|
192
|
-
data:
|
|
193
|
-
patternDiscriminator:
|
|
194
|
-
patternDiscriminatorLabel:
|
|
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:
|
|
198
|
-
patterns:
|
|
199
|
-
projection:
|
|
200
|
-
useBreaks:
|
|
201
|
-
useGradients:
|
|
202
|
-
useCentroidPoint:
|
|
201
|
+
gradientReverse: j,
|
|
202
|
+
patterns: P,
|
|
203
|
+
projection: ot,
|
|
204
|
+
useBreaks: tt,
|
|
205
|
+
useGradients: R,
|
|
206
|
+
useCentroidPoint: U,
|
|
203
207
|
usePattern: q,
|
|
204
|
-
waitForFilters:
|
|
205
|
-
intl:
|
|
206
|
-
patternsVisible:
|
|
207
|
-
togglePatterns:
|
|
208
|
-
colorLayerVisible:
|
|
209
|
-
visible:
|
|
210
|
-
} = this.props,
|
|
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:
|
|
213
|
-
defaultBorderColor:
|
|
214
|
-
defaultSize:
|
|
215
|
-
}),
|
|
216
|
+
defaultFillColor: y,
|
|
217
|
+
defaultBorderColor: g,
|
|
218
|
+
defaultSize: $
|
|
219
|
+
}), J = (d) => new nt({
|
|
216
220
|
data: d.children,
|
|
217
|
-
measure:
|
|
218
|
-
defaultFillColor:
|
|
221
|
+
measure: D[0],
|
|
222
|
+
defaultFillColor: y,
|
|
219
223
|
gradientScheme: N,
|
|
220
|
-
gradientReverse:
|
|
224
|
+
gradientReverse: j
|
|
221
225
|
});
|
|
222
226
|
if (this.g) {
|
|
223
227
|
const d = {
|
|
224
|
-
style:
|
|
225
|
-
notation:
|
|
226
|
-
currency:
|
|
227
|
-
minimumFractionDigits: parseInt(
|
|
228
|
-
maximumFractionDigits: parseInt(
|
|
229
|
-
},
|
|
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(
|
|
232
|
-
h.append("circle").attr("fill", (
|
|
233
|
-
if (
|
|
234
|
-
const
|
|
235
|
-
...
|
|
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
|
-
[
|
|
238
|
-
...
|
|
239
|
-
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,
|
|
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", (
|
|
248
|
+
}).on("mouseleave", (t) => {
|
|
245
249
|
this.hiddenToolTip();
|
|
246
|
-
}), h.append("text").attr("class", "point-label").attr("x", (
|
|
247
|
-
}),
|
|
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(
|
|
254
|
+
createPatterns(r) {
|
|
251
255
|
const {
|
|
252
256
|
app: l,
|
|
253
|
-
svg:
|
|
254
|
-
format:
|
|
255
|
-
id:
|
|
256
|
-
file:
|
|
257
|
+
svg: C,
|
|
258
|
+
format: o,
|
|
259
|
+
id: m,
|
|
260
|
+
file: b,
|
|
257
261
|
path: n,
|
|
258
|
-
onLayerCreated:
|
|
262
|
+
onLayerCreated: T,
|
|
259
263
|
labelFilter: s = [],
|
|
260
|
-
labelField:
|
|
261
|
-
labelFontSize:
|
|
262
|
-
labelColor:
|
|
264
|
+
labelField: f,
|
|
265
|
+
labelFontSize: i,
|
|
266
|
+
labelColor: u,
|
|
263
267
|
fillColor: p,
|
|
264
|
-
borderColor:
|
|
268
|
+
borderColor: _,
|
|
265
269
|
tooltip: x,
|
|
266
|
-
markFillColor:
|
|
267
|
-
markLabelColor:
|
|
268
|
-
markBorderColor:
|
|
269
|
-
markSizeScale:
|
|
270
|
-
markerLabelSize:
|
|
271
|
-
featureJoinAttribute:
|
|
272
|
-
apiJoinAttribute:
|
|
273
|
-
measures:
|
|
274
|
-
editing:
|
|
275
|
-
data:
|
|
276
|
-
patternDiscriminator:
|
|
277
|
-
patternDiscriminatorLabel:
|
|
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:
|
|
281
|
-
patterns:
|
|
282
|
-
projection:
|
|
283
|
-
useBreaks:
|
|
284
|
-
useGradients:
|
|
285
|
-
useCentroidPoint:
|
|
284
|
+
gradientReverse: j,
|
|
285
|
+
patterns: P,
|
|
286
|
+
projection: ot,
|
|
287
|
+
useBreaks: tt,
|
|
288
|
+
useGradients: R,
|
|
289
|
+
useCentroidPoint: U,
|
|
286
290
|
usePattern: q,
|
|
287
|
-
waitForFilters:
|
|
288
|
-
intl:
|
|
289
|
-
patternsVisible:
|
|
290
|
-
togglePatterns:
|
|
291
|
-
colorLayerVisible:
|
|
292
|
-
visible:
|
|
293
|
-
} = this.props,
|
|
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:
|
|
296
|
-
defaultBorderColor:
|
|
297
|
-
defaultSize:
|
|
298
|
-
}),
|
|
299
|
-
data:
|
|
300
|
-
measure:
|
|
301
|
-
defaultFillColor:
|
|
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:
|
|
307
|
+
gradientReverse: j,
|
|
304
308
|
gradientStartColor,
|
|
305
309
|
gradientEndColor
|
|
306
310
|
});
|
|
307
|
-
let
|
|
308
|
-
if (l == "csv" &&
|
|
309
|
-
|
|
310
|
-
key:
|
|
311
|
-
type:
|
|
312
|
-
color:
|
|
313
|
-
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 (
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
const
|
|
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:
|
|
322
|
-
color:
|
|
323
|
-
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
|
|
329
|
-
if (
|
|
330
|
-
|
|
331
|
-
}),
|
|
332
|
-
this.g.selectAll(".shape-pattern").remove(),
|
|
333
|
-
let
|
|
334
|
-
a.properties && a.properties.meta && (
|
|
335
|
-
this.g.append("path").attr("d", n(a)).datum(
|
|
336
|
-
if (
|
|
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", (
|
|
339
|
-
|
|
340
|
-
|
|
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", (
|
|
347
|
+
}).on("mouseleave", (W) => {
|
|
343
348
|
this.hiddenToolTip();
|
|
344
349
|
});
|
|
345
350
|
}));
|
|
346
|
-
}),
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
a.type === "lines" &&
|
|
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
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}),
|
|
357
|
-
|
|
358
|
-
}),
|
|
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(
|
|
362
|
-
const n =
|
|
363
|
-
const
|
|
364
|
-
if (l != "csv" &&
|
|
365
|
-
const
|
|
366
|
-
if (
|
|
367
|
-
const
|
|
368
|
-
if (s.properties.meta =
|
|
369
|
-
const p =
|
|
370
|
-
s.properties.meta[
|
|
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
|
|
376
|
-
|
|
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 { ...
|
|
386
|
+
return { ...r, features: n };
|
|
382
387
|
}
|
|
383
|
-
componentDidUpdate(
|
|
384
|
-
const { app:
|
|
385
|
-
if ((
|
|
386
|
-
const p =
|
|
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
|
-
|
|
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:
|
|
401
|
+
id: r,
|
|
397
402
|
file: l,
|
|
398
|
-
path:
|
|
399
|
-
zoom:
|
|
400
|
-
labelFilter:
|
|
401
|
-
labelField:
|
|
403
|
+
path: C,
|
|
404
|
+
zoom: o,
|
|
405
|
+
labelFilter: m = [],
|
|
406
|
+
labelField: b,
|
|
402
407
|
labelFontSize: n,
|
|
403
|
-
labelColor:
|
|
408
|
+
labelColor: T,
|
|
404
409
|
fillColor: s,
|
|
405
|
-
borderColor:
|
|
406
|
-
featureJoinAttribute:
|
|
407
|
-
apiJoinAttribute:
|
|
410
|
+
borderColor: f,
|
|
411
|
+
featureJoinAttribute: i,
|
|
412
|
+
apiJoinAttribute: u,
|
|
408
413
|
dvzProxyDatasetId: p,
|
|
409
|
-
editing:
|
|
414
|
+
editing: _
|
|
410
415
|
} = this.props;
|
|
411
|
-
return /* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ rt("g", { id: "data-" + r, className: "data " + r, ref: this.gRef });
|
|
412
417
|
}
|
|
413
418
|
}
|
|
414
|
-
const
|
|
419
|
+
const bt = (V) => {
|
|
415
420
|
const {
|
|
416
|
-
id:
|
|
421
|
+
id: r,
|
|
417
422
|
unique: l,
|
|
418
|
-
filters:
|
|
419
|
-
csv:
|
|
420
|
-
app:
|
|
421
|
-
group:
|
|
423
|
+
filters: C,
|
|
424
|
+
csv: o,
|
|
425
|
+
app: m,
|
|
426
|
+
group: b = "default",
|
|
422
427
|
apiJoinAttribute: n,
|
|
423
|
-
editing:
|
|
428
|
+
editing: T,
|
|
424
429
|
patternDiscriminator: s,
|
|
425
|
-
dvzProxyDatasetId:
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
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:
|
|
437
|
-
params:
|
|
438
|
-
app:
|
|
439
|
-
csv: decodeURIComponent(
|
|
440
|
-
|
|
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: [
|
|
454
|
+
store: [m, l, r],
|
|
444
455
|
mySelf: "Data layer",
|
|
445
456
|
source: n + (s != "none" ? "/" + s : ""),
|
|
446
|
-
children: /* @__PURE__ */
|
|
457
|
+
children: /* @__PURE__ */ rt(ht, { children: /* @__PURE__ */ rt(gt, { ...V }) })
|
|
447
458
|
}
|
|
448
459
|
);
|
|
449
|
-
},
|
|
460
|
+
}, zt = mt(bt);
|
|
450
461
|
export {
|
|
451
|
-
|
|
462
|
+
zt as default
|
|
452
463
|
};
|