geostyler
Version:
Framework for styling geodata
220 lines (219 loc) • 5.92 kB
JavaScript
import { jsxs as w, Fragment as B, jsx as e } from "react/jsx-runtime";
import { Form as s, Collapse as H } from "antd";
import a from "lodash-es/cloneDeep.js";
import J from "lodash-es/get.js";
import { ColorField as v } from "../Field/ColorField/ColorField.js";
import { OpacityField as g } from "../Field/OpacityField/OpacityField.js";
import { GraphicEditor as M } from "../GraphicEditor/GraphicEditor.js";
import { WidthField as Q } from "../Field/WidthField/WidthField.js";
import { LineDashField as R } from "../Field/LineDashField/LineDashField.js";
import { useGeoStylerComposition as X, useGeoStylerLocale as Y, useGeoStylerUnsupportedProperties as Z } from "../../../context/GeoStylerContext/GeoStylerContext.js";
import { VisibilityField as $ } from "../Field/VisibilityField/VisibilityField.js";
import { getFormItemConfig as F } from "../../../Util/FormItemUtil.js";
const bl = (L) => {
const z = X("FillEditor"), I = { ...L, ...z }, {
fillColorField: m,
fillOpacityField: u,
onSymbolizerChange: o,
opacityField: b,
outlineColorField: h,
outlineDasharrayField: p,
outlineOpacityField: f,
outlineWidthField: y,
visibilityField: C,
symbolizer: t
} = I, n = Y("FillEditor"), {
getFormItemSupportProps: c
} = Z(t), O = (i) => {
const l = a(t);
l.color = i, o && o(l);
}, V = (i) => {
const l = a(t);
l.fillOpacity = i, o && o(l);
}, S = (i) => {
const l = a(t);
l.opacity = i, o && o(l);
}, D = (i) => {
const l = a(t);
l.outlineOpacity = i, o && o(l);
}, G = (i) => {
const l = a(t);
l.outlineColor = i, o && o(l);
}, E = (i) => {
const l = a(t);
l.outlineWidth = i, o && o(l);
}, k = (i) => {
const l = a(t);
l.outlineDasharray = i, o && o(l);
}, x = (i) => {
const l = a(t);
l.graphicFill = i, o && o(l);
}, T = (i) => {
const l = a(t);
l.visibility = i, o && o(l);
}, {
color: W,
fillOpacity: j,
outlineColor: P,
graphicFill: d,
outlineWidth: _,
outlineDasharray: A,
opacity: K,
outlineOpacity: N,
visibility: U
} = t, r = F(), q = [{
key: "1",
label: n.generalSectionLabel,
children: /* @__PURE__ */ w(B, { children: [
(C == null ? void 0 : C.visibility) === !1 ? null : /* @__PURE__ */ e(
s.Item,
{
...r,
label: n.visibilityLabel,
children: /* @__PURE__ */ e(
$,
{
value: U,
onChange: T
}
)
}
),
(m == null ? void 0 : m.visibility) === !1 ? null : /* @__PURE__ */ e(
s.Item,
{
...r,
label: n.fillColorLabel,
...c("color"),
children: /* @__PURE__ */ e(
v,
{
value: W,
defaultValue: m == null ? void 0 : m.default,
onChange: O
}
)
}
),
(u == null ? void 0 : u.visibility) === !1 ? null : /* @__PURE__ */ e(
s.Item,
{
...r,
label: n.fillOpacityLabel,
...c("fillOpacity"),
children: /* @__PURE__ */ e(
g,
{
value: j,
defaultValue: u == null ? void 0 : u.default,
onChange: V
}
)
}
),
(b == null ? void 0 : b.visibility) === !1 ? null : /* @__PURE__ */ e(
s.Item,
{
...r,
label: n.opacityLabel,
...c("opacity"),
children: /* @__PURE__ */ e(
g,
{
value: K,
defaultValue: b == null ? void 0 : b.default,
onChange: S
}
)
}
),
(f == null ? void 0 : f.visibility) === !1 ? null : /* @__PURE__ */ e(
s.Item,
{
...r,
label: n.outlineOpacityLabel,
...c("outlineOpacity"),
children: /* @__PURE__ */ e(
g,
{
value: N,
defaultValue: f == null ? void 0 : f.default,
onChange: D
}
)
}
),
(h == null ? void 0 : h.visibility) === !1 ? null : /* @__PURE__ */ e(
s.Item,
{
...r,
label: n.outlineColorLabel,
...c("outlineColor"),
children: /* @__PURE__ */ e(
v,
{
value: P,
defaultValue: h == null ? void 0 : h.default,
onChange: G
}
)
}
),
(y == null ? void 0 : y.visibility) === !1 ? null : /* @__PURE__ */ e(
s.Item,
{
...r,
label: n.outlineWidthLabel,
...c("outlineWidth"),
children: /* @__PURE__ */ e(
Q,
{
value: _,
defaultValue: y == null ? void 0 : y.default,
onChange: E
}
)
}
),
(p == null ? void 0 : p.visibility) === !1 ? null : /* @__PURE__ */ e(
s.Item,
{
...r,
label: n.outlineDasharrayLabel,
...c("outlineDasharray"),
children: /* @__PURE__ */ e(
R,
{
value: A,
onChange: k
}
)
}
)
] })
}, {
key: "2",
label: n.graphicFillSectionLabel,
// TODO: allow changing graphicFill via composition context
children: /* @__PURE__ */ e(
M,
{
graphicTypeFieldLabel: n.graphicFillTypeLabel,
value: d,
graphicType: J(d, "kind"),
onGraphicChange: x
}
)
}];
return /* @__PURE__ */ e("div", { className: "gs-fill-symbolizer-editor", children: /* @__PURE__ */ e(
H,
{
items: q,
defaultActiveKey: ["1"],
bordered: !1
}
) });
};
export {
bl as FillEditor
};