openlayers-style-editor 0.1.4 → 0.1.6
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/components/categorized.d.ts +0 -0
- package/dist/components/geometryEditor.d.ts +0 -0
- package/dist/components/graduated.d.ts +0 -0
- package/dist/components/main/StyleEditor.d.ts +0 -0
- package/dist/components/main/StyleEditorComponent.d.ts +0 -0
- package/dist/components/myColorPicker.d.ts +0 -0
- package/dist/components/rampColors.d.ts +0 -0
- package/dist/components/uniqueSymbol.d.ts +0 -0
- package/dist/components/utills.d.ts +0 -0
- package/dist/i18n.d.ts +0 -0
- package/dist/index.cjs +58 -28
- package/dist/index.d.ts +0 -0
- package/dist/index.js +58 -28
- package/dist/rendererUtils.d.ts +0 -0
- package/package.json +15 -15
- package/dist/openlayers-style-editor.css +0 -1
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/i18n.d.ts
CHANGED
|
File without changes
|
package/dist/index.cjs
CHANGED
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
return GraduatedModes2;
|
|
47
47
|
})(GraduatedModes || {});
|
|
48
48
|
function getCategorizedStyle(attribute, colors, outlineColor, outlineWidth, defaultColor) {
|
|
49
|
+
if (outlineWidth == 0 && outlineColor != void 0)
|
|
50
|
+
outlineColor[3] = 0;
|
|
51
|
+
else if (outlineWidth != void 0 && outlineWidth > 0 && outlineColor)
|
|
52
|
+
outlineColor[3] = 1;
|
|
49
53
|
let aux = [];
|
|
50
54
|
aux.push("match");
|
|
51
55
|
aux.push(["get", attribute]);
|
|
@@ -61,11 +65,15 @@
|
|
|
61
65
|
"white",
|
|
62
66
|
outlineColor || "#000000"
|
|
63
67
|
],
|
|
64
|
-
"stroke-width": ["case", ["==", ["var", "highlightedId"], ["id"]], 2, outlineWidth
|
|
68
|
+
"stroke-width": ["case", ["==", ["var", "highlightedId"], ["id"]], 2, outlineWidth == void 0 ? 1 : outlineWidth],
|
|
65
69
|
"fill-color": aux
|
|
66
70
|
};
|
|
67
71
|
}
|
|
68
72
|
function singleColorStyle(color, outlineColor, outlineWidth) {
|
|
73
|
+
if (outlineWidth == 0 && outlineColor != void 0)
|
|
74
|
+
outlineColor[3] = 0;
|
|
75
|
+
else if (outlineWidth != void 0 && outlineWidth > 0 && outlineColor)
|
|
76
|
+
outlineColor[3] = 1;
|
|
69
77
|
return {
|
|
70
78
|
"stroke-color": [
|
|
71
79
|
"case",
|
|
@@ -73,7 +81,7 @@
|
|
|
73
81
|
"white",
|
|
74
82
|
outlineColor || "#000000"
|
|
75
83
|
],
|
|
76
|
-
"stroke-width": ["case", ["==", ["var", "highlightedId"], ["id"]], 2, outlineWidth
|
|
84
|
+
"stroke-width": ["case", ["==", ["var", "highlightedId"], ["id"]], 2, outlineWidth == void 0 ? 1 : outlineWidth],
|
|
77
85
|
"stroke-offset": 0,
|
|
78
86
|
"fill-color": color
|
|
79
87
|
};
|
|
@@ -86,6 +94,10 @@
|
|
|
86
94
|
};
|
|
87
95
|
}
|
|
88
96
|
function getGraduatedStyle(attribute, ramp, outlineColor, outlineWidth) {
|
|
97
|
+
if (outlineWidth == 0 && outlineColor != void 0)
|
|
98
|
+
outlineColor[3] = 0;
|
|
99
|
+
else if (outlineWidth != void 0 && outlineWidth > 0 && outlineColor)
|
|
100
|
+
outlineColor[3] = 1;
|
|
89
101
|
let aux = [];
|
|
90
102
|
aux.push("interpolate");
|
|
91
103
|
aux.push(["linear"]);
|
|
@@ -101,7 +113,7 @@
|
|
|
101
113
|
"white",
|
|
102
114
|
outlineColor || "#000000"
|
|
103
115
|
],
|
|
104
|
-
"stroke-width": ["case", ["==", ["var", "highlightedId"], ["id"]], 2, outlineWidth
|
|
116
|
+
"stroke-width": ["case", ["==", ["var", "highlightedId"], ["id"]], 2, outlineWidth == void 0 ? 1 : outlineWidth],
|
|
105
117
|
"fill-color": aux
|
|
106
118
|
};
|
|
107
119
|
}
|
|
@@ -120,8 +132,13 @@
|
|
|
120
132
|
let aux = renderer.rendererOL["fill-color"];
|
|
121
133
|
aux = [...aux];
|
|
122
134
|
aux[3] = opacity / 100;
|
|
123
|
-
newRenderer = {
|
|
124
|
-
|
|
135
|
+
newRenderer = {
|
|
136
|
+
...renderer,
|
|
137
|
+
rendererOL: {
|
|
138
|
+
...renderer.rendererOL,
|
|
139
|
+
["fill-color"]: aux
|
|
140
|
+
}
|
|
141
|
+
};
|
|
125
142
|
}
|
|
126
143
|
if (renderer.type == "Categorized") {
|
|
127
144
|
let aux = renderer.rendererOL["fill-color"].slice(3);
|
|
@@ -131,7 +148,6 @@
|
|
|
131
148
|
color[3] = opacity / 100;
|
|
132
149
|
newAux[i] = color;
|
|
133
150
|
}
|
|
134
|
-
console.log(renderer);
|
|
135
151
|
newRenderer = {
|
|
136
152
|
...renderer,
|
|
137
153
|
rendererOL: {
|
|
@@ -139,7 +155,6 @@
|
|
|
139
155
|
["fill-color"]: renderer.rendererOL["fill-color"].slice(0, 3).concat(newAux)
|
|
140
156
|
}
|
|
141
157
|
};
|
|
142
|
-
console.log(newRenderer);
|
|
143
158
|
}
|
|
144
159
|
if (renderer.type == "Graduated") {
|
|
145
160
|
let aux = renderer.rendererOL["fill-color"].slice(4);
|
|
@@ -149,8 +164,13 @@
|
|
|
149
164
|
color[3] = opacity / 100;
|
|
150
165
|
newAux[i] = color;
|
|
151
166
|
}
|
|
152
|
-
newRenderer = {
|
|
153
|
-
|
|
167
|
+
newRenderer = {
|
|
168
|
+
...renderer,
|
|
169
|
+
rendererOL: {
|
|
170
|
+
...renderer.rendererOL,
|
|
171
|
+
["fill-color"]: renderer.rendererOL["fill-color"].slice(0, 4).concat(newAux)
|
|
172
|
+
}
|
|
173
|
+
};
|
|
154
174
|
}
|
|
155
175
|
return newRenderer;
|
|
156
176
|
}
|
|
@@ -252,7 +272,11 @@
|
|
|
252
272
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
253
273
|
MyColorPicker,
|
|
254
274
|
{
|
|
255
|
-
color:
|
|
275
|
+
color: (() => {
|
|
276
|
+
if (borderColor.at(3) < 1)
|
|
277
|
+
return [borderColor[0], borderColor[1], borderColor[2], 1];
|
|
278
|
+
return borderColor;
|
|
279
|
+
})(),
|
|
256
280
|
hideAlpha: true,
|
|
257
281
|
onChange: (e) => setBorderColor(color_js.fromString(e))
|
|
258
282
|
}
|
|
@@ -793,7 +817,7 @@
|
|
|
793
817
|
});
|
|
794
818
|
setTable(tableUpdated);
|
|
795
819
|
} else if (colorRamp.value.length > 0) {
|
|
796
|
-
const style = getCategorizedStyle(selectedAttr
|
|
820
|
+
const style = getCategorizedStyle(selectedAttr?.name, colorRamp.value);
|
|
797
821
|
const colors = getStyleColorsAndValues(style, RenderType.Categorized);
|
|
798
822
|
const tableUpdated = [];
|
|
799
823
|
table.forEach(({ value, visible }) => {
|
|
@@ -900,7 +924,11 @@
|
|
|
900
924
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
901
925
|
MyColorPicker,
|
|
902
926
|
{
|
|
903
|
-
color:
|
|
927
|
+
color: (() => {
|
|
928
|
+
if (borderColor.at(3) < 1)
|
|
929
|
+
return [borderColor[0], borderColor[1], borderColor[2], 1];
|
|
930
|
+
return borderColor;
|
|
931
|
+
})(),
|
|
904
932
|
hideAlpha: true,
|
|
905
933
|
onChange: (e) => setBorderColor(color_js.fromString(e))
|
|
906
934
|
}
|
|
@@ -1001,7 +1029,7 @@
|
|
|
1001
1029
|
datatable_esm_js.DataTable,
|
|
1002
1030
|
{
|
|
1003
1031
|
value: table,
|
|
1004
|
-
selectionMode: rowClick ?
|
|
1032
|
+
selectionMode: rowClick ? null : "checkbox",
|
|
1005
1033
|
tableStyle: { minWidth: "25rem" },
|
|
1006
1034
|
selection: table.filter((tr) => tr.visible),
|
|
1007
1035
|
onSelectionChange: (e) => {
|
|
@@ -1034,8 +1062,8 @@
|
|
|
1034
1062
|
onClick: () => {
|
|
1035
1063
|
applyRenderer({
|
|
1036
1064
|
type: RenderType.Categorized,
|
|
1037
|
-
field: selectedAttr
|
|
1038
|
-
rendererOL: getCategorizedStyle(selectedAttr
|
|
1065
|
+
field: selectedAttr?.name,
|
|
1066
|
+
rendererOL: getCategorizedStyle(selectedAttr?.name, table.filter((row) => row.value != nullText && row.visible).map((tr) => ({
|
|
1039
1067
|
value: tr.value,
|
|
1040
1068
|
color: tr.color
|
|
1041
1069
|
})), borderColor, borderThickness, table.find((row) => row.value == nullText).color)
|
|
@@ -1089,8 +1117,7 @@
|
|
|
1089
1117
|
const locale = numbersLocale;
|
|
1090
1118
|
const toast = react.useRef(null);
|
|
1091
1119
|
const showToast = (message, severity) => {
|
|
1092
|
-
|
|
1093
|
-
(_a = toast.current) == null ? void 0 : _a.show({ severity, summary: "Error", detail: message });
|
|
1120
|
+
toast.current?.show({ severity, summary: "Error", detail: message });
|
|
1094
1121
|
};
|
|
1095
1122
|
const currentRender = layerCurrentRenderer.type != RenderType.Graduated ? [] : layerCurrentRenderer.rendererOL["fill-color"];
|
|
1096
1123
|
const valuesAndColors = [];
|
|
@@ -1231,7 +1258,7 @@
|
|
|
1231
1258
|
}
|
|
1232
1259
|
async function calculateStopsByMode(mode, nClasses, intervalSize2) {
|
|
1233
1260
|
let stops2 = [];
|
|
1234
|
-
let values =
|
|
1261
|
+
let values = selectedAttr?.values.map(Number) || [];
|
|
1235
1262
|
values = values.filter((v) => !isNaN(v) && v != null);
|
|
1236
1263
|
const min = Math.min(...values);
|
|
1237
1264
|
const max = Math.max(...values);
|
|
@@ -1285,7 +1312,7 @@
|
|
|
1285
1312
|
}
|
|
1286
1313
|
react.useEffect(() => {
|
|
1287
1314
|
if (stops.length > 0) {
|
|
1288
|
-
let values =
|
|
1315
|
+
let values = selectedAttr?.values.map(Number) || [];
|
|
1289
1316
|
values = values.filter((v) => !isNaN(v) && v != null);
|
|
1290
1317
|
setIntervals(countNumbers(values || []));
|
|
1291
1318
|
}
|
|
@@ -1328,7 +1355,7 @@
|
|
|
1328
1355
|
if (context.tick) {
|
|
1329
1356
|
const value = Number.parseInt(context.tick.label);
|
|
1330
1357
|
const interval = stops.map((stop) => intervals.find((i) => i.min <= stop.value && stop.value < i.max));
|
|
1331
|
-
return interval.find((i) =>
|
|
1358
|
+
return interval.find((i) => i?.min <= value && value < i.max) ? "#ea1010" : "rgba(0,0,0,0)";
|
|
1332
1359
|
} else
|
|
1333
1360
|
return "rgba(0,0,0,0)";
|
|
1334
1361
|
},
|
|
@@ -1527,7 +1554,6 @@
|
|
|
1527
1554
|
] }),
|
|
1528
1555
|
stops.map(
|
|
1529
1556
|
(value, index) => {
|
|
1530
|
-
var _a, _b;
|
|
1531
1557
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-row-small-small-gap", children: [
|
|
1532
1558
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1533
1559
|
inputnumber_esm_js.InputNumber,
|
|
@@ -1536,7 +1562,7 @@
|
|
|
1536
1562
|
allowEmpty: false,
|
|
1537
1563
|
locale,
|
|
1538
1564
|
min: stops[0].value,
|
|
1539
|
-
max: index < stops.length - 1 ?
|
|
1565
|
+
max: index < stops.length - 1 ? stops[index + 1]?.value - 1e-3 : stops[stops.length]?.value,
|
|
1540
1566
|
disabled: index === 0 || selectedMode != GraduatedModes.Manual || index === stops.length - 1,
|
|
1541
1567
|
onChange: (e) => {
|
|
1542
1568
|
const aux = [...stops];
|
|
@@ -1571,7 +1597,11 @@
|
|
|
1571
1597
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1572
1598
|
MyColorPicker,
|
|
1573
1599
|
{
|
|
1574
|
-
color:
|
|
1600
|
+
color: (() => {
|
|
1601
|
+
if (borderColor.at(3) < 1)
|
|
1602
|
+
return [borderColor[0], borderColor[1], borderColor[2], 1];
|
|
1603
|
+
return borderColor;
|
|
1604
|
+
})(),
|
|
1575
1605
|
hideAlpha: true,
|
|
1576
1606
|
onChange: (e) => setBorderColor(color_js.fromString(e))
|
|
1577
1607
|
}
|
|
@@ -1658,8 +1688,8 @@
|
|
|
1658
1688
|
applyRenderer({
|
|
1659
1689
|
type: RenderType.Graduated,
|
|
1660
1690
|
graduatedType: selectedMode,
|
|
1661
|
-
field: selectedAttr
|
|
1662
|
-
rendererOL: getGraduatedStyle(selectedAttr
|
|
1691
|
+
field: selectedAttr?.name,
|
|
1692
|
+
rendererOL: getGraduatedStyle(selectedAttr?.name, stops, borderColor, borderThickness)
|
|
1663
1693
|
});
|
|
1664
1694
|
setVisible(false);
|
|
1665
1695
|
}
|
|
@@ -1730,7 +1760,7 @@
|
|
|
1730
1760
|
}
|
|
1731
1761
|
)
|
|
1732
1762
|
] }),
|
|
1733
|
-
|
|
1763
|
+
activeIndex?.code == 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1734
1764
|
UniqueSymbol,
|
|
1735
1765
|
{
|
|
1736
1766
|
layerCurrentRenderer: currentRenderer,
|
|
@@ -1739,7 +1769,7 @@
|
|
|
1739
1769
|
setVisible
|
|
1740
1770
|
}
|
|
1741
1771
|
),
|
|
1742
|
-
|
|
1772
|
+
activeIndex?.code == 1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1743
1773
|
Categorized,
|
|
1744
1774
|
{
|
|
1745
1775
|
attr,
|
|
@@ -1752,7 +1782,7 @@
|
|
|
1752
1782
|
showPreDefinedRamps
|
|
1753
1783
|
}
|
|
1754
1784
|
),
|
|
1755
|
-
|
|
1785
|
+
activeIndex?.code == 2 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1756
1786
|
Graduated,
|
|
1757
1787
|
{
|
|
1758
1788
|
attr,
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,10 @@ var GraduatedModes = /* @__PURE__ */ ((GraduatedModes2) => {
|
|
|
60
60
|
return GraduatedModes2;
|
|
61
61
|
})(GraduatedModes || {});
|
|
62
62
|
function getCategorizedStyle(attribute, colors, outlineColor, outlineWidth, defaultColor) {
|
|
63
|
+
if (outlineWidth == 0 && outlineColor != void 0)
|
|
64
|
+
outlineColor[3] = 0;
|
|
65
|
+
else if (outlineWidth != void 0 && outlineWidth > 0 && outlineColor)
|
|
66
|
+
outlineColor[3] = 1;
|
|
63
67
|
let aux = [];
|
|
64
68
|
aux.push("match");
|
|
65
69
|
aux.push(["get", attribute]);
|
|
@@ -75,11 +79,15 @@ function getCategorizedStyle(attribute, colors, outlineColor, outlineWidth, defa
|
|
|
75
79
|
"white",
|
|
76
80
|
outlineColor || "#000000"
|
|
77
81
|
],
|
|
78
|
-
"stroke-width": ["case", ["==", ["var", "highlightedId"], ["id"]], 2, outlineWidth
|
|
82
|
+
"stroke-width": ["case", ["==", ["var", "highlightedId"], ["id"]], 2, outlineWidth == void 0 ? 1 : outlineWidth],
|
|
79
83
|
"fill-color": aux
|
|
80
84
|
};
|
|
81
85
|
}
|
|
82
86
|
function singleColorStyle(color, outlineColor, outlineWidth) {
|
|
87
|
+
if (outlineWidth == 0 && outlineColor != void 0)
|
|
88
|
+
outlineColor[3] = 0;
|
|
89
|
+
else if (outlineWidth != void 0 && outlineWidth > 0 && outlineColor)
|
|
90
|
+
outlineColor[3] = 1;
|
|
83
91
|
return {
|
|
84
92
|
"stroke-color": [
|
|
85
93
|
"case",
|
|
@@ -87,7 +95,7 @@ function singleColorStyle(color, outlineColor, outlineWidth) {
|
|
|
87
95
|
"white",
|
|
88
96
|
outlineColor || "#000000"
|
|
89
97
|
],
|
|
90
|
-
"stroke-width": ["case", ["==", ["var", "highlightedId"], ["id"]], 2, outlineWidth
|
|
98
|
+
"stroke-width": ["case", ["==", ["var", "highlightedId"], ["id"]], 2, outlineWidth == void 0 ? 1 : outlineWidth],
|
|
91
99
|
"stroke-offset": 0,
|
|
92
100
|
"fill-color": color
|
|
93
101
|
};
|
|
@@ -100,6 +108,10 @@ function singleColorStyleForLines(color) {
|
|
|
100
108
|
};
|
|
101
109
|
}
|
|
102
110
|
function getGraduatedStyle(attribute, ramp, outlineColor, outlineWidth) {
|
|
111
|
+
if (outlineWidth == 0 && outlineColor != void 0)
|
|
112
|
+
outlineColor[3] = 0;
|
|
113
|
+
else if (outlineWidth != void 0 && outlineWidth > 0 && outlineColor)
|
|
114
|
+
outlineColor[3] = 1;
|
|
103
115
|
let aux = [];
|
|
104
116
|
aux.push("interpolate");
|
|
105
117
|
aux.push(["linear"]);
|
|
@@ -115,7 +127,7 @@ function getGraduatedStyle(attribute, ramp, outlineColor, outlineWidth) {
|
|
|
115
127
|
"white",
|
|
116
128
|
outlineColor || "#000000"
|
|
117
129
|
],
|
|
118
|
-
"stroke-width": ["case", ["==", ["var", "highlightedId"], ["id"]], 2, outlineWidth
|
|
130
|
+
"stroke-width": ["case", ["==", ["var", "highlightedId"], ["id"]], 2, outlineWidth == void 0 ? 1 : outlineWidth],
|
|
119
131
|
"fill-color": aux
|
|
120
132
|
};
|
|
121
133
|
}
|
|
@@ -134,8 +146,13 @@ function changeRendererOpacity(renderer, opacity) {
|
|
|
134
146
|
let aux = renderer.rendererOL["fill-color"];
|
|
135
147
|
aux = [...aux];
|
|
136
148
|
aux[3] = opacity / 100;
|
|
137
|
-
newRenderer = {
|
|
138
|
-
|
|
149
|
+
newRenderer = {
|
|
150
|
+
...renderer,
|
|
151
|
+
rendererOL: {
|
|
152
|
+
...renderer.rendererOL,
|
|
153
|
+
["fill-color"]: aux
|
|
154
|
+
}
|
|
155
|
+
};
|
|
139
156
|
}
|
|
140
157
|
if (renderer.type == "Categorized") {
|
|
141
158
|
let aux = renderer.rendererOL["fill-color"].slice(3);
|
|
@@ -145,7 +162,6 @@ function changeRendererOpacity(renderer, opacity) {
|
|
|
145
162
|
color[3] = opacity / 100;
|
|
146
163
|
newAux[i] = color;
|
|
147
164
|
}
|
|
148
|
-
console.log(renderer);
|
|
149
165
|
newRenderer = {
|
|
150
166
|
...renderer,
|
|
151
167
|
rendererOL: {
|
|
@@ -153,7 +169,6 @@ function changeRendererOpacity(renderer, opacity) {
|
|
|
153
169
|
["fill-color"]: renderer.rendererOL["fill-color"].slice(0, 3).concat(newAux)
|
|
154
170
|
}
|
|
155
171
|
};
|
|
156
|
-
console.log(newRenderer);
|
|
157
172
|
}
|
|
158
173
|
if (renderer.type == "Graduated") {
|
|
159
174
|
let aux = renderer.rendererOL["fill-color"].slice(4);
|
|
@@ -163,8 +178,13 @@ function changeRendererOpacity(renderer, opacity) {
|
|
|
163
178
|
color[3] = opacity / 100;
|
|
164
179
|
newAux[i] = color;
|
|
165
180
|
}
|
|
166
|
-
newRenderer = {
|
|
167
|
-
|
|
181
|
+
newRenderer = {
|
|
182
|
+
...renderer,
|
|
183
|
+
rendererOL: {
|
|
184
|
+
...renderer.rendererOL,
|
|
185
|
+
["fill-color"]: renderer.rendererOL["fill-color"].slice(0, 4).concat(newAux)
|
|
186
|
+
}
|
|
187
|
+
};
|
|
168
188
|
}
|
|
169
189
|
return newRenderer;
|
|
170
190
|
}
|
|
@@ -266,7 +286,11 @@ const UniqueSymbol = (props) => {
|
|
|
266
286
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
267
287
|
MyColorPicker,
|
|
268
288
|
{
|
|
269
|
-
color:
|
|
289
|
+
color: (() => {
|
|
290
|
+
if (borderColor.at(3) < 1)
|
|
291
|
+
return [borderColor[0], borderColor[1], borderColor[2], 1];
|
|
292
|
+
return borderColor;
|
|
293
|
+
})(),
|
|
270
294
|
hideAlpha: true,
|
|
271
295
|
onChange: (e) => setBorderColor(fromString(e))
|
|
272
296
|
}
|
|
@@ -807,7 +831,7 @@ const Categorized = (props) => {
|
|
|
807
831
|
});
|
|
808
832
|
setTable(tableUpdated);
|
|
809
833
|
} else if (colorRamp.value.length > 0) {
|
|
810
|
-
const style = getCategorizedStyle(selectedAttr
|
|
834
|
+
const style = getCategorizedStyle(selectedAttr?.name, colorRamp.value);
|
|
811
835
|
const colors = getStyleColorsAndValues(style, RenderType.Categorized);
|
|
812
836
|
const tableUpdated = [];
|
|
813
837
|
table.forEach(({ value, visible }) => {
|
|
@@ -914,7 +938,11 @@ const Categorized = (props) => {
|
|
|
914
938
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
915
939
|
MyColorPicker,
|
|
916
940
|
{
|
|
917
|
-
color:
|
|
941
|
+
color: (() => {
|
|
942
|
+
if (borderColor.at(3) < 1)
|
|
943
|
+
return [borderColor[0], borderColor[1], borderColor[2], 1];
|
|
944
|
+
return borderColor;
|
|
945
|
+
})(),
|
|
918
946
|
hideAlpha: true,
|
|
919
947
|
onChange: (e) => setBorderColor(fromString(e))
|
|
920
948
|
}
|
|
@@ -1015,7 +1043,7 @@ const Categorized = (props) => {
|
|
|
1015
1043
|
DataTable,
|
|
1016
1044
|
{
|
|
1017
1045
|
value: table,
|
|
1018
|
-
selectionMode: rowClick ?
|
|
1046
|
+
selectionMode: rowClick ? null : "checkbox",
|
|
1019
1047
|
tableStyle: { minWidth: "25rem" },
|
|
1020
1048
|
selection: table.filter((tr) => tr.visible),
|
|
1021
1049
|
onSelectionChange: (e) => {
|
|
@@ -1048,8 +1076,8 @@ const Categorized = (props) => {
|
|
|
1048
1076
|
onClick: () => {
|
|
1049
1077
|
applyRenderer({
|
|
1050
1078
|
type: RenderType.Categorized,
|
|
1051
|
-
field: selectedAttr
|
|
1052
|
-
rendererOL: getCategorizedStyle(selectedAttr
|
|
1079
|
+
field: selectedAttr?.name,
|
|
1080
|
+
rendererOL: getCategorizedStyle(selectedAttr?.name, table.filter((row) => row.value != nullText && row.visible).map((tr) => ({
|
|
1053
1081
|
value: tr.value,
|
|
1054
1082
|
color: tr.color
|
|
1055
1083
|
})), borderColor, borderThickness, table.find((row) => row.value == nullText).color)
|
|
@@ -1103,8 +1131,7 @@ const Graduated = (props) => {
|
|
|
1103
1131
|
const locale = numbersLocale;
|
|
1104
1132
|
const toast = useRef(null);
|
|
1105
1133
|
const showToast = (message, severity) => {
|
|
1106
|
-
|
|
1107
|
-
(_a = toast.current) == null ? void 0 : _a.show({ severity, summary: "Error", detail: message });
|
|
1134
|
+
toast.current?.show({ severity, summary: "Error", detail: message });
|
|
1108
1135
|
};
|
|
1109
1136
|
const currentRender = layerCurrentRenderer.type != RenderType.Graduated ? [] : layerCurrentRenderer.rendererOL["fill-color"];
|
|
1110
1137
|
const valuesAndColors = [];
|
|
@@ -1245,7 +1272,7 @@ const Graduated = (props) => {
|
|
|
1245
1272
|
}
|
|
1246
1273
|
async function calculateStopsByMode(mode, nClasses, intervalSize2) {
|
|
1247
1274
|
let stops2 = [];
|
|
1248
|
-
let values =
|
|
1275
|
+
let values = selectedAttr?.values.map(Number) || [];
|
|
1249
1276
|
values = values.filter((v) => !isNaN(v) && v != null);
|
|
1250
1277
|
const min = Math.min(...values);
|
|
1251
1278
|
const max = Math.max(...values);
|
|
@@ -1299,7 +1326,7 @@ const Graduated = (props) => {
|
|
|
1299
1326
|
}
|
|
1300
1327
|
useEffect(() => {
|
|
1301
1328
|
if (stops.length > 0) {
|
|
1302
|
-
let values =
|
|
1329
|
+
let values = selectedAttr?.values.map(Number) || [];
|
|
1303
1330
|
values = values.filter((v) => !isNaN(v) && v != null);
|
|
1304
1331
|
setIntervals(countNumbers(values || []));
|
|
1305
1332
|
}
|
|
@@ -1342,7 +1369,7 @@ const Graduated = (props) => {
|
|
|
1342
1369
|
if (context.tick) {
|
|
1343
1370
|
const value = Number.parseInt(context.tick.label);
|
|
1344
1371
|
const interval = stops.map((stop) => intervals.find((i) => i.min <= stop.value && stop.value < i.max));
|
|
1345
|
-
return interval.find((i) =>
|
|
1372
|
+
return interval.find((i) => i?.min <= value && value < i.max) ? "#ea1010" : "rgba(0,0,0,0)";
|
|
1346
1373
|
} else
|
|
1347
1374
|
return "rgba(0,0,0,0)";
|
|
1348
1375
|
},
|
|
@@ -1541,7 +1568,6 @@ const Graduated = (props) => {
|
|
|
1541
1568
|
] }),
|
|
1542
1569
|
stops.map(
|
|
1543
1570
|
(value, index) => {
|
|
1544
|
-
var _a, _b;
|
|
1545
1571
|
return /* @__PURE__ */ jsxs("div", { className: "flex-row-small-small-gap", children: [
|
|
1546
1572
|
/* @__PURE__ */ jsx(
|
|
1547
1573
|
InputNumber,
|
|
@@ -1550,7 +1576,7 @@ const Graduated = (props) => {
|
|
|
1550
1576
|
allowEmpty: false,
|
|
1551
1577
|
locale,
|
|
1552
1578
|
min: stops[0].value,
|
|
1553
|
-
max: index < stops.length - 1 ?
|
|
1579
|
+
max: index < stops.length - 1 ? stops[index + 1]?.value - 1e-3 : stops[stops.length]?.value,
|
|
1554
1580
|
disabled: index === 0 || selectedMode != GraduatedModes.Manual || index === stops.length - 1,
|
|
1555
1581
|
onChange: (e) => {
|
|
1556
1582
|
const aux = [...stops];
|
|
@@ -1585,7 +1611,11 @@ const Graduated = (props) => {
|
|
|
1585
1611
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
1586
1612
|
MyColorPicker,
|
|
1587
1613
|
{
|
|
1588
|
-
color:
|
|
1614
|
+
color: (() => {
|
|
1615
|
+
if (borderColor.at(3) < 1)
|
|
1616
|
+
return [borderColor[0], borderColor[1], borderColor[2], 1];
|
|
1617
|
+
return borderColor;
|
|
1618
|
+
})(),
|
|
1589
1619
|
hideAlpha: true,
|
|
1590
1620
|
onChange: (e) => setBorderColor(fromString(e))
|
|
1591
1621
|
}
|
|
@@ -1672,8 +1702,8 @@ const Graduated = (props) => {
|
|
|
1672
1702
|
applyRenderer({
|
|
1673
1703
|
type: RenderType.Graduated,
|
|
1674
1704
|
graduatedType: selectedMode,
|
|
1675
|
-
field: selectedAttr
|
|
1676
|
-
rendererOL: getGraduatedStyle(selectedAttr
|
|
1705
|
+
field: selectedAttr?.name,
|
|
1706
|
+
rendererOL: getGraduatedStyle(selectedAttr?.name, stops, borderColor, borderThickness)
|
|
1677
1707
|
});
|
|
1678
1708
|
setVisible(false);
|
|
1679
1709
|
}
|
|
@@ -1744,7 +1774,7 @@ const GeometryEditor = (props) => {
|
|
|
1744
1774
|
}
|
|
1745
1775
|
)
|
|
1746
1776
|
] }),
|
|
1747
|
-
|
|
1777
|
+
activeIndex?.code == 0 && /* @__PURE__ */ jsx(
|
|
1748
1778
|
UniqueSymbol,
|
|
1749
1779
|
{
|
|
1750
1780
|
layerCurrentRenderer: currentRenderer,
|
|
@@ -1753,7 +1783,7 @@ const GeometryEditor = (props) => {
|
|
|
1753
1783
|
setVisible
|
|
1754
1784
|
}
|
|
1755
1785
|
),
|
|
1756
|
-
|
|
1786
|
+
activeIndex?.code == 1 && /* @__PURE__ */ jsx(
|
|
1757
1787
|
Categorized,
|
|
1758
1788
|
{
|
|
1759
1789
|
attr,
|
|
@@ -1766,7 +1796,7 @@ const GeometryEditor = (props) => {
|
|
|
1766
1796
|
showPreDefinedRamps
|
|
1767
1797
|
}
|
|
1768
1798
|
),
|
|
1769
|
-
|
|
1799
|
+
activeIndex?.code == 2 && /* @__PURE__ */ jsx(
|
|
1770
1800
|
Graduated,
|
|
1771
1801
|
{
|
|
1772
1802
|
attr,
|
package/dist/rendererUtils.d.ts
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openlayers-style-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A style editor extension for OpenLayers currently working with WebGL Vector Layers",
|
|
6
6
|
"homepage": "https://land-it.github.io/openlayers-style-editor/",
|
|
@@ -34,29 +34,29 @@
|
|
|
34
34
|
"react-dom": ">= 17.0.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"chart.js": "4.
|
|
37
|
+
"chart.js": "4.5.1",
|
|
38
38
|
"geobuckets": "0.0.3",
|
|
39
|
-
"i18next": "
|
|
39
|
+
"i18next": "25.6.0",
|
|
40
40
|
"primeicons": "7.0.0",
|
|
41
|
-
"primereact": "10.9.
|
|
41
|
+
"primereact": "10.9.7",
|
|
42
42
|
"react-best-gradient-color-picker": "3.0.14",
|
|
43
|
-
"react-i18next": "
|
|
43
|
+
"react-i18next": "16.2.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@eslint/js": "9.
|
|
47
|
-
"@types/node": "
|
|
46
|
+
"@eslint/js": "9.38.0",
|
|
47
|
+
"@types/node": "24.9.1",
|
|
48
48
|
"@types/react": "18.3.18",
|
|
49
49
|
"@types/react-dom": "18.3.5",
|
|
50
|
-
"@vitejs/plugin-react": "
|
|
50
|
+
"@vitejs/plugin-react": "5.1.0",
|
|
51
51
|
"eslint": "8.57.0",
|
|
52
|
-
"eslint-plugin-react-hooks": "
|
|
53
|
-
"eslint-plugin-react-refresh": "0.4.
|
|
54
|
-
"globals": "16.
|
|
55
|
-
"typescript": "5.
|
|
56
|
-
"typescript-eslint": "8.
|
|
57
|
-
"vite": "
|
|
52
|
+
"eslint-plugin-react-hooks": "7.0.0",
|
|
53
|
+
"eslint-plugin-react-refresh": "0.4.24",
|
|
54
|
+
"globals": "16.4.0",
|
|
55
|
+
"typescript": "5.9.3",
|
|
56
|
+
"typescript-eslint": "8.46.2",
|
|
57
|
+
"vite": "7.1.12",
|
|
58
58
|
"vite-plugin-css-injected-by-js": "3.5.2",
|
|
59
|
-
"vite-plugin-dts": "4.5.
|
|
59
|
+
"vite-plugin-dts": "4.5.4"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|