UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 4.12 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{isGroupColumn as e}from"./columnUtils.js";import{loadCalciteComponents as t}from"../../support/componentsUtils.js";const n={action:"EsriFeatureTableActionColumn",attachments:"EsriFeatureTableAttachmentsColumn",relationship:"EsriFeatureTableRelationshipColumn"},i=()=>t({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")}),o=()=>Promise.all([t({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),option:()=>import("@esri/calcite-components/dist/components/calcite-option"),select:()=>import("@esri/calcite-components/dist/components/calcite-select"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker")}),i()]),r=()=>Promise.all([t({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar")}),o()]);function c(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"getField"in e&&"queryFeatureCount"in e&&"queryFeatures"in e&&"queryObjectIds"in e&&"capabilities"in e&&"fields"in e&&"fieldsIndex"in e&&"id"in e&&"load"in e&&"objectIdField"in e&&"type"in e&&"when"in e}function s(e){return c(e)&&"queryAttachments"in e}function a(e){return s(e)&&"addAttachment"in e&&"deleteAttachments"in e&&"updateAttachment"in e}function l(e){return c(e)&&"editingEnabled"in e&&"applyEdits"in e}function p(e){return c(e)&&"relationships"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e}function u(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function m(e,t,n){if(t?.map)return d(e,[...t.map.allLayers,...t.map.allTables],n)}function d(e,t,{relatedTableId:n}){const i="scene"===e.type&&e.associatedLayer?e.associatedLayer.url:e.url,o=t=>!(!p(t)||t===e)&&("sublayer"===t.type&&t.layer?.url===e.url?t.id===n:i===t.url&&t.layerId===n);if("sublayer"===e.type&&u(e.parent)){const t=t=>p(t)&&t!==e&&t.id===n,i=e.parent,o=i.sublayers?.find(t)||i.subtables?.find(t);if(p(o))return o}let r=null;for(const c of t)if(u(c)){const e=c.sublayers?.find(o)||c.subtables?.find(o);if(e){r=e;break}}else if(o(c)){r=c;break}if(p(r))return r}function f(e,t){return null!=e&&Number.isInteger(e)&&e>-1&&e<t}function y(e){return null==e||0===e.trim().length}function b(e,t){return(e.relationships??[]).filter((e=>!(e.id===t&&"one-to-one"===e.cardinality))).map((({id:e})=>({relationshipId:e})))}function h(e,t){return e.relationships?.find((({id:e})=>e===t))}function w(e,t){return null==t?null:e?.fields?.find((e=>t.toLowerCase()===e.name?.toLowerCase()))}function F(e,t){return t.some((t=>!("group"!==t.type||!F(e,t.columnTemplates))||t.fieldName===e))}function g(t,n){return n?.some((n=>!(!e(n)||!g(t,n.columns))||n.fieldName===t))??!1}function C(e,t){return`${e.id}-${t}`}function I(e){return e.isTable?"table":"feature"===e.type?"feature-layer":"layer"}export{w as findField,m as findRelatedLayer,d as findRelatedLayerInSources,h as findRelationship,I as getIconForLayer,b as getRelationshipIdsToShow,C as getTableHighlightKey,g as hasColumnForField,F as hasTemplateForField,y as isEmptyStringOrWhitespace,c as isIFeatureTableSupportedLayer,s as isIFeatureTableSupportedLayerWithAttachments,a as isIFeatureTableSupportedLayerWithAttachmentsEditing,l as isIFeatureTableSupportedLayerWithEditing,p as isIFeatureTableSupportedLayerWithRelationships,u as isMapImageLayer,f as isPageIndexValid,i as loadColumnComponents,o as loadEditorColumnComponents,r as loadFieldColumnComponents,n as uniqueColumnNames};