geostyler
Version:
Framework for styling geodata
97 lines (96 loc) • 2.43 kB
JavaScript
import { jsx as t, jsxs as p, Fragment as S } from "react/jsx-runtime";
import { useState as j } from "react";
import { Slider as k, InputNumber as b, Button as N } from "antd";
import { FunctionUI as w } from "../../FunctionUI/FunctionUI.js";
import { isGeoStylerFunction as x } from "geostyler-style";
import { FunctionOutlined as e } from "@ant-design/icons";
/* empty css */
const q = ({
slider: y = !1,
sliderProps: l = {},
/* more safety */
onChange: r,
onCancel: u,
value: m,
className: d,
inputProps: F = {},
/* more safety */
functionUiProps: I
}) => {
let s = "number-expression-input";
d && (s += ` ${d}`);
const [f, c] = j(() => x(m) ? void 0 : m);
return x(m) ? /* @__PURE__ */ t("span", { className: s, children: /* @__PURE__ */ t(
w,
{
type: "number",
value: m,
...I,
onChange: r,
onCancel: () => u == null ? void 0 : u("number")
}
) }) : /* @__PURE__ */ t("span", { className: s, children: y ? /* @__PURE__ */ p("div", { className: "slider-wrapper", children: [
/* @__PURE__ */ t(
k,
{
...l,
value: f,
range: !1,
onChange: (i) => {
i === null && (r == null || r(void 0)), r == null || r(i), c(i === null ? void 0 : i);
}
}
),
/* @__PURE__ */ p("div", { className: "number-wrapper", children: [
/* @__PURE__ */ t(
b,
{
...l,
value: f,
onChange: (i) => {
i === null && (r == null || r(void 0)), r == null || r(Number(i)), c(i === null ? void 0 : Number(i));
}
}
),
/* @__PURE__ */ t(
N,
{
icon: /* @__PURE__ */ t(e, {}),
onClick: () => {
r == null || r({
name: "property",
args: [""]
});
}
}
)
] })
] }) : /* @__PURE__ */ p(S, { children: [
/* @__PURE__ */ t(
b,
{
value: m,
onChange: (i) => {
i === null && (r == null || r(void 0)), r == null || r(i);
},
...F
}
),
/* @__PURE__ */ t(
N,
{
icon: /* @__PURE__ */ t(e, {}),
onClick: () => {
r == null || r({
name: "property",
args: [""]
});
}
}
)
] }) });
};
export {
q as NumberExpressionInput,
q as default
};