UNPKG

geostyler

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