UNPKG

geostyler

Version:
47 lines (46 loc) 1.35 kB
import { jsxs as c, jsx as u } from "react/jsx-runtime"; import { Row as h, Col as i, Select as n } from "antd"; import { useMemo as x } from "react"; import f from "../../_virtual/cloneDeep.js"; /* empty css */ const w = ({ scaleDenominators: p, scaleDenominator: t, onChange: l }) => { const o = t != null && t.min ? parseFloat(t.min) : void 0, m = t != null && t.max ? parseFloat(t.max) : void 0, a = x(() => { const r = []; return Object.keys(p).forEach((e) => { r.push({ label: e, value: p[e] }); }), r; }, [p]), s = x(() => a.filter((r) => o ? r.value >= o : !0), [a, o]); return /* @__PURE__ */ c(h, { gutter: 4, className: "gs-select-scale", children: [ /* @__PURE__ */ u(i, { span: 12, children: /* @__PURE__ */ u( n, { value: o, options: a, allowClear: !0, onChange: (r) => { let e = f(t); e || (e = {}), e.min = r, e.max && e.max < r && (e.max = r), l && l(e); } } ) }), /* @__PURE__ */ u(i, { span: 12, children: /* @__PURE__ */ u( n, { value: m, options: s, allowClear: !0, onChange: (r) => { let e = f(t); e || (e = {}), e.max = r, l && l(e); } } ) }) ] }); }; export { w as SelectScaleDenominator };