UNPKG

geostyler

Version:
61 lines (60 loc) 1.7 kB
import { jsx as o } from "react/jsx-runtime"; import { Form as d, AutoComplete as b, InputNumber as F } from "antd"; import { useGeoStylerData as g, useGeoStylerLocale as x } from "../../../context/GeoStylerContext/GeoStylerContext.js"; import N from "lodash-es/get.js"; /* empty css */ const G = ({ value: s, validateStatus: c = "success", onValueChange: a, size: m, selectedAttribute: n }) => { var u; const l = g(), r = x("NumberFilterField"), i = c !== "success" ? r.help : null, f = (e) => { a && a(Number(e)); }, t = []; return l && "exampleFeatures" in l && ((u = l == null ? void 0 : l.exampleFeatures) == null ? void 0 : u.features).forEach((h) => { const p = N(h, `properties[${n}]`); p && t.indexOf(p) === -1 && t.push(`${p}`); }), /* @__PURE__ */ o( "div", { className: "gs-number-filter-field", draggable: !0, onDragStart: (e) => e.preventDefault(), children: /* @__PURE__ */ o( d.Item, { label: r.label, colon: !1, validateStatus: c, help: i, hasFeedback: !0, children: t.length > 0 ? /* @__PURE__ */ o( b, { size: m, value: `${s || ""}`, onChange: f, placeholder: r.placeholder, options: t.map((e) => ({ value: e })) } ) : /* @__PURE__ */ o( F, { size: m, defaultValue: s, value: s, onChange: a, placeholder: r.placeholder } ) } ) } ); }; export { G as NumberFilterField };