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.
 
 

15 lines
6.0 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 exports ../../../chunks/tslib.es6 ../../../core/promiseUtils ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../portal/Portal ../../Widget ../../../chunks/componentsUtils ../../support/widgetUtils ../../support/decorators/messageBundle ../../support/jsxFactory".split(" "),function(f,d,g,l,h,t,u,v,m,n,p,q,w,k,c){d.SaveLayer=class extends p{constructor(a,b){super(a,
b);this.messagesIdentity=this.messagesCommon=this.messages=this._userName=this._portalFolderCombobox=this._layerNameInput=this._layer=this._folders=null;this.opened=!1;this.state="initialized";this.close=()=>{this.opened=!1;this.state="initialized"}}loadDependencies(){return q.loadCalciteComponents({button:()=>new Promise((a,b)=>f(["../../../chunks/calcite-button"],a,b)),combobox:()=>new Promise((a,b)=>f(["../../../chunks/calcite-combobox"],a,b)),"combobox-item":()=>new Promise((a,b)=>f(["../../../chunks/calcite-combobox-item"],
a,b)),icon:()=>new Promise((a,b)=>f(["../../../chunks/calcite-icon"],a,b)),input:()=>new Promise((a,b)=>f(["../../../chunks/calcite-input"],a,b)),label:()=>new Promise((a,b)=>f(["../../../chunks/calcite-label"],a,b)),loader:()=>new Promise((a,b)=>f(["../../../chunks/calcite-loader"],a,b)),panel:()=>new Promise((a,b)=>f(["../../../chunks/calcite-panel"],a,b))})}get label(){return this.messages?.widgetLabel??""}set label(a){this._overrideIfSome("label",a)}async open(a){this.state="initialized";this.opened=
!0;this._layer=a;this.state="connect-to-portal";a=n.getDefault();try{await a.signIn()}catch(b){l.isAbortError(b)||"identity-manager:user-aborted"===b.name?this.close():this.state="connect-to-portal-error";return}this.state="fetch-portal-information";({user:a}=a);this._userName=a?.username;try{this._folders=await a?.fetchFolders()}catch{this.state="fetch-portal-information-error";return}this.state="save-layer"}render(){switch(this.state){case "initialized":return this._renderInitialized();case "connect-to-portal":return this._renderProcess(this.messagesIdentity.lblSigning);
case "connect-to-portal-error":return this._renderError(this.messages.errors.authenticating);case "fetch-portal-information":return this._renderProcess(this.messages.processing.fetching);case "fetch-portal-information-error":return this._renderError(this.messages.errors.fetching);case "save-layer":return this._renderSaveLayer();case "saving":return this._renderProcess(this.messages.processing.saving);case "saving-error":return this._renderError(this.messages.errors.saving)}}_renderError(a){return c.tsx("calcite-panel",
{class:"esri-save-layer",heading:this.messages.widgetLabel,key:"esri-save-layer-error-panel"},c.tsx("div",{class:"esri-save-layer__error"},c.tsx("calcite-icon",{class:"esri-save-layer__error-icon",icon:"exclamation-mark-triangle",scale:"l",textLabel:this.messagesCommon.errorMessage}),c.tsx("calcite-label",{class:"esri-save-layer__error-label"},a)),c.tsx("calcite-button",{appearance:"outline",onclick:this.close,slot:"footer-actions",width:"half"},this.messagesCommon.close))}_renderInitialized(){return c.tsx("calcite-panel",
{class:"esri-save-layer",heading:this.messages.widgetLabel,key:"esri-save-layer-initialize-panel"})}_renderProcess(a){return c.tsx("calcite-panel",{class:"esri-save-layer",heading:this.messages.widgetLabel,key:"esri-save-layer-process-panel"},c.tsx("calcite-loader",{class:"esri-save-layer__process-loader",label:a}),c.tsx("calcite-label",{alignment:"center",class:"esri-save-layer__process-label"},a))}_renderSaveLayer(){if(null==this._layer||null==this._folders||null==this._userName)return this._renderInitialized();
var {stops:a}=this._layer,b=a.at(0).name;a=a.at(-1).name;b=`${b} - ${a}`;a=this._folders.map(e=>c.tsx("calcite-combobox-item",{key:`${"esri-save-layer"}-folder-${e.id}`,textLabel:e.title??"",value:e.id}));a.unshift(c.tsx("calcite-combobox-item",{key:"esri-save-layer-folder-home",selected:!0,textLabel:`${this._userName} (${this.messagesCommon.home})`,value:null}));return c.tsx("calcite-panel",{class:"esri-save-layer",heading:this.messages.widgetLabel,key:"esri-save-layer-save-panel"},c.tsx("calcite-label",
{class:"esri-save-layer__layer-name-label"},this.messages.laverName,c.tsx("calcite-input",{afterCreate:e=>{this._layerNameInput=e},label:this.messages.laverName,value:b})),c.tsx("calcite-label",{class:"esri-save-layer__portal-folder-label"},this.messages.saveInFolder,c.tsx("calcite-combobox",{afterCreate:e=>{this._portalFolderCombobox=e},label:this.messages.saveInFolder,overlayPositioning:"fixed",selectionMode:"single"},a)),c.tsx("calcite-button",{onclick:()=>this._saveButtonClick(),slot:"footer-actions",
width:"half"},this.messagesCommon.save),c.tsx("calcite-button",{appearance:"outline",onclick:()=>{this.close()},slot:"footer-actions",width:"half"},this.messagesCommon.cancel))}_saveButtonClick(){this.state="saving";this._saveLayer().then(()=>{this.close()}).catch(()=>{this.state="saving-error"})}async _saveLayer(){if(null!=this._layer&&null!=this._folders){var a=this._layerNameInput?.value,b=this._portalFolderCombobox?.value,e=this._folders.find(r=>r.id===b);await this._layer.saveAs({title:a},{folder:e})}}};
g.__decorate([h.property()],d.SaveLayer.prototype,"label",null);g.__decorate([h.property(),k.messageBundle("esri/widgets/support/t9n/SaveLayer")],d.SaveLayer.prototype,"messages",void 0);g.__decorate([h.property(),k.messageBundle("esri/t9n/common")],d.SaveLayer.prototype,"messagesCommon",void 0);g.__decorate([h.property(),k.messageBundle("esri/identity/t9n/identity")],d.SaveLayer.prototype,"messagesIdentity",void 0);g.__decorate([h.property()],d.SaveLayer.prototype,"opened",void 0);g.__decorate([h.property()],
d.SaveLayer.prototype,"state",void 0);d.SaveLayer=g.__decorate([m.subclass("esri.widgets.Directions.components.SaveLayer")],d.SaveLayer);Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});