geostyler 18.4.2 → 18.5.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.
@@ -1,102 +1,115 @@
1
- import { jsx as e, jsxs as p } from "react/jsx-runtime";
2
- import { useState as n } from "react";
3
- import { Form as l, Radio as R, InputNumber as J, Tooltip as Q, Button as D } from "antd";
4
- import { AttributeCombo as X } from "../Filter/AttributeCombo/AttributeCombo.js";
1
+ import { jsx as e, jsxs as g } from "react/jsx-runtime";
2
+ import { useState as t } from "react";
3
+ import { Form as r, Radio as F, InputNumber as oe, Tooltip as le, Button as O } from "antd";
4
+ import { AttributeCombo as te } from "../Filter/AttributeCombo/AttributeCombo.js";
5
5
  /* empty css */
6
- import g from "../../Util/RuleGeneratorUtil.js";
7
- import { KindField as Y } from "../Symbolizer/Field/KindField/KindField.js";
8
- import { WellKnownNameField as Z } from "../Symbolizer/Field/WellKnownNameField/WellKnownNameField.js";
9
- import { brewer as ee } from "chroma-js";
10
- import { ColorRampCombo as oe } from "./ColorRampCombo/ColorRampCombo.js";
11
- import { ColorSpaceCombo as te } from "./ColorSpaceCombo/ColorSpaceCombo.js";
12
- import { ColorsPreview as ne } from "./ColorsPreview/ColorsPreview.js";
13
- import { ClassificationCombo as re } from "./ClassificationCombo/ClassificationCombo.js";
14
- import le from "lodash-es/get.js";
15
- import { PlusSquareOutlined as ie } from "@ant-design/icons";
16
- import { useGeoStylerData as se, useGeoStylerComposition as ae, useGeoStylerLocale as ce } from "../../context/GeoStylerContext/GeoStylerContext.js";
17
- import { getFormItemConfig as me } from "../../Util/FormItemUtil.js";
18
- const ke = (K) => {
19
- const u = se(), O = ae("RuleGenerator"), E = { ...K, ...O }, {
20
- onRulesChange: y,
21
- colorSpaces: S = ["hsl", "hsv", "hsi", "lab", "lch", "hcl", "rgb"],
6
+ import f from "../../Util/RuleGeneratorUtil.js";
7
+ import { KindField as ne } from "../Symbolizer/Field/KindField/KindField.js";
8
+ import { WellKnownNameField as re } from "../Symbolizer/Field/WellKnownNameField/WellKnownNameField.js";
9
+ import { brewer as se } from "chroma-js";
10
+ import { ColorRampCombo as ie } from "./ColorRampCombo/ColorRampCombo.js";
11
+ import { ColorSpaceCombo as ae } from "./ColorSpaceCombo/ColorSpaceCombo.js";
12
+ import { ColorsPreview as ce } from "./ColorsPreview/ColorsPreview.js";
13
+ import { ClassificationCombo as me } from "./ClassificationCombo/ClassificationCombo.js";
14
+ import ue from "lodash-es/get.js";
15
+ import { PlusSquareOutlined as de } from "@ant-design/icons";
16
+ import { useGeoStylerData as he, useGeoStylerComposition as W, useGeoStylerLocale as pe } from "../../context/GeoStylerContext/GeoStylerContext.js";
17
+ import { getFormItemConfig as ge } from "../../Util/FormItemUtil.js";
18
+ import { ElseRuleField as fe } from "../Symbolizer/Field/ElseRuleField/ElseRuleField.js";
19
+ const $e = ($) => {
20
+ const u = he(), L = W("RuleGenerator"), C = W("Rule"), P = { ...$, ...L, elseRuleField: C == null ? void 0 : C.elseRuleField }, {
21
+ onRulesChange: G,
22
+ colorSpaces: M = ["hsl", "hsv", "hsi", "lab", "lch", "hcl", "rgb"],
22
23
  // rgba, cmyk and gl crash
23
24
  colorRamps: m = {
24
25
  GeoStyler: ["#E7000E", "#F48E00", "#FFED00", "#00943D", "#272C82", "#611E82"],
25
26
  GreenRed: ["#00FF00", "#FF0000"],
26
- ...ee
27
- }
28
- } = E, o = ce("RuleGenerator"), i = 2, [f, W] = n(
29
- g.guessSymbolizerFromData(u)
30
- ), [C, G] = n("circle"), [b, $] = n(m && m.GeoStyler ? "GeoStyler" : void 0), [M, P] = n("hsl"), [s, v] = n(2), [F, V] = n(), [x, w] = n(), [z, A] = n(), [d, T] = n(), [a, I] = n(), [h, k] = n(), B = (t) => {
27
+ ...se
28
+ },
29
+ elseRuleField: b
30
+ } = P, o = pe("RuleGenerator"), a = 2, [v, V] = t(
31
+ f.guessSymbolizerFromData(u)
32
+ ), [R, I] = t("circle"), [y, x] = t(m && m.GeoStyler ? "GeoStyler" : void 0), [w, z] = t("hsl"), [i, S] = t(2), [k, A] = t([]), [T, E] = t(), [B, j] = t(), [d, U] = t(), [c, N] = t(), [h, D] = t(), [p, q] = t(!1), H = (l) => {
31
33
  try {
32
- const c = le(u, `schema.properties[${t}].type`);
33
- let N = a;
34
- c === "string" && a === "kmeans" && (N = void 0);
35
- const _ = g.getDistinctValues(u, t) || [];
36
- T(t), A(c), V(_), k(c === "string" ? "nominal" : "cardinal"), I(N);
34
+ const s = ue(u, `schema.properties[${l}].type`);
35
+ let K = c;
36
+ s === "string" && c === "kmeans" && (K = void 0);
37
+ const ee = f.getDistinctValues(u, l) || [];
38
+ U(l), j(s), A(ee), D(s === "string" ? "nominal" : "cardinal"), N(K);
37
39
  } catch {
38
- w(!0);
40
+ E(!0);
39
41
  }
40
- }, L = (t) => {
41
- k(t.target.value);
42
- }, j = () => {
43
- v(F.length);
44
- }, U = (t) => {
45
- let c;
46
- t === "Mark" && !C ? c = "circle" : c = void 0, G(c), W(t);
47
- }, q = () => {
42
+ }, _ = (l) => {
43
+ q(l);
44
+ }, J = (l) => {
45
+ D(l.target.value);
46
+ }, Q = () => {
47
+ S(k.length);
48
+ }, X = (l) => {
49
+ let s;
50
+ l === "Mark" && !R ? s = "circle" : s = void 0, I(s), V(l);
51
+ }, Y = () => {
48
52
  try {
49
- const t = g.generateRules({
53
+ const l = f.generateRules({
50
54
  attributeName: d,
51
- classificationMethod: a,
52
- colors: m[b],
55
+ classificationMethod: c,
56
+ colors: m[y],
53
57
  data: u,
54
58
  levelOfMeasurement: h,
55
- numberOfRules: s,
56
- symbolizerKind: f,
57
- wellKnownName: C
59
+ numberOfRules: i,
60
+ symbolizerKind: v,
61
+ wellKnownName: R,
62
+ elseRule: p
58
63
  });
59
- a === "kmeans" && v(t.length), y && y(t);
64
+ if (c === "kmeans") {
65
+ const s = p ? l.length : l.length - 1;
66
+ S(s);
67
+ }
68
+ G && G(l);
60
69
  } catch {
61
- w(!0);
70
+ E(!0);
62
71
  }
63
72
  };
64
- if (x)
73
+ if (T)
65
74
  return /* @__PURE__ */ e("h1", { children: "An error occurred in the RuleGenerator UI." });
66
- const H = g.generateColors(m[b], s, M), r = me();
67
- return /* @__PURE__ */ p("div", { className: "gs-rule-generator", children: [
75
+ const Z = f.generateColors(
76
+ m[y],
77
+ p ? i + 1 : i,
78
+ w
79
+ ), n = ge();
80
+ return /* @__PURE__ */ g("div", { className: "gs-rule-generator", children: [
68
81
  /* @__PURE__ */ e(
69
- X,
82
+ te,
70
83
  {
71
84
  value: d,
72
- onAttributeChange: B,
85
+ onAttributeChange: H,
73
86
  validateStatus: d ? "success" : "warning"
74
87
  }
75
88
  ),
76
89
  /* @__PURE__ */ e(
77
- l.Item,
90
+ r.Item,
78
91
  {
79
- ...r,
92
+ ...n,
80
93
  label: o.levelOfMeasurement,
81
- children: /* @__PURE__ */ p(
82
- R.Group,
94
+ children: /* @__PURE__ */ g(
95
+ F.Group,
83
96
  {
84
- onChange: L,
97
+ onChange: J,
85
98
  value: h,
86
99
  buttonStyle: "solid",
87
100
  children: [
88
101
  /* @__PURE__ */ e(
89
- R.Button,
102
+ F.Button,
90
103
  {
91
104
  value: "nominal",
92
105
  children: o.nominal
93
106
  }
94
107
  ),
95
108
  /* @__PURE__ */ e(
96
- R.Button,
109
+ F.Button,
97
110
  {
98
111
  value: "cardinal",
99
- disabled: z === "string",
112
+ disabled: B === "string",
100
113
  children: o.cardinal
101
114
  }
102
115
  )
@@ -106,136 +119,150 @@ const ke = (K) => {
106
119
  }
107
120
  ),
108
121
  h !== "cardinal" ? null : /* @__PURE__ */ e(
109
- l.Item,
122
+ r.Item,
110
123
  {
111
- ...r,
124
+ ...n,
112
125
  label: o.classification,
113
126
  children: /* @__PURE__ */ e(
114
- re,
127
+ me,
115
128
  {
116
- classification: a,
117
- onChange: I
129
+ classification: c,
130
+ onChange: N
118
131
  }
119
132
  )
120
133
  }
121
134
  ),
122
135
  /* @__PURE__ */ e(
123
- l.Item,
136
+ r.Item,
124
137
  {
125
- ...r,
138
+ ...n,
126
139
  label: o.numberOfRules,
127
- validateStatus: a === "kmeans" ? "warning" : s < i ? "error" : void 0,
128
- help: a === "kmeans" ? o.numberOfRulesViaKmeans : s < i ? `${o.colorRampMinClassesWarningPre} ${i} ${o.colorRampMinClassesWarningPost}` : void 0,
129
- children: /* @__PURE__ */ p("div", { children: [
140
+ validateStatus: c === "kmeans" ? "warning" : i < a ? "error" : void 0,
141
+ help: c === "kmeans" ? o.numberOfRulesViaKmeans : i < a ? `${o.colorRampMinClassesWarningPre} ${a} ${o.colorRampMinClassesWarningPost}` : void 0,
142
+ children: /* @__PURE__ */ g("div", { children: [
130
143
  /* @__PURE__ */ e(
131
- J,
144
+ oe,
132
145
  {
133
- min: i,
146
+ min: a,
134
147
  max: 100,
135
- value: s,
136
- onChange: v
148
+ value: i,
149
+ onChange: S
137
150
  }
138
151
  ),
139
- h === "nominal" && F.length > 0 && /* @__PURE__ */ e(Q, { title: o.allDistinctValues, children: /* @__PURE__ */ e(
140
- D,
152
+ h === "nominal" && k.length > 0 && /* @__PURE__ */ e(le, { title: o.allDistinctValues, children: /* @__PURE__ */ e(
153
+ O,
141
154
  {
142
155
  className: "all-distinct-values-button",
143
- icon: /* @__PURE__ */ e(ie, {}),
144
- onClick: j
156
+ icon: /* @__PURE__ */ e(de, {}),
157
+ onClick: Q
145
158
  }
146
159
  ) })
147
160
  ] })
148
161
  }
149
162
  ),
150
- /* @__PURE__ */ p("fieldset", { children: [
163
+ /* @__PURE__ */ g("fieldset", { children: [
151
164
  /* @__PURE__ */ e("legend", { children: o.symbolizer }),
152
165
  /* @__PURE__ */ e(
153
- l.Item,
166
+ r.Item,
154
167
  {
155
- ...r,
168
+ ...n,
156
169
  children: /* @__PURE__ */ e(
157
- Y,
170
+ ne,
158
171
  {
159
- value: f,
172
+ value: v,
160
173
  symbolizerKinds: [
161
174
  "Fill",
162
175
  "Mark",
163
176
  "Line"
164
177
  ],
165
- onChange: U
178
+ onChange: X
166
179
  }
167
180
  )
168
181
  }
169
182
  ),
170
- f !== "Mark" ? null : /* @__PURE__ */ e(
171
- l.Item,
183
+ v !== "Mark" ? null : /* @__PURE__ */ e(
184
+ r.Item,
172
185
  {
173
- ...r,
186
+ ...n,
174
187
  children: /* @__PURE__ */ e(
175
- Z,
188
+ re,
176
189
  {
177
- value: C,
178
- onChange: G
190
+ value: R,
191
+ onChange: I
179
192
  }
180
193
  )
181
194
  }
182
195
  ),
183
196
  /* @__PURE__ */ e(
184
- l.Item,
197
+ r.Item,
185
198
  {
186
- ...r,
199
+ ...n,
187
200
  label: o.colorRamp,
188
- help: s < i ? `${o.colorRampMinClassesWarningPre} ${i} ${o.colorRampMinClassesWarningPost}` : void 0,
201
+ help: i < a ? `${o.colorRampMinClassesWarningPre} ${a} ${o.colorRampMinClassesWarningPost}` : void 0,
189
202
  children: /* @__PURE__ */ e(
190
- oe,
203
+ ie,
191
204
  {
192
205
  colorRamps: m,
193
- colorRamp: b,
194
- onChange: $
206
+ colorRamp: y,
207
+ onChange: x
195
208
  }
196
209
  )
197
210
  }
198
211
  ),
199
- S.length > 0 ? /* @__PURE__ */ e(
200
- l.Item,
212
+ M.length > 0 ? /* @__PURE__ */ e(
213
+ r.Item,
201
214
  {
202
- ...r,
215
+ ...n,
203
216
  label: o.colorSpace,
204
217
  children: /* @__PURE__ */ e(
205
- te,
218
+ ae,
206
219
  {
207
- colorSpace: M,
208
- colorSpaces: S,
209
- onChange: P
220
+ colorSpace: w,
221
+ colorSpaces: M,
222
+ onChange: z
210
223
  }
211
224
  )
212
225
  }
213
226
  ) : null,
214
227
  /* @__PURE__ */ e(
215
- l.Item,
228
+ r.Item,
216
229
  {
217
- ...r,
230
+ ...n,
218
231
  label: o.preview,
219
232
  children: /* @__PURE__ */ e(
220
- ne,
233
+ ce,
221
234
  {
222
- colors: H
235
+ colors: Z
223
236
  }
224
237
  )
225
238
  }
226
239
  )
227
240
  ] }),
241
+ (b == null ? void 0 : b.visibility) === !1 ? null : /* @__PURE__ */ e(
242
+ r.Item,
243
+ {
244
+ ...n,
245
+ label: o.elseRuleFieldLabel,
246
+ children: /* @__PURE__ */ e(
247
+ fe,
248
+ {
249
+ value: p,
250
+ onChange: _
251
+ }
252
+ )
253
+ }
254
+ ),
228
255
  /* @__PURE__ */ e(
229
- l.Item,
256
+ r.Item,
230
257
  {
231
- ...r,
258
+ ...n,
232
259
  children: /* @__PURE__ */ e(
233
- D,
260
+ O,
234
261
  {
235
262
  className: "gs-rule-generator-submit-button",
236
263
  type: "primary",
237
- onClick: q,
238
- disabled: s < i || !d,
264
+ onClick: Y,
265
+ disabled: i < a || !d,
239
266
  children: o.generateButtonText
240
267
  }
241
268
  )
@@ -244,5 +271,5 @@ const ke = (K) => {
244
271
  ] });
245
272
  };
246
273
  export {
247
- ke as RuleGenerator
274
+ $e as RuleGenerator
248
275
  };
@@ -1,62 +1,67 @@
1
- import { jsxs as S, jsx as i } from "react/jsx-runtime";
1
+ import { jsxs as S, jsx as l } from "react/jsx-runtime";
2
2
  import "./RuleOverview.css.js";
3
- import { RuleFieldContainer as h } from "../RuleFieldContainer/RuleFieldContainer.js";
4
- import { Divider as b } from "antd";
5
- import { Symbolizers as d } from "../Symbolizers/Symbolizers.js";
3
+ import { RuleFieldContainer as b } from "../RuleFieldContainer/RuleFieldContainer.js";
4
+ import { Divider as d } from "antd";
5
+ import { Symbolizers as g } from "../Symbolizers/Symbolizers.js";
6
6
  import a from "../../Util/CardViewUtil.js";
7
- import { FilterOverview as g } from "../FilterOverview/FilterOverview.js";
7
+ import { FilterOverview as E } from "../FilterOverview/FilterOverview.js";
8
8
  import { useGeoStylerComposition as x, useGeoStylerLocale as z } from "../../context/GeoStylerContext/GeoStylerContext.js";
9
- const j = (c) => {
9
+ const k = (c) => {
10
10
  var t, m;
11
- const u = x("Rule"), p = { ...c, ...u }, {
12
- onChangeView: s = () => {
11
+ const u = x("Rule"), R = { ...c, ...u }, {
12
+ onChangeView: r = () => {
13
13
  },
14
- onRuleChange: l = () => {
14
+ onRuleChange: i = () => {
15
15
  },
16
16
  rule: o,
17
- filterField: r
18
- } = p, f = z("RuleOverview"), v = (n) => {
17
+ filterField: s
18
+ } = R, p = z("RuleOverview"), C = (n) => {
19
19
  const e = { ...o, name: n };
20
- l(e);
21
- }, C = (n) => {
20
+ i(e);
21
+ }, f = (n) => {
22
22
  const e = { ...o };
23
- e.scaleDenominator || (e.scaleDenominator = {}), e.scaleDenominator.min = n, l(e);
24
- }, R = (n) => {
23
+ e.scaleDenominator || (e.scaleDenominator = {}), e.scaleDenominator.min = n, i(e);
24
+ }, v = (n) => {
25
25
  const e = { ...o };
26
- e.scaleDenominator || (e.scaleDenominator = {}), e.scaleDenominator.max = n, l(e);
26
+ e.scaleDenominator || (e.scaleDenominator = {}), e.scaleDenominator.max = n, i(e);
27
27
  }, w = (n) => {
28
+ const e = { ...o, elseRule: n };
29
+ i(e);
30
+ }, h = (n) => {
28
31
  const e = { ...o, symbolizers: n };
29
- l(e);
32
+ i(e);
30
33
  }, y = (n) => {
31
- s(a.SYMBOLIZERVIEW, [n]);
34
+ r(a.SYMBOLIZERVIEW, [n]);
32
35
  }, D = () => {
33
- s(a.FILTEREDITVIEW, []);
36
+ r(a.FILTEREDITVIEW, []);
34
37
  };
35
38
  return /* @__PURE__ */ S("div", { className: "gs-rule-overview", children: [
36
- /* @__PURE__ */ i("h2", { children: f.ruleTitle }),
37
- /* @__PURE__ */ i(b, {}),
38
- /* @__PURE__ */ i(
39
- h,
39
+ /* @__PURE__ */ l("h2", { children: p.ruleTitle }),
40
+ /* @__PURE__ */ l(d, {}),
41
+ /* @__PURE__ */ l(
42
+ b,
40
43
  {
41
44
  name: o.name,
42
45
  minScale: (t = o.scaleDenominator) == null ? void 0 : t.min,
43
46
  maxScale: (m = o.scaleDenominator) == null ? void 0 : m.max,
44
- onNameChange: v,
45
- onMinScaleChange: C,
46
- onMaxScaleChange: R,
47
- symbolizers: o.symbolizers
47
+ onNameChange: C,
48
+ onMinScaleChange: f,
49
+ onMaxScaleChange: v,
50
+ symbolizers: o.symbolizers,
51
+ elseRule: o.elseRule,
52
+ onElseRuleChange: w
48
53
  }
49
54
  ),
50
- /* @__PURE__ */ i(
51
- d,
55
+ /* @__PURE__ */ l(
56
+ g,
52
57
  {
53
58
  symbolizers: o.symbolizers,
54
59
  onEditSymbolizerClick: y,
55
- onSymbolizersChange: w
60
+ onSymbolizersChange: h
56
61
  }
57
62
  ),
58
- (r == null ? void 0 : r.visibility) === !1 ? null : /* @__PURE__ */ i(
59
- g,
63
+ (s == null ? void 0 : s.visibility) === !1 ? null : /* @__PURE__ */ l(
64
+ E,
60
65
  {
61
66
  filter: o.filter,
62
67
  onEditFilterClick: D
@@ -65,5 +70,5 @@ const j = (c) => {
65
70
  ] });
66
71
  };
67
72
  export {
68
- j as RuleOverview
73
+ k as RuleOverview
69
74
  };