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.
@@ -29,12 +29,17 @@ export interface RuleComposableProps {
29
29
  /** ignored if actionsField.visibility is falsy */
30
30
  remove?: boolean;
31
31
  };
32
+ elseRuleField?: {
33
+ visibility?: boolean;
34
+ };
32
35
  }
33
36
  export interface RuleCardInternalProps {
34
37
  /** The rule to display. */
35
38
  rule: GsRule;
36
39
  /** The number of features that are also matched by other rules. */
37
40
  duplicates?: number;
41
+ /** The number of features that are matched by this rule. */
42
+ amount?: number;
38
43
  /** The callback when the card was clicked. */
39
44
  onClick?: () => void;
40
45
  }
@@ -1,61 +1,58 @@
1
- import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
- import { CqlParser as $ } from "geostyler-cql-parser";
1
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
+ import { CqlParser as q } from "geostyler-cql-parser";
3
3
  /* empty css */
4
- import { Renderer as w } from "../Renderer/Renderer/Renderer.js";
5
- import R from "../../Util/FilterUtil.js";
6
- import j from "../../Util/DataUtil.js";
7
- import { Typography as k, Card as z, Divider as G } from "antd";
8
- import { BlockOutlined as P, FilterFilled as T } from "@ant-design/icons";
9
- import { useGeoStylerData as U, useGeoStylerComposition as x } from "../../context/GeoStylerContext/GeoStylerContext.js";
10
- const { Text: t } = k, J = (g) => {
11
- var h, v;
12
- const u = U(), b = x("Rule"), N = { ...g, ...b }, {
13
- rule: e,
14
- duplicates: f,
15
- onClick: C,
4
+ import { Renderer as $ } from "../Renderer/Renderer/Renderer.js";
5
+ import { Typography as w, Card as D, Divider as j } from "antd";
6
+ import { BlockOutlined as k, FilterFilled as z } from "@ant-design/icons";
7
+ import { useGeoStylerComposition as P } from "../../context/GeoStylerContext/GeoStylerContext.js";
8
+ const { Text: s } = w, E = (v) => {
9
+ var f, h;
10
+ const b = P("Rule"), g = { ...v, ...b }, {
11
+ rule: r,
12
+ duplicates: p,
13
+ amount: m,
14
+ onClick: N,
16
15
  amountField: o,
17
16
  duplicateField: c,
18
- filterField: n,
17
+ filterField: t,
19
18
  maxScaleField: a,
20
19
  minScaleField: d,
21
- nameField: m
22
- } = N;
23
- let p;
24
- j.isVector(u) && (p = R.getMatches(e.filter, u).length);
25
- const D = new $();
20
+ nameField: u
21
+ } = g, C = new q();
26
22
  let y;
27
- e.filter && (y = D.write(e.filter));
28
- const q = (l, s) => l === void 0 && s === void 0 ? "-" : l === void 0 ? `1:${s}` : s === void 0 ? `1:${l}` : `1:${l} < 1:${s}`;
29
- return /* @__PURE__ */ i(
30
- z,
23
+ r.filter && (y = C.write(r.filter));
24
+ const R = (i, n) => i === void 0 && n === void 0 ? "-" : i === void 0 ? `1:${n}` : n === void 0 ? `1:${i}` : `1:${i} < 1:${n}`;
25
+ return /* @__PURE__ */ l(
26
+ D,
31
27
  {
32
28
  className: "gs-rule-card",
33
29
  hoverable: !0,
34
- onClick: C,
30
+ onClick: N,
35
31
  children: [
36
- /* @__PURE__ */ r(
37
- w,
32
+ /* @__PURE__ */ e(
33
+ $,
38
34
  {
39
- symbolizers: e.symbolizers
35
+ symbolizers: r.symbolizers
40
36
  }
41
37
  ),
42
- /* @__PURE__ */ r(G, { type: "vertical" }),
43
- /* @__PURE__ */ i("div", { className: "gs-rule-card-content", children: [
44
- (m == null ? void 0 : m.visibility) === !1 ? null : /* @__PURE__ */ r("h2", { children: e.name }),
45
- (a == null ? void 0 : a.visibility) === !1 || (d == null ? void 0 : d.visibility) === !1 ? null : /* @__PURE__ */ r("span", { children: q((h = e.scaleDenominator) == null ? void 0 : h.min, (v = e.scaleDenominator) == null ? void 0 : v.max) }),
46
- /* @__PURE__ */ i("span", { className: "gs-rule-card-content-icon-row", children: [
47
- (o == null ? void 0 : o.visibility) === !1 ? null : /* @__PURE__ */ i(t, { type: "secondary", children: [
48
- /* @__PURE__ */ r("span", { className: "gs-rule-card-icon", children: "Σ" }),
38
+ /* @__PURE__ */ e(j, { type: "vertical" }),
39
+ /* @__PURE__ */ l("div", { className: "gs-rule-card-content", children: [
40
+ (u == null ? void 0 : u.visibility) === !1 ? null : /* @__PURE__ */ e("h2", { children: r.elseRule ? /* @__PURE__ */ e("i", { children: r.name }) : r.name }),
41
+ (a == null ? void 0 : a.visibility) === !1 || (d == null ? void 0 : d.visibility) === !1 ? null : /* @__PURE__ */ e("span", { children: R((f = r.scaleDenominator) == null ? void 0 : f.min, (h = r.scaleDenominator) == null ? void 0 : h.max) }),
42
+ /* @__PURE__ */ l("span", { className: "gs-rule-card-content-icon-row", children: [
43
+ (o == null ? void 0 : o.visibility) === !1 ? null : /* @__PURE__ */ l(s, { type: "secondary", children: [
44
+ /* @__PURE__ */ e("span", { className: "gs-rule-card-icon", children: "Σ" }),
45
+ m !== void 0 ? m : "-"
46
+ ] }),
47
+ (c == null ? void 0 : c.visibility) === !1 ? null : /* @__PURE__ */ l(s, { type: "secondary", children: [
48
+ /* @__PURE__ */ e(k, { className: "gs-rule-card-icon" }),
49
49
  p !== void 0 ? p : "-"
50
50
  ] }),
51
- (c == null ? void 0 : c.visibility) === !1 ? null : /* @__PURE__ */ i(t, { type: "secondary", children: [
52
- /* @__PURE__ */ r(P, { className: "gs-rule-card-icon" }),
53
- f !== void 0 ? f : "-"
54
- ] })
51
+ r.elseRule ? /* @__PURE__ */ e(s, { type: "secondary", children: /* @__PURE__ */ e("span", { className: "gs-rule-card-icon", children: "≠" }) }) : null
55
52
  ] }),
56
- (n == null ? void 0 : n.visibility) === !1 ? null : /* @__PURE__ */ i("span", { className: "gs-rule-card-cql", children: [
57
- /* @__PURE__ */ r(t, { type: "secondary", children: /* @__PURE__ */ r(T, { className: "gs-rule-card-icon" }) }),
58
- /* @__PURE__ */ r(t, { type: "secondary", children: y })
53
+ (t == null ? void 0 : t.visibility) === !1 ? null : /* @__PURE__ */ l("span", { className: "gs-rule-card-cql", children: [
54
+ /* @__PURE__ */ e(s, { type: "secondary", children: /* @__PURE__ */ e(z, { className: "gs-rule-card-icon" }) }),
55
+ /* @__PURE__ */ e(s, { type: "secondary", children: y })
59
56
  ] })
60
57
  ] })
61
58
  ]
@@ -63,5 +60,5 @@ const { Text: t } = k, J = (g) => {
63
60
  );
64
61
  };
65
62
  export {
66
- J as RuleCard
63
+ E as RuleCard
67
64
  };
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
- import { Expression, Symbolizer } from 'geostyler-style';
2
+ import { Expression, Rule, Symbolizer } from 'geostyler-style';
3
3
  import { RuleComposableProps } from '../RuleCard/RuleCard';
4
- export type RuleFieldContainerComposableProps = Pick<RuleComposableProps, 'maxScaleField' | 'minScaleField' | 'nameField'>;
4
+ export type RuleFieldContainerComposableProps = Pick<RuleComposableProps, 'maxScaleField' | 'minScaleField' | 'nameField' | 'elseRuleField'>;
5
5
  export interface RuleFieldContainerInternalProps {
6
6
  /** The callback method when the name changes */
7
7
  onNameChange?: (name: string) => void;
@@ -17,6 +17,10 @@ export interface RuleFieldContainerInternalProps {
17
17
  maxScale?: Expression<number>;
18
18
  /** The symbolizers of the rule */
19
19
  symbolizers?: Symbolizer[];
20
+ /** The else rule flag */
21
+ elseRule?: Rule['elseRule'];
22
+ /** The callback method when the elseRule changes */
23
+ onElseRuleChange?: (elseRule: Rule['elseRule']) => void;
20
24
  }
21
25
  export type RuleFieldContainerProps = RuleFieldContainerInternalProps & RuleFieldContainerComposableProps;
22
26
  export declare const RuleFieldContainer: React.FC<RuleFieldContainerProps>;
@@ -1,67 +1,86 @@
1
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
2
  /* empty css */
3
- import { Form as g, Divider as v } from "antd";
4
- import { FieldContainer as y } from "../FieldContainer/FieldContainer.js";
5
- import { NameField as b } from "../NameField/NameField.js";
6
- import { MinScaleDenominator as S } from "../ScaleDenominator/MinScaleDenominator.js";
7
- import { MaxScaleDenominator as x } from "../ScaleDenominator/MaxScaleDenominator.js";
8
- import { Renderer as F } from "../Renderer/Renderer/Renderer.js";
9
- import { useGeoStylerComposition as M, useGeoStylerLocale as N } from "../../context/GeoStylerContext/GeoStylerContext.js";
10
- import { getFormItemConfig as R } from "../../Util/FormItemUtil.js";
11
- const A = (t) => {
12
- const m = M("Rule"), s = { ...t, ...m }, {
13
- maxScale: c,
3
+ import { Form as m, Divider as R } from "antd";
4
+ import { FieldContainer as F } from "../FieldContainer/FieldContainer.js";
5
+ import { NameField as S } from "../NameField/NameField.js";
6
+ import { MinScaleDenominator as x } from "../ScaleDenominator/MinScaleDenominator.js";
7
+ import { MaxScaleDenominator as M } from "../ScaleDenominator/MaxScaleDenominator.js";
8
+ import { Renderer as N } from "../Renderer/Renderer/Renderer.js";
9
+ import { useGeoStylerComposition as D, useGeoStylerLocale as I } from "../../context/GeoStylerContext/GeoStylerContext.js";
10
+ import { getFormItemConfig as L } from "../../Util/FormItemUtil.js";
11
+ import { ElseRuleField as j } from "../Symbolizer/Field/ElseRuleField/ElseRuleField.js";
12
+ const K = (s) => {
13
+ const c = D("Rule"), u = { ...s, ...c }, {
14
+ maxScale: f,
14
15
  maxScaleField: o,
15
- minScale: f,
16
+ minScale: d,
16
17
  minScaleField: i,
17
18
  name: p,
18
- nameField: l,
19
- onMaxScaleChange: d = () => {
19
+ nameField: n,
20
+ onMaxScaleChange: h = () => {
20
21
  },
21
- onMinScaleChange: u = () => {
22
+ onMinScaleChange: C = () => {
22
23
  },
23
- onNameChange: h = () => {
24
+ onNameChange: g = () => {
24
25
  },
25
- symbolizers: C = []
26
- } = s, r = N("RuleFieldContainer"), n = R();
27
- return /* @__PURE__ */ a(y, { className: "gs-rule-field-container", children: [
28
- /* @__PURE__ */ a("div", { className: "gs-rule-field-container-header", children: [
29
- (l == null ? void 0 : l.visibility) === !1 ? null : /* @__PURE__ */ e(
30
- g.Item,
26
+ symbolizers: v = [],
27
+ elseRuleField: r,
28
+ elseRule: b,
29
+ onElseRuleChange: y = () => {
30
+ }
31
+ } = u, a = I("RuleFieldContainer"), l = L();
32
+ return /* @__PURE__ */ t(F, { className: "gs-rule-field-container", children: [
33
+ /* @__PURE__ */ t("div", { className: "gs-rule-field-container-header", children: [
34
+ (n == null ? void 0 : n.visibility) === !1 ? null : /* @__PURE__ */ e(
35
+ m.Item,
31
36
  {
32
- ...n,
33
- label: r.nameFieldLabel,
37
+ ...l,
38
+ label: a.nameFieldLabel,
34
39
  children: /* @__PURE__ */ e(
35
- b,
40
+ S,
36
41
  {
37
42
  value: p,
38
- onChange: h,
39
- placeholder: r.nameFieldPlaceholder
43
+ onChange: g,
44
+ placeholder: a.nameFieldPlaceholder
40
45
  }
41
46
  )
42
47
  }
43
48
  ),
44
49
  (i == null ? void 0 : i.visibility) === !1 ? null : /* @__PURE__ */ e(
45
- S,
50
+ x,
46
51
  {
47
- value: f,
48
- onChange: u,
49
- ...n
52
+ value: d,
53
+ onChange: C,
54
+ ...l
50
55
  }
51
56
  ),
52
57
  (o == null ? void 0 : o.visibility) === !1 ? null : /* @__PURE__ */ e(
53
- x,
58
+ M,
54
59
  {
55
- value: c,
56
- onChange: d,
57
- ...n
60
+ value: f,
61
+ onChange: h,
62
+ ...l
63
+ }
64
+ ),
65
+ (r == null ? void 0 : r.visibility) === !1 ? null : /* @__PURE__ */ e(
66
+ m.Item,
67
+ {
68
+ ...l,
69
+ label: a.elseRuleFieldLabel,
70
+ children: /* @__PURE__ */ e(
71
+ j,
72
+ {
73
+ value: b,
74
+ onChange: y
75
+ }
76
+ )
58
77
  }
59
78
  )
60
79
  ] }),
61
- /* @__PURE__ */ e(v, { type: "vertical" }),
62
- /* @__PURE__ */ e(F, { symbolizers: C })
80
+ /* @__PURE__ */ e(R, { type: "vertical" }),
81
+ /* @__PURE__ */ e(N, { symbolizers: v })
63
82
  ] });
64
83
  };
65
84
  export {
66
- A as RuleFieldContainer
85
+ K as RuleFieldContainer
67
86
  };
@@ -1,6 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { Rule } from 'geostyler-style';
3
3
  import { InterpolationMode } from 'chroma-js';
4
+ import { RuleComposableProps } from '../RuleCard/RuleCard';
4
5
  export type LevelOfMeasurement = 'nominal' | 'ordinal' | 'cardinal';
5
6
  export interface RuleGeneratorComposableProps {
6
7
  /** List of provided color ramps */
@@ -11,5 +12,5 @@ export interface RuleGeneratorComposableProps {
11
12
  export interface RuleGeneratorInternalProps {
12
13
  onRulesChange?: (rules: Rule[]) => void;
13
14
  }
14
- export type RuleGeneratorProps = RuleGeneratorInternalProps & RuleGeneratorComposableProps;
15
+ export type RuleGeneratorProps = RuleGeneratorInternalProps & RuleGeneratorComposableProps & Pick<RuleComposableProps, 'elseRuleField'>;
15
16
  export declare const RuleGenerator: React.FC<RuleGeneratorProps>;