geostyler
Version:
Framework for styling geodata
157 lines (156 loc) • 4.18 kB
JavaScript
import { jsxs as a, jsx as o } from "react/jsx-runtime";
import { useState as I } from "react";
import { Modal as c } from "antd";
import { ColorField as K } from "../Field/ColorField/ColorField.js";
import { RadiusField as M } from "../Field/RadiusField/RadiusField.js";
import { OpacityField as R } from "../Field/OpacityField/OpacityField.js";
import { WellKnownNameField as S } from "../Field/WellKnownNameField/WellKnownNameField.js";
import { KindField as x } from "../Field/KindField/KindField.js";
import { ImageField as j } from "../Field/ImageField/ImageField.js";
import { IconSelector as B } from "../IconSelector/IconSelector.js";
/* empty css */
import { useGeoStylerLocale as E } from "../../../context/GeoStylerContext/GeoStylerContext.js";
const V = ({
style: d = {
name: "My Style",
rules: []
},
colorModalVisible: b = !1,
sizeModalVisible: h = !1,
opacityModalVisible: k = !1,
symbolModalVisible: C = !1,
selectedRowKeys: v = [],
modalsClosed: s = () => {
},
updateMultiColors: w,
updateMultiSizes: N,
updateMultiOpacities: z,
updateMultiSymbols: m,
iconLibraries: f
}) => {
const l = E("BulkEditModals"), [r, L] = I("Mark");
let p = [], u = "#000000", y = 5, g = 1, n = "circle";
if (d) {
p = d.rules;
const t = p.filter((e, F) => v.includes(F)).find((e) => e.symbolizers && e.symbolizers.length > 0);
if (t && t.symbolizers && t.symbolizers[0]) {
const e = t.symbolizers[0];
e.color && (u = e.color), e.radius && (y = e.radius), e.opacity && (g = e.opacity), e.kind && e.kind === "Mark" && e.wellKnownName && (n = e.wellKnownName), e.kind && e.kind === "Icon" && e.image && (n = e.image);
}
}
return /* @__PURE__ */ a("div", { className: "gs-style", children: [
/* @__PURE__ */ a(
c,
{
title: l.colorLabel,
open: b,
wrapClassName: "gs-modal-color",
footer: null,
onCancel: s,
children: [
l.colorLabel,
/* @__PURE__ */ o(
K,
{
value: u,
onChange: w
}
)
]
}
),
/* @__PURE__ */ a(
c,
{
title: l.radiusLabel,
open: h,
wrapClassName: "gs-modal-size",
footer: null,
onCancel: s,
children: [
l.radiusLabel,
/* @__PURE__ */ o(
M,
{
value: y,
onChange: N
}
)
]
}
),
/* @__PURE__ */ a(
c,
{
title: l.opacityLabel,
open: k,
wrapClassName: "gs-modal-opacity",
footer: null,
onCancel: s,
children: [
l.opacityLabel,
/* @__PURE__ */ o(
R,
{
value: g,
onChange: z
}
)
]
}
),
/* @__PURE__ */ a(
c,
{
title: l.symbolLabel,
open: C,
wrapClassName: "gs-modal-opacity",
footer: null,
onCancel: s,
children: [
/* @__PURE__ */ o(
x,
{
symbolizerKinds: ["Mark", "Icon"],
value: r,
onChange: L
}
),
r === "Mark" ? /* @__PURE__ */ o(
S,
{
value: n,
onChange: (i) => {
m(i, r);
}
}
) : /* @__PURE__ */ a("div", { children: [
l.imageFieldLabel,
/* @__PURE__ */ o(
j,
{
value: n,
onChange: (i) => {
m(i, r);
}
}
),
f ? /* @__PURE__ */ o("div", { className: "gs-bulk-edit-modals-icon-selector", children: /* @__PURE__ */ o(
B,
{
iconLibraries: f,
onIconSelect: (i) => {
m(i, r);
},
selectedIconSrc: n
}
) }) : null
] })
]
}
)
] });
};
export {
V as BulkEditModals
};