@arcgis/core 5.0.0-next.27 → 5.0.0-next.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/Map.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{aca72ca7f43f70eb8077.js → 0bfb7db0a151a5e85dd1.js} +1 -1
  5. package/assets/esri/core/workers/chunks/2d0d8243ed0c21f8a498.js +1 -0
  6. package/assets/esri/core/workers/chunks/{e873359e00e0866d4ef6.js → 66853ecdebfc2aa68ce7.js} +21 -22
  7. package/assets/esri/core/workers/chunks/6c8f5a56e94fdbe6a4a5.js +1 -0
  8. package/assets/esri/core/workers/chunks/6ce7ca6bebdc61d8eada.js +1 -0
  9. package/assets/esri/core/workers/chunks/{8b33732e3c2924c1f60d.js → e615983fab688d515205.js} +1 -1
  10. package/assets/esri/core/workers/chunks/e6fa6f9c278589c8a713.js +1 -0
  11. package/chunks/CheckerBoard.glsl.js +2 -2
  12. package/chunks/ColorMaterial.glsl.js +2 -2
  13. package/chunks/ComponentShader.glsl.js +2 -2
  14. package/chunks/DefaultMaterial.glsl.js +2 -2
  15. package/chunks/ImageMaterial.glsl.js +2 -2
  16. package/chunks/LineMarker.glsl.js +2 -2
  17. package/chunks/NativeLine.glsl.js +2 -2
  18. package/chunks/Path.glsl.js +3 -3
  19. package/chunks/Pattern.glsl.js +2 -2
  20. package/chunks/RealisticTree.glsl.js +2 -2
  21. package/chunks/RibbonLine.glsl.js +2 -2
  22. package/chunks/ShadedColorMaterial.glsl.js +2 -2
  23. package/chunks/Terrain.glsl.js +27 -37
  24. package/chunks/WaterSurface.glsl.js +2 -2
  25. package/config.js +1 -1
  26. package/core/accessorSupport/decorators/property.js +1 -1
  27. package/core/has.js +1 -1
  28. package/geometry/Circle.js +1 -1
  29. package/geometry/support/MeshMaterial.js +1 -1
  30. package/geometry/support/MeshMaterialMetallicRoughness.js +1 -1
  31. package/interfaces.d.ts +29 -23
  32. package/kernel.js +1 -1
  33. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  34. package/package.json +2 -2
  35. package/renderers/support/UniqueValueClass.js +1 -1
  36. package/renderers/visualVariables/SizeVariable.js +1 -1
  37. package/support/revision.js +1 -1
  38. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  39. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  40. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  41. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  42. package/views/3d/state/ViewState.js +1 -1
  43. package/views/3d/state/ViewStateManager.js +1 -1
  44. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  45. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  46. package/views/3d/support/QualityProfile.js +1 -1
  47. package/views/3d/terrain/TerrainRenderer.js +1 -1
  48. package/views/3d/terrain/TerrainSurface.js +1 -1
  49. package/views/3d/webgl-engine/Stage.js +1 -1
  50. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  51. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  52. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  53. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  54. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  55. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  56. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  57. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  58. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  59. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  60. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  61. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  62. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  63. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  64. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  65. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  66. package/views/3d/webgl-engine/shaders/{OutputColorHighlightOID.glsl.js → OutputColorHighlightOLID.glsl.js} +2 -3
  67. package/views/3d/webgl-engine/shaders/Path.glsl.js +1 -1
  68. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  69. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  70. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  71. package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
  72. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  73. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  74. package/views/SceneView.js +1 -1
  75. package/views/View.js +1 -1
  76. package/views/View2D.js +1 -1
  77. package/views/Viewport2DMixin.js +1 -1
  78. package/views/navigation/Momentum.js +1 -1
  79. package/views/video/VideoOperationalDataView.js +1 -1
  80. package/webscene/Slide.js +1 -1
  81. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  82. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  83. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  84. package/widgets/FeatureTable.js +1 -1
  85. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  86. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  87. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  88. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  89. package/widgets/UtilityNetworkTrace.js +1 -1
  90. package/widgets/Widget.js +1 -1
  91. package/assets/esri/core/workers/chunks/3f2b1d2102eef7ac29b4.js +0 -1
  92. package/assets/esri/core/workers/chunks/7532e819d2f4ee4813be.js +0 -1
  93. package/assets/esri/core/workers/chunks/76f2ce14d0d3001620a9.js +0 -1
  94. package/assets/esri/core/workers/chunks/ab5c386100b84bc564dd.js +0 -1
  95. package/views/3d/webgl-engine/lib/ComponentUtils.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{isSome as e,unique as r}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import{abortHandle as i}from"../../core/handleUtils.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{EsriPromise as n}from"../../core/Promise.js";import{throwIfAborted as l,isAbortError as a}from"../../core/promiseUtils.js";import u from"../../core/ReactiveMap.js";import{property as f,subclass as p}from"../../core/accessorSupport/decorators.js";import{isSubtypeSublayer as d}from"../../layers/support/layerUtils.js";import c from"./Edits.js";import{fetchFullFeaturesByObjectId as h}from"./workflowUtils.js";let m=class extends n{constructor(t){super(t),this.editorItems=[],this.featureInfos=null,this.parent=null,this.selectedFeature=null,this.sketchOptions=null,this.snappingManager=null,this.viewModel=null,this._editorItemsByLayer=new u,this._fullFeatures=new u,this._pendingEdits=new u}initialize(){const t=new AbortController;this.addResolvingPromise(this._initializeFullFeatures(t.signal).then(e=>{l(t.signal),this._initializeEdits(e)}).catch(t=>{if(a(t))throw new s("update-features-workflow:full-features-aborted","Fetching of full features was aborted.");throw t})),this.addHandles(i(t)),this._initializeEditorItemsByLayer()}get features(){return this.fullFeatures}get fullFeatures(){return Array.from(this._fullFeatures.values())}get initialFeatures(){return Array.from(this._pendingEdits.values()).map(t=>t.initialFeature).filter(e)}get layers(){const{featureInfos:t,features:s}=this;return t?.length?t.map(t=>t.layer):s.length?r(s.map(t=>t.sourceLayer).filter(e)):[]}set timeZone(t){this._set("timeZone",t),this._pendingEdits.forEach(e=>{e.timeZone=t})}getEditorItemForLayer(t){return this._editorItemsByLayer.get(t)}getFeatureTitle(t){return this._pendingEdits.get(t)?.displayTitle}getPendingEditsForFeature(t){const e=t.getObjectId();if(null!=e)return this._pendingEdits.get(this._fullFeatures.get(e)??t)}isSubmittable(t){const e=this._pendingEdits.get(t);return!!e&&(e.submittable||e.isAssociation)}stageDelete(){for(const t of this._pendingEdits.values())t.stageDelete()}_initializeEditorItemsByLayer(){for(const t of this.editorItems)this._editorItemsByLayer.set(t.layer,t)}_initializeEdits(t){const{timeZone:e}=this;for(const r of t){const t=new c({feature:r,timeZone:e});t.trackChanges(),this._pendingEdits.set(r,t)}}async _initializeFullFeatures(t){const{_fullFeatures:e,featureInfos:r,features:i,viewModel:n}=this,{spatialReference:l}=n.view,a=new Map;if(r?.length)for(const{layer:s,objectIds:o}of r)a.set(d(s)?s.parent:s,o);else if(i.length)for(const s of i){const t=s.getObjectId();if(null!=t){const e=s.sourceLayer??s.layer,r=d(e)?e.parent:e;o(a,r,()=>[]).push(t)}}const u=Array.from(a.entries()).map(async([r,i])=>{const o=await h(i,r,l,t);if(o.length!==i.length)throw new s("editor:update-features-workflow:fetch-full-features-incomplete","Failed to fetch full features for one or more of the provided features.");const n=r.objectIdField,a=(t,e)=>t.attributes[n]>e.attributes[n]?1:-1,u=i.sort(),f=o.sort(a);for(let t=0;t<u.length;t++)e.set(u[t],f[t]);return o});return(await Promise.all(u)).flat()}};t([f({constructOnly:!0})],m.prototype,"editorItems",void 0),t([f({constructOnly:!0})],m.prototype,"featureInfos",void 0),t([f()],m.prototype,"features",null),t([f()],m.prototype,"fullFeatures",null),t([f()],m.prototype,"initialFeatures",null),t([f()],m.prototype,"layers",null),t([f()],m.prototype,"parent",void 0),t([f()],m.prototype,"selectedFeature",void 0),t([f({constructOnly:!0})],m.prototype,"sketchOptions",void 0),t([f()],m.prototype,"snappingManager",void 0),t([f()],m.prototype,"timeZone",null),t([f()],m.prototype,"viewModel",void 0),t([f()],m.prototype,"_fullFeatures",void 0),m=t([p("esri.widgets.Editor.UpdateFeaturesWorkflowData")],m);const y=m;export{y as default};
5
+ import{__decorate as t}from"tslib";import{isSome as e,unique as r}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import{abortHandle as i}from"../../core/handleUtils.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{EsriPromise as n}from"../../core/Promise.js";import{throwIfAborted as l,isAbortError as a}from"../../core/promiseUtils.js";import u from"../../core/ReactiveMap.js";import{property as f,subclass as p}from"../../core/accessorSupport/decorators.js";import{isSubtypeSublayer as d}from"../../layers/support/layerUtils.js";import c from"./Edits.js";import{fetchFullFeaturesByObjectId as h}from"./workflowUtils.js";let m=class extends n{constructor(t){super(t),this.editorItems=[],this.featureInfos=null,this.parent=null,this.selectedFeature=null,this.sketchOptions=null,this.snappingManager=null,this.viewModel=null,this._editorItemsByLayer=new u,this._fullFeatures=new u,this._pendingEdits=new u}initialize(){const t=new AbortController;this.addResolvingPromise(this._initializeFullFeatures(t.signal).then(e=>{l(t.signal),this._initializeEdits(e)}).catch(t=>{if(a(t))throw new s("update-features-workflow:full-features-aborted","Fetching of full features was aborted.");throw t})),this.addHandles(i(t)),this._initializeEditorItemsByLayer()}get features(){return this.fullFeatures}get fullFeatures(){return Array.from(this._fullFeatures.values())}get initialFeatures(){return Array.from(this._pendingEdits.values()).map(t=>t.initialFeature).filter(e)}get layers(){const{featureInfos:t,features:s}=this;return t?.length?t.map(t=>t.layer):s.length?r(s.map(t=>t.sourceLayer).filter(e)):[]}set timeZone(t){this._set("timeZone",t),this._pendingEdits.forEach(e=>{e.timeZone=t})}getEditorItemForLayer(t){return this._editorItemsByLayer.get(t)}getFeatureTitle(t){return this._pendingEdits.get(t)?.displayTitle}getPendingEditsForFeature(t){const e=t.getObjectId();if(null!=e)return this._pendingEdits.get(this._fullFeatures.get(e)??t)}isSubmittable(t){const e=this._pendingEdits.get(t);return!!e&&(e.submittable||e.isAssociation)}stageDelete(){for(const t of this._pendingEdits.values())t.stageDelete()}_initializeEditorItemsByLayer(){for(const t of this.editorItems)this._editorItemsByLayer.set(t.layer,t)}_initializeEdits(t){const{timeZone:e}=this;for(const r of t){const t=new c({feature:r,timeZone:e});t.trackChanges(),this._pendingEdits.set(r,t)}}async _initializeFullFeatures(t){const{_fullFeatures:e,featureInfos:r,features:i,viewModel:n}=this,{spatialReference:l}=n.view,a=new Map;if(r?.length)for(const{layer:s,objectIds:o}of r)a.set(d(s)?s.parent:s,o);else if(i.length)for(const s of i){const t=s.getObjectId();if(null!=t){const e=s.sourceLayer??s.layer,r=d(e)?e.parent:e;o(a,r,()=>[]).push(t)}}const u=Array.from(a.entries()).map(async([r,i])=>{const o=await h(i,r,l,t);if(o.length!==i.length)throw new s("editor:update-features-workflow:fetch-full-features-incomplete","Failed to fetch full features for one or more of the provided features.");const n=r.objectIdField,a=(t,e)=>t.attributes[n]>e.attributes[n]?1:-1,u=i.sort((t,e)=>t-e),f=o.sort(a);for(let t=0;t<u.length;t++)e.set(u[t],f[t]);return o});return(await Promise.all(u)).flat()}};t([f({constructOnly:!0})],m.prototype,"editorItems",void 0),t([f({constructOnly:!0})],m.prototype,"featureInfos",void 0),t([f()],m.prototype,"features",null),t([f()],m.prototype,"fullFeatures",null),t([f()],m.prototype,"initialFeatures",null),t([f()],m.prototype,"layers",null),t([f()],m.prototype,"parent",void 0),t([f()],m.prototype,"selectedFeature",void 0),t([f({constructOnly:!0})],m.prototype,"sketchOptions",void 0),t([f()],m.prototype,"snappingManager",void 0),t([f()],m.prototype,"timeZone",null),t([f()],m.prototype,"viewModel",void 0),t([f()],m.prototype,"_fullFeatures",void 0),m=t([p("esri.widgets.Editor.UpdateFeaturesWorkflowData")],m);const y=m;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{isSome as i}from"../core/arrayUtils.js";import{watch as l,on as o,sync as n,initial as s}from"../core/reactiveUtils.js";import{renderingSanitizer as a}from"../core/sanitizerUtils.js";import{formatFileSize as r}from"../core/unitFormatUtils.js";import{property as c,subclass as d}from"../core/accessorSupport/decorators.js";import{isLayerFromCatalog as h}from"../layers/catalog/catalogUtils.js";import{isKnowledgeGraphLayer as m,isMapImageLayer as p,isSubtypeGroupLayer as u}from"../layers/support/layerUtils.js";import g from"../tables/AttributeTableTemplate.js";import w from"./Widget.js";import{isSupportedImage as b,getCalciteIconForAttachment as v}from"./Attachments/support/attachmentUtils.js";import{loadPromptComponents as y,Prompt as f}from"./Editor/components/Prompt.js";import _ from"./FeatureTable/ColumnMenuVisibleElements.js";import M from"./FeatureTable/FeatureTableViewModel.js";import C from"./FeatureTable/VisibleElements.js";import{isGroupColumn as A}from"./FeatureTable/support/columnUtils.js";import{loadFieldColumnComponents as S,isIFeatureTableSupportedLayer as T,isIFeatureTableSupportedLayerWithAttachments as E,getRelationshipIdsToShow as V}from"./FeatureTable/support/tableUtils.js";import{loadCalciteComponents as I}from"./support/componentsUtils.js";import{globalCss as R}from"./support/globalCss.js";import{getIconForLayer as k}from"./support/iconUtils.js";import{messageBundle as x,vmEvent as D,tsx as P}from"./support/widget.js";import{storeNode as O,discardNode as F}from"./support/widgetUtils.js";var z;const L="esri-feature-table",j=`${L}__attachments-view`,U={base:L,content:`${L}__content`,menuPopover:`${L}__menu-popover`,layerDropdownMenu:`${L}__layer-switcher-menu`,tableContainer:`${L}__table-container`,tableContainerWithAttachments:`${L}__table-container--attachments`,tableNavigation:`${L}__table-navigation`,attachmentsView:j,attachmentsViewContent:`${j}__content`,attachmentsViewDropArea:`${j}__drop-area`,attachmentsViewIcon:`${j}__icon`,attachmentsViewInformation:`${j}__information`,attachmentsViewList:`${j}__list`,attachmentsViewListFileSize:`${j}__list__filesize`,attachmentsViewListItemDelete:`${j}__list-item--delete`,attachmentsViewListThumbnail:`${j}__list__thumbnail`,expanded:`${L}__expanded`,collapsed:`${L}__collapsed`},$={chevronRight:"chevron-right",clearSelection:"clear-selection",downloadTo:"download-to",exclamationMarkTriangle:"exclamation-mark-triangle",exportToCSV:"file-csv",folderOpen:"folder-open",delete:"trash",launch:"launch",layers:"layers",moveUp:"move-up",plus:"plus",refresh:"refresh",replaceImage:"replace-image",save:"save",showAll:"selection-x",showColumn:"show-column",showSelected:"selection-filter",upload:"upload",zoomToSelection:"zoom-to-object"};let B=z=class extends w{constructor(e,t){super(e,t),this._attachmentsInput=null,this._columnVisibilityActions=new Map,this.attachmentsList=null,this.description=null,this.disabled=!1,this.navigationScale="m",this.title=null,this.viewModel=new M,this.visibleElements=new C,this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([l(()=>[this.isQueryingOrSyncing,this.editingEnabled],()=>this.scheduleRender()),l(()=>[this._effectiveVisibleElements,this._effectiveVisibleElements.columnDescriptions,this._effectiveVisibleElements.columnMenus,this._effectiveVisibleElements.columnMenuItems,this.columns.length],()=>{this.columns.forEach(e=>e.visibleElements=this._effectiveVisibleElements),this.refreshCellContent()},n),l(()=>this._effectiveVisibleElements.selectionColumn,e=>{this.grid&&(this.grid.selectionColumnEnabled=e)},s),o(()=>this.viewModel,"show-related-table",e=>this._onShowRelatedTable(e)),l(()=>this.editingEnabled,()=>{const{attachmentsViewOptions:e}=this;this.clearPrompt(),e&&(e.form?.reset(),e.candidates=null)})])}loadDependencies(){return Promise.all([I({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),alert:()=>import("@esri/calcite-components/dist/components/calcite-alert"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),pagination:()=>import("@esri/calcite-components/dist/components/calcite-pagination"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")}),y(),S()])}destroy(){this.drainRelatedTables(),this.clearPrompt()}get _effectiveDescription(){const{description:e}=this;return null!=e?a.sanitize("function"==typeof e?e():e):void 0}get _effectiveLayers(){const{layer:e,layers:t}=this,i=t?.length?t.filter(T):[],l=i.length?i:[...this._viewLayers];return e&&!l.includes(e)&&l.push(e),l}get _effectiveTitle(){const{layer:e,messages:i,state:l,highlightIds:o,title:n,size:s}=this;if(n)return a.sanitize("function"==typeof n?n():n);if(!e)return i.noLayer;switch(l){case"disabled":return i.errorLayer;case"ready":case"loading":return i.loading;case"error":return i.errorData}return t(i.header,{title:a.sanitize(e.title),count:s,selected:o.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}get _filteredTables(){const e=this.relatedTables.toArray(),t=1===e.length;return this.allRelatedTablesVisible?e:t?[e[0]]:this._shouldShowAttachmentsView?e.slice(-1):e.slice(-2)}get _hasAttachmentsViewError(){return null!=this.attachmentsViewOptions.error}get _hasCustomMenuItems(){return!!this.menuConfig?.items?.length}get _hasDefaultMenuItems(){return!!(this._showClearSelectionAction||this._showDeleteSelectionAction||this._showExportSelectionToCSVAction||this._showRefreshDataAction||this._showZoomToSelectionAction||this._showSelectedRecordsShowSelectedAction||this._showSelectedRecordsShowAllAction||this._showColumnsVisibilityAction)}get _shouldShowGrid(){return this.allRelatedTablesVisible||1===this.relatedTables.length&&!this._shouldShowAttachmentsView}get _shouldShowMenu(){const{header:e,menu:t}=this._effectiveVisibleElements;return!(!e||!t||!this._hasDefaultMenuItems&&!this._hasCustomMenuItems)}get _shouldShowAttachmentsView(){return!(null==this.attachmentsViewOptions.objectId&&!this.relatedTables.some(e=>null!=e.attachmentsViewOptions.objectId))}get _showClearSelectionAction(){return!(!this.highlightIds.length||!this._effectiveVisibleElements.menuItems?.clearSelection||this.relatedTables.length||this._shouldShowAttachmentsView)}get _showColumnsVisibilityAction(){const{header:e,menu:t,menuItems:i}=this._effectiveVisibleElements;return!(!(e&&t&&i?.toggleColumns)||this.showRelatedTableCallback||this.allRelatedTablesVisible||this._shouldShowAttachmentsView)}get _showDeleteSelectionAction(){return!(!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete)||this.relatedTables.length||this._shouldShowAttachmentsView)}get _showExportSelectionToCSVAction(){return!(!(this._effectiveVisibleElements.menuItems.exportSelectionToCSV&&this.layer&&this.highlightIds.length)||this.relatedTables.length)}get _showLayerDropdown(){return!(!this._effectiveLayers.length||!this._effectiveVisibleElements.layerDropdown)}get _shouldShowNavigationBar(){const e=!!this.relatedTable||this._shouldShowAttachmentsView;return!this.tableParent&&e}get _showRefreshDataAction(){return!!this._effectiveVisibleElements.menuItems?.refreshData}get _showSelectedRecordsShowSelectedAction(){const e=this.objectIds.length,t=this.highlightIds.length;return!(!t||!this._effectiveVisibleElements.menuItems?.selectedRecordsShowSelectedToggle||e&&t===e||this.relatedTables.length||this._shouldShowAttachmentsView)}get _showSelectedRecordsShowAllAction(){return!(!this._effectiveVisibleElements.menuItems?.selectedRecordsShowAllToggle||!this.objectIds.length||this.relatedTables.length)}get _showZoomToSelectionAction(){return!(!this.view||!this.highlightIds.length||this.effectiveTable.layer?.isTable||!this._effectiveVisibleElements.menuItems?.zoomToSelection)}get _viewLayers(){const e=this.view?.map;if(!e)return[];const t=new Set,i=e=>{!T(e)||u(e)||t.has(e)||"sublayer"===e.type&&!e.capabilities?.operations?.supportsQuery||(e.load(),t.add(e))},l=e=>{h(e)||"catalog-footprint"===e.type||(m(e)?(e.load(),e.layers?.forEach(i),e.tables?.forEach(i)):p(e)?(e.loadAll(),e.allSublayers?.forEach(i),e.subtables?.forEach(i)):u(e)?(e.loadAll(),e.sublayers?.forEach(i)):i(e))};return e.allLayers.forEach(l),e.allTables.forEach(l),[...t.values()]}get grid(){return this.viewModel.grid}get actionColumn(){return this.viewModel.actionColumn}get actionColumnConfig(){return this.viewModel.actionColumnConfig}set actionColumnConfig(e){this.viewModel.actionColumnConfig=e}get activeFilters(){return this.viewModel.activeFilters}get activeSortOrders(){return this.viewModel.activeSortOrders}get allColumns(){return this.viewModel.allColumns}get allRelatedTablesVisible(){return this.viewModel.allRelatedTablesVisible}get allVisibleColumns(){return this.viewModel.allVisibleColumns}get attachmentsColumns(){return this.viewModel.attachmentsColumns}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get attachmentsViewOptions(){return this.viewModel.attachmentsViewOptions}set attachmentsViewOptions(e){this.viewModel.attachmentsViewOptions=e}get attributeTableTemplate(){return this.viewModel.attributeTableTemplate}set attributeTableTemplate(e){this.viewModel.attributeTableTemplate=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=e}get clearPrompt(){return this.viewModel.clearPrompt}set clearPrompt(e){this.viewModel.clearPrompt=e}get columnPerformanceModeEnabled(){return this.viewModel.columnPerformanceModeEnabled}set columnPerformanceModeEnabled(e){this.viewModel.columnPerformanceModeEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get columns(){return this.viewModel.columns}get definitionExpression(){return this.viewModel.definitionExpression}set definitionExpression(e){this.viewModel.definitionExpression=e}set container(e){super.container=e}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveSize(){return this.viewModel.effectiveSize}get effectiveTable(){return this.relatedTable||this}get fieldColumns(){return this.viewModel.fieldColumns}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(e){this.viewModel.filterGeometry=e}get filterBySelectionEnabled(){return this.viewModel.filterBySelectionEnabled}set filterBySelectionEnabled(e){this.viewModel.filterBySelectionEnabled=e}get groupColumns(){return this.viewModel.groupColumns}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(e){this.viewModel.hiddenFields=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get icon(){return"table"}set icon(e){this._overrideIfSome("icon",e)}get initialSize(){return this.viewModel.initialSize}set initialSize(e){this.viewModel.initialSize=e}get isQueryingOrSyncing(){return this.viewModel.isQueryingOrSyncing}get isSyncingAttachments(){return this.viewModel.isSyncingAttachments}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}get layerView(){return this.viewModel.layerView}get maxSize(){return this.viewModel.maxSize}set maxSize(e){this.viewModel.maxSize=e}get messages(){return this.viewModel.messages}set messages(e){this.viewModel.messages=e}get messagesCommon(){return this.viewModel.messagesCommon}set messagesCommon(e){this.viewModel.messagesCommon=e}get messagesUnits(){return this.viewModel.messagesUnits}set messagesUnits(e){this.viewModel.messagesUnits=e}get messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(e){this.viewModel.messagesURIUtils=e}get menuConfig(){return this.viewModel.menuConfig}set menuConfig(e){this.viewModel.menuConfig=e}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get multipleSortPriority(){return this.viewModel.multipleSortPriority}set multipleSortPriority(e){this.viewModel.multipleSortPriority=e}get noDataMessage(){return this.viewModel.noDataMessage}set noDataMessage(e){this.viewModel.noDataMessage=e}get objectIds(){return this.viewModel.objectIds}set objectIds(e){this.viewModel.objectIds=e}get outFields(){return this.viewModel.outFields}set outFields(e){this.viewModel.outFields=e}get pageCount(){return this.viewModel.pageCount}get pageIndex(){return this.viewModel.pageIndex}set pageIndex(e){this.viewModel.pageIndex=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get paginationEnabled(){return this.viewModel.paginationEnabled}set paginationEnabled(e){this.viewModel.paginationEnabled=e}get prompt(){return this.viewModel.prompt}set prompt(e){this.viewModel.prompt=e}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get relatedTable(){return this.viewModel.relatedTable}get relatedTables(){return this.viewModel.relatedTables}set relatedTables(e){this.viewModel.relatedTables=e}get relationship(){return this.viewModel.relationship}get relationshipColumnConfigs(){return this.viewModel.relationshipColumnConfigs}set relationshipColumnConfigs(e){this.viewModel.relationshipColumnConfigs=e}get relationshipColumns(){return this.viewModel.relationshipColumns}get relationshipConfig(){return this.viewModel.relationshipConfig}set relationshipConfig(e){this.viewModel.relationshipConfig=e}get relationshipInfos(){return this.viewModel.relationshipInfos}get returnGeometryEnabled(){return this.viewModel.returnGeometryEnabled}set returnGeometryEnabled(e){this.viewModel.returnGeometryEnabled=e}get returnMEnabled(){return this.viewModel.returnMEnabled}set returnMEnabled(e){this.viewModel.returnMEnabled=e}get returnZEnabled(){return this.viewModel.returnZEnabled}set returnZEnabled(e){this.viewModel.returnZEnabled=e}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(e){this.viewModel.rowHighlightIds=e}get selectionSource(){return this.viewModel.selectionSource}set selectionSource(e){this.viewModel.selectionSource=e}get showAllRelatedTables(){return this.viewModel.showAllRelatedTables}set showAllRelatedTables(e){this.viewModel.showAllRelatedTables=e}get showPrompt(){return this.viewModel.showPrompt}set showPrompt(e){this.viewModel.showPrompt=e}get showRelatedTableCallback(){return this.viewModel.showRelatedTableCallback}set showRelatedTableCallback(e){this.viewModel.showRelatedTableCallback=e}get size(){return this.viewModel.size}get state(){return this.viewModel.state}get supportsAddAttachments(){return this.viewModel.supportsAddAttachments}get supportsAttachments(){return this.viewModel.supportsAttachments}get supportsDeleteAttachments(){return this.viewModel.supportsDeleteAttachments}get supportsResizeAttachments(){return this.viewModel.supportsResizeAttachments}get supportsUpdateAttachments(){return this.viewModel.supportsUpdateAttachments}get syncTemplateOnChangesEnabled(){return this.viewModel.syncTemplateOnChangesEnabled}set syncTemplateOnChangesEnabled(e){this.viewModel.syncTemplateOnChangesEnabled=e}get tableController(){return this.viewModel.tableController}set tableController(e){this.viewModel.tableController=e}get tableParent(){return this.viewModel.tableParent}set tableParent(e){this.viewModel.tableParent=e}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(e){this.viewModel.tableTemplate=e}get tableTemplateOverride(){return this.viewModel.tableTemplateOverride}set tableTemplateOverride(e){this.viewModel.tableTemplateOverride=e}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visibleColumns(){return this.viewModel.visibleColumns}get visibleElementsOverride(){const{attachmentsViewOptions:e,relatedTable:t,tableController:i,visibleElements:l}=this,{columnDescriptions:o,columnMenus:n,tooltips:s}=l,a=null!=e.objectId;if(t)return new C({columnDescriptions:o,columnMenus:n,tooltips:s,close:l.close,header:l.header,layerDropdown:l.layerDropdown,layerDropdownIcons:l.layerDropdownIcons,menu:l.menu,menuItems:l.menuItems,progress:l.progress,selectionColumn:!1,columnMenuItems:new _({sortAscending:!1,sortDescending:!1})});if(i){const e=i.relatedTable===this,t=i.allRelatedTablesVisible,r=e&&l.selectionColumn&&!t&&!a,c=e&&!t&&!a;return new C({columnDescriptions:o,columnMenus:n,tooltips:s,selectionColumn:r,close:!1,header:!1,layerDropdown:!1,menu:!1,progress:!1,columnMenuItems:new _({sortAscending:c,sortDescending:c})})}return a?new C({columnDescriptions:o,columnMenus:n,tooltips:s,close:l.close,header:l.header,layerDropdown:l.layerDropdown,layerDropdownIcons:l.layerDropdownIcons,menu:l.menu,menuItems:l.menuItems,progress:l.progress,selectionColumn:!1,columnMenuItems:new _({sortAscending:!1,sortDescending:!1})}):null}clearSelectionFilter(){this.viewModel.clearSelectionFilter()}async deleteAttachments(e,t,i){null!=e&&t?.length&&(i?this._showDeleteAttachmentPrompt(e,t):await this.viewModel.deleteAttachments(e,t))}deleteSelection(e){return this.highlightIds.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}async downloadAttachmentById(e,t){return this.viewModel.downloadAttachmentById(e,t)}drainRelatedTables(){this.viewModel.drainRelatedTables()}exportSelectionToCSV(e){return this.viewModel.exportSelectionToCSV(e)}filterBySelection(){this.viewModel.filterBySelection()}findColumn(e){return this.viewModel.findColumn(e)}goToPage(e){this.viewModel.goToPage(e)}hideColumn(e){this.grid?.hideColumn(e)}nextPage(){this.viewModel.nextPage()}previousPage(){this.viewModel.previousPage()}async refresh(){await this.viewModel.refresh()}refreshCellContent(){this.viewModel.refreshCellContent()}async saveAttachmentsViewForm(){await this.viewModel.saveAttachmentsViewForm()}showAllColumns(){this.viewModel.showAllColumns()}showColumn(e){this.grid?.showColumn(e)}sortColumn(e,t){this.viewModel.sortColumn(e,t)}scrollLeft(){this.viewModel.scrollLeft()}scrollToBottom(){this.viewModel.scrollToBottom()}scrollToIndex(e){this.viewModel.scrollToIndex(e)}scrollToRow(e){this.viewModel.scrollToRow(e)}scrollToTop(){this.viewModel.scrollToTop()}toggleColumnVisibility(e){this.viewModel.toggleColumnVisibility(e)}zoomToSelection(){this.effectiveTable.viewModel.zoomToSelection()}render(){const{_effectiveVisibleElements:e,isQueryingOrSyncing:t,menuConfig:i,state:l}=this;return P("div",{bind:this,class:this.classes(U.base,R.widget)},P("calcite-panel",{bind:this,class:U.content,closable:e.close,description:this._effectiveDescription,disabled:this.disabled||"disabled"===l&&!this._effectiveLayers?.length,heading:e.header?this._effectiveTitle:void 0,key:"table-content",loading:"loading"===l,menuOpen:!!i?.open,overlayPositioning:"fixed",onCalcitePanelClose:e=>{e.currentTarget.closed=!1,this.emit("close")}},e.progress?P("calcite-progress",{type:t?"indeterminate":"determinate"}):null,this._showLayerDropdown?this._renderLayerDropdown():null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderNavigationBar(),this._renderTables(),this._renderError()),this._renderColumnVisibilityPopover(),this._renderPrompt())}_renderTables(){const{grid:e,relatedTables:t}=this,i=this.classes(U.tableContainer);if(t.length){const l=this.classes(U.base,this.allRelatedTablesVisible?U.expanded:U.collapsed,this._shouldShowAttachmentsView?U.tableContainerWithAttachments:void 0);return P("div",{class:i},P("calcite-panel",{overlayPositioning:"fixed"},P("div",null,[this._shouldShowGrid?P("div",{class:l},e?.render(),this._renderPagination()):void 0,...this._filteredTables.map(e=>{const i=t.indexOf(e);return P("div",{class:l,key:`related-${i}`},e.render())}),,])))}return null!=this.attachmentsViewOptions.objectId?P("div",{class:i},P("calcite-panel",{overlayPositioning:"fixed"},P("div",null,[P("div",{class:this.classes(U.base,U.collapsed)},e?.render(),this._renderPagination()),this._renderAttachmentsView()]))):[P("div",{class:i},e?.render()),this._renderPagination()]}_renderPagination(){if(this.paginationEnabled)return P("calcite-pagination",{pageSize:1,startItem:this.pageIndex+1,totalItems:this.pageCount,onCalcitePaginationChange:e=>this.goToPage(e.currentTarget.startItem-1)})}_renderError(){const{messages:e}=this;return P("calcite-alert",{autoClose:!0,autoCloseDuration:"fast",icon:$.exclamationMarkTriangle,kind:"danger",label:e.errorOccured,open:this._hasAttachmentsViewError,slot:"alerts",onCalciteAlertClose:()=>{this.attachmentsViewOptions.error=null}},P("span",{slot:"message"},e.errorOccured))}_renderPrompt(){return this.prompt?P(f,{...this.prompt,headingLevel:2}):void 0}_showDeletePrompt(){const{messages:e,messagesCommon:i}=this,l=t(e.deleteSelectionCount,{count:this.highlightIds.length});this.showPrompt({title:l,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:i.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,action:()=>this.clearPrompt()}}})}_showDeleteAttachmentPrompt(e,i){const{messages:l,messagesCommon:o}=this,n=t(l.deleteAttachmentCount,{count:i.length});this.showPrompt({title:n,message:l.deleteAttachmentConfirmation,context:"danger",actions:{primary:{label:o.delete,action:async()=>{try{await this.deleteAttachments(e,i,!1)}finally{this.clearPrompt()}}},secondary:{label:o.cancel,action:()=>this.clearPrompt()}}})}async _onDeleteSelectionClick(){try{await this.viewModel.deleteSelection()}finally{this.clearPrompt()}}_renderHeaderMenuAction(e){const{disabled:t,hidden:i,icon:l,text:o,clickFunction:n}=e;if(!i)return P("calcite-action",{disabled:t??this.menuConfig?.disabled,icon:l??void 0,key:o,onclick:()=>n(),slot:"header-menu-actions",text:o,textEnabled:!0,title:o})}_renderHeaderMenuActions(){return this._shouldShowMenu?[this._renderDefaultHeaderMenuActions(),this._renderCustomHeaderMenuActions()]:[]}_renderDefaultHeaderMenuActions(){if(!this._hasDefaultMenuItems)return[];const{messages:e}=this;return[this._showRefreshDataAction&&{icon:$.refresh,text:e.refreshData,clickFunction:()=>this.refresh()},this._showDeleteSelectionAction&&{icon:$.delete,text:e.deleteSelection,clickFunction:()=>this.deleteSelection(!0)},this._showClearSelectionAction&&{icon:$.clearSelection,text:e.clearSelection,clickFunction:()=>this.highlightIds?.removeAll()},this._showZoomToSelectionAction&&{icon:$.zoomToSelection,text:e.zoomToSelection,clickFunction:()=>this.zoomToSelection()},this._showSelectedRecordsShowSelectedAction&&{icon:$.showSelected,text:e.showSelected,clickFunction:()=>{const{objectIds:e}=this;e.removeAll(),e.addMany(this.highlightIds.toArray())}},this._showSelectedRecordsShowAllAction&&{icon:$.showAll,text:e.showAllRecords,clickFunction:()=>this.objectIds.removeAll()},this._showExportSelectionToCSVAction&&{icon:$.exportToCSV,text:e.exportSelectionCSV,clickFunction:()=>this.exportSelectionToCSV()}].filter(i).map(e=>e&&this._renderHeaderMenuAction(e))}_renderCustomHeaderMenuActions(){return this.menuConfig?.items?.map(({disabled:e,hidden:t,icon:i,label:l,clickFunction:o})=>this._renderHeaderMenuAction({hidden:"function"==typeof t?t():t,icon:i,text:l,disabled:e,clickFunction:e=>o(e)}))??[]}_renderColumnVisibilityAction(){if(!this._showColumnsVisibilityAction)return[];const{_columnVisibilityActions:e,effectiveTable:t,id:i}=this,l=this.messages.toggleColumns;return P("calcite-action",{afterCreate:t=>e.set(i,t),afterRemoved:()=>e.delete(i),appearance:"transparent",bind:this,disabled:t.menuConfig?.disabled,icon:$.showColumn,id:`${i}__toggle-columns-action`,slot:"header-actions-end",text:l},this._effectiveVisibleElements.tooltips?P("calcite-tooltip",{closeOnClick:!0,overlayPositioning:"fixed",placement:"bottom-end",slot:"tooltip"},l):null)}_renderColumnVisibilityPopover(){if(!this._showColumnsVisibilityAction||this.effectiveTable.menuConfig?.disabled)return;const{effectiveTable:e}=this,t=this.messages.toggleColumns;return P("calcite-popover",{autoClose:!0,class:U.menuPopover,label:t,overlayPositioning:"fixed",placement:"top-end",pointerDisabled:!0,referenceElement:this._columnVisibilityActions.get(this.id)},P("calcite-list",{displayMode:"nested",filterEnabled:!0,filterPlaceholder:t,label:t,selectionMode:"multiple"},e.columns.toArray().map(t=>{const i=A(t)?t.columns?.map(t=>this._renderColumnListItem({column:t,table:e,ignoreSelect:!0})):void 0;return this._renderColumnListItem({column:t,table:e,items:i})})))}_renderColumnListItem(e){const{column:t,table:i,items:l,ignoreSelect:o}=e,{effectiveLabel:n,fieldName:s,hidden:a}=t;return P("calcite-list-item",{expanded:!(!l?.length||a)||void 0,key:`toggle-columns__item-${s}`,label:n,selected:!a,value:s,onCalciteListItemSelect:e=>{o&&e.stopPropagation(),i.toggleColumnVisibility(e.currentTarget.value)}},l)}_renderLayerDropdown(){const e=this.messages.selectALayer;return P("div",{class:U.layerDropdownMenu,key:`${this.id}-layerDropdown`,slot:"header-actions-start"},P("calcite-dropdown",{bind:this,maxItems:5,overlayPositioning:"fixed",placement:"bottom-start"},P("calcite-action",{icon:$.layers,slot:"trigger",text:e,title:e}),P("calcite-dropdown-group",{selectionMode:"single"},this._effectiveLayers.map((e,t)=>this._renderLayerDropdownItem(e,t))??null)))}_renderLayerDropdownItem(e,t){const i=this.visibleElements.layerDropdownIcons;return P("calcite-dropdown-item",{iconStart:i?k(e):void 0,key:`dropdown-item-${t}`,label:e.title??"",selected:e===this.layer,value:e.id,onCalciteDropdownItemSelect:()=>{this.layer=e}},e.title)}_onRelatedNavigationItemClick(e){this.viewModel.drainRelatedTablesAboveIndex(e)}_collapseRelatedTable(e){this.viewModel.collapseRelatedTable(this.effectiveTable,e)}_onShowRelatedTable(e){this.showRelatedTableCallback||(this._collapseRelatedTable(e),this._createRelatedTable(e))}async _createRelatedTable(e){const{editingEnabled:t,effectiveTable:i,paginationEnabled:l,pageSize:o,view:n,viewModel:s}=this,{layer:a,objectId:r,relatedLayer:c,relationshipId:d}=e;await a.load();const h=this.attachmentsEnabled&&E(a),m=new z({layer:a,attachmentsEnabled:h,editingEnabled:t,paginationEnabled:l,pageSize:o,relatedRecordsEnabled:!0,relationshipConfig:{objectId:r,relatedLayer:c,relationshipId:d},relationshipColumnConfigs:V(a,d),tableController:this,tableParent:i,view:n,showRelatedTableCallback:e=>s.emit("show-related-table",e)});this.relatedTables.add(m),this.scheduleRender()}_renderAttachmentsView(){const{attachmentInfos:e,mode:t,objectId:i}=this.attachmentsViewOptions;return"file"!==t&&e.length&&null!=i?this._renderAttachmentsViewList():this._renderAttachmentsViewFilePane()}_renderAttachmentsViewFilePane(){const{attachmentsViewOptions:e,isSyncingAttachments:t,supportsAddAttachments:i,messages:l,messagesUnits:o}=this,{attachmentId:n,attachmentInfos:s,candidates:a,objectId:c}=e,d=s.find(e=>e.id===n),h=s.length,m=a?.length,p=d?P("calcite-label",{alignment:"center",key:"replace-file-node",scale:"l"},l.replaceFile):void 0,u=m?void 0:P("calcite-label",{alignment:"center",key:"message-node",scale:"m"},i?null==c?l.noFeature:l.dragAndDropToUpload:l.editingRestricted),g=Array.from(a??[]).pop(),w=g?P("calcite-label",{key:"filename-node"},g.name):void 0,b=i&&null!=c,v=b&&m,y=P("input",{afterCreate:O,afterRemoved:F,afterUpdate:O,bind:this,"data-node-ref":"_attachmentsInput",files:a,hidden:!0,name:"attachment",onchange:e=>this._onAttachmentsViewCandidateChange(e),type:"file"}),f=b?P("calcite-button",{appearance:"outline-fill",bind:this,disabled:t,iconStart:$.folderOpen,key:"select-node",loading:!1,onclick:()=>{this._attachmentsInput&&(this._attachmentsInput.value="",this._attachmentsInput.click())},width:"full"},l.selectFile):void 0,_=v?P("calcite-button",{appearance:"outline-fill",bind:this,disabled:t,iconStart:$.save,key:"save-node",loading:t,onclick:()=>{this.saveAttachmentsViewForm()},width:"full"},d?l.updateAttachment:l.addAttachment):void 0,M=h||m?P("calcite-button",{appearance:"transparent",bind:this,disabled:t,key:"cancel-node",onclick:()=>{this._attachmentsInput&&(this._attachmentsInput.value=""),e.reset(),e.attachmentInfos?.length&&(e.mode="list")},width:"full"},this.messagesCommon.cancel):void 0;return[P("div",{class:U.attachmentsView,key:"attachments-view"},P("div",{class:U.attachmentsViewContent,key:"attachments-view-content"},P("div",{bind:this,class:U.attachmentsViewDropArea,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop},P("calcite-icon",{class:U.attachmentsViewIcon,icon:$.upload,scale:"l"}),p,u,P("form",{afterCreate:t=>e.form=t,afterRemoved:()=>e.form=null,bind:this,key:"attachments-form"},P("fieldset",null,w,y,f,_,M)))),null!=c&&null!=d?P("div",{class:U.attachmentsViewInformation,key:"information"},this._renderAttachmentsViewThumbnail(d,200),P("label",{key:"file-label"},l.fileName),P("span",{key:"file-span"},d.name),P("label",{key:"size-label"},l.size),P("span",{key:"size-span"},r(o,d.size??0))):void 0)]}_renderAttachmentsViewList(){const{attachmentsViewOptions:e,isSyncingAttachments:t,messages:i,messagesUnits:l,supportsDeleteAttachments:o,supportsUpdateAttachments:n}=this,{attachmentInfos:s,objectId:a}=e;return P("calcite-list",{afterCreate:O,afterRemoved:F,afterUpdate:O,bind:this,class:U.attachmentsViewList,"data-node-ref":"attachmentsList",key:`attachments-list-${a}`,label:i?.attachments,loading:t,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop,selectionMode:"multiple",onCalciteListChange:()=>this.scheduleRender()},...s?.map(t=>{const{id:s,name:c,size:d,url:h}=t,m=r(l,d??0);return P("calcite-list-item",{afterRemoved:()=>this.scheduleRender(),key:`attachment-${s}`,label:c,value:s},this._renderAttachmentsViewListThumbnail(t),P("span",{class:U.attachmentsViewListFileSize,slot:"actions-end",title:m},m),P("calcite-action",{appearance:"transparent",icon:$.downloadTo,key:`download-attachment-${s}`,label:`${c}`,onclick:e=>{e.preventDefault(),this.downloadAttachmentById(a??-1,s)},slot:"actions-end",text:i.downloadAttachment,title:i.downloadAttachment}),n&&null!=a?P("calcite-action",{appearance:"transparent",disabled:!n,icon:$.replaceImage,key:`replace-attachment-${s}`,label:`${c}`,onclick:()=>{e.mode="file",e.attachmentId=s},slot:"actions-end",text:i.updateAttachment,title:i.updateAttachment}):void 0,P("calcite-action",{appearance:"transparent",icon:$.launch,key:`launch-attachment-${s}`,label:`${c}`,onclick:()=>{h&&window.open(h,"_blank")},slot:"actions-end",text:i.viewAttachment,title:i.viewAttachment}),o&&null!=a?P("calcite-action",{appearance:"transparent",class:U.attachmentsViewListItemDelete,disabled:!o,icon:$.delete,key:`delete-attachment-${s}`,label:`${c}`,onclick:()=>{this.deleteAttachments(a,[s],!0)},slot:"actions-end",text:i.deleteAttachment,title:i.deleteAttachment}):void 0)}))}_renderAttachmentsViewListThumbnail(e){return P("div",{class:U.attachmentsViewListThumbnail,slot:"content-start"},P("a",{href:e.url??"",rel:"noreferrer",target:"_blank"},this._renderAttachmentsViewThumbnail(e)))}_renderAttachmentsViewThumbnail(e,t=64){const{contentType:i,name:l,size:o,url:n}=e,s=`${n}${n?.includes("?")?"&":"?"}w=${t}&s=${o}`;return this.supportsResizeAttachments&&b(i)?P("img",{alt:l,key:`thumbnail-image-${l}`,src:s,title:l}):P("calcite-icon",{icon:v(i),key:`thumbnail-icon-${l}`,scale:"l",textLabel:l,title:l})}_onAttachmentsViewCandidateChange({target:e}){this.attachmentsViewOptions.candidates=e?.files}_onAttachmentsViewDrop(e){e.preventDefault(),(this.supportsAddAttachments||this.supportsUpdateAttachments)&&this.attachmentsViewOptions.set({mode:"file",candidates:e.dataTransfer?.files})}_renderNavigationBar(){const{effectiveTable:e,messages:i,messagesCommon:l,navigationScale:o,relatedTable:n,relatedTables:s}=this;if(!this._shouldShowNavigationBar)return;const{attachmentsList:a,attachmentsViewOptions:r,layer:c,supportsAddAttachments:d,supportsDeleteAttachments:h}=e;if(!c)return;const{attachmentInfos:m,objectId:p}=r,u=null!=p,g=m.length,w=a?.selectedItems?.length??0,b=`${c.objectIdField}: ${p}`,v=t(i.selectedCount,{count:w}),y=t(i.attachmentsCount,{count:g}),f=u?P("calcite-action",{bind:this,icon:$.chevronRight,iconFlipRtl:!0,key:"navigation-feature",onclick:()=>e.scrollToRow(p),scale:o,text:b,textEnabled:!0,title:b}):void 0,_=u?P("calcite-action",{icon:$.chevronRight,iconFlipRtl:!0,key:"navigation-attachments-label",label:y,onclick:()=>{g>0&&(r.mode="list")},scale:o,text:y,textEnabled:!0,title:y}):void 0,M=u?P("calcite-chip",{closable:!0,closed:0===w,key:"navigation-chip",kind:"inverse",label:v,scale:o,selected:!0,title:v,value:"selected",onCalciteChipClose:()=>a?.selectedItems?.forEach(e=>e.selected=!1)},v):void 0,C=n?P("calcite-label",{layout:"inline",scale:o},i.showAllTables,P("calcite-switch",{checked:this.allRelatedTablesVisible,scale:o,onCalciteSwitchChange:e=>this.showAllRelatedTables=!!e.currentTarget.checked})):void 0,A=u&&"list"===r.mode&&null!=p&&w&&h?P("calcite-action",{icon:$.delete,iconFlipRtl:!0,key:"attachments-trash-all",onclick:()=>{e.deleteAttachments(p,a?.selectedItems?.map(e=>e.value)??[],!0)},scale:o,text:l.delete,textEnabled:!0,title:t(i.deleteAttachmentCount,{count:w})}):void 0,S=u&&"list"===r.mode&&d?P("calcite-action",{bind:this,icon:$.plus,iconFlipRtl:!0,key:"attachments-add",onclick:()=>{r.attachmentId=null,r.mode="file"},scale:o,text:i.addAttachment,textEnabled:!0,title:i.addAttachment}):void 0;return P("div",{class:U.tableNavigation,key:"table-nav"},P("calcite-action",{icon:$.moveUp,iconFlipRtl:!0,key:"go-back",onclick:()=>{n&&this.drainRelatedTables(),e.attachmentsViewOptions.objectId=null},scale:o,text:this.layer?.title??"",textEnabled:!1,title:n?i.exitRelatedRecords:i.exitAttachments}),s.toArray().map((e,t)=>this._renderRelatedTableNavigationAction(e,t)),f,_,P("div",null,M,C,A,S))}_renderRelatedTableNavigationAction(e,t){const i=this._getLabelForRelatedTableNavigationAction(e);return P("calcite-action",{icon:$.chevronRight,iconFlipRtl:!0,key:t,onclick:()=>this._onRelatedNavigationItemClick(t),scale:this.navigationScale,text:i,textEnabled:!0,title:e.layer?.title||""})}_getLabelForRelatedTableNavigationAction(e){const t=e.layer?.title;if(!t)return"";const{relatedTables:i}=this;if(i.length<=1)return t;return i.indexOf(e)!==i.length-1&&t.length>20?`${t.slice(0,20)}...`:t}};e([c()],B.prototype,"_attachmentsInput",void 0),e([c()],B.prototype,"_columnVisibilityActions",void 0),e([c()],B.prototype,"_effectiveDescription",null),e([c()],B.prototype,"_effectiveLayers",null),e([c()],B.prototype,"_effectiveTitle",null),e([c()],B.prototype,"_effectiveVisibleElements",null),e([c()],B.prototype,"_filteredTables",null),e([c()],B.prototype,"_hasAttachmentsViewError",null),e([c()],B.prototype,"_hasCustomMenuItems",null),e([c()],B.prototype,"_hasDefaultMenuItems",null),e([c()],B.prototype,"_shouldShowGrid",null),e([c()],B.prototype,"_shouldShowMenu",null),e([c()],B.prototype,"_shouldShowAttachmentsView",null),e([c()],B.prototype,"_showClearSelectionAction",null),e([c()],B.prototype,"_showColumnsVisibilityAction",null),e([c()],B.prototype,"_showDeleteSelectionAction",null),e([c()],B.prototype,"_showExportSelectionToCSVAction",null),e([c()],B.prototype,"_showLayerDropdown",null),e([c()],B.prototype,"_shouldShowNavigationBar",null),e([c()],B.prototype,"_showRefreshDataAction",null),e([c()],B.prototype,"_showSelectedRecordsShowSelectedAction",null),e([c()],B.prototype,"_showSelectedRecordsShowAllAction",null),e([c()],B.prototype,"_showZoomToSelectionAction",null),e([c()],B.prototype,"_viewLayers",null),e([c()],B.prototype,"attachmentsList",void 0),e([c({readOnly:!0})],B.prototype,"grid",null),e([c()],B.prototype,"actionColumn",null),e([c()],B.prototype,"actionColumnConfig",null),e([c({readOnly:!0})],B.prototype,"activeFilters",null),e([c({readOnly:!0})],B.prototype,"activeSortOrders",null),e([c()],B.prototype,"allColumns",null),e([c({readOnly:!0})],B.prototype,"allRelatedTablesVisible",null),e([c()],B.prototype,"allVisibleColumns",null),e([c()],B.prototype,"attachmentsColumns",null),e([c()],B.prototype,"attachmentsEnabled",null),e([c()],B.prototype,"attachmentsViewOptions",null),e([c({type:g})],B.prototype,"attributeTableTemplate",null),e([c()],B.prototype,"autoRefreshEnabled",null),e([c()],B.prototype,"clearPrompt",null),e([c()],B.prototype,"columnPerformanceModeEnabled",null),e([c()],B.prototype,"columnReorderingEnabled",null),e([c({readOnly:!0})],B.prototype,"columns",null),e([c()],B.prototype,"definitionExpression",null),e([c()],B.prototype,"description",void 0),e([c()],B.prototype,"disabled",void 0),e([c()],B.prototype,"editingEnabled",null),e([c()],B.prototype,"effectiveSize",null),e([c()],B.prototype,"effectiveTable",null),e([c()],B.prototype,"fieldColumns",null),e([c()],B.prototype,"filterGeometry",null),e([c()],B.prototype,"filterBySelectionEnabled",null),e([c()],B.prototype,"groupColumns",null),e([c()],B.prototype,"hiddenFields",null),e([c()],B.prototype,"highlightEnabled",null),e([c()],B.prototype,"highlightIds",null),e([c()],B.prototype,"icon",null),e([c()],B.prototype,"initialSize",null),e([c()],B.prototype,"isQueryingOrSyncing",null),e([c()],B.prototype,"isSyncingAttachments",null),e([c()],B.prototype,"label",null),e([c()],B.prototype,"layer",null),e([c()],B.prototype,"layers",null),e([c()],B.prototype,"layerView",null),e([c()],B.prototype,"maxSize",null),e([c(),x("esri/widgets/FeatureTable/t9n/FeatureTable")],B.prototype,"messages",null),e([c(),x("esri/t9n/common")],B.prototype,"messagesCommon",null),e([c(),x("esri/core/t9n/Units")],B.prototype,"messagesUnits",null),e([c(),x("esri/widgets/support/t9n/uriUtils")],B.prototype,"messagesURIUtils",null),e([c()],B.prototype,"menuConfig",null),e([c()],B.prototype,"multipleSelectionEnabled",null),e([c()],B.prototype,"multiSortEnabled",null),e([c()],B.prototype,"multipleSortPriority",null),e([c()],B.prototype,"navigationScale",void 0),e([c()],B.prototype,"noDataMessage",null),e([c()],B.prototype,"objectIds",null),e([c()],B.prototype,"outFields",null),e([c()],B.prototype,"pageCount",null),e([c()],B.prototype,"pageIndex",null),e([c()],B.prototype,"pageSize",null),e([c()],B.prototype,"paginationEnabled",null),e([c()],B.prototype,"prompt",null),e([c()],B.prototype,"relatedRecordsEnabled",null),e([c()],B.prototype,"relatedTable",null),e([c()],B.prototype,"relatedTables",null),e([c()],B.prototype,"relationship",null),e([c()],B.prototype,"relationshipColumnConfigs",null),e([c()],B.prototype,"relationshipColumns",null),e([c()],B.prototype,"relationshipConfig",null),e([c()],B.prototype,"relationshipInfos",null),e([c()],B.prototype,"returnGeometryEnabled",null),e([c()],B.prototype,"returnMEnabled",null),e([c()],B.prototype,"returnZEnabled",null),e([c()],B.prototype,"rowHighlightIds",null),e([c()],B.prototype,"selectionSource",null),e([c()],B.prototype,"showAllRelatedTables",null),e([c()],B.prototype,"showPrompt",null),e([c()],B.prototype,"showRelatedTableCallback",null),e([c()],B.prototype,"size",null),e([c({readOnly:!0})],B.prototype,"state",null),e([c()],B.prototype,"supportsAddAttachments",null),e([c()],B.prototype,"supportsAttachments",null),e([c()],B.prototype,"supportsDeleteAttachments",null),e([c()],B.prototype,"supportsResizeAttachments",null),e([c()],B.prototype,"supportsUpdateAttachments",null),e([c()],B.prototype,"syncTemplateOnChangesEnabled",null),e([c({constructOnly:!0})],B.prototype,"tableController",null),e([c({constructOnly:!0})],B.prototype,"tableParent",null),e([c()],B.prototype,"tableTemplate",null),e([c()],B.prototype,"tableTemplateOverride",null),e([c()],B.prototype,"title",void 0),e([c()],B.prototype,"timeExtent",null),e([c()],B.prototype,"timeZone",null),e([c()],B.prototype,"view",null),e([c({type:M}),D(["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder","show-related-table"])],B.prototype,"viewModel",void 0),e([c()],B.prototype,"visibleColumns",null),e([c({type:C,nonNullable:!0})],B.prototype,"visibleElements",void 0),e([c({type:C})],B.prototype,"visibleElementsOverride",null),B=z=e([d("esri.widgets.FeatureTable")],B);const N=B;export{N as default};
5
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{isSome as i}from"../core/arrayUtils.js";import{watch as l,on as o,sync as n,initial as s}from"../core/reactiveUtils.js";import{renderingSanitizer as a}from"../core/sanitizerUtils.js";import{formatFileSize as r}from"../core/unitFormatUtils.js";import{property as c,subclass as d}from"../core/accessorSupport/decorators.js";import{isLayerFromCatalog as h}from"../layers/catalog/catalogUtils.js";import{isKnowledgeGraphLayer as m,isMapImageLayer as p,isSubtypeGroupLayer as u}from"../layers/support/layerUtils.js";import g from"../tables/AttributeTableTemplate.js";import w from"./Widget.js";import{isSupportedImage as b,getCalciteIconForAttachment as v}from"./Attachments/support/attachmentUtils.js";import{loadPromptComponents as y,Prompt as f}from"./Editor/components/Prompt.js";import _ from"./FeatureTable/ColumnMenuVisibleElements.js";import M from"./FeatureTable/FeatureTableViewModel.js";import C from"./FeatureTable/VisibleElements.js";import{isGroupColumn as A}from"./FeatureTable/support/columnUtils.js";import{loadFieldColumnComponents as S,isIFeatureTableSupportedLayer as T,isIFeatureTableSupportedLayerWithAttachments as E,getRelationshipIdsToShow as V}from"./FeatureTable/support/tableUtils.js";import{loadCalciteComponents as I}from"./support/componentsUtils.js";import{globalCss as R}from"./support/globalCss.js";import{getIconForLayer as k}from"./support/iconUtils.js";import{messageBundle as x,vmEvent as D,tsx as P}from"./support/widget.js";import{storeNode as O,discardNode as F}from"./support/widgetUtils.js";var z;const L="esri-feature-table",j=`${L}__attachments-view`,U={base:L,content:`${L}__content`,menuPopover:`${L}__menu-popover`,layerDropdownMenu:`${L}__layer-switcher-menu`,tableContainer:`${L}__table-container`,tableContainerWithAttachments:`${L}__table-container--attachments`,tableNavigation:`${L}__table-navigation`,attachmentsView:j,attachmentsViewContent:`${j}__content`,attachmentsViewDropArea:`${j}__drop-area`,attachmentsViewIcon:`${j}__icon`,attachmentsViewInformation:`${j}__information`,attachmentsViewList:`${j}__list`,attachmentsViewListFileSize:`${j}__list__filesize`,attachmentsViewListItemDelete:`${j}__list-item--delete`,attachmentsViewListThumbnail:`${j}__list__thumbnail`,expanded:`${L}__expanded`,collapsed:`${L}__collapsed`},$={chevronRight:"chevron-right",clearSelection:"clear-selection",downloadTo:"download-to",exclamationMarkTriangle:"exclamation-mark-triangle",exportToCSV:"file-csv",folderOpen:"folder-open",delete:"trash",launch:"launch",layers:"layers",moveUp:"move-up",plus:"plus",refresh:"refresh",replaceImage:"replace-image",save:"save",showAll:"selection-x",showColumn:"show-column",showSelected:"selection-filter",upload:"upload",zoomToSelection:"zoom-to-object"};let B=z=class extends w{constructor(e,t){super(e,t),this._attachmentsInput=null,this._columnVisibilityActions=new Map,this.attachmentsList=null,this.description=null,this.disabled=!1,this.navigationScale="m",this.title=null,this.viewModel=new M,this.visibleElements=new C,this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([l(()=>[this.isQueryingOrSyncing,this.editingEnabled],()=>this.scheduleRender()),l(()=>[this._effectiveVisibleElements,this._effectiveVisibleElements.columnDescriptions,this._effectiveVisibleElements.columnMenus,this._effectiveVisibleElements.columnMenuItems,this.columns.length],()=>{this.columns.forEach(e=>e.visibleElements=this._effectiveVisibleElements),this.refreshCellContent()},n),l(()=>this._effectiveVisibleElements.selectionColumn,e=>{this.grid&&(this.grid.selectionColumnEnabled=e)},s),o(()=>this.viewModel,"show-related-table",e=>this._onShowRelatedTable(e)),l(()=>this.editingEnabled,()=>{const{attachmentsViewOptions:e}=this;this.clearPrompt(),e&&(e.form?.reset(),e.candidates=null)})])}loadDependencies(){return Promise.all([I({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),alert:()=>import("@esri/calcite-components/dist/components/calcite-alert"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),pagination:()=>import("@esri/calcite-components/dist/components/calcite-pagination"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")}),y(),S()])}destroy(){this.drainRelatedTables(),this.clearPrompt()}get _effectiveDescription(){const{description:e}=this;return null!=e?a.sanitize("function"==typeof e?e():e):void 0}get _effectiveLayers(){const{layer:e,layers:t}=this,i=t?.length?t.filter(T):[],l=i.length?i:[...this._viewLayers];return e&&!l.includes(e)&&l.push(e),l}get _effectiveTitle(){const{layer:e,messages:i,state:l,highlightIds:o,title:n,size:s}=this;if(n)return a.sanitize("function"==typeof n?n():n);if(!e)return i.noLayer;switch(l){case"disabled":return i.errorLayer;case"ready":case"loading":return i.loading;case"error":return i.errorData}return t(i.header,{title:a.sanitize(e.title),count:s,selected:o.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}get _filteredTables(){const e=this.relatedTables.toArray(),t=1===e.length;return this.allRelatedTablesVisible?e:t?[e[0]]:this._shouldShowAttachmentsView?e.slice(-1):e.slice(-2)}get _hasAttachmentsViewError(){return null!=this.attachmentsViewOptions.error}get _hasCustomMenuItems(){return!!this.menuConfig?.items?.length}get _hasDefaultMenuItems(){return!!(this._showClearSelectionAction||this._showDeleteSelectionAction||this._showExportSelectionToCSVAction||this._showRefreshDataAction||this._showZoomToSelectionAction||this._showSelectedRecordsShowSelectedAction||this._showSelectedRecordsShowAllAction||this._showColumnsVisibilityAction)}get _shouldShowGrid(){return this.allRelatedTablesVisible||1===this.relatedTables.length&&!this._shouldShowAttachmentsView}get _shouldShowMenu(){const{header:e,menu:t}=this._effectiveVisibleElements;return!(!e||!t||!this._hasDefaultMenuItems&&!this._hasCustomMenuItems)}get _shouldShowAttachmentsView(){return!(null==this.attachmentsViewOptions.objectId&&!this.relatedTables.some(e=>null!=e.attachmentsViewOptions.objectId))}get _showClearSelectionAction(){return!(!this.highlightIds.length||!this._effectiveVisibleElements.menuItems?.clearSelection||this.relatedTables.length||this._shouldShowAttachmentsView)}get _showColumnsVisibilityAction(){const{header:e,menu:t,menuItems:i}=this._effectiveVisibleElements;return!(!(e&&t&&i?.toggleColumns)||this.showRelatedTableCallback||this.allRelatedTablesVisible||this._shouldShowAttachmentsView)}get _showDeleteSelectionAction(){return!(!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete)||this.relatedTables.length||this._shouldShowAttachmentsView)}get _showExportSelectionToCSVAction(){return!(!(this._effectiveVisibleElements.menuItems.exportSelectionToCSV&&this.layer&&this.highlightIds.length)||this.relatedTables.length)}get _showLayerDropdown(){return!(!this._effectiveLayers.length||!this._effectiveVisibleElements.layerDropdown)}get _shouldShowNavigationBar(){const e=!!this.relatedTable||this._shouldShowAttachmentsView;return!this.tableParent&&e}get _showRefreshDataAction(){return!!this._effectiveVisibleElements.menuItems?.refreshData}get _showSelectedRecordsShowSelectedAction(){const e=this.objectIds.length,t=this.highlightIds.length;return!(!t||!this._effectiveVisibleElements.menuItems?.selectedRecordsShowSelectedToggle||e&&t===e||this.relatedTables.length||this._shouldShowAttachmentsView)}get _showSelectedRecordsShowAllAction(){return!(!this._effectiveVisibleElements.menuItems?.selectedRecordsShowAllToggle||!this.objectIds.length||this.relatedTables.length)}get _showZoomToSelectionAction(){return!(!this.view||!this.highlightIds.length||this.effectiveTable.layer?.isTable||!this._effectiveVisibleElements.menuItems?.zoomToSelection)}get _viewLayers(){const e=this.view?.map;if(!e)return[];const t=new Set,i=e=>{!T(e)||u(e)||t.has(e)||"sublayer"===e.type&&!e.capabilities?.operations?.supportsQuery||(e.load(),t.add(e))},l=e=>{h(e)||"catalog-footprint"===e.type||(m(e)?(e.load(),e.layers?.forEach(i),e.tables?.forEach(i)):p(e)?(e.loadAll(),e.allSublayers?.forEach(i),e.subtables?.forEach(i)):u(e)?(e.loadAll(),e.sublayers?.forEach(i)):i(e))};return e.allLayers.forEach(l),e.allTables.forEach(l),[...t.values()]}get grid(){return this.viewModel.grid}get actionColumn(){return this.viewModel.actionColumn}get actionColumnConfig(){return this.viewModel.actionColumnConfig}set actionColumnConfig(e){this.viewModel.actionColumnConfig=e}get activeFilters(){return this.viewModel.activeFilters}get activeSortOrders(){return this.viewModel.activeSortOrders}get allColumns(){return this.viewModel.allColumns}get allRelatedTablesVisible(){return this.viewModel.allRelatedTablesVisible}get allVisibleColumns(){return this.viewModel.allVisibleColumns}get attachmentsColumns(){return this.viewModel.attachmentsColumns}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get attachmentsViewOptions(){return this.viewModel.attachmentsViewOptions}set attachmentsViewOptions(e){this.viewModel.attachmentsViewOptions=e}get attributeTableTemplate(){return this.viewModel.attributeTableTemplate}set attributeTableTemplate(e){this.viewModel.attributeTableTemplate=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=e}get clearPrompt(){return this.viewModel.clearPrompt}set clearPrompt(e){this.viewModel.clearPrompt=e}get columnPerformanceModeEnabled(){return this.viewModel.columnPerformanceModeEnabled}set columnPerformanceModeEnabled(e){this.viewModel.columnPerformanceModeEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get columns(){return this.viewModel.columns}get definitionExpression(){return this.viewModel.definitionExpression}set definitionExpression(e){this.viewModel.definitionExpression=e}get container(){return super.container}set container(e){super.container=e}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveSize(){return this.viewModel.effectiveSize}get effectiveTable(){return this.relatedTable||this}get fieldColumns(){return this.viewModel.fieldColumns}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(e){this.viewModel.filterGeometry=e}get filterBySelectionEnabled(){return this.viewModel.filterBySelectionEnabled}set filterBySelectionEnabled(e){this.viewModel.filterBySelectionEnabled=e}get groupColumns(){return this.viewModel.groupColumns}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(e){this.viewModel.hiddenFields=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get icon(){return"table"}set icon(e){this._overrideIfSome("icon",e)}get initialSize(){return this.viewModel.initialSize}set initialSize(e){this.viewModel.initialSize=e}get isQueryingOrSyncing(){return this.viewModel.isQueryingOrSyncing}get isSyncingAttachments(){return this.viewModel.isSyncingAttachments}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}get layerView(){return this.viewModel.layerView}get maxSize(){return this.viewModel.maxSize}set maxSize(e){this.viewModel.maxSize=e}get messages(){return this.viewModel.messages}set messages(e){this.viewModel.messages=e}get messagesCommon(){return this.viewModel.messagesCommon}set messagesCommon(e){this.viewModel.messagesCommon=e}get messagesUnits(){return this.viewModel.messagesUnits}set messagesUnits(e){this.viewModel.messagesUnits=e}get messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(e){this.viewModel.messagesURIUtils=e}get menuConfig(){return this.viewModel.menuConfig}set menuConfig(e){this.viewModel.menuConfig=e}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get multipleSortPriority(){return this.viewModel.multipleSortPriority}set multipleSortPriority(e){this.viewModel.multipleSortPriority=e}get noDataMessage(){return this.viewModel.noDataMessage}set noDataMessage(e){this.viewModel.noDataMessage=e}get objectIds(){return this.viewModel.objectIds}set objectIds(e){this.viewModel.objectIds=e}get outFields(){return this.viewModel.outFields}set outFields(e){this.viewModel.outFields=e}get pageCount(){return this.viewModel.pageCount}get pageIndex(){return this.viewModel.pageIndex}set pageIndex(e){this.viewModel.pageIndex=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get paginationEnabled(){return this.viewModel.paginationEnabled}set paginationEnabled(e){this.viewModel.paginationEnabled=e}get prompt(){return this.viewModel.prompt}set prompt(e){this.viewModel.prompt=e}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get relatedTable(){return this.viewModel.relatedTable}get relatedTables(){return this.viewModel.relatedTables}set relatedTables(e){this.viewModel.relatedTables=e}get relationship(){return this.viewModel.relationship}get relationshipColumnConfigs(){return this.viewModel.relationshipColumnConfigs}set relationshipColumnConfigs(e){this.viewModel.relationshipColumnConfigs=e}get relationshipColumns(){return this.viewModel.relationshipColumns}get relationshipConfig(){return this.viewModel.relationshipConfig}set relationshipConfig(e){this.viewModel.relationshipConfig=e}get relationshipInfos(){return this.viewModel.relationshipInfos}get returnGeometryEnabled(){return this.viewModel.returnGeometryEnabled}set returnGeometryEnabled(e){this.viewModel.returnGeometryEnabled=e}get returnMEnabled(){return this.viewModel.returnMEnabled}set returnMEnabled(e){this.viewModel.returnMEnabled=e}get returnZEnabled(){return this.viewModel.returnZEnabled}set returnZEnabled(e){this.viewModel.returnZEnabled=e}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(e){this.viewModel.rowHighlightIds=e}get selectionSource(){return this.viewModel.selectionSource}set selectionSource(e){this.viewModel.selectionSource=e}get showAllRelatedTables(){return this.viewModel.showAllRelatedTables}set showAllRelatedTables(e){this.viewModel.showAllRelatedTables=e}get showPrompt(){return this.viewModel.showPrompt}set showPrompt(e){this.viewModel.showPrompt=e}get showRelatedTableCallback(){return this.viewModel.showRelatedTableCallback}set showRelatedTableCallback(e){this.viewModel.showRelatedTableCallback=e}get size(){return this.viewModel.size}get state(){return this.viewModel.state}get supportsAddAttachments(){return this.viewModel.supportsAddAttachments}get supportsAttachments(){return this.viewModel.supportsAttachments}get supportsDeleteAttachments(){return this.viewModel.supportsDeleteAttachments}get supportsResizeAttachments(){return this.viewModel.supportsResizeAttachments}get supportsUpdateAttachments(){return this.viewModel.supportsUpdateAttachments}get syncTemplateOnChangesEnabled(){return this.viewModel.syncTemplateOnChangesEnabled}set syncTemplateOnChangesEnabled(e){this.viewModel.syncTemplateOnChangesEnabled=e}get tableController(){return this.viewModel.tableController}set tableController(e){this.viewModel.tableController=e}get tableParent(){return this.viewModel.tableParent}set tableParent(e){this.viewModel.tableParent=e}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(e){this.viewModel.tableTemplate=e}get tableTemplateOverride(){return this.viewModel.tableTemplateOverride}set tableTemplateOverride(e){this.viewModel.tableTemplateOverride=e}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visibleColumns(){return this.viewModel.visibleColumns}get visibleElementsOverride(){const{attachmentsViewOptions:e,relatedTable:t,tableController:i,visibleElements:l}=this,{columnDescriptions:o,columnMenus:n,tooltips:s}=l,a=null!=e.objectId;if(t)return new C({columnDescriptions:o,columnMenus:n,tooltips:s,close:l.close,header:l.header,layerDropdown:l.layerDropdown,layerDropdownIcons:l.layerDropdownIcons,menu:l.menu,menuItems:l.menuItems,progress:l.progress,selectionColumn:!1,columnMenuItems:new _({sortAscending:!1,sortDescending:!1})});if(i){const e=i.relatedTable===this,t=i.allRelatedTablesVisible,r=e&&l.selectionColumn&&!t&&!a,c=e&&!t&&!a;return new C({columnDescriptions:o,columnMenus:n,tooltips:s,selectionColumn:r,close:!1,header:!1,layerDropdown:!1,menu:!1,progress:!1,columnMenuItems:new _({sortAscending:c,sortDescending:c})})}return a?new C({columnDescriptions:o,columnMenus:n,tooltips:s,close:l.close,header:l.header,layerDropdown:l.layerDropdown,layerDropdownIcons:l.layerDropdownIcons,menu:l.menu,menuItems:l.menuItems,progress:l.progress,selectionColumn:!1,columnMenuItems:new _({sortAscending:!1,sortDescending:!1})}):null}clearSelectionFilter(){this.viewModel.clearSelectionFilter()}async deleteAttachments(e,t,i){null!=e&&t?.length&&(i?this._showDeleteAttachmentPrompt(e,t):await this.viewModel.deleteAttachments(e,t))}deleteSelection(e){return this.highlightIds.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}async downloadAttachmentById(e,t){return this.viewModel.downloadAttachmentById(e,t)}drainRelatedTables(){this.viewModel.drainRelatedTables()}exportSelectionToCSV(e){return this.viewModel.exportSelectionToCSV(e)}filterBySelection(){this.viewModel.filterBySelection()}findColumn(e){return this.viewModel.findColumn(e)}goToPage(e){this.viewModel.goToPage(e)}hideColumn(e){this.grid?.hideColumn(e)}nextPage(){this.viewModel.nextPage()}previousPage(){this.viewModel.previousPage()}async refresh(){await this.viewModel.refresh()}refreshCellContent(){this.viewModel.refreshCellContent()}async saveAttachmentsViewForm(){await this.viewModel.saveAttachmentsViewForm()}showAllColumns(){this.viewModel.showAllColumns()}showColumn(e){this.grid?.showColumn(e)}sortColumn(e,t){this.viewModel.sortColumn(e,t)}scrollLeft(){this.viewModel.scrollLeft()}scrollToBottom(){this.viewModel.scrollToBottom()}scrollToIndex(e){this.viewModel.scrollToIndex(e)}scrollToRow(e){this.viewModel.scrollToRow(e)}scrollToTop(){this.viewModel.scrollToTop()}toggleColumnVisibility(e){this.viewModel.toggleColumnVisibility(e)}zoomToSelection(){this.effectiveTable.viewModel.zoomToSelection()}render(){const{_effectiveVisibleElements:e,isQueryingOrSyncing:t,menuConfig:i,state:l}=this;return P("div",{bind:this,class:this.classes(U.base,R.widget)},P("calcite-panel",{bind:this,class:U.content,closable:e.close,description:this._effectiveDescription,disabled:this.disabled||"disabled"===l&&!this._effectiveLayers?.length,heading:e.header?this._effectiveTitle:void 0,key:"table-content",loading:"loading"===l,menuOpen:!!i?.open,overlayPositioning:"fixed",onCalcitePanelClose:e=>{e.currentTarget.closed=!1,this.emit("close")}},e.progress?P("calcite-progress",{type:t?"indeterminate":"determinate"}):null,this._showLayerDropdown?this._renderLayerDropdown():null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderNavigationBar(),this._renderTables(),this._renderError()),this._renderColumnVisibilityPopover(),this._renderPrompt())}_renderTables(){const{grid:e,relatedTables:t}=this,i=this.classes(U.tableContainer);if(t.length){const l=this.classes(U.base,this.allRelatedTablesVisible?U.expanded:U.collapsed,this._shouldShowAttachmentsView?U.tableContainerWithAttachments:void 0);return P("div",{class:i},P("calcite-panel",{overlayPositioning:"fixed"},P("div",null,[this._shouldShowGrid?P("div",{class:l},e?.render(),this._renderPagination()):void 0,...this._filteredTables.map(e=>{const i=t.indexOf(e);return P("div",{class:l,key:`related-${i}`},e.render())}),,])))}return null!=this.attachmentsViewOptions.objectId?P("div",{class:i},P("calcite-panel",{overlayPositioning:"fixed"},P("div",null,[P("div",{class:this.classes(U.base,U.collapsed)},e?.render(),this._renderPagination()),this._renderAttachmentsView()]))):[P("div",{class:i},e?.render()),this._renderPagination()]}_renderPagination(){if(this.paginationEnabled)return P("calcite-pagination",{pageSize:1,startItem:this.pageIndex+1,totalItems:this.pageCount,onCalcitePaginationChange:e=>this.goToPage(e.currentTarget.startItem-1)})}_renderError(){const{messages:e}=this;return P("calcite-alert",{autoClose:!0,autoCloseDuration:"fast",icon:$.exclamationMarkTriangle,kind:"danger",label:e.errorOccured,open:this._hasAttachmentsViewError,slot:"alerts",onCalciteAlertClose:()=>{this.attachmentsViewOptions.error=null}},P("span",{slot:"message"},e.errorOccured))}_renderPrompt(){return this.prompt?P(f,{...this.prompt,headingLevel:2}):void 0}_showDeletePrompt(){const{messages:e,messagesCommon:i}=this,l=t(e.deleteSelectionCount,{count:this.highlightIds.length});this.showPrompt({title:l,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:i.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,action:()=>this.clearPrompt()}}})}_showDeleteAttachmentPrompt(e,i){const{messages:l,messagesCommon:o}=this,n=t(l.deleteAttachmentCount,{count:i.length});this.showPrompt({title:n,message:l.deleteAttachmentConfirmation,context:"danger",actions:{primary:{label:o.delete,action:async()=>{try{await this.deleteAttachments(e,i,!1)}finally{this.clearPrompt()}}},secondary:{label:o.cancel,action:()=>this.clearPrompt()}}})}async _onDeleteSelectionClick(){try{await this.viewModel.deleteSelection()}finally{this.clearPrompt()}}_renderHeaderMenuAction(e){const{disabled:t,hidden:i,icon:l,text:o,clickFunction:n}=e;if(!i)return P("calcite-action",{disabled:t??this.menuConfig?.disabled,icon:l??void 0,key:o,onclick:()=>n(),slot:"header-menu-actions",text:o,textEnabled:!0,title:o})}_renderHeaderMenuActions(){return this._shouldShowMenu?[this._renderDefaultHeaderMenuActions(),this._renderCustomHeaderMenuActions()]:[]}_renderDefaultHeaderMenuActions(){if(!this._hasDefaultMenuItems)return[];const{messages:e}=this;return[this._showRefreshDataAction&&{icon:$.refresh,text:e.refreshData,clickFunction:()=>this.refresh()},this._showDeleteSelectionAction&&{icon:$.delete,text:e.deleteSelection,clickFunction:()=>this.deleteSelection(!0)},this._showClearSelectionAction&&{icon:$.clearSelection,text:e.clearSelection,clickFunction:()=>this.highlightIds?.removeAll()},this._showZoomToSelectionAction&&{icon:$.zoomToSelection,text:e.zoomToSelection,clickFunction:()=>this.zoomToSelection()},this._showSelectedRecordsShowSelectedAction&&{icon:$.showSelected,text:e.showSelected,clickFunction:()=>{const{objectIds:e}=this;e.removeAll(),e.addMany(this.highlightIds.toArray())}},this._showSelectedRecordsShowAllAction&&{icon:$.showAll,text:e.showAllRecords,clickFunction:()=>this.objectIds.removeAll()},this._showExportSelectionToCSVAction&&{icon:$.exportToCSV,text:e.exportSelectionCSV,clickFunction:()=>this.exportSelectionToCSV()}].filter(i).map(e=>e&&this._renderHeaderMenuAction(e))}_renderCustomHeaderMenuActions(){return this.menuConfig?.items?.map(({disabled:e,hidden:t,icon:i,label:l,clickFunction:o})=>this._renderHeaderMenuAction({hidden:"function"==typeof t?t():t,icon:i,text:l,disabled:e,clickFunction:e=>o(e)}))??[]}_renderColumnVisibilityAction(){if(!this._showColumnsVisibilityAction)return[];const{_columnVisibilityActions:e,effectiveTable:t,id:i}=this,l=this.messages.toggleColumns;return P("calcite-action",{afterCreate:t=>e.set(i,t),afterRemoved:()=>e.delete(i),appearance:"transparent",bind:this,disabled:t.menuConfig?.disabled,icon:$.showColumn,id:`${i}__toggle-columns-action`,slot:"header-actions-end",text:l},this._effectiveVisibleElements.tooltips?P("calcite-tooltip",{closeOnClick:!0,overlayPositioning:"fixed",placement:"bottom-end",slot:"tooltip"},l):null)}_renderColumnVisibilityPopover(){if(!this._showColumnsVisibilityAction||this.effectiveTable.menuConfig?.disabled)return;const{effectiveTable:e}=this,t=this.messages.toggleColumns;return P("calcite-popover",{autoClose:!0,class:U.menuPopover,label:t,overlayPositioning:"fixed",placement:"top-end",pointerDisabled:!0,referenceElement:this._columnVisibilityActions.get(this.id)},P("calcite-list",{displayMode:"nested",filterEnabled:!0,filterPlaceholder:t,label:t,selectionMode:"multiple"},e.columns.toArray().map(t=>{const i=A(t)?t.columns?.map(t=>this._renderColumnListItem({column:t,table:e,ignoreSelect:!0})):void 0;return this._renderColumnListItem({column:t,table:e,items:i})})))}_renderColumnListItem(e){const{column:t,table:i,items:l,ignoreSelect:o}=e,{effectiveLabel:n,fieldName:s,hidden:a}=t;return P("calcite-list-item",{expanded:!(!l?.length||a)||void 0,key:`toggle-columns__item-${s}`,label:n,selected:!a,value:s,onCalciteListItemSelect:e=>{o&&e.stopPropagation(),i.toggleColumnVisibility(e.currentTarget.value)}},l)}_renderLayerDropdown(){const e=this.messages.selectALayer;return P("div",{class:U.layerDropdownMenu,key:`${this.id}-layerDropdown`,slot:"header-actions-start"},P("calcite-dropdown",{bind:this,maxItems:5,overlayPositioning:"fixed",placement:"bottom-start"},P("calcite-action",{icon:$.layers,slot:"trigger",text:e,title:e}),P("calcite-dropdown-group",{selectionMode:"single"},this._effectiveLayers.map((e,t)=>this._renderLayerDropdownItem(e,t))??null)))}_renderLayerDropdownItem(e,t){const i=this.visibleElements.layerDropdownIcons;return P("calcite-dropdown-item",{iconStart:i?k(e):void 0,key:`dropdown-item-${t}`,label:e.title??"",selected:e===this.layer,value:e.id,onCalciteDropdownItemSelect:()=>{this.layer=e}},e.title)}_onRelatedNavigationItemClick(e){this.viewModel.drainRelatedTablesAboveIndex(e)}_collapseRelatedTable(e){this.viewModel.collapseRelatedTable(this.effectiveTable,e)}_onShowRelatedTable(e){this.showRelatedTableCallback||(this._collapseRelatedTable(e),this._createRelatedTable(e))}async _createRelatedTable(e){const{editingEnabled:t,effectiveTable:i,paginationEnabled:l,pageSize:o,view:n,viewModel:s}=this,{layer:a,objectId:r,relatedLayer:c,relationshipId:d}=e;await a.load();const h=this.attachmentsEnabled&&E(a),m=new z({layer:a,attachmentsEnabled:h,editingEnabled:t,paginationEnabled:l,pageSize:o,relatedRecordsEnabled:!0,relationshipConfig:{objectId:r,relatedLayer:c,relationshipId:d},relationshipColumnConfigs:V(a,d),tableController:this,tableParent:i,view:n,showRelatedTableCallback:e=>s.emit("show-related-table",e)});this.relatedTables.add(m),this.scheduleRender()}_renderAttachmentsView(){const{attachmentInfos:e,mode:t,objectId:i}=this.attachmentsViewOptions;return"file"!==t&&e.length&&null!=i?this._renderAttachmentsViewList():this._renderAttachmentsViewFilePane()}_renderAttachmentsViewFilePane(){const{attachmentsViewOptions:e,isSyncingAttachments:t,supportsAddAttachments:i,messages:l,messagesUnits:o}=this,{attachmentId:n,attachmentInfos:s,candidates:a,objectId:c}=e,d=s.find(e=>e.id===n),h=s.length,m=a?.length,p=d?P("calcite-label",{alignment:"center",key:"replace-file-node",scale:"l"},l.replaceFile):void 0,u=m?void 0:P("calcite-label",{alignment:"center",key:"message-node",scale:"m"},i?null==c?l.noFeature:l.dragAndDropToUpload:l.editingRestricted),g=Array.from(a??[]).pop(),w=g?P("calcite-label",{key:"filename-node"},g.name):void 0,b=i&&null!=c,v=b&&m,y=P("input",{afterCreate:O,afterRemoved:F,afterUpdate:O,bind:this,"data-node-ref":"_attachmentsInput",files:a,hidden:!0,name:"attachment",onchange:e=>this._onAttachmentsViewCandidateChange(e),type:"file"}),f=b?P("calcite-button",{appearance:"outline-fill",bind:this,disabled:t,iconStart:$.folderOpen,key:"select-node",loading:!1,onclick:()=>{this._attachmentsInput&&(this._attachmentsInput.value="",this._attachmentsInput.click())},width:"full"},l.selectFile):void 0,_=v?P("calcite-button",{appearance:"outline-fill",bind:this,disabled:t,iconStart:$.save,key:"save-node",loading:t,onclick:()=>{this.saveAttachmentsViewForm()},width:"full"},d?l.updateAttachment:l.addAttachment):void 0,M=h||m?P("calcite-button",{appearance:"transparent",bind:this,disabled:t,key:"cancel-node",onclick:()=>{this._attachmentsInput&&(this._attachmentsInput.value=""),e.reset(),e.attachmentInfos?.length&&(e.mode="list")},width:"full"},this.messagesCommon.cancel):void 0;return[P("div",{class:U.attachmentsView,key:"attachments-view"},P("div",{class:U.attachmentsViewContent,key:"attachments-view-content"},P("div",{bind:this,class:U.attachmentsViewDropArea,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop},P("calcite-icon",{class:U.attachmentsViewIcon,icon:$.upload,scale:"l"}),p,u,P("form",{afterCreate:t=>e.form=t,afterRemoved:()=>e.form=null,bind:this,key:"attachments-form"},P("fieldset",null,w,y,f,_,M)))),null!=c&&null!=d?P("div",{class:U.attachmentsViewInformation,key:"information"},this._renderAttachmentsViewThumbnail(d,200),P("label",{key:"file-label"},l.fileName),P("span",{key:"file-span"},d.name),P("label",{key:"size-label"},l.size),P("span",{key:"size-span"},r(o,d.size??0))):void 0)]}_renderAttachmentsViewList(){const{attachmentsViewOptions:e,isSyncingAttachments:t,messages:i,messagesUnits:l,supportsDeleteAttachments:o,supportsUpdateAttachments:n}=this,{attachmentInfos:s,objectId:a}=e;return P("calcite-list",{afterCreate:O,afterRemoved:F,afterUpdate:O,bind:this,class:U.attachmentsViewList,"data-node-ref":"attachmentsList",key:`attachments-list-${a}`,label:i?.attachments,loading:t,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop,selectionMode:"multiple",onCalciteListChange:()=>this.scheduleRender()},...s?.map(t=>{const{id:s,name:c,size:d,url:h}=t,m=r(l,d??0);return P("calcite-list-item",{afterRemoved:()=>this.scheduleRender(),key:`attachment-${s}`,label:c,value:s},this._renderAttachmentsViewListThumbnail(t),P("span",{class:U.attachmentsViewListFileSize,slot:"actions-end",title:m},m),P("calcite-action",{appearance:"transparent",icon:$.downloadTo,key:`download-attachment-${s}`,label:`${c}`,onclick:e=>{e.preventDefault(),this.downloadAttachmentById(a??-1,s)},slot:"actions-end",text:i.downloadAttachment,title:i.downloadAttachment}),n&&null!=a?P("calcite-action",{appearance:"transparent",disabled:!n,icon:$.replaceImage,key:`replace-attachment-${s}`,label:`${c}`,onclick:()=>{e.mode="file",e.attachmentId=s},slot:"actions-end",text:i.updateAttachment,title:i.updateAttachment}):void 0,P("calcite-action",{appearance:"transparent",icon:$.launch,key:`launch-attachment-${s}`,label:`${c}`,onclick:()=>{h&&window.open(h,"_blank")},slot:"actions-end",text:i.viewAttachment,title:i.viewAttachment}),o&&null!=a?P("calcite-action",{appearance:"transparent",class:U.attachmentsViewListItemDelete,disabled:!o,icon:$.delete,key:`delete-attachment-${s}`,label:`${c}`,onclick:()=>{this.deleteAttachments(a,[s],!0)},slot:"actions-end",text:i.deleteAttachment,title:i.deleteAttachment}):void 0)}))}_renderAttachmentsViewListThumbnail(e){return P("div",{class:U.attachmentsViewListThumbnail,slot:"content-start"},P("a",{href:e.url??"",rel:"noreferrer",target:"_blank"},this._renderAttachmentsViewThumbnail(e)))}_renderAttachmentsViewThumbnail(e,t=64){const{contentType:i,name:l,size:o,url:n}=e,s=`${n}${n?.includes("?")?"&":"?"}w=${t}&s=${o}`;return this.supportsResizeAttachments&&b(i)?P("img",{alt:l,key:`thumbnail-image-${l}`,src:s,title:l}):P("calcite-icon",{icon:v(i),key:`thumbnail-icon-${l}`,scale:"l",textLabel:l,title:l})}_onAttachmentsViewCandidateChange({target:e}){this.attachmentsViewOptions.candidates=e?.files}_onAttachmentsViewDrop(e){e.preventDefault(),(this.supportsAddAttachments||this.supportsUpdateAttachments)&&this.attachmentsViewOptions.set({mode:"file",candidates:e.dataTransfer?.files})}_renderNavigationBar(){const{effectiveTable:e,messages:i,messagesCommon:l,navigationScale:o,relatedTable:n,relatedTables:s}=this;if(!this._shouldShowNavigationBar)return;const{attachmentsList:a,attachmentsViewOptions:r,layer:c,supportsAddAttachments:d,supportsDeleteAttachments:h}=e;if(!c)return;const{attachmentInfos:m,objectId:p}=r,u=null!=p,g=m.length,w=a?.selectedItems?.length??0,b=`${c.objectIdField}: ${p}`,v=t(i.selectedCount,{count:w}),y=t(i.attachmentsCount,{count:g}),f=u?P("calcite-action",{bind:this,icon:$.chevronRight,iconFlipRtl:!0,key:"navigation-feature",onclick:()=>e.scrollToRow(p),scale:o,text:b,textEnabled:!0,title:b}):void 0,_=u?P("calcite-action",{icon:$.chevronRight,iconFlipRtl:!0,key:"navigation-attachments-label",label:y,onclick:()=>{g>0&&(r.mode="list")},scale:o,text:y,textEnabled:!0,title:y}):void 0,M=u?P("calcite-chip",{closable:!0,closed:0===w,key:"navigation-chip",kind:"inverse",label:v,scale:o,selected:!0,title:v,value:"selected",onCalciteChipClose:()=>a?.selectedItems?.forEach(e=>e.selected=!1)},v):void 0,C=n?P("calcite-label",{layout:"inline",scale:o},i.showAllTables,P("calcite-switch",{checked:this.allRelatedTablesVisible,scale:o,onCalciteSwitchChange:e=>this.showAllRelatedTables=!!e.currentTarget.checked})):void 0,A=u&&"list"===r.mode&&null!=p&&w&&h?P("calcite-action",{icon:$.delete,iconFlipRtl:!0,key:"attachments-trash-all",onclick:()=>{e.deleteAttachments(p,a?.selectedItems?.map(e=>e.value)??[],!0)},scale:o,text:l.delete,textEnabled:!0,title:t(i.deleteAttachmentCount,{count:w})}):void 0,S=u&&"list"===r.mode&&d?P("calcite-action",{bind:this,icon:$.plus,iconFlipRtl:!0,key:"attachments-add",onclick:()=>{r.attachmentId=null,r.mode="file"},scale:o,text:i.addAttachment,textEnabled:!0,title:i.addAttachment}):void 0;return P("div",{class:U.tableNavigation,key:"table-nav"},P("calcite-action",{icon:$.moveUp,iconFlipRtl:!0,key:"go-back",onclick:()=>{n&&this.drainRelatedTables(),e.attachmentsViewOptions.objectId=null},scale:o,text:this.layer?.title??"",textEnabled:!1,title:n?i.exitRelatedRecords:i.exitAttachments}),s.toArray().map((e,t)=>this._renderRelatedTableNavigationAction(e,t)),f,_,P("div",null,M,C,A,S))}_renderRelatedTableNavigationAction(e,t){const i=this._getLabelForRelatedTableNavigationAction(e);return P("calcite-action",{icon:$.chevronRight,iconFlipRtl:!0,key:t,onclick:()=>this._onRelatedNavigationItemClick(t),scale:this.navigationScale,text:i,textEnabled:!0,title:e.layer?.title||""})}_getLabelForRelatedTableNavigationAction(e){const t=e.layer?.title;if(!t)return"";const{relatedTables:i}=this;if(i.length<=1)return t;return i.indexOf(e)!==i.length-1&&t.length>20?`${t.slice(0,20)}...`:t}};e([c()],B.prototype,"_attachmentsInput",void 0),e([c()],B.prototype,"_columnVisibilityActions",void 0),e([c()],B.prototype,"_effectiveDescription",null),e([c()],B.prototype,"_effectiveLayers",null),e([c()],B.prototype,"_effectiveTitle",null),e([c()],B.prototype,"_effectiveVisibleElements",null),e([c()],B.prototype,"_filteredTables",null),e([c()],B.prototype,"_hasAttachmentsViewError",null),e([c()],B.prototype,"_hasCustomMenuItems",null),e([c()],B.prototype,"_hasDefaultMenuItems",null),e([c()],B.prototype,"_shouldShowGrid",null),e([c()],B.prototype,"_shouldShowMenu",null),e([c()],B.prototype,"_shouldShowAttachmentsView",null),e([c()],B.prototype,"_showClearSelectionAction",null),e([c()],B.prototype,"_showColumnsVisibilityAction",null),e([c()],B.prototype,"_showDeleteSelectionAction",null),e([c()],B.prototype,"_showExportSelectionToCSVAction",null),e([c()],B.prototype,"_showLayerDropdown",null),e([c()],B.prototype,"_shouldShowNavigationBar",null),e([c()],B.prototype,"_showRefreshDataAction",null),e([c()],B.prototype,"_showSelectedRecordsShowSelectedAction",null),e([c()],B.prototype,"_showSelectedRecordsShowAllAction",null),e([c()],B.prototype,"_showZoomToSelectionAction",null),e([c()],B.prototype,"_viewLayers",null),e([c()],B.prototype,"attachmentsList",void 0),e([c({readOnly:!0})],B.prototype,"grid",null),e([c()],B.prototype,"actionColumn",null),e([c()],B.prototype,"actionColumnConfig",null),e([c({readOnly:!0})],B.prototype,"activeFilters",null),e([c({readOnly:!0})],B.prototype,"activeSortOrders",null),e([c()],B.prototype,"allColumns",null),e([c({readOnly:!0})],B.prototype,"allRelatedTablesVisible",null),e([c()],B.prototype,"allVisibleColumns",null),e([c()],B.prototype,"attachmentsColumns",null),e([c()],B.prototype,"attachmentsEnabled",null),e([c()],B.prototype,"attachmentsViewOptions",null),e([c({type:g})],B.prototype,"attributeTableTemplate",null),e([c()],B.prototype,"autoRefreshEnabled",null),e([c()],B.prototype,"clearPrompt",null),e([c()],B.prototype,"columnPerformanceModeEnabled",null),e([c()],B.prototype,"columnReorderingEnabled",null),e([c({readOnly:!0})],B.prototype,"columns",null),e([c()],B.prototype,"definitionExpression",null),e([c()],B.prototype,"description",void 0),e([c()],B.prototype,"disabled",void 0),e([c()],B.prototype,"editingEnabled",null),e([c()],B.prototype,"effectiveSize",null),e([c()],B.prototype,"effectiveTable",null),e([c()],B.prototype,"fieldColumns",null),e([c()],B.prototype,"filterGeometry",null),e([c()],B.prototype,"filterBySelectionEnabled",null),e([c()],B.prototype,"groupColumns",null),e([c()],B.prototype,"hiddenFields",null),e([c()],B.prototype,"highlightEnabled",null),e([c()],B.prototype,"highlightIds",null),e([c()],B.prototype,"icon",null),e([c()],B.prototype,"initialSize",null),e([c()],B.prototype,"isQueryingOrSyncing",null),e([c()],B.prototype,"isSyncingAttachments",null),e([c()],B.prototype,"label",null),e([c()],B.prototype,"layer",null),e([c()],B.prototype,"layers",null),e([c()],B.prototype,"layerView",null),e([c()],B.prototype,"maxSize",null),e([c(),x("esri/widgets/FeatureTable/t9n/FeatureTable")],B.prototype,"messages",null),e([c(),x("esri/t9n/common")],B.prototype,"messagesCommon",null),e([c(),x("esri/core/t9n/Units")],B.prototype,"messagesUnits",null),e([c(),x("esri/widgets/support/t9n/uriUtils")],B.prototype,"messagesURIUtils",null),e([c()],B.prototype,"menuConfig",null),e([c()],B.prototype,"multipleSelectionEnabled",null),e([c()],B.prototype,"multiSortEnabled",null),e([c()],B.prototype,"multipleSortPriority",null),e([c()],B.prototype,"navigationScale",void 0),e([c()],B.prototype,"noDataMessage",null),e([c()],B.prototype,"objectIds",null),e([c()],B.prototype,"outFields",null),e([c()],B.prototype,"pageCount",null),e([c()],B.prototype,"pageIndex",null),e([c()],B.prototype,"pageSize",null),e([c()],B.prototype,"paginationEnabled",null),e([c()],B.prototype,"prompt",null),e([c()],B.prototype,"relatedRecordsEnabled",null),e([c()],B.prototype,"relatedTable",null),e([c()],B.prototype,"relatedTables",null),e([c()],B.prototype,"relationship",null),e([c()],B.prototype,"relationshipColumnConfigs",null),e([c()],B.prototype,"relationshipColumns",null),e([c()],B.prototype,"relationshipConfig",null),e([c()],B.prototype,"relationshipInfos",null),e([c()],B.prototype,"returnGeometryEnabled",null),e([c()],B.prototype,"returnMEnabled",null),e([c()],B.prototype,"returnZEnabled",null),e([c()],B.prototype,"rowHighlightIds",null),e([c()],B.prototype,"selectionSource",null),e([c()],B.prototype,"showAllRelatedTables",null),e([c()],B.prototype,"showPrompt",null),e([c()],B.prototype,"showRelatedTableCallback",null),e([c()],B.prototype,"size",null),e([c({readOnly:!0})],B.prototype,"state",null),e([c()],B.prototype,"supportsAddAttachments",null),e([c()],B.prototype,"supportsAttachments",null),e([c()],B.prototype,"supportsDeleteAttachments",null),e([c()],B.prototype,"supportsResizeAttachments",null),e([c()],B.prototype,"supportsUpdateAttachments",null),e([c()],B.prototype,"syncTemplateOnChangesEnabled",null),e([c({constructOnly:!0})],B.prototype,"tableController",null),e([c({constructOnly:!0})],B.prototype,"tableParent",null),e([c()],B.prototype,"tableTemplate",null),e([c()],B.prototype,"tableTemplateOverride",null),e([c()],B.prototype,"title",void 0),e([c()],B.prototype,"timeExtent",null),e([c()],B.prototype,"timeZone",null),e([c()],B.prototype,"view",null),e([c({type:M}),D(["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder","show-related-table"])],B.prototype,"viewModel",void 0),e([c()],B.prototype,"visibleColumns",null),e([c({type:C,nonNullable:!0})],B.prototype,"visibleElements",void 0),e([c({type:C})],B.prototype,"visibleElementsOverride",null),B=z=e([d("esri.widgets.FeatureTable")],B);const N=B;export{N as default};