UNPKG

@arcgis/map-components

Version:
5 lines (4 loc) 4.94 kB
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. v4.32.13 */ import{a as l,b as c}from"./VOXR3NPC.js";import{A as o,B as v,G as V,r as u,s}from"./NIZJVZRG.js";var N=u`:host{display:none;background:#bdf2c4}:host([selected]){display:flex}calcite-block{margin-block:0}calcite-pagination{justify-content:center}`,h=class extends v{constructor(){super(...arguments),this._filterInputElement=l(),this._flowItemElement=l(),this.currentPage=1,this.selected=!1,this.showBackButton=!1,this.arcgisGetVersions=o(),this.arcgisManageVersion=o(),this.arcgisNewVersion=o()}static{this.properties={_filteredVersionInfos:16,currentPage:11,selected:7,showBackButton:7,versionListElementProps:0}}static{this.styles=N}load(){this._filteredVersionInfos=this.versionListElementProps.versionInfos}willUpdate(e){if(e.has("versionListElementProps")){let i=e.get("versionListElementProps"),t=this.versionListElementProps;i?.versionInfos!==t.versionInfos&&(this._filteredVersionInfos=t.versionInfos,this._filterInputElement.value&&this._handleFilterChange())}}updated(){this._filterInputElement.value?.setFocus()}async setFocus(){this._flowItemElement.value?.setFocus()}goBack(){}_handleFilterChange(){let{versionListElementProps:{versionInfos:e}}=this,i=this._filterInputElement.value.value.toUpperCase();this._filteredVersionInfos=i===""?e:e.filter(t=>t.versionIdentifier.name.toUpperCase().includes(i)||t.versionIdentifier.guid.toUpperCase().includes(i)),this._filteredVersionInfos.length&&(this.currentPage=1)}_handleNoticeClosed(){this.versionListElementProps={...this.versionListElementProps,executionError:void 0}}_handlePaginationChange(e){this.currentPage=e.target.startItem}_getExecutionError(e){let{versionListElementProps:{strings:{executionErrors:i}}}=this;switch(e){case"no-advanced-editing-user-type-extension":return i.noAdvancedEditingUserTypeExtension;case"no-feature-service-found":return i.noFeatureServiceFound;case"no-valid-enterprise-version":return i.notValidEnterpriseVersion;case"no-valid-version-name":return i.invalidVersionName;default:return e}}_paginate(e,i,t){return e.slice((t-1)*i,t*i)}render(){let{currentPage:e,selected:i,showBackButton:t,versionListElementProps:{closable:I,currentUser:$,currentVersionIdentifier:d,executionError:g,hasAdvEditingUte:f,heading:_,isVersionAdministrator:E,isVersioningApiAvailable:p,pageSize:r,serviceName:b,serviceUrl:a,state:x,strings:{headers:m},strings:n,versionInfos:P}}=this,w=s`<calcite-block .heading=${m.currentVersion} .description=${d.name} overlay-positioning=fixed></calcite-block>`,k=s`<calcite-action id=actionRefreshVersions icon=refresh text @click=${()=>{this.arcgisGetVersions.emit({serviceUrl:a})}} slot=header-actions-end><calcite-tooltip overlay-positioning=fixed reference-element=actionRefreshVersions><span>${n.actions.refreshVersions}</span></calcite-tooltip></calcite-action>`;this._paginatedVersionInfos=this._filteredVersionInfos.length>r?this._paginate(this._filteredVersionInfos,r,e):this._filteredVersionInfos;let C=this._filteredVersionInfos.length>r?s`<calcite-pagination @calcitePaginationChange=${this._handlePaginationChange} page-size=1 .startItem=${e} .totalItems=${Math.ceil(this._filteredVersionInfos.length/r)}></calcite-pagination>`:void 0,U=this._paginate(this._paginatedVersionInfos,r,1).map(F=>s`<arcgis-version-management-version-item .versionItemElementProps=${{currentUser:$,currentVersionIdentifier:d,isCurrentVersionCard:!1,hasAdvEditingUte:f,isVersionAdministrator:E,isVersioningApiAvailable:p,serviceUrl:a,strings:n,versionInfo:F}}></arcgis-version-management-version-item>`),L=P.length>r?s`<calcite-block heading .label=${m.filterVersions} open><calcite-input-text clearable icon=search @calciteInputTextInput=${this._handleFilterChange} .placeholder=${n.actions.searchVersions} ${c(this._filterInputElement)}></calcite-input-text></calcite-block>`:void 0,A=s`<calcite-list .label=${n.headers.manageVersions}>${U}</calcite-list>`,y=p&&f?s`<calcite-fab appearance=outline-fill slot=fab text-enabled .text=${n.actions.newVersion} @click=${()=>{this.arcgisNewVersion.emit({serviceUrl:a})}}></calcite-fab>`:void 0,B=g?s`<calcite-notice @calciteNoticeClose=${this._handleNoticeClosed} class="notice" closable kind=warning open scale=s slot=footer width=full><div slot=message>${this._getExecutionError(g)}</div></calcite-notice>`:void 0;return s`<calcite-flow-item .closable=${I} .description=${b} .heading=${_} .selected=${i} .showBackButton=${t} ${c(this._flowItemElement)}><calcite-panel .loading=${x==="executing"}>${w}<calcite-panel .heading=${this._filteredVersionInfos.length?`${n.headers.manageVersions} (${this._filteredVersionInfos.length})`:n.headers.manageVersions}>${k}${L}${A}${y}</calcite-panel>${C}${B}</calcite-panel></calcite-flow-item>`}};V("arcgis-version-management-version-list",h);export{h as ArcgisVersionManagementVersionList};