UNPKG

@arcgis/map-components

Version:
66 lines (65 loc) 1.91 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */ import { queryAllJSON as c } from "@arcgis/core/applications/Components/featureUtils.js"; import { supportsFieldConfiguration as a } from "@arcgis/core/applications/PortalApp/layerUtils.js"; import p from "@arcgis/core/rest/support/FeatureSet.js"; function f(e) { return e != null && typeof e == "object" && "sourceLayer" in e; } function g(e, t) { if (!e.map) return; const { map: n } = e; n.layers.includes(t) || (n.add(t), n.reorder(t, n.layers.length - 1)); } async function S(e, t, n, r = !0) { const i = await c(e, t, n), o = p.fromJSON(i); return r && o.features.forEach((u) => { u.layer = y(e) ? e.findSublayerForFeature(u) : e, u.origin = u.layer, f(u) && (u.sourceLayer = u.layer); }), o; } function m(e) { return e != null && typeof e == "object" && "type" in e && e.type === "feature"; } function F(e) { return e != null && typeof e == "object" && "type" in e && e.type === "graphics"; } function y(e) { return e != null && typeof e == "object" && "type" in e && e.type === "subtype-group" && "sublayers" in e; } function L(e) { return e?.type === "subtype-sublayer"; } function h(e, t) { const n = t?.type === "subtype-sublayer" ? t.parent : t; return e.allLayerViews.find((r) => { const i = r.layer; return i === n || "sublayers" in i && i.sublayers != null && i.sublayers.includes(n); }); } function s(e) { const t = e?.type; return t === "binning" || t === "cluster"; } function R(e, t) { if (!a(e)) return; const n = t?.graphic, r = e.featureReduction; if (n) { if (n.isAggregate) { const i = n.origin; return i && "featureReductionProvider" in i && r ? s(r) ? r : null : void 0; } return e; } return t?.checkFeatureReduction && r ? s(r) ? r : null : e; } export { F as a, g as b, y as c, m as d, h as f, R as g, L as i, S as q };