@arcgis/core 4.28.0-next.20230706 → 4.28.0-next.20230708
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{cfd8b13bfabafc56d65d.js → 2c2cab197c47f080772a.js} +1 -1
- package/assets/esri/core/workers/chunks/{6d22060e5b6e0b11227a.js → 3a0e2535f6cdb2e65667.js} +1 -1
- package/assets/esri/core/workers/chunks/4e4e62462deec25e82ce.js +1 -0
- package/assets/esri/core/workers/chunks/fb7eff7f76386f81d57b.js +1 -0
- package/assets/esri/t9n/common.json +1 -1
- package/assets/esri/t9n/common_en.json +1 -1
- package/assets/esri/themes/base/widgets/_Feature.scss +3 -2
- package/assets/esri/themes/base/widgets/_UtilityNetworkAssociations.scss +69 -32
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_en.json +1 -1
- package/chunks/BlendWeights.glsl.js +33 -35
- package/chunks/Blur.glsl.js +6 -9
- package/chunks/EdgeDetect.glsl.js +10 -10
- package/interfaces.d.ts +6 -300
- package/layers/WebTileLayer.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
- package/networks/Network.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +1 -1
- package/rest/networks/support/ValidateNetworkTopologyResult.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
- package/views/3d/webgl-engine/shaders/BlendWeights.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Blur.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/EdgeDetect.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/SMAAPassParameters.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Feature/resources.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/Zoom/ZoomConditions2D.js +1 -1
- package/assets/esri/core/workers/chunks/6b579428c976011b8bcb.js +0 -1
- package/assets/esri/core/workers/chunks/7d9ad61c7896cafc19f7.js +0 -1
- package/layers/LinkChartLayer.d.ts +0 -4
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{abortMaybe as r,disposeMaybe as s}from"../../../../core/maybe.js";import{isAbortError as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{abortMaybe as r,disposeMaybe as s}from"../../../../core/maybe.js";import{isAbortError as o,throwIfAborted as i,isAborted as n}from"../../../../core/promiseUtils.js";import{watch as a,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as p}from"../../../../support/requestImageUtils.js";import{ColorFormat as u}from"../core/FBOCache.js";import{RenderFeature as d}from"./RenderFeature.js";import{RenderSlot as m}from"./RenderSlot.js";import{PixelFormat as _,TextureSamplingMode as b,ClearBufferBit as x,TextureWrapMode as f}from"../../../webgl/enums.js";import{Texture as g}from"../../../webgl/Texture.js";import{TextureDescriptor as T}from"../../../webgl/TextureDescriptor.js";let C=class extends t{constructor(e){super(e),this.renderSlots=[m.ANTIALIASING],this._context=null,this._areaTexture=null,this._searchTexture=null,this._isEnabled=!1}get canRender(){return this._isEnabled&&null!=this._context}get updating(){return null!=this._abortController}initializeRenderContext(e){this._context=e,this.addHandles([a((()=>this.view.qualitySettings.antialiasingEnabled),(e=>e||this._context?.isFeatureEnabled(d.Antialiasing)?this.enable():this.disable()),l)])}renderFeatureChanged(){this.view.qualitySettings.antialiasingEnabled||this._context?.isFeatureEnabled(d.Antialiasing)?this.enable():this.disable()}uninitializeRenderContext(){this.disable(),this._context=null}enable(){if(this._isEnabled||!this._context||this._abortController)return;this._abortController=new AbortController;const e=this._abortController.signal;import("./SmaaRenderPassData.js").then((t=>this._loadTextures(this._context,t,e))).then((()=>{this._context?.requestRender(),this._abortController=null})).catch((e=>{o(e)||this._dispose()}))}_loadTextures(e,t,r){return i(r),e?Promise.all([p(t.areaTexture).then((t=>R(e.fbos.rctx,b.LINEAR,_.RGB,t))),p(t.searchTexure).then((t=>R(e.fbos.rctx,b.NEAREST,_.LUMINANCE,t)))]).then((([e,t])=>{n(r)?(e.dispose(),t.dispose(),i(r)):(this._areaTexture=e,this._searchTexture=t,this._isEnabled=!0)})):Promise.reject()}disable(){this._abortController=r(this._abortController),this._dispose()}_dispose(){this._areaTexture=s(this._areaTexture),this._searchTexture=s(this._searchTexture),this._isEnabled=!1}render(e){if(!this._isEnabled||!this._context)return;const t=e.offscreenRenderingHelper.colorTexture,r=t.descriptor.width,s=t.descriptor.height,o=this._context.fbos,i=e.bindParameters.output,n=this._context.fbos.rctx;n.setViewport(0,0,r,s);const a=o.acquire(u.RG,r,s);n.bindFramebuffer(a.fbo),n.setClearColor(0,0,0,1),n.clear(x.COLOR_BUFFER_BIT),e.offscreenRenderingHelper.compositingHelper.compositeSMAAEdgeDetect(t);const l=o.acquire(u.RGBA,r,s);n.bindFramebuffer(l.fbo),n.setClearColor(0,0,1,1),n.clear(x.COLOR_BUFFER_BIT),e.offscreenRenderingHelper.compositingHelper.compositeSMAABlendWeights(a.colorTexture,this._areaTexture,this._searchTexture),n.bindFramebuffer(i),a.release(),n.setClearColor(0,1,0,1),n.clear(x.COLOR_BUFFER_BIT),e.offscreenRenderingHelper.compositingHelper.compositeSMAABlur(l.colorTexture),l.release()}};function R(e,t,r,s){const o=new T;return o.pixelFormat=r,o.wrapMode=f.CLAMP_TO_EDGE,o.width=s.width,o.height=s.height,o.samplingMode=t,new g(e,o,s)}e([c({constructOnly:!0})],C.prototype,"view",void 0),e([c()],C.prototype,"_context",void 0),e([c()],C.prototype,"_abortController",void 0),e([c({readOnly:!0})],C.prototype,"updating",null),C=e([h("esri.views.3d.webgl-engine.lib.SmaaRenderPass")],C);export{C as SmaaRenderPass};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../core/
|
|
5
|
+
import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";export{b as build}from"../../../../chunks/BlendWeights.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../core/
|
|
5
|
+
import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";export{b as build}from"../../../../chunks/Blur.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../core/
|
|
5
|
+
import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";export{b as build}from"../../../../chunks/EdgeDetect.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{NoParameters as e}from"../core/shaderModules/interfaces.js";class s extends e{}export{s as SMAAPassParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Graphic.js";import{createTask as t}from"../../core/asyncUtils.js";import"../../core/has.js";import{handlesGroup as i,makeHandle as r}from"../../core/handleUtils.js";import{clone as n}from"../../core/lang.js";import{throwIfAborted as a,whenOrAbort as s}from"../../core/promiseUtils.js";import{watch as l,whenOnce as o}from"../../core/reactiveUtils.js";import{px2pt as c}from"../../core/screenUtils.js";import{diff as u}from"../../core/accessorSupport/diffUtils.js";import{getDisplayFieldName as p}from"../../layers/support/fieldUtils.js";import{calculateTolerance as y}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as d}from"../../renderers/support/lengthUtils.js";import{getTransformationType as f,TransformationType as m}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{getRotationAngle as h,getSize as g}from"../../renderers/visualVariables/support/visualVariableUtils.js";import{sceneLayerEditingEnabled as b,i3sPatchingEnabled as w}from"../../support/featureFlags.js";import{to3D as v}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as S}from"../../symbols/support/symbolUtils.js";import{GraphicState as j}from"../../views/3d/layers/graphics/GraphicState.js";import{createQueryGeometry as I}from"../../views/support/drapedUtils.js";import{hitTestSelectSimilarDistance as U,filterGraphicHits as V}from"../../views/support/hitTestSelectUtils.js";function F(e){const t=e.sourceLayer;if(!t||"feature"!==t.type||!E(t.renderer))return{rotation:null,size:null};let i=null,r=null;const n=t.renderer.getVisualVariablesForType("rotation").filter((t=>(!t.axis||"heading"===t.axis)&&t.field&&!t.valueExpression&&null!=h(t,e)));1===n.length&&(i=L(n[0],t));const a=t.renderer.getVisualVariablesForType("size").filter((t=>t.field&&!t.useSymbolValue&&!t.valueExpression&&f(t)===m.RealWorldSize&&null!=g(t,e)));return 1===a.length&&(r=x(a[0],t)),{rotation:i,size:r}}function L(e,t){const i="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,r=e.field,n=t.fields&&t.fields.filter((e=>e.name===r)),a=n&&1===n.length?n[0].type:"double",s={initial:0,current:0};return{field:r,fieldType:a,getDefault:()=>Promise.resolve(0),getValue:e=>(s.current=s.initial-i*e,k((s.current+360)%360,a)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function T(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function z(e,t,i){if(null==t)return 0;const{symbol:r}=v(t);if(null==r||"web-style"===r.type||"cim"===r.type)return 0;const n=r.symbolLayers.at(0);if(!n)return 0;switch(n.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return n.size||Math.min(Y.icon,(await e(n,Y.icon))[0])||Y.icon}case"text":return n.size||Y.text;case"line":return n.size||Y.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return T(await t(n,e.scale/Y.viewScaleSizeFactor),i)}case"path":return(null!=n.width?n.width:n.height)||e.scale/Y.viewScaleSizeFactor;case"extrude":return n.size||e.scale/Y.viewScaleSizeFactor;default:return 0}}function x(e,t){const i=e.field,r=e.axis,n=t.fields&&t.fields.filter((e=>e.name===i)),a=n&&1===n.length?n[0].type:"double",s={updating:!1,initial:0,current:0},l=d[e.valueUnit]??1;let o;return o="area"===e.valueRepresentation?e=>(e*l/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*l/2:e=>e*l,{field:i,fieldType:a,getDefault:async(e,t)=>k(o(await z(t,e,r)),a),getValue:(e,t)=>(s.initial||(s.initial=t.pixelSizeAt(t.center)),s.current=s.initial*e,k(s.current,a)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1,displayUnit:ie(e.valueUnit),axis:e.axis}}function k(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function E(e){switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function O(e,t){const i=await S(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t});null!=u(e.symbol,i)&&(e.symbol=i)}function A(e){if(!e)throw new Error("no geometry type");return"multipatch"===e?"mesh":e}async function M(e,t,n,a){await C(e,t,a);const s=e.on("create",(async i=>{if("cancel"===i.state)return C(e,t,a);if("complete"===i.state){const e=i.graphic;e.sourceLayer||(e.sourceLayer=t.layer),e.attributes||(e.attributes={...t.template?.prototype.attributes}),await O(e,a),n(e)}}));return i([s,r((()=>e.cancel()))])}async function C(e,t,i){const r=t.layer,n={...t.template?.prototype.attributes};await G(e,r,n,i),e.layer.elevationInfo=r.elevationInfo,await e.create(A(r.geometryType),{graphicProperties:{attributes:n,sourceLayer:r},hasZ:r.capabilities.data.supportsZ,geometryToPlace:t.geometryToPlace??void 0})}async function G(t,i,r,n){const a=new e({sourceLayer:i,attributes:r}),{rotation:s,size:l}=F(a);let o=await S(a,{useSourceLayer:!0,webStyleCache:n}),c=!1;for(const e of[l,s]){if(null==e)continue;null==r[e.field]&&(r[e.field]=await e.getDefault(o,t.view),c=!0)}switch(c&&(o=await S(a,{useSourceLayer:!0,webStyleCache:n})),o?.type){case"simple-fill":case"polygon-3d":t.polygonSymbol=o;break;case"simple-line":case"line-3d":t.polylineSymbol=o;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":t.pointSymbol=o}P(t.tooltipOptions,l,s)}function P(e,t,i){e.visualVariables=null!=t||null!=i?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=i?{valueType:i.fieldType,rotationType:i.rotationType??"geographic"}:null}:null}function R(e,t){return e?e.find((e=>e.layer===t)):void 0}async function D(e,t,i,r){if(0===e.length)return[];const{updatable:n,graphicsByLayer:a}=await i.async((async()=>{const{results:n}=await s(U(t,i),r),a=new Map,l=e=>{const t=e.layer,i=a.get(t);if(!i){const e=new Array;return a.set(t,e),e}return i};V(n).forEach((({graphic:e})=>l(e).push(e)));const o=e.filter((({supports:e,layer:t})=>e.includes("update")&&a.has(t)));return 0!==o.length&&i.stopPropagation(),{updatable:o,graphicsByLayer:a}}));return s(Promise.allSettled(n.map((async({layer:e})=>{const{objectIdField:t}=e,i="displayField"in e?e.displayField:null,n=[t];null!=i&&e.fieldsIndex.has(i)&&n.push(i);const s=a.get(e);if(!!s.some((e=>n.some((t=>!(t in e.attributes)))))){const t=e.createQuery();return t.outFields=n,t.returnGeometry=!1,t.objectIds=s.map((e=>e.getObjectId())),e.queryFeatures(t,{signal:r}).then((({features:e})=>e))}return s}))),r)}async function q(e,t,i,r){if(0===e.length)return[];let n=null;const a=await i.async((async()=>{const{results:a}=await s(t.hitTest(i),r);if(0===a.length)return[];const l=new Set;n=V(a),n.forEach((({graphic:e})=>e&&l.add(e.layer)));const o=e.items.filter((({layer:e,supports:t,attachmentsOnUpdateEnabled:i})=>l.has(e)&&(t.includes("update")||t.includes("delete")||i)));return o.length>0&&i.stopPropagation(),o}));return s(Promise.allSettled(a.map((({layer:e})=>{const a=e.objectIdField,s="displayField"in e?e.displayField:null,l=p({displayField:s,fields:e.fields}),o=[a];null!=l&&e.fieldsIndex.has(l)&&o.push(l);const c=e.createQuery();c.outFields=o,c.returnGeometry=!1;const u="renderer"in e?y({renderer:e.renderer,event:i}):0;return c.geometry=I(i.mapPoint,u,t),c.outSpatialReference=t.spatialReference,e.queryFeatures(c,{signal:r}).then((({features:t})=>(n?.forEach((({graphic:i})=>{i.layer!==e||t.some((e=>e.getObjectId()===i.getObjectId()))||t.push(i)})),t)))}))),r)}async function Z(e,t,i,r){switch(t.type){case"3d":return D(e,t,i,r);case"2d":return q(e,t,i,r)}}async function Q(e,t,i){const{sourceLayer:r}=e,n=r.createQuery();n.objectIds=[e.getAttribute(r.objectIdField)],n.outFields=["*"],n.outSpatialReference=t,n.returnM=r.capabilities.data.supportsM,n.returnZ=r.capabilities.data.supportsZ,b()&&w()&&"scene"===r.type&&null!=r.infoFor3D&&(n.returnGeometry=!0,n.formatOf3DObjects="3D_glb");const s=await r.queryFeatures(n,{signal:i});a(i);return s.features[0]}async function B(e){const{graphic:t,sketchViewModel:i,sourceLayer:r,visualVariables:n,webStyleCache:a}=e;let s=!1;const{rotation:l,size:o}=n;[l,o].forEach((async e=>{if(null==e)return;const r=t.getAttribute(e.field);if(null!=r)e.initValue(r);else{const r=await e.getDefault(t.symbol,i.view);e.initValue(r),t.setAttribute(e.field,r),s=!0}})),s&&await O(t,a);const c={multipleSelectionEnabled:!1};return"point"===r.geometryType&&(c.enableRotation=null!=l,c.enableScaling=null!=o),P(i.tooltipOptions,o,l),i.layer.elevationInfo=r.elevationInfo,i.update(t,c)}function W(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function _(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}async function H(e,t,i,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return;const a=r.rotation,s=W(i.toolEventInfo);if(null!=a&&null!=s)if("rotate-stop"===s.type)a.isUpdatingInteractively=!1,a.initValue();else{a.isUpdatingInteractively=!0;const{field:i,getValue:r}=a;t.setAttribute(i,r(s.angle,e))}const l=r.size,o=_(i.toolEventInfo);if(null!=l&&null!=o)if("scale-stop"===o.type)l.isUpdatingInteractively=!1,l.initValue();else{l.isUpdatingInteractively=!0;const{field:i,getValue:r}=l;t.setAttribute(i,r(o.xScale,e))}await O(t,n)}async function J(e,t,n,a,s,o){const c=ue(e);await O(c,o),a.map.add(n.layer),n.layer.add(c);const u=e.sourceLayer,p=se(a,u);await X(a,c),await B({graphic:c,sketchViewModel:n,sourceLayer:u,visualVariables:t,webStyleCache:o});const y=K(n,e,c);let d=null;p.then((e=>d=e)).catch((()=>{}));const f=t.size,m=t.rotation,h=l((()=>e.attributes),(async e=>{let t=!1;for(const i in e){const r=e[i];r!==c.getAttribute(i)&&(c.setAttribute(i,r),null==f||f.isUpdatingInteractively||f.field!==i||f.initValue(r),null==m||m.isUpdatingInteractively||m.field!==i||m.initValue(r),(null==d||d.requiredFields.includes(i))&&(t=!0))}t&&await O(c,o)})),g=n.on("update",(async e=>{const i=e.graphics[0];if("complete"===e.state)return B({graphic:i,sketchViewModel:n,sourceLayer:u,visualVariables:t,webStyleCache:o});await H(a,i,e,t,o),s(ue(i),e)})),b=n.on(["undo","redo"],(async e=>{s(ue(e.graphics[0]),e)})),w=n.updateOnGraphicClick;return{visual:i([y,r((()=>{n.updateOnGraphicClick=w}))]),interactive:i([b,g,r((()=>n.cancel())),h,r((()=>{n.updateOnGraphicClick=!1}))])}}function K(e,n,s){const l=e.view,c=n.sourceLayer,u=n.layer,p=n.getAttribute(u.objectIdField);let y=null;function d(e){y?.abort(),y=t((async t=>{const i=await se(l,c);a(t),i.setVisibility?.(p,e)}))}return d(!1),i([N(l,s,(e=>d(!e))),r((async()=>{d(!0);try{const e=await se(l,c);await o((()=>!e.updating))}finally{e.layer.remove(s)}}))])}function N(e,t,r){if("3d"===e.type){const n=new j({graphic:t});return i([e.trackGraphicState(n),l((()=>n.displaying),r)])}return l((()=>t.visible),r)}async function X(e,t){if("3d"===e.type){const i=new j({graphic:t}),r=e.trackGraphicState(i);await o((()=>i.displaying)),r.remove()}else await o((()=>t.visible))}const Y={icon:c(24),text:c(12),line:c(1),viewScaleSizeFactor:100};function $(e,t,i){let r=!1;return e.filter((e=>!!r||(r=e===t,r))).map((e=>i[e]()))}function ee(e){if(1!==e.length)return null;const t=e[0];if("items"in t){const e=t;return 1===e.items.length?e.items[0]:null}return t}function te(e,t){if(e.viewModel.refreshCreationTemplates(),"awaiting-feature-creation-info"===t[0].id){const i=ee(e.viewModel.featureTemplatesViewModel.items);null==i||i.supportsUpload||(e.creationInfo=i,t.shift())}return t}function ie(e){switch(e){case"unknown":case"decimal-degrees":return null;default:return e}}function re(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}function ne(e){const{creationInfo:t,viewModel:i}=e;if(!t)return!1;const{layer:r}=t,n=i.editableItems.find((e=>e.layer===r));if(n)return n.attachmentsOnCreateEnabled;const a=r.capabilities?.data,s=i.layerInfos?.find((e=>e.layer===r));return!(!(a&&"supportsAttachment"in a&&a.supportsAttachment)||s&&(!1===s.allowAttachments||!1===s.attachmentsOnUpdateEnabled))}const ae=e=>/-stop/.test(e)||/vertex-/.test(e),se=(e,t)=>{const i="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(i)};function le(e){return"createInteractiveEditSession"in e}const oe=Symbol();function ce(e){return e&&"object"==typeof e&&oe in e}function ue(e){const t=e.geometry;if("mesh"===t?.type){const i=e.cloneShallow();return i.attributes=n(e.attributes),i.geometry=t.cloneShallow(),i.geometry.transform=t.transform?.clone()??null,i}return e.clone()}function pe(e){const t=e.cursor;return e.cursor="progress",r((()=>e.cursor=t))}export{oe as UsesSketchViewModelSymbol,te as avoidFeatureTemplateSelectionWithOnlyOneItem,le as canCreateInteractiveEditSession,ue as cloneGraphicExceptMesh,$ as createWorkflowSteps,Z as fetchCandidates,Q as fetchFullFeature,R as findLayerInfo,F as getVisualVariableAttributes,ae as isTerminalUpdateEventType,re as prepareAttachmentsForCreateWorkflow,M as setUpFeatureAdd,J as setUpGeometryUpdate,ne as shouldShowAttachmentsForCreateWorkflow,pe as showProgressCursor,Y as sizeDefaults,ie as sizeVariableUnitToLengthUnit,C as startCreatingNewFeature,B as startUpdatingFeature,O as updateGraphicSymbolWhenRequired,H as visualVariableInteractiveUpdate,se as whenEditorLayerView,X as whenGraphicDisplayed,ce as workflowUsesSketchViewModel};
|
|
5
|
+
import e from"../../Graphic.js";import{createTask as t}from"../../core/asyncUtils.js";import"../../core/has.js";import{handlesGroup as r,makeHandle as i}from"../../core/handleUtils.js";import{clone as n}from"../../core/lang.js";import{throwIfAborted as a,whenOrAbort as s}from"../../core/promiseUtils.js";import{watch as l,whenOnce as o}from"../../core/reactiveUtils.js";import{px2pt as c}from"../../core/screenUtils.js";import{diff as u}from"../../core/accessorSupport/diffUtils.js";import{getDisplayFieldName as p}from"../../layers/support/fieldUtils.js";import{calculateTolerance as y}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as d}from"../../renderers/support/lengthUtils.js";import{getTransformationType as f,TransformationType as m}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{getRotationAngle as h,getSize as g}from"../../renderers/visualVariables/support/visualVariableUtils.js";import{sceneLayerEditingEnabled as b,i3sPatchingEnabled as w}from"../../support/featureFlags.js";import{to3D as v}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as S}from"../../symbols/support/symbolUtils.js";import{GraphicState as j}from"../../views/3d/layers/graphics/GraphicState.js";import{createQueryGeometry as I}from"../../views/support/drapedUtils.js";import{hitTestSelectSimilarDistance as U,filterGraphicHits as V}from"../../views/support/hitTestSelectUtils.js";function F(e){const t=e.sourceLayer;if(!t||"feature"!==t.type||!E(t.renderer))return{rotation:null,size:null};let r=null,i=null;const n=t.renderer.getVisualVariablesForType("rotation").filter((t=>(!t.axis||"heading"===t.axis)&&t.field&&!t.valueExpression&&null!=h(t,e)));1===n.length&&(r=L(n[0],t));const a=t.renderer.getVisualVariablesForType("size").filter((t=>t.field&&!t.useSymbolValue&&!t.valueExpression&&f(t)===m.RealWorldSize&&null!=g(t,e)));return 1===a.length&&(i=x(a[0],t)),{rotation:r,size:i}}function L(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,i=e.field,n=t.fields&&t.fields.filter((e=>e.name===i)),a=n&&1===n.length?n[0].type:"double",s={initial:0,current:0};return{field:i,fieldType:a,getDefault:()=>Promise.resolve(0),getValue:e=>(s.current=s.initial-r*e,k((s.current+360)%360,a)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function T(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function z(e,t,r){if(null==t)return 0;const{symbol:i}=v(t);if(null==i||"web-style"===i.type||"cim"===i.type)return 0;const n=i.symbolLayers.at(0);if(!n)return 0;switch(n.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return n.size||Math.min(Y.icon,(await e(n,Y.icon))[0])||Y.icon}case"text":return n.size||Y.text;case"line":return n.size||Y.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return T(await t(n,e.scale/Y.viewScaleSizeFactor),r)}case"path":return(null!=n.width?n.width:n.height)||e.scale/Y.viewScaleSizeFactor;case"extrude":return n.size||e.scale/Y.viewScaleSizeFactor;default:return 0}}function x(e,t){const r=e.field,i=e.axis,n=t.fields&&t.fields.filter((e=>e.name===r)),a=n&&1===n.length?n[0].type:"double",s={updating:!1,initial:0,current:0},l=d[e.valueUnit]??1;let o;return o="area"===e.valueRepresentation?e=>(e*l/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*l/2:e=>e*l,{field:r,fieldType:a,getDefault:async(e,t)=>k(o(await z(t,e,i)),a),getValue:(e,t)=>(s.initial||(s.initial=t.pixelSizeAt(t.center)),s.current=s.initial*e,k(s.current,a)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1,displayUnit:re(e.valueUnit),axis:e.axis}}function k(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function E(e){switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function O(e,t){const r=await S(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t});null!=u(e.symbol,r)&&(e.symbol=r)}function A(e){if(!e)throw new Error("no geometry type");return"multipatch"===e?"mesh":e}async function M(e,t,n,a){await C(e,t,a);const s=e.on("create",(async r=>{if("cancel"===r.state)return C(e,t,a);if("complete"===r.state){const e=r.graphic;e.sourceLayer||(e.sourceLayer=t.layer),e.attributes||(e.attributes={...t.template?.prototype.attributes}),await O(e,a),n(e)}}));return r([s,i((()=>e.cancel()))])}async function C(e,t,r){const i=t.layer,n={...t.template?.prototype.attributes};await G(e,i,n,r),e.layer.elevationInfo=i.elevationInfo,await e.create(A(i.geometryType),{graphicProperties:{attributes:n,sourceLayer:i},hasZ:i.capabilities.data.supportsZ,geometryToPlace:t.geometryToPlace??void 0})}async function G(t,r,i,n){const a=new e({sourceLayer:r,attributes:i}),{rotation:s,size:l}=F(a);let o=await S(a,{useSourceLayer:!0,webStyleCache:n}),c=!1;for(const e of[l,s]){if(null==e)continue;null==i[e.field]&&(i[e.field]=await e.getDefault(o,t.view),c=!0)}switch(c&&(o=await S(a,{useSourceLayer:!0,webStyleCache:n})),o?.type){case"simple-fill":case"polygon-3d":t.polygonSymbol=o;break;case"simple-line":case"line-3d":t.polylineSymbol=o;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":t.pointSymbol=o;break;case"mesh-3d":t.meshSymbol=o}P(t.tooltipOptions,l,s)}function P(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function R(e,t){return e?e.find((e=>e.layer===t)):void 0}async function D(e,t,r,i){if(0===e.length)return[];const{updatable:n,graphicsByLayer:a}=await r.async((async()=>{const{results:n}=await s(U(t,r),i),a=new Map,l=e=>{const t=e.layer,r=a.get(t);if(!r){const e=new Array;return a.set(t,e),e}return r};V(n).forEach((({graphic:e})=>l(e).push(e)));const o=e.filter((({supports:e,layer:t})=>e.includes("update")&&a.has(t)));return 0!==o.length&&r.stopPropagation(),{updatable:o,graphicsByLayer:a}}));return s(Promise.allSettled(n.map((async({layer:e})=>{const{objectIdField:t}=e,r="displayField"in e?e.displayField:null,n=[t];null!=r&&e.fieldsIndex.has(r)&&n.push(r);const s=a.get(e);if(!!s.some((e=>n.some((t=>!(t in e.attributes)))))){const t=e.createQuery();return t.outFields=n,t.returnGeometry=!1,t.objectIds=s.map((e=>e.getObjectId())),e.queryFeatures(t,{signal:i}).then((({features:e})=>e))}return s}))),i)}async function q(e,t,r,i){if(0===e.length)return[];let n=null;const a=await r.async((async()=>{const{results:a}=await s(t.hitTest(r),i);if(0===a.length)return[];const l=new Set;n=V(a),n.forEach((({graphic:e})=>e&&l.add(e.layer)));const o=e.items.filter((({layer:e,supports:t,attachmentsOnUpdateEnabled:r})=>l.has(e)&&(t.includes("update")||t.includes("delete")||r)));return o.length>0&&r.stopPropagation(),o}));return s(Promise.allSettled(a.map((({layer:e})=>{const a=e.objectIdField,s="displayField"in e?e.displayField:null,l=p({displayField:s,fields:e.fields}),o=[a];null!=l&&e.fieldsIndex.has(l)&&o.push(l);const c=e.createQuery();c.outFields=o,c.returnGeometry=!1;const u="renderer"in e?y({renderer:e.renderer,event:r}):0;return c.geometry=I(r.mapPoint,u,t),c.outSpatialReference=t.spatialReference,e.queryFeatures(c,{signal:i}).then((({features:t})=>(n?.forEach((({graphic:r})=>{r.layer!==e||t.some((e=>e.getObjectId()===r.getObjectId()))||t.push(r)})),t)))}))),i)}async function Z(e,t,r,i){switch(t.type){case"3d":return D(e,t,r,i);case"2d":return q(e,t,r,i)}}async function Q(e,t,r){const{sourceLayer:i}=e,n=i.createQuery();n.objectIds=[e.getAttribute(i.objectIdField)],n.outFields=["*"],n.outSpatialReference=t,n.returnM=i.capabilities.data.supportsM,n.returnZ=i.capabilities.data.supportsZ,b()&&w()&&"scene"===i.type&&null!=i.infoFor3D&&(n.returnGeometry=!0,n.formatOf3DObjects="3D_glb");const s=await i.queryFeatures(n,{signal:r});a(r);return s.features[0]}async function B(e){const{graphic:t,sketchViewModel:r,sourceLayer:i,visualVariables:n,webStyleCache:a}=e;let s=!1;const{rotation:l,size:o}=n;[l,o].forEach((async e=>{if(null==e)return;const i=t.getAttribute(e.field);if(null!=i)e.initValue(i);else{const i=await e.getDefault(t.symbol,r.view);e.initValue(i),t.setAttribute(e.field,i),s=!0}})),s&&await O(t,a);const c={multipleSelectionEnabled:!1};return"point"===i.geometryType&&(c.enableRotation=null!=l,c.enableScaling=null!=o),P(r.tooltipOptions,o,l),r.layer.elevationInfo=i.elevationInfo,r.update(t,c)}function W(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function _(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}async function H(e,t,r,i,n){if(null==t.geometry||"point"!==t.geometry?.type)return;const a=i.rotation,s=W(r.toolEventInfo);if(null!=a&&null!=s)if("rotate-stop"===s.type)a.isUpdatingInteractively=!1,a.initValue();else{a.isUpdatingInteractively=!0;const{field:r,getValue:i}=a;t.setAttribute(r,i(s.angle,e))}const l=i.size,o=_(r.toolEventInfo);if(null!=l&&null!=o)if("scale-stop"===o.type)l.isUpdatingInteractively=!1,l.initValue();else{l.isUpdatingInteractively=!0;const{field:r,getValue:i}=l;t.setAttribute(r,i(o.xScale,e))}await O(t,n)}async function J(e,t,n,a,s,o){const c=ue(e);await O(c,o),a.map.add(n.layer),n.layer.add(c);const u=e.sourceLayer,p=se(a,u);await X(a,c),await B({graphic:c,sketchViewModel:n,sourceLayer:u,visualVariables:t,webStyleCache:o});const y=K(n,e,c);let d=null;p.then((e=>d=e)).catch((()=>{}));const f=t.size,m=t.rotation,h=l((()=>e.attributes),(async e=>{let t=!1;for(const r in e){const i=e[r];i!==c.getAttribute(r)&&(c.setAttribute(r,i),null==f||f.isUpdatingInteractively||f.field!==r||f.initValue(i),null==m||m.isUpdatingInteractively||m.field!==r||m.initValue(i),(null==d||d.requiredFields.includes(r))&&(t=!0))}t&&await O(c,o)})),g=n.on("update",(async e=>{const r=e.graphics[0];if("complete"===e.state)return B({graphic:r,sketchViewModel:n,sourceLayer:u,visualVariables:t,webStyleCache:o});await H(a,r,e,t,o),s(ue(r),e)})),b=n.on(["undo","redo"],(async e=>{s(ue(e.graphics[0]),e)})),w=n.updateOnGraphicClick;return{visual:r([y,i((()=>{n.updateOnGraphicClick=w}))]),interactive:r([b,g,i((()=>n.cancel())),h,i((()=>{n.updateOnGraphicClick=!1}))])}}function K(e,n,s){const l=e.view,c=n.sourceLayer,u=n.layer,p=n.getAttribute(u.objectIdField);let y=null;function d(e){y?.abort(),y=t((async t=>{const r=await se(l,c);a(t),r.setVisibility?.(p,e)}))}return d(!1),r([N(l,s,(e=>d(!e))),i((async()=>{d(!0);try{const e=await se(l,c);await o((()=>!e.updating))}finally{e.layer.remove(s)}}))])}function N(e,t,i){if("3d"===e.type){const n=new j({graphic:t});return r([e.trackGraphicState(n),l((()=>n.displaying),i)])}return l((()=>t.visible),i)}async function X(e,t){if("3d"===e.type){const r=new j({graphic:t}),i=e.trackGraphicState(r);await o((()=>r.displaying)),i.remove()}else await o((()=>t.visible))}const Y={icon:c(24),text:c(12),line:c(1),viewScaleSizeFactor:100};function $(e,t,r){let i=!1;return e.filter((e=>!!i||(i=e===t,i))).map((e=>r[e]()))}function ee(e){if(1!==e.length)return null;const t=e[0];if("items"in t){const e=t;return 1===e.items.length?e.items[0]:null}return t}function te(e,t){if(e.viewModel.refreshCreationTemplates(),"awaiting-feature-creation-info"===t[0].id){const r=ee(e.viewModel.featureTemplatesViewModel.items);null==r||r.supportsUpload||(e.creationInfo=r,t.shift())}return t}function re(e){switch(e){case"unknown":case"decimal-degrees":return null;default:return e}}function ie(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}function ne(e){const{creationInfo:t,viewModel:r}=e;if(!t)return!1;const{layer:i}=t,n=r.editableItems.find((e=>e.layer===i));if(n)return n.attachmentsOnCreateEnabled;const a=i.capabilities?.data,s=r.layerInfos?.find((e=>e.layer===i));return!(!(a&&"supportsAttachment"in a&&a.supportsAttachment)||s&&(!1===s.allowAttachments||!1===s.attachmentsOnUpdateEnabled))}const ae=e=>/-stop/.test(e)||/vertex-/.test(e),se=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function le(e){return"createInteractiveEditSession"in e}const oe=Symbol();function ce(e){return e&&"object"==typeof e&&oe in e}function ue(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=n(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function pe(e){const t=e.cursor;return e.cursor="progress",i((()=>e.cursor=t))}export{oe as UsesSketchViewModelSymbol,te as avoidFeatureTemplateSelectionWithOnlyOneItem,le as canCreateInteractiveEditSession,ue as cloneGraphicExceptMesh,$ as createWorkflowSteps,Z as fetchCandidates,Q as fetchFullFeature,R as findLayerInfo,F as getVisualVariableAttributes,ae as isTerminalUpdateEventType,ie as prepareAttachmentsForCreateWorkflow,M as setUpFeatureAdd,J as setUpGeometryUpdate,ne as shouldShowAttachmentsForCreateWorkflow,pe as showProgressCursor,Y as sizeDefaults,re as sizeVariableUnitToLengthUnit,C as startCreatingNewFeature,B as startUpdatingFeature,O as updateGraphicSymbolWhenRequired,H as visualVariableInteractiveUpdate,se as whenEditorLayerView,X as whenGraphicDisplayed,ce as workflowUsesSketchViewModel};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const e="esri-feature",t={iconText:"esri-icon-font-fallback-text",iconLoading:"esri-icon-loading-indicator esri-rotating",esriTable:"esri-widget__table",esriWidget:"esri-widget",base:e,container:`${e}__size-container`,title:`${e}__title`,main:`${e}__main-container`,btn:`${e}__button`,icon:`${e}__icon`,content:`${e}__content`,contentNode:`${e}__content-node`,contentElement:`${e}__content-element`,text:`${e}__text`,lastEditedInfo:`${e}__last-edited-info`,fields:`${e}__fields`,fieldHeader:`${e}__field-header`,fieldData:`${e}__field-data`,fieldDataDate:`${e}__field-data--date`,loadingSpinnerContainer:`${e}__loading-container`,spinner:`${e}__loading-spinner`};export{t as CSS};
|
|
5
|
+
const e="esri-feature",t={iconText:"esri-icon-font-fallback-text",iconLoading:"esri-icon-loading-indicator esri-rotating",esriTable:"esri-widget__table",esriWidget:"esri-widget",base:e,container:`${e}__size-container`,title:`${e}__title`,main:`${e}__main-container`,btn:`${e}__button`,icon:`${e}__icon`,content:`${e}__content`,contentNode:`${e}__content-node`,contentNodeText:`${e}__content-node--text`,contentElement:`${e}__content-element`,text:`${e}__text`,lastEditedInfo:`${e}__last-edited-info`,fields:`${e}__fields`,fieldHeader:`${e}__field-header`,fieldData:`${e}__field-data`,fieldDataDate:`${e}__field-data--date`,loadingSpinnerContainer:`${e}__loading-container`,spinner:`${e}__loading-spinner`};export{t as CSS};
|
package/widgets/Feature.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{watch as t,on as s,initial as i}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import l from"./Widget.js";import d from"./Feature/FeatureAttachments.js";import a from"./Feature/FeatureContent.js";import c from"./Feature/FeatureExpression.js";import p from"./Feature/FeatureFields.js";import u from"./Feature/FeatureMedia.js";import h from"./Feature/FeatureRelationship.js";import m from"./Feature/FeatureViewModel.js";import{CSS as v}from"./Feature/resources.js";import{FeatureContentMixin as y}from"./Feature/support/FeatureContentMixin.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{Heading as w}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{tsx as M}from"./support/jsxFactory.js";import{substitute as E}from"../intl/substitute.js";var b;const _={title:!0,content:!0,lastEditedInfo:!0},W="relationship-handles";let j=b=class extends(y(l)){constructor(e,t){super(e,t),this._contentWidgets=[],this.flowItems=null,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.visibleElements={..._},this.viewModel=new m}initialize(){this.addHandles(t((()=>this.viewModel?.contentViewModels),(()=>this._setupContentWidgets()),i))}loadDependencies(){return g({notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js")})}destroy(){this._destroyContentWidgets()}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(e){this.viewModel.defaultPopupTemplateEnabled=e}get isTable(){return this.viewModel.isTable}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get title(){return this.viewModel.title}castVisibleElements(e){return{..._,...e}}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{state:e}=this.viewModel,t=M("div",{class:v.container,key:"container"},this.renderTitle(),"error"===e?this.renderError():"loading"===e?this.renderLoading():this.renderContentContainer());return M("div",{class:this.classes(v.base,v.esriWidget)},t)}setActiveMedia(e,t){return this.viewModel.setActiveMedia(e,t)}nextMedia(e){return this.viewModel.nextMedia(e)}previousMedia(e){return this.viewModel.previousMedia(e)}renderError(){const{messagesCommon:e,messages:t,visibleElements:s}=this;return M("calcite-notice",{open:!0,kind:"danger",icon:"exclamation-mark-circle",scale:"s"},s.title?M("div",{key:"error-title",slot:"title"},e.errorMessage):null,M("div",{key:"error-message",slot:"message"},t.loadingError))}renderLoading(){return M("div",{key:"loading-container",class:v.loadingSpinnerContainer},M("span",{class:this.classes(v.iconLoading,v.spinner)}))}renderContentContainer(){const{visibleElements:e}=this;return e.content?M("div",{class:v.main},[this.renderContent(),this.renderLastEditInfo()]):null}renderTitle(){const{visibleElements:e,title:t}=this;return e.title?M(w,{level:this.headingLevel,class:v.title,innerHTML:t}):null}renderContent(){const e=this.viewModel.content,t="content";if(!e)return null;if(Array.isArray(e))return e.length?M("div",{class:v.contentNode,key:`${t}-content-elements`},e.map(this.renderContentElement,this)):null;if("string"==typeof e){const e=this._contentWidgets[0];return!e||e.destroyed?null:M("div",{class:v.contentNode,key:`${t}-content`},e.render())}return this.renderNodeContent(e)}renderContentElement(e,t){const{visibleElements:s}=this;if("boolean"!=typeof s.content&&!s.content?.[e.type])return null;switch(e.type){case"attachments":return this.renderAttachments(t);case"custom":return this.renderCustom(e,t);case"fields":return this.renderFields(t);case"media":return this.renderMedia(t);case"text":return this.renderText(e,t);case"expression":return this.renderExpression(t);case"relationship":return this.renderRelationship(t);default:return null}}renderAttachments(e){const t=this._contentWidgets[e];if(!t||t.destroyed)return null;const{state:s,attachmentInfos:i}=t.viewModel;return"loading"===s||i.length>0?M("div",{key:this._buildKey("attachments-element",e),class:this.classes(v.contentElement)},t.render()):null}renderRelationship(e){const t=this._contentWidgets[e];return t&&!t.destroyed&&this.flowItems?M("div",{key:this._buildKey("relationship-element",e),class:v.contentElement},t.render()):null}renderExpression(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:M("div",{key:this._buildKey("expression-element",e),class:v.contentElement},t.render())}renderCustom(e,t){const{creator:s}=e,i=this._contentWidgets[t];return!i||i.destroyed?null:s?M("div",{key:this._buildKey("custom-element",t),class:v.contentElement},i.render()):null}renderFields(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:M("div",{key:this._buildKey("fields-element",e),class:v.contentElement},t.render())}renderMedia(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:M("div",{key:this._buildKey("media-element",e),class:v.contentElement},t.render())}renderLastEditInfo(){const{visibleElements:e,messages:t}=this,{lastEditInfo:s}=this.viewModel;if(!s||!e.lastEditedInfo)return null;const{date:i,user:n}=s,r="edit"===s.type?n?t.lastEditedByUser:t.lastEdited:n?t.lastCreatedByUser:t.lastCreated,o=E(r,{date:i,user:n});return M("div",{key:"edit-info-element",class:this.classes(v.lastEditedInfo,v.contentElement)},o)}renderText(e,t){const s=e.text,i=this._contentWidgets[t];return!i||i.destroyed?null:s?M("div",{key:this._buildKey("text-element",t),class:this.classes(v.contentElement,v.text)},i.render()):null}_buildKey(e,...t){return`${e}__${this.viewModel?.graphic?.uid||"0"}-${t.join("-")}`}_destroyContentWidget(e){e&&(e.viewModel=null,!e.destroyed&&e.destroy())}_destroyContentWidgets(){this.removeHandles(W),this._contentWidgets.forEach((e=>this._destroyContentWidget(e))),this._contentWidgets=[]}_addFeatureRelationshipHandles(e){const{flowItems:t,visibleElements:i}=this;this.addHandles([s((()=>e),"select-record",(({featureViewModel:e})=>{t&&(e.abilities={relationshipContent:!0},t.push(new b({flowItems:t,viewModel:e,visibleElements:i})))})),s((()=>e),"show-all-records",(()=>{if(!t)return;const{viewModel:s}=e;s.showAllEnabled=!0;const i=new h({visibleElements:{title:!1,description:!1},viewModel:s});this._addFeatureRelationshipHandles(i),t.push(i)}))],W)}_setupContentWidgets(){this._destroyContentWidgets();const{headingLevel:e,visibleElements:t}=this,s=this.viewModel?.content,{contentViewModels:i}=this.viewModel;if(Array.isArray(s))s.forEach(((s,n)=>{if("attachments"===s.type&&(this._contentWidgets[n]=new d({displayType:s.displayType,headingLevel:t.title?e+1:e,viewModel:i[n]})),"fields"===s.type&&(this._contentWidgets[n]=new p({viewModel:i[n]})),"media"===s.type&&(this._contentWidgets[n]=new u({viewModel:i[n]})),"text"===s.type&&(this._contentWidgets[n]=new a({viewModel:i[n]})),"custom"===s.type&&(this._contentWidgets[n]=new a({viewModel:i[n]})),"expression"===s.type&&(this._contentWidgets[n]=new c({viewModel:i[n]})),"relationship"===s.type){const e=new h({viewModel:i[n]});this._addFeatureRelationshipHandles(e),this._contentWidgets[n]=e}}),this);else{const e=i[0];e&&!e.destroyed&&(this._contentWidgets[0]=new a({viewModel:e}))}this.scheduleRender()}};e([n()],j.prototype,"graphic",null),e([n()],j.prototype,"defaultPopupTemplateEnabled",null),e([n()],j.prototype,"flowItems",void 0),e([n()],j.prototype,"headingLevel",void 0),e([n({readOnly:!0})],j.prototype,"isTable",null),e([n()],j.prototype,"label",null),e([n(),f("esri/widgets/Feature/t9n/Feature")],j.prototype,"messages",void 0),e([n(),f("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([n(),f("esri/widgets/support/t9n/uriUtils")],j.prototype,"messagesURIUtils",void 0),e([n()],j.prototype,"spatialReference",null),e([n({readOnly:!0})],j.prototype,"title",null),e([n()],j.prototype,"visibleElements",void 0),e([r("visibleElements")],j.prototype,"castVisibleElements",null),e([n()],j.prototype,"map",null),e([n()],j.prototype,"view",null),e([n({type:m})],j.prototype,"viewModel",void 0),j=b=e([o("esri.widgets.Feature")],j);const C=j;export{C as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{watch as t,on as s,initial as i}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import l from"./Widget.js";import d from"./Feature/FeatureAttachments.js";import a from"./Feature/FeatureContent.js";import c from"./Feature/FeatureExpression.js";import p from"./Feature/FeatureFields.js";import u from"./Feature/FeatureMedia.js";import h from"./Feature/FeatureRelationship.js";import m from"./Feature/FeatureViewModel.js";import{CSS as v}from"./Feature/resources.js";import{FeatureContentMixin as y}from"./Feature/support/FeatureContentMixin.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{Heading as w}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{tsx as M}from"./support/jsxFactory.js";import{substitute as E}from"../intl/substitute.js";var b;const _={title:!0,content:!0,lastEditedInfo:!0},W="relationship-handles";let j=b=class extends(y(l)){constructor(e,t){super(e,t),this._contentWidgets=[],this.flowItems=null,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.visibleElements={..._},this.viewModel=new m}initialize(){this.addHandles(t((()=>this.viewModel?.contentViewModels),(()=>this._setupContentWidgets()),i))}loadDependencies(){return g({notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js")})}destroy(){this._destroyContentWidgets()}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(e){this.viewModel.defaultPopupTemplateEnabled=e}get isTable(){return this.viewModel.isTable}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get title(){return this.viewModel.title}castVisibleElements(e){return{..._,...e}}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{state:e}=this.viewModel,t=M("div",{class:v.container,key:"container"},this.renderTitle(),"error"===e?this.renderError():"loading"===e?this.renderLoading():this.renderContentContainer());return M("div",{class:this.classes(v.base,v.esriWidget)},t)}setActiveMedia(e,t){return this.viewModel.setActiveMedia(e,t)}nextMedia(e){return this.viewModel.nextMedia(e)}previousMedia(e){return this.viewModel.previousMedia(e)}renderError(){const{messagesCommon:e,messages:t,visibleElements:s}=this;return M("calcite-notice",{open:!0,kind:"danger",icon:"exclamation-mark-circle",scale:"s"},s.title?M("div",{key:"error-title",slot:"title"},e.errorMessage):null,M("div",{key:"error-message",slot:"message"},t.loadingError))}renderLoading(){return M("div",{key:"loading-container",class:v.loadingSpinnerContainer},M("span",{class:this.classes(v.iconLoading,v.spinner)}))}renderContentContainer(){const{visibleElements:e}=this;return e.content?M("div",{class:v.main},[this.renderContent(),this.renderLastEditInfo()]):null}renderTitle(){const{visibleElements:e,title:t}=this;return e.title?M(w,{level:this.headingLevel,class:v.title,innerHTML:t}):null}renderContent(){const e=this.viewModel.content,t="content";if(!e)return null;if(Array.isArray(e))return e.length?M("div",{class:v.contentNode,key:`${t}-content-elements`},e.map(this.renderContentElement,this)):null;if("string"==typeof e){const e=this._contentWidgets[0];return!e||e.destroyed?null:M("div",{class:this.classes(v.contentNode,v.contentNodeText),key:`${t}-content`},e.render())}return this.renderNodeContent(e)}renderContentElement(e,t){const{visibleElements:s}=this;if("boolean"!=typeof s.content&&!s.content?.[e.type])return null;switch(e.type){case"attachments":return this.renderAttachments(t);case"custom":return this.renderCustom(e,t);case"fields":return this.renderFields(t);case"media":return this.renderMedia(t);case"text":return this.renderText(e,t);case"expression":return this.renderExpression(t);case"relationship":return this.renderRelationship(t);default:return null}}renderAttachments(e){const t=this._contentWidgets[e];if(!t||t.destroyed)return null;const{state:s,attachmentInfos:i}=t.viewModel;return"loading"===s||i.length>0?M("div",{key:this._buildKey("attachments-element",e),class:this.classes(v.contentElement)},t.render()):null}renderRelationship(e){const t=this._contentWidgets[e];return t&&!t.destroyed&&this.flowItems?M("div",{key:this._buildKey("relationship-element",e),class:v.contentElement},t.render()):null}renderExpression(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:M("div",{key:this._buildKey("expression-element",e),class:v.contentElement},t.render())}renderCustom(e,t){const{creator:s}=e,i=this._contentWidgets[t];return!i||i.destroyed?null:s?M("div",{key:this._buildKey("custom-element",t),class:v.contentElement},i.render()):null}renderFields(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:M("div",{key:this._buildKey("fields-element",e),class:v.contentElement},t.render())}renderMedia(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:M("div",{key:this._buildKey("media-element",e),class:v.contentElement},t.render())}renderLastEditInfo(){const{visibleElements:e,messages:t}=this,{lastEditInfo:s}=this.viewModel;if(!s||!e.lastEditedInfo)return null;const{date:i,user:n}=s,r="edit"===s.type?n?t.lastEditedByUser:t.lastEdited:n?t.lastCreatedByUser:t.lastCreated,o=E(r,{date:i,user:n});return M("div",{key:"edit-info-element",class:this.classes(v.lastEditedInfo,v.contentElement)},o)}renderText(e,t){const s=e.text,i=this._contentWidgets[t];return!i||i.destroyed?null:s?M("div",{key:this._buildKey("text-element",t),class:this.classes(v.contentElement,v.text)},i.render()):null}_buildKey(e,...t){return`${e}__${this.viewModel?.graphic?.uid||"0"}-${t.join("-")}`}_destroyContentWidget(e){e&&(e.viewModel=null,!e.destroyed&&e.destroy())}_destroyContentWidgets(){this.removeHandles(W),this._contentWidgets.forEach((e=>this._destroyContentWidget(e))),this._contentWidgets=[]}_addFeatureRelationshipHandles(e){const{flowItems:t,visibleElements:i}=this;this.addHandles([s((()=>e),"select-record",(({featureViewModel:e})=>{t&&(e.abilities={relationshipContent:!0},t.push(new b({flowItems:t,viewModel:e,visibleElements:i})))})),s((()=>e),"show-all-records",(()=>{if(!t)return;const{viewModel:s}=e;s.showAllEnabled=!0;const i=new h({visibleElements:{title:!1,description:!1},viewModel:s});this._addFeatureRelationshipHandles(i),t.push(i)}))],W)}_setupContentWidgets(){this._destroyContentWidgets();const{headingLevel:e,visibleElements:t}=this,s=this.viewModel?.content,{contentViewModels:i}=this.viewModel;if(Array.isArray(s))s.forEach(((s,n)=>{if("attachments"===s.type&&(this._contentWidgets[n]=new d({displayType:s.displayType,headingLevel:t.title?e+1:e,viewModel:i[n]})),"fields"===s.type&&(this._contentWidgets[n]=new p({viewModel:i[n]})),"media"===s.type&&(this._contentWidgets[n]=new u({viewModel:i[n]})),"text"===s.type&&(this._contentWidgets[n]=new a({viewModel:i[n]})),"custom"===s.type&&(this._contentWidgets[n]=new a({viewModel:i[n]})),"expression"===s.type&&(this._contentWidgets[n]=new c({viewModel:i[n]})),"relationship"===s.type){const e=new h({viewModel:i[n]});this._addFeatureRelationshipHandles(e),this._contentWidgets[n]=e}}),this);else{const e=i[0];e&&!e.destroyed&&(this._contentWidgets[0]=new a({viewModel:e}))}this.scheduleRender()}};e([n()],j.prototype,"graphic",null),e([n()],j.prototype,"defaultPopupTemplateEnabled",null),e([n()],j.prototype,"flowItems",void 0),e([n()],j.prototype,"headingLevel",void 0),e([n({readOnly:!0})],j.prototype,"isTable",null),e([n()],j.prototype,"label",null),e([n(),f("esri/widgets/Feature/t9n/Feature")],j.prototype,"messages",void 0),e([n(),f("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([n(),f("esri/widgets/support/t9n/uriUtils")],j.prototype,"messagesURIUtils",void 0),e([n()],j.prototype,"spatialReference",null),e([n({readOnly:!0})],j.prototype,"title",null),e([n()],j.prototype,"visibleElements",void 0),e([r("visibleElements")],j.prototype,"castVisibleElements",null),e([n()],j.prototype,"map",null),e([n()],j.prototype,"view",null),e([n({type:m})],j.prototype,"viewModel",void 0),j=b=e([o("esri.widgets.Feature")],j);const C=j;export{C as default};
|
package/widgets/Print.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{on as i,eventKey as a}from"../core/events.js";import{clone as n}from"../core/lang.js";import s from"../core/Logger.js";import{watch as o,initial as l}from"../core/reactiveUtils.js";import{addProxy as r,hasSameOrigin as d}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{getToken as u}from"../rest/utils.js";import h from"./Widget.js";import m from"./Print/FileLink.js";import _ from"./Print/PrintViewModel.js";import b from"./Print/TemplateOptions.js";import{Heading as v}from"./support/Heading.js";import g from"./support/Popover.js";import{isActivationKey as y,keepMenuItemWithinView as f}from"./support/widgetUtils.js";import{messageBundle as T}from"./support/decorators/messageBundle.js";import{tsx as w}from"./support/jsxFactory.js";const O=t.ofType(m),x="MAP_ONLY";var C;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab"}(C||(C={}));const L="esri-print",k=`${L}__advanced-options-button`,I={base:L,headerTitle:`${L}__header-title`,inputText:`${L}__input-text`,layoutTabList:`${L}__layout-tab-list`,layoutTab:`${L}__layout-tab`,layoutSection:`${L}__layout-section`,mapOnlySection:`${L}__map-only-section`,scaleInput:`${L}__scale-input`,templateList:`${L}__template-list`,templateListScroller:`${L}__template-list-scroller`,templateListFooter:`${L}__template-list-footer`,loader:`${L}__loader`,advancedOptionsButton:k,advancedOptionsButtonContainer:`${k}-container`,advancedOptionsButtonTitle:`${k}-title`,advancedOptionsButtonIconOpened:`${k}-icon--opened`,advancedOptionsButtonIconClosed:`${k}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${k}-icon--closed-rtl`,refreshButton:`${L}__refresh-button`,swapButton:`${L}__swap-button`,linkButton:`${L}__link-button`,printButton:`${L}__export-button`,templateButton:`${L}__template-button`,formSectionContainer:`${L}__form-section-container`,advancedOptionsSection:`${L}__advanced-options-section`,advancedOptionsContainer:`${L}__advanced-options-container`,authorInfoContainer:`${L}__author-info-container`,copyrightInfoContainer:`${L}__copyright-info-container`,exportedFilesContainer:`${L}__export-panel-container`,exportedFilesTitle:`${L}__export-title`,exportedFile:`${L}__exported-file`,exportedFileLink:"esri-widget__anchor esri-print__exported-file-link",exportedFileLinkTitle:`${L}__exported-file-link-title`,heightContainer:`${L}__height-container`,legendInfoContainer:`${L}__legend-info-container`,printWidgetContainer:`${L}__container`,panelContainer:`${L}__panel-container`,scaleInfoContainer:`${L}__scale-info-container`,scaleInputContainer:`${L}__scale-input-container`,sizeContainer:`${L}__size-container`,widthContainer:`${L}__width-container`,widget:"esri-widget",panel:"esri-widget--panel",widgetButton:"esri-widget--button",button:"esri-button",buttonSecondary:"esri-button--secondary",buttonTertiary:"esri-button--tertiary",select:"esri-select",input:"esri-input",disabled:"esri-disabled",anchorDisabled:"esri-widget__anchor--disabled",buttonDisabled:"esri-button--disabled",panelError:`${L}__panel--error`,exportedFileError:`${L}__exported-file--error`,hide:"esri-hidden",rotate:"esri-rotating",anchor:"esri-widget__anchor",menu:"esri-menu",menuList:"esri-menu__list",menuItem:"esri-menu__list-item",menuItemFocus:"esri-menu__list-item--focus",menuHeader:"esri-menu__header",iconCheckMark:"esri-icon-check-mark",iconDownload:"esri-icon-download",iconLaunchLink:"esri-icon-launch-link-external",iconError:"esri-icon-error",iconPrinter:"esri-icon-printer",iconRightTriangleArrow:"esri-icon-right-triangle-arrow",iconLeftTriangleArrow:"esri-icon-left-triangle-arrow",iconDownArrow:"esri-icon-down-arrow",iconRefresh:"esri-icon-refresh",iconSpinner:"esri-icon-loading-indicator",iconSwap:"esri-icon-swap",iconLinked:"esri-icon-link-horizontal",iconUnlinked:"esri-icon-unlocked-link-horizontal",widgetIcon:"esri-icon-printer"},S="User sets an invalid layout, resetting it to the default valid one...",$="User sets an invalid format, resetting it to the default valid one...";function M(e){const t=8.3333,i=11.4583;return{width:Math.round(e*t),height:Math.round(e*i)}}function F(e){return!isNaN(e)&&e>0}function E(e){return e?.toUpperCase()===x}let P=class extends h{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._advancedOptionsVisibleForLayout=!1,this._advancedOptionsVisibleForMapOnly=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._focusedTemplateIndex=0,this._layoutTabSelected=!0,this._pendingExportScroll=!1,this._rootNode=null,this._selectTemplateNode=null,this._templateListPopover=new g({owner:this,placement:"top",offset:[0,-100],anchorElement:()=>this._selectTemplateNode,renderContentFunction:this.renderTemplateList}),this.exportedLinks=new O,this.headingLevel=3,this.iconClass=I.widgetIcon,this.icon=null,this.templateOptions=new b,this.viewModel=new _,this.handleTemplateListCreation=e=>e.focus(),this.handleTemplateChildBlur=e=>{const t=e.relatedTarget?.closest(`.${I.templateList}`);t||this.handleCloseTemplateSelection()},this.handleCloseTemplateSelection=()=>{this._focusedTemplateIndex=0,this._templateListPopover.open=!1,this._selectTemplateNode?.focus()},this.handleSelectTemplateClick=()=>{this._focusedTemplateIndex=0,this._templateListPopover.open=!0},this.handleTemplateListClick=e=>{const t=A(e.target);t&&this.applyTemplate(t)},this.handleTemplateListKeyDown=e=>{if(this._focusedTemplateIndex){if(y(e.key))return this.applyTemplate(this.viewModel.defaultTemplates.at(this._focusedTemplateIndex)),void e.preventDefault();if("ArrowDown"===e.key||"ArrowUp"===e.key){const{defaultTemplates:t}=this.viewModel,i="ArrowDown"===e.key?1:-1,a=(this._focusedTemplateIndex+i)%t.length;this._focusedTemplateIndex=a<0?t.length-1:a;const n=e.currentTarget;f(n.querySelectorAll(`.${I.menuItem}`)[this._focusedTemplateIndex],n.parentElement),e.preventDefault()}"Escape"===e.key&&this.handleCloseTemplateSelection()}},this._removeLink=e=>{const t=e.currentTarget["data-item"];t&&"error"===t.state&&this.exportedLinks.remove(t)},this._handleLinkClick=e=>{const t=e.currentTarget,{href:i}=t,a=u(this.viewModel.effectivePrintServiceUrl);if(!a)return;if(!e.isTrusted)return void e.stopPropagation();e.preventDefault();const n=new URL(i);n.searchParams.set("token",a),t.href=n.href,t.click(),t.href=i},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o((()=>this.viewModel?.templatesInfo),(e=>{const{format:t,layout:i}=this.templateOptions;if(e){const a=i===e.layout.defaultValue||E(i)||e.layout.choiceList&&i&&e.layout.choiceList.includes(i),n=t===e.format.defaultValue||e.format.choiceList&&t&&e.format.choiceList.includes(t);a||(i&&s.getLogger(this).warn(S),this.templateOptions.layout=e.layout.defaultValue),n||(t&&s.getLogger(this).warn($),this.templateOptions.format=e.format.defaultValue),E(i)&&(this._layoutTabSelected=!1)}}),l),o((()=>this.templateOptions?.format),(e=>{const{viewModel:{templatesInfo:t}}=this;if(t&&e){let i=!1;t.format.choiceList&&t.format.choiceList.forEach((t=>{t.toUpperCase()===e.toUpperCase()&&(this.templateOptions.format=t,i=!0)})),i||(this.templateOptions.format=t.format.defaultValue,s.getLogger(this).warn($)),this.scheduleRender()}}),l),o((()=>this.templateOptions?.layout),(e=>{const{viewModel:{templatesInfo:t}}=this;if(t&&e){this._layoutTabSelected=!E(e);let i=!this._layoutTabSelected;i||t.layout.choiceList&&t.layout.choiceList.forEach((t=>{t.toUpperCase()===e.toUpperCase()&&(this.templateOptions.layout=t,i=!0)})),i||(this.templateOptions.layout=t.layout.defaultValue,s.getLogger(this).warn(S));const a=this.viewModel.effectiveTemplateCustomTextElements[this.templateOptions.layout];this.templateOptions.customTextElements=a?n(a):null,this.scheduleRender()}}),l),o((()=>this.templateOptions?.dpi),(e=>{e<=0?this.templateOptions.dpi=1:this.scheduleRender()}),l),o((()=>this.viewModel?.view?.scale),(e=>{const{scale:t,scaleEnabled:i}=this.templateOptions;i&&t||(this.templateOptions.scale=e)}),l)]);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const i=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>clearTimeout(i)))}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{attributionEnabled:e,author:t,copyright:i,dpi:a,format:n,height:s,layout:o,legendEnabled:l,northArrowEnabled:r,scaleEnabled:d,scale:p,width:c}=this.templateOptions,u="ready"!==this.viewModel?.state,h=this.renderTitleOrFileNameSection(),{includeDefaultTemplates:m,messages:_,viewModel:b}=this,g=this.viewModel?.templatesInfo?.format?.choiceList||[],y=g.length>0?g.map((e=>w("option",{key:e,selected:e===n,value:e},e.toUpperCase()))):w("option",{key:"format-default-option"},_.formatDefaultOption),f=w("div",{class:I.formSectionContainer},w("label",null,_.fileFormatTitle,w("select",{class:I.select,onchange:this._updateFromOption,"data-target-property":"format",bind:this},y))),T=this.viewModel?.templatesInfo?.layout?.choiceList,O=T?.length?T.map((e=>w("option",{key:e,selected:e===o,value:e},_[e]||e))):w("option",{key:"layout-default-option"},_.layoutDefaultOption),x=w("div",{class:I.formSectionContainer},w("label",null,_.layoutTitle,w("select",{class:I.select,onchange:this._updateFromOption,"data-target-property":"layout",bind:this},O))),L=w("div",{class:I.formSectionContainer},w("label",null,_.dpi,w("input",{type:"number",class:this.classes(I.inputText,I.input),"data-input-name":"dpi",onchange:this._handleDPIChange,value:`${a}`,min:"1",tabIndex:0,bind:this}))),k=w("div",{class:this.classes(I.scaleInfoContainer,I.formSectionContainer)},w("label",null,w("input",{"data-option-name":"scaleEnabled",checked:d,type:"checkbox",tabIndex:0,onchange:this._toggleInputValue,bind:this}),_.scale),w("div",{class:I.scaleInputContainer},w("input",{"aria-label":_.scaleLabel,"aria-valuenow":`${p}`,role:"spinbutton",type:"number",class:this.classes(I.inputText,I.input,I.scaleInput),tabIndex:0,"data-input-name":"scale",onchange:this._updateInputValue,disabled:!d,value:`${p}`,bind:this}),w("button",{type:"button","aria-label":_.reset,class:this.classes(I.widgetButton,I.refreshButton,I.iconRefresh),tabIndex:0,onclick:this._resetToCurrentScale,bind:this}))),S=this._advancedOptionsVisibleForLayout?w("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:I.advancedOptionsContainer},k,w("div",{class:this.classes(I.authorInfoContainer,I.formSectionContainer)},w("label",null,_.author,w("input",{type:"text",value:t??"",class:this.classes(I.inputText,I.input),tabIndex:0,"data-input-name":"author",onchange:this._updateInputValue,bind:this}))),w("div",{class:this.classes(I.copyrightInfoContainer,I.formSectionContainer)},w("label",null,_.copyright,w("input",{type:"text",class:this.classes(I.inputText,I.input),tabIndex:0,value:i??"","data-input-name":"copyright",onchange:this._updateInputValue,bind:this}))),L,w("div",{class:this.classes(I.legendInfoContainer,I.formSectionContainer)},w("label",null,w("input",{type:"checkbox","data-option-name":"legendEnabled",tabIndex:0,checked:l,onchange:this._toggleInputValue,bind:this}),_.legend)),this.viewModel.templateToNorthArrowInfo[o]?w("div",{class:this.classes(I.legendInfoContainer,I.formSectionContainer),key:"north-arrow"},w("label",null,w("input",{type:"checkbox","data-option-name":"northArrowEnabled",tabIndex:0,checked:r,onchange:this._toggleInputValue,bind:this}),_.northArrow)):null,this.renderCustomTextElementSection()):null,$=this._advancedOptionsVisibleForMapOnly?w("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:I.advancedOptionsContainer},k,L,w("div",{class:I.formSectionContainer},w("label",null,w("input",{"data-option-name":"attributionEnabled",type:"checkbox",onchange:this._toggleInputValue,tabIndex:0,checked:e,bind:this}),_.attribution)),this.renderCustomTextElementSection()):null,M=this._layoutTabSelected?w("section",{key:"esri-print__layoutContent",id:`${this.id}__layoutContent`,"aria-labelledby":`${this.id}__layoutTab`,class:I.layoutSection,role:"tabpanel"},w("div",{class:I.panelContainer},h,x,this._layoutTabSelected?f:null),w("div",{class:this.classes(I.panelContainer,I.advancedOptionsSection)},w("button",{"aria-label":_.advancedOptions,"aria-expanded":this._advancedOptionsVisibleForLayout?"true":"false",class:I.advancedOptionsButton,onclick:this._showAdvancedOptions,bind:this,type:"button"},w("div",{class:I.advancedOptionsButtonContainer},w("span",{"aria-hidden":"true",class:this.classes(I.iconRightTriangleArrow,I.advancedOptionsButtonIconClosed)}),w("span",{"aria-hidden":"true",class:this.classes(I.iconLeftTriangleArrow,I.advancedOptionsButtonIconClosed_RTL)}),w("span",{"aria-hidden":"true",class:this.classes(I.iconDownArrow,I.advancedOptionsButtonIconOpened)}),w("span",{class:I.advancedOptionsButtonTitle},_.advancedOptions))),S)):w("section",{key:"esri-print__mapOnlyContent",id:`${this.id}__mapOnlyContent`,"aria-labelledby":`${this.id}__mapOnlyTab`,class:I.mapOnlySection,role:"tabpanel"},w("div",{class:I.panelContainer},h,this._layoutTabSelected?null:f,w("div",{class:this.classes(I.sizeContainer,I.formSectionContainer)},w("div",{class:I.widthContainer},w("label",null,_.width,w("input",{type:"number",class:this.classes(I.inputText,I.input),"data-input-name":"width",onchange:this._updateInputValue,value:`${c}`,tabIndex:0,bind:this}))),w("div",{class:I.heightContainer},w("label",null,_.height,w("input",{type:"number",class:this.classes(I.inputText,I.input),"data-input-name":"height",onchange:this._updateInputValue,value:`${s}`,tabIndex:0,bind:this}))),w("button",{type:"button","aria-label":_.swap,class:this.classes(I.widgetButton,I.swapButton,I.iconSwap),onclick:this._switchInput,tabIndex:0,bind:this})),w("div",{class:this.classes(I.panelContainer,I.advancedOptionsSection)},w("button",{"aria-label":_.advancedOptions,"aria-expanded":this._advancedOptionsVisibleForMapOnly?"true":"false",type:"button",class:I.advancedOptionsButton,onclick:this._showAdvancedOptions,bind:this},w("div",{class:I.advancedOptionsButtonContainer},w("span",{"aria-hidden":"true",class:this.classes(I.iconRightTriangleArrow,I.advancedOptionsButtonIconClosed)}),w("span",{"aria-hidden":"true",class:this.classes(I.iconLeftTriangleArrow,I.advancedOptionsButtonIconClosed_RTL)}),w("span",{"aria-hidden":"true",class:this.classes(I.iconDownArrow,I.advancedOptionsButtonIconOpened)}),w("span",{class:I.advancedOptionsButtonTitle},_.advancedOptions))),$))),F=this.exportedLinks.toArray(),E=this._renderExportedLink(F),P={[I.buttonDisabled]:u||!o&&!n},A="2d"!==this.view?.type,V=w("div",{class:I.panelError},A?_.sceneViewError:_.serviceError),B=w("div",null,w("ul",{class:I.layoutTabList,role:"tablist",onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,bind:this},w("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,id:`${this.id}__layoutTab`,"data-tab-id":C.layout,class:I.layoutTab,role:"tab",tabIndex:0,"aria-selected":`${this._layoutTabSelected}`},_.layoutTab),w("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,id:`${this.id}__mapOnlyTab`,"data-tab-id":C.mapOnly,class:I.layoutTab,role:"tab",tabIndex:0,"aria-selected":`${!this._layoutTabSelected}`},_.mapOnlyTab)),M,w("button",{"aria-label":_.exportDescription,type:"button",class:this.classes(I.printButton,I.button,P),disabled:u,tabIndex:0,onclick:this._handlePrintMap,bind:this},_.export),m&&b.defaultTemplates.length>0?this.renderTemplateSectionTrigger():null,w("div",{class:I.exportedFilesContainer,afterUpdate:this._scrollExportIntoView,bind:this},w(v,{class:I.exportedFilesTitle,level:this.headingLevel},_.exportText),F.length>0?null:w("div",null,w("div",null,_.exportHint)),E)),D=w("div",{class:I.printWidgetContainer},w("header",{class:I.headerTitle},_.export),this.error||A||!this.view?V:B),N="initializing"===this.viewModel?.state?this._renderLoader():D;return w("div",{afterCreate:this._handleRootAfterCreate,bind:this,class:this.classes(I.base,I.widget,I.panel)},N)}renderTemplateSectionTrigger(){const{messages:e,_templateListPopover:t}=this,i=t.open;return w("button",{afterCreate:e=>this._selectTemplateNode=e,"aria-controls":i?`${this.id}__template-selection`:"","aria-label":e.selectTemplateDescription,"aria-pressed":i.toString(),class:this.classes(I.button,I.buttonTertiary,I.templateButton),onclick:this.handleSelectTemplateClick,title:e.selectTemplateDescription,type:"button"},e.selectTemplate)}renderCustomTextElementSection(){const{templateOptions:{customTextElements:e}}=this;return e?w("div",{class:I.formSectionContainer,key:"custom-text-elements"},e.map((e=>{const[t,i]=Object.entries(e)[0];return"date"===t?null:w("label",{key:t},t,w("input",{bind:this,class:this.classes(I.inputText,I.input),"data-input-custom":!0,"data-input-name":t,onchange:this._updateInputValue,type:"text",value:i}))}))):null}renderTemplateList(){const{messages:e,messagesCommon:t,viewModel:i}=this,{defaultTemplates:a}=i,n=e.selectTemplateDescription,s=`${this.id}__template-selection`;return w("div",{class:this.classes(I.templateList,I.widget,I.panel),id:s},w(v,{class:I.menuHeader,level:this.headingLevel},e.selectTemplate),w("div",{class:I.templateListScroller},w("ul",{afterCreate:this.handleTemplateListCreation,"aria-activedescendant":`${this.id}__template-item--${this._focusedTemplateIndex}`,"aria-label":n,class:I.menuList,key:"templates",onblur:this.handleTemplateChildBlur,onclick:this.handleTemplateListClick,onkeydown:this.handleTemplateListKeyDown,role:"listbox",tabIndex:0,title:n},a.toArray().map(((t,i)=>{const a=i===this._focusedTemplateIndex,n=t.description??"",s=t.label??"";return w("li",{"aria-label":n,class:this.classes(I.menuItem,{[I.menuItemFocus]:a}),"data-template":t,id:`${this.id}__template-item--${i}`,key:s,title:n},E(s)?e.mapOnlyTab:s)})))),w("div",{class:I.templateListFooter},w("button",{type:"button",class:this.classes(I.button,I.buttonSecondary),onblur:this.handleTemplateChildBlur,onclick:this.handleCloseTemplateSelection},t.done)))}applyTemplate(e){const{format:t,layout:i,layoutOptions:a}=e,{templateOptions:n}=this;this._templateListPopover.open=!1,this._toggleTab("map-only"===i?C.mapOnly:C.layout,!1),t&&(n.format=t),i&&(n.layout=i),this._focusedTemplateIndex=null,n.legendEnabled=a?.legend??n.legendEnabled,this.handleCloseTemplateSelection()}renderTitleOrFileNameSection(){const{templateOptions:e,messages:t}=this;let i,a,n,s;return this._layoutTabSelected?(i=t.title,a=t.titlePlaceHolder,n=e.title,s="title"):(i=t.fileName,a=t.fileNamePlaceHolder,n=e.fileName,s="fileName"),w("div",{class:I.formSectionContainer,key:s},w("label",null,i,w("input",{type:"text",tabIndex:0,placeholder:a,class:this.classes(I.inputText,I.input),value:n??"","data-input-name":s,onchange:this._updateInputValue,bind:this})))}_handleRootAfterCreate(e){this._rootNode=e,this.addHandles(i(e,"scroll",(()=>{this._templateListPopover.open&&this.handleCloseTemplateSelection()})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&this._layoutTabSelected||"mapOnlyTab"===t&&!this._layoutTabSelected)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[I.loader]:this._awaitingServerResponse};return w("div",{class:this.classes(e),key:"loader"})}_createFileLink(e,t){const i=t||this.messages.untitled,a=e.format.toLowerCase(),n=a.includes("png")?"png":a,s=i+n;return void 0!==this._exportedFileNameMap[s]?this._exportedFileNameMap[s]++:this._exportedFileNameMap[s]=0,new m({name:i,extension:n,count:this._exportedFileNameMap[s]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,i){e.find((e=>{const[i]=Object.entries(e)[0];return i===t}))[t]=i}_updateInputValue(e){const t=e.target,i=t.getAttribute("data-input-name"),a=!!t["data-input-custom"],{templateOptions:n}=this;if(a)return void this._updateCustomTextElementValue(n.customTextElements,i,t.value);let s;if("number"===t.type){if(!F(t.valueAsNumber)){const e=n[i];return void(t.value=`${e}`)}s=t.valueAsNumber}else s=t.value;n[i]=s}_handleDPIChange(e){this._updateInputValue(e);const t=e.currentTarget.valueAsNumber,{height:i,width:a}=M(t),{templateOptions:n}=this;n.height=i,n.width=a}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e}=this,t=this.viewModel.toPrintTemplate(e),i=this._layoutTabSelected?t.layoutOptions?.titleText:e.fileName,a=this._createFileLink(t,i);this.exportedLinks.add(a),this.emit("submit",{link:a}),this.viewModel.print(t).then((e=>{a.set({url:e&&e.url,state:"ready"})})).catch((e=>{a.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:a}),this.scheduleRender()}))}_updateFromOption(e){const t=e.target,i=t.selectedOptions?t.selectedOptions.item(0)?.value:t.options[t.selectedIndex].value,a=t.getAttribute("data-target-property");this.templateOptions[a]=i}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_showAdvancedOptions(){this._layoutTabSelected?this._advancedOptionsVisibleForLayout=!this._advancedOptionsVisibleForLayout:this._advancedOptionsVisibleForMapOnly=!this._advancedOptionsVisibleForMapOnly}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;const e=this._rootNode;if(!e)return;const{clientHeight:t,scrollHeight:i}=e,a=i-t;a>0&&(e.scrollTop=a)}_toggleInputValue(e){const t=e.target,i=t.getAttribute("data-option-name");this.templateOptions[i]=t.checked,"scaleEnabled"===i&&(this.templateOptions[i]||this._resetToCurrentScale())}_renderExportedLink(e){const t=this.messages;return e.map((e=>{const{error:i,url:a,state:n}=e,s=e.formattedName??"",o="error"===n,l="pending"===n,p="ready"===n,c={[I.anchorDisabled]:l||o};let u=a||null;u&&(u=r(u));const h=d(a,location.href),m={[I.iconSpinner]:l,[I.rotate]:l,[I.iconDownload]:h&&p,[I.iconLaunchLink]:!h&&p,[I.iconError]:o,[I.exportedFileError]:o},_={[I.exportedFileError]:o};let b;b=l?t.pending:p?t.ready:t.errorMessage;const v=o?"print-task:cim-symbol-unsupported"===i?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return w("div",{"aria-label":b,class:I.exportedFile,"data-item":e,key:s,onclick:this._removeLink,title:v},w("a",{"aria-label":`${s}. ${t.linkReady}`,download:s,href:u??"",rel:"noreferrer",tabIndex:0,target:"_blank",class:this.classes(I.exportedFileLink,c),onclick:this._handleLinkClick},w("span",{class:this.classes(m)}),w("span",{class:this.classes(I.exportedFileLinkTitle,_)},s)))}))}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._layoutTabSelected=e===C.layout,this._layoutTabSelected){const e=this.viewModel?.templatesInfo?.layout?.choiceList;this.templateOptions.layout=e?e[0]:"letter-ansi-a-landscape"}else this.templateOptions.layout=x;t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const t=a(e),i=e.target.getAttribute("data-tab-id");if(y(t))return this._toggleTab(i),e.preventDefault(),void e.stopPropagation();"ArrowLeft"!==t&&"ArrowRight"!==t||(this._toggleTab(i===C.layout?C.mapOnly:C.layout),e.preventDefault(),e.stopPropagation())}};function A(e){return e?.["data-template"]}e([p()],P.prototype,"allowedFormats",null),e([p()],P.prototype,"allowedLayouts",null),e([p()],P.prototype,"error",null),e([p({type:O})],P.prototype,"exportedLinks",void 0),e([p()],P.prototype,"extraParameters",null),e([p()],P.prototype,"headingLevel",void 0),e([p()],P.prototype,"iconClass",void 0),e([p()],P.prototype,"icon",void 0),e([p()],P.prototype,"includeDefaultTemplates",null),e([p()],P.prototype,"label",null),e([p(),T("esri/widgets/Print/t9n/Print")],P.prototype,"messages",void 0),e([p(),T("esri/t9n/common")],P.prototype,"messagesCommon",void 0),e([p()],P.prototype,"portal",null),e([p()],P.prototype,"printServiceUrl",null),e([p()],P.prototype,"templateCustomTextElements",null),e([p({type:b})],P.prototype,"templateOptions",void 0),e([p()],P.prototype,"view",null),e([p({type:_})],P.prototype,"viewModel",void 0),P=e([c("esri.widgets.Print")],P);const V=P;export{V as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{on as i,eventKey as a}from"../core/events.js";import{clone as n}from"../core/lang.js";import s from"../core/Logger.js";import{watch as o,initial as l}from"../core/reactiveUtils.js";import{addProxy as r,hasSameOrigin as d}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{getToken as u}from"../rest/utils.js";import h from"./Widget.js";import m from"./Print/FileLink.js";import _ from"./Print/PrintViewModel.js";import b from"./Print/TemplateOptions.js";import{Heading as v}from"./support/Heading.js";import g from"./support/Popover.js";import{isActivationKey as y,keepMenuItemWithinView as f}from"./support/widgetUtils.js";import{messageBundle as T}from"./support/decorators/messageBundle.js";import{tsx as w}from"./support/jsxFactory.js";const O=t.ofType(m),x="MAP_ONLY";var C;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab"}(C||(C={}));const L="esri-print",k=`${L}__advanced-options-button`,I={base:L,headerTitle:`${L}__header-title`,inputText:`${L}__input-text`,layoutTabList:`${L}__layout-tab-list`,layoutTab:`${L}__layout-tab`,layoutSection:`${L}__layout-section`,mapOnlySection:`${L}__map-only-section`,scaleInput:`${L}__scale-input`,templateList:`${L}__template-list`,templateListScroller:`${L}__template-list-scroller`,templateListFooter:`${L}__template-list-footer`,loader:`${L}__loader`,advancedOptionsButton:k,advancedOptionsButtonContainer:`${k}-container`,advancedOptionsButtonTitle:`${k}-title`,advancedOptionsButtonIconOpened:`${k}-icon--opened`,advancedOptionsButtonIconClosed:`${k}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${k}-icon--closed-rtl`,refreshButton:`${L}__refresh-button`,swapButton:`${L}__swap-button`,linkButton:`${L}__link-button`,printButton:`${L}__export-button`,templateButton:`${L}__template-button`,formSectionContainer:`${L}__form-section-container`,advancedOptionsSection:`${L}__advanced-options-section`,advancedOptionsContainer:`${L}__advanced-options-container`,authorInfoContainer:`${L}__author-info-container`,copyrightInfoContainer:`${L}__copyright-info-container`,exportedFilesContainer:`${L}__export-panel-container`,exportedFilesTitle:`${L}__export-title`,exportedFile:`${L}__exported-file`,exportedFileLink:"esri-widget__anchor esri-print__exported-file-link",exportedFileLinkTitle:`${L}__exported-file-link-title`,heightContainer:`${L}__height-container`,legendInfoContainer:`${L}__legend-info-container`,printWidgetContainer:`${L}__container`,panelContainer:`${L}__panel-container`,scaleInfoContainer:`${L}__scale-info-container`,scaleInputContainer:`${L}__scale-input-container`,sizeContainer:`${L}__size-container`,widthContainer:`${L}__width-container`,widget:"esri-widget",panel:"esri-widget--panel",widgetButton:"esri-widget--button",button:"esri-button",buttonSecondary:"esri-button--secondary",buttonTertiary:"esri-button--tertiary",select:"esri-select",input:"esri-input",disabled:"esri-disabled",anchorDisabled:"esri-widget__anchor--disabled",buttonDisabled:"esri-button--disabled",panelError:`${L}__panel--error`,exportedFileError:`${L}__exported-file--error`,hide:"esri-hidden",rotate:"esri-rotating",anchor:"esri-widget__anchor",menu:"esri-menu",menuList:"esri-menu__list",menuItem:"esri-menu__list-item",menuItemFocus:"esri-menu__list-item--focus",menuHeader:"esri-menu__header",iconCheckMark:"esri-icon-check-mark",iconDownload:"esri-icon-download",iconLaunchLink:"esri-icon-launch-link-external",iconError:"esri-icon-error",iconPrinter:"esri-icon-printer",iconRightTriangleArrow:"esri-icon-right-triangle-arrow",iconLeftTriangleArrow:"esri-icon-left-triangle-arrow",iconDownArrow:"esri-icon-down-arrow",iconRefresh:"esri-icon-refresh",iconSpinner:"esri-icon-loading-indicator",iconSwap:"esri-icon-swap",iconLinked:"esri-icon-link-horizontal",iconUnlinked:"esri-icon-unlocked-link-horizontal",widgetIcon:"esri-icon-printer"},S="User sets an invalid layout, resetting it to the default valid one...",$="User sets an invalid format, resetting it to the default valid one...";function M(e){const t=8.3333,i=11.4583;return{width:Math.round(e*t),height:Math.round(e*i)}}function F(e){return!isNaN(e)&&e>0}function E(e){return e?.toUpperCase()===x}let P=class extends h{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._advancedOptionsVisibleForLayout=!1,this._advancedOptionsVisibleForMapOnly=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._focusedTemplateIndex=0,this._layoutTabSelected=!0,this._pendingExportScroll=!1,this._rootNode=null,this._selectTemplateNode=null,this._templateListPopover=new g({owner:this,placement:"top",offset:[0,-100],anchorElement:()=>this._selectTemplateNode,renderContentFunction:this.renderTemplateList}),this.exportedLinks=new O,this.headingLevel=3,this.iconClass=I.widgetIcon,this.icon=null,this.templateOptions=new b,this.viewModel=new _,this.handleTemplateListCreation=e=>e.focus(),this.handleTemplateChildBlur=e=>{const t=e.relatedTarget?.closest(`.${I.templateList}`);t||this.handleCloseTemplateSelection()},this.handleCloseTemplateSelection=()=>{this._focusedTemplateIndex=0,this._templateListPopover.open=!1,this._selectTemplateNode?.focus()},this.handleSelectTemplateClick=()=>{this._focusedTemplateIndex=0,this._templateListPopover.open=!0},this.handleTemplateListClick=e=>{const t=A(e.target);t&&this.applyTemplate(t)},this.handleTemplateListKeyDown=e=>{if(this._focusedTemplateIndex){if(y(e.key))return this.applyTemplate(this.viewModel.defaultTemplates.at(this._focusedTemplateIndex)),void e.preventDefault();if("ArrowDown"===e.key||"ArrowUp"===e.key){const{defaultTemplates:t}=this.viewModel,i="ArrowDown"===e.key?1:-1,a=(this._focusedTemplateIndex+i)%t.length;this._focusedTemplateIndex=a<0?t.length-1:a;const n=e.currentTarget;f(n.querySelectorAll(`.${I.menuItem}`)[this._focusedTemplateIndex],n.parentElement),e.preventDefault()}"Escape"===e.key&&this.handleCloseTemplateSelection()}},this._removeLink=e=>{const t=e.currentTarget["data-item"];t&&"error"===t.state&&this.exportedLinks.remove(t)},this._handleLinkClick=e=>{const t=e.currentTarget,{href:i}=t,a=u(this.viewModel.effectivePrintServiceUrl);if(!a)return;if(!e.isTrusted)return void e.stopPropagation();e.preventDefault();const n=new URL(i);n.searchParams.set("token",a),t.href=n.href,t.click(),t.href=i},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o((()=>this.viewModel?.templatesInfo),(e=>{const{format:t,layout:i}=this.templateOptions;if(e){const a=i===e.layout.defaultValue||E(i)||e.layout.choiceList&&i&&e.layout.choiceList.includes(i),n=t===e.format.defaultValue||e.format.choiceList&&t&&e.format.choiceList.includes(t);a||(i&&s.getLogger(this).warn(S),this.templateOptions.layout=e.layout.defaultValue),n||(t&&s.getLogger(this).warn($),this.templateOptions.format=e.format.defaultValue),E(i)&&(this._layoutTabSelected=!1)}}),l),o((()=>this.templateOptions?.format),(e=>{const{viewModel:{templatesInfo:t}}=this;if(t&&e){let i=!1;t.format.choiceList&&t.format.choiceList.forEach((t=>{t.toUpperCase()===e.toUpperCase()&&(this.templateOptions.format=t,i=!0)})),i||(this.templateOptions.format=t.format.defaultValue,s.getLogger(this).warn($)),this.scheduleRender()}}),l),o((()=>this.templateOptions?.layout),(e=>{const{viewModel:{templatesInfo:t}}=this;if(t&&e){this._layoutTabSelected=!E(e);let i=!this._layoutTabSelected;i||t.layout.choiceList&&t.layout.choiceList.forEach((t=>{t.toUpperCase()===e.toUpperCase()&&(this.templateOptions.layout=t,i=!0)})),i||(this.templateOptions.layout=t.layout.defaultValue,s.getLogger(this).warn(S));const a=this.viewModel.effectiveTemplateCustomTextElements[this.templateOptions.layout];this.templateOptions.customTextElements=a?n(a):null,this.scheduleRender()}}),l),o((()=>this.templateOptions?.dpi),(e=>{e<=0?this.templateOptions.dpi=1:this.scheduleRender()}),l),o((()=>this.viewModel?.view?.scale),(e=>{const{scale:t,scaleEnabled:i}=this.templateOptions;i&&t||(this.templateOptions.scale=e)}),l)]);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const i=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>clearTimeout(i)))}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{attributionEnabled:e,author:t,copyright:i,dpi:a,format:n,height:s,layout:o,legendEnabled:l,northArrowEnabled:r,scaleEnabled:d,scale:p,width:c}=this.templateOptions,u="ready"!==this.viewModel?.state,h=this.renderTitleOrFileNameSection(),{includeDefaultTemplates:m,messages:_,viewModel:b}=this,g=this.viewModel?.templatesInfo?.format?.choiceList||[],y=g.length>0?g.map((e=>w("option",{key:e,selected:e===n,value:e},e.toUpperCase()))):w("option",{key:"format-default-option"},_.formatDefaultOption),f=w("div",{class:I.formSectionContainer},w("label",null,_.fileFormatTitle,w("select",{class:I.select,onchange:this._updateFromOption,"data-target-property":"format",bind:this},y))),T=this.viewModel?.templatesInfo?.layout?.choiceList,O=T?.length?T.map((e=>w("option",{key:e,selected:e===o,value:e},_[e]||e))):w("option",{key:"layout-default-option"},_.layoutDefaultOption),x=w("div",{class:I.formSectionContainer},w("label",null,_.layoutTitle,w("select",{class:I.select,onchange:this._updateFromOption,"data-target-property":"layout",bind:this},O))),L=w("div",{class:I.formSectionContainer},w("label",null,_.dpi,w("input",{type:"number",class:this.classes(I.inputText,I.input),"data-input-name":"dpi",onchange:this._handleDPIChange,value:`${a}`,min:"1",tabIndex:0,bind:this}))),k=w("div",{class:this.classes(I.scaleInfoContainer,I.formSectionContainer)},w("label",null,w("input",{"data-option-name":"scaleEnabled",checked:d,type:"checkbox",tabIndex:0,onchange:this._toggleInputValue,bind:this}),_.scale),w("div",{class:I.scaleInputContainer},w("input",{"aria-label":_.scaleLabel,"aria-valuenow":`${p}`,role:"spinbutton",type:"number",class:this.classes(I.inputText,I.input,I.scaleInput),tabIndex:0,"data-input-name":"scale",onchange:this._updateInputValue,disabled:!d,value:`${p}`,bind:this}),w("button",{type:"button","aria-label":_.reset,class:this.classes(I.widgetButton,I.refreshButton,I.iconRefresh),tabIndex:0,onclick:this._resetToCurrentScale,bind:this}))),S=this._advancedOptionsVisibleForLayout?w("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:I.advancedOptionsContainer},k,w("div",{class:this.classes(I.authorInfoContainer,I.formSectionContainer)},w("label",null,_.author,w("input",{type:"text",value:t??"",class:this.classes(I.inputText,I.input),tabIndex:0,"data-input-name":"author",onchange:this._updateInputValue,bind:this}))),w("div",{class:this.classes(I.copyrightInfoContainer,I.formSectionContainer)},w("label",null,_.copyright,w("input",{type:"text",class:this.classes(I.inputText,I.input),tabIndex:0,value:i??"","data-input-name":"copyright",onchange:this._updateInputValue,bind:this}))),L,w("div",{class:this.classes(I.legendInfoContainer,I.formSectionContainer)},w("label",null,w("input",{type:"checkbox","data-option-name":"legendEnabled",tabIndex:0,checked:l,onchange:this._toggleInputValue,bind:this}),_.legend)),this.viewModel.templateToNorthArrowInfo[o]?w("div",{class:this.classes(I.legendInfoContainer,I.formSectionContainer),key:"north-arrow"},w("label",null,w("input",{type:"checkbox","data-option-name":"northArrowEnabled",tabIndex:0,checked:r,onchange:this._toggleInputValue,bind:this}),_.northArrow)):null,this.renderCustomTextElementSection()):null,$=this._advancedOptionsVisibleForMapOnly?w("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:I.advancedOptionsContainer},k,L,w("div",{class:I.formSectionContainer},w("label",null,w("input",{"data-option-name":"attributionEnabled",type:"checkbox",onchange:this._toggleInputValue,tabIndex:0,checked:e,bind:this}),_.attribution)),this.renderCustomTextElementSection()):null,M=this._layoutTabSelected?w("section",{key:"esri-print__layoutContent",id:`${this.id}__layoutContent`,"aria-labelledby":`${this.id}__layoutTab`,class:I.layoutSection,role:"tabpanel"},w("div",{class:I.panelContainer},h,x,this._layoutTabSelected?f:null),w("div",{class:this.classes(I.panelContainer,I.advancedOptionsSection)},w("button",{"aria-label":_.advancedOptions,"aria-expanded":this._advancedOptionsVisibleForLayout?"true":"false",class:I.advancedOptionsButton,onclick:this._showAdvancedOptions,bind:this,type:"button"},w("div",{class:I.advancedOptionsButtonContainer},w("span",{"aria-hidden":"true",class:this.classes(I.iconRightTriangleArrow,I.advancedOptionsButtonIconClosed)}),w("span",{"aria-hidden":"true",class:this.classes(I.iconLeftTriangleArrow,I.advancedOptionsButtonIconClosed_RTL)}),w("span",{"aria-hidden":"true",class:this.classes(I.iconDownArrow,I.advancedOptionsButtonIconOpened)}),w("span",{class:I.advancedOptionsButtonTitle},_.advancedOptions))),S)):w("section",{key:"esri-print__mapOnlyContent",id:`${this.id}__mapOnlyContent`,"aria-labelledby":`${this.id}__mapOnlyTab`,class:I.mapOnlySection,role:"tabpanel"},w("div",{class:I.panelContainer},h,this._layoutTabSelected?null:f,w("div",{class:this.classes(I.sizeContainer,I.formSectionContainer)},w("div",{class:I.widthContainer},w("label",null,_.width,w("input",{type:"number",class:this.classes(I.inputText,I.input),"data-input-name":"width",onchange:this._updateInputValue,value:`${c}`,tabIndex:0,bind:this}))),w("div",{class:I.heightContainer},w("label",null,_.height,w("input",{type:"number",class:this.classes(I.inputText,I.input),"data-input-name":"height",onchange:this._updateInputValue,value:`${s}`,tabIndex:0,bind:this}))),w("button",{type:"button","aria-label":_.swap,class:this.classes(I.widgetButton,I.swapButton,I.iconSwap),onclick:this._switchInput,tabIndex:0,bind:this})),w("div",{class:this.classes(I.panelContainer,I.advancedOptionsSection)},w("button",{"aria-label":_.advancedOptions,"aria-expanded":this._advancedOptionsVisibleForMapOnly?"true":"false",type:"button",class:I.advancedOptionsButton,onclick:this._showAdvancedOptions,bind:this},w("div",{class:I.advancedOptionsButtonContainer},w("span",{"aria-hidden":"true",class:this.classes(I.iconRightTriangleArrow,I.advancedOptionsButtonIconClosed)}),w("span",{"aria-hidden":"true",class:this.classes(I.iconLeftTriangleArrow,I.advancedOptionsButtonIconClosed_RTL)}),w("span",{"aria-hidden":"true",class:this.classes(I.iconDownArrow,I.advancedOptionsButtonIconOpened)}),w("span",{class:I.advancedOptionsButtonTitle},_.advancedOptions))),$))),F=this.exportedLinks.toArray(),E=this._renderExportedLink(F),P={[I.buttonDisabled]:u||!o&&!n},{view:A}=this,V=!A||"2d"!==A.type,B=w("div",{class:I.panelError},V?_.sceneViewError:_.serviceError),D=w("div",null,w("ul",{class:I.layoutTabList,role:"tablist",onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,bind:this},w("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,id:`${this.id}__layoutTab`,"data-tab-id":C.layout,class:I.layoutTab,role:"tab",tabIndex:0,"aria-selected":`${this._layoutTabSelected}`},_.layoutTab),w("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,id:`${this.id}__mapOnlyTab`,"data-tab-id":C.mapOnly,class:I.layoutTab,role:"tab",tabIndex:0,"aria-selected":`${!this._layoutTabSelected}`},_.mapOnlyTab)),M,w("button",{"aria-label":_.exportDescription,type:"button",class:this.classes(I.printButton,I.button,P),disabled:u,tabIndex:0,onclick:this._handlePrintMap,bind:this},_.export),m&&b.defaultTemplates.length>0?this.renderTemplateSectionTrigger():null,w("div",{class:I.exportedFilesContainer,afterUpdate:this._scrollExportIntoView,bind:this},w(v,{class:I.exportedFilesTitle,level:this.headingLevel},_.exportText),F.length>0?null:w("div",null,w("div",null,_.exportHint)),E)),N=w("div",{class:I.printWidgetContainer},w("header",{class:I.headerTitle},_.export),this.error||V||!this.view?B:D),R="initializing"===this.viewModel?.state?this._renderLoader():N;return w("div",{afterCreate:this._handleRootAfterCreate,bind:this,class:this.classes(I.base,I.widget,I.panel)},R)}renderTemplateSectionTrigger(){const{messages:e,_templateListPopover:t}=this,i=t.open;return w("button",{afterCreate:e=>this._selectTemplateNode=e,"aria-controls":i?`${this.id}__template-selection`:"","aria-label":e.selectTemplateDescription,"aria-pressed":i.toString(),class:this.classes(I.button,I.buttonTertiary,I.templateButton),onclick:this.handleSelectTemplateClick,title:e.selectTemplateDescription,type:"button"},e.selectTemplate)}renderCustomTextElementSection(){const{templateOptions:{customTextElements:e}}=this;return e?w("div",{class:I.formSectionContainer,key:"custom-text-elements"},e.map((e=>{const[t,i]=Object.entries(e)[0];return"date"===t?null:w("label",{key:t},t,w("input",{bind:this,class:this.classes(I.inputText,I.input),"data-input-custom":!0,"data-input-name":t,onchange:this._updateInputValue,type:"text",value:i}))}))):null}renderTemplateList(){const{messages:e,messagesCommon:t,viewModel:i}=this,{defaultTemplates:a}=i,n=e.selectTemplateDescription,s=`${this.id}__template-selection`;return w("div",{class:this.classes(I.templateList,I.widget,I.panel),id:s},w(v,{class:I.menuHeader,level:this.headingLevel},e.selectTemplate),w("div",{class:I.templateListScroller},w("ul",{afterCreate:this.handleTemplateListCreation,"aria-activedescendant":`${this.id}__template-item--${this._focusedTemplateIndex}`,"aria-label":n,class:I.menuList,key:"templates",onblur:this.handleTemplateChildBlur,onclick:this.handleTemplateListClick,onkeydown:this.handleTemplateListKeyDown,role:"listbox",tabIndex:0,title:n},a.toArray().map(((t,i)=>{const a=i===this._focusedTemplateIndex,n=t.description??"",s=t.label??"";return w("li",{"aria-label":n,class:this.classes(I.menuItem,{[I.menuItemFocus]:a}),"data-template":t,id:`${this.id}__template-item--${i}`,key:s,title:n},E(s)?e.mapOnlyTab:s)})))),w("div",{class:I.templateListFooter},w("button",{type:"button",class:this.classes(I.button,I.buttonSecondary),onblur:this.handleTemplateChildBlur,onclick:this.handleCloseTemplateSelection},t.done)))}applyTemplate(e){const{format:t,layout:i,layoutOptions:a}=e,{templateOptions:n}=this;this._templateListPopover.open=!1,this._toggleTab("map-only"===i?C.mapOnly:C.layout,!1),t&&(n.format=t),i&&(n.layout=i),this._focusedTemplateIndex=null,n.legendEnabled=a?.legend??n.legendEnabled,this.handleCloseTemplateSelection()}renderTitleOrFileNameSection(){const{templateOptions:e,messages:t}=this;let i,a,n,s;return this._layoutTabSelected?(i=t.title,a=t.titlePlaceHolder,n=e.title,s="title"):(i=t.fileName,a=t.fileNamePlaceHolder,n=e.fileName,s="fileName"),w("div",{class:I.formSectionContainer,key:s},w("label",null,i,w("input",{type:"text",tabIndex:0,placeholder:a,class:this.classes(I.inputText,I.input),value:n??"","data-input-name":s,onchange:this._updateInputValue,bind:this})))}_handleRootAfterCreate(e){this._rootNode=e,this.addHandles(i(e,"scroll",(()=>{this._templateListPopover.open&&this.handleCloseTemplateSelection()})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&this._layoutTabSelected||"mapOnlyTab"===t&&!this._layoutTabSelected)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[I.loader]:this._awaitingServerResponse};return w("div",{class:this.classes(e),key:"loader"})}_createFileLink(e,t){const i=t||this.messages.untitled,a=e.format.toLowerCase(),n=a.includes("png")?"png":a,s=i+n;return void 0!==this._exportedFileNameMap[s]?this._exportedFileNameMap[s]++:this._exportedFileNameMap[s]=0,new m({name:i,extension:n,count:this._exportedFileNameMap[s]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,i){e.find((e=>{const[i]=Object.entries(e)[0];return i===t}))[t]=i}_updateInputValue(e){const t=e.target,i=t.getAttribute("data-input-name"),a=!!t["data-input-custom"],{templateOptions:n}=this;if(a)return void this._updateCustomTextElementValue(n.customTextElements,i,t.value);let s;if("number"===t.type){if(!F(t.valueAsNumber)){const e=n[i];return void(t.value=`${e}`)}s=t.valueAsNumber}else s=t.value;n[i]=s}_handleDPIChange(e){this._updateInputValue(e);const t=e.currentTarget.valueAsNumber,{height:i,width:a}=M(t),{templateOptions:n}=this;n.height=i,n.width=a}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e}=this,t=this.viewModel.toPrintTemplate(e),i=this._layoutTabSelected?t.layoutOptions?.titleText:e.fileName,a=this._createFileLink(t,i);this.exportedLinks.add(a),this.emit("submit",{link:a}),this.viewModel.print(t).then((e=>{a.set({url:e&&e.url,state:"ready"})})).catch((e=>{a.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:a}),this.scheduleRender()}))}_updateFromOption(e){const t=e.target,i=t.selectedOptions?t.selectedOptions.item(0)?.value:t.options[t.selectedIndex].value,a=t.getAttribute("data-target-property");this.templateOptions[a]=i}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_showAdvancedOptions(){this._layoutTabSelected?this._advancedOptionsVisibleForLayout=!this._advancedOptionsVisibleForLayout:this._advancedOptionsVisibleForMapOnly=!this._advancedOptionsVisibleForMapOnly}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;const e=this._rootNode;if(!e)return;const{clientHeight:t,scrollHeight:i}=e,a=i-t;a>0&&(e.scrollTop=a)}_toggleInputValue(e){const t=e.target,i=t.getAttribute("data-option-name");this.templateOptions[i]=t.checked,"scaleEnabled"===i&&(this.templateOptions[i]||this._resetToCurrentScale())}_renderExportedLink(e){const t=this.messages;return e.map((e=>{const{error:i,url:a,state:n}=e,s=e.formattedName??"",o="error"===n,l="pending"===n,p="ready"===n,c={[I.anchorDisabled]:l||o};let u=a||null;u&&(u=r(u));const h=d(a,location.href),m={[I.iconSpinner]:l,[I.rotate]:l,[I.iconDownload]:h&&p,[I.iconLaunchLink]:!h&&p,[I.iconError]:o,[I.exportedFileError]:o},_={[I.exportedFileError]:o};let b;b=l?t.pending:p?t.ready:t.errorMessage;const v=o?"print-task:cim-symbol-unsupported"===i?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return w("div",{"aria-label":b,class:I.exportedFile,"data-item":e,key:s,onclick:this._removeLink,title:v},w("a",{"aria-label":`${s}. ${t.linkReady}`,download:s,href:u??"",rel:"noreferrer",tabIndex:0,target:"_blank",class:this.classes(I.exportedFileLink,c),onclick:this._handleLinkClick},w("span",{class:this.classes(m)}),w("span",{class:this.classes(I.exportedFileLinkTitle,_)},s)))}))}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._layoutTabSelected=e===C.layout,this._layoutTabSelected){const e=this.viewModel?.templatesInfo?.layout?.choiceList;this.templateOptions.layout=e?e[0]:"letter-ansi-a-landscape"}else this.templateOptions.layout=x;t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const t=a(e),i=e.target.getAttribute("data-tab-id");if(y(t))return this._toggleTab(i),e.preventDefault(),void e.stopPropagation();"ArrowLeft"!==t&&"ArrowRight"!==t||(this._toggleTab(i===C.layout?C.mapOnly:C.layout),e.preventDefault(),e.stopPropagation())}};function A(e){return e?.["data-template"]}e([p()],P.prototype,"allowedFormats",null),e([p()],P.prototype,"allowedLayouts",null),e([p()],P.prototype,"error",null),e([p({type:O})],P.prototype,"exportedLinks",void 0),e([p()],P.prototype,"extraParameters",null),e([p()],P.prototype,"headingLevel",void 0),e([p()],P.prototype,"iconClass",void 0),e([p()],P.prototype,"icon",void 0),e([p()],P.prototype,"includeDefaultTemplates",null),e([p()],P.prototype,"label",null),e([p(),T("esri/widgets/Print/t9n/Print")],P.prototype,"messages",void 0),e([p(),T("esri/t9n/common")],P.prototype,"messagesCommon",void 0),e([p()],P.prototype,"portal",null),e([p()],P.prototype,"printServiceUrl",null),e([p()],P.prototype,"templateCustomTextElements",null),e([p({type:b})],P.prototype,"templateOptions",void 0),e([p()],P.prototype,"view",null),e([p({type:_})],P.prototype,"viewModel",void 0),P=e([c("esri.widgets.Print")],P);const V=P;export{V as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import i from"../../Graphic.js";import"../../intl.js";import s from"../../core/Accessor.js";import e from"../../core/Collection.js";import o from"../../core/Error.js";import{HandleOwnerMixin as r}from"../../core/HandleOwner.js";import n from"../../core/Logger.js";import{watch as a}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../geometry/Extent.js";import m from"../../geometry/Point.js";import{load as y,project as p,isLoaded as u}from"../../geometry/projection.js";import w from"../../layers/GraphicsLayer.js";import{synthesizeAssociationGeometries as A}from"../../rest/networks/synthesizeAssociationGeometries.js";import d from"../../rest/networks/support/SynthesizeAssociationGeometriesParameters.js";import v from"../../symbols/LineSymbolMarker.js";import L from"../../symbols/SimpleLineSymbol.js";import{addUniqueLayer as S}from"../../views/draw/support/layerUtils.js";import{onLocaleChange as g}from"../../intl/locale.js";import{fetchMessageBundle as _}from"../../intl/messages.js";let b=class extends(r(s)){constructor(t){super(t),this._internalGraphicsLayerConnectivity=this._createInternalGraphicsLayer("Connectivity Associations (Internal)"),this._internalGraphicsLayerStructuralAttachment=this._createInternalGraphicsLayer("Structural Attachment Associations (Internal)"),this._initialValidationsFinished=!1,this.autoRefreshAssociations=!1,this.connectivityAssociationsLineSymbol=new L({style:"short-dash",width:2,color:[190,159,159,1]}),this.executionError="",this.loadError="",this.loadErrors=new e,this.maxAllowableAssociations=250,this.showAssociationsEnabled=!1,this.showArrowsConnectivity=!1,this.showArrowsStructuralAttachment=!1,this.structuralAttachmentAssociationsLineSymbol=new L({style:"short-dash",width:2,color:[159,190,159,1]})}initialize(){const t=async()=>{this.messages||(this.messages=await _("esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations"))};t().then((()=>{this.view||(this.view=null),this.utilityNetwork||(this.utilityNetwork=null),this.addHandles([a((()=>[this.view,this.utilityNetwork]),(async()=>{const{loadErrors:t,messages:i}=this,{noUtilityNetwork:s,noView:e}=i.info;this._initialValidationsFinished=!1,t.removeAll();let r=!1,a=!1;this._set("loadError",""),this.removeAssociations(),this.utilityNetwork&&"utility"===this.utilityNetwork.type?(this.utilityNetwork.loaded||await this.utilityNetwork.load(),r=!0):(this.loadErrors.push(s),this._set("loadError",s),n.getLogger(this).error(new o("utilityNetworkAssociations:missing-property",s))),this.view&&"2d"===this.view.type?(S(this.view,this._internalGraphicsLayerConnectivity),S(this.view,this._internalGraphicsLayerStructuralAttachment),a=!0):(this.loadErrors.push(e),this._set("loadError",e),n.getLogger(this).error(new o("utilityNetworkAssociations:missing-property",e))),r&&a&&this.showAssociationsEnabled&&await this.showAssociations(),this._internalGraphicsLayerConnectivity.visible=this.includeConnectivityAssociations,this._internalGraphicsLayerStructuralAttachment.visible=this.includeStructuralAttachmentAssociations,this._initialValidationsFinished=!0}),{initial:!0}),a((()=>[this.view?.stationary,this.showAssociationsEnabled,this.maxAllowableAssociations]),(async()=>{this.view?.stationary&&this.showAssociationsEnabled&&(this.includeConnectivityAssociations||this.includeStructuralAttachmentAssociations)&&await this.showAssociations()})),a((()=>[this.showArrowsConnectivity]),(()=>{const t=this.connectivityAssociationsLineSymbol.clone();t.marker=null,this.showArrowsConnectivity&&(t.marker=new v({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"})),this._internalGraphicsLayerConnectivity.graphics.length>0&&this._internalGraphicsLayerConnectivity.graphics.map((i=>{i.symbol=t}))})),a((()=>[this.showArrowsStructuralAttachment]),(()=>{const t=this.structuralAttachmentAssociationsLineSymbol.clone();t.marker=null,this.showArrowsStructuralAttachment&&(t.marker=new v({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"})),this._internalGraphicsLayerStructuralAttachment.graphics.length>0&&this._internalGraphicsLayerStructuralAttachment.graphics.map((i=>{i.symbol=t}))})),g(t)])}))}destroy(){this.view=null,this._removeInternalGraphicsLayers()}set includeConnectivityAssociations(t){this._set("includeConnectivityAssociations",t),this._internalGraphicsLayerConnectivity.visible=t}set includeStructuralAttachmentAssociations(t){this._set("includeStructuralAttachmentAssociations",t),this._internalGraphicsLayerStructuralAttachment.visible=t}get state(){return""!==this.loadError?"disabled":this.updatingHandles.updating?"executing":""!==this.executionError?"warning":this._initialValidationsFinished?"ready":"loading"}set utilityNetwork(t){this._get("utilityNetwork")!==t&&this._set("utilityNetwork",t)}set view(t){this._get("view")!==t&&this._set("view",t)}removeAssociations(){this._internalGraphicsLayerConnectivity.removeAll(),this._internalGraphicsLayerStructuralAttachment.removeAll()}async showAssociations(){const{messages:t}=this,{maxAllowableAssociationsExceeded:s,noAssociationsFound:e}=t.info,o=this.utilityNetwork?.spatialReference;if(u()||await y(),!this.view)return;const{spatialReference:r,extent:{xmin:n,ymin:a,xmax:c,ymax:l}}=this.view,w=p(new m({x:n,y:a,spatialReference:r}),o),L=p(new m({x:c,y:l,spatialReference:r}),o),S=new h({xmin:w.x,ymin:w.y,xmax:L.x,ymax:L.y,spatialReference:o});let g="";this.utilityNetwork?.networkServiceUrl&&(g=this.utilityNetwork?.networkServiceUrl);const _=new d({returnConnectivityAssociations:this.includeConnectivityAssociations,returnAttachmentAssociations:this.includeStructuralAttachmentAssociations,extent:S,outSpatialReference:this.utilityNetwork?.spatialReference,maxGeometryCount:this.maxAllowableAssociations,gdbVersion:(this.view?.map.allLayers?.items.find((t=>"feature"===t.type))).gdbVersion,moment:this.moment});this._set("executionError",""),this.removeAssociations(),this.updatingHandles.addPromise(A(g,_).then((t=>{let o=[],r=[];!0!==t?.maxGeometryCountExceeded?0!==t?.associations.length?t&&(o=t?.associations.filter((({associationType:t})=>"connectivity"===t)).map((t=>(this.connectivityAssociationsLineSymbol.marker=null,this.showArrowsConnectivity&&(this.connectivityAssociationsLineSymbol.marker=new v({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"})),new i({geometry:t.geometry.clone(),symbol:this.connectivityAssociationsLineSymbol})))),r=t.associations.filter((({associationType:t})=>"attachment"===t)).map((t=>(this.structuralAttachmentAssociationsLineSymbol.marker=null,this.showArrowsStructuralAttachment&&(this.structuralAttachmentAssociationsLineSymbol.marker=new v({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"})),new i({geometry:t.geometry.clone(),symbol:this.structuralAttachmentAssociationsLineSymbol})))),o.length>0&&this._internalGraphicsLayerConnectivity.addMany(o),r.length>0&&this._internalGraphicsLayerStructuralAttachment.addMany(r)):this._set("executionError",e):this._set("executionError",s)}),(({message:t})=>{this._set("executionError",t)})))}_createInternalGraphicsLayer(t){return new w({listMode:"hide",internal:!0,title:t})}_removeInternalGraphicsLayers(){this._internalGraphicsLayerConnectivity&&this._internalGraphicsLayerStructuralAttachment&&this.view&&this.view.map&&(this.view.map.remove(this._internalGraphicsLayerConnectivity),this.view.map.remove(this._internalGraphicsLayerStructuralAttachment))}};t([c()],b.prototype,"_initialValidationsFinished",void 0),t([c()],b.prototype,"autoRefreshAssociations",void 0),t([c()],b.prototype,"connectivityAssociationsLineSymbol",void 0),t([c({readOnly:!0})],b.prototype,"executionError",void 0),t([c({type:Boolean,value:!0})],b.prototype,"includeConnectivityAssociations",null),t([c({type:Boolean,value:!0})],b.prototype,"includeStructuralAttachmentAssociations",null),t([c({readOnly:!0})],b.prototype,"loadError",void 0),t([c()],b.prototype,"loadErrors",void 0),t([c()],b.prototype,"maxAllowableAssociations",void 0),t([c()],b.prototype,"messages",void 0),t([c()],b.prototype,"moment",void 0),t([c()],b.prototype,"showAssociationsEnabled",void 0),t([c()],b.prototype,"showArrowsConnectivity",void 0),t([c()],b.prototype,"showArrowsStructuralAttachment",void 0),t([c({readOnly:!0})],b.prototype,"state",null),t([c()],b.prototype,"structuralAttachmentAssociationsLineSymbol",void 0),t([c()],b.prototype,"utilityNetwork",null),t([c()],b.prototype,"view",null),b=t([l("esri.widgets.UtilityNetworkAssociations.UtilityNetworkAssociationsViewModel")],b);const f=b;export{f as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../chunks/tslib.es6.js";import{watch as s}from"../core/reactiveUtils.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as e}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import{loadCalciteComponents as l}from"./support/componentsUtils.js";import"./support/widgetUtils.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import{tsx as c}from"./support/jsxFactory.js";import r from"./UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";const d={widgetBlockContent:"esri-un-associations__widget-block-content",widgetBlockActions:"esri-un-associations__widget-block-actions",widgetBlockActionsSwitch:"esri-un-associations__widget-block-actions-switch",widgetSettingsContainer:"esri-un-associations__widget-settings-container",widgetControlsLabelAndToggle:"esri-un-associations__controls-label-and-toggle",widgetControlsLabelAndSlider:"esri-un-associations__controls-label-and-slider",widgetControlsLabel:"esri-un-associations__controls-label",widgetControlsSlider:"esri-un-associations__controls-slider"},h={maxAllowableAssociationsSlider:!1};let A=class extends n{constructor(t,s){super(t,s),this._autoRefreshAssociations=!0,this._associationsOptionsEnabled=!1,this._maxAllowableAssociationsSliderMax=1e3,this._maxAllowableAssociationsSliderMin=250,this._maxAllowableAssociationsSliderStep=250,this.messages=null,this.showAssociationsEnabled=!1,this.viewModel=new r,this.visibleElements={...h}}initialize(){this.addHandles([s((()=>[this.view?.stationary,this.showAssociationsEnabled,this.includeConnectivityAssociations,this.includeStructuralAttachmentAssociations,this.maxAllowableAssociations]),(()=>{!0===this.autoRefreshAssociations&&(!0===this.showAssociationsEnabled?this.viewModel.showAssociations():this.viewModel.removeAssociations())}))])}get autoRefreshAssociations(){return this._autoRefreshAssociations}set autoRefreshAssociations(t){this._autoRefreshAssociations=t}get connectivityAssociationsLineSymbol(){return this.viewModel.connectivityAssociationsLineSymbol}set connectivityAssociationsLineSymbol(t){this.viewModel.connectivityAssociationsLineSymbol=t}get includeConnectivityAssociations(){return this.viewModel.includeConnectivityAssociations}set includeConnectivityAssociations(t){this.viewModel.includeConnectivityAssociations=t}get includeStructuralAttachmentAssociations(){return this.viewModel.includeStructuralAttachmentAssociations}set includeStructuralAttachmentAssociations(t){this.viewModel.includeStructuralAttachmentAssociations=t}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get maxAllowableAssociations(){return this.viewModel.maxAllowableAssociations}set maxAllowableAssociations(t){this.viewModel.maxAllowableAssociations=t}get maxAllowableAssociationsSliderMax(){return this._maxAllowableAssociationsSliderMax}set maxAllowableAssociationsSliderMax(t){t<=this.maxAllowableAssociationsSliderMin||(this._maxAllowableAssociationsSliderMax=t)}get maxAllowableAssociationsSliderMin(){return this._maxAllowableAssociationsSliderMin}set maxAllowableAssociationsSliderMin(t){t<0||t>=this.maxAllowableAssociationsSliderMax||(this._maxAllowableAssociationsSliderMin=t)}get maxAllowableAssociationsSliderStep(){return this._maxAllowableAssociationsSliderStep}set maxAllowableAssociationsSliderStep(t){this._maxAllowableAssociationsSliderStep=t}get showArrowsConnectivity(){return this.viewModel.showArrowsConnectivity}set showArrowsConnectivity(t){this.viewModel.showArrowsConnectivity=t}get showArrowsStructuralAttachment(){return this.viewModel.showArrowsStructuralAttachment}set showArrowsStructuralAttachment(t){this.viewModel.showArrowsStructuralAttachment=t}get structuralAttachmentAssociationsLineSymbol(){return this.viewModel.structuralAttachmentAssociationsLineSymbol}set structuralAttachmentAssociationsLineSymbol(t){this.viewModel.structuralAttachmentAssociationsLineSymbol=t}get utilityNetwork(){return this.viewModel.utilityNetwork}set utilityNetwork(t){this.viewModel.utilityNetwork=t}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}castVisibleElements(t){return{...h,...t}}render(){const t=this.viewModel;return c("div",null,c("calcite-block",{heading:this.label,class:d.widgetBlockContent,collapsible:"disabled"!==t.state,open:"disabled"===t.state},this.renderShowStatusIcon(),this.autoRefreshAssociations?this.renderShowAssociationsSwitch():this.renderRefreshAssociationsAction(),this.renderSettings()),this.autoRefreshAssociations?this.renderShowAssociationsSwitchTooltip():this.renderRefreshAssociationsActionTooltip(),this.renderShowStatusIconTooltip())}loadDependencies(){return l({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}renderConnectivityAssociationsToggle(){const{messages:t}=this;return c("div",{key:"connectivityAssociationsToggleDiv",class:d.widgetControlsLabelAndToggle},c("calcite-label",{class:d.widgetControlsLabel},t.inputStrings.enableConnectivity),c("calcite-switch",{bind:this,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,checked:this.includeConnectivityAssociations,onCalciteSwitchChange:this._connectivityAssociationsSwitchChange}))}renderMaxAllowableAssociationsSlider(){const{messages:t,visibleElements:{maxAllowableAssociationsSlider:s}}=this;if(s)return c("div",{class:d.widgetControlsLabelAndSlider},c("calcite-label",{class:d.widgetControlsLabel},t.inputStrings.maxAllowableAssociations),c("calcite-slider",{bind:this,class:d.widgetControlsSlider,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,min:this.maxAllowableAssociationsSliderMin,max:this.maxAllowableAssociationsSliderMax,step:this.maxAllowableAssociationsSliderStep,ticks:this.maxAllowableAssociationsSliderStep,value:this.maxAllowableAssociations,labelTicks:!0,snap:!0,scale:"s",onCalciteSliderChange:this._maxAllowableAssociationsSliderChange}))}renderRefreshAssociationsAction(){if("disabled"!==this.viewModel.state)return c("div",{slot:"control",style:"--calcite-ui-icon-color: #077ac2"},c("calcite-action",{id:"refreshAssociations-action",bind:this,class:d.widgetBlockActions,icon:"refresh-",text:"",onclick:this._refreshAssociations}))}renderRefreshAssociationsActionTooltip(){const{messages:t}=this;return c("calcite-tooltip",{label:"refreshAssociations-action-tooltip-label",referenceElement:"refreshAssociations-action"},c("span",null,t.inputStrings.refreshAssociations))}renderSettings(){const t=this.viewModel;return"disabled"===t.state?c("calcite-notice",{open:!0,kind:"warning",scale:"s"},c("div",{slot:"message"},t.loadError)):c("div",{class:d.widgetSettingsContainer},this.renderConnectivityAssociationsToggle(),this.renderStructuralAttachmentAssociationsToggle(),this.renderMaxAllowableAssociationsSlider())}renderShowAssociationsSwitch(){return"disabled"===this.viewModel.state?c("div",{id:"showAssociations-switch"}):c("calcite-switch",{id:"showAssociations-switch",bind:this,class:d.widgetBlockActionsSwitch,checked:this.showAssociationsEnabled,onCalciteSwitchChange:this._showAssociationsSwitchChange,slot:"control"})}renderShowAssociationsSwitchTooltip(){const{messages:t}=this;return c("calcite-tooltip",{label:"showAssociations-switch-tooltip-label",referenceElement:"showAssociations-switch"},c("span",null,t.inputStrings.enableAssociations))}renderShowStatusIcon(){const t=this.viewModel,s=()=>{switch(t.state){case"disabled":case"failed":case"warning":return"exclamation-mark-triangle";default:return"blank"}},i=()=>{switch(t.state){case"disabled":case"failed":case"warning":return!1;default:return!0}};return c("div",{slot:"control",style:"--calcite-ui-icon-color: #edd317"},c("calcite-action",{id:"statusIcon-action",class:d.widgetBlockActions,icon:s(),disabled:i(),text:"",slot:"control"}))}renderShowStatusIconTooltip(){const t=this.viewModel,s=()=>{switch(t.state){case"failed":case"warning":return t.executionError;default:return""}};if("disabled"!==t.state)return c("calcite-tooltip",{label:"statusIcon-status-tooltip-label",referenceElement:"statusIcon-action"},c("span",null,s()))}renderStructuralAttachmentAssociationsToggle(){const{messages:t}=this;return c("div",{key:"structuralAttachmentAssociationsToggleDiv",class:d.widgetControlsLabelAndToggle},c("calcite-label",{class:d.widgetControlsLabel},t.inputStrings.enableStructuralAttachment),c("calcite-switch",{bind:this,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,checked:this.includeStructuralAttachmentAssociations,onCalciteSwitchChange:this._structuralAttAssociationsSwitchChange}))}_connectivityAssociationsSwitchChange(t){this.includeConnectivityAssociations=t.target.checked}_maxAllowableAssociationsSliderChange(t){this.maxAllowableAssociations=Number(t.target.value)}_refreshAssociations(){this.viewModel.showAssociations()}_showAssociationsSwitchChange(t){this.showAssociationsEnabled=t.target.checked,this._associationsOptionsEnabled=t.target.checked}_structuralAttAssociationsSwitchChange(t){this.includeStructuralAttachmentAssociations=t.target.checked}};t([i()],A.prototype,"connectivityAssociationsLineSymbol",null),t([i()],A.prototype,"includeConnectivityAssociations",null),t([i()],A.prototype,"includeStructuralAttachmentAssociations",null),t([i()],A.prototype,"label",null),t([i()],A.prototype,"maxAllowableAssociations",null),t([i()],A.prototype,"maxAllowableAssociationsSliderMax",null),t([i()],A.prototype,"maxAllowableAssociationsSliderMin",null),t([i()],A.prototype,"maxAllowableAssociationsSliderStep",null),t([i(),a("esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations")],A.prototype,"messages",void 0),t([i()],A.prototype,"showArrowsConnectivity",null),t([i()],A.prototype,"showArrowsStructuralAttachment",null),t([i()],A.prototype,"showAssociationsEnabled",void 0),t([i()],A.prototype,"structuralAttachmentAssociationsLineSymbol",null),t([i()],A.prototype,"utilityNetwork",null),t([i()],A.prototype,"view",null),t([i({type:r})],A.prototype,"viewModel",void 0),t([i()],A.prototype,"visibleElements",void 0),t([e("visibleElements")],A.prototype,"castVisibleElements",null),A=t([o("esri.widgets.UtilityNetworkAssociations")],A);const w=A;export{w as default};
|
|
5
|
+
import{_ as t}from"../chunks/tslib.es6.js";import{watch as s}from"../core/reactiveUtils.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as e}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import{loadCalciteComponents as a}from"./support/componentsUtils.js";import"./support/widgetUtils.js";import{messageBundle as l}from"./support/decorators/messageBundle.js";import{tsx as c}from"./support/jsxFactory.js";import r from"./UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";const d="esri-un-associations",h={action:`${d}__action`,container:`${d}__container`,content:`${d}__content`,controlsContainer:`${d}__controls-container`,label:`${d}__label`,labelAndSlider:`${d}__label-and-slider`,labelAndToggle:`${d}__label-and-toggle`,refreshAction:`${d}__refresh-action`,settings:`${d}__settings`,slider:`${d}__slider`,statusIconContainer:`${d}__status-icon-container`,statusIconWarning:`${d}__status-icon-warning`,switch:`${d}__switch`,switchContainer:`${d}__switch-container`},A={maxAllowableAssociationsSlider:!1};let u=class extends n{constructor(t,s){super(t,s),this._autoRefreshAssociations=!0,this._associationsOptionsEnabled=!1,this._maxAllowableAssociationsSliderMax=1e3,this._maxAllowableAssociationsSliderMin=250,this._maxAllowableAssociationsSliderStep=250,this.messages=null,this.messagesCommon=null,this.viewModel=new r,this.visibleElements={...A}}initialize(){this.addHandles([s((()=>[this.view?.stationary,this.showAssociationsEnabled,this.includeConnectivityAssociations,this.includeStructuralAttachmentAssociations,this.maxAllowableAssociations]),(()=>{!0===this.autoRefreshAssociations&&(!0===this.showAssociationsEnabled?this.viewModel.showAssociations():this.viewModel.removeAssociations())}))])}get autoRefreshAssociations(){return this._autoRefreshAssociations}set autoRefreshAssociations(t){this._autoRefreshAssociations=t}get connectivityAssociationsLineSymbol(){return this.viewModel.connectivityAssociationsLineSymbol}set connectivityAssociationsLineSymbol(t){this.viewModel.connectivityAssociationsLineSymbol=t}get includeConnectivityAssociations(){return this.viewModel.includeConnectivityAssociations}set includeConnectivityAssociations(t){this.viewModel.includeConnectivityAssociations=t}get includeStructuralAttachmentAssociations(){return this.viewModel.includeStructuralAttachmentAssociations}set includeStructuralAttachmentAssociations(t){this.viewModel.includeStructuralAttachmentAssociations=t}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get maxAllowableAssociations(){return this.viewModel.maxAllowableAssociations}set maxAllowableAssociations(t){this.viewModel.maxAllowableAssociations=t}get maxAllowableAssociationsSliderMax(){return this._maxAllowableAssociationsSliderMax}set maxAllowableAssociationsSliderMax(t){t<=this.maxAllowableAssociationsSliderMin||(this._maxAllowableAssociationsSliderMax=t)}get maxAllowableAssociationsSliderMin(){return this._maxAllowableAssociationsSliderMin}set maxAllowableAssociationsSliderMin(t){t<0||t>=this.maxAllowableAssociationsSliderMax||(this._maxAllowableAssociationsSliderMin=t)}get maxAllowableAssociationsSliderStep(){return this._maxAllowableAssociationsSliderStep}set maxAllowableAssociationsSliderStep(t){this._maxAllowableAssociationsSliderStep=t}get showArrowsConnectivity(){return this.viewModel.showArrowsConnectivity}set showArrowsConnectivity(t){this.viewModel.showArrowsConnectivity=t}get showArrowsStructuralAttachment(){return this.viewModel.showArrowsStructuralAttachment}set showArrowsStructuralAttachment(t){this.viewModel.showArrowsStructuralAttachment=t}get showAssociationsEnabled(){return this.viewModel.showAssociationsEnabled}set showAssociationsEnabled(t){this.viewModel.showAssociationsEnabled=t}get structuralAttachmentAssociationsLineSymbol(){return this.viewModel.structuralAttachmentAssociationsLineSymbol}set structuralAttachmentAssociationsLineSymbol(t){this.viewModel.structuralAttachmentAssociationsLineSymbol=t}get utilityNetwork(){return this.viewModel.utilityNetwork}set utilityNetwork(t){this.viewModel.utilityNetwork=t}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}castVisibleElements(t){return{...A,...t}}render(){const{label:t}=this;return c("div",{class:h.container},c("calcite-block",{heading:t,class:h.content,collapsible:!0},this._renderStatusIcon(),this.autoRefreshAssociations?this._renderShowAssociationsSwitch():this._renderRefreshAssociationsAction(),this._renderSettings()))}loadDependencies(){return a({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel.js"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}_connectivityAssociationsSwitchChange(t){this.includeConnectivityAssociations=t.target.checked}_getLoadErrorMessagesAsNotices(t,s){return c("calcite-notice",{key:`error-notice-${s}`,open:!0,closable:!1,kind:"warning",scale:"s"},c("div",{slot:"message"},t))}_maxAllowableAssociationsSliderChange(t){this.maxAllowableAssociations=Number(t.target.value)}_refreshAssociations(){const{viewModel:t,viewModel:{state:s}}=this;"ready"!==s&&"warning"!==s||t.showAssociations()}_renderConnectivityAssociationsToggle(){const{messages:{input:{enableConnectivity:t}}}=this;return c("div",{key:"connectivityAssociationsToggleDiv",class:h.labelAndToggle},c("calcite-label",{class:h.label},t),c("calcite-switch",{bind:this,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,checked:this.includeConnectivityAssociations,onCalciteSwitchChange:this._connectivityAssociationsSwitchChange}))}_renderLoadingAction(t,s,i){return c("div",{key:t,slot:"control"},c("calcite-action",{id:s,text:i,loading:!0}),c("calcite-tooltip",{referenceElement:s,label:i},c("span",null,i)))}_renderMaxAllowableAssociationsSlider(){const{messages:{input:{maxAllowableAssociations:t}},visibleElements:{maxAllowableAssociationsSlider:s}}=this;if(s)return c("div",{class:h.labelAndSlider},c("calcite-label",{class:h.label},t),c("calcite-slider",{bind:this,class:h.slider,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,min:this.maxAllowableAssociationsSliderMin,max:this.maxAllowableAssociationsSliderMax,step:this.maxAllowableAssociationsSliderStep,ticks:this.maxAllowableAssociationsSliderStep,value:this.maxAllowableAssociations,labelTicks:!0,snap:!0,scale:"s",onCalciteSliderChange:this._maxAllowableAssociationsSliderChange}))}_renderRefreshAssociationsAction(){const{messages:{input:{refreshAssociations:t}},messagesCommon:{loading:s},viewModel:{state:i}}=this,e=`${this.id}-refresh-action`;if("disabled"!==i)return c("div",{slot:"control",class:h.refreshAction},c("calcite-action",{id:e,bind:this,class:h.action,icon:"refresh-",text:t,loading:"loading"===i,onclick:this._refreshAssociations}),c("calcite-tooltip",{referenceElement:e,label:"loading"===i?s:t},c("span",null,"loading"===i?s:t)))}_renderSettings(){const{viewModel:{loadErrors:t,state:s}}=this;return"disabled"===s?c("div",{key:"loadErrorsDiv",class:h.controlsContainer},t.items.map(this._getLoadErrorMessagesAsNotices)):c("calcite-panel",{disabled:"loading"===s},c("div",{class:h.settings},this._renderConnectivityAssociationsToggle(),this._renderStructuralAttachmentAssociationsToggle(),this._renderMaxAllowableAssociationsSlider()))}_renderShowAssociationsSwitch(){const{messages:{input:{enableAssociations:t}},messagesCommon:{loading:s},viewModel:{state:i}}=this,e=`${this.id}-show-associations-switch`;if("disabled"!==i)return"loading"===i?this._renderLoadingAction("loadingActionDiv",`${this.id}-loading-action`,s):c("div",{key:"switchDiv",slot:"control",class:h.switchContainer},c("calcite-switch",{id:e,bind:this,class:h.switch,checked:this.showAssociationsEnabled,onCalciteSwitchChange:this._showAssociationsSwitchChange}),c("calcite-tooltip",{referenceElement:e,label:t},c("span",null,t)))}_renderStatusIcon(){const{messagesCommon:{executing:t},viewModel:{executionError:s,state:i}}=this;switch(i){case"disabled":return this._renderWarningIcon("statusDiv",`${this.id}-disabled-icon`,null);case"warning":return this._renderWarningIcon("statusDiv",`${this.id}-warning-icon`,s);case"executing":return this._renderLoadingAction("executingActionDiv",`${this.id}-executing-action`,t);default:return}}_renderStructuralAttachmentAssociationsToggle(){const{messages:{input:{enableStructuralAttachment:t}}}=this;return c("div",{key:"structuralAttachmentAssociationsToggleDiv",class:h.labelAndToggle},c("calcite-label",{class:h.label},t),c("calcite-switch",{bind:this,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,checked:this.includeStructuralAttachmentAssociations,onCalciteSwitchChange:this._structuralAttAssociationsSwitchChange}))}_showAssociationsSwitchChange(t){const{viewModel:s}=this;this.showAssociationsEnabled=t.target.checked,this._associationsOptionsEnabled=t.target.checked,this.showAssociationsEnabled||s.removeAssociations()}_structuralAttAssociationsSwitchChange(t){this.includeStructuralAttachmentAssociations=t.target.checked}_renderWarningIcon(t,s,i){return i?c("div",{key:t,slot:"control",class:h.statusIconContainer},c("calcite-icon",{id:s,icon:"exclamation-mark-triangle",scale:"s",class:h.statusIconWarning}),c("calcite-tooltip",{referenceElement:s,label:i},c("span",null,i))):c("div",{key:t,slot:"control",class:h.statusIconContainer},c("calcite-icon",{id:s,icon:"exclamation-mark-triangle",scale:"s",class:h.statusIconWarning}))}};t([i()],u.prototype,"autoRefreshAssociations",null),t([i()],u.prototype,"connectivityAssociationsLineSymbol",null),t([i()],u.prototype,"includeConnectivityAssociations",null),t([i()],u.prototype,"includeStructuralAttachmentAssociations",null),t([i()],u.prototype,"label",null),t([i()],u.prototype,"maxAllowableAssociations",null),t([i()],u.prototype,"maxAllowableAssociationsSliderMax",null),t([i()],u.prototype,"maxAllowableAssociationsSliderMin",null),t([i()],u.prototype,"maxAllowableAssociationsSliderStep",null),t([i(),l("esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations")],u.prototype,"messages",void 0),t([i(),l("esri/t9n/common")],u.prototype,"messagesCommon",void 0),t([i()],u.prototype,"showArrowsConnectivity",null),t([i()],u.prototype,"showArrowsStructuralAttachment",null),t([i()],u.prototype,"showAssociationsEnabled",null),t([i()],u.prototype,"structuralAttachmentAssociationsLineSymbol",null),t([i()],u.prototype,"utilityNetwork",null),t([i()],u.prototype,"view",null),t([i({type:r})],u.prototype,"viewModel",void 0),t([i()],u.prototype,"visibleElements",void 0),t([e("visibleElements")],u.prototype,"castVisibleElements",null),u=t([o("esri.widgets.UtilityNetworkAssociations")],u);const m=u;export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let r=class extends e{get canZoomIn(){const o=this.view?.ready;if(!o)return!1;const e=this.view?.constraints?.effectiveMaxScale;return 0===e||this._scale>e}get canZoomOut(){const{view:o}=this,e=o?.ready;if(!e)return!1;const t=o.constraints?.effectiveMinScale;return 0===t||this._scale<t}get _scale(){const o=this.view?.animation?.target;return(o&&"then"in o?void 0:o?.scale)??this.view?.scale??0}};o([t({readOnly:!0})],r.prototype,"canZoomIn",null),o([t({readOnly:!0})],r.prototype,"canZoomOut",null),o([t()],r.prototype,"view",void 0),o([t()],r.prototype,"_scale",null),r=o([s("esri.widgets.Zoom.ZoomConditions2D")],r);const c=r;export{c as default};
|