UNPKG

geostyler

Version:
216 lines (215 loc) 4.56 kB
import { jsxs as T, jsx as l } from "react/jsx-runtime"; import { Form as s } from "antd"; import f from "lodash-es/cloneDeep.js"; import { AttributeCombo as $ } from "../../Filter/AttributeCombo/AttributeCombo.js"; import { ColorField as h } from "../Field/ColorField/ColorField.js"; import { FontPicker as k } from "../Field/FontPicker/FontPicker.js"; import { OffsetField as m } from "../Field/OffsetField/OffsetField.js"; import { OpacityField as D } from "../Field/OpacityField/OpacityField.js"; import { RotateField as G } from "../Field/RotateField/RotateField.js"; import { WidthField as C } from "../Field/WidthField/WidthField.js"; import { useGeoStylerLocale as N } from "../../../context/GeoStylerContext/GeoStylerContext.js"; /* empty css */ import { getFormItemConfig as _ } from "../../../Util/FormItemUtil.js"; const to = ({ symbolizer: n, onSymbolizerChange: e }) => { const a = N("PropTextEditor"), u = (t) => { const o = /\{\{(.*)\}\}/g; return t.replace(o, "$1"); }, L = (t) => { const o = f(n); o.label = `{{${t}}}`, e && e(o); }, v = (t) => { const o = f(n); o.color = t, e && e(o); }, I = (t) => { const o = f(n); o.font = t.length > 0 ? t : void 0, e && e(o); }, F = (t) => { const o = f(n); o.opacity = t, e && e(o); }, b = (t) => { const o = f(n); o.size = t, e && e(o); }, g = (t) => { const o = f(n), i = [ t, o.offset ? o.offset[1] : 0 ]; o.offset = i, e && e(o); }, x = (t) => { const o = f(n), i = [ o.offset ? o.offset[0] : 0, t ]; o.offset = i, e && e(o); }, O = (t) => { const o = f(n); o.rotate = t, e && e(o); }, W = (t) => { const o = f(n); o.haloColor = t, e && e(o); }, w = (t) => { const o = f(n); o.haloWidth = t, e && e(o); }, E = f(n), { opacity: P, color: X, font: Y, offset: r, size: j, rotate: A, haloColor: H, haloWidth: R } = E; let d, p; r && (d = r[0], p = r[1]); const c = _(); return /* @__PURE__ */ T("div", { className: "gs-text-symbolizer-prop-editor", children: [ /* @__PURE__ */ l( s.Item, { ...c, label: a.propFieldLabel, children: /* @__PURE__ */ l( $, { value: n.label ? u(n.label) : void 0, onAttributeChange: L } ) } ), /* @__PURE__ */ l( s.Item, { ...c, label: a.colorLabel, children: /* @__PURE__ */ l( h, { value: X, onChange: v } ) } ), /* @__PURE__ */ l( s.Item, { ...c, label: a.fontLabel, children: /* @__PURE__ */ l( k, { value: Y, onChange: I } ) } ), /* @__PURE__ */ l( s.Item, { ...c, label: a.opacityLabel, children: /* @__PURE__ */ l( D, { value: P, onChange: F } ) } ), /* @__PURE__ */ l( s.Item, { ...c, label: a.sizeLabel, children: /* @__PURE__ */ l( C, { width: j, onChange: b } ) } ), /* @__PURE__ */ l( s.Item, { ...c, label: a.offsetXLabel, children: /* @__PURE__ */ l( m, { value: d, onChange: g } ) } ), /* @__PURE__ */ l( s.Item, { ...c, label: a.offsetYLabel, children: /* @__PURE__ */ l( m, { value: p, onChange: x } ) } ), /* @__PURE__ */ l( s.Item, { ...c, label: a.rotateLabel, children: /* @__PURE__ */ l( G, { value: A, onChange: O } ) } ), /* @__PURE__ */ l( s.Item, { ...c, label: a.haloColorLabel, children: /* @__PURE__ */ l( h, { value: H, onChange: W } ) } ), /* @__PURE__ */ l( s.Item, { ...c, label: a.haloWidthLabel, children: /* @__PURE__ */ l( C, { value: R, onChange: w } ) } ) ] }); }; export { to as PropTextEditor };