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