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.
 
 

10 lines
3.2 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("exports ../../core/Error ../../core/accessorSupport/originUtils ../../portal/Portal ../../portal/PortalItem ../../portal/support/jsonContext ../../portal/support/portalItemUtils ../../webdoc/support/saveAPIKeyUtils ../../webdoc/support/saveUtils".split(" "),function(f,k,u,C,D,E,v,F,G){function w(a,b,c){c=c(a);if(!c.isValid)throw new k(`${b}:invalid-parameters`,c.errorMessage,{layer:a});}async function x(a){const {layer:b,errorNamePrefix:c,validateLayer:d}=a;await b.load();w(b,c,d)}function m(a,
b){return`Layer (title: ${a.title}, id: ${a.id}) of type '${a.declaredClass}' ${b}`}function y(a){const {item:b,errorNamePrefix:c,layer:d,validateItem:e}=a;F.validateSaveAPIKey(b);H(a);if(e&&(a=e(b),!a.isValid))throw new k(`${c}:invalid-parameters`,a.errorMessage,{layer:d});}function H(a){const {item:b,itemType:c,additionalItemType:d,errorNamePrefix:e,layer:g}=a;a=[c];d&&a.push(d);if(!a.includes(b.type))throw a=a.map(l=>`'${l}'`).join(", "),new k(`${e}:portal-item-wrong-type`,`Portal item type should be one of: "${a}"`,
{item:b,layer:g});}function z(a){const {layer:b,errorNamePrefix:c}=a,{portalItem:d}=b;if(!d)throw new k(`${c}:portal-item-not-set`,m(b,"requires the portalItem property to be set"));if(!d.loaded)throw new k(`${c}:portal-item-not-loaded`,m(b,"cannot be saved to a portal item that does not exist or is inaccessible"));y({...a,item:d})}function A(a){const {newItem:b,itemType:c}=a;let d=D.from(b);d.id&&(d=d.clone(),d.id=null);let e;(e=d).type??(e.type=c);let g;(g=d).portal??(g.portal=C.getDefault());y({...a,
item:d});return d}function n(a){return E.createForItemWrite(a,"portal-item")}async function p(a,b,c){"beforeSave"in a&&"function"===typeof a.beforeSave&&await a.beforeSave();a=a.write({},b);await Promise.all(b.resources?.pendingOperations??[]);G.evaluateWriteErrors(b,{errorName:"layer-write:unsupported"},c);return a}function q(a){v.addTypeKeyword(a,v.typeKeyword.JSAPI);a.typeKeywords&&(a.typeKeywords=a.typeKeywords.filter((b,c,d)=>d.indexOf(b)===c))}async function B(a,b,c){const d=a.portal;await d.signIn();
await d.user?.addItem({item:a,data:b,folder:c?.folder})}f.addItem=B;f.createErrorMessage=m;f.createJSONContextForWrite=n;f.ensureItemConfig=z;f.ensureLayerConfig=w;f.getLayerJSON=p;f.getPortalItem=A;f.save=async function(a,b){const {layer:c,createItemData:d,createJSONContext:e,setItemProperties:g,saveResources:l,supplementalUnsupportedErrors:r}=a;await x(a);z(a);a=c.portalItem;const h=e?e(a):n(a);b=await p(c,h,{...b,supplementalUnsupportedErrors:r});b=await d({layer:c,layerJSON:b},a);await g?.(c,
a);q(a);await a.update({data:b});u.updateOrigins(h);await l?.(a,h);return a};f.saveAs=async function(a,b){const {layer:c,createItemData:d,createJSONContext:e,setItemProperties:g,saveResources:l,supplementalUnsupportedErrors:r}=a;await x(a);a=A(a);const h=e?e(a):n(a);var t=await p(c,h,{...b,supplementalUnsupportedErrors:r});t=await d({layer:c,layerJSON:t},a);await g(c,a);q(a);await B(a,t,b);c.portalItem=a;u.updateOrigins(h);await l?.(a,h);return a};f.setCommonItemProperties=q;Object.defineProperty(f,
Symbol.toStringTag,{value:"Module"})});