UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 1.13 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{ensureOneOfType as t}from"../../core/accessorSupport/ensureType.js";import e from"../elements/AttributeTableAttachmentElement.js";import p from"../elements/AttributeTableElement.js";import r from"../elements/AttributeTableFieldElement.js";import o from"../elements/AttributeTableRelationshipElement.js";function i(t){return{typesWithGroup:{base:p,key:"type",typeMap:{attachment:e,field:r,group:t,relationship:o}},typesWithoutGroup:{base:p,key:"type",typeMap:{attachment:e,field:r,relationship:o}}}}function n(t,e,p=!0){if(!t)return null;const r=p?e.typesWithGroup.typeMap:e.typesWithoutGroup.typeMap;return t.filter((t=>r[t.type])).map((t=>r[t.type].fromJSON(t)))}function u(t,e,p=!0){if(!t)return null;const r=p?e.typesWithGroup.typeMap:e.typesWithoutGroup.typeMap;return t.filter((t=>r[t.type])).map((t=>t.toJSON()))}function s(e,p,r=!0){return e?e.map((e=>t(r?p.typesWithGroup:p.typesWithoutGroup,e))):null}export{i as buildTypeMaps,s as ensureType,n as fromJSON,u as toJSON};