@arcgis/map-components
Version:
ArcGIS Map Components
5 lines (4 loc) • 5.45 kB
JavaScript
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
v4.33.13 */
import{a as u,b as v}from"./MF2SVVTD.js";import{B as p,E as w,P as g,U as $,j as b,k as l}from"./HX57SHRL.js";var k=b`{:host{display:none;background:#bdf2c4}:host([selected]){display:flex}.properties-buttons{display:flex}}`,_=class extends g{constructor(){super(...arguments),this._flowItemElement=u(),this._switchToVersion=!0,this._switchToVersionCheckboxElement=u(),this._versionNameInputElement=u(),this.selected=!1,this.showBackButton=!1,this.arcgisAlterVersion=p(),this.arcgisCreateVersion=p(),this.arcgisFlowItemBack=p(),this.arcgisFlowItemClose=p()}static{this.properties={selected:7,showBackButton:7,versionPropertiesElementProps:0}}static{this.shadowRootOptions=w}static{this.styles=k}load(){let{versionPropertiesElementProps:{versionInfo:e}}=this;e?(this._mode="edit",this._fullVersionName=e.versionIdentifier.name,this._ownerName=this._fullVersionName.substring(0,this._fullVersionName.lastIndexOf(".")),this._versionName=this._fullVersionName.substring(this._fullVersionName.lastIndexOf(".")+1)):this._mode="create"}updated(){this._mode==="create"&&this._versionNameInputElement.value?.setFocus()}async setFocus(){this._flowItemElement.value?.setFocus()}goBack(){}_handleCancel(){this.arcgisFlowItemBack.emit()}_handleChange(e){let{_mode:i,_ownerName:h,_versionName:m,versionPropertiesElementProps:{currentUser:d,isVersionAdministrator:t,serviceUrl:r,versionInfo:a}}=this,{_alterVersionParameters:c,_createVersionParameters:s}=this;switch(i==="create"&&(s||(s={access:"public",description:"",featureServerUrl:r,ownerName:d,versionName:""})),i==="edit"&&(c||(c={featureServerUrl:r,versionIdentifier:a.versionIdentifier,ownerName:h,versionName:m,access:a.access,description:a.description})),e.type){case"calciteChipGroupSelect":{let o=e.target.label,n=e.target.selectedItems[0].label;i==="create"&&(s={...s,[o]:n}),i==="edit"&&(c={...c,[o]:n});break}case"calciteInputTextInput":{let o=e.target.name,n=e.target.value;i==="create"&&(s={...s,[o]:n}),i==="edit"&&(c={...c,[o]:n});break}case"calciteTextAreaInput":{let o=e.target.name,n=e.target.value;i==="create"&&(s={...s,[o]:n}),i==="edit"&&(c={...c,[o]:n});break}}i==="create"&&(s.access!=="public"&&d.toUpperCase()!==s.ownerName?.toUpperCase()&&!t?(this._switchToVersionCheckboxElement.value.checked=!1,this._switchToVersionCheckboxElement.value.disabled=!0,this._switchToVersion=!1):this._switchToVersionCheckboxElement.value.disabled=!1,this._createVersionParameters=s),i==="edit"&&(this._alterVersionParameters=c)}_handleClose(){this.arcgisFlowItemClose.emit()}_handleSave(){let{_alterVersionParameters:e,_createVersionParameters:i,_mode:h,_switchToVersion:m}=this;h==="create"&&this.arcgisCreateVersion.emit({createVersionParameters:i,switchToVersion:m}),h==="edit"&&this.arcgisAlterVersion.emit({alterVersionParameters:e})}_handleSwitchToVersionChange(e){this._switchToVersion=e.target.checked}render(){let{selected:e,showBackButton:i,versionPropertiesElementProps:{closable:h,currentUser:m,state:d,strings:t,versionInfo:r},_mode:a,_ownerName:c,_versionName:s}=this,o=l`<div class="properties-buttons"><calcite-button appearance=outline width=half =${this._handleCancel}>${t.actions.cancelSave}</calcite-button><calcite-button width=half =${this._handleSave}>${t.actions.saveVersion}</calcite-button></div>`,n=l`<calcite-label>${t.input.versionAccess}<calcite-chip-group label=access =${this._handleChange} selection-mode=single-persist><calcite-chip .selected=${a==="edit"&&r.access==="public"||a==="create"} label=public>${t.accessLevels.public}</calcite-chip><calcite-chip .selected=${a==="edit"&&r.access==="protected"} label=protected>${t.accessLevels.protected}</calcite-chip><calcite-chip .selected=${a==="edit"&&r.access==="private"} label=private>${t.accessLevels.private}</calcite-chip></calcite-chip-group></calcite-label>`,V=l`<calcite-label>${t.input.versionDescription}<calcite-text-area name=description =${this._handleChange} resize=vertical .value=${a==="edit"?r.description:""}></calcite-text-area></calcite-label>`,f=l`<calcite-label>${t.input.versionName}<calcite-input-text name=versionName =${this._handleChange} max-length=62 .value=${a==="edit"?s:""} ${v(this._versionNameInputElement)}></calcite-input-text></calcite-label>`,I=l`<calcite-label>${t.input.versionOwner}<calcite-input-text name=ownerName =${this._handleChange} .value=${a==="edit"?c:m}></calcite-input-text></calcite-label>`,x=a==="create"?l`<calcite-label layout=inline><calcite-checkbox checked name=switchToVersion =${this._handleSwitchToVersionChange} ${v(this._switchToVersionCheckboxElement)}></calcite-checkbox>${t.actions.switchToVersion}</calcite-label>`:void 0;return l`<calcite-flow-item .closable=${h} .description=${r?r.versionIdentifier.name:""} .heading=${r?t.actions.editVersion:t.actions.newVersion} .selected=${e} .showBackButton=${i} =${this._handleClose} ${v(this._flowItemElement)}><calcite-panel .loading=${d==="executing"}><calcite-block .label=${t.headers.versionProperties} open>${f}${V}${n}${I}${x}${o}</calcite-block></calcite-panel></calcite-flow-item>`}};$("arcgis-version-management-version-properties",_);export{_ as ArcgisVersionManagementVersionProperties};