UNPKG

geostyler

Version:
61 lines (60 loc) 1.76 kB
import { jsx as n, jsxs as d } from "react/jsx-runtime"; import { Alert as l } from "antd"; import { useGeoStylerLocale as y } from "../../context/GeoStylerContext/GeoStylerContext.js"; const x = ({ feedback: p }) => { const s = y("ParserFeedback"); if (!p || Object.keys(p).length < 1) return null; const { errors: i, warnings: a, unsupportedProperties: f } = p, m = a == null ? void 0 : a.map((e, r) => /* @__PURE__ */ n( l, { showIcon: !0, type: "warning", message: e }, `warning-${r}` )), g = i == null ? void 0 : i.map((e, r) => /* @__PURE__ */ n( l, { showIcon: !0, type: "error", message: e.message }, `error-${r}` )), o = [], $ = (e) => { let r; return typeof e == "string" || e instanceof String ? e === "none" ? r = s.notSupported : e === "partial" && (r = s.partiallySupported) : e.support && (e.support === "none" ? r = `${s.notSupported}: ${e.info}` : e.support === "partial" && (r = `${s.partiallySupported}: ${e.info}`)), r; }, u = (e, r = "") => { Object.keys(e).forEach((c) => { const t = e[c]; typeof t == "string" || t instanceof String || t.support ? o.push(`${r}${c} ${$(t)}`) : u(t, `${c}.`); }); }; f && u(f); const h = o == null ? void 0 : o.map((e, r) => /* @__PURE__ */ n( l, { showIcon: !0, type: "warning", message: e }, `unsupportedProperty-${r}` )); return /* @__PURE__ */ d("div", { className: "gs-parser-feedback", children: [ /* @__PURE__ */ n("div", { className: "error-alerts", children: g }), /* @__PURE__ */ d("div", { className: "warning-alerts", children: [ m, h ] }) ] }); }; export { x as ParserFeedback, x as default };