Custom Gis Application with Arcgis Javascript API with modern layouting
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

60 lines
29 KiB

// All material copyright Esri, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.30/esri/copyright.txt for details.
//>>built
define("require ../chunks/tslib.es6 ../intl ../core/Collection ../core/reactiveUtils ../core/accessorSupport/decorators/property ../core/has ../core/Logger ../core/RandomLCG ../core/accessorSupport/decorators/subclass ../layers/catalog/catalogUtils ../layers/support/layerUtils ./Widget ./FeatureTable/ColumnMenuVisibleElements ./FeatureTable/FeatureTableViewModel ./FeatureTable/VisibleElements ./FeatureTable/support/FieldColumnTemplate ./FeatureTable/support/TableTemplate ./FeatureTable/support/tableUtils ../chunks/componentsUtils ./support/globalCss ./support/Heading ./support/widgetUtils ./support/decorators/messageBundle ./support/decorators/vmEvent ./support/jsxFactory ../intl/substitute".split(" "),
function(m,e,d,G,u,f,T,U,V,K,L,M,N,H,I,x,O,A,t,P,Q,R,B,C,S,k,J){var D;d=D=class extends N{constructor(a,b){super(a,b);this._columnVisibilityActions=new Map;this._prompt=null;this._showAllTablesEnabled=!1;this.description=null;this.disabled=!1;this.menuConfig=this.layers=null;this.relatedTables=new G;this.title=this.tableParent=null;this.viewModel=new I;this.visibleElements=new x;this.visibleElementsOverride=null;this._showDeletePrompt=this._showDeletePrompt.bind(this);this._onDeleteSelectionClick=
this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([u.watch(()=>[this.viewModel.store.querying,this.viewModel.store.syncing,this.editingEnabled],()=>this.scheduleRender()),u.watch(()=>({visibleElements:this._effectiveVisibleElements,items:this.columns.length}),({visibleElements:a})=>{this.columns.forEach(b=>b.visibleElements=a);this.refreshCellContent()},u.sync),u.watch(()=>this._effectiveVisibleElements.selectionColumn,a=>{this.grid&&(this.grid.selectionColumnEnabled=a)},u.initial),
u.on(()=>this.viewModel,"show-related-table",a=>this._onShowRelatedTable(a)),u.watch(()=>this.viewModel.state,a=>{"disabled"===a&&this.relatedTables.length&&this._drainRelatedTables()})])}loadDependencies(){return P.loadCalciteComponents({action:()=>new Promise((a,b)=>m(["../chunks/calcite-action"],a,b)),button:()=>new Promise((a,b)=>m(["../chunks/calcite-button"],a,b)),dropdown:()=>new Promise((a,b)=>m(["../chunks/calcite-dropdown"],a,b)),"dropdown-group":()=>new Promise((a,b)=>m(["../chunks/calcite-dropdown-group"],
a,b)),"dropdown-item":()=>new Promise((a,b)=>m(["../chunks/calcite-dropdown-item"],a,b)),icon:()=>new Promise((a,b)=>m(["../chunks/calcite-icon"],a,b)),label:()=>new Promise((a,b)=>m(["../chunks/calcite-label"],a,b)),list:()=>new Promise((a,b)=>m(["../chunks/calcite-list"],a,b)),"list-item":()=>new Promise((a,b)=>m(["../chunks/calcite-list-item"],a,b)),panel:()=>new Promise((a,b)=>m(["../chunks/calcite-panel"],a,b)),popover:()=>new Promise((a,b)=>m(["../chunks/calcite-popover"],a,b)),progress:()=>
new Promise((a,b)=>m(["../chunks/calcite-progress"],a,b)),scrim:()=>new Promise((a,b)=>m(["../chunks/calcite-scrim"],a,b)),switch:()=>new Promise((a,b)=>m(["../chunks/calcite-switch"],a,b)),tooltip:()=>new Promise((a,b)=>m(["../chunks/calcite-tooltip"],a,b)),"action-bar":()=>new Promise((a,b)=>m(["../chunks/calcite-action-bar"],a,b)),"input-date-picker":()=>new Promise((a,b)=>m(["../chunks/calcite-input-date-picker"],a,b)),"input-time-picker":()=>new Promise((a,b)=>m(["../chunks/calcite-input-time-picker"],
a,b)),"input-time-zone":()=>new Promise((a,b)=>m(["../chunks/calcite-input-time-zone"],a,b))})}destroy(){this._drainRelatedTables();this._clearPrompt()}get _effectiveDescription(){const {description:a}=this;return null!=a?B.renderingSanitizer.sanitize("function"===typeof a?a():a):void 0}get _effectiveLayers(){const {layer:a,layers:b}=this;var c=b?.length?b.filter(t.isIFeatureTableSupportedLayer):[];c=c.length?c:[...this._viewLayers];a&&!c.includes(a)&&c.push(a);return c}get _effectiveTable(){return this.relatedTable||
this}get _effectiveTitle(){const {layer:a,messages:b,state:c,highlightIds:g,title:h,viewModel:l}=this;if(h)return B.renderingSanitizer.sanitize("function"===typeof h?h():h);if(!a)return b.noLayer;switch(c){case "disabled":return b.errorLayer;case "ready":case "loading":return b.loading;case "error":return b.errorData}return J.substitute(b.header,{title:B.renderingSanitizer.sanitize(a.title),count:l.size,selected:g.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}get _hasCustomMenuItems(){return!!this.menuConfig?.items?.length}get _hasDefaultMenuItems(){return!!(this._showClearSelectionAction||
this._showDeleteSelectionAction||this._showRefreshDataAction||this._showZoomToSelectionAction||this._showSelectedRecordsShowSelectedAction||this._showSelectedRecordsShowAllAction||this._showColumnsVisibilityAction)}get _shouldShowMenu(){const {header:a,menu:b}=this._effectiveVisibleElements;return!(!a||!b||!this._hasDefaultMenuItems&&!this._hasCustomMenuItems)}get _showClearSelectionAction(){return!(!this.highlightIds.length||!this._effectiveVisibleElements.menuItems?.clearSelection||this.relatedTables.length)}get _showColumnsVisibilityAction(){const {header:a,
menu:b,menuItems:c}=this._effectiveVisibleElements;return!(!(a&&b&&c?.toggleColumns)||this.showRelatedTableCallback||this._showAllTablesEnabled)}get _showDeleteSelectionAction(){return!(!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete)||this.relatedTables.length)}get _showLayerDropdown(){return!(!this._effectiveLayers.length||!this._effectiveVisibleElements.layerDropdown)}get _showRefreshDataAction(){return!!this._effectiveVisibleElements.menuItems?.refreshData}get _showSelectedRecordsShowSelectedAction(){const a=
this.objectIds.length,b=this.highlightIds.length;return!(!b||!this._effectiveVisibleElements.menuItems?.selectedRecordsShowSelectedToggle||a&&b===a||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 a=
this.view?.map;if(!a)return[];const b=new Set,c=h=>{t.isIFeatureTableSupportedLayer(h)&&!b.has(h)&&b.add(h)},g=h=>{L.isLayerFromCatalog(h)||"catalog-footprint"===h.type||(M.isKnowledgeGraphLayer(h)?(h.layers?.forEach(c),h.tables?.forEach(c)):t.isMapImageLayer(h)?(h.sublayers?.forEach(c),h.subtables?.forEach(c)):c(h))};a.allLayers.forEach(g);a.allTables.forEach(g);return[...b.values()]}get actionColumnConfig(){return this.viewModel.actionColumnConfig}set actionColumnConfig(a){this.viewModel.actionColumnConfig=
a}get activeFilters(){return this.viewModel.activeFilters}get activeSortOrders(){return this.viewModel.activeSortOrders}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(a){this.viewModel.attachmentsEnabled=a}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(a){this.viewModel.autoRefreshEnabled=a}get columnPerformanceModeEnabled(){return this.viewModel.columnPerformanceModeEnabled}set columnPerformanceModeEnabled(a){this.viewModel.columnPerformanceModeEnabled=
a}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(a){this.viewModel.columnReorderingEnabled=a}get columns(){return this.viewModel.columns}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(a){this.viewModel.editingEnabled=a}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(a){this.viewModel.filterGeometry=a}get filterBySelectionEnabled(){return this.viewModel.filterBySelectionEnabled}set filterBySelectionEnabled(a){this.viewModel.filterBySelectionEnabled=
a}get grid(){return this.viewModel.grid}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(a){this.viewModel.hiddenFields=a}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(a){this.viewModel.highlightEnabled=a}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(a){this.viewModel.highlightIds=a}get icon(){return"table"}set icon(a){this._overrideIfSome("icon",a)}get isQueryingOrSyncing(){return this.viewModel.isQueryingOrSyncing||
this.relatedTables.some(a=>!!a.isQueryingOrSyncing)}get label(){return this.messages?.widgetLabel??""}set label(a){this._overrideIfSome("label",a)}get layer(){return this.viewModel.layer}set layer(a){this._drainRelatedTables();this.viewModel.layer=a}get layerView(){return this.viewModel.layerView}get messages(){return this.viewModel.messages}set messages(a){this.viewModel.messages=a}get messagesCommon(){return this.viewModel.messagesCommon}set messagesCommon(a){this.viewModel.messagesCommon=a}get messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(a){this.viewModel.messagesURIUtils=
a}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(a){this.viewModel.multipleSelectionEnabled=a}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(a){this.viewModel.multiSortEnabled=a}get objectIds(){return this.viewModel.objectIds}set objectIds(a){this.viewModel.objectIds=a}get pageSize(){return this.viewModel.pageSize}set pageSize(a){this.viewModel.pageSize=a}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(a){this.viewModel.relatedRecordsEnabled=
a}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){return this.viewModel.relationship}get relationshipColumnConfigs(){return this.viewModel.relationshipColumnConfigs}set relationshipColumnConfigs(a){this.viewModel.relationshipColumnConfigs=a}get relationshipConfig(){return this.viewModel.relationshipConfig}set relationshipConfig(a){this.viewModel.relationshipConfig=a}get returnGeometryEnabled(){return this.viewModel.returnGeometryEnabled}set returnGeometryEnabled(a){this.viewModel.returnGeometryEnabled=
a}get returnMEnabled(){return this.viewModel.returnMEnabled}set returnMEnabled(a){this.viewModel.returnMEnabled=a}get returnZEnabled(){return this.viewModel.returnZEnabled}set returnZEnabled(a){this.viewModel.returnZEnabled=a}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(a){this.viewModel.rowHighlightIds=a}get selectionSource(){return this.viewModel.selectionSource}set selectionSource(a){this.viewModel.selectionSource=a}get showRelatedTableCallback(){return this.viewModel.showRelatedTableCallback}set showRelatedTableCallback(a){this.viewModel.showRelatedTableCallback=
a}get size(){return this.viewModel.size}get state(){return this.viewModel.state}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(a){this.viewModel.tableTemplate=a}get tableTemplateOverride(){return this.viewModel.tableTemplateOverride}set tableTemplateOverride(a){this.viewModel.tableTemplateOverride=a}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(a){this.viewModel.timeExtent=a}get timeZone(){return this.viewModel.timeZone}set timeZone(a){this.viewModel.timeZone=
a}get view(){return this.viewModel.view}set view(a){this.viewModel.view=a}clearSelectionFilter(){this.viewModel.clearSelectionFilter()}deleteSelection(a){return this.highlightIds.length?a?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}filterBySelection(){this.viewModel.filterBySelection()}findColumn(a){return this.viewModel.findColumn(a)}hideColumn(a){this.grid?.hideColumn(a)}async refresh(){this.relatedTables.forEach(async a=>
await a.refresh());await this.viewModel.refresh()}refreshCellContent(){this.viewModel.refreshCellContent()}showAllColumns(){this.viewModel.showAllColumns()}showColumn(a){this.grid?.showColumn(a)}sortColumn(a,b){this.viewModel.sortColumn(a,b)}scrollToIndex(a){this.viewModel.scrollToIndex(a)}toggleColumnVisibility(a){this.viewModel.toggleColumnVisibility(a)}zoomToSelection(){this._effectiveTable.viewModel.zoomToSelection()}render(){const {_prompt:a,_effectiveVisibleElements:b,isQueryingOrSyncing:c,
menuConfig:g,state:h}=this;return k.tsx("div",{bind:this,class:this.classes("esri-feature-table",Q.globalCss.widget)},k.tsx("calcite-panel",{bind:this,class:"esri-feature-table__content",closable:b.close,description:this._effectiveDescription,disabled:this.disabled||"disabled"===h,heading:b.header?this._effectiveTitle:void 0,loading:"loading"===h,menuOpen:!!g?.open,overlayPositioning:"fixed",onCalcitePanelClose:l=>{l.target.closed=!1;this.emit("close")}},b.progress?k.tsx("calcite-progress",{type:c?
"indeterminate":"determinate"}):null,this._showLayerDropdown?this._renderLayerDropdown():null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderRelatedTableNavigationBar(),k.tsx("div",{class:"esri-feature-table__table-container"},this._renderTables())),a?k.tsx("calcite-scrim",null,this._renderPrompt(a)):null)}_renderTables(){const {_showAllTablesEnabled:a,grid:b,relatedTables:c}=this;if(c.length){var g=c.toArray();const h=1===g.length,l=this.classes("esri-feature-table",
a?"esri-feature-table__expanded":"esri-feature-table__collapsed"),p=a||h;g=a?g:h?[g[0]]:g.slice(-2);return k.tsx("calcite-panel",{overlayPositioning:"fixed"},k.tsx("div",null,[p?k.tsx("div",{class:l},b?.render()):void 0,...g.map(r=>{const q=c.indexOf(r);return k.tsx("div",{class:l,key:`related-${q}`},r.render())}),,]))}return b?.render()}_clearPrompt(){this._prompt=null}_renderPrompt({title:a,message:b,context:c,actions:g}){const h=k.tsx("calcite-button",{appearance:"solid",key:"prompt-primary-button",
kind:"danger"===c?"danger":"brand",onclick:g.primary.action,width:g.secondary?"half":"full"},g.primary.label);g=g.secondary?k.tsx("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:"danger"===c?"danger":"brand",onclick:g.secondary.action,width:"half"},g.secondary.label):null;return k.tsx("div",{class:`${"esri-feature-table__prompt"}--${c}`},k.tsx("div",{class:"esri-feature-table__prompt__header"},k.tsx("calcite-icon",{icon:"exclamation-mark-triangle"}),k.tsx(R.Heading,{class:"esri-feature-table__prompt__header__heading",
level:2},a)),k.tsx("div",{class:"esri-feature-table__prompt__message"},b),k.tsx("div",{class:"esri-feature-table__prompt__divider"}),k.tsx("div",{class:"esri-feature-table__prompt__actions"},g,h))}_showDeletePrompt(){const {messages:a,messagesCommon:b}=this;this._prompt={title:J.substitute(a.deleteSelectionCount,{count:this.highlightIds.length}),message:a.deleteRecordsRemoved,context:"danger",actions:{primary:{label:b.delete,action:this._onDeleteSelectionClick},secondary:{label:a.keepRecords,action:()=>
this._clearPrompt()}}}}async _onDeleteSelectionClick(){try{await this.viewModel.deleteSelection()}finally{this._clearPrompt()}}_renderHeaderMenuAction(a){const {disabled:b,hidden:c,icon:g,text:h,clickFunction:l}=a;if(!c)return k.tsx("calcite-action",{disabled:b??this.menuConfig?.disabled,icon:g??void 0,key:h,onclick:()=>l(),slot:"header-menu-actions",text:h,textEnabled:!0,title:h})}_renderHeaderMenuActions(){return this._shouldShowMenu?[this._renderDefaultHeaderMenuActions(),this._renderCustomHeaderMenuActions()]:
[]}_renderDefaultHeaderMenuActions(){if(!this._hasDefaultMenuItems)return[];const {messages:a}=this,b=[];this._showRefreshDataAction&&b.push(this._renderHeaderMenuAction({icon:"refresh",text:a.refreshData,clickFunction:()=>this.refresh()}));this._showDeleteSelectionAction&&b.push(this._renderHeaderMenuAction({icon:"trash",text:a.deleteSelection,clickFunction:()=>this.deleteSelection(!0)}));this._showClearSelectionAction&&b.push(this._renderHeaderMenuAction({icon:"clear-selection",text:a.clearSelection,
clickFunction:()=>this.highlightIds?.removeAll()}));this._showZoomToSelectionAction&&b.push(this._renderHeaderMenuAction({icon:"zoom-to-object",text:a.zoomToSelection,clickFunction:()=>this.zoomToSelection()}));this._showSelectedRecordsShowSelectedAction&&b.push(this._renderHeaderMenuAction({icon:"selection-filter",text:a.showSelected,clickFunction:()=>{const {objectIds:c}=this;c.removeAll();c.addMany(this.highlightIds.toArray())}}));this._showSelectedRecordsShowAllAction&&b.push(this._renderHeaderMenuAction({icon:"selection-x",
text:a.showAllRecords,clickFunction:()=>this.objectIds.removeAll()}));return b}_renderCustomHeaderMenuActions(){return this.menuConfig?.items?.map(({disabled:a,hidden:b,icon:c,label:g,clickFunction:h})=>this._renderHeaderMenuAction({hidden:"function"===typeof b?b():b,icon:c,text:g,disabled:a,clickFunction:l=>h(l)}))??[]}_renderColumnVisibilityAction(){if(!this._showColumnsVisibilityAction)return[];const {_columnVisibilityActions:a,_effectiveTable:b,_effectiveVisibleElements:c,id:g,messages:h}=this,
l=b.columns.toArray(),p=h?.toggleColumns,r=[k.tsx("calcite-action",{afterCreate:q=>a.set(g,q),afterRemoved:()=>a.delete(g),appearance:"transparent",bind:this,disabled:b.menuConfig?.disabled,icon:"show-column",id:`${g}__toggle-columns-action`,slot:"header-actions-end",text:p},c.tooltips?k.tsx("calcite-tooltip",{closeOnClick:!0,overlayPositioning:"fixed",placement:"bottom-end",slot:"tooltip"},p):null)];b.menuConfig?.disabled||r.push(k.tsx("calcite-popover",{autoClose:!0,class:"esri-feature-table__menu-popover",
label:p,overlayPositioning:"fixed",placement:"top-end",pointerDisabled:!0,referenceElement:a.get(g)},k.tsx("calcite-list",{filterEnabled:!0,filterPlaceholder:h.toggleColumns,selectionMode:"multiple"},...l.map(q=>{const w="columns"in q&&q.columns?.length?q.columns.map(v=>this._renderColumnListItem({column:v,table:b,ignoreSelect:!0})):void 0;return this._renderColumnListItem({column:q,table:b,items:w})}))));return r}_renderColumnListItem(a){const {column:b,table:c,items:g,ignoreSelect:h}=a,{effectiveLabel:l,
fieldName:p,hidden:r}=b;return k.tsx("calcite-list-item",{key:`toggle-columns__item-${p}`,label:l,open:!(!g?.length||r)||void 0,selected:!r,value:p,onCalciteListItemSelect:q=>{h||c.toggleColumnVisibility(q.target.value)}},g)}_renderLayerDropdown(){const a=this.messages.selectALayer;return k.tsx("div",{class:"esri-feature-table__layer-switcher-menu",key:`${this.id}-layerDropdown`,slot:"header-actions-start"},k.tsx("calcite-dropdown",{bind:this,maxItems:5,overlayPositioning:"fixed",placement:"bottom-start"},
k.tsx("calcite-action",{icon:"layers",slot:"trigger",text:a,title:a}),k.tsx("calcite-dropdown-group",{selectionMode:"single"},this._effectiveLayers.map((b,c)=>this._renderLayerDropdownItem(b,c))??null)))}_renderLayerDropdownItem(a,b){return k.tsx("calcite-dropdown-item",{key:`dropdown-item-${b}`,label:a.title??"",selected:a===this.layer,value:a.id,onCalciteDropdownItemSelect:()=>{this.layer=a}},a.title)}_onShowRelatedTable(a){this.showRelatedTableCallback||(this._collapseRelatedTable(this._effectiveTable,
a),this._createRelatedTable(a))}_renderRelatedTableNavigationBar(){const {messages:a}=this,b=a.exitRelatedRecords;if(this.relatedTables.length&&!this.showRelatedTableCallback)return k.tsx("div",{class:"esri-feature-table__table-navigation",key:"table-nav"},k.tsx("calcite-action",{icon:"move-up",iconFlipRtl:!0,key:b,onclick:()=>this._drainRelatedTables(),text:b,title:b}),this.relatedTables.toArray().map((c,g)=>this._renderRelatedTableNavigationAction(c,g)),k.tsx("div",null,k.tsx("calcite-label",{layout:"inline"},
a.showAllTables,k.tsx("calcite-switch",{checked:this._showAllTablesEnabled,onCalciteSwitchChange:c=>{c=!!c.target.checked;const g=this.relatedTable;this._showAllTablesEnabled=c;g&&(c?this._enterShowAllView(g):this._exitShowAllView(g))}}))))}_renderRelatedTableNavigationAction(a,b){const c=this._getLabelForRelatedTableNavigationAction(a);return k.tsx("calcite-action",{icon:"chevron-right",iconFlipRtl:!0,key:b,onclick:()=>this._drainRelatedTablesAboveIndex(b),text:c,textEnabled:!0,title:a.layer?.title||
""})}_getLabelForRelatedTableNavigationAction(a){const b=a.layer?.title;if(!b)return"";const {relatedTables:c}=this;return 1>=c.length?b:c.indexOf(a)!==c.length-1&&20<b.length?`${b.slice(0,20)}...`:b}_drainRelatedTables(){this.relatedTables.drain(a=>!a.destroyed&&a.destroy());this.set({_showAllTablesEnabled:!1,multipleSelectionEnabled:!0,tableTemplateOverride:null,relationshipColumnConfigs:null,visibleElementsOverride:null});this.hiddenFields.removeMany([t.uniqueColumnNames.action,t.uniqueColumnNames.attachments])}_drainRelatedTablesAboveIndex(a){var b=
this.relatedTables;const c=b.filter((l,p)=>p>a);c.forEach(l=>!l.destroyed&&l.destroy());b.removeMany(c);b=b.at(-1);if(b?.layer&&b?.relationship){var {layer:g,relationship:h}=b;this._showAllTablesEnabled?this._enterShowAllView(b):b.set({multipleSelectionEnabled:!0,tableTemplateOverride:null,relationshipColumnConfigs:this._getRelationshipIdsToShow(g,h.id),visibleElementsOverride:null});b.hiddenFields.removeMany([t.uniqueColumnNames.action,t.uniqueColumnNames.attachments])}}_getRelatedTableMenuItemConfig(a,
b,c){return b.fields.map(({alias:g,name:h})=>({selected:h===c,label:g||h,clickFunction:l=>{l.stopPropagation();a.tableTemplateOverride=new A({columnTemplates:[this._createRelatedFieldColumnTemplate(a,b,h)]})}}))}_createRelatedFieldColumnTemplate(a,b,c){return new O({fieldName:c,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._getRelatedTableMenuItemConfig(a,b,c)},resizable:!1})}_enterShowAllView(a){const b=a.layer;if(b){var c=a===this,{visibleElements:g}=a;a.set({relationshipColumnConfigs:[],
tableTemplateOverride:new A({columnTemplates:[this._createRelatedFieldColumnTemplate(a,b,b.displayField||b.objectIdField)]}),visibleElementsOverride:new x({header:c&&g.header,progress:c&&g.progress,columnMenus:g.columnMenus,close:g.close,tooltips:g.tooltips,selectionColumn:!1,columnMenuItems:new H({sortAscending:!1,sortDescending:!1})})});a.hiddenFields.addMany([t.uniqueColumnNames.action,t.uniqueColumnNames.attachments])}}_exitShowAllView(a){const {layer:b,relationship:c}=a;b&&null!=c?.id&&(a.set({relationshipColumnConfigs:this._getRelationshipIdsToShow(b,
c.id),tableTemplateOverride:null,visibleElementsOverride:null}),a.hiddenFields.removeMany([t.uniqueColumnNames.action,t.uniqueColumnNames.attachments]))}_collapseRelatedTable(a,b){const {relatedLayer:c,feature:g,relationshipId:h}=b;b=c.relationships?.find(({id:E})=>E===h);var {objectIdField:l}=c;b=c.displayField||b?.keyField||l;l=g.getObjectId()??g.attributes[l];const p=a===this,{close:r,columnMenus:q,header:w,layerDropdown:v,menu:y,menuItems:n,progress:F,tooltips:z}=a.visibleElements;a.set({highlightIds:new G([l]),
multipleSelectionEnabled:!1,relationshipColumnConfigs:[{relationshipId:h,collapsed:!0}],tableTemplateOverride:new A({columnTemplates:[this._createRelatedFieldColumnTemplate(a,c,b)]}),visibleElementsOverride:new x({header:p&&w,progress:p&&F,columnMenus:q,close:r,layerDropdown:v,menu:y,menuItems:n,tooltips:z,selectionColumn:!1,columnMenuItems:new H({sortAscending:!1,sortDescending:!1})})});a.hiddenFields.addMany([t.uniqueColumnNames.action,t.uniqueColumnNames.attachments]);a.grid?.scrollLeft(0)}_getRelationshipIdsToShow(a,
b){return(a.relationships??[]).filter(c=>!(c.id===b&&"one-to-one"===c.cardinality)).map(({id:c})=>({relationshipId:c}))}async _createRelatedTable(a){const {editingEnabled:b,relatedTables:c,view:g,viewModel:h}=this,{layer:l,feature:p,relatedLayer:r,relationshipId:q}=a;a=p.getObjectId()??p.attributes[r.objectIdField];var w=c.length;const v=w?c.getItemAt(w-1):this;await l.load();w=this.attachmentsEnabled&&t.isIFeatureTableSupportedLayerWithAttachments(l);const y=new D({layer:l,attachmentsEnabled:w,editingEnabled:b,
relatedRecordsEnabled:!0,relationshipConfig:{objectId:a,relatedLayer:r,relationshipId:q},relationshipColumnConfigs:this._getRelationshipIdsToShow(l,q),tableParent:v,view:g,visibleElements:new x({header:!1,progress:!1}),showRelatedTableCallback:({feature:n,layer:F,relatedLayer:z,relationshipId:E})=>{null!=(n.getObjectId()??n.attributes[z.objectIdField])&&h.emit("show-related-table",{feature:n,layer:F,relatedLayer:z,relationshipId:E})}});y.addHandles([u.on(()=>v.highlightIds,"change",({added:n})=>{n=
n[0];null!=n&&(y.highlightIds.removeAll(),y.relationshipConfig={objectId:n,relatedLayer:r,relationshipId:q})}),u.on(()=>v,"cell-click",n=>{({feature:n}=n);n&&(n=n.getObjectId()??n.attributes[r.objectIdField],null!=n&&v.highlightIds.add(n))})]);this.relatedTables.add(y);this.scheduleRender()}};e.__decorate([f.property()],d.prototype,"_columnVisibilityActions",void 0);e.__decorate([f.property()],d.prototype,"_effectiveDescription",null);e.__decorate([f.property()],d.prototype,"_effectiveLayers",null);
e.__decorate([f.property()],d.prototype,"_effectiveTable",null);e.__decorate([f.property()],d.prototype,"_effectiveTitle",null);e.__decorate([f.property()],d.prototype,"_effectiveVisibleElements",null);e.__decorate([f.property()],d.prototype,"_hasCustomMenuItems",null);e.__decorate([f.property()],d.prototype,"_hasDefaultMenuItems",null);e.__decorate([f.property()],d.prototype,"_prompt",void 0);e.__decorate([f.property()],d.prototype,"_shouldShowMenu",null);e.__decorate([f.property()],d.prototype,
"_showAllTablesEnabled",void 0);e.__decorate([f.property()],d.prototype,"_showClearSelectionAction",null);e.__decorate([f.property()],d.prototype,"_showColumnsVisibilityAction",null);e.__decorate([f.property()],d.prototype,"_showDeleteSelectionAction",null);e.__decorate([f.property()],d.prototype,"_showLayerDropdown",null);e.__decorate([f.property()],d.prototype,"_showRefreshDataAction",null);e.__decorate([f.property()],d.prototype,"_showSelectedRecordsShowSelectedAction",null);e.__decorate([f.property()],
d.prototype,"_showSelectedRecordsShowAllAction",null);e.__decorate([f.property()],d.prototype,"_showZoomToSelectionAction",null);e.__decorate([f.property()],d.prototype,"_viewLayers",null);e.__decorate([f.property()],d.prototype,"actionColumnConfig",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"activeFilters",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"activeSortOrders",null);e.__decorate([f.property()],d.prototype,"attachmentsEnabled",null);e.__decorate([f.property()],
d.prototype,"autoRefreshEnabled",null);e.__decorate([f.property()],d.prototype,"columnPerformanceModeEnabled",null);e.__decorate([f.property()],d.prototype,"columnReorderingEnabled",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"columns",null);e.__decorate([f.property()],d.prototype,"description",void 0);e.__decorate([f.property()],d.prototype,"disabled",void 0);e.__decorate([f.property()],d.prototype,"editingEnabled",null);e.__decorate([f.property()],d.prototype,"filterGeometry",null);
e.__decorate([f.property()],d.prototype,"filterBySelectionEnabled",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"grid",null);e.__decorate([f.property()],d.prototype,"hiddenFields",null);e.__decorate([f.property()],d.prototype,"highlightEnabled",null);e.__decorate([f.property()],d.prototype,"highlightIds",null);e.__decorate([f.property()],d.prototype,"icon",null);e.__decorate([f.property()],d.prototype,"isQueryingOrSyncing",null);e.__decorate([f.property()],d.prototype,"label",null);
e.__decorate([f.property()],d.prototype,"layer",null);e.__decorate([f.property()],d.prototype,"layers",void 0);e.__decorate([f.property()],d.prototype,"layerView",null);e.__decorate([f.property(),C.messageBundle("esri/widgets/FeatureTable/t9n/FeatureTable")],d.prototype,"messages",null);e.__decorate([f.property(),C.messageBundle("esri/t9n/common")],d.prototype,"messagesCommon",null);e.__decorate([f.property(),C.messageBundle("esri/widgets/support/t9n/uriUtils")],d.prototype,"messagesURIUtils",null);
e.__decorate([f.property()],d.prototype,"menuConfig",void 0);e.__decorate([f.property()],d.prototype,"multipleSelectionEnabled",null);e.__decorate([f.property()],d.prototype,"multiSortEnabled",null);e.__decorate([f.property()],d.prototype,"objectIds",null);e.__decorate([f.property()],d.prototype,"pageSize",null);e.__decorate([f.property()],d.prototype,"relatedRecordsEnabled",null);e.__decorate([f.property()],d.prototype,"relatedTable",null);e.__decorate([f.property()],d.prototype,"relatedTables",
void 0);e.__decorate([f.property()],d.prototype,"relationship",null);e.__decorate([f.property()],d.prototype,"relationshipColumnConfigs",null);e.__decorate([f.property()],d.prototype,"relationshipConfig",null);e.__decorate([f.property()],d.prototype,"returnGeometryEnabled",null);e.__decorate([f.property()],d.prototype,"returnMEnabled",null);e.__decorate([f.property()],d.prototype,"returnZEnabled",null);e.__decorate([f.property()],d.prototype,"rowHighlightIds",null);e.__decorate([f.property()],d.prototype,
"selectionSource",null);e.__decorate([f.property()],d.prototype,"showRelatedTableCallback",null);e.__decorate([f.property()],d.prototype,"size",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"state",null);e.__decorate([f.property({constructOnly:!0})],d.prototype,"tableParent",void 0);e.__decorate([f.property()],d.prototype,"tableTemplate",null);e.__decorate([f.property()],d.prototype,"tableTemplateOverride",null);e.__decorate([f.property()],d.prototype,"title",void 0);e.__decorate([f.property()],
d.prototype,"timeExtent",null);e.__decorate([f.property()],d.prototype,"timeZone",null);e.__decorate([f.property()],d.prototype,"view",null);e.__decorate([f.property({type:I}),S.vmEvent(["cell-click","cell-pointerover","cell-pointerout","cell-keydown","show-related-table"])],d.prototype,"viewModel",void 0);e.__decorate([f.property({type:x,nonNullable:!0})],d.prototype,"visibleElements",void 0);e.__decorate([f.property({type:x})],d.prototype,"visibleElementsOverride",void 0);return d=D=e.__decorate([K.subclass("esri.widgets.FeatureTable")],
d)});