@devgateway/dvz-ui-react 1.6.19 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/cjs/_virtual/_commonjsHelpers.js +1 -0
  2. package/dist/cjs/_virtual/debounce.js +1 -0
  3. package/dist/cjs/api/commons.js +1 -1
  4. package/dist/cjs/embeddable/big-filter/BigNumberGroup.js +1 -0
  5. package/dist/cjs/embeddable/big-filter/BigNumberItem.js +1 -0
  6. package/dist/cjs/embeddable/big-filter/DataProvider.js +1 -0
  7. package/dist/cjs/embeddable/big-filter/index.js +1 -0
  8. package/dist/cjs/embeddable/big-number/index.js +1 -1
  9. package/dist/cjs/embeddable/big-number-trend/Alternative.js +1 -0
  10. package/dist/cjs/embeddable/big-number-trend/Classic.js +1 -0
  11. package/dist/cjs/embeddable/big-number-trend/index.js +1 -1
  12. package/dist/cjs/embeddable/chart/Bar.js +1 -1
  13. package/dist/cjs/embeddable/chart/Line.js +1 -1
  14. package/dist/cjs/embeddable/chart/data/Bar.js +1 -1
  15. package/dist/cjs/embeddable/chart/index.js +1 -1
  16. package/dist/cjs/embeddable/d3Map/BaseLayer.js +1 -1
  17. package/dist/cjs/embeddable/d3Map/BreaksStyles.js +1 -1
  18. package/dist/cjs/embeddable/d3Map/DataLayer.js +1 -1
  19. package/dist/cjs/embeddable/d3Map/FlowLayer.js +1 -1
  20. package/dist/cjs/embeddable/d3Map/GradientColors.js +1 -1
  21. package/dist/cjs/embeddable/d3Map/LatLongLayer.js +1 -1
  22. package/dist/cjs/embeddable/d3Map/Layer.js +1 -1
  23. package/dist/cjs/embeddable/d3Map/Legends.js +1 -1
  24. package/dist/cjs/embeddable/d3Map/ProjectedContainer.js +1 -1
  25. package/dist/cjs/embeddable/d3Map/Utils.js +1 -1
  26. package/dist/cjs/embeddable/d3Map/ZoomControl.js +1 -1
  27. package/dist/cjs/embeddable/d3Map/index.js +1 -1
  28. package/dist/cjs/embeddable/data/CategoriesProvider.js +1 -1
  29. package/dist/cjs/embeddable/data/D3MapDataConsumer.js +1 -0
  30. package/dist/cjs/embeddable/data/D3MapDataProvider.js +1 -0
  31. package/dist/cjs/embeddable/data/DataContext.js +1 -1
  32. package/dist/cjs/embeddable/data/DataProvider.js +1 -1
  33. package/dist/cjs/embeddable/data-paragraph/index.js +1 -0
  34. package/dist/cjs/embeddable/download/dom-to-image.js +2 -2
  35. package/dist/cjs/embeddable/download/index.js +5 -5
  36. package/dist/cjs/embeddable/filter/index.js +1 -1
  37. package/dist/cjs/embeddable/grouped-bars/GroupedBars.js +1 -0
  38. package/dist/cjs/embeddable/grouped-bars/index.js +1 -0
  39. package/dist/cjs/embeddable/index.js +1 -1
  40. package/dist/cjs/embeddable/reducers/data-api.js +1 -1
  41. package/dist/cjs/embeddable/reducers/data.js +1 -1
  42. package/dist/cjs/embeddable/utils/common.js +1 -1
  43. package/dist/cjs/index.js +1 -1
  44. package/dist/cjs/layout/Customizer.js +1 -1
  45. package/dist/cjs/layout/PreviewComponent.js +1 -1
  46. package/dist/cjs/layout/containers/SlugPostContainer.js +1 -1
  47. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js +1 -0
  48. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +1 -0
  49. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTrim.js +1 -0
  50. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +1 -0
  51. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js +1 -0
  52. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js +1 -0
  53. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js +1 -0
  54. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.js +1 -0
  55. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/debounce.js +1 -0
  56. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js +1 -0
  57. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js +1 -0
  58. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js +1 -0
  59. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/now.js +1 -0
  60. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toNumber.js +1 -0
  61. package/dist/cjs/styles.css +1 -1
  62. package/dist/esm/_virtual/_commonjsHelpers.js +8 -0
  63. package/dist/esm/_virtual/debounce.js +7 -0
  64. package/dist/esm/api/commons.js +26 -17
  65. package/dist/esm/embeddable/big-filter/BigNumberGroup.js +129 -0
  66. package/dist/esm/embeddable/big-filter/BigNumberItem.js +107 -0
  67. package/dist/esm/embeddable/big-filter/DataProvider.js +53 -0
  68. package/dist/esm/embeddable/big-filter/index.js +130 -0
  69. package/dist/esm/embeddable/big-number/index.js +154 -102
  70. package/dist/esm/embeddable/big-number-trend/Alternative.js +227 -0
  71. package/dist/esm/embeddable/big-number-trend/Classic.js +190 -0
  72. package/dist/esm/embeddable/big-number-trend/index.js +12 -147
  73. package/dist/esm/embeddable/chart/Bar.js +450 -395
  74. package/dist/esm/embeddable/chart/Line.js +216 -184
  75. package/dist/esm/embeddable/chart/data/Bar.js +16 -18
  76. package/dist/esm/embeddable/chart/index.js +168 -162
  77. package/dist/esm/embeddable/d3Map/BaseLayer.js +25 -28
  78. package/dist/esm/embeddable/d3Map/BreaksStyles.js +17 -10
  79. package/dist/esm/embeddable/d3Map/DataLayer.js +290 -289
  80. package/dist/esm/embeddable/d3Map/FlowLayer.js +122 -136
  81. package/dist/esm/embeddable/d3Map/GradientColors.js +27 -20
  82. package/dist/esm/embeddable/d3Map/LatLongLayer.js +62 -62
  83. package/dist/esm/embeddable/d3Map/Layer.js +31 -27
  84. package/dist/esm/embeddable/d3Map/Legends.js +204 -190
  85. package/dist/esm/embeddable/d3Map/ProjectedContainer.js +1 -3
  86. package/dist/esm/embeddable/d3Map/Utils.js +12 -8
  87. package/dist/esm/embeddable/d3Map/ZoomControl.js +41 -41
  88. package/dist/esm/embeddable/d3Map/index.js +135 -117
  89. package/dist/esm/embeddable/data/CategoriesProvider.js +39 -26
  90. package/dist/esm/embeddable/data/D3MapDataConsumer.js +7 -0
  91. package/dist/esm/embeddable/data/D3MapDataProvider.js +83 -0
  92. package/dist/esm/embeddable/data/DataContext.js +2 -2
  93. package/dist/esm/embeddable/data/DataProvider.js +125 -56
  94. package/dist/esm/embeddable/data-paragraph/index.js +168 -0
  95. package/dist/esm/embeddable/download/dom-to-image.js +163 -148
  96. package/dist/esm/embeddable/download/index.js +102 -76
  97. package/dist/esm/embeddable/filter/index.js +335 -298
  98. package/dist/esm/embeddable/grouped-bars/GroupedBars.js +549 -0
  99. package/dist/esm/embeddable/grouped-bars/index.js +16 -0
  100. package/dist/esm/embeddable/index.js +33 -30
  101. package/dist/esm/embeddable/reducers/data-api.js +44 -35
  102. package/dist/esm/embeddable/reducers/data.js +141 -182
  103. package/dist/esm/embeddable/utils/common.js +3 -3
  104. package/dist/esm/index.js +111 -94
  105. package/dist/esm/layout/Customizer.js +10 -9
  106. package/dist/esm/layout/PreviewComponent.js +23 -26
  107. package/dist/esm/layout/containers/SlugPostContainer.js +9 -8
  108. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js +11 -0
  109. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +16 -0
  110. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTrim.js +14 -0
  111. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +11 -0
  112. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js +21 -0
  113. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js +13 -0
  114. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js +11 -0
  115. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.js +15 -0
  116. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/debounce.js +60 -0
  117. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js +13 -0
  118. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js +12 -0
  119. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js +15 -0
  120. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/now.js +13 -0
  121. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toNumber.js +28 -0
  122. package/dist/esm/styles.css +1 -1
  123. package/dist/types/api/commons.d.ts +4 -1
  124. package/dist/types/embeddable/big-filter/BigNumberGroup.d.ts +3 -0
  125. package/dist/types/embeddable/big-filter/BigNumberItem.d.ts +2 -0
  126. package/dist/types/embeddable/big-filter/DataProvider.d.ts +7 -0
  127. package/dist/types/embeddable/big-filter/index.d.ts +5 -0
  128. package/dist/types/embeddable/big-number-trend/Alternative.d.ts +5 -0
  129. package/dist/types/embeddable/big-number-trend/Classic.d.ts +5 -0
  130. package/dist/types/embeddable/big-number-trend/index.d.ts +2 -4
  131. package/dist/types/embeddable/chart/Bar.d.ts +3 -0
  132. package/dist/types/embeddable/chart/Line.d.ts +6 -0
  133. package/dist/types/embeddable/d3Map/GradientColors.d.ts +6 -2
  134. package/dist/types/embeddable/d3Map/Layer.d.ts +1 -1
  135. package/dist/types/embeddable/d3Map/Utils.d.ts +1 -1
  136. package/dist/types/embeddable/data/D3MapDataProvider.d.ts +7 -0
  137. package/dist/types/embeddable/data/index.d.ts +6 -0
  138. package/dist/types/embeddable/data-paragraph/index.d.ts +5 -0
  139. package/dist/types/embeddable/filter/index.d.ts +13 -1
  140. package/dist/types/embeddable/grouped-bars/GroupedBars.d.ts +5 -0
  141. package/dist/types/embeddable/grouped-bars/index.d.ts +3 -0
  142. package/dist/types/embeddable/reducers/data-api.d.ts +5 -0
  143. package/dist/types/embeddable/reducers/data.d.ts +16 -9
  144. package/dist/types/embeddable/utils/index.d.ts +1 -0
  145. package/dist/types/embeddable/utils/parseUtils.d.ts +0 -6
  146. package/dist/types/index.d.ts +6 -0
  147. package/dist/types/layout/Customizer.d.ts +1 -0
  148. package/dist/types/layout/containers/PageContainer.d.ts +8 -0
  149. package/dist/types/layout/containers/PostContainer.d.ts +0 -0
  150. package/dist/types/layout/index.d.ts +1 -0
  151. package/dist/types/utils/Logger.d.ts +1 -0
  152. package/package.json +4 -3
  153. /package/dist/types/embeddable/data/{DataConsumerMap.d.ts → D3MapDataConsumer.d.ts} +0 -0
@@ -1,184 +1,170 @@
1
- import { jsx as L } from "react/jsx-runtime";
1
+ import { jsx as b } from "react/jsx-runtime";
2
2
  import "react";
3
- import q from "./BaseLayer.js";
4
- import G from "../data/DataProvider.js";
5
- import H from "../data/DataConsumer.js";
6
- import * as P from "d3";
7
- import { injectIntl as X } from "react-intl";
8
- import K from "papaparse";
9
- import Q from "./BreaksStyles.js";
10
- class Z extends q {
3
+ import Y from "./BaseLayer.js";
4
+ import q from "../data/DataProvider.js";
5
+ import G from "../data/DataConsumer.js";
6
+ import * as T from "d3";
7
+ import { injectIntl as H } from "react-intl";
8
+ import X from "papaparse";
9
+ import K from "./BreaksStyles.js";
10
+ class Q extends Y {
11
11
  constructor() {
12
12
  super(), this.createDataLayer = this.createDataLayer.bind(this);
13
13
  }
14
- createDataLayer(r) {
14
+ createDataLayer(t) {
15
15
  const {
16
- format: s,
17
- path: a,
18
- tooltip: k,
16
+ format: i,
17
+ path: s,
18
+ tooltip: u,
19
19
  markFillColor: n,
20
- markBorderColor: g,
21
- markSizeScale: F,
20
+ markBorderColor: m,
21
+ markSizeScale: g,
22
22
  //circle size
23
- featureJoinAttribute: d,
24
- apiJoinAttribute: A,
25
- projection: w,
26
- breaks: C,
27
- markSizeScale2: b,
23
+ featureJoinAttribute: e,
24
+ apiJoinAttribute: v,
25
+ projection: o,
26
+ breaks: l,
27
+ markSizeScale2: p,
28
28
  //arrow size
29
- measures: u,
30
- zoom: v,
31
- offsetPixels: l = 10,
32
- waitForFilters: N
33
- } = this.props, E = u[0], x = new Q({
34
- breaks: C,
29
+ measures: f,
30
+ zoom: k,
31
+ offsetPixels: x = 10,
32
+ waitForFilters: $
33
+ } = this.props, _ = f[0], D = new K({
34
+ breaks: l,
35
35
  defaultFillColor: n,
36
- defaultBorderColor: g,
37
- defaultSize: b
36
+ defaultBorderColor: m,
37
+ defaultSize: p
38
38
  });
39
- s.style === "compacted" || s.style, s.style, s.currency, parseInt(s.minimumFractionDigits), parseInt(s.maximumFractionDigits);
40
- const _ = r.features.filter((t) => t.properties._value != null);
41
- this.g = P.select(this.gRef.current), this.g.attr("class", "base-layer zoomable"), this.props.transform && this.g.attr("transform", this.props.transform), this.g.selectAll(".flow-line").remove(), this.g.selectAll(".start-point").remove(), this.g.selectAll(".end-point").remove(), this.g.select("defs").selectAll("*").remove();
42
- const J = this.props.transform ? this.props.transform.k : 1, S = [];
43
- _.forEach((t) => {
44
- S.push(t), t.properties.destinations.sort((p, e) => p[E] - e[E]).forEach((p) => {
45
- const e = p[E];
46
- r.features.filter((o) => o.properties[d] == p.value).forEach((o) => {
47
- o.properties.meta = p;
48
- const c = t.properties[d], i = t.properties[d] + "--" + o.properties[d], f = a.centroid(t), h = a.centroid(o), O = h[0] - f[0], T = h[1] - f[1], I = Math.sqrt(O * O + T * T), V = O / I, M = T / I, R = [
49
- h[0] - V * l,
50
- h[1] - M * l
51
- ], U = w.invert(R), W = {
39
+ i.style === "compacted" || i.style, i.style, i.currency, parseInt(i.minimumFractionDigits), parseInt(i.maximumFractionDigits);
40
+ const I = t.features.filter((r) => r.properties._value != null);
41
+ this.g = T.select(this.gRef.current), this.g.attr("class", "base-layer zoomable flow"), this.props.transform && this.g.attr("transform", this.props.transform), this.g.selectAll(".flow-line").remove(), this.g.selectAll(".start-point").remove(), this.g.selectAll(".end-point").remove(), this.g.select("defs").selectAll("*").remove();
42
+ const B = this.props.transform ? this.props.transform.k : 1, z = [];
43
+ I.forEach((r) => {
44
+ z.push(r), r.properties.destinations.sort((h, y) => h[_] - y[_]).forEach((h) => {
45
+ const y = h[_];
46
+ t.features.filter((a) => a.properties[e] == h.value).forEach((a) => {
47
+ a.properties.meta = h;
48
+ const M = r.properties[e], w = r.properties[e] + "--" + a.properties[e], E = s.centroid(r), A = s.centroid(a), F = A[0] - E[0], j = A[1] - E[1], O = Math.sqrt(F * F + j * j), V = F / O, J = j / O, N = [
49
+ A[0] - V * x,
50
+ A[1] - J * x
51
+ ], R = o.invert(N), U = {
52
52
  type: "LineString",
53
53
  coordinates: [
54
- w.invert(f),
54
+ o.invert(E),
55
55
  // Start in geo coords
56
- U
56
+ R
57
57
  // New endpoint before d2
58
58
  ]
59
- }, m = this.g.append("g");
60
- this.g.select("defs").append("marker").attr("id", "arrow" + i).attr("markerUnits", "strokeWidth").attr("markerWidth", "6").attr("markerHeight", "6").attr("viewBox", "0 0 24 24").attr("refX", "6").attr("refY", "6").attr("orient", "auto").append("path").attr("d", "M2,2 L10,6 L2,10 L6,6 L2,2").attr("d", "M2,2 L10,6 L2,10 L6,6 L2,2").attr("style", (D) => "fill: " + x.getColor(e) + ";"), m.append("path").attr("d", a(W)).attr("id", i).attr("class", "flow-line").style("fill", "none").style("cursor", "pointer").style("stroke-dasharray", "0").style("stroke", (D) => x.getColor(e)).style("stroke-width", (D) => x.getSize(e)).attr("marker-end", "url(#arrow" + i + ")").on("mouseenter", (D, tt) => {
61
- if (m.selectAll("marker").transition().duration("200").style("opacity", 0), m.selectAll(".start-point").transition().duration("200").style("opacity", 0), m.selectAll(".flow-line").transition().duration("200").style("opacity", 0), P.select(D.target).transition().duration("200").style("opacity", 1), m.selectAll("#arrow" + i).transition().duration("200").style("opacity", 1), m.selectAll(".start-point.circle_" + c).transition().duration("200").style("opacity", 1), e) {
62
- const B = {}, j = {};
63
- Object.keys(t.properties).forEach((y) => {
64
- B["origin_" + y] = t.properties[y];
65
- }), Object.keys(o.properties).forEach((y) => {
66
- j["target_" + y] = o.properties[y];
67
- }), Object.keys(o.properties.meta).forEach((y) => {
68
- j["target_" + y] = o.properties.meta[y];
59
+ }, c = this.g;
60
+ this.g.select("defs").append("marker").attr("id", "arrow" + w).attr("markerUnits", "strokeWidth").attr("markerWidth", "6").attr("markerHeight", "6").attr("viewBox", "0 0 24 24").attr("refX", "6").attr("refY", "6").attr("orient", "auto").append("path").attr("d", "M2,2 L10,6 L2,10 L6,6 L2,2").attr("d", "M2,2 L10,6 L2,10 L6,6 L2,2").attr("style", (L) => "fill: " + D.getColor(y) + ";"), c.append("path").attr("d", s(U)).attr("id", w).attr("class", "flow-line").style("fill", "none").style("cursor", "pointer").style("stroke-dasharray", "0").style("stroke", (L) => D.getColor(y)).style("stroke-width", (L) => D.getSize(y)).attr("marker-end", "url(#arrow" + w + ")").on("mouseenter", (L, tt) => {
61
+ if (c.selectAll("marker").transition().duration("200").style("opacity", 0), c.selectAll(".start-point").transition().duration("200").style("opacity", 0), c.selectAll(".flow-line").transition().duration("200").style("opacity", 0), T.select(L.target).transition().duration("200").style("opacity", 1), c.selectAll("#arrow" + w).transition().duration("200").style("opacity", 1), c.selectAll(".start-point.circle_" + M).transition().duration("200").style("opacity", 1), y) {
62
+ const P = {}, C = {};
63
+ Object.keys(r.properties).forEach((d) => {
64
+ P["origin_" + d] = r.properties[d];
65
+ }), Object.keys(a.properties).forEach((d) => {
66
+ C["target_" + d] = a.properties[d];
67
+ }), Object.keys(a.properties.meta).forEach((d) => {
68
+ C["target_" + d] = a.properties.meta[d];
69
69
  });
70
- const Y = {
71
- ...B,
72
- ...j,
70
+ const W = {
71
+ ...P,
72
+ ...C,
73
73
  meta: {
74
- [A]: t.properties.meta ? t.properties.meta.value : "",
75
- ...t.properties.meta,
76
- value: e
74
+ [v]: r.properties.meta ? r.properties.meta.value : "",
75
+ ...r.properties.meta,
76
+ value: y
77
77
  }
78
78
  };
79
- this.showToolTip(k, Y, x.getColor(o.properties._value));
79
+ this.showToolTip(u, W, D.getColor(a.properties._value));
80
80
  }
81
- }).on("mouseout", (D) => {
82
- this.hiddenToolTip(), P.selectAll(".flow-line").transition().duration("100").style("opacity", 1), m.selectAll(".start-point").transition().duration("100").style("opacity", 1), m.selectAll("marker").transition().duration("100").style("opacity", 1);
83
- }), m.append("text").append("textPath").attr("xlink:href", i).style("text-anchor", "middle").attr("startOffset", "50%").attr("fill", "#fff").text("Yay, my text is on a wavy path");
81
+ }).on("mouseout", (L) => {
82
+ this.hiddenToolTip(), T.selectAll(".flow-line").transition().duration("100").style("opacity", 1), c.selectAll(".start-point").transition().duration("100").style("opacity", 1), c.selectAll("marker").transition().duration("100").style("opacity", 1);
83
+ }), c.append("text").append("textPath").attr("xlink:href", w).style("text-anchor", "middle").attr("startOffset", "50%").attr("fill", "#fff").text("Yay, my text is on a wavy path");
84
84
  });
85
85
  });
86
- }), S.forEach((t) => {
87
- this.g.append("circle").attr("fill", n).attr("stroke", g).attr("class", "start-point circle_" + t.properties[d]).attr("stroke-width", 2).style("vector-effect", "non-scaling-stroke").attr("cx", a.centroid(t)[0]).attr("cy", a.centroid(t)[1]).attr("r", () => F * 1 / J).on("mouseenter", (p) => {
88
- this.showToolTip("{name_en}", t.properties, "");
89
- }).on("mouseout", (p) => {
86
+ }), z.forEach((r) => {
87
+ this.g.append("circle").attr("fill", n).attr("stroke", m).attr("class", "start-point circle_" + r.properties[e]).attr("stroke-width", 2).style("vector-effect", "non-scaling-stroke").attr("cx", s.centroid(r)[0]).attr("cy", s.centroid(r)[1]).attr("r", () => g * 1 / B).on("mouseenter", (h) => {
88
+ this.showToolTip("{name_en}", r.properties, "");
89
+ }).on("mouseout", (h) => {
90
90
  this.hiddenToolTip();
91
91
  });
92
92
  });
93
93
  }
94
- create() {
94
+ _buildLayer(t) {
95
95
  const {
96
- app: r,
97
- name: s,
98
- file: a,
99
- path: k,
100
- csv: n,
101
- zoom: g,
102
- labelFilter: F = [],
103
- labelField: d,
104
- labelFontSize: A,
105
- labelColor: w,
106
- fillColor: C,
107
- borderColor: b,
108
- featureJoinAttribute: u,
109
- editing: v,
110
- data: l,
111
- breaks: N,
112
- markFillColor: E,
113
- markSizeScale: x,
114
- measures: _,
115
- flowValuesFrom: J
116
- } = this.props;
117
- a != "none" && this.loadJSON(a).then((S) => {
118
- const t = S.features.map((e) => {
119
- const o = e.properties[u];
120
- if (r != "csv" && l && l.children) {
121
- const c = l.children.filter((i) => i.value.indexOf(o) > -1);
122
- if (c.length > 0) {
123
- const i = c[0][_[0]];
124
- e.properties.meta = c[0], e.properties._value = i, e.properties.destinations = c[0].children;
125
- }
126
- } else if (r == "csv") {
127
- const c = K.parse(n, { header: !0, dynamicTyping: !0 }), i = e.properties[u];
128
- c.data.filter((h) => h.origin == i);
129
- const f = c.data.filter((h) => h.origin == i)[0];
130
- f != null && (alert("CSV Not implemented Yet, please do it if you have time"), e.properties.meta = f, e.properties._value = f.value, e.properties.destinations = f.destination);
96
+ featureJoinAttribute: i,
97
+ app: s,
98
+ data: u,
99
+ measures: n,
100
+ csv: m
101
+ } = this.props, g = t.features.map((e) => {
102
+ const v = e.properties[i];
103
+ if (s != "csv" && u && u.children) {
104
+ const o = u.children.filter((l) => l.value.indexOf(v) > -1);
105
+ if (o.length > 0) {
106
+ const l = o[0][n[0]];
107
+ e.properties.meta = o[0], e.properties._value = l, e.properties.destinations = o[0].children;
131
108
  }
132
- return e;
133
- }), p = { ...S, features: t };
134
- this.createDataLayer(p);
109
+ } else if (s == "csv") {
110
+ const o = X.parse(m, { header: !0, dynamicTyping: !0 }), l = e.properties[i], p = o.data.filter((f) => f.origin == l)[0];
111
+ p != null && (alert("CSV Not implemented Yet, please do it if you have time"), e.properties.meta = p, e.properties._value = p.value, e.properties.destinations = p.destination);
112
+ }
113
+ return e;
135
114
  });
115
+ this.createDataLayer({ ...t, features: g });
116
+ }
117
+ create() {
118
+ const { file: t } = this.props;
119
+ t != "none" && (this.state.json ? this._buildLayer(this.state.json) : this.loadJSON(t).then((i) => {
120
+ this.setState({ json: i }), this._buildLayer(i);
121
+ }));
136
122
  }
137
- componentDidUpdate(r, s, a) {
138
- const { projection: k, editing: n, data: g } = this.props;
139
- (n || JSON.stringify(r.data) !== JSON.stringify(g)) && this.create(), r.visible != this.props.visible && this.g.style("display", this.props.visible ? "" : "none");
123
+ componentDidUpdate(t, i, s) {
124
+ const { projection: u, editing: n, data: m } = this.props;
125
+ (n || t.data !== m || t.path !== this.props.path) && this.create(), t.visible != this.props.visible && this.g.style("display", this.props.visible ? "" : "none");
140
126
  }
141
127
  componentDidMount() {
142
128
  this.create(), this.props.zoom.current.fullView();
143
129
  }
144
130
  render() {
145
- const { id: r } = this.props;
146
- return /* @__PURE__ */ L("g", { id: "data-" + r, className: "data " + r, ref: this.gRef, children: /* @__PURE__ */ L("defs", {}) });
131
+ const { id: t } = this.props;
132
+ return /* @__PURE__ */ b("g", { id: "data-" + t, className: "data " + t, ref: this.gRef, children: /* @__PURE__ */ b("defs", {}) });
147
133
  }
148
134
  }
149
- const $ = (z) => {
135
+ const Z = (S) => {
150
136
  const {
151
- id: r,
152
- unique: s,
153
- filters: a,
154
- csv: k,
137
+ id: t,
138
+ unique: i,
139
+ filters: s,
140
+ csv: u,
155
141
  app: n,
156
- group: g = "default",
157
- flowOrigin: F,
158
- editing: d,
159
- flowDestination: A,
160
- dvzProxyDatasetId: w,
161
- waitForFilters: C
162
- } = z, b = { dvzProxyDatasetId: w }, u = a || {};
163
- return u && u.forEach && u.forEach((v) => {
164
- v.value != null && v.value.filter((l) => l != null && l.toString().trim() != "").length > 0 && (b[v.param] = v.value);
165
- }), /* @__PURE__ */ L(
166
- G,
142
+ group: m = "default",
143
+ flowOrigin: g,
144
+ editing: e,
145
+ flowDestination: v,
146
+ dvzProxyDatasetId: o,
147
+ waitForFilters: l
148
+ } = S, p = { dvzProxyDatasetId: o }, f = s || {};
149
+ return f && f.forEach && f.forEach((k) => {
150
+ k.value != null && k.value.filter((x) => x != null && x.toString().trim() != "").length > 0 && (p[k.param] = k.value);
151
+ }), /* @__PURE__ */ b(
152
+ q,
167
153
  {
168
- editing: d,
169
- params: b,
170
- waitForFilters: C,
154
+ editing: e,
155
+ params: p,
156
+ waitForFilters: l,
171
157
  app: n,
172
- csv: decodeURIComponent(k),
173
- group: g,
158
+ csv: decodeURIComponent(u),
159
+ group: m,
174
160
  ignoreErrors: !0,
175
161
  isSvg: !0,
176
- store: [n, s, r],
177
- source: F + "/" + A,
178
- children: /* @__PURE__ */ L(H, { children: /* @__PURE__ */ L(Z, { ...z }) })
162
+ store: [n, i, t],
163
+ source: g + "/" + v,
164
+ children: /* @__PURE__ */ b(G, { children: /* @__PURE__ */ b(Q, { ...S }) })
179
165
  }
180
166
  );
181
- }, pt = X($);
167
+ }, pt = H(Z);
182
168
  export {
183
169
  pt as default
184
170
  };
@@ -1,4 +1,4 @@
1
- const c = [
1
+ const _ = [
2
2
  {
3
3
  value: "blues",
4
4
  label: "blues",
@@ -108,16 +108,21 @@ const c = [
108
108
  endColor: "#800026"
109
109
  }
110
110
  ];
111
- class _ {
112
- constructor(s) {
113
- const { gradientScheme: r, gradientReverse: o, data: t = [], defaultFillColor: u, measure: f } = s;
114
- this.defaultFillColor = u, this.measure = f, this.valueColors = this.createGradient(r, t, o), this.getColor = this.getColor.bind(this);
111
+ class v {
112
+ constructor(t) {
113
+ const { gradientScheme: r, gradientReverse: a, data: o = [], defaultFillColor: d, measure: f, gradientStartColor: C, gradientEndColor: u } = t;
114
+ this.defaultFillColor = d, this.measure = f, this.gradientStartColor = C, this.gradientEndColor = u, this.valueColors = this.createGradient(r, o, a), this.getColor = this.getColor.bind(this);
115
115
  }
116
- createGradient(s, r, o) {
117
- const t = c.find((e) => e.value == s) || {
116
+ createGradient(t, r, a) {
117
+ let o = {
118
+ startColor: this.gradientStartColor || "#ffffff",
119
+ endColor: this.gradientEndColor || "#000000"
120
+ };
121
+ t !== "custom" && (o = _.find((e) => e.value == t) || {
118
122
  startColor: "#ffffff",
119
123
  endColor: "#000000"
120
- }, u = r.slice().sort((e, l) => e[this.measure] - l[this.measure]);
124
+ });
125
+ const d = r.slice().sort((e, l) => e[this.measure] - l[this.measure]);
121
126
  function f(e) {
122
127
  return e = e.replace(/^#/, ""), e.length === 3 && (e = e.split("").map((l) => l + l).join("")), {
123
128
  r: parseInt(e.substr(0, 2), 16),
@@ -125,31 +130,33 @@ class _ {
125
130
  b: parseInt(e.substr(4, 2), 16)
126
131
  };
127
132
  }
128
- function i({ r: e, g: l, b: C }) {
129
- const n = (b) => b.toString(16).padStart(2, "0");
130
- return `#${n(e)}${n(l)}${n(C)}`;
133
+ function C({ r: e, g: l, b: i }) {
134
+ const s = (g) => g.toString(16).padStart(2, "0");
135
+ return `#${s(e)}${s(l)}${s(i)}`;
131
136
  }
132
- const a = f(o ? t.endColor : t.startColor), d = f(o ? t.startColor : t.endColor), g = [];
137
+ const u = a ? o.endColor : o.startColor, p = a ? o.startColor : o.endColor;
138
+ this.startColor = u, this.endColor = p;
139
+ const n = f(u), b = f(p), c = [];
133
140
  for (let e = 0; e < r.length; e++) {
134
- const l = e / (r.length - 1), C = Math.round(a.r + (d.r - a.r) * l), n = Math.round(a.g + (d.g - a.g) * l), b = Math.round(a.b + (d.b - a.b) * l);
135
- g.push({ value: u[e][this.measure], color: i({ r: C, g: n, b }) });
141
+ const l = r.length > 1 ? e / (r.length - 1) : 1, i = Math.round(n.r + (b.r - n.r) * l), s = Math.round(n.g + (b.g - n.g) * l), g = Math.round(n.b + (b.b - n.b) * l);
142
+ c.push({ value: d[e][this.measure], color: C({ r: i, g: s, b: g }) });
136
143
  }
137
- return g;
144
+ return c;
138
145
  }
139
- getColor(s) {
146
+ getColor(t) {
140
147
  if (this.valueColors.length > 0) {
141
- const r = this.valueColors.find((o) => o.value == s);
148
+ const r = this.valueColors.find((a) => a.value == t);
142
149
  return (r == null ? void 0 : r.color) || this.defaultFillColor;
143
150
  }
144
151
  return this.defaultFillColor;
145
152
  }
146
153
  getStartColor() {
147
- return this.valueColors[0].color;
154
+ return this.startColor;
148
155
  }
149
156
  getEndColor() {
150
- return this.valueColors.at(-1).color;
157
+ return this.endColor;
151
158
  }
152
159
  }
153
160
  export {
154
- _ as default
161
+ v as default
155
162
  };
@@ -1,26 +1,26 @@
1
- import { jsx as b } from "react/jsx-runtime";
1
+ import { jsx as v } from "react/jsx-runtime";
2
2
  import I from "react";
3
- import O from "../data/DataProvider.js";
4
- import _ from "../data/DataConsumer.js";
3
+ import j from "../data/DataProvider.js";
4
+ import N from "../data/DataConsumer.js";
5
5
  import * as p from "d3";
6
- import { injectIntl as j } from "react-intl";
7
- import * as J from "react-dom";
8
- import P from "./Tooltip.js";
9
- class U extends I.Component {
6
+ import { injectIntl as O } from "react-intl";
7
+ import * as U from "react-dom";
8
+ import V from "./Tooltip.js";
9
+ class X extends I.Component {
10
10
  constructor() {
11
11
  super(), this.create = this.create.bind(this), this.showToolTip = this.showToolTip.bind(this), this.moveToolTip = this.moveToolTip.bind(this), this.resize = this.resize.bind(this), this.gRef = I.createRef();
12
12
  }
13
- showToolTip(e, n, r, s) {
14
- const l = p.select("body").append("div").attr("class", "d3MapTooltip").style("position", "absolute").html("").style("left", s.pageX + 15 + "px").style("top", s.pageY - 50 + "px");
15
- J.render(/* @__PURE__ */ b(
16
- P,
13
+ showToolTip(e, n, s, r) {
14
+ const a = p.select("body").append("div").attr("class", "d3MapTooltip").style("position", "absolute").html("").style("left", r.pageX + 15 + "px").style("top", r.pageY - 50 + "px");
15
+ U.render(/* @__PURE__ */ v(
16
+ V,
17
17
  {
18
18
  intl: this.props.intl,
19
19
  tooltip: e,
20
20
  data: n,
21
21
  tooltipEnableMarkdown: !1
22
22
  }
23
- ), l._groups[0][0]);
23
+ ), a._groups[0][0]);
24
24
  }
25
25
  moveToolTip(e) {
26
26
  p.select(".d3MapTooltip").style("left", e.pageX + 15 + "px").style("top", e.pageY - 50 + "px");
@@ -32,65 +32,65 @@ class U extends I.Component {
32
32
  const {
33
33
  app: e,
34
34
  tooltip: n,
35
- data: r,
36
- markFillColor: s,
37
- markBorderColor: l,
35
+ data: s,
36
+ markFillColor: r,
37
+ markBorderColor: a,
38
38
  markSizeScale: m,
39
39
  markerLabelSize: g,
40
40
  measures: y,
41
41
  projection: c,
42
42
  id: T,
43
- format: a,
43
+ format: l,
44
44
  intl: x,
45
45
  useBreaks: L,
46
46
  breaks: d,
47
- pointDimensionStyles: h = [],
47
+ pointDimensionStyles: u = [],
48
48
  pointStyleBy: f,
49
- dimension2: v,
49
+ dimension2: b,
50
50
  visible: D = !0,
51
51
  showDim2OnLegends: A,
52
- dim2LegendLabel: X
52
+ dim2LegendLabel: q
53
53
  } = this.props, E = {
54
- style: a.style === "compacted" ? "decimal" : a.style,
55
- notation: a.style === "compacted" ? "compact" : "standard",
56
- currency: a.currency,
57
- minimumFractionDigits: parseInt(a.minimumFractionDigits),
58
- maximumFractionDigits: parseInt(a.maximumFractionDigits)
54
+ style: l.style === "compacted" ? "decimal" : l.style,
55
+ notation: l.style === "compacted" ? "compact" : "standard",
56
+ currency: l.currency,
57
+ minimumFractionDigits: parseInt(l.minimumFractionDigits),
58
+ maximumFractionDigits: parseInt(l.maximumFractionDigits)
59
59
  }, B = p.scaleThreshold().domain(d.map((t) => t.end)).range(d.map((t) => m + t.size)), C = p.scaleThreshold().domain(d.map((t) => t.end)).range(d.map((t) => t.color)), M = p.scaleThreshold().domain(d.map((t) => t.end)).range(d.map((t) => t.borderColor));
60
60
  let S = [];
61
61
  const z = p.select(this.gRef.current);
62
- if (e != "csv" && r && r.children)
63
- S = r.children.map((t) => {
62
+ if (e != "csv" && s && s.children)
63
+ S = s.children.map((t) => {
64
64
  const o = t.value.split(",");
65
- let u = { color: s, size: m, border: l }, i = 1;
66
- return f === "measure" ? (i = t[y[0]], u = { color: C(i), size: B(i), border: M(i) }) : f === "dimension" && t.children && A && (i = t.children[0].value, u = {
67
- color: h[i + "_color"] || s,
68
- size: h[i + "_size"] || m,
69
- border: h[i + "_border"] || l
65
+ let h = { color: r, size: m, border: a }, i = 1;
66
+ return f === "measure" ? (i = t[y[0]], h = { color: C(i), size: B(i), border: M(i) }) : f === "dimension" && t.children && A && (i = t.children[0].value, h = {
67
+ color: u[i + "_color"] || r,
68
+ size: u[i + "_size"] || m,
69
+ border: u[i + "_border"] || a
70
70
  }), {
71
71
  x: o[0],
72
72
  y: o[1],
73
73
  value: i,
74
74
  metadata: t,
75
- pointStyle: u
75
+ pointStyle: h
76
76
  };
77
77
  }), S.sort((t, o) => t.pointStyle.size - o.pointStyle.size);
78
78
  else if (e == "csv") {
79
- const t = r.meta.fields[0], o = r.meta.fields[1], u = r.meta.fields[2];
80
- S = r.data.map((i) => {
81
- let N = { color: s, size: m, border: l };
79
+ const t = s.meta.fields[0], o = s.meta.fields[1], h = s.meta.fields[2];
80
+ S = s.data.map((i) => {
81
+ let _ = { color: r, size: m, border: a };
82
82
  return {
83
83
  x: i[t],
84
84
  y: i[o],
85
- value: i[u],
85
+ value: i[h],
86
86
  meta: i,
87
- pointStyle: N
87
+ pointStyle: _
88
88
  };
89
89
  });
90
90
  }
91
91
  const F = (t) => {
92
- const { pointStyleBy: o, dimension2: u } = this.props, i = {};
93
- return u != "none" && (i[u] = t.metadata.children[0].value), { ...i, ...t, ...t.metadata };
92
+ const { pointStyleBy: o, dimension2: h } = this.props, i = {};
93
+ return h != "none" && (i[h] = t.metadata.children[0].value), { ...i, ...t, ...t.metadata };
94
94
  }, R = this.props.transform ? this.props.transform.k : 1;
95
95
  z.attr("class", "zoomable lat-long " + T), z.selectAll(".point-group").remove();
96
96
  const w = z.selectAll(".point-group").data(S).enter().append("g").attr("class", "point-group");
@@ -112,17 +112,17 @@ class U extends I.Component {
112
112
  this.hiddenToolTip(t);
113
113
  }), this.props.transform && z.attr("transform", this.props.transform);
114
114
  }
115
- componentDidUpdate(e, n, r) {
116
- const { editing: s, selectedItem: l, onZoomToPoint: m, data: g } = this.props, y = p.select(this.gRef.current);
117
- if ((s || JSON.stringify(e.data) !== JSON.stringify(g)) && this.create(), e.visible != this.props.visible && p.select(this.gRef.current).style("display", this.props.visible ? "block" : "none"), l != null && this.props.selectedItem != e.selectedItem) {
118
- const T = y.selectAll(".point-group circle").filter((a) => a.metadata.children.find((x) => x.value == l) != null);
115
+ componentDidUpdate(e, n, s) {
116
+ const { editing: r, selectedItem: a, onZoomToPoint: m, data: g } = this.props, y = p.select(this.gRef.current);
117
+ if ((r || e.data !== g || e.path !== this.props.path) && this.create(), e.visible != this.props.visible && p.select(this.gRef.current).style("display", this.props.visible ? "block" : "none"), a != null && this.props.selectedItem != e.selectedItem) {
118
+ const T = y.selectAll(".point-group circle").filter((l) => l.metadata.children.find((x) => x.value == a) != null);
119
119
  m({ x: T.datum().x, y: T.datum().y });
120
120
  }
121
121
  this.resize();
122
122
  }
123
123
  resize() {
124
- const { markerLabelSize: e } = this.props, n = p.select(this.gRef.current), r = this.props.transform ? this.props.transform.k : 1;
125
- n && (n.selectAll(".point-group circle").attr("r", (s) => s.pointStyle.size * 1 / r), n.selectAll(".point-group text.point-label").attr("font-size", (s) => e * (10 / r) + "px"));
124
+ const { markerLabelSize: e } = this.props, n = p.select(this.gRef.current), s = this.props.transform ? this.props.transform.k : 1;
125
+ n && (n.selectAll(".point-group circle").attr("r", (r) => r.pointStyle.size * 1 / s), n.selectAll(".point-group text.point-label").attr("font-size", (r) => e * (10 / s) + "px"));
126
126
  }
127
127
  componentDidMount() {
128
128
  this.create();
@@ -131,44 +131,44 @@ class U extends I.Component {
131
131
  const {
132
132
  id: e
133
133
  } = this.props;
134
- return /* @__PURE__ */ b("g", { className: "latLong " + e, ref: this.gRef });
134
+ return /* @__PURE__ */ v("g", { className: "latLong " + e, ref: this.gRef });
135
135
  }
136
136
  }
137
- const V = (k) => {
137
+ const Y = (k) => {
138
138
  const {
139
139
  id: e,
140
140
  unique: n,
141
- filters: r,
142
- csv: s,
143
- app: l,
141
+ filters: s,
142
+ csv: r,
143
+ app: a,
144
144
  group: m = "default",
145
145
  apiJoinAttribute: g,
146
146
  editing: y,
147
147
  dimension2: c,
148
148
  pointStyleBy: T,
149
- dvzProxyDatasetId: a,
149
+ dvzProxyDatasetId: l,
150
150
  settings: x,
151
151
  waitForFilters: L
152
- } = k, d = c != "none" ? "/" + c : "", h = {}, f = r || {};
153
- return f && f.forEach && f.forEach((v) => {
154
- v.value != null && v.value.filter((D) => D != null && D.toString().trim() != "").length > 0 && (h[v.param] = v.value);
155
- }), a && (h.dvzProxyDatasetId = a), /* @__PURE__ */ b(
156
- O,
152
+ } = k, d = c != "none" ? "/" + c : "", u = {}, f = s || {};
153
+ return f && f.forEach && f.forEach((b) => {
154
+ b.value != null && b.value.filter((D) => D != null && D.toString().trim() != "").length > 0 && (u[b.param] = b.value);
155
+ }), l && (u.dvzProxyDatasetId = l), /* @__PURE__ */ v(
156
+ j,
157
157
  {
158
158
  editing: y,
159
- params: h,
159
+ params: u,
160
160
  waitForFilters: L,
161
- app: l,
162
- csv: decodeURIComponent(s),
161
+ app: a,
162
+ csv: decodeURIComponent(r),
163
163
  group: m,
164
164
  ignoreErrors: !0,
165
165
  isSvg: !0,
166
- store: [l, n, e],
166
+ store: [a, n, e],
167
167
  source: [g + d],
168
- children: /* @__PURE__ */ b(_, { children: /* @__PURE__ */ b(U, { ...k }) })
168
+ children: /* @__PURE__ */ v(N, { children: /* @__PURE__ */ v(X, { ...k }) })
169
169
  }
170
170
  );
171
- }, K = j(V);
171
+ }, K = O(Y);
172
172
  export {
173
173
  K as default
174
174
  };