UNPKG

@arcgis/map-components

Version:
5 lines (4 loc) 5.49 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 d,b as u}from"./VOXR3NPC.js";import{A as m,B as g,G as $,g as b,r as w,s as n}from"./NIZJVZRG.js";var k=w`@layer{:host{display:none;background:#bdf2c4}:host([selected]){display:flex}.properties-buttons{display:flex}}`,_=class extends g{constructor(){super(...arguments),this._flowItemElement=d(),this._switchToVersion=!0,this._switchToVersionCheckboxElement=d(),this._versionNameInputElement=d(),this.selected=!1,this.showBackButton=!1,this.arcgisAlterVersion=m(),this.arcgisCreateVersion=m(),this.arcgisFlowItemBack=m(),this.arcgisFlowItemClose=m()}static{this.properties={selected:7,showBackButton:7,versionPropertiesElementProps:0}}static{this.shadowRootOptions=b}static{this.styles=k}load(){let{versionPropertiesElementProps:{versionInfo:t}}=this;t?(this._mode="edit",this._fullVersionName=t.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(t){let{_mode:s,_ownerName:l,_versionName:h,versionPropertiesElementProps:{currentUser:p,isVersionAdministrator:v,serviceUrl:i,versionInfo:c}}=this,{_alterVersionParameters:e,_createVersionParameters:a}=this;switch(s==="create"&&(a||(a={access:"public",description:"",featureServerUrl:i,ownerName:p,versionName:""})),s==="edit"&&(e||(e={featureServerUrl:i,versionIdentifier:c.versionIdentifier,ownerName:l,versionName:h,access:c.access,description:c.description})),t.type){case"calciteChipGroupSelect":{let r=t.target.label,o=t.target.selectedItems[0].value;s==="create"&&(a={...a,[r]:o}),s==="edit"&&(e={...e,[r]:o});break}case"calciteInputTextInput":{let r=t.target.name,o=t.target.value;s==="create"&&(a={...a,[r]:o}),s==="edit"&&(e={...e,[r]:o});break}case"calciteTextAreaInput":{let r=t.target.name,o=t.target.value;s==="create"&&(a={...a,[r]:o}),s==="edit"&&(e={...e,[r]:o});break}}s==="create"&&(a.access!=="public"&&p.toUpperCase()!==a.ownerName?.toUpperCase()&&!v?(this._switchToVersionCheckboxElement.value.checked=!1,this._switchToVersionCheckboxElement.value.disabled=!0,this._switchToVersion=!1):this._switchToVersionCheckboxElement.value.disabled=!1,this._createVersionParameters=a),s==="edit"&&(this._alterVersionParameters=e)}_handleClose(){this.arcgisFlowItemClose.emit()}_handleSave(){let{_alterVersionParameters:t,_createVersionParameters:s,_mode:l,_switchToVersion:h}=this;l==="create"&&this.arcgisCreateVersion.emit({createVersionParameters:s,switchToVersion:h}),l==="edit"&&this.arcgisAlterVersion.emit({alterVersionParameters:t})}_handleSwitchToVersionChange(t){this._switchToVersion=t.target.checked}render(){let{selected:t,showBackButton:s,versionPropertiesElementProps:{closable:l,currentUser:h,hasAdvEditingUte:p,state:v,strings:i,versionInfo:c},_mode:e,_ownerName:a,_versionName:r}=this,o=n`<div class="properties-buttons"><calcite-button appearance=outline width=half @click=${this._handleCancel}>${i.actions.cancelSave}</calcite-button><calcite-button width=half @click=${this._handleSave}>${i.actions.saveVersion}</calcite-button></div>`,V=n`<calcite-label>${i.input.versionAccess}<calcite-chip-group label=access @calciteChipGroupSelect=${this._handleChange} selection-mode=single-persist><calcite-chip .selected=${e==="edit"&&c.access==="public"||e==="create"} label=public>${i.accessLevels.public}</calcite-chip><calcite-chip .selected=${e==="edit"&&c.access==="protected"} label=protected>${i.accessLevels.protected}</calcite-chip><calcite-chip .selected=${e==="edit"&&c.access==="private"} label=private>${i.accessLevels.private}</calcite-chip></calcite-chip-group></calcite-label>`,f=n`<calcite-label>${i.input.versionDescription}<calcite-text-area name=description @calciteTextAreaInput=${this._handleChange} resize=vertical .value=${e==="edit"?c.description:""}></calcite-text-area></calcite-label>`,I=n`<calcite-label>${i.input.versionName}<calcite-input-text name=versionName @calciteInputTextInput=${this._handleChange} max-length=62 .value=${e==="edit"?r:""} ${u(this._versionNameInputElement)}></calcite-input-text></calcite-label>`,x=n`<calcite-label>${i.input.versionOwner}<calcite-input-text name=ownerName @calciteInputTextInput=${this._handleChange} .disabled=${!p} .value=${e==="edit"?a:h}></calcite-input-text></calcite-label>`,C=e==="create"?n`<calcite-label layout=inline><calcite-checkbox checked name=switchToVersion @calciteCheckboxChange=${this._handleSwitchToVersionChange} ${u(this._switchToVersionCheckboxElement)}></calcite-checkbox>${i.actions.switchToVersion}</calcite-label>`:void 0;return n`<calcite-flow-item .closable=${l} .description=${c?c.versionIdentifier.name:""} .heading=${c?i.actions.editVersion:i.actions.newVersion} .selected=${t} .showBackButton=${s} @calciteFlowItemClose=${this._handleClose} ${u(this._flowItemElement)}><calcite-panel .loading=${v==="executing"}><calcite-block .label=${i.headers.versionProperties} open>${I}${f}${V}${x}${C}${o}</calcite-block></calcite-panel></calcite-flow-item>`}};$("arcgis-version-management-version-properties",_);export{_ as ArcgisVersionManagementVersionProperties};