@arcgis/core 4.31.0-next.20240821 → 4.31.0-next.20240822

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 (45) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{9443b9ec03f25c723c2c.js → 06d328c8aad32c52de97.js} +1 -1
  3. package/assets/esri/core/workers/chunks/203afe6dd0461d4bd774.js +278 -0
  4. package/assets/esri/core/workers/chunks/{cd9f48dcee2a1fc261ed.js → c5214a47690c594903d1.js} +25 -25
  5. package/assets/esri/themes/base/widgets/_Grid.scss +0 -8
  6. package/assets/esri/themes/base/widgets/_Print.scss +13 -15
  7. package/assets/esri/themes/dark/main.css +1 -1
  8. package/assets/esri/themes/light/main.css +1 -1
  9. package/assets/esri/themes/light/view.css +1 -1
  10. package/assets/esri/widgets/Print/t9n/Print.json +1 -1
  11. package/assets/esri/widgets/Print/t9n/Print_en.json +1 -1
  12. package/chunks/ComponentShader.glsl.js +29 -29
  13. package/chunks/DefaultMaterial.glsl.js +1 -1
  14. package/chunks/Path.glsl.js +22 -17
  15. package/exports/csv.js +1 -1
  16. package/interfaces.d.ts +37 -9
  17. package/package.json +1 -1
  18. package/support/revision.js +1 -1
  19. package/views/2d/support/highlightGroupUtils.js +1 -1
  20. package/views/3d/terrain/TerrainRenderer.js +1 -1
  21. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  22. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  23. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +2 -2
  24. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +3 -3
  25. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  26. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  27. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  28. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  29. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  30. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  31. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +8 -8
  32. package/views/3d/webgl-engine/shaders/Path.glsl.js +1 -1
  33. package/widgets/Feature/FeatureMedia.js +1 -1
  34. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  35. package/widgets/FeatureTable/Grid/Column.js +1 -1
  36. package/widgets/FeatureTable.js +1 -1
  37. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  38. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  39. package/widgets/Print/CustomTemplate.js +1 -1
  40. package/widgets/Print/PrintViewModel.js +1 -1
  41. package/widgets/Print/TemplateOptions.js +1 -1
  42. package/widgets/Print/utils.js +5 -0
  43. package/widgets/Print.js +1 -1
  44. package/widgets/support/exportUtils.js +1 -1
  45. package/assets/esri/core/workers/chunks/e5474bcde5b8fa037b56.js +0 -278
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import"../core/shaderLibrary/output/OutputDepth.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"./OutputColorHighlightOID.glsl.js";export{b as build}from"../../../../chunks/Path.glsl.js";
5
+ import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import"../core/shaderLibrary/output/OutputDepth.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"./OutputColorHighlightOID.glsl.js";export{b as build}from"../../../../chunks/Path.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{prefersReducedMotion as t}from"../../core/a11yUtils.js";import{watch as i,initial as r}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{getColorsFromRenderer as o}from"../../renderers/support/utils.js";import n from"../Widget.js";import l from"./FeatureMedia/FeatureMediaViewModel.js";import d from"./support/FeatureElementInfo.js";import{shouldOpenInNewTab as m}from"./support/featureUtils.js";import{loadCalciteComponents as c}from"../support/componentsUtils.js";import{isRTL as h}from"../support/widgetUtils.js";import{messageBundle as p}from"../support/decorators/messageBundle.js";import{tsx as u}from"../support/jsxFactory.js";import{isDarkTheme as f}from"../../support/themeUtils.js";import{substitute as _}from"../../intl/substitute.js";const v="esri-feature-media",g={base:v,mediaContainer:`${v}__container`,mediaItemContainer:`${v}__item-container`,mediaItem:`${v}__item`,mediaItemText:`${v}__item-text`,mediaItemTitle:`${v}__item-title`,mediaItemCaption:`${v}__item-caption`,mediaNavigation:`${v}__item-navigation`,mediaPagination:`${v}__pagination`,mediaPaginationText:`${v}__pagination-text`,mediaPrevious:`${v}__previous`,mediaPreviousIconLTR:`${v}__previous-icon`,mediaPreviousIconRTL:`${v}__previous-icon--rtl`,mediaNext:`${v}__next`,mediaNextIconLTR:`${v}__next-icon`,mediaNextIconRTL:`${v}__next-icon--rtl`,mediaChart:`${v}__chart`,mediaPaginationButton:`${v}__pagination-button`,mediaPaginationIcon:`${v}__pagination-icon`,mediaChartRendered:`${v}__chart--rendered`},M=15,w="category",I="value",A="rgba(50, 50, 50, 1)",C=250,y=500,x=200;let T=class extends n{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this._chartRootMap=new WeakMap,this.viewModel=new l,this.messages=null,this._disposeChart=e=>{this._chartRootMap.get(e)?.dispose(),this._chartRootMap.delete(e)},this._createChart=async e=>{const{destroyed:t,viewModel:i}=this;if(t||!i||!e)return;const{createRoot:r}=await import("../support/chartUtilsAm5.js"),a=await r(e);this._chartRootMap.set(e,a),this._renderChart({mediaInfo:i.activeMediaInfo,root:a})}}initialize(){this._featureElementInfo=new d,this.addHandles([i((()=>[this.viewModel?.activeMediaInfo,this.viewModel?.activeMediaInfoIndex]),(()=>this._setupMediaRefreshTimer()),r),i((()=>[this.viewModel?.description,this.viewModel?.title]),(()=>this._setupFeatureElementInfo()),r)])}loadDependencies(){return c({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js")})}destroy(){this._clearMediaRefreshTimer(),this._featureElementInfo?.destroy()}get attributes(){return this.viewModel.attributes}set attributes(e){this.viewModel.attributes=e}get activeMediaInfoIndex(){return this.viewModel.activeMediaInfoIndex}set activeMediaInfoIndex(e){this.viewModel.activeMediaInfoIndex=e}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get fieldInfoMap(){return this.viewModel.fieldInfoMap}set fieldInfoMap(e){this.viewModel.fieldInfoMap=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get mediaInfos(){return this.viewModel.mediaInfos}set mediaInfos(e){this.viewModel.mediaInfos=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get relatedInfos(){return this.viewModel.relatedInfos}set relatedInfos(e){this.viewModel.relatedInfos=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){return u("div",{bind:this,class:g.base,onkeyup:this._handleMediaKeyup},this._featureElementInfo?.render(),this._renderMedia())}_renderMedia(){const{formattedMediaInfoCount:e,activeMediaInfoIndex:t}=this.viewModel,i=this._renderMediaText();return e?u("div",{class:g.mediaContainer,key:"media-element-container"},this._renderMediaInfo(),u("div",{class:g.mediaNavigation},i,e>1?u("div",{class:g.mediaPagination},this._renderMediaPageButton("previous"),u("span",{class:g.mediaPaginationText},_(this.messages.pageText,{index:t+1,total:e})),this._renderMediaPageButton("next")):null)):null}_renderMediaText(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e&&e.title?u("div",{class:g.mediaItemTitle,innerHTML:e.title,key:"media-title"}):null,i=e&&e.caption?u("div",{class:g.mediaItemCaption,innerHTML:e.caption,key:"media-caption"}):null;return t||i?u("div",{class:g.mediaItemText,key:"media-text"},t,i):null}_renderImageMediaInfo(e){if(!e.value)return null;const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:i,formattedMediaInfoCount:r}=this.viewModel,{value:a,refreshInterval:s,altText:o,title:n,type:l}=e,{sourceURL:d,linkURL:c}=a,h=m(c??void 0)?"_blank":"_self",p="_blank"===h?"noreferrer":"",f=s?t:null,_=f?f.timestamp:0,v=f?f.sourceURL:d,g=u("img",{alt:o||n,key:`media-${l}-${i}-${r}-${_}`,src:v??void 0});return(c?u("a",{href:c,rel:p,target:h,title:n},g):null)??g}_renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:i}=this.viewModel;return u("div",{afterCreate:this._createChart,afterRemoved:this._disposeChart,bind:this,class:g.mediaChart,key:`media-${e.type}-${t}-${i}`})}_renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?"image"===e.type?this._renderImageMediaInfo(e):e.type.includes("chart")?this._renderChartMediaInfo(e):null:null}_renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;return e?u("div",{class:g.mediaItemContainer,key:"media-container"},u("div",{class:g.mediaItem,key:"media-item-container"},this._renderMediaInfoType())):null}_renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t="previous"===e,i=t?this.messages.previous:this.messages.next,r=t?"chevron-left":"chevron-right",a=t?"media-previous":"media-next",s=t?this._previous:this._next;return u("button",{"aria-label":i,bind:this,class:g.mediaPaginationButton,key:a,onclick:s,tabIndex:0,title:i,type:"button"},u("calcite-icon",{class:g.mediaPaginationIcon,icon:r,scale:"s"}))}_setupFeatureElementInfo(){const{description:e,title:t}=this;this._featureElementInfo?.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_getRenderer(){if(!this.viewModel)return;const{isAggregate:e,layer:t}=this.viewModel;return e&&t?.featureReduction&&"renderer"in t.featureReduction?t.featureReduction.renderer:t?.renderer}async _getSeriesColors(e){const{colorAm5:t}=await import("./FeatureMedia/chartCommon.js"),i=new Map;return e.forEach((e=>{e.color&&i.set(e,t(e.color.toCss(!0)))})),i}async _getRendererColors(){const{colorAm5:e}=await import("./FeatureMedia/chartCommon.js"),t=new Map,i=this._getRenderer(),r="default";if(!i)return t;const a=await o(i);a.delete(r);return Array.from(a.values()).every((e=>1===e?.length))?(Array.from(a.keys()).forEach((i=>{const r=a.get(i)?.[0]?.toCss(!0);r&&t.set(i,e(r))})),t):t}_handleMediaKeyup(e){const{key:t}=e;"ArrowLeft"===t&&(e.stopPropagation(),this.viewModel.previous()),"ArrowRight"===t&&(e.stopPropagation(),this.viewModel.next())}_canAnimateChart(){return!!this.viewModel&&(!!this.viewModel.abilities.chartAnimation&&!t())}_getChartAnimationMS(){return this._canAnimateChart()?C:0}_getChartSeriesAnimationMS(){return this._canAnimateChart()?y:0}async _renderChart(e){const{root:t,mediaInfo:i}=e,{value:r,type:a}=i,{ResponsiveThemeAm5:s,DarkThemeAm5:o,AnimatedThemeAm5:n,ColorSetAm5:l,ThemeAm5:d,esriChartColorSet:m}=await import("./FeatureMedia/chartCommon.js"),c=d.new(t);c.rule("ColorSet").set("colors",m),c.rule("ColorSet").set("reuse",!0);const h=[s.new(t),c];f()&&h.push(o.new(t)),this._canAnimateChart()&&h.push(n.new(t)),t.setThemes(h);const p=await this._getRendererColors(),u=await this._getSeriesColors(r.series),_=l.new(t,{}),v=u.get(r.series[0]),g=v?{lineSettings:{stroke:v}}:void 0,M=r.series.map(((e,t)=>{const i=u.get(e)||p.get(e.fieldName)||_.getIndex(t);return{[w]:e.tooltip,[I]:e.value,columnSettings:{fill:i,stroke:i},...g}})).filter((e=>"pie-chart"!==a||null!=e.value&&e.value>0));"pie-chart"===a?this._createPieChart(e,M):this._createXYChart(e,M)}_getDirection(){return h(this.container)?"rtl":"ltr"}_isInversed(){return!!h(this.container)}async _customizeChartTooltip(e,t="horizontal"){const{colorAm5:i}=await import("./FeatureMedia/chartCommon.js");e.setAll({pointerOrientation:t}),e.get("background")?.setAll({stroke:i(A)}),e.label.setAll({direction:this._getDirection(),oversizedBehavior:"wrap",maxWidth:x})}async _createPieChart(e,t){const{TooltipAm5:i}=await import("./FeatureMedia/chartCommon.js"),{PieChartAm5:r,PieSeriesAm5:a}=await import("./FeatureMedia/pieChart.js"),{mediaInfo:s,root:o}=e,{title:n}=s,l=5,d=s?.altText||s?.title||"",m=o.container.children.push(r.new(o,{ariaLabel:d,focusable:!0,paddingBottom:l,paddingTop:l,paddingLeft:l,paddingRight:l})),c="{category}: {valuePercentTotal.formatNumber('0.00')}%\n ({value})",h=i.new(o,{labelText:c}),p=m.series.push(a.new(o,{name:n,valueField:I,categoryField:w,tooltip:h}));p.ticks.template.set("forceHidden",!0),p.labels.template.set("forceHidden",!0),p.slices.template.states.create("active",{shiftRadius:l}),this._customizeChartTooltip(h),p.slices.template.setAll({ariaLabel:c,focusable:!0,templateField:"columnSettings"}),p.data.setAll(t),p.appear(this._getChartSeriesAnimationMS()),m.appear(this._getChartAnimationMS()),m.root.dom.classList.toggle(g.mediaChartRendered,!0)}_getMinSeriesValue(e){let t=0;return e.forEach((e=>t=Math.min(e.value,t))),t}async _createColumnChart(e,t,i){const{TooltipAm5:r,ScrollbarAm5:a}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:s,AxisRendererXAm5:o,ValueAxisAm5:n,AxisRendererYAm5:l,ColumnSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{mediaInfo:m,root:c}=t,{value:h,title:p}=m;e.setAll({wheelX:"panX",wheelY:"zoomX"});const u=e.xAxes.push(s.new(c,{renderer:o.new(c,{inversed:this._isInversed()}),categoryField:w}));u.get("renderer").labels.template.setAll({forceHidden:!0});const f=e.yAxes.push(n.new(c,{renderer:l.new(c,{inside:!1}),min:this._getMinSeriesValue(h.series)}));f.get("renderer").labels.template.setAll({direction:this._getDirection()});const _="{categoryX}",v=r.new(c,{labelText:_}),g=e.series.push(d.new(c,{name:p,xAxis:u,yAxis:f,valueYField:I,categoryXField:w,tooltip:v}));this._customizeChartTooltip(v),g.columns.template.setAll({ariaLabel:_,focusable:!0,templateField:"columnSettings"}),h.series.length>M&&e.set("scrollbarX",a.new(c,{orientation:"horizontal"})),u.data.setAll(i),g.data.setAll(i),g.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createBarChart(e,t,i){const{TooltipAm5:r,ScrollbarAm5:a}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:s,AxisRendererXAm5:o,ValueAxisAm5:n,AxisRendererYAm5:l,ColumnSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{mediaInfo:m,root:c}=t,{value:h,title:p}=m;e.setAll({wheelX:"panY",wheelY:"zoomY"});const u=e.yAxes.push(s.new(c,{renderer:l.new(c,{inversed:!0}),categoryField:w}));u.get("renderer").labels.template.setAll({forceHidden:!0});const f=e.xAxes.push(n.new(c,{renderer:o.new(c,{inside:!1,inversed:this._isInversed()}),min:this._getMinSeriesValue(h.series)}));f.get("renderer").labels.template.setAll({direction:this._getDirection()});const _="{categoryY}",v=r.new(c,{labelText:_}),g=e.series.push(d.new(c,{name:p,xAxis:f,yAxis:u,valueXField:I,categoryYField:w,tooltip:v}));this._customizeChartTooltip(v,"vertical"),g.columns.template.setAll({ariaLabel:_,focusable:!0,templateField:"columnSettings"}),h.series.length>M&&e.set("scrollbarY",a.new(c,{orientation:"vertical"})),u.data.setAll(i),g.data.setAll(i),g.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createLineChart(e,t,i){const{TooltipAm5:r,ScrollbarAm5:a}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:s,AxisRendererXAm5:o,ValueAxisAm5:n,AxisRendererYAm5:l,LineSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{root:m,mediaInfo:c}=t,{value:h,title:p}=c;e.setAll({wheelX:"panX",wheelY:"zoomX"});const u=e.xAxes.push(s.new(m,{renderer:o.new(m,{inversed:this._isInversed()}),categoryField:w}));u.get("renderer").labels.template.setAll({forceHidden:!0});const f=e.yAxes.push(n.new(m,{renderer:l.new(m,{inside:!1}),min:this._getMinSeriesValue(h.series)}));f.get("renderer").labels.template.setAll({direction:this._getDirection()});const _="{categoryX}",v=i[0]?.lineSettings?.stroke,g=r.new(m,{getFillFromSprite:!v,labelText:_});v&&g.get("background")?.setAll({fill:v});const A=e.series.push(d.new(m,{name:p,xAxis:u,yAxis:f,valueYField:I,categoryXField:w,tooltip:g}));A.strokes.template.setAll({templateField:"lineSettings"}),this._customizeChartTooltip(g,"vertical"),h.series.length>M&&e.set("scrollbarX",a.new(m,{orientation:"horizontal"})),u.data.setAll(i),A.data.setAll(i),A.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createXYChart(e,t){const{XYChartAm5:i,XYCursorAm5:r}=await import("./FeatureMedia/xyChart.js"),{root:a,mediaInfo:s}=e,{type:o}=s,n=s?.altText||s?.title||"",l=a.container.children.push(i.new(a,{ariaLabel:n,focusable:!0,panX:!0,panY:!0}));l.set("cursor",r.new(a,{})),"column-chart"===o&&await this._createColumnChart(l,e,t),"bar-chart"===o&&await this._createBarChart(l,e,t),"line-chart"===o&&await this._createLineChart(l,e,t),l.root.dom.classList.toggle(g.mediaChartRendered,!0)}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:e&&this._getImageSource(e,t)}}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;"image"===e?.type&&e?.refreshInterval>0&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:i}=e,r=6e4*t;this._updateMediaInfoTimestamp(i.sourceURL);const a=setInterval((()=>{this._updateMediaInfoTimestamp(i.sourceURL)}),r);this._refreshTimer=a}_getImageSource(e,t){const i=e.includes("?")?"&":"?",[r,a=""]=e.split("#");return`${r}${i}timestamp=${t}${a?"#":""}${a}`}};e([a()],T.prototype,"_refreshIntervalInfo",void 0),e([a()],T.prototype,"attributes",null),e([a()],T.prototype,"activeMediaInfoIndex",null),e([a()],T.prototype,"description",null),e([a()],T.prototype,"fieldInfoMap",null),e([a()],T.prototype,"layer",null),e([a()],T.prototype,"mediaInfos",null),e([a()],T.prototype,"popupTemplate",null),e([a()],T.prototype,"relatedInfos",null),e([a()],T.prototype,"title",null),e([a({type:l})],T.prototype,"viewModel",void 0),e([a(),p("esri/widgets/Feature/t9n/Feature")],T.prototype,"messages",void 0),T=e([s("esri.widgets.Feature.FeatureMedia")],T);const b=T;export{b as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{prefersReducedMotion as t}from"../../core/a11yUtils.js";import{watch as i,initial as r}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{getColorsFromRenderer as s}from"../../renderers/support/utils.js";import n from"../Widget.js";import l from"./FeatureMedia/FeatureMediaViewModel.js";import d from"./support/FeatureElementInfo.js";import{shouldOpenInNewTab as m}from"./support/featureUtils.js";import{loadCalciteComponents as c}from"../support/componentsUtils.js";import{isRTL as h}from"../support/widgetUtils.js";import{messageBundle as p}from"../support/decorators/messageBundle.js";import{tsx as u}from"../support/jsxFactory.js";import{isDarkTheme as f}from"../../support/themeUtils.js";import{substitute as _}from"../../intl/substitute.js";const g="esri-feature-media",v={base:g,mediaContainer:`${g}__container`,mediaItemContainer:`${g}__item-container`,mediaItem:`${g}__item`,mediaItemText:`${g}__item-text`,mediaItemTitle:`${g}__item-title`,mediaItemCaption:`${g}__item-caption`,mediaNavigation:`${g}__item-navigation`,mediaPagination:`${g}__pagination`,mediaPaginationText:`${g}__pagination-text`,mediaPrevious:`${g}__previous`,mediaPreviousIconLTR:`${g}__previous-icon`,mediaPreviousIconRTL:`${g}__previous-icon--rtl`,mediaNext:`${g}__next`,mediaNextIconLTR:`${g}__next-icon`,mediaNextIconRTL:`${g}__next-icon--rtl`,mediaChart:`${g}__chart`,mediaPaginationButton:`${g}__pagination-button`,mediaPaginationIcon:`${g}__pagination-icon`,mediaChartRendered:`${g}__chart--rendered`},M=15,w="category",A="value",I="rgba(50, 50, 50, 1)",C=250,y=500,x=200;let T=class extends n{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this._chartRootMap=new WeakMap,this.viewModel=new l,this.messages=null,this._disposeChart=e=>{this._chartRootMap.get(e)?.dispose(),this._chartRootMap.delete(e)},this._createChart=async e=>{const{destroyed:t,viewModel:i}=this;if(t||!i||!e)return;const{createRoot:r}=await import("../support/chartUtilsAm5.js"),a=await r(e);this._chartRootMap.set(e,a),this._renderChart({mediaInfo:i.activeMediaInfo,root:a})}}initialize(){this._featureElementInfo=new d,this.addHandles([i((()=>[this.viewModel?.activeMediaInfo,this.viewModel?.activeMediaInfoIndex]),(()=>this._setupMediaRefreshTimer()),r),i((()=>[this.viewModel?.description,this.viewModel?.title]),(()=>this._setupFeatureElementInfo()),r)])}loadDependencies(){return c({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js")})}destroy(){this._clearMediaRefreshTimer(),this._featureElementInfo?.destroy()}get attributes(){return this.viewModel.attributes}set attributes(e){this.viewModel.attributes=e}get activeMediaInfoIndex(){return this.viewModel.activeMediaInfoIndex}set activeMediaInfoIndex(e){this.viewModel.activeMediaInfoIndex=e}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get fieldInfoMap(){return this.viewModel.fieldInfoMap}set fieldInfoMap(e){this.viewModel.fieldInfoMap=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get mediaInfos(){return this.viewModel.mediaInfos}set mediaInfos(e){this.viewModel.mediaInfos=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get relatedInfos(){return this.viewModel.relatedInfos}set relatedInfos(e){this.viewModel.relatedInfos=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){return u("div",{bind:this,class:v.base,onkeyup:this._handleMediaKeyup},this._featureElementInfo?.render(),this._renderMedia())}_renderMedia(){const{formattedMediaInfoCount:e,activeMediaInfoIndex:t}=this.viewModel,i=this._renderMediaText();return e?u("div",{class:v.mediaContainer,key:"media-element-container"},this._renderMediaInfo(),u("div",{class:v.mediaNavigation},i,e>1?u("div",{class:v.mediaPagination},this._renderMediaPageButton("previous"),u("span",{class:v.mediaPaginationText},_(this.messages.pageText,{index:t+1,total:e})),this._renderMediaPageButton("next")):null)):null}_renderMediaText(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e&&e.title?u("div",{class:v.mediaItemTitle,innerHTML:e.title,key:"media-title"}):null,i=e&&e.caption?u("div",{class:v.mediaItemCaption,innerHTML:e.caption,key:"media-caption"}):null;return t||i?u("div",{class:v.mediaItemText,key:"media-text"},t,i):null}_renderImageMediaInfo(e){if(!e.value)return null;const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:i,formattedMediaInfoCount:r}=this.viewModel,{value:a,refreshInterval:o,altText:s,title:n,type:l}=e,{sourceURL:d,linkURL:c}=a,h=m(c??void 0)?"_blank":"_self",p="_blank"===h?"noreferrer":"",f=o?t:null,_=f?f.timestamp:0,g=f?f.sourceURL:d,v=u("img",{alt:s||n,key:`media-${l}-${i}-${r}-${_}`,src:g??void 0});return(c?u("a",{href:c,rel:p,target:h,title:n},v):null)??v}_renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:i}=this.viewModel;return u("div",{afterCreate:this._createChart,afterRemoved:this._disposeChart,bind:this,class:v.mediaChart,key:`media-${e.type}-${t}-${i}`})}_renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?"image"===e.type?this._renderImageMediaInfo(e):e.type.includes("chart")?this._renderChartMediaInfo(e):null:null}_renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;return e?u("div",{class:v.mediaItemContainer,key:"media-container"},u("div",{class:v.mediaItem,key:"media-item-container"},this._renderMediaInfoType())):null}_renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t="previous"===e,i=t?this.messages.previous:this.messages.next,r=t?"chevron-left":"chevron-right",a=t?"media-previous":"media-next",o=t?this._previous:this._next;return u("button",{"aria-label":i,bind:this,class:v.mediaPaginationButton,key:a,onclick:o,tabIndex:0,title:i,type:"button"},u("calcite-icon",{class:v.mediaPaginationIcon,icon:r,scale:"s"}))}_setupFeatureElementInfo(){const{description:e,title:t}=this;this._featureElementInfo?.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_getRenderer(){if(!this.viewModel)return;const{isAggregate:e,layer:t}=this.viewModel;return e&&t?.featureReduction&&"renderer"in t.featureReduction?t.featureReduction.renderer:t?.renderer}async _getSeriesColors(e){const{colorAm5:t}=await import("./FeatureMedia/chartCommon.js"),i=new Map;return e.forEach((e=>{e.color&&i.set(e,t(e.color.toCss(!0)))})),i}async _getRendererColors(){const{colorAm5:e}=await import("./FeatureMedia/chartCommon.js"),t=new Map,i=this._getRenderer(),r="default";if(!i)return t;const a=await s(i);a.delete(r);return Array.from(a.values()).every((e=>1===e?.length))?(Array.from(a.keys()).forEach((i=>{const r=a.get(i)?.[0]?.toCss(!0);r&&t.set(i,e(r))})),t):t}_handleMediaKeyup(e){const{key:t}=e;"ArrowLeft"===t&&(e.stopPropagation(),this.viewModel.previous()),"ArrowRight"===t&&(e.stopPropagation(),this.viewModel.next())}_canAnimateChart(){return!!this.viewModel&&(!!this.viewModel.abilities.chartAnimation&&!t())}_getChartAnimationMS(){return this._canAnimateChart()?C:0}_getChartSeriesAnimationMS(){return this._canAnimateChart()?y:0}async _renderChart(e){const{root:t,mediaInfo:i}=e,{value:r,type:a}=i,{ResponsiveThemeAm5:o,DarkThemeAm5:s,AnimatedThemeAm5:n,ColorSetAm5:l,ThemeAm5:d,esriChartColorSet:m}=await import("./FeatureMedia/chartCommon.js"),c=d.new(t);c.rule("ColorSet").set("colors",m),c.rule("ColorSet").set("reuse",!0);const h=[o.new(t),c];f()&&h.push(s.new(t)),this._canAnimateChart()&&h.push(n.new(t)),t.setThemes(h);const p=await this._getRendererColors(),u=await this._getSeriesColors(r.series),_=l.new(t,{}),g=u.get(r.series[0]),v=g?{lineSettings:{stroke:g}}:void 0,M=r.series.map(((e,t)=>{const i=u.get(e)||p.get(e.fieldName)||_.getIndex(t);return{[w]:e.tooltip,[A]:e.value,columnSettings:{fill:i,stroke:i},...v}})).filter((e=>"pie-chart"!==a||null!=e.value&&e.value>0));"pie-chart"===a?this._createPieChart(e,M):this._createXYChart(e,M)}_getDirection(){return h(this.container)?"rtl":"ltr"}async _customizeChartTooltip(e,t="horizontal"){const{colorAm5:i}=await import("./FeatureMedia/chartCommon.js");e.setAll({pointerOrientation:t}),e.get("background")?.setAll({stroke:i(I)}),e.label.setAll({direction:this._getDirection(),oversizedBehavior:"wrap",maxWidth:x,textAlign:h(this.container)?"center":"start"})}async _createPieChart(e,t){const{TooltipAm5:i}=await import("./FeatureMedia/chartCommon.js"),{PieChartAm5:r,PieSeriesAm5:a}=await import("./FeatureMedia/pieChart.js"),{mediaInfo:o,root:s}=e,{title:n}=o,l=5,d=o?.altText||o?.title||"",m=s.container.children.push(r.new(s,{ariaLabel:d,focusable:!0,paddingBottom:l,paddingTop:l,paddingLeft:l,paddingRight:l})),c="{category}: {valuePercentTotal.formatNumber('0.00')}%\n ({value})",h=i.new(s,{labelText:c}),p=m.series.push(a.new(s,{name:n,valueField:A,categoryField:w,tooltip:h}));p.ticks.template.set("forceHidden",!0),p.labels.template.set("forceHidden",!0),p.slices.template.states.create("active",{shiftRadius:l}),this._customizeChartTooltip(h),p.slices.template.setAll({ariaLabel:c,focusable:!0,templateField:"columnSettings"}),p.data.setAll(t),p.appear(this._getChartSeriesAnimationMS()),m.appear(this._getChartAnimationMS()),m.root.dom.classList.toggle(v.mediaChartRendered,!0)}_getMinSeriesValue(e){let t=0;return e.forEach((e=>t=Math.min(e.value,t))),t}async _createColumnChart(e,t,i){const{TooltipAm5:r,ScrollbarAm5:a}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:o,AxisRendererXAm5:s,ValueAxisAm5:n,AxisRendererYAm5:l,ColumnSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{mediaInfo:m,root:c}=t,{value:p,title:u}=m;e.setAll({wheelX:"panX",wheelY:"zoomX"});const f=e.xAxes.push(o.new(c,{renderer:s.new(c,{inversed:h(this.container)}),categoryField:w}));f.get("renderer").labels.template.setAll({forceHidden:!0});const _=e.yAxes.push(n.new(c,{renderer:l.new(c,{inside:!1}),min:this._getMinSeriesValue(p.series)}));_.get("renderer").labels.template.setAll({direction:this._getDirection()});const g="{categoryX}",v=r.new(c,{labelText:g}),I=e.series.push(d.new(c,{name:u,xAxis:f,yAxis:_,valueYField:A,categoryXField:w,tooltip:v}));this._customizeChartTooltip(v),I.columns.template.setAll({ariaLabel:g,focusable:!0,templateField:"columnSettings"}),p.series.length>M&&e.set("scrollbarX",a.new(c,{orientation:"horizontal"})),f.data.setAll(i),I.data.setAll(i),I.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createBarChart(e,t,i){const{TooltipAm5:r,ScrollbarAm5:a}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:o,AxisRendererXAm5:s,ValueAxisAm5:n,AxisRendererYAm5:l,ColumnSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{mediaInfo:m,root:c}=t,{value:p,title:u}=m;e.setAll({wheelX:"panY",wheelY:"zoomY"});const f=e.yAxes.push(o.new(c,{renderer:l.new(c,{inversed:!0}),categoryField:w}));f.get("renderer").labels.template.setAll({forceHidden:!0});const _=e.xAxes.push(n.new(c,{renderer:s.new(c,{inside:!1,inversed:h(this.container)}),min:this._getMinSeriesValue(p.series)}));_.get("renderer").labels.template.setAll({direction:this._getDirection()});const g="{categoryY}",v=r.new(c,{labelText:g}),I=e.series.push(d.new(c,{name:u,xAxis:_,yAxis:f,valueXField:A,categoryYField:w,tooltip:v}));this._customizeChartTooltip(v,"vertical"),I.columns.template.setAll({ariaLabel:g,focusable:!0,templateField:"columnSettings"}),p.series.length>M&&e.set("scrollbarY",a.new(c,{orientation:"vertical"})),f.data.setAll(i),I.data.setAll(i),I.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createLineChart(e,t,i){const{TooltipAm5:r,ScrollbarAm5:a}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:o,AxisRendererXAm5:s,ValueAxisAm5:n,AxisRendererYAm5:l,LineSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{root:m,mediaInfo:c}=t,{value:p,title:u}=c;e.setAll({wheelX:"panX",wheelY:"zoomX"});const f=e.xAxes.push(o.new(m,{renderer:s.new(m,{inversed:h(this.container)}),categoryField:w}));f.get("renderer").labels.template.setAll({forceHidden:!0});const _=e.yAxes.push(n.new(m,{renderer:l.new(m,{inside:!1}),min:this._getMinSeriesValue(p.series)}));_.get("renderer").labels.template.setAll({direction:this._getDirection()});const g="{categoryX}",v=i[0]?.lineSettings?.stroke,I=r.new(m,{getFillFromSprite:!v,labelText:g});v&&I.get("background")?.setAll({fill:v});const C=e.series.push(d.new(m,{name:u,xAxis:f,yAxis:_,valueYField:A,categoryXField:w,tooltip:I}));C.strokes.template.setAll({templateField:"lineSettings"}),this._customizeChartTooltip(I,"vertical"),p.series.length>M&&e.set("scrollbarX",a.new(m,{orientation:"horizontal"})),f.data.setAll(i),C.data.setAll(i),C.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createXYChart(e,t){const{XYChartAm5:i,XYCursorAm5:r}=await import("./FeatureMedia/xyChart.js"),{root:a,mediaInfo:o}=e,{type:s}=o,n=o?.altText||o?.title||"",l=a.container.children.push(i.new(a,{ariaLabel:n,focusable:!0,panX:!0,panY:!0}));l.set("cursor",r.new(a,{})),"column-chart"===s&&await this._createColumnChart(l,e,t),"bar-chart"===s&&await this._createBarChart(l,e,t),"line-chart"===s&&await this._createLineChart(l,e,t),l.root.dom.classList.toggle(v.mediaChartRendered,!0)}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:e&&this._getImageSource(e,t)}}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;"image"===e?.type&&e?.refreshInterval>0&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:i}=e,r=6e4*t;this._updateMediaInfoTimestamp(i.sourceURL);const a=setInterval((()=>{this._updateMediaInfoTimestamp(i.sourceURL)}),r);this._refreshTimer=a}_getImageSource(e,t){const i=e.includes("?")?"&":"?",[r,a=""]=e.split("#");return`${r}${i}timestamp=${t}${a?"#":""}${a}`}};e([a()],T.prototype,"_refreshIntervalInfo",void 0),e([a()],T.prototype,"attributes",null),e([a()],T.prototype,"activeMediaInfoIndex",null),e([a()],T.prototype,"description",null),e([a()],T.prototype,"fieldInfoMap",null),e([a()],T.prototype,"layer",null),e([a()],T.prototype,"mediaInfos",null),e([a()],T.prototype,"popupTemplate",null),e([a()],T.prototype,"relatedInfos",null),e([a()],T.prototype,"title",null),e([a({type:l})],T.prototype,"viewModel",void 0),e([a(),p("esri/widgets/Feature/t9n/Feature")],T.prototype,"messages",void 0),T=e([o("esri.widgets.Feature.FeatureMedia")],T);const b=T;export{b 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/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../core/Collection.js";import{referenceSetter as i}from"../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../core/deprecate.js";import o from"../../core/Handles.js";import r from"../../core/Logger.js";import{debounce as n,ignoreAbortErrors as l}from"../../core/promiseUtils.js";import{watch as a,initial as h,on as d}from"../../core/reactiveUtils.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{getLowerCaseDefaultHiddenFields as c}from"../../layers/support/fieldUtils.js";import{getTimeZoneFormattingOptions as p,system as u}from"../../time/timeZoneUtils.js";import{highlightsSupported as f}from"../../views/support/layerViewUtils.js";import{isSelectableLayer as y}from"../../views/support/selectionUtils.js";import b from"./ActionColumn.js";import _ from"./AttachmentsColumn.js";import I from"./FieldColumn.js";import C from"./RelationshipColumn.js";import v from"./Grid/Column.js";import w from"./Grid/Grid.js";import E from"./Grid/GridViewModel.js";import T from"./Grid/GroupColumn.js";import S from"./support/FeatureStore.js";import j from"./support/TableTemplate.js";import{uniqueColumnNames as F}from"./support/tableUtils.js";import{exportToCSV as R}from"../support/exportUtils.js";import"../support/widgetUtils.js";import{messageBundle as x}from"../support/decorators/messageBundle.js";import{onLocaleChange as U}from"../../intl/locale.js";import{convertDateFormatToIntlOptions as O}from"../../intl/date.js";import{fetchMessageBundle as L}from"../../intl/messages.js";let z=class extends E{constructor(e){super(e),this._debounceRefresh=n((()=>this._refresh())),this._highlights=new o,this.actionColumnConfig=null,this.autoRefreshEnabled=!0,this.columns=new t,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const{objectIds:o}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===o.length&&-1===o.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const r=this.paginationEnabled?this.pageIndex:e.page,n=await s.fetchItems({...e,page:r});t&&t(n)},this.editingEnabled=!1,this.grid=null,this.highlightEnabled=!0,this.itemIdPath="objectId",this.layer=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.relationshipColumnConfigs=null,this.selectionSource="table",this.showRelatedTableCallback=null,this.store=null,this.tableTemplate=null,this.tableTemplateOverride=null,this.timeZone=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._set("store",new S),this._set("grid",new w({itemIdPath:this.itemIdPath,viewModel:this}))}initialize(){const e=async()=>{this.messages=await L("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await L("esri/t9n/common"),this.messagesURIUtils=await L("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([U((()=>{e(),this._generateColumns()})),a((()=>[this.messages,this.messagesCommon,this.messagesURIUtils]),(()=>{const e=this.messages;this.grid&&(this.grid.messages=e),this.columns.forEach((t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils})),this._requestContentUpdate()}),h),d((()=>this.highlightIds),"change",(e=>this._onHighlightIdsChange(e)),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this._highlights.removeAll()}),a((()=>this.attachmentsEnabled),(e=>{const{attachmentsColumn:t,columns:i}=this;t&&i.remove(t),e&&i.length&&i.add(this._generateAttachmentsColumn(),this._getIndexOfFirstFrozenToEndColumn())})),a((()=>this._viewSelection),(()=>{this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)})),a((()=>[this._tableHighlightsReady,this._viewSelectionReady]),(()=>this._syncSelection())),a((()=>this.layer),(async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch((()=>{})))})),a((()=>this.layer?.loaded),(e=>e&&this._onLayerLoad())),a((()=>this.store.state),(e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())})),a((()=>this._effectiveTableTemplate),(()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()})),a((()=>[this.timeZone,this.view?.timeZone]),(()=>{this.columns.forEach((e=>{if("field"in e&&e.field){const{timeZone:t,timeZoneName:i}=this._getTimeZoneInfoForFieldColumn(e.field);e.set({timeZone:t,timeZoneName:i})}})),this._requestContentUpdate()})),a((()=>this.editingEnabled),(e=>{this.editorColumns.forEach((t=>t.tableEditingEnabled=e)),this._requestContentUpdate()})),a((()=>this.layer?.definitionExpression),((e,t)=>(e||t)&&"loaded"===this.store.state&&this.reset())),a((()=>this.layer?.timeExtent),((e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset())),d((()=>this.layer),"refresh",(e=>this._onLayerRefresh(e))),d((()=>this.grid),["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown"],(({index:e,item:t,native:i,path:s,type:o})=>{const r=t?.feature;this.emit(o,{feature:r,index:e,native:i,type:o,fieldName:s??void 0,objectId:r?.getObjectId()})})),a((()=>this.actionColumnConfig),(e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())})),a((()=>[this.relationshipColumnConfigs?.length,this.relatedRecordsEnabled]),(([e,t])=>{const{columns:i,relationshipColumns:s}=this;s.length&&i.removeMany(s),i.length&&t&&i.addMany(this._generateRelationshipColumns(),this._getIndexOfFirstFrozenToEndColumn())})),d((()=>this.objectIds),"change",(()=>this._onObjectIdsChange()),{onListenerAdd:()=>this._onObjectIdsChange()}),a((()=>[this.paginationEnabled,this.pageIndex]),(()=>this.refreshPageCache())),a((()=>this.activeSortOrders),(e=>this.store.sortOrders=e)),a((()=>this.pageCount),(()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)}))])}destroy(){this._drainColumns(),this._highlights.removeAll(),this._highlights.destroy(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return c(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _highlightableLayerView(){const e=this.layerView;return f(e)?e:null}get _relationshipInfos(){return this.store.relationshipInfos}get _selectionManager(){const{view:e}=this;return!e||e.destroyed?null:e.selectionManager?.sources?.length?e.selectionManager:null}get _selectableLayer(){const{layer:e}=this;return y(e)&&this._selectionManager?.sources.includes(e)?e:null}get _tableHighlightsReady(){return!("table"!==this.selectionSource||!this.highlightEnabled||!this._highlightableLayerView)}get _viewSelection(){const{_selectableLayer:e}=this;return e?this._selectionManager?.getSelection(e)??[]:[]}get _viewSelectionReady(){return!(!this.layer||"view"!==this.selectionSource||!this._selectionManager)}get activeFilters(){const{filterGeometry:e,objectIds:i,filterBySelectionEnabled:s,highlightIds:o}=this,r=new t;return e&&r.push({type:"geometry",geometry:e}),s?r.push({type:"selection",objectIds:o.toArray()}):i.length&&r.push({type:"objectId",objectIds:i.toArray()}),r}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map((({path:e,direction:t})=>({fieldName:e,direction:t}))).filter((e=>e.fieldName&&e.direction)):[]}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(t.removeAll(),this._logWarning("Selection filter has been applied with an objectID filter. Object ID filter has been removed.")),this.filterGeometry&&this._logWarning("Selection filter has been applied with a geometry filter. Results may appear inconsistent"),this._syncObjectIdsWithStore(this.highlightIds.toArray())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get hiddenFields(){return this._get("hiddenFields")??new t}set hiddenFields(e){this._set("hiddenFields",i(e,this._get("hiddenFields"),t))}get isQueryingOrSyncing(){const{store:e}=this;return e?.syncing||e?.querying}get layerView(){return this.store.layerView}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relationship(){const e=this.relationshipConfig?.relationshipId;return null==e?null:this.relationships?.find((({id:t})=>t===e))}get relationshipConfig(){return this.store.relationshipConfig}set relationshipConfig(e){this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e}get relationships(){return this.store.relationships}get returnGeometryEnabled(){return this.store.returnGeometry}set returnGeometryEnabled(e){this.store.returnGeometry=e}get returnMEnabled(){return this.store.returnM}set returnMEnabled(e){this.store.returnM=e}get returnZEnabled(){return this.store.returnZ}set returnZEnabled(e){this.store.returnZ=e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get view(){return this.store.view}set view(e){this.store.view=e}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter((e=>!e.error)).map((e=>e.objectId));i.length&&(this.highlightIds.removeMany(i),await this.refresh())}async exportSelectionToCSV(){const{highlightIds:e,layer:t,outFields:i}=this;t&&e.length?await R({layer:t,objectIds:e.toArray(),outFields:i}):this._logWarning("Export failed.")}filterBySelection(){this.filterBySelectionEnabled?this._logWarning("Property 'filterBySelectionEnabled' is already 'true'. This method has no effect."):(s(r.getLogger(this),"`FeatureTable.filterBySelection` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.addMany(this.highlightIds.toArray()))}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.store.getItemByObjectId(e);return i?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(null==e||!Number.isInteger(e))return void this._logWarning("Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.");const{pageCount:t}=this;(e>=t||-1===e)&&(e=t-1),e<-1&&(e=0),e!==this.pageIndex&&(this.pageIndex=e),this.paginationEnabled||this.scrollToIndex(e*this.pageSize)}nextPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){return l(this._debounceRefresh())}refreshCellContent(){this._requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){const t=this.store.getItemIndexByObjectId(e);t>-1?this.grid?.scrollToIndex(t):this._logWarning("Row not found. Associated data may not be loaded yet.")}scrollToTop(){this.grid?.scrollToTop()}clearSelectionFilter(){s(r.getLogger(this),"`FeatureTable.clearSelectionFilter` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.removeAll()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const o=await e.queryFeatures(s);try{await t.goTo(o.features)}catch(r){"AbortError"!==r.name&&console.error(r)}}_requestContentUpdate(){this.grid?.requestContentUpdate()}async _refresh(){await this.store.refreshLayerInfo();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach(((t,i)=>{t||this.highlightIds.remove(e[i])}))}this.refreshPageCache()}_onLayerLoad(){const{layer:e,pageSize:t}=this;if(!e)return;const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,o=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=o),this.grid?.set("pageSize",o),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const e=this._effectiveTableTemplate?.columnTemplates,t=e?this._generateColumnsFromTemplates(e):this._generateDefaultFieldColumns();t.length&&this.attachmentsEnabled&&t.push(this._generateAttachmentsColumn()),t.length&&this.relatedRecordsEnabled&&this._relationshipInfos.length&&t.push(...this._generateRelationshipColumns()),this.actionColumnConfig&&t.push(this._generateActionColumn()),t.sort(((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0)),this.columns.addMany(t)}_generateColumnsFromTemplates(e){const{editingEnabled:t,_effectiveTableTemplate:i,grid:s,layer:o,messages:r,messagesCommon:n,messagesURIUtils:l,store:a,timeZone:h}=this;if(!o)return[];const d=o.fields??[],g=[],m=e=>d.find((t=>e.fieldName.toLowerCase()===t.name?.toLowerCase()));return e.forEach((e=>{const{autoWidth:d,direction:c,flexGrow:p,fieldName:u,formatFunction:f,frozen:y,frozenToEnd:b,icon:_,initialSortPriority:C,invalid:w,label:E,menuConfig:S,resizable:j,sortable:F,textAlign:R,textWrap:x,type:U,width:O}=e;if(!U)return void this._logWarning("Property 'type' is missing from the provided template. Skipped generating a column for this template.");if(y&&b)return void this._logWarning("Both 'frozen' and 'frozenToEnd' cannot be true for a single template. Skipped generating a column for this template.");const L=!1===e.visible;if("group"===U){if(!e.columnTemplates?.length)return void this._logWarning("Group columns must contain column templates. Skipped generating a column for this template.");if(!e.label)return void this._logWarning("Group columns require a label. Skipped generating a column for this template.");const t=this._generateColumnsFromTemplates(e.columnTemplates),i=L||this._isFieldHidden(e.label);g.push(new T({autoWidth:d,columns:t,flexGrow:p,frozen:y,frozenToEnd:b,grid:s,hidden:i,icon:_,invalid:w,label:E,menuConfig:S,messages:r,messagesCommon:n,messagesURIUtils:l,resizable:j,textAlign:R,textWrap:x,width:O}))}if(!u)return void this._logWarning("'fieldName' was missing from the provided template. Skipped generating a column for this template.");const z=L||this._isFieldHidden(u);if("column"===U&&g.push(new v({autoWidth:d,direction:c,fieldName:u,flexGrow:p,formatFunction:f,frozen:y,frozenToEnd:b,grid:s,hidden:z,icon:_,initialSortPriority:C,invalid:w,label:E,menuConfig:S,messages:r,messagesCommon:n,messagesURIUtils:l,resizable:j,sortable:F,textAlign:R,textWrap:x,timeZone:h,width:O})),"field"===U){const h=m(e);if(!h)return void this._logWarning("A valid 'field' could not be found for the provided template. Skipped generating a column for this template.");const{editable:u,required:v}=e,T=i?.expressionInfos||null,{timeZone:U,timeZoneName:L}=this._getTimeZoneInfoForFieldColumn(h);g.push(new I({autoWidth:d,direction:c,editable:u,expressionInfos:T,field:h,fieldName:h.name,flexGrow:p,formatFunction:f,frozen:y,frozenToEnd:b,grid:s,hidden:z,icon:_,initialSortPriority:C,invalid:w,label:E,layer:o,messages:r,messagesCommon:n,messagesURIUtils:l,menuConfig:S,sortable:F,store:a,required:v,resizable:j,tableEditingEnabled:t,template:e,textAlign:R,textWrap:x,timeZone:U,timeZoneName:L,width:O}))}})),g}_generateDefaultFieldColumns(){const{editingEnabled:e,grid:t,layer:i,messages:s,messagesCommon:o,messagesURIUtils:r,store:n}=this,l=[];return i?.fields.length?(i.fields.forEach((a=>{if(!a.visible||"geometry"===a.type)return;const{timeZone:h,timeZoneName:d}=this._getTimeZoneInfoForFieldColumn(a),g=a.name;l.push(new I({field:a,fieldName:g,grid:t,hidden:this._isFieldHidden(g),layer:i,messages:s,messagesCommon:o,messagesURIUtils:r,store:n,tableEditingEnabled:e,timeZone:h,timeZoneName:d}))})),l):l}_getTimeZoneInfoForFieldColumn(e){const{layer:t,timeZone:i,view:s}=this;return!t||"date"!==e?.type&&"timestamp-offset"!==e?.type?{timeZone:void 0,timeZoneName:void 0}:p(t.preferredTimeZone||null,!!t.datesInUnknownTimezone,i??s?.timeZone??u,O("short-time"),e.type)}_generateAttachmentsColumn(){return new _({hidden:this._isFieldHidden(F.attachments),messages:this.messages})}_generateRelationshipColumns(){const{_relationshipInfos:e,grid:t,messages:i,messagesCommon:s,messagesURIUtils:o,relationshipColumnConfigs:r}=this,n=[];if(!e?.length)return n;const l={grid:t,messages:i,messagesCommon:s,messagesURIUtils:o};return r?r.forEach((t=>{const{relationshipId:i}=t,s=e.find((e=>e.relationshipId===i));s&&n.push(new C({...t,...l,fieldName:`${F.relationship}-${i}`,layer:s.relatedLayer,relatedLayer:s.layer,relationshipId:i,showRelatedTableCallback:e=>this._onShowRelatedTable(e)}))})):e.forEach((({layer:e,relatedLayer:t,relationshipId:i})=>{n.push(new C({...l,fieldName:`${F.relationship}-${i}`,layer:t,relatedLayer:e,relationshipId:i,showRelatedTableCallback:e=>this._onShowRelatedTable(e)}))})),n}_generateActionColumn(){return new b({hidden:this._isFieldHidden(F.action),...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some((e=>e.toLowerCase()===t))}_addTableHighlight(e){const{_highlightableLayerView:t,layer:i}=this;if(t&&i){const s=this.store.getItemByObjectId(e),o=s?.feature??e;this._highlights.add(t.highlight(o),`${i.id}-${e}`)}}_removeTableHighlight(e){const{layer:t}=this;t&&this._highlights.remove(`${t.id}-${e}`)}_syncSelection(){this._highlights.removeAll(),this._tableHighlightsReady?this.highlightIds.forEach((e=>this._addTableHighlight(e))):this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}_appendToViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.appendToSelection(t,e)}_removeFromViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.removeFromSelection(t,e)}_onHighlightIdsChange(e){const{added:t,removed:i}=e;this._tableHighlightsReady?(i.forEach((e=>this._removeTableHighlight(e))),t.forEach((e=>this._addTableHighlight(e)))):this._viewSelectionReady&&(this._removeFromViewSelection(i),this._appendToViewSelection(t)),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray())}_onShowRelatedTable(e){const{highlightIds:t}=this,{objectId:i}=e;t.removeAll(),t.add(i),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit("show-related-table",e)}_onObjectIdsChange(){const e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning("Object ID filter was applied while a selection filter was applied. Selection filter has been removed.")),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.refreshPageCache()}_drainColumns(){this.columns.drain((e=>!e.destroyed&&e.destroy()))}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex((e=>e.frozenToEnd));return e>-1?e:void 0}_logWarning(e){r.getLogger(this).warn(e)}};e([g()],z.prototype,"_defaultHiddenFields",null),e([g()],z.prototype,"_effectiveTableTemplate",null),e([g()],z.prototype,"_highlights",void 0),e([g()],z.prototype,"_highlightableLayerView",null),e([g()],z.prototype,"_relationshipInfos",null),e([g()],z.prototype,"_selectionManager",null),e([g()],z.prototype,"_selectableLayer",null),e([g()],z.prototype,"_tableHighlightsReady",null),e([g()],z.prototype,"_viewSelection",null),e([g()],z.prototype,"_viewSelectionReady",null),e([g()],z.prototype,"actionColumnConfig",void 0),e([g()],z.prototype,"activeFilters",null),e([g({readOnly:!0})],z.prototype,"activeSortOrders",null),e([g()],z.prototype,"attachmentsEnabled",null),e([g()],z.prototype,"autoRefreshEnabled",void 0),e([g({readOnly:!0})],z.prototype,"columns",void 0),e([g()],z.prototype,"dataProvider",void 0),e([g()],z.prototype,"editingEnabled",void 0),e([g()],z.prototype,"filterGeometry",null),e([g()],z.prototype,"filterBySelectionEnabled",null),e([g({readOnly:!0})],z.prototype,"grid",void 0),e([g()],z.prototype,"hiddenFields",null),e([g()],z.prototype,"highlightEnabled",void 0),e([g()],z.prototype,"isQueryingOrSyncing",null),e([g({readOnly:!0})],z.prototype,"itemIdPath",void 0),e([g()],z.prototype,"layer",void 0),e([g()],z.prototype,"layerView",null),e([g()],z.prototype,"messages",void 0),e([g(),x("esri/t9n/common")],z.prototype,"messagesCommon",void 0),e([g(),x("esri/widgets/support/t9n/uriUtils")],z.prototype,"messagesURIUtils",void 0),e([g()],z.prototype,"outFields",null),e([g()],z.prototype,"relatedRecordsEnabled",null),e([g()],z.prototype,"relationship",null),e([g()],z.prototype,"relationshipColumnConfigs",void 0),e([g()],z.prototype,"relationshipConfig",null),e([g()],z.prototype,"relationships",null),e([g()],z.prototype,"returnGeometryEnabled",null),e([g()],z.prototype,"returnMEnabled",null),e([g()],z.prototype,"returnZEnabled",null),e([g()],z.prototype,"selectionSource",void 0),e([g()],z.prototype,"showRelatedTableCallback",void 0),e([g({readOnly:!0,type:S})],z.prototype,"store",void 0),e([g({type:j})],z.prototype,"tableTemplate",void 0),e([g()],z.prototype,"tableTemplateOverride",void 0),e([g()],z.prototype,"timeExtent",null),e([g()],z.prototype,"timeZone",void 0),e([g()],z.prototype,"view",null),z=e([m("esri.widgets.FeatureTable.FeatureTableViewModel")],z);const A=z;export{A as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../core/Collection.js";import{referenceSetter as i}from"../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../core/deprecate.js";import o from"../../core/Handles.js";import r from"../../core/Logger.js";import{debounce as n,ignoreAbortErrors as l}from"../../core/promiseUtils.js";import{watch as a,initial as h,on as d}from"../../core/reactiveUtils.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{getLowerCaseDefaultHiddenFields as c}from"../../layers/support/fieldUtils.js";import{getTimeZoneFormattingOptions as p,system as u}from"../../time/timeZoneUtils.js";import{highlightsSupported as f}from"../../views/support/layerViewUtils.js";import{isSelectableLayer as y}from"../../views/support/selectionUtils.js";import b from"./ActionColumn.js";import _ from"./AttachmentsColumn.js";import I from"./FieldColumn.js";import C from"./RelationshipColumn.js";import v from"./Grid/Column.js";import w from"./Grid/Grid.js";import E from"./Grid/GridViewModel.js";import T from"./Grid/GroupColumn.js";import S from"./support/FeatureStore.js";import j from"./support/TableTemplate.js";import{uniqueColumnNames as F}from"./support/tableUtils.js";import{exportToCSV as R}from"../support/exportUtils.js";import"../support/widgetUtils.js";import{messageBundle as x}from"../support/decorators/messageBundle.js";import{onLocaleChange as U}from"../../intl/locale.js";import{convertDateFormatToIntlOptions as O}from"../../intl/date.js";import{fetchMessageBundle as L}from"../../intl/messages.js";let z=class extends E{constructor(e){super(e),this._debounceRefresh=n((()=>this._refresh())),this._highlights=new o,this.actionColumnConfig=null,this.autoRefreshEnabled=!0,this.columns=new t,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const{objectIds:o}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===o.length&&-1===o.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const r=this.paginationEnabled?this.pageIndex:e.page,n=await s.fetchItems({...e,page:r});t&&t(n)},this.editingEnabled=!1,this.grid=null,this.highlightEnabled=!0,this.itemIdPath="objectId",this.layer=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.relationshipColumnConfigs=null,this.selectionSource="table",this.showRelatedTableCallback=null,this.store=null,this.tableTemplate=null,this.tableTemplateOverride=null,this.timeZone=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._set("store",new S),this._set("grid",new w({itemIdPath:this.itemIdPath,viewModel:this}))}initialize(){const e=async()=>{this.messages=await L("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await L("esri/t9n/common"),this.messagesURIUtils=await L("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([U((()=>{e(),this._generateColumns()})),a((()=>[this.messages,this.messagesCommon,this.messagesURIUtils]),(()=>{const e=this.messages;this.grid&&(this.grid.messages=e),this.columns.forEach((t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils})),this._requestContentUpdate()}),h),d((()=>this.highlightIds),"change",(e=>this._onHighlightIdsChange(e)),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this._highlights.removeAll()}),a((()=>this.attachmentsEnabled),(e=>{const{attachmentsColumn:t,columns:i}=this;t&&i.remove(t),e&&i.length&&i.add(this._generateAttachmentsColumn(),this._getIndexOfFirstFrozenToEndColumn())})),a((()=>this._viewSelection),(()=>{this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)})),a((()=>[this._tableHighlightsReady,this._viewSelectionReady]),(()=>this._syncSelection())),a((()=>this.layer),(async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch((()=>{})))})),a((()=>this.layer?.loaded),(e=>e&&this._onLayerLoad())),a((()=>this.store.state),(e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())})),a((()=>this._effectiveTableTemplate),(()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()})),a((()=>[this.timeZone,this.view?.timeZone]),(()=>{this.columns.forEach((e=>{if("field"in e&&e.field){const{timeZone:t,timeZoneName:i}=this._getTimeZoneInfoForFieldColumn(e.field);e.set({timeZone:t,timeZoneName:i})}})),this._requestContentUpdate()})),a((()=>this.editingEnabled),(e=>{this.editorColumns.forEach((t=>t.tableEditingEnabled=e)),this._requestContentUpdate()})),a((()=>this.layer?.definitionExpression),((e,t)=>(e||t)&&"loaded"===this.store.state&&this.reset())),a((()=>this.layer?.timeExtent),((e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset())),d((()=>this.layer),"refresh",(e=>this._onLayerRefresh(e))),d((()=>this.grid),["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown"],(({index:e,item:t,native:i,path:s,type:o})=>{const r=t?.feature;this.emit(o,{feature:r,index:e,native:i,type:o,fieldName:s??void 0,objectId:r?.getObjectId()})})),a((()=>this.actionColumnConfig),(e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())})),a((()=>[this.relationshipColumnConfigs?.length,this.relatedRecordsEnabled]),(([e,t])=>{const{columns:i,relationshipColumns:s}=this;s.length&&i.removeMany(s),i.length&&t&&i.addMany(this._generateRelationshipColumns(),this._getIndexOfFirstFrozenToEndColumn())})),d((()=>this.objectIds),"change",(()=>this._onObjectIdsChange()),{onListenerAdd:()=>this._onObjectIdsChange()}),a((()=>[this.paginationEnabled,this.pageIndex]),(()=>this.refreshPageCache())),a((()=>this.activeSortOrders),(e=>this.store.sortOrders=e)),a((()=>this.pageCount),(()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)}))])}destroy(){this._drainColumns(),this._highlights.removeAll(),this._highlights.destroy(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return c(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _highlightableLayerView(){const e=this.layerView;return f(e)?e:null}get _relationshipInfos(){return this.store.relationshipInfos}get _selectionManager(){const{view:e}=this;return!e||e.destroyed?null:e.selectionManager?.sources?.length?e.selectionManager:null}get _selectableLayer(){const{layer:e}=this;return y(e)&&this._selectionManager?.sources.includes(e)?e:null}get _tableHighlightsReady(){return!("table"!==this.selectionSource||!this.highlightEnabled||!this._highlightableLayerView)}get _viewSelection(){const{_selectableLayer:e}=this;return e?this._selectionManager?.getSelection(e)??[]:[]}get _viewSelectionReady(){return!(!this.layer||"view"!==this.selectionSource||!this._selectionManager)}get activeFilters(){const{filterGeometry:e,objectIds:i,filterBySelectionEnabled:s,highlightIds:o}=this,r=new t;return e&&r.push({type:"geometry",geometry:e}),s?r.push({type:"selection",objectIds:o.toArray()}):i.length&&r.push({type:"objectId",objectIds:i.toArray()}),r}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map((({path:e,direction:t})=>({fieldName:e,direction:t}))).filter((e=>e.fieldName&&e.direction)):[]}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(t.removeAll(),this._logWarning("Selection filter has been applied with an objectID filter. Object ID filter has been removed.")),this.filterGeometry&&this._logWarning("Selection filter has been applied with a geometry filter. Results may appear inconsistent"),this._syncObjectIdsWithStore(this.highlightIds.toArray())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get hiddenFields(){return this._get("hiddenFields")??new t}set hiddenFields(e){this._set("hiddenFields",i(e,this._get("hiddenFields"),t))}get isQueryingOrSyncing(){const{store:e}=this;return e?.syncing||e?.querying}get layerView(){return this.store.layerView}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relationship(){const e=this.relationshipConfig?.relationshipId;return null==e?null:this.relationships?.find((({id:t})=>t===e))}get relationshipConfig(){return this.store.relationshipConfig}set relationshipConfig(e){this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e}get relationships(){return this.store.relationships}get returnGeometryEnabled(){return this.store.returnGeometry}set returnGeometryEnabled(e){this.store.returnGeometry=e}get returnMEnabled(){return this.store.returnM}set returnMEnabled(e){this.store.returnM=e}get returnZEnabled(){return this.store.returnZ}set returnZEnabled(e){this.store.returnZ=e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get view(){return this.store.view}set view(e){this.store.view=e}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter((e=>!e.error)).map((e=>e.objectId));i.length&&(this.highlightIds.removeMany(i),await this.refresh())}async exportSelectionToCSV(e){const{highlightIds:t,layer:i,outFields:s}=this;i&&t.length?await R({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}filterBySelection(){this.filterBySelectionEnabled?this._logWarning("Property 'filterBySelectionEnabled' is already 'true'. This method has no effect."):(s(r.getLogger(this),"`FeatureTable.filterBySelection` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.addMany(this.highlightIds.toArray()))}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.store.getItemByObjectId(e);return i?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(null==e||!Number.isInteger(e))return void this._logWarning("Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.");const{pageCount:t}=this;(e>=t||-1===e)&&(e=t-1),e<-1&&(e=0),e!==this.pageIndex&&(this.pageIndex=e),this.paginationEnabled||this.scrollToIndex(e*this.pageSize)}nextPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){return l(this._debounceRefresh())}refreshCellContent(){this._requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){const t=this.store.getItemIndexByObjectId(e);t>-1?this.grid?.scrollToIndex(t):this._logWarning("Row not found. Associated data may not be loaded yet.")}scrollToTop(){this.grid?.scrollToTop()}clearSelectionFilter(){s(r.getLogger(this),"`FeatureTable.clearSelectionFilter` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.removeAll()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const o=await e.queryFeatures(s);try{await t.goTo(o.features)}catch(r){"AbortError"!==r.name&&console.error(r)}}_requestContentUpdate(){this.grid?.requestContentUpdate()}async _refresh(){await this.store.refreshLayerInfo();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach(((t,i)=>{t||this.highlightIds.remove(e[i])}))}this.refreshPageCache()}_onLayerLoad(){const{layer:e,pageSize:t}=this;if(!e)return;const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,o=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=o),this.grid?.set("pageSize",o),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const e=this._effectiveTableTemplate?.columnTemplates,t=e?this._generateColumnsFromTemplates(e):this._generateDefaultFieldColumns();t.length&&this.attachmentsEnabled&&t.push(this._generateAttachmentsColumn()),t.length&&this.relatedRecordsEnabled&&this._relationshipInfos.length&&t.push(...this._generateRelationshipColumns()),this.actionColumnConfig&&t.push(this._generateActionColumn()),t.sort(((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0)),this.columns.addMany(t)}_generateColumnsFromTemplates(e){const{editingEnabled:t,_effectiveTableTemplate:i,grid:s,layer:o,messages:r,messagesCommon:n,messagesURIUtils:l,store:a,timeZone:h}=this;if(!o)return[];const d=o.fields??[],g=[],m=e=>d.find((t=>e.fieldName.toLowerCase()===t.name?.toLowerCase()));return e.forEach((e=>{const{autoWidth:d,direction:c,flexGrow:p,fieldName:u,formatFunction:f,frozen:y,frozenToEnd:b,icon:_,initialSortPriority:C,invalid:w,label:E,menuConfig:S,resizable:j,sortable:F,textAlign:R,textWrap:x,type:U,width:O}=e;if(!U)return void this._logWarning("Property 'type' is missing from the provided template. Skipped generating a column for this template.");if(y&&b)return void this._logWarning("Both 'frozen' and 'frozenToEnd' cannot be true for a single template. Skipped generating a column for this template.");const L=!1===e.visible;if("group"===U){if(!e.columnTemplates?.length)return void this._logWarning("Group columns must contain column templates. Skipped generating a column for this template.");if(!e.label)return void this._logWarning("Group columns require a label. Skipped generating a column for this template.");const t=this._generateColumnsFromTemplates(e.columnTemplates),i=L||this._isFieldHidden(e.label);g.push(new T({autoWidth:d,columns:t,flexGrow:p,frozen:y,frozenToEnd:b,grid:s,hidden:i,icon:_,invalid:w,label:E,menuConfig:S,messages:r,messagesCommon:n,messagesURIUtils:l,resizable:j,textAlign:R,textWrap:x,width:O}))}if(!u)return void this._logWarning("'fieldName' was missing from the provided template. Skipped generating a column for this template.");const z=L||this._isFieldHidden(u);if("column"===U&&g.push(new v({autoWidth:d,direction:c,fieldName:u,flexGrow:p,formatFunction:f,frozen:y,frozenToEnd:b,grid:s,hidden:z,icon:_,initialSortPriority:C,invalid:w,label:E,menuConfig:S,messages:r,messagesCommon:n,messagesURIUtils:l,resizable:j,sortable:F,textAlign:R,textWrap:x,timeZone:h,width:O})),"field"===U){const h=m(e);if(!h)return void this._logWarning("A valid 'field' could not be found for the provided template. Skipped generating a column for this template.");const{editable:u,required:v}=e,T=i?.expressionInfos||null,{timeZone:U,timeZoneName:L}=this._getTimeZoneInfoForFieldColumn(h);g.push(new I({autoWidth:d,direction:c,editable:u,expressionInfos:T,field:h,fieldName:h.name,flexGrow:p,formatFunction:f,frozen:y,frozenToEnd:b,grid:s,hidden:z,icon:_,initialSortPriority:C,invalid:w,label:E,layer:o,messages:r,messagesCommon:n,messagesURIUtils:l,menuConfig:S,sortable:F,store:a,required:v,resizable:j,tableEditingEnabled:t,template:e,textAlign:R,textWrap:x,timeZone:U,timeZoneName:L,width:O}))}})),g}_generateDefaultFieldColumns(){const{editingEnabled:e,grid:t,layer:i,messages:s,messagesCommon:o,messagesURIUtils:r,store:n}=this,l=[];return i?.fields.length?(i.fields.forEach((a=>{if(!a.visible||"geometry"===a.type)return;const{timeZone:h,timeZoneName:d}=this._getTimeZoneInfoForFieldColumn(a),g=a.name;l.push(new I({field:a,fieldName:g,grid:t,hidden:this._isFieldHidden(g),layer:i,messages:s,messagesCommon:o,messagesURIUtils:r,store:n,tableEditingEnabled:e,timeZone:h,timeZoneName:d}))})),l):l}_getTimeZoneInfoForFieldColumn(e){const{layer:t,timeZone:i,view:s}=this;return!t||"date"!==e?.type&&"timestamp-offset"!==e?.type?{timeZone:void 0,timeZoneName:void 0}:p(t.preferredTimeZone||null,!!t.datesInUnknownTimezone,i??s?.timeZone??u,O("short-time"),e.type)}_generateAttachmentsColumn(){return new _({hidden:this._isFieldHidden(F.attachments),messages:this.messages})}_generateRelationshipColumns(){const{_relationshipInfos:e,grid:t,messages:i,messagesCommon:s,messagesURIUtils:o,relationshipColumnConfigs:r}=this,n=[];if(!e?.length)return n;const l={grid:t,messages:i,messagesCommon:s,messagesURIUtils:o};return r?r.forEach((t=>{const{relationshipId:i}=t,s=e.find((e=>e.relationshipId===i));s&&n.push(new C({...t,...l,fieldName:`${F.relationship}-${i}`,layer:s.relatedLayer,relatedLayer:s.layer,relationshipId:i,showRelatedTableCallback:e=>this._onShowRelatedTable(e)}))})):e.forEach((({layer:e,relatedLayer:t,relationshipId:i})=>{n.push(new C({...l,fieldName:`${F.relationship}-${i}`,layer:t,relatedLayer:e,relationshipId:i,showRelatedTableCallback:e=>this._onShowRelatedTable(e)}))})),n}_generateActionColumn(){return new b({hidden:this._isFieldHidden(F.action),...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some((e=>e.toLowerCase()===t))}_addTableHighlight(e){const{_highlightableLayerView:t,layer:i}=this;if(t&&i){const s=this.store.getItemByObjectId(e),o=s?.feature??e;this._highlights.add(t.highlight(o),`${i.id}-${e}`)}}_removeTableHighlight(e){const{layer:t}=this;t&&this._highlights.remove(`${t.id}-${e}`)}_syncSelection(){this._highlights.removeAll(),this._tableHighlightsReady?this.highlightIds.forEach((e=>this._addTableHighlight(e))):this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}_appendToViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.appendToSelection(t,e)}_removeFromViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.removeFromSelection(t,e)}_onHighlightIdsChange(e){const{added:t,removed:i}=e;this._tableHighlightsReady?(i.forEach((e=>this._removeTableHighlight(e))),t.forEach((e=>this._addTableHighlight(e)))):this._viewSelectionReady&&(this._removeFromViewSelection(i),this._appendToViewSelection(t)),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray())}_onShowRelatedTable(e){const{highlightIds:t}=this,{objectId:i}=e;t.removeAll(),t.add(i),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit("show-related-table",e)}_onObjectIdsChange(){const e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning("Object ID filter was applied while a selection filter was applied. Selection filter has been removed.")),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.refreshPageCache()}_drainColumns(){this.columns.drain((e=>!e.destroyed&&e.destroy()))}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex((e=>e.frozenToEnd));return e>-1?e:void 0}_logWarning(e){r.getLogger(this).warn(e)}};e([g()],z.prototype,"_defaultHiddenFields",null),e([g()],z.prototype,"_effectiveTableTemplate",null),e([g()],z.prototype,"_highlights",void 0),e([g()],z.prototype,"_highlightableLayerView",null),e([g()],z.prototype,"_relationshipInfos",null),e([g()],z.prototype,"_selectionManager",null),e([g()],z.prototype,"_selectableLayer",null),e([g()],z.prototype,"_tableHighlightsReady",null),e([g()],z.prototype,"_viewSelection",null),e([g()],z.prototype,"_viewSelectionReady",null),e([g()],z.prototype,"actionColumnConfig",void 0),e([g()],z.prototype,"activeFilters",null),e([g({readOnly:!0})],z.prototype,"activeSortOrders",null),e([g()],z.prototype,"attachmentsEnabled",null),e([g()],z.prototype,"autoRefreshEnabled",void 0),e([g({readOnly:!0})],z.prototype,"columns",void 0),e([g()],z.prototype,"dataProvider",void 0),e([g()],z.prototype,"editingEnabled",void 0),e([g()],z.prototype,"filterGeometry",null),e([g()],z.prototype,"filterBySelectionEnabled",null),e([g({readOnly:!0})],z.prototype,"grid",void 0),e([g()],z.prototype,"hiddenFields",null),e([g()],z.prototype,"highlightEnabled",void 0),e([g()],z.prototype,"isQueryingOrSyncing",null),e([g({readOnly:!0})],z.prototype,"itemIdPath",void 0),e([g()],z.prototype,"layer",void 0),e([g()],z.prototype,"layerView",null),e([g()],z.prototype,"messages",void 0),e([g(),x("esri/t9n/common")],z.prototype,"messagesCommon",void 0),e([g(),x("esri/widgets/support/t9n/uriUtils")],z.prototype,"messagesURIUtils",void 0),e([g()],z.prototype,"outFields",null),e([g()],z.prototype,"relatedRecordsEnabled",null),e([g()],z.prototype,"relationship",null),e([g()],z.prototype,"relationshipColumnConfigs",void 0),e([g()],z.prototype,"relationshipConfig",null),e([g()],z.prototype,"relationships",null),e([g()],z.prototype,"returnGeometryEnabled",null),e([g()],z.prototype,"returnMEnabled",null),e([g()],z.prototype,"returnZEnabled",null),e([g()],z.prototype,"selectionSource",void 0),e([g()],z.prototype,"showRelatedTableCallback",void 0),e([g({readOnly:!0,type:S})],z.prototype,"store",void 0),e([g({type:j})],z.prototype,"tableTemplate",void 0),e([g()],z.prototype,"tableTemplateOverride",void 0),e([g()],z.prototype,"timeExtent",null),e([g()],z.prototype,"timeZone",void 0),e([g()],z.prototype,"view",null),z=e([m("esri.widgets.FeatureTable.FeatureTableViewModel")],z);const A=z;export{A 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/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Evented.js";import{watch as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{autoLink as s}from"../../support/uriUtils.js";import{renderingSanitizer as r}from"../../support/widgetUtils.js";const l="esri-column",c={sorter:`${l}__sorter`,headerContent:`${l}__header-content`,headerLabel:`${l}__header-label`,headerMenuIcon:`${l}__header-menu-icon`};let a=class extends t.EventedAccessor{constructor(e){super(e),this._menuIsOpen=!1,this.autoWidth=!1,this.cellValueFormatFunction=e=>{const{rowData:t,value:o}=e,{formatFunction:n}=this,i=r.sanitize(o);if(n&&t){const{index:e,item:{feature:o}}=t;return n({column:this,feature:o,index:e,value:i})}return i},this.direction=null,this.fieldName=null,this.flexGrow=1,this.footerRenderFunction=null,this.formatFunction=null,this.frozen=!1,this.frozenToEnd=!1,this.grid=null,this.headerRenderFunction=e=>{const{root:t}=e,o=this.createHeaderContent();this.removeCellContent(t),t.appendChild(o)},this.hidden=!1,this.icon=null,this.initialSortPriority=null,this.label=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.renderFunction=({root:e,column:t,rowData:o})=>{const n=this.getCellValue(o),i=this.cellValueFormatFunction({column:t,rowData:o,value:n});let r=null;r=i instanceof HTMLElement?i:s(this.messagesURIUtils,i),this.removeCellContent(e),r instanceof HTMLElement?e.appendChild(r):null!=r&&(e.innerHTML=r.toString())},this.resizable=!0,this.sortable=!1,this.store=null,this.textAlign="start",this.textWrap=!1,this.timeZone=null,this.timeZoneName=null,this.visibleElements=null,this.width=200}initialize(){const{fieldName:e}=this;this._set("sortElement",this.createSortElement()),this.sortElement.setAttribute("path",e),this.addHandles([o((()=>this.direction),(e=>{const{sortElement:t}=this;this.sortable&&t&&(e?this.sortElement.direction!==e&&t.setAttribute("direction",e):t.removeAttribute("direction"))})),o((()=>this.hidden),(()=>this.closeMenu())),o((()=>this.fieldName),(e=>{const{sortElement:t}=this;t&&t.path!==e&&t.setAttribute("path",e)})),o((()=>this.effectiveLabel),(e=>{const{sortElement:t}=this;t&&t.textContent!==e&&(t.setAttribute("title",e),t.textContent=e)}))])}get customMenuItems(){return this.menuConfig?.items?.map((({disabled:e,hidden:t,icon:o,iconClass:n,label:i,selected:s,clickFunction:r})=>this.createCalciteDropdownItem({disabled:e,hidden:t,iconClass:n,iconStart:o,selected:s,textContent:i,onclick:e=>r(e)})))??[]}get defaultMenuItems(){if(!this.sortable)return[];const e=this.messages,t=[],o=this.visibleElements?.columnMenuItems;if(!1!==o?.sortAscending){const o=this.createCalciteDropdownItem({iconStart:"sort-ascending-arrow",textContent:e?.sortAsc,onclick:()=>this.direction="asc"});t.push(o)}if(!1!==o?.sortDescending){const o=this.createCalciteDropdownItem({iconStart:"sort-descending-arrow",textContent:e?.sortDesc,onclick:()=>this.direction="desc"});t.push(o)}return t}get effectiveLabel(){return r.sanitize(this.label||this.fieldName)}get iconNode(){const{icon:e}=this;return e?this.createCalciteIcon({icon:e}):null}set invalid(e){this._set("invalid",e),this.grid?.generateCellPartNames()}get menu(){const{customMenuItems:e,defaultMenuItems:t,menuConfig:o}=this,n=!!o?.open,i=this.createCalciteAction({icon:o?.icon??"ellipsis",text:this.messages?.menu??"",slot:"trigger"}),s=document.createElement("calcite-dropdown");if(s.maxItems=o?.maxItems??4,s.placement="top-end",s.overlayPositioning="fixed",s.scale=o?.scale??"m",n&&(s.open=n,this._menuIsOpen=!0),s.appendChild(i),s.addEventListener("calciteDropdownOpen",(()=>this._menuIsOpen=!0)),s.addEventListener("calciteDropdownClose",(()=>this._menuIsOpen=!1)),s.onkeydown=this._stopPropagationOnSelect,s.addEventListener("mousewheel",(e=>{e.stopPropagation()})),t.length){const e=s.appendChild(document.createElement("calcite-dropdown-group"));e.selectionMode="none",e.append(...t)}if(e.length){const t=s.appendChild(document.createElement("calcite-dropdown-group"));t.selectionMode=o?.selectionMode??"none",t.append(...e)}return s}get menuItems(){return[...this.defaultMenuItems,...this.customMenuItems]}get menuIsOpen(){return this._menuIsOpen}get menuIsVisible(){return!(!1===this.visibleElements?.columnMenus||!this.menuItems.length)}closeMenu(){this.menu.open=!1}getCellValue(e){return e?.item.feature.attributes?.[this.fieldName]}createSortElement(){const{effectiveLabel:e,direction:t,fieldName:o,initialSortPriority:n}=this,i=document.createElement("vaadin-grid-sorter");return i.classList.add(c.sorter),i.setAttribute("path",o),i.setAttribute("title",e),i.textContent=e,t&&i.setAttribute("direction",t),null!=n&&(i._initialOrder=n),i.addEventListener("direction-changed",(()=>{this.direction!==i.direction&&this._set("direction",i.direction)})),i}createCalciteAction(e){const t=document.createElement("calcite-action"),{className:o,disabled:n,icon:i,label:s,scale:r,slot:l,text:c,textEnabled:a,onclick:d}=e;return t.className=o??"",t.disabled=!!n,t.icon=i??"",t.label=s??"",t.scale=r??"s",t.slot=l??"",t.text=t.title=c??"",t.textEnabled=!!a,t.onclick=d??null,t}createCalciteButton(e){const t=document.createElement("calcite-button"),{appearance:o,className:n,disabled:i,iconEnd:s,iconFlipRtl:r,loading:l,onclick:c,scale:a,textContent:d}=e;return t.className=n??"",t.scale=a??"s",t.appearance=o??"transparent",t.disabled=!!i,t.iconEnd=s??"",r&&(t.iconFlipRtl=r),t.loading=!!l,t.textContent=t.title=d??"",t.onclick=c??null,t}createCalciteDropdownItem(e){const t=document.createElement("calcite-dropdown-item"),{disabled:o,hidden:n,iconClass:i,iconStart:s,textContent:r,onclick:l,selected:a}=e,d=r??"";if(i&&!s){const e=document.createElement("span"),o=document.createElement("span");o.classList.add(c.headerMenuIcon,i),e.textContent=e.title=d,e.insertBefore(o,e.firstChild),t.appendChild(e)}else t.iconStart=s??"",t.textContent=t.title=d;return t.disabled=!!o,t.hidden="function"==typeof n?n():!!n,t.selected=!!a,l&&(t.addEventListener("calciteDropdownItemSelect",l),t.onkeydown=this._stopPropagationOnSelect),t}createCalciteIcon(e){const{effectiveLabel:t}=this,{icon:o,scale:n,textLabel:i}=e,s=document.createElement("calcite-icon"),r=i??t;return s.icon=o,s.scale=n??"s",s.textLabel=r,s.title=r,s}createHeaderContent(){const{effectiveLabel:e,iconNode:t}=this,o=document.createElement("div");if(o.classList.add(c.headerContent),t&&o.appendChild(t),this.sortable)o.appendChild(this.sortElement);else if(""!==e){const t=document.createElement("div");t.classList.add(c.headerLabel);const n=t.appendChild(document.createElement("span"));n.textContent=e,n.setAttribute("title",e),o.appendChild(t)}return this.menuIsVisible&&o.appendChild(this.menu),o}removeCellContent(e){if(e&&e.firstChild)try{for(;e?.firstChild;)e?.removeChild(e.firstChild)}catch(t){}}openMenu(){this.menuIsVisible&&(this.menu.open=!0,this.menuItems[0]?.setFocus())}sort(){this.sortable&&this.sortElement?.click()}_stopPropagationOnSelect(e){"Enter"!==e.key&&" "!==e.key||e.stopPropagation()}};e([n()],a.prototype,"_menuIsOpen",void 0),e([n()],a.prototype,"autoWidth",void 0),e([n()],a.prototype,"cellValueFormatFunction",void 0),e([n()],a.prototype,"customMenuItems",null),e([n()],a.prototype,"defaultMenuItems",null),e([n()],a.prototype,"direction",void 0),e([n()],a.prototype,"effectiveLabel",null),e([n({constructOnly:!0})],a.prototype,"fieldName",void 0),e([n()],a.prototype,"flexGrow",void 0),e([n()],a.prototype,"footerRenderFunction",void 0),e([n()],a.prototype,"formatFunction",void 0),e([n()],a.prototype,"frozen",void 0),e([n()],a.prototype,"frozenToEnd",void 0),e([n()],a.prototype,"grid",void 0),e([n()],a.prototype,"iconNode",null),e([n()],a.prototype,"invalid",null),e([n()],a.prototype,"headerRenderFunction",void 0),e([n()],a.prototype,"hidden",void 0),e([n()],a.prototype,"icon",void 0),e([n({constructOnly:!0})],a.prototype,"initialSortPriority",void 0),e([n()],a.prototype,"label",void 0),e([n()],a.prototype,"menu",null),e([n()],a.prototype,"menuItems",null),e([n()],a.prototype,"menuConfig",void 0),e([n()],a.prototype,"menuIsOpen",null),e([n()],a.prototype,"menuIsVisible",null),e([n()],a.prototype,"messages",void 0),e([n()],a.prototype,"messagesCommon",void 0),e([n()],a.prototype,"messagesURIUtils",void 0),e([n()],a.prototype,"renderFunction",void 0),e([n()],a.prototype,"resizable",void 0),e([n()],a.prototype,"sortable",void 0),e([n({readOnly:!0})],a.prototype,"sortElement",void 0),e([n()],a.prototype,"store",void 0),e([n()],a.prototype,"textAlign",void 0),e([n()],a.prototype,"textWrap",void 0),e([n()],a.prototype,"timeZone",void 0),e([n()],a.prototype,"timeZoneName",void 0),e([n()],a.prototype,"visibleElements",void 0),e([n()],a.prototype,"width",void 0),a=e([i("esri.widgets.FeatureTable.Grid.Column")],a);const d=a;export{d as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Evented.js";import{watch as n}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{autoLink as s}from"../../support/uriUtils.js";import{renderingSanitizer as r}from"../../support/widgetUtils.js";const l="esri-column",a={sorter:`${l}__sorter`,headerContent:`${l}__header-content`,headerLabel:`${l}__header-label`,headerMenuIcon:`${l}__header-menu-icon`};let c=class extends t.EventedAccessor{constructor(e){super(e),this._menuIsOpen=!1,this.autoWidth=!1,this.cellValueFormatFunction=e=>{const{rowData:t,value:n}=e,{formatFunction:o}=this,i=r.sanitize(n);if(o&&t){const{index:e,item:{feature:n}}=t;return o({column:this,feature:n,index:e,value:i})}return i},this.direction=null,this.fieldName=null,this.flexGrow=1,this.footerRenderFunction=null,this.formatFunction=null,this.frozen=!1,this.frozenToEnd=!1,this.grid=null,this.headerRenderFunction=e=>{const{root:t}=e,n=this.createHeaderContent();this.removeCellContent(t),t.appendChild(n)},this.hidden=!1,this.icon=null,this.initialSortPriority=null,this.label=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.renderFunction=({root:e,column:t,rowData:n})=>{const o=this.getCellValue(n),i=this.cellValueFormatFunction({column:t,rowData:n,value:o});let r=null;r=i instanceof HTMLElement?i:s(this.messagesURIUtils,i),this.removeCellContent(e),r instanceof HTMLElement?e.appendChild(r):null!=r&&(e.innerHTML=r.toString())},this.resizable=!0,this.sortable=!1,this.store=null,this.textAlign="start",this.textWrap=!1,this.timeZone=null,this.timeZoneName=null,this.visibleElements=null,this.width=200}initialize(){const{fieldName:e}=this;this._set("sortElement",this.createSortElement()),this.sortElement.setAttribute("path",e),this.addHandles([n((()=>this.direction),(e=>{const{sortElement:t}=this;this.sortable&&t&&(e?this.sortElement.direction!==e&&t.setAttribute("direction",e):t.removeAttribute("direction"))})),n((()=>this.hidden),(()=>this.closeMenu())),n((()=>this.fieldName),(e=>{const{sortElement:t}=this;t&&t.path!==e&&t.setAttribute("path",e)})),n((()=>this.effectiveLabel),(e=>{const{sortElement:t}=this;t&&t.textContent!==e&&(t.setAttribute("title",e),t.textContent=e)}))])}get customMenuItems(){return this.menuConfig?.items?.map((({disabled:e,hidden:t,icon:n,iconClass:o,label:i,selected:s,clickFunction:r})=>this.createCalciteDropdownItem({disabled:e,hidden:t,iconClass:o,iconStart:n,selected:s,textContent:i,onclick:e=>r(e)})))??[]}get defaultMenuItems(){if(!this.sortable)return[];const e=this.messages,t=[],n=this.visibleElements?.columnMenuItems;if(!1!==n?.sortAscending){const n=this.createCalciteDropdownItem({iconStart:"sort-ascending-arrow",textContent:e?.sortAsc,onclick:()=>this.direction="asc"});t.push(n)}if(!1!==n?.sortDescending){const n=this.createCalciteDropdownItem({iconStart:"sort-descending-arrow",textContent:e?.sortDesc,onclick:()=>this.direction="desc"});t.push(n)}return t}get effectiveLabel(){return r.sanitize(this.label||this.fieldName)}get iconNode(){const{icon:e}=this;return e?this.createCalciteIcon({icon:e}):null}set invalid(e){this._set("invalid",e),this.grid?.generateCellPartNames()}get menu(){const{customMenuItems:e,defaultMenuItems:t,menuConfig:n}=this,o=!!n?.open,i=this.createCalciteAction({icon:n?.icon??"ellipsis",text:this.messages?.menu??"",slot:"trigger"}),s=document.createElement("calcite-dropdown");if(s.maxItems=n?.maxItems??4,s.placement="top-end",s.overlayPositioning="fixed",s.scale=n?.scale??"m",o&&(s.open=o,this._menuIsOpen=!0),s.appendChild(i),s.addEventListener("calciteDropdownOpen",(()=>this._menuIsOpen=!0)),s.addEventListener("calciteDropdownClose",(()=>this._menuIsOpen=!1)),s.onkeydown=this._stopPropagationOnSelect,s.addEventListener("mousewheel",(e=>{e.stopPropagation()})),t.length){const e=s.appendChild(document.createElement("calcite-dropdown-group"));e.selectionMode="none",e.append(...t)}if(e.length){const t=s.appendChild(document.createElement("calcite-dropdown-group"));t.selectionMode=n?.selectionMode??"none",t.append(...e)}return s}get menuItems(){return[...this.defaultMenuItems,...this.customMenuItems]}get menuIsOpen(){return this._menuIsOpen}get menuIsVisible(){return!(!1===this.visibleElements?.columnMenus||!this.menuItems.length)}closeMenu(){this.menu.open=!1}getCellValue(e){return e?.item.feature.attributes?.[this.fieldName]}createSortElement(){const{effectiveLabel:e,direction:t,fieldName:n,initialSortPriority:o}=this,i=document.createElement("vaadin-grid-sorter");return i.classList.add(a.sorter),i.setAttribute("path",n),i.setAttribute("title",e),i.textContent=e,t&&i.setAttribute("direction",t),null!=o&&(i._initialOrder=o),i.addEventListener("direction-changed",(()=>{this.direction!==i.direction&&this._set("direction",i.direction)})),i}createCalciteAction(e){const t=document.createElement("calcite-action"),{appearance:n,className:o,disabled:i,icon:s,label:r,scale:l,slot:a,text:c,textEnabled:d,onclick:p}=e;return t.appearance=n??"transparent",t.className=o??"",t.disabled=!!i,t.icon=s??"",t.label=r??"",t.scale=l??"s",t.slot=a??"",t.text=t.title=c??"",t.textEnabled=!!d,t.onclick=p??null,t}createCalciteButton(e){const t=document.createElement("calcite-button"),{appearance:n,className:o,disabled:i,iconEnd:s,iconFlipRtl:r,loading:l,onclick:a,scale:c,textContent:d}=e;return t.className=o??"",t.scale=c??"s",t.appearance=n??"transparent",t.disabled=!!i,t.iconEnd=s??"",r&&(t.iconFlipRtl=r),t.loading=!!l,t.textContent=t.title=d??"",t.onclick=a??null,t}createCalciteDropdownItem(e){const t=document.createElement("calcite-dropdown-item"),{disabled:n,hidden:o,iconClass:i,iconStart:s,textContent:r,onclick:l,selected:c}=e,d=r??"";if(i&&!s){const e=document.createElement("span"),n=document.createElement("span");n.classList.add(a.headerMenuIcon,i),e.textContent=e.title=d,e.insertBefore(n,e.firstChild),t.appendChild(e)}else t.iconStart=s??"",t.textContent=t.title=d;return t.disabled=!!n,t.hidden="function"==typeof o?o():!!o,t.selected=!!c,l&&(t.addEventListener("calciteDropdownItemSelect",l),t.onkeydown=this._stopPropagationOnSelect),t}createCalciteIcon(e){const{effectiveLabel:t}=this,{icon:n,scale:o,textLabel:i}=e,s=document.createElement("calcite-icon"),r=i??t;return s.icon=n,s.scale=o??"s",s.textLabel=r,s.title=r,s}createHeaderContent(){const{effectiveLabel:e,iconNode:t}=this,n=document.createElement("div");if(n.classList.add(a.headerContent),t&&n.appendChild(t),this.sortable)n.appendChild(this.sortElement);else if(""!==e){const t=document.createElement("div");t.classList.add(a.headerLabel);const o=t.appendChild(document.createElement("span"));o.textContent=e,o.setAttribute("title",e),n.appendChild(t)}return this.menuIsVisible&&n.appendChild(this.menu),n}removeCellContent(e){if(e&&e.firstChild)try{for(;e?.firstChild;)e?.removeChild(e.firstChild)}catch(t){}}openMenu(){this.menuIsVisible&&(this.menu.open=!0,this.menuItems[0]?.setFocus())}sort(){this.sortable&&this.sortElement?.click()}_stopPropagationOnSelect(e){"Enter"!==e.key&&" "!==e.key||e.stopPropagation()}};e([o()],c.prototype,"_menuIsOpen",void 0),e([o()],c.prototype,"autoWidth",void 0),e([o()],c.prototype,"cellValueFormatFunction",void 0),e([o()],c.prototype,"customMenuItems",null),e([o()],c.prototype,"defaultMenuItems",null),e([o()],c.prototype,"direction",void 0),e([o()],c.prototype,"effectiveLabel",null),e([o({constructOnly:!0})],c.prototype,"fieldName",void 0),e([o()],c.prototype,"flexGrow",void 0),e([o()],c.prototype,"footerRenderFunction",void 0),e([o()],c.prototype,"formatFunction",void 0),e([o()],c.prototype,"frozen",void 0),e([o()],c.prototype,"frozenToEnd",void 0),e([o()],c.prototype,"grid",void 0),e([o()],c.prototype,"iconNode",null),e([o()],c.prototype,"invalid",null),e([o()],c.prototype,"headerRenderFunction",void 0),e([o()],c.prototype,"hidden",void 0),e([o()],c.prototype,"icon",void 0),e([o({constructOnly:!0})],c.prototype,"initialSortPriority",void 0),e([o()],c.prototype,"label",void 0),e([o()],c.prototype,"menu",null),e([o()],c.prototype,"menuItems",null),e([o()],c.prototype,"menuConfig",void 0),e([o()],c.prototype,"menuIsOpen",null),e([o()],c.prototype,"menuIsVisible",null),e([o()],c.prototype,"messages",void 0),e([o()],c.prototype,"messagesCommon",void 0),e([o()],c.prototype,"messagesURIUtils",void 0),e([o()],c.prototype,"renderFunction",void 0),e([o()],c.prototype,"resizable",void 0),e([o()],c.prototype,"sortable",void 0),e([o({readOnly:!0})],c.prototype,"sortElement",void 0),e([o()],c.prototype,"store",void 0),e([o()],c.prototype,"textAlign",void 0),e([o()],c.prototype,"textWrap",void 0),e([o()],c.prototype,"timeZone",void 0),e([o()],c.prototype,"timeZoneName",void 0),e([o()],c.prototype,"visibleElements",void 0),e([o()],c.prototype,"width",void 0),c=e([i("esri.widgets.FeatureTable.Grid.Column")],c);const d=c;export{d 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/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{watch as l,sync as o,initial as s,on as n}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as d}from"../layers/catalog/catalogUtils.js";import{isKnowledgeGraphLayer as c,isSubtypeGroupLayer as h}from"../layers/support/layerUtils.js";import p from"./Widget.js";import m from"./FeatureTable/ColumnMenuVisibleElements.js";import u from"./FeatureTable/FeatureTableViewModel.js";import g from"./FeatureTable/VisibleElements.js";import b from"./FeatureTable/support/FieldColumnTemplate.js";import w from"./FeatureTable/support/TableTemplate.js";import{isIFeatureTableSupportedLayer as v,uniqueColumnNames as y,isIFeatureTableSupportedLayerWithAttachments as f,isMapImageLayer as _}from"./FeatureTable/support/tableUtils.js";import{loadCalciteComponents as M}from"./support/componentsUtils.js";import{globalCss as T}from"./support/globalCss.js";import{Heading as S}from"./support/Heading.js";import{renderingSanitizer as C}from"./support/widgetUtils.js";import{messageBundle as E}from"./support/decorators/messageBundle.js";import{vmEvent as I}from"./support/decorators/vmEvent.js";import{tsx as R}from"./support/jsxFactory.js";import{substitute as A}from"../intl/substitute.js";var x;const j="esri-feature-table",F=`${j}__prompt`,k={base:j,content:`${j}__content`,menuPopover:`${j}__menu-popover`,layerDropdownMenu:`${j}__layer-switcher-menu`,tableContainer:`${j}__table-container`,tableNavigation:`${j}__table-navigation`,expanded:`${j}__expanded`,collapsed:`${j}__collapsed`,promptContainer:F,promptHeader:`${F}__header`,promptHeading:`${F}__header__heading`,promptMessage:`${F}__message`,promptDivider:`${F}__divider`,promptActions:`${F}__actions`},V={clearSelection:"clear-selection",exportToCSV:"file-csv",delete:"trash",refresh:"refresh",showAll:"selection-x",showSelected:"selection-filter",zoomToSelection:"zoom-to-object"};let D=x=class extends p{constructor(e,t){super(e,t),this._columnVisibilityActions=new Map,this._prompt=null,this._showAllTablesEnabled=!1,this.description=null,this.disabled=!1,this.layers=null,this.menuConfig=null,this.relatedTables=new i,this.tableParent=null,this.title=null,this.viewModel=new u,this.visibleElements=new g,this.visibleElementsOverride=null,this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([l((()=>[this.viewModel.store.querying,this.viewModel.store.syncing,this.editingEnabled]),(()=>this.scheduleRender())),l((()=>({visibleElements:this._effectiveVisibleElements,items:this.columns.length})),(({visibleElements:e})=>{this.columns.forEach((t=>t.visibleElements=e)),this.refreshCellContent()}),o),l((()=>this._effectiveVisibleElements.selectionColumn),(e=>{this.grid&&(this.grid.selectionColumnEnabled=e)}),s),n((()=>this.viewModel),"show-related-table",(e=>this._onShowRelatedTable(e))),l((()=>this.viewModel.state),(e=>{"disabled"===e&&this.relatedTables.length&&this._drainRelatedTables()}))])}loadDependencies(){return M({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown.js"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group.js"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),pagination:()=>import("@esri/calcite-components/dist/components/calcite-pagination.js"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel.js"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover.js"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress.js"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone.js"),option:()=>import("@esri/calcite-components/dist/components/calcite-option.js"),select:()=>import("@esri/calcite-components/dist/components/calcite-select.js")})}destroy(){this._drainRelatedTables(),this._clearPrompt()}get _effectiveDescription(){const{description:e}=this;return null!=e?C.sanitize("function"==typeof e?e():e):void 0}get _effectiveLayers(){const{layer:e,layers:t}=this,i=t?.length?t.filter(v):[],l=i.length?i:[...this._viewLayers];return e&&!l.includes(e)&&l.push(e),l}get _effectiveTable(){return this.relatedTable||this}get _effectiveTitle(){const{layer:e,messages:t,state:i,highlightIds:l,title:o,size:s}=this;if(o)return C.sanitize("function"==typeof o?o():o);if(!e)return t.noLayer;switch(i){case"disabled":return t.errorLayer;case"ready":case"loading":return t.loading;case"error":return t.errorData}return A(t.header,{title:C.sanitize(e.title),count:s,selected:l.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}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 _shouldShowMenu(){const{header:e,menu:t}=this._effectiveVisibleElements;return!(!e||!t||!this._hasDefaultMenuItems&&!this._hasCustomMenuItems)}get _showClearSelectionAction(){return!(!this.highlightIds.length||!this._effectiveVisibleElements.menuItems?.clearSelection||this.relatedTables.length)}get _showColumnsVisibilityAction(){const{header:e,menu:t,menuItems:i}=this._effectiveVisibleElements;return!(!(e&&t&&i?.toggleColumns)||this.showRelatedTableCallback||this.allRelatedTablesVisible)}get _showDeleteSelectionAction(){return!(!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete)||this.relatedTables.length)}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 _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)}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=>{!v(e)||h(e)||t.has(e)||t.add(e)},l=e=>{d(e)||"catalog-footprint"===e.type||(c(e)?(e.layers?.forEach(i),e.tables?.forEach(i)):_(e)?(e.sublayers?.forEach(i),e.subtables?.forEach(i)):h(e)?e.sublayers?.forEach(i):i(e))};return e.allLayers.forEach(l),e.allTables.forEach(l),[...t.values()]}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 allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this._showAllTablesEnabled)}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=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 editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveSize(){return this.viewModel.effectiveSize}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 grid(){return this.viewModel.grid}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 isQueryingOrSyncing(){return this.viewModel.isQueryingOrSyncing||this.relatedTables.some((e=>!!e.isQueryingOrSyncing))}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this._drainRelatedTables(),this.viewModel.layer=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 messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(e){this.viewModel.messagesURIUtils=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 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 relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){return this.viewModel.relationship}get relationshipColumnConfigs(){return this.viewModel.relationshipColumnConfigs}set relationshipColumnConfigs(e){this.viewModel.relationshipColumnConfigs=e}get relationshipConfig(){return this.viewModel.relationshipConfig}set relationshipConfig(e){this.viewModel.relationshipConfig=e}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 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 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}clearSelectionFilter(){this.viewModel.clearSelectionFilter()}deleteSelection(e){return this.highlightIds.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}exportSelectionToCSV(){this.viewModel.exportSelectionToCSV()}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(){this.relatedTables.forEach((async e=>await e.refresh())),await this.viewModel.refresh()}refreshCellContent(){this.viewModel.refreshCellContent()}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)}toggleAllRelatedTables(e){const t=this.relatedTable;this._showAllTablesEnabled=e,t&&(e?this._enterShowAllView(t):this._exitShowAllView(t))}zoomToSelection(){this._effectiveTable.viewModel.zoomToSelection()}render(){const{_prompt:e,_effectiveVisibleElements:t,isQueryingOrSyncing:i,menuConfig:l,state:o}=this;return R("div",{bind:this,class:this.classes(k.base,T.widget)},R("calcite-panel",{bind:this,class:k.content,closable:t.close,description:this._effectiveDescription,disabled:this.disabled||"disabled"===o&&!this._effectiveLayers?.length,heading:t.header?this._effectiveTitle:void 0,loading:"loading"===o,menuOpen:!!l?.open,overlayPositioning:"fixed",onCalcitePanelClose:e=>{e.target.closed=!1,this.emit("close")}},t.progress?R("calcite-progress",{type:i?"indeterminate":"determinate"}):null,this._showLayerDropdown?this._renderLayerDropdown():null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderRelatedTableNavigationBar(),this._renderTables()),e?R("calcite-scrim",null,this._renderPrompt(e)):null)}_renderTables(){const{allRelatedTablesVisible:e,grid:t,relatedTables:i}=this;if(i.length){const l=i.toArray(),o=1===l.length,s=this.classes(k.base,e?k.expanded:k.collapsed),n=e||o,r=e?l:o?[l[0]]:l.slice(-2);return R("div",{class:k.tableContainer},R("calcite-panel",{overlayPositioning:"fixed"},R("div",null,[n?R("div",{class:s},t?.render(),this._renderPagination()):void 0,...r.map((e=>{const t=i.indexOf(e);return R("div",{class:s,key:`related-${t}`},e.render())})),,])))}return[R("div",{class:k.tableContainer},t?.render()),this._renderPagination()]}_renderPagination(){if(this.paginationEnabled)return R("calcite-pagination",{pageSize:1,startItem:this.pageIndex+1,totalItems:this.pageCount,onCalcitePaginationChange:e=>this.goToPage(e.target.startItem-1)})}_clearPrompt(){this._prompt=null}_renderPrompt({title:e,message:t,context:i,actions:l}){const o=R("calcite-button",{appearance:"solid",key:"prompt-primary-button",kind:"danger"===i?"danger":"brand",onclick:l.primary.action,width:l.secondary?"half":"full"},l.primary.label),s=l.secondary?R("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:"danger"===i?"danger":"brand",onclick:l.secondary.action,width:"half"},l.secondary.label):null;return R("div",{class:`${k.promptContainer}--${i}`},R("div",{class:k.promptHeader},R("calcite-icon",{icon:"exclamation-mark-triangle"}),R(S,{class:k.promptHeading,level:2},e)),R("div",{class:k.promptMessage},t),R("div",{class:k.promptDivider}),R("div",{class:k.promptActions},s,o))}_showDeletePrompt(){const{messages:e,messagesCommon:t}=this,i=A(e.deleteSelectionCount,{count:this.highlightIds.length});this._prompt={title:i,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:t.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,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:s}=e;if(!i)return R("calcite-action",{disabled:t??this.menuConfig?.disabled,icon:l??void 0,key:o,onclick:()=>s(),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:V.refresh,text:e.refreshData,clickFunction:()=>this.refresh()},this._showDeleteSelectionAction&&{icon:V.delete,text:e.deleteSelection,clickFunction:()=>this.deleteSelection(!0)},this._showClearSelectionAction&&{icon:V.clearSelection,text:e.clearSelection,clickFunction:()=>this.highlightIds?.removeAll()},this._showZoomToSelectionAction&&{icon:V.zoomToSelection,text:e.zoomToSelection,clickFunction:()=>this.zoomToSelection()},this._showSelectedRecordsShowSelectedAction&&{icon:V.showSelected,text:e.showSelected,clickFunction:()=>{const{objectIds:e}=this;e.removeAll(),e.addMany(this.highlightIds.toArray())}},this._showSelectedRecordsShowAllAction&&{icon:V.showAll,text:e.showAllRecords,clickFunction:()=>this.objectIds.removeAll()},this._showExportSelectionToCSVAction&&{icon:V.exportToCSV,text:e.exportSelectionCSV,clickFunction:()=>this.exportSelectionToCSV()}].filter(t).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,_effectiveVisibleElements:i,id:l,messages:o}=this,s=t.columns.toArray(),n=o?.toggleColumns,r=`${l}__toggle-columns-action`,a=[R("calcite-action",{afterCreate:t=>e.set(l,t),afterRemoved:()=>e.delete(l),appearance:"transparent",bind:this,disabled:t.menuConfig?.disabled,icon:"show-column",id:r,slot:"header-actions-end",text:n},i.tooltips?R("calcite-tooltip",{closeOnClick:!0,overlayPositioning:"fixed",placement:"bottom-end",slot:"tooltip"},n):null)];return t.menuConfig?.disabled||a.push(R("calcite-popover",{autoClose:!0,class:k.menuPopover,label:n,overlayPositioning:"fixed",placement:"top-end",pointerDisabled:!0,referenceElement:e.get(l)},R("calcite-list",{filterEnabled:!0,filterPlaceholder:o.toggleColumns,selectionMode:"multiple"},...s.map((e=>{const i="columns"in e&&e.columns?.length?e.columns.map((e=>this._renderColumnListItem({column:e,table:t,ignoreSelect:!0}))):void 0;return this._renderColumnListItem({column:e,table:t,items:i})}))))),a}_renderColumnListItem(e){const{column:t,table:i,items:l,ignoreSelect:o}=e,{effectiveLabel:s,fieldName:n,hidden:r}=t;return R("calcite-list-item",{key:`toggle-columns__item-${n}`,label:s,open:!(!l?.length||r)||void 0,selected:!r,value:n,onCalciteListItemSelect:e=>{o||i.toggleColumnVisibility(e.target.value)}},l)}_renderLayerDropdown(){const e=this.messages.selectALayer;return R("div",{class:k.layerDropdownMenu,key:`${this.id}-layerDropdown`,slot:"header-actions-start"},R("calcite-dropdown",{bind:this,maxItems:5,overlayPositioning:"fixed",placement:"bottom-start"},R("calcite-action",{icon:"layers",slot:"trigger",text:e,title:e}),R("calcite-dropdown-group",{selectionMode:"single"},this._effectiveLayers.map(((e,t)=>this._renderLayerDropdownItem(e,t)))??null)))}_renderLayerDropdownItem(e,t){return R("calcite-dropdown-item",{key:`dropdown-item-${t}`,label:e.title??"",selected:e===this.layer,value:e.id,onCalciteDropdownItemSelect:()=>{this.layer=e}},e.title)}_onShowRelatedTable(e){this.showRelatedTableCallback||(this._collapseRelatedTable(this._effectiveTable,e),this._createRelatedTable(e))}_renderRelatedTableNavigationBar(){const{messages:e}=this,t=e.exitRelatedRecords;if(this.relatedTables.length&&!this.showRelatedTableCallback)return R("div",{class:k.tableNavigation,key:"table-nav"},R("calcite-action",{icon:"move-up",iconFlipRtl:!0,key:t,onclick:()=>this._drainRelatedTables(),text:t,title:t}),this.relatedTables.toArray().map(((e,t)=>this._renderRelatedTableNavigationAction(e,t))),R("div",null,R("calcite-label",{layout:"inline"},e.showAllTables,R("calcite-switch",{checked:this.allRelatedTablesVisible,onCalciteSwitchChange:e=>this.toggleAllRelatedTables(!!e.target.checked)}))))}_renderRelatedTableNavigationAction(e,t){const i=this._getLabelForRelatedTableNavigationAction(e);return R("calcite-action",{icon:"chevron-right",iconFlipRtl:!0,key:t,onclick:()=>this._drainRelatedTablesAboveIndex(t),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}_drainRelatedTables(){this.relatedTables.drain((e=>!e.destroyed&&e.destroy())),this.set({_showAllTablesEnabled:!1,multipleSelectionEnabled:!0,tableTemplateOverride:null,relationshipColumnConfigs:null,visibleElementsOverride:null}),this.hiddenFields.removeMany([y.action,y.attachments])}_drainRelatedTablesAboveIndex(e){const t=this.relatedTables,i=t.filter(((t,i)=>i>e));i.forEach((e=>!e.destroyed&&e.destroy())),t.removeMany(i);const l=t.at(-1);if(!l?.layer||!l?.relationship)return;const{layer:o,relationship:s}=l;this._showAllTablesEnabled?this._enterShowAllView(l):l.set({multipleSelectionEnabled:!0,tableTemplateOverride:null,relationshipColumnConfigs:this._getRelationshipIdsToShow(o,s.id),visibleElementsOverride:null}),l.hiddenFields.removeMany([y.action,y.attachments])}_getRelatedTableMenuItemConfig(e,t,i){return t.fields.map((({alias:l,name:o})=>({selected:o===i,label:l||o,clickFunction:i=>{i.stopPropagation(),e.tableTemplateOverride=new w({columnTemplates:[this._createRelatedFieldColumnTemplate(e,t,o)]})}})))}_createRelatedFieldColumnTemplate(e,t,i){return new b({fieldName:i,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._getRelatedTableMenuItemConfig(e,t,i)},resizable:!1})}_enterShowAllView(e){const t=e.layer;if(!t)return;const i=e===this,{visibleElements:l}=e,o=t.displayField||t.objectIdField;e.set({relationshipColumnConfigs:[],tableTemplateOverride:new w({columnTemplates:[this._createRelatedFieldColumnTemplate(e,t,o)]}),visibleElementsOverride:new g({header:i&&l.header,progress:i&&l.progress,columnMenus:l.columnMenus,close:l.close,tooltips:l.tooltips,selectionColumn:!1,columnMenuItems:new m({sortAscending:!1,sortDescending:!1})})}),e.hiddenFields.addMany([y.action,y.attachments])}_exitShowAllView(e){const{layer:t,relationship:i}=e;t&&null!=i?.id&&(e.set({relationshipColumnConfigs:this._getRelationshipIdsToShow(t,i.id),tableTemplateOverride:null,visibleElementsOverride:null}),e.hiddenFields.removeMany([y.action,y.attachments]))}_collapseRelatedTable(e,t){const{relatedLayer:l,feature:o,relationshipId:s}=t,n=l.relationships?.find((({id:e})=>e===s)),{objectIdField:r}=l,a=l.displayField||n?.keyField||r,d=o.getObjectId()??o.attributes[r],c=e===this,{close:h,columnMenus:p,header:u,layerDropdown:b,menu:v,menuItems:f,progress:_,tooltips:M}=e.visibleElements;e.set({highlightIds:new i([d]),multipleSelectionEnabled:!1,relationshipColumnConfigs:[{relationshipId:s,collapsed:!0}],tableTemplateOverride:new w({columnTemplates:[this._createRelatedFieldColumnTemplate(e,l,a)]}),visibleElementsOverride:new g({header:c&&u,progress:c&&_,columnMenus:p,close:h,layerDropdown:b,menu:v,menuItems:f,tooltips:M,selectionColumn:!1,columnMenuItems:new m({sortAscending:!1,sortDescending:!1})})}),e.hiddenFields.addMany([y.action,y.attachments]),e.scrollLeft()}_getRelationshipIdsToShow(e,t){return(e.relationships??[]).filter((e=>!(e.id===t&&"one-to-one"===e.cardinality))).map((({id:e})=>({relationshipId:e})))}async _createRelatedTable(e){const{editingEnabled:t,paginationEnabled:i,pageSize:l,relatedTables:o,view:s,viewModel:r}=this,{layer:a,feature:d,relatedLayer:c,relationshipId:h}=e,p=d.getObjectId()??d.attributes[c.objectIdField],m=o.length,u=m?o.getItemAt(m-1):this;await a.load();const b=this.attachmentsEnabled&&f(a),w=new x({layer:a,attachmentsEnabled:b,editingEnabled:t,paginationEnabled:i,pageSize:l,relatedRecordsEnabled:!0,relationshipConfig:{objectId:p,relatedLayer:c,relationshipId:h},relationshipColumnConfigs:this._getRelationshipIdsToShow(a,h),tableParent:u,view:s,visibleElements:new g({header:!1,progress:!1}),showRelatedTableCallback:e=>{r.emit("show-related-table",e)}});w.addHandles([n((()=>u.highlightIds),"change",(({added:e})=>{const t=e[0];null!=t&&(w.highlightIds.removeAll(),w.relationshipConfig={objectId:t,relatedLayer:c,relationshipId:h})})),n((()=>u),"cell-click",(e=>{const{feature:t}=e;if(t){const e=t.getObjectId()??t.attributes[c.objectIdField];null!=e&&u.highlightIds.add(e)}}))]),this.relatedTables.add(w),this.scheduleRender()}};e([r()],D.prototype,"_columnVisibilityActions",void 0),e([r()],D.prototype,"_effectiveDescription",null),e([r()],D.prototype,"_effectiveLayers",null),e([r()],D.prototype,"_effectiveTable",null),e([r()],D.prototype,"_effectiveTitle",null),e([r()],D.prototype,"_effectiveVisibleElements",null),e([r()],D.prototype,"_hasCustomMenuItems",null),e([r()],D.prototype,"_hasDefaultMenuItems",null),e([r()],D.prototype,"_prompt",void 0),e([r()],D.prototype,"_shouldShowMenu",null),e([r()],D.prototype,"_showAllTablesEnabled",void 0),e([r()],D.prototype,"_showClearSelectionAction",null),e([r()],D.prototype,"_showColumnsVisibilityAction",null),e([r()],D.prototype,"_showDeleteSelectionAction",null),e([r()],D.prototype,"_showExportSelectionToCSVAction",null),e([r()],D.prototype,"_showLayerDropdown",null),e([r()],D.prototype,"_showRefreshDataAction",null),e([r()],D.prototype,"_showSelectedRecordsShowSelectedAction",null),e([r()],D.prototype,"_showSelectedRecordsShowAllAction",null),e([r()],D.prototype,"_showZoomToSelectionAction",null),e([r()],D.prototype,"_viewLayers",null),e([r()],D.prototype,"actionColumnConfig",null),e([r({readOnly:!0})],D.prototype,"activeFilters",null),e([r({readOnly:!0})],D.prototype,"activeSortOrders",null),e([r({readOnly:!0})],D.prototype,"allRelatedTablesVisible",null),e([r()],D.prototype,"attachmentsEnabled",null),e([r()],D.prototype,"autoRefreshEnabled",null),e([r()],D.prototype,"columnPerformanceModeEnabled",null),e([r()],D.prototype,"columnReorderingEnabled",null),e([r({readOnly:!0})],D.prototype,"columns",null),e([r()],D.prototype,"description",void 0),e([r()],D.prototype,"disabled",void 0),e([r()],D.prototype,"editingEnabled",null),e([r()],D.prototype,"effectiveSize",null),e([r()],D.prototype,"filterGeometry",null),e([r()],D.prototype,"filterBySelectionEnabled",null),e([r({readOnly:!0})],D.prototype,"grid",null),e([r()],D.prototype,"hiddenFields",null),e([r()],D.prototype,"highlightEnabled",null),e([r()],D.prototype,"highlightIds",null),e([r()],D.prototype,"icon",null),e([r()],D.prototype,"isQueryingOrSyncing",null),e([r()],D.prototype,"label",null),e([r()],D.prototype,"layer",null),e([r()],D.prototype,"layers",void 0),e([r()],D.prototype,"layerView",null),e([r()],D.prototype,"maxSize",null),e([r(),E("esri/widgets/FeatureTable/t9n/FeatureTable")],D.prototype,"messages",null),e([r(),E("esri/t9n/common")],D.prototype,"messagesCommon",null),e([r(),E("esri/widgets/support/t9n/uriUtils")],D.prototype,"messagesURIUtils",null),e([r()],D.prototype,"menuConfig",void 0),e([r()],D.prototype,"multipleSelectionEnabled",null),e([r()],D.prototype,"multiSortEnabled",null),e([r()],D.prototype,"objectIds",null),e([r()],D.prototype,"outFields",null),e([r()],D.prototype,"pageCount",null),e([r()],D.prototype,"pageIndex",null),e([r()],D.prototype,"pageSize",null),e([r()],D.prototype,"paginationEnabled",null),e([r()],D.prototype,"relatedRecordsEnabled",null),e([r()],D.prototype,"relatedTable",null),e([r()],D.prototype,"relatedTables",void 0),e([r()],D.prototype,"relationship",null),e([r()],D.prototype,"relationshipColumnConfigs",null),e([r()],D.prototype,"relationshipConfig",null),e([r()],D.prototype,"returnGeometryEnabled",null),e([r()],D.prototype,"returnMEnabled",null),e([r()],D.prototype,"returnZEnabled",null),e([r()],D.prototype,"rowHighlightIds",null),e([r()],D.prototype,"selectionSource",null),e([r()],D.prototype,"showRelatedTableCallback",null),e([r()],D.prototype,"size",null),e([r({readOnly:!0})],D.prototype,"state",null),e([r({constructOnly:!0})],D.prototype,"tableParent",void 0),e([r()],D.prototype,"tableTemplate",null),e([r()],D.prototype,"tableTemplateOverride",null),e([r()],D.prototype,"title",void 0),e([r()],D.prototype,"timeExtent",null),e([r()],D.prototype,"timeZone",null),e([r()],D.prototype,"view",null),e([r({type:u}),I(["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","show-related-table"])],D.prototype,"viewModel",void 0),e([r({type:g,nonNullable:!0})],D.prototype,"visibleElements",void 0),e([r({type:g})],D.prototype,"visibleElementsOverride",void 0),D=x=e([a("esri.widgets.FeatureTable")],D);const O=D;export{O as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{watch as l,sync as o,initial as s,on as n}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as d}from"../layers/catalog/catalogUtils.js";import{isKnowledgeGraphLayer as c,isSubtypeGroupLayer as h}from"../layers/support/layerUtils.js";import p from"./Widget.js";import m from"./FeatureTable/ColumnMenuVisibleElements.js";import u from"./FeatureTable/FeatureTableViewModel.js";import g from"./FeatureTable/VisibleElements.js";import b from"./FeatureTable/support/FieldColumnTemplate.js";import w from"./FeatureTable/support/TableTemplate.js";import{isIFeatureTableSupportedLayer as v,uniqueColumnNames as y,isIFeatureTableSupportedLayerWithAttachments as f,isMapImageLayer as _}from"./FeatureTable/support/tableUtils.js";import{loadCalciteComponents as M}from"./support/componentsUtils.js";import{globalCss as T}from"./support/globalCss.js";import{Heading as S}from"./support/Heading.js";import{renderingSanitizer as C}from"./support/widgetUtils.js";import{messageBundle as E}from"./support/decorators/messageBundle.js";import{vmEvent as I}from"./support/decorators/vmEvent.js";import{tsx as R}from"./support/jsxFactory.js";import{substitute as A}from"../intl/substitute.js";var x;const j="esri-feature-table",F=`${j}__prompt`,k={base:j,content:`${j}__content`,menuPopover:`${j}__menu-popover`,layerDropdownMenu:`${j}__layer-switcher-menu`,tableContainer:`${j}__table-container`,tableNavigation:`${j}__table-navigation`,expanded:`${j}__expanded`,collapsed:`${j}__collapsed`,promptContainer:F,promptHeader:`${F}__header`,promptHeading:`${F}__header__heading`,promptMessage:`${F}__message`,promptDivider:`${F}__divider`,promptActions:`${F}__actions`},V={clearSelection:"clear-selection",exportToCSV:"file-csv",delete:"trash",refresh:"refresh",showAll:"selection-x",showSelected:"selection-filter",zoomToSelection:"zoom-to-object"};let D=x=class extends p{constructor(e,t){super(e,t),this._columnVisibilityActions=new Map,this._prompt=null,this._showAllTablesEnabled=!1,this.description=null,this.disabled=!1,this.layers=null,this.menuConfig=null,this.relatedTables=new i,this.tableParent=null,this.title=null,this.viewModel=new u,this.visibleElements=new g,this.visibleElementsOverride=null,this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([l((()=>[this.viewModel.store.querying,this.viewModel.store.syncing,this.editingEnabled]),(()=>this.scheduleRender())),l((()=>({visibleElements:this._effectiveVisibleElements,items:this.columns.length})),(({visibleElements:e})=>{this.columns.forEach((t=>t.visibleElements=e)),this.refreshCellContent()}),o),l((()=>this._effectiveVisibleElements.selectionColumn),(e=>{this.grid&&(this.grid.selectionColumnEnabled=e)}),s),n((()=>this.viewModel),"show-related-table",(e=>this._onShowRelatedTable(e))),l((()=>this.viewModel.state),(e=>{"disabled"===e&&this.relatedTables.length&&this._drainRelatedTables()}))])}loadDependencies(){return M({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown.js"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group.js"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),pagination:()=>import("@esri/calcite-components/dist/components/calcite-pagination.js"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel.js"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover.js"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress.js"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone.js"),option:()=>import("@esri/calcite-components/dist/components/calcite-option.js"),select:()=>import("@esri/calcite-components/dist/components/calcite-select.js")})}destroy(){this._drainRelatedTables(),this._clearPrompt()}get _effectiveDescription(){const{description:e}=this;return null!=e?C.sanitize("function"==typeof e?e():e):void 0}get _effectiveLayers(){const{layer:e,layers:t}=this,i=t?.length?t.filter(v):[],l=i.length?i:[...this._viewLayers];return e&&!l.includes(e)&&l.push(e),l}get _effectiveTable(){return this.relatedTable||this}get _effectiveTitle(){const{layer:e,messages:t,state:i,highlightIds:l,title:o,size:s}=this;if(o)return C.sanitize("function"==typeof o?o():o);if(!e)return t.noLayer;switch(i){case"disabled":return t.errorLayer;case"ready":case"loading":return t.loading;case"error":return t.errorData}return A(t.header,{title:C.sanitize(e.title),count:s,selected:l.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}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 _shouldShowMenu(){const{header:e,menu:t}=this._effectiveVisibleElements;return!(!e||!t||!this._hasDefaultMenuItems&&!this._hasCustomMenuItems)}get _showClearSelectionAction(){return!(!this.highlightIds.length||!this._effectiveVisibleElements.menuItems?.clearSelection||this.relatedTables.length)}get _showColumnsVisibilityAction(){const{header:e,menu:t,menuItems:i}=this._effectiveVisibleElements;return!(!(e&&t&&i?.toggleColumns)||this.showRelatedTableCallback||this.allRelatedTablesVisible)}get _showDeleteSelectionAction(){return!(!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete)||this.relatedTables.length)}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 _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)}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=>{!v(e)||h(e)||t.has(e)||t.add(e)},l=e=>{d(e)||"catalog-footprint"===e.type||(c(e)?(e.layers?.forEach(i),e.tables?.forEach(i)):_(e)?(e.sublayers?.forEach(i),e.subtables?.forEach(i)):h(e)?e.sublayers?.forEach(i):i(e))};return e.allLayers.forEach(l),e.allTables.forEach(l),[...t.values()]}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 allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this._showAllTablesEnabled)}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=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 editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveSize(){return this.viewModel.effectiveSize}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 grid(){return this.viewModel.grid}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 isQueryingOrSyncing(){return this.viewModel.isQueryingOrSyncing||this.relatedTables.some((e=>!!e.isQueryingOrSyncing))}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this._drainRelatedTables(),this.viewModel.layer=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 messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(e){this.viewModel.messagesURIUtils=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 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 relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){return this.viewModel.relationship}get relationshipColumnConfigs(){return this.viewModel.relationshipColumnConfigs}set relationshipColumnConfigs(e){this.viewModel.relationshipColumnConfigs=e}get relationshipConfig(){return this.viewModel.relationshipConfig}set relationshipConfig(e){this.viewModel.relationshipConfig=e}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 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 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}clearSelectionFilter(){this.viewModel.clearSelectionFilter()}deleteSelection(e){return this.highlightIds.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}exportSelectionToCSV(e){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(){this.relatedTables.forEach((async e=>await e.refresh())),await this.viewModel.refresh()}refreshCellContent(){this.viewModel.refreshCellContent()}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)}toggleAllRelatedTables(e){const t=this.relatedTable;this._showAllTablesEnabled=e,t&&(e?this._enterShowAllView(t):this._exitShowAllView(t))}zoomToSelection(){this._effectiveTable.viewModel.zoomToSelection()}render(){const{_prompt:e,_effectiveVisibleElements:t,isQueryingOrSyncing:i,menuConfig:l,state:o}=this;return R("div",{bind:this,class:this.classes(k.base,T.widget)},R("calcite-panel",{bind:this,class:k.content,closable:t.close,description:this._effectiveDescription,disabled:this.disabled||"disabled"===o&&!this._effectiveLayers?.length,heading:t.header?this._effectiveTitle:void 0,loading:"loading"===o,menuOpen:!!l?.open,overlayPositioning:"fixed",onCalcitePanelClose:e=>{e.target.closed=!1,this.emit("close")}},t.progress?R("calcite-progress",{type:i?"indeterminate":"determinate"}):null,this._showLayerDropdown?this._renderLayerDropdown():null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderRelatedTableNavigationBar(),this._renderTables()),e?R("calcite-scrim",null,this._renderPrompt(e)):null)}_renderTables(){const{allRelatedTablesVisible:e,grid:t,relatedTables:i}=this;if(i.length){const l=i.toArray(),o=1===l.length,s=this.classes(k.base,e?k.expanded:k.collapsed),n=e||o,r=e?l:o?[l[0]]:l.slice(-2);return R("div",{class:k.tableContainer},R("calcite-panel",{overlayPositioning:"fixed"},R("div",null,[n?R("div",{class:s},t?.render(),this._renderPagination()):void 0,...r.map((e=>{const t=i.indexOf(e);return R("div",{class:s,key:`related-${t}`},e.render())})),,])))}return[R("div",{class:k.tableContainer},t?.render()),this._renderPagination()]}_renderPagination(){if(this.paginationEnabled)return R("calcite-pagination",{pageSize:1,startItem:this.pageIndex+1,totalItems:this.pageCount,onCalcitePaginationChange:e=>this.goToPage(e.target.startItem-1)})}_clearPrompt(){this._prompt=null}_renderPrompt({title:e,message:t,context:i,actions:l}){const o=R("calcite-button",{appearance:"solid",key:"prompt-primary-button",kind:"danger"===i?"danger":"brand",onclick:l.primary.action,width:l.secondary?"half":"full"},l.primary.label),s=l.secondary?R("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:"danger"===i?"danger":"brand",onclick:l.secondary.action,width:"half"},l.secondary.label):null;return R("div",{class:`${k.promptContainer}--${i}`},R("div",{class:k.promptHeader},R("calcite-icon",{icon:"exclamation-mark-triangle"}),R(S,{class:k.promptHeading,level:2},e)),R("div",{class:k.promptMessage},t),R("div",{class:k.promptDivider}),R("div",{class:k.promptActions},s,o))}_showDeletePrompt(){const{messages:e,messagesCommon:t}=this,i=A(e.deleteSelectionCount,{count:this.highlightIds.length});this._prompt={title:i,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:t.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,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:s}=e;if(!i)return R("calcite-action",{disabled:t??this.menuConfig?.disabled,icon:l??void 0,key:o,onclick:()=>s(),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:V.refresh,text:e.refreshData,clickFunction:()=>this.refresh()},this._showDeleteSelectionAction&&{icon:V.delete,text:e.deleteSelection,clickFunction:()=>this.deleteSelection(!0)},this._showClearSelectionAction&&{icon:V.clearSelection,text:e.clearSelection,clickFunction:()=>this.highlightIds?.removeAll()},this._showZoomToSelectionAction&&{icon:V.zoomToSelection,text:e.zoomToSelection,clickFunction:()=>this.zoomToSelection()},this._showSelectedRecordsShowSelectedAction&&{icon:V.showSelected,text:e.showSelected,clickFunction:()=>{const{objectIds:e}=this;e.removeAll(),e.addMany(this.highlightIds.toArray())}},this._showSelectedRecordsShowAllAction&&{icon:V.showAll,text:e.showAllRecords,clickFunction:()=>this.objectIds.removeAll()},this._showExportSelectionToCSVAction&&{icon:V.exportToCSV,text:e.exportSelectionCSV,clickFunction:()=>this.exportSelectionToCSV()}].filter(t).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,_effectiveVisibleElements:i,id:l,messages:o}=this,s=t.columns.toArray(),n=o?.toggleColumns,r=`${l}__toggle-columns-action`,a=[R("calcite-action",{afterCreate:t=>e.set(l,t),afterRemoved:()=>e.delete(l),appearance:"transparent",bind:this,disabled:t.menuConfig?.disabled,icon:"show-column",id:r,slot:"header-actions-end",text:n},i.tooltips?R("calcite-tooltip",{closeOnClick:!0,overlayPositioning:"fixed",placement:"bottom-end",slot:"tooltip"},n):null)];return t.menuConfig?.disabled||a.push(R("calcite-popover",{autoClose:!0,class:k.menuPopover,label:n,overlayPositioning:"fixed",placement:"top-end",pointerDisabled:!0,referenceElement:e.get(l)},R("calcite-list",{filterEnabled:!0,filterPlaceholder:o.toggleColumns,selectionMode:"multiple"},...s.map((e=>{const i="columns"in e&&e.columns?.length?e.columns.map((e=>this._renderColumnListItem({column:e,table:t,ignoreSelect:!0}))):void 0;return this._renderColumnListItem({column:e,table:t,items:i})}))))),a}_renderColumnListItem(e){const{column:t,table:i,items:l,ignoreSelect:o}=e,{effectiveLabel:s,fieldName:n,hidden:r}=t;return R("calcite-list-item",{key:`toggle-columns__item-${n}`,label:s,open:!(!l?.length||r)||void 0,selected:!r,value:n,onCalciteListItemSelect:e=>{o||i.toggleColumnVisibility(e.target.value)}},l)}_renderLayerDropdown(){const e=this.messages.selectALayer;return R("div",{class:k.layerDropdownMenu,key:`${this.id}-layerDropdown`,slot:"header-actions-start"},R("calcite-dropdown",{bind:this,maxItems:5,overlayPositioning:"fixed",placement:"bottom-start"},R("calcite-action",{icon:"layers",slot:"trigger",text:e,title:e}),R("calcite-dropdown-group",{selectionMode:"single"},this._effectiveLayers.map(((e,t)=>this._renderLayerDropdownItem(e,t)))??null)))}_renderLayerDropdownItem(e,t){return R("calcite-dropdown-item",{key:`dropdown-item-${t}`,label:e.title??"",selected:e===this.layer,value:e.id,onCalciteDropdownItemSelect:()=>{this.layer=e}},e.title)}_onShowRelatedTable(e){this.showRelatedTableCallback||(this._collapseRelatedTable(this._effectiveTable,e),this._createRelatedTable(e))}_renderRelatedTableNavigationBar(){const{messages:e}=this,t=e.exitRelatedRecords;if(this.relatedTables.length&&!this.showRelatedTableCallback)return R("div",{class:k.tableNavigation,key:"table-nav"},R("calcite-action",{icon:"move-up",iconFlipRtl:!0,key:t,onclick:()=>this._drainRelatedTables(),text:t,title:t}),this.relatedTables.toArray().map(((e,t)=>this._renderRelatedTableNavigationAction(e,t))),R("div",null,R("calcite-label",{layout:"inline"},e.showAllTables,R("calcite-switch",{checked:this.allRelatedTablesVisible,onCalciteSwitchChange:e=>this.toggleAllRelatedTables(!!e.target.checked)}))))}_renderRelatedTableNavigationAction(e,t){const i=this._getLabelForRelatedTableNavigationAction(e);return R("calcite-action",{icon:"chevron-right",iconFlipRtl:!0,key:t,onclick:()=>this._drainRelatedTablesAboveIndex(t),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}_drainRelatedTables(){this.relatedTables.drain((e=>!e.destroyed&&e.destroy())),this.set({_showAllTablesEnabled:!1,multipleSelectionEnabled:!0,tableTemplateOverride:null,relationshipColumnConfigs:null,visibleElementsOverride:null}),this.hiddenFields.removeMany([y.action,y.attachments])}_drainRelatedTablesAboveIndex(e){const t=this.relatedTables,i=t.filter(((t,i)=>i>e));i.forEach((e=>!e.destroyed&&e.destroy())),t.removeMany(i);const l=t.at(-1);if(!l?.layer||!l?.relationship)return;const{layer:o,relationship:s}=l;this._showAllTablesEnabled?this._enterShowAllView(l):l.set({multipleSelectionEnabled:!0,tableTemplateOverride:null,relationshipColumnConfigs:this._getRelationshipIdsToShow(o,s.id),visibleElementsOverride:null}),l.hiddenFields.removeMany([y.action,y.attachments])}_getRelatedTableMenuItemConfig(e,t,i){return t.fields.map((({alias:l,name:o})=>({selected:o===i,label:l||o,clickFunction:i=>{i.stopPropagation(),e.tableTemplateOverride=new w({columnTemplates:[this._createRelatedFieldColumnTemplate(e,t,o)]})}})))}_createRelatedFieldColumnTemplate(e,t,i){return new b({fieldName:i,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._getRelatedTableMenuItemConfig(e,t,i)},resizable:!1})}_enterShowAllView(e){const t=e.layer;if(!t)return;const i=e===this,{visibleElements:l}=e,o=t.displayField||t.objectIdField;e.set({relationshipColumnConfigs:[],tableTemplateOverride:new w({columnTemplates:[this._createRelatedFieldColumnTemplate(e,t,o)]}),visibleElementsOverride:new g({header:i&&l.header,progress:i&&l.progress,columnMenus:l.columnMenus,close:l.close,tooltips:l.tooltips,selectionColumn:!1,columnMenuItems:new m({sortAscending:!1,sortDescending:!1})})}),e.hiddenFields.addMany([y.action,y.attachments])}_exitShowAllView(e){const{layer:t,relationship:i}=e;t&&null!=i?.id&&(e.set({relationshipColumnConfigs:this._getRelationshipIdsToShow(t,i.id),tableTemplateOverride:null,visibleElementsOverride:null}),e.hiddenFields.removeMany([y.action,y.attachments]))}_collapseRelatedTable(e,t){const{relatedLayer:l,feature:o,relationshipId:s}=t,n=l.relationships?.find((({id:e})=>e===s)),{objectIdField:r}=l,a=l.displayField||n?.keyField||r,d=o.getObjectId()??o.attributes[r],c=e===this,{close:h,columnMenus:p,header:u,layerDropdown:b,menu:v,menuItems:f,progress:_,tooltips:M}=e.visibleElements;e.set({highlightIds:new i([d]),multipleSelectionEnabled:!1,relationshipColumnConfigs:[{relationshipId:s,collapsed:!0}],tableTemplateOverride:new w({columnTemplates:[this._createRelatedFieldColumnTemplate(e,l,a)]}),visibleElementsOverride:new g({header:c&&u,progress:c&&_,columnMenus:p,close:h,layerDropdown:b,menu:v,menuItems:f,tooltips:M,selectionColumn:!1,columnMenuItems:new m({sortAscending:!1,sortDescending:!1})})}),e.hiddenFields.addMany([y.action,y.attachments]),e.scrollLeft()}_getRelationshipIdsToShow(e,t){return(e.relationships??[]).filter((e=>!(e.id===t&&"one-to-one"===e.cardinality))).map((({id:e})=>({relationshipId:e})))}async _createRelatedTable(e){const{editingEnabled:t,paginationEnabled:i,pageSize:l,relatedTables:o,view:s,viewModel:r}=this,{layer:a,feature:d,relatedLayer:c,relationshipId:h}=e,p=d.getObjectId()??d.attributes[c.objectIdField],m=o.length,u=m?o.getItemAt(m-1):this;await a.load();const b=this.attachmentsEnabled&&f(a),w=new x({layer:a,attachmentsEnabled:b,editingEnabled:t,paginationEnabled:i,pageSize:l,relatedRecordsEnabled:!0,relationshipConfig:{objectId:p,relatedLayer:c,relationshipId:h},relationshipColumnConfigs:this._getRelationshipIdsToShow(a,h),tableParent:u,view:s,visibleElements:new g({header:!1,progress:!1}),showRelatedTableCallback:e=>{r.emit("show-related-table",e)}});w.addHandles([n((()=>u.highlightIds),"change",(({added:e})=>{const t=e[0];null!=t&&(w.highlightIds.removeAll(),w.relationshipConfig={objectId:t,relatedLayer:c,relationshipId:h})})),n((()=>u),"cell-click",(e=>{const{feature:t}=e;if(t){const e=t.getObjectId()??t.attributes[c.objectIdField];null!=e&&u.highlightIds.add(e)}}))]),this.relatedTables.add(w),this.scheduleRender()}};e([r()],D.prototype,"_columnVisibilityActions",void 0),e([r()],D.prototype,"_effectiveDescription",null),e([r()],D.prototype,"_effectiveLayers",null),e([r()],D.prototype,"_effectiveTable",null),e([r()],D.prototype,"_effectiveTitle",null),e([r()],D.prototype,"_effectiveVisibleElements",null),e([r()],D.prototype,"_hasCustomMenuItems",null),e([r()],D.prototype,"_hasDefaultMenuItems",null),e([r()],D.prototype,"_prompt",void 0),e([r()],D.prototype,"_shouldShowMenu",null),e([r()],D.prototype,"_showAllTablesEnabled",void 0),e([r()],D.prototype,"_showClearSelectionAction",null),e([r()],D.prototype,"_showColumnsVisibilityAction",null),e([r()],D.prototype,"_showDeleteSelectionAction",null),e([r()],D.prototype,"_showExportSelectionToCSVAction",null),e([r()],D.prototype,"_showLayerDropdown",null),e([r()],D.prototype,"_showRefreshDataAction",null),e([r()],D.prototype,"_showSelectedRecordsShowSelectedAction",null),e([r()],D.prototype,"_showSelectedRecordsShowAllAction",null),e([r()],D.prototype,"_showZoomToSelectionAction",null),e([r()],D.prototype,"_viewLayers",null),e([r()],D.prototype,"actionColumnConfig",null),e([r({readOnly:!0})],D.prototype,"activeFilters",null),e([r({readOnly:!0})],D.prototype,"activeSortOrders",null),e([r({readOnly:!0})],D.prototype,"allRelatedTablesVisible",null),e([r()],D.prototype,"attachmentsEnabled",null),e([r()],D.prototype,"autoRefreshEnabled",null),e([r()],D.prototype,"columnPerformanceModeEnabled",null),e([r()],D.prototype,"columnReorderingEnabled",null),e([r({readOnly:!0})],D.prototype,"columns",null),e([r()],D.prototype,"description",void 0),e([r()],D.prototype,"disabled",void 0),e([r()],D.prototype,"editingEnabled",null),e([r()],D.prototype,"effectiveSize",null),e([r()],D.prototype,"filterGeometry",null),e([r()],D.prototype,"filterBySelectionEnabled",null),e([r({readOnly:!0})],D.prototype,"grid",null),e([r()],D.prototype,"hiddenFields",null),e([r()],D.prototype,"highlightEnabled",null),e([r()],D.prototype,"highlightIds",null),e([r()],D.prototype,"icon",null),e([r()],D.prototype,"isQueryingOrSyncing",null),e([r()],D.prototype,"label",null),e([r()],D.prototype,"layer",null),e([r()],D.prototype,"layers",void 0),e([r()],D.prototype,"layerView",null),e([r()],D.prototype,"maxSize",null),e([r(),E("esri/widgets/FeatureTable/t9n/FeatureTable")],D.prototype,"messages",null),e([r(),E("esri/t9n/common")],D.prototype,"messagesCommon",null),e([r(),E("esri/widgets/support/t9n/uriUtils")],D.prototype,"messagesURIUtils",null),e([r()],D.prototype,"menuConfig",void 0),e([r()],D.prototype,"multipleSelectionEnabled",null),e([r()],D.prototype,"multiSortEnabled",null),e([r()],D.prototype,"objectIds",null),e([r()],D.prototype,"outFields",null),e([r()],D.prototype,"pageCount",null),e([r()],D.prototype,"pageIndex",null),e([r()],D.prototype,"pageSize",null),e([r()],D.prototype,"paginationEnabled",null),e([r()],D.prototype,"relatedRecordsEnabled",null),e([r()],D.prototype,"relatedTable",null),e([r()],D.prototype,"relatedTables",void 0),e([r()],D.prototype,"relationship",null),e([r()],D.prototype,"relationshipColumnConfigs",null),e([r()],D.prototype,"relationshipConfig",null),e([r()],D.prototype,"returnGeometryEnabled",null),e([r()],D.prototype,"returnMEnabled",null),e([r()],D.prototype,"returnZEnabled",null),e([r()],D.prototype,"rowHighlightIds",null),e([r()],D.prototype,"selectionSource",null),e([r()],D.prototype,"showRelatedTableCallback",null),e([r()],D.prototype,"size",null),e([r({readOnly:!0})],D.prototype,"state",null),e([r({constructOnly:!0})],D.prototype,"tableParent",void 0),e([r()],D.prototype,"tableTemplate",null),e([r()],D.prototype,"tableTemplateOverride",null),e([r()],D.prototype,"title",void 0),e([r()],D.prototype,"timeExtent",null),e([r()],D.prototype,"timeZone",null),e([r()],D.prototype,"view",null),e([r({type:u}),I(["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","show-related-table"])],D.prototype,"viewModel",void 0),e([r({type:g,nonNullable:!0})],D.prototype,"visibleElements",void 0),e([r({type:g})],D.prototype,"visibleElementsOverride",void 0),D=x=e([a("esri.widgets.FeatureTable")],D);const O=D;export{O as default};