UNPKG

geostyler

Version:
317 lines (316 loc) 8.09 kB
import { jsxs as ae, jsx as t } from "react/jsx-runtime"; import { Form as r, Mentions as ie } from "antd"; import i from "lodash-es/cloneDeep.js"; import { ColorField as P } from "../Field/ColorField/ColorField.js"; import { OpacityField as se } from "../Field/OpacityField/OpacityField.js"; import { WidthField as G } from "../Field/WidthField/WidthField.js"; import { FontPicker as re } from "../Field/FontPicker/FontPicker.js"; import { OffsetField as R } from "../Field/OffsetField/OffsetField.js"; import { RotateField as fe } from "../Field/RotateField/RotateField.js"; import { useGeoStylerData as me, useGeoStylerComposition as ce, useGeoStylerLocale as ue, useGeoStylerUnsupportedProperties as be } from "../../../context/GeoStylerContext/GeoStylerContext.js"; /* empty css */ import { VisibilityField as he } from "../Field/VisibilityField/VisibilityField.js"; import { getFormItemConfig as Ce } from "../../../Util/FormItemUtil.js"; import { RepeatField as ye } from "../Field/RepeatField/RepeatField.js"; import { PlacementField as pe } from "../Field/PlacementField/PlacementField.js"; const Ee = (j) => { const z = me(), k = ce("TextEditor"), E = { ...j, ...k }, { colorField: c, fontField: m, haloColorField: u, haloWidthField: b, offsetXField: h, offsetYField: C, onSymbolizerChange: o, opacityField: y, rotateField: p, sizeField: g, symbolizer: n, templateField: v, visibilityField: L, placementField: I, repeatField: d } = E, a = ue("TextEditor"), { getFormItemSupportProps: f } = be(n), N = (l) => { const e = i(n); e.label = l, o && o(e); }, T = (l) => { const e = i(n); e.color = l, o && o(e); }, W = (l) => { const e = i(n); e.font = l.length > 0 ? l : void 0, o && o(e); }, w = (l) => { const e = i(n); e.opacity = l, o && o(e); }, D = (l) => { const e = i(n); e.size = l, o && o(e); }, H = (l) => { const e = i(n), x = [ l, e.offset ? e.offset[1] : 0 ]; e.offset = x, o && o(e); }, M = (l) => { const e = i(n), x = [ e.offset ? e.offset[0] : 0, l ]; e.offset = x, o && o(e); }, U = (l) => { const e = i(n); e.rotate = l, o && o(e); }, _ = (l) => { const e = i(n); e.haloColor = l, o && o(e); }, $ = (l) => { const e = i(n); e.haloWidth = l, o && o(e); }, q = (l) => { const e = i(n); e.visibility = l, o && o(e); }, A = (l) => { const e = i(n); e.placement = l, o && o(e); }, B = (l) => { const e = i(n); e.repeat = l, o && o(e); }, J = i(n), { opacity: K, color: Q, font: X, offset: V, size: Y, rotate: Z, haloColor: F, haloWidth: ee, visibility: le, placement: oe, repeat: te } = J; let O, S; V && (O = V[0], S = V[1]); const ne = z && z.schema ? Object.keys(z.schema.properties) : [], s = Ce(); return /* @__PURE__ */ ae("div", { className: "gs-text-symbolizer-editor", children: [ (L == null ? void 0 : L.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.visibilityLabel, children: /* @__PURE__ */ t( he, { value: le, onChange: q } ) } ), (v == null ? void 0 : v.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.templateFieldLabel, ...f("label"), children: /* @__PURE__ */ t( ie, { className: "editor-field", value: n.label || "", defaultValue: v == null ? void 0 : v.default, onChange: N, placeholder: a.templateFieldLabel, prefix: "{{", notFoundContent: a.attributeNotFound, options: ne.map((l) => ({ key: l, value: `${l}}}`, label: l })) } ) } ), (c == null ? void 0 : c.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.colorLabel, ...f("color"), children: /* @__PURE__ */ t( P, { value: Q, defaultValue: c == null ? void 0 : c.default, onChange: T } ) } ), (m == null ? void 0 : m.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.fontLabel, ...f("font"), children: /* @__PURE__ */ t( re, { value: X, defaultValue: m == null ? void 0 : m.default, onChange: W, fonts: m == null ? void 0 : m.fonts } ) } ), (y == null ? void 0 : y.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.opacityLabel, ...f("opacity"), children: /* @__PURE__ */ t( se, { value: K, defaultValue: y == null ? void 0 : y.default, onChange: w } ) } ), (g == null ? void 0 : g.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.sizeLabel, ...f("size"), children: /* @__PURE__ */ t( G, { value: Y, defaultValue: g == null ? void 0 : g.default, onChange: D } ) } ), (h == null ? void 0 : h.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.offsetXLabel, ...f("offset"), children: /* @__PURE__ */ t( R, { value: O, defaultValue: h == null ? void 0 : h.default, onChange: H } ) } ), (C == null ? void 0 : C.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.offsetYLabel, ...f("offset"), children: /* @__PURE__ */ t( R, { value: S, defaultValue: C == null ? void 0 : C.default, onChange: M } ) } ), (p == null ? void 0 : p.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.rotateLabel, ...f("rotate"), children: /* @__PURE__ */ t( fe, { value: Z, defaultValue: p == null ? void 0 : p.default, onChange: U } ) } ), (u == null ? void 0 : u.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.haloColorLabel, ...f("haloColor"), children: /* @__PURE__ */ t( P, { value: F, defaultValue: u == null ? void 0 : u.default, onChange: _ } ) } ), (b == null ? void 0 : b.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.haloWidthLabel, ...f("haloWidth"), children: /* @__PURE__ */ t( G, { value: ee, defaultValue: b == null ? void 0 : b.default, onChange: $ } ) } ), (I == null ? void 0 : I.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.placementLabel, ...f("placement"), children: /* @__PURE__ */ t( pe, { value: oe, onChange: (l) => A(l) } ) } ), (d == null ? void 0 : d.visibility) === !1 ? null : /* @__PURE__ */ t( r.Item, { ...s, label: a.repeatLabel, ...f("repeat"), children: /* @__PURE__ */ t( ye, { value: te, defaultValue: d == null ? void 0 : d.default, onChange: B } ) } ) ] }); }; export { Ee as TextEditor };