geostyler
Version:
Framework for styling geodata
180 lines (179 loc) • 4.69 kB
JavaScript
import { jsxs as N, jsx as i } from "react/jsx-runtime";
import { Form as a } from "antd";
import r from "lodash-es/cloneDeep.js";
import U from "lodash-es/isEmpty.js";
import { OpacityField as k } from "../Field/OpacityField/OpacityField.js";
import { ImageField as q } from "../Field/ImageField/ImageField.js";
import { RotateField as A } from "../Field/RotateField/RotateField.js";
import { SizeField as B } from "../Field/SizeField/SizeField.js";
import { OffsetField as d } from "../Field/OffsetField/OffsetField.js";
import { useGeoStylerComposition as H, useGeoStylerLocale as J, useGeoStylerUnsupportedProperties as K } from "../../../context/GeoStylerContext/GeoStylerContext.js";
import { VisibilityField as M } from "../Field/VisibilityField/VisibilityField.js";
import { getFormItemConfig as Q } from "../../../Util/FormItemUtil.js";
const se = (z) => {
const I = H("IconEditor"), L = { ...z, ...I }, {
iconLibraries: S,
imageField: m,
offsetXField: c,
offsetYField: f,
onSymbolizerChange: o,
opacityField: b,
rotateField: p,
sizeField: g,
visibilityField: C,
symbolizer: n
} = L, l = J("IconEditor"), {
getFormItemSupportProps: u
} = K(n), O = (t) => {
const e = r(n);
e.image = t, o && o(e);
}, V = (t) => {
const e = r(n);
e.size = t, o && o(e);
}, E = (t) => {
const e = r(n), h = [
t,
e.offset ? e.offset[1] : 0
];
e.offset = h, o && o(e);
}, x = (t) => {
const e = r(n), h = [
e.offset ? e.offset[0] : 0,
t
];
e.offset = h, o && o(e);
}, G = (t) => {
const e = r(n);
e.rotate = t, o && o(e);
}, P = (t) => {
const e = r(n);
e.opacity = t, o && o(e);
}, T = (t) => {
const e = r(n);
e.visibility = t, o && o(e);
}, {
opacity: j,
image: v,
size: w,
rotate: R,
offset: y,
visibility: _
} = n, D = U(v) ? l.imagePlaceholder : v, s = Q();
return /* @__PURE__ */ N("div", { className: "gs-icon-symbolizer-editor", children: [
(C == null ? void 0 : C.visibility) === !1 ? null : /* @__PURE__ */ i(
a.Item,
{
...s,
label: l.visibilityLabel,
children: /* @__PURE__ */ i(
M,
{
value: _,
onChange: T
}
)
}
),
(m == null ? void 0 : m.visibility) === !1 ? null : /* @__PURE__ */ i(
a.Item,
{
...s,
label: l.imageLabel,
...u("image"),
children: /* @__PURE__ */ i(
q,
{
value: D,
onChange: O,
iconLibraries: S,
tooltipLabel: l.iconTooltipLabel,
spriteTooltipLabel: l.iconSpriteTooltipLabel,
disableSprite: m == null ? void 0 : m.disableSprite
}
)
}
),
(g == null ? void 0 : g.visibility) === !1 ? null : /* @__PURE__ */ i(
a.Item,
{
...s,
label: l.sizeLabel,
...u("size"),
children: /* @__PURE__ */ i(
B,
{
value: w,
onChange: V
}
)
}
),
(c == null ? void 0 : c.visibility) === !1 ? null : /* @__PURE__ */ i(
a.Item,
{
...s,
label: l.offsetXLabel,
...u("offset"),
children: /* @__PURE__ */ i(
d,
{
value: y == null ? void 0 : y[0],
defaultValue: c == null ? void 0 : c.default,
onChange: E
}
)
}
),
(f == null ? void 0 : f.visibility) === !1 ? null : /* @__PURE__ */ i(
a.Item,
{
...s,
label: l.offsetYLabel,
...u("offset"),
children: /* @__PURE__ */ i(
d,
{
value: y == null ? void 0 : y[1],
defaultValue: f == null ? void 0 : f.default,
onChange: x
}
)
}
),
(p == null ? void 0 : p.visibility) === !1 ? null : /* @__PURE__ */ i(
a.Item,
{
...s,
label: l.rotateLabel,
...u("rotate"),
children: /* @__PURE__ */ i(
A,
{
value: R,
defaultValue: p == null ? void 0 : p.default,
onChange: G
}
)
}
),
(b == null ? void 0 : b.visibility) === !1 ? null : /* @__PURE__ */ i(
a.Item,
{
...s,
label: l.opacityLabel,
...u("opacity"),
children: /* @__PURE__ */ i(
k,
{
value: j,
defaultValue: b == null ? void 0 : b.default,
onChange: P
}
)
}
)
] });
};
export {
se as IconEditor
};