UNPKG

geostyler

Version:
88 lines (87 loc) 2.02 kB
import { jsxs as f, jsx as l } from "react/jsx-runtime"; import { ColorField as h } from "../ColorField/ColorField.js"; import { OffsetField as C } from "../OffsetField/OffsetField.js"; import { Form as r, Input as g } from "antd"; import { OpacityField as u } from "../OpacityField/OpacityField.js"; import n from "lodash-es/get.js"; import { useGeoStylerLocale as L } from "../../../../context/GeoStylerContext/GeoStylerContext.js"; const j = ({ labelPlaceholder: p = "Color Map Label", onChange: i, value: e }) => { const t = L("ColorMapEntryField"), a = (o, y) => { const c = { ...e }; c[o] = y, i && i(c); }, m = (o) => { a("color", o); }, d = (o) => { a("quantity", o); }, b = (o) => { a("label", o); }, s = (o) => { a("opacity", o); }; return /* @__PURE__ */ f("div", { children: [ /* @__PURE__ */ l( r.Item, { label: t.colorLabel, children: /* @__PURE__ */ l( h, { value: n(e, "color"), onChange: m } ) } ), /* @__PURE__ */ l( r.Item, { label: t.quantityLabel, children: /* @__PURE__ */ l( C, { value: n(e, "quantity"), onChange: d } ) } ), /* @__PURE__ */ l( r.Item, { label: t.labelLabel, children: /* @__PURE__ */ l( g, { className: "editor-field colormapentry-label-field", defaultValue: n(e, "label"), value: n(e, "label"), placeholder: p, onChange: (o) => { b(o.target.value); } } ) } ), /* @__PURE__ */ l( r.Item, { label: t.opacityLabel, children: /* @__PURE__ */ l( u, { value: e == null ? void 0 : e.opacity, onChange: s } ) } ) ] }); }; export { j as ColorMapEntryField };