@devgateway/dvz-ui-react 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/embeddable/big-number/index.js +1 -1
- package/dist/cjs/embeddable/chart/Bar.js +1 -1
- package/dist/cjs/embeddable/chart/index.js +1 -1
- package/dist/cjs/embeddable/d3Map/BaseLayer.js +1 -1
- package/dist/cjs/embeddable/d3Map/DataLayer.js +1 -1
- package/dist/cjs/embeddable/d3Map/FlowLayer.js +1 -1
- package/dist/cjs/embeddable/d3Map/ZoomControl.js +1 -1
- package/dist/cjs/embeddable/d3Map/index.js +1 -1
- package/dist/cjs/embeddable/posts-with-filters/DropDownFilter.js +1 -0
- package/dist/cjs/embeddable/posts-with-filters/Post.js +1 -1
- package/dist/cjs/embeddable/posts-with-filters/index.js +1 -1
- package/dist/cjs/embeddable/reducers/data-api.js +1 -1
- package/dist/cjs/layout/containers/SlugPostContainer.js +1 -1
- package/dist/cjs/styles.css +1 -1
- package/dist/esm/embeddable/big-number/index.js +92 -85
- package/dist/esm/embeddable/chart/Bar.js +128 -123
- package/dist/esm/embeddable/chart/index.js +229 -225
- package/dist/esm/embeddable/d3Map/BaseLayer.js +40 -27
- package/dist/esm/embeddable/d3Map/DataLayer.js +196 -204
- package/dist/esm/embeddable/d3Map/FlowLayer.js +104 -101
- package/dist/esm/embeddable/d3Map/ZoomControl.js +64 -54
- package/dist/esm/embeddable/d3Map/index.js +110 -99
- package/dist/esm/embeddable/posts-with-filters/DropDownFilter.js +25 -0
- package/dist/esm/embeddable/posts-with-filters/Post.js +49 -24
- package/dist/esm/embeddable/posts-with-filters/index.js +120 -119
- package/dist/esm/embeddable/reducers/data-api.js +13 -11
- package/dist/esm/layout/containers/SlugPostContainer.js +3 -3
- package/dist/esm/styles.css +1 -1
- package/dist/types/embeddable/chart/Bar.d.ts +2 -0
- package/dist/types/embeddable/d3Map/BaseLayer.d.ts +1 -0
- package/dist/types/embeddable/d3Map/ZoomControl.d.ts +2 -1
- package/dist/types/embeddable/posts-with-filters/DropDownFilter.d.ts +4 -0
- package/dist/types/embeddable/posts-with-filters/Post.d.ts +4 -2
- package/package.json +4 -2
|
@@ -1,59 +1,72 @@
|
|
|
1
1
|
import { jsx as x } from "react/jsx-runtime";
|
|
2
2
|
import R from "react";
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
class
|
|
3
|
+
import * as c from "d3";
|
|
4
|
+
import v from "./Layer.js";
|
|
5
|
+
class F extends v {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(), this.gRef = R.createRef();
|
|
8
8
|
}
|
|
9
9
|
createPaths(e) {
|
|
10
10
|
const {
|
|
11
11
|
path: s,
|
|
12
|
-
fillColor:
|
|
13
|
-
borderColor:
|
|
14
|
-
projection:
|
|
12
|
+
fillColor: r,
|
|
13
|
+
borderColor: o,
|
|
14
|
+
projection: i
|
|
15
15
|
} = this.props;
|
|
16
|
-
this.gRef && this.gRef.current && (this.g =
|
|
16
|
+
this.gRef && this.gRef.current && (this.g = c.select(this.gRef.current), this.g.attr("class", "base-layer zoomable"), this.g.selectAll(".borders").remove(), this.g.selectAll(".feature-label").remove(), this.g.selectAll(".borders").data(e.features).enter().append("path").attr("fill", r).attr("stroke", o).attr("id", "state-borders").attr("class", "borders").attr("d", s).style("vector-effect", "non-scaling-stroke"));
|
|
17
17
|
}
|
|
18
18
|
createLabels(e) {
|
|
19
19
|
const {
|
|
20
20
|
path: s,
|
|
21
|
-
labelFilter:
|
|
22
|
-
labelSettings:
|
|
23
|
-
labelField:
|
|
24
|
-
labelFontSize:
|
|
25
|
-
labelColor:
|
|
21
|
+
labelFilter: r = [],
|
|
22
|
+
labelSettings: o = {},
|
|
23
|
+
labelField: i,
|
|
24
|
+
labelFontSize: f,
|
|
25
|
+
labelColor: l,
|
|
26
26
|
projection: h,
|
|
27
|
-
initialPosition: d
|
|
27
|
+
initialPosition: d,
|
|
28
|
+
minLabelZoomVisible: b
|
|
28
29
|
} = this.props;
|
|
29
30
|
if (this.gRef && this.gRef.current) {
|
|
30
|
-
this.g =
|
|
31
|
-
const
|
|
32
|
-
this.g.selectAll(".feature-label").data(e.features.filter((t) =>
|
|
33
|
-
return t.properties[
|
|
34
|
-
}).attr("
|
|
35
|
-
const p =
|
|
36
|
-
return "translate(" + [
|
|
37
|
-
}).attr("text-anchor", "middle").attr("dominant-baseline", "middle");
|
|
31
|
+
this.g = c.select(this.gRef.current);
|
|
32
|
+
const a = h.scale(), n = this.props.transform ? this.props.transform.k : d.k;
|
|
33
|
+
this.g.selectAll(".feature-label").data(e.features.filter((t) => r.indexOf(t.properties[i]) == -1)).enter().append("text").attr("class", "feature-label").attr("font-size", (t) => Math.max(0.5, f / n) + "px").style("pointer-events", "none").text(function(t) {
|
|
34
|
+
return t.properties[i];
|
|
35
|
+
}).attr("color", l).attr("fill", l).attr("transform", function(t) {
|
|
36
|
+
const p = o[t.properties[i] + "_rotation"] || 0, g = o[t.properties[i] + "_offsetX"] || 0, m = o[t.properties[i] + "_offsetY"] || 0, u = s.centroid(t)[0] + g / a, y = s.centroid(t)[1] + m / a;
|
|
37
|
+
return "translate(" + [u, y] + "),rotate(" + (p || 0) + ")";
|
|
38
|
+
}).attr("text-anchor", "middle").attr("dominant-baseline", "middle"), n < b ? (console.log("remove layers"), this.g.selectAll(".feature-label").transition().style("display", "none")) : this.g.selectAll(".feature-label").style("display", "");
|
|
38
39
|
}
|
|
39
40
|
}
|
|
41
|
+
resize() {
|
|
42
|
+
const {
|
|
43
|
+
labelFontSize: e,
|
|
44
|
+
minLabelZoomVisible: s = -1
|
|
45
|
+
} = this.props;
|
|
46
|
+
debugger;
|
|
47
|
+
const r = this.props.transform ? this.props.transform.k : 1;
|
|
48
|
+
console.log("minLabelZoomVisible", s, r), r < s ? (console.log("remove layers"), this.g.selectAll(".feature-label").transition().style("display", "none")) : this.g.selectAll(".feature-label").style("display", ""), this.g.selectAll(".feature-label").attr("font-size", (o) => Math.max(0.5, e / r) + "px");
|
|
49
|
+
}
|
|
40
50
|
createLayer(e) {
|
|
41
|
-
this.createPaths(e), this.createLabels(e)
|
|
51
|
+
if (this.createPaths(e), this.createLabels(e), this.props.onReady) {
|
|
52
|
+
debugger;
|
|
53
|
+
this.props.onReady();
|
|
54
|
+
}
|
|
42
55
|
}
|
|
43
56
|
componentDidMount() {
|
|
44
57
|
super.componentDidMount();
|
|
45
58
|
}
|
|
46
|
-
componentDidUpdate(e, s,
|
|
59
|
+
componentDidUpdate(e, s, r) {
|
|
47
60
|
const {
|
|
48
|
-
editing:
|
|
61
|
+
editing: o
|
|
49
62
|
} = this.props;
|
|
50
|
-
|
|
63
|
+
o && this.create(), e.visible != this.props.visible && this.g.style("display", this.props.visible ? "block" : "none"), this.g && this.resize();
|
|
51
64
|
}
|
|
52
65
|
render() {
|
|
53
|
-
const { name: e, height: s, width:
|
|
66
|
+
const { name: e, height: s, width: r } = this.props;
|
|
54
67
|
return /* @__PURE__ */ x("g", { ref: this.gRef });
|
|
55
68
|
}
|
|
56
69
|
}
|
|
57
70
|
export {
|
|
58
|
-
|
|
71
|
+
F as default
|
|
59
72
|
};
|