geostyler
Version:
Framework for styling geodata
84 lines (83 loc) • 2.65 kB
JavaScript
import { jsxs as L, jsx as m } from "react/jsx-runtime";
import { SourceChannelNameField as S } from "../SourceChannelNameField/SourceChannelNameField.js";
import { Form as h } from "antd";
import { ContrastEnhancementField as w } from "../ContrastEnhancementField/ContrastEnhancementField.js";
import { GammaField as x } from "../GammaField/GammaField.js";
import C from "lodash-es/get.js";
import p from "lodash-es/cloneDeep.js";
import { useGeoStylerComposition as F, useGeoStylerLocale as j } from "../../../../context/GeoStylerContext/GeoStylerContext.js";
import { getFormItemConfig as _ } from "../../../../Util/FormItemUtil.js";
const J = (u) => {
const E = F("ChannelField"), g = { ...u, ...E }, {
channel: e,
contrastEnhancementTypes: d = ["histogram", "normalize"],
onChange: f,
sourceChannelNames: y,
contrastEnhancementField: c,
gammaValueField: a,
sourceChannelNameField: s
} = g, l = j("ChannelField"), r = (t, o) => {
let n;
e ? n = p(e) : n = {}, n[t] = o, f && f(n);
}, b = (t) => {
r("sourceChannelName", t);
}, v = (t) => {
const o = e == null ? void 0 : e.contrastEnhancement;
let n;
o ? n = p(o) : n = {}, n.enhancementType = t, r("contrastEnhancement", n);
}, N = (t) => {
const o = e == null ? void 0 : e.contrastEnhancement;
let n;
o ? n = p(o) : n = {}, n.gammaValue = t, r("contrastEnhancement", n);
}, T = C(e, "sourceChannelName"), G = C(e, "contrastEnhancement.enhancementType"), I = C(e, "contrastEnhancement.gammaValue"), i = _();
return /* @__PURE__ */ L("div", { children: [
(s == null ? void 0 : s.visibility) === !1 ? null : /* @__PURE__ */ m(
h.Item,
{
...i,
label: l.sourceChannelNameLabel,
children: /* @__PURE__ */ m(
S,
{
onChange: b,
value: T,
sourceChannelNames: y
}
)
}
),
(c == null ? void 0 : c.visibility) === !1 ? null : /* @__PURE__ */ m(
h.Item,
{
...i,
label: l.contrastEnhancementTypeLabel,
children: /* @__PURE__ */ m(
w,
{
value: G,
contrastEnhancementOptions: d,
onChange: v
}
)
}
),
(a == null ? void 0 : a.visibility) === !1 ? null : /* @__PURE__ */ m(
h.Item,
{
...i,
label: l.gammaValueLabel,
children: /* @__PURE__ */ m(
x,
{
value: I,
defaultValue: a == null ? void 0 : a.default,
onChange: N
}
)
}
)
] });
};
export {
J as ChannelField
};