UNPKG

geostyler

Version:
68 lines (67 loc) 2.87 kB
import { jsxs as i, jsx as r } from "react/jsx-runtime"; import { CqlParser as $ } from "geostyler-cql-parser"; /* empty css */ import { Renderer as w } from "../Renderer/Renderer/Renderer.js"; import R from "../../Util/FilterUtil.js"; import j from "../../Util/DataUtil.js"; import { Typography as k, Card as z, Divider as G } from "antd"; import { BlockOutlined as P, FilterFilled as T } from "@ant-design/icons"; import { useGeoStylerData as U, useGeoStylerComposition as x } from "../../context/GeoStylerContext/GeoStylerContext.js"; const { Text: t } = k, J = (g) => { var h, v; const u = U(), b = x("Rule"), N = { ...g, ...b }, { rule: e, duplicates: f, onClick: C, amountField: o, duplicateField: c, filterField: n, maxScaleField: a, minScaleField: d, nameField: m } = N; let p; j.isVector(u) && (p = R.getMatches(e.filter, u).length); const D = new $(); let y; e.filter && (y = D.write(e.filter)); const q = (l, s) => l === void 0 && s === void 0 ? "-" : l === void 0 ? `1:${s}` : s === void 0 ? `1:${l}` : `1:${l} < 1:${s}`; return /* @__PURE__ */ i( z, { className: "gs-rule-card", hoverable: !0, onClick: C, children: [ /* @__PURE__ */ r( w, { symbolizers: e.symbolizers } ), /* @__PURE__ */ r(G, { type: "vertical" }), /* @__PURE__ */ i("div", { className: "gs-rule-card-content", children: [ (m == null ? void 0 : m.visibility) === !1 ? null : /* @__PURE__ */ r("h2", { children: e.name }), (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) }), /* @__PURE__ */ i("span", { className: "gs-rule-card-content-icon-row", children: [ (o == null ? void 0 : o.visibility) === !1 ? null : /* @__PURE__ */ i(t, { type: "secondary", children: [ /* @__PURE__ */ r("span", { className: "gs-rule-card-icon", children: "Σ" }), p !== void 0 ? p : "-" ] }), (c == null ? void 0 : c.visibility) === !1 ? null : /* @__PURE__ */ i(t, { type: "secondary", children: [ /* @__PURE__ */ r(P, { className: "gs-rule-card-icon" }), f !== void 0 ? f : "-" ] }) ] }), (n == null ? void 0 : n.visibility) === !1 ? null : /* @__PURE__ */ i("span", { className: "gs-rule-card-cql", children: [ /* @__PURE__ */ r(t, { type: "secondary", children: /* @__PURE__ */ r(T, { className: "gs-rule-card-icon" }) }), /* @__PURE__ */ r(t, { type: "secondary", children: y }) ] }) ] }) ] } ); }; export { J as RuleCard };