@arcgis/core 4.33.0-next.20250410 → 4.33.0-next.20250412
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/{1364744b15b327abd5a1.js → 37716880cef8155259f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{ccb289911e7445b17763.js → 3a84ee5d0434362286a6.js} +10 -10
- package/assets/esri/core/workers/chunks/4deeeceb784e4390441d.js +1 -0
- package/assets/esri/core/workers/chunks/5a991c8e0febb0cf9be1.js +1 -0
- package/assets/esri/core/workers/chunks/7f86c9ec45f4fae1fb49.js +1 -0
- package/assets/esri/core/workers/chunks/{b06e3ba73f353592c81d.js → b6361cec92003997bfe5.js} +1 -1
- package/assets/esri/core/workers/chunks/{4bbe6160eda3fb5d58ec.js → d88544ac332be633e3fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{35ab75010817f1525e54.js → e6a97f9b6f7be8076f85.js} +1 -1
- package/assets/esri/core/workers/chunks/{5fa5bfc70512994f5ec1.js → e7cb4003c45e42b48ea6.js} +1 -1
- package/assets/esri/core/workers/chunks/{b308bef7ff08e0e635b5.js → fe1ad9ed0d32f557e5a3.js} +23 -23
- package/assets/esri/themes/base/widgets/_BuildingDisciplinesTree.scss +0 -1
- 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/chunks/BloomBlur.glsl.js +4 -6
- package/chunks/BloomComposition.glsl.js +12 -12
- package/editing/sharedTemplates/executor/createTemplateExecutor.js +1 -1
- package/interfaces.d.ts +47 -2
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CurveHelper.js +1 -1
- package/symbols/cim/GeometryWalker.js +1 -1
- package/symbols/cim/placements/PlacementAtExtremities.js +1 -1
- package/symbols/cim/placements/PlacementOnLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/utils.js +1 -1
- package/views/3d/layers/ElevationLayerView3D.js +1 -1
- package/views/3d/layers/ElevationLayerView3DModifications.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TextureFader.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/TileTexture.js +1 -1
- package/views/3d/webgl/formats.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomPresets.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RendererBase.js +5 -0
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoCache.js +1 -1
- package/views/FocusAreas.js +1 -1
- package/views/webgl/VertexArrayObject.js +1 -1
- package/views/webgl/enums.js +1 -1
- package/views/webgl/textureUtils.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/Search.js +1 -1
- package/assets/esri/core/workers/chunks/386ea90e87254b0282ec.js +0 -1
- package/assets/esri/core/workers/chunks/4046ec636723c20d3e28.js +0 -1
- package/assets/esri/core/workers/chunks/ec83af4fb3bf59df7759.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../Widget.js";import t from"./BuildingDisciplinesNode.js";import{loadCalciteComponents as r}from"../../support/componentsUtils.js";import"../../support/widgetUtils.js";import{tsx as l}from"../../support/jsxFactory.js";const p={expand:"expand",collapse:"collapse",hideSublayer:"hideSublayer",showSublayer:"showSublayer"},c={base:"esri-building-disciplines-tree"};let n=class extends o{constructor(e){super(e),this.toggleSiblingsVisibility=!1}loadDependencies(){return Promise.allSettled([r({tree:()=>import("@esri/calcite-components/dist/components/calcite-tree")}),t.loadDependencies()])}static{this.vnodeSelector="calcite-tree"}render(){const{vm:e}=this,s=this.toggleSiblingsVisibility,i=this.messages??p;return l("calcite-tree",{class:c.base,
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../Widget.js";import t from"./BuildingDisciplinesNode.js";import{loadCalciteComponents as r}from"../../support/componentsUtils.js";import"../../support/widgetUtils.js";import{tsx as l}from"../../support/jsxFactory.js";const p={expand:"expand",collapse:"collapse",hideSublayer:"hideSublayer",showSublayer:"showSublayer"},c={base:"esri-building-disciplines-tree"};let n=class extends o{constructor(e){super(e),this.toggleSiblingsVisibility=!1}loadDependencies(){return Promise.allSettled([r({tree:()=>import("@esri/calcite-components/dist/components/calcite-tree")}),t.loadDependencies()])}static{this.vnodeSelector="calcite-tree"}render(){const{vm:e}=this,s=this.toggleSiblingsVisibility,i=this.messages??p;return l("calcite-tree",{class:c.base,lines:!0,selectionMode:"none"},e.root.children.toArray().filter((e=>!e.isDiscipline||e.hasChildren)).reverse().map((e=>l(t,{messages:i,node:e,toggleSiblingsVisibility:s}))))}};e([s()],n.prototype,"vm",void 0),e([s()],n.prototype,"messages",void 0),e([s()],n.prototype,"toggleSiblingsVisibility",void 0),n=e([i("esri.widgets.BuildingExplorer.BuildingDisciplinesTree.BuildingDisciplinesTree")],n);const a=n;export{a 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../core/has.js";import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{convertDateFormatToIntlOptions as n,formatDate as r}from"../../../intl/date.js";import{formatNumber as i,convertNumberFormatToIntlOptions as o}from"../../../intl/number.js";import{isRasterPixelValueField as a,featureHasFields as l,isTimeOnlyField as u}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as s}from"../../../layers/support/layerUtils.js";import{formatAnyDate as f,isAnyDateField as c}from"../../../smartMapping/support/utils.js";import{loadArcade as d}from"../../../support/loadArcade.js";import{getTimeZoneFormattingOptions as p}from"../../../time/timeZoneUtils.js";const y="esri.widgets.Feature.support.featureUtils",m=()=>e.getLogger(y),b=/href=(""|'')/gi,g=/(\{([^{\r\n]+)\})/g,I=/'/g,h=/^\s*expression\//i,w=/(\n)/gi,T=/[\u00A0-\u9999<>&]/gim,F=/href\s*=\s*(?:"([^"]+)"|'([^']+)')/gi,j=/^(?:mailto:|tel:)/,N="relationships/",Z=n("short-date-short-time");function L(e){if(null!=e)return(e.sourceLayer||e.layer)??void 0}async function q({type:e,value:t,event:n}){try{return"function"==typeof t?t(n):await t}catch(r){return void m().error("error",`An error occurred when calling the "${e}" function`,{error:r,graphic:n.graphic,value:t})}}function x(e=""){if(e)return!j.test(e.trim().toLowerCase())}function E(e){return!!e&&h.test(e)}function v(e,t){if(!t||!E(t)||!e)return;const n=t.replace(h,"").toLowerCase();return e.find((({name:e})=>e.toLowerCase()===n))}function A(e,t){const n=v(t,e?.fieldName);return n?n.title||null:e?e.label||e.fieldName:null}function C(e,t){const n=t.get(e.toLowerCase());return`{${n?.fieldName||e}}`}function U(e){return e.replaceAll(b,"")}function M(e,t){const n=$(t,e);return n?n.name:e}function R(e,t){return e&&e.map((e=>M(e,t)))}function $(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function k(e){return`${e}`.trim()}function D({attributes:e,globalAttributes:t,layer:n,text:r,expressionAttributes:i,fieldInfoMap:o}){return r?z({formattedAttributes:t,template:P(r,{...t,...i,...e},n),fieldInfoMap:o}):""}function z({formattedAttributes:e,template:n,fieldInfoMap:r}){return k(U(t(t(n,(e=>C(e,r))),e)))}function O(e,t,n=!1){const r=t[e];if("string"==typeof r){const i="%27",o=(n?encodeURIComponent(r):r).replaceAll(I,i);t[e]=o}}function G(e,t=!1){const n={...e};return Object.keys(n).forEach((e=>O(e,n,t))),n}function S(e,n,r){const i=(n=k(n))&&"{"!==n[0];return t(e,G(r,i||!1))}function Q(e,t){return e.replaceAll(g,((e,n,r)=>{const i=$(t,r);return i?`{${i.name}}`:n}))}function P(e,t,n){const r=Q(e,n);return r?r.replaceAll(F,((e,n,r)=>S(e,n||r,t))):r}function _(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function H(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&("feature"===e.type||"scene"===e.type||"subtype-group"===e.type||"subtype-sublayer"===e.type||"sublayer"===e.type)&&"when"in e}function B(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function J(e){return H(e)&&B(e)}function K(e){return!(!(e&&"object"==typeof e&&"createQuery"in e&&"getField"in e&&"queryFeatureCount"in e&&"queryFeatures"in e&&"queryObjectIds"in e&&"capabilities"in e&&"fields"in e&&"fieldsIndex"in e&&"type"in e)||"feature"!==e.type&&"subtype-group"!==e.type&&"subtype-sublayer"!==e.type&&"sublayer"!==e.type||!("when"in e))&&("subtype-sublayer"===e.type&&"parent"in e&&e.parent&&"object"==typeof e.parent?"globalIdField"in e.parent:"globalIdField"in e)}function V(e){return!!e&&"object"==typeof e&&"sourceLayer"in e&&J(e.sourceLayer)}function W(e,t){const{fieldInfos:n,fieldName:r,preventPlacesFormatting:l,layer:u,timeZone:s}=t,c=ee(n,r),d=$(u,r);if(c&&!a(r)){const t=d?.type,n=c.format?.dateFormat;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t||n)return f(e,{format:n,fieldType:t,timeZoneOptions:{layerTimeZone:u&&"preferredTimeZone"in u?u.preferredTimeZone:null,viewTimeZone:s,datesInUnknownTimezone:!(!u||!("datesInUnknownTimezone"in u))&&!!u.datesInUnknownTimezone}})}const p=c?.format;return"string"==typeof e&&a(r)&&p?X(e,p):"string"==typeof(e=_(e,p))||null==e||null==p?le(e):i(e,l?{...o(p),minimumFractionDigits:0,maximumFractionDigits:20}:o(p))}function X(e,t){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(",")?Y(e,",",", ",t):e.includes(";")?Y(e,";","; ",t):e.includes(" ")?Y(e," "," ",t):i(Number(e),o(t))}function Y(e,t,n,r){return e.trim().split(t).map((e=>i(Number(e),o(r)))).join(n)}function ee(e,t){if(e?.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function te({fieldName:e,graphic:t,layer:n}){if(pe(e))return null;if(!n||"function"!=typeof n.getFeatureType)return null;const{typeIdField:r}=n;if(!r||e!==r)return null;const i=n.getFeatureType(t);return i?i.name:null}function ne({fieldName:e,value:t,graphic:n,layer:r}){if(pe(e))return null;if(!r||"function"!=typeof r.getFieldDomain)return null;const i=n&&r.getFieldDomain(e,{feature:n,excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")});return i&&"coded-value"===i.type?i.getName(t):null}function re(e,t,n,i){const{creatorField:o,creationDateField:a,editorField:l,editDateField:u}=e;if(!t)return;const s=p(i&&"preferredTimeZone"in i?i.preferredTimeZone:null,!(!i||!("datesInUnknownTimezone"in i))&&!!i.datesInUnknownTimezone,n,Z,"date"),f={...Z,...s},c=t[u];if("number"==typeof c){const e=t[l];return{type:"edit",date:r(c,f),user:e}}const d=t[a];if("number"==typeof d){const e=t[o];return{type:"create",date:r(d,f),user:e}}return null}function ie(e,t){const n=new Map;if(!e)return n;for(const r of e){if(!r.fieldName)continue;const e=M(r.fieldName,t);r.fieldName=e,n.set(e.toLowerCase(),r)}return n}function oe(e){const t=[];if(!e)return t;const{fieldInfos:n,content:r}=e;return n&&t.push(...n),r&&Array.isArray(r)?(r.forEach((e=>{if("fields"===e.type){const n=e?.fieldInfos;n&&t.push(...n)}})),t):t}function ae(e){return e.replaceAll(T,(e=>`&#${e.charCodeAt(0)};`))}function le(e){return"string"==typeof e?e.replaceAll(w,'<br class="esri-text-new-line" />'):e}function ue(e){const{value:t,fieldName:n,fieldInfos:r,fieldInfoMap:i,layer:o,graphic:a,timeZone:l}=e;if(null==t)return"";const s=ne({fieldName:n,value:t,graphic:a,layer:o});if(s)return s;const d=te({fieldName:n,graphic:a,layer:o});if(d)return d;if(i.get(n.toLowerCase()))return W(t,{fieldInfos:r||Array.from(i.values()),fieldName:n,layer:o,timeZone:l});const p=o?.fieldsIndex?.get(n);return p&&(c(p)||u(p))?f(t,{fieldType:p.type,timeZoneOptions:{layerTimeZone:o&&"preferredTimeZone"in o?o.preferredTimeZone:null,viewTimeZone:l,datesInUnknownTimezone:!(!o||!("datesInUnknownTimezone"in o))&&!!o.datesInUnknownTimezone}}):le(t)}function se({fieldInfos:e,attributes:t,layer:n,graphic:r,fieldInfoMap:i,relatedInfos:o,timeZone:a}){const l={};return o?.forEach((t=>be({attributes:l,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:n,timeZone:a}))),t&&Object.keys(t).forEach((o=>{const u=t[o];l[o]=ue({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:n,value:u,graphic:r,timeZone:a})})),l}async function fe(e,t){const{layer:n,graphic:r,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,u=o[0];if("number"!=typeof u&&"string"!=typeof u){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:n,graphic:r,objectId:u,requiredFields:i};return m().warn(e,t),null}if(!s(n)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:n,graphic:r,requiredFields:i,returnGeometry:a};return m().warn(e,t),null}const f=n.createQuery();f.objectIds=o,f.outFields=i?.length?i:[n.objectIdField],f.returnGeometry=!!a,f.returnZ=!!a,f.returnM=!!a,f.outSpatialReference=l;return(await n.queryFeatures(f,t)).features[0]}async function ce(e){if(!e.expressionInfos?.length)return!1;const t=await d(),{arcadeUtils:{hasGeometryFunctions:n}}=t;return n(e)}async function de({graphic:e,popupTemplate:t,layer:n,spatialReference:r},i){if(!n||!t)return;if("function"==typeof n.load&&await n.load(i),!e.attributes)return;const o=n.objectIdField,a=e.attributes[o];if(null==a)return;const u=[a],s=await t.getRequiredFields(n.fieldsIndex),f=l(s,e),c=f?[]:s.includes(o)?s:[...s,o],d=t.returnGeometry||await ce(t);if(f&&!d)return;const p=await fe({layer:n,graphic:e,outFields:c,objectIds:u,returnGeometry:d,spatialReference:r},i);p&&(p.geometry&&(e.geometry=p.geometry),p.attributes&&(e.attributes={...e.attributes,...p.attributes}))}function pe(e=""){return!!e&&e.includes(N)}function ye(e){return`${N}${e.layerId}/${e.fieldName}`}function me({attributes:e,graphic:t,relatedInfo:n,fieldInfos:r,fieldInfoMap:i,layer:o,timeZone:a}){e&&t&&n&&Object.keys(t.attributes).forEach((l=>{const u=ye({layerId:n.relation.id.toString(),fieldName:l}),s=t.attributes[l];e[u]=ue({fieldName:u,fieldInfos:r,fieldInfoMap:i,layer:o,value:s,graphic:t,timeZone:a})}))}function be({attributes:e,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}){e&&t&&(t.relatedFeatures?.forEach((a=>me({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))),t.relatedStatsFeatures?.forEach((a=>me({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))))}const ge=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},Ie=({layer:e,method:t,query:n,definitionExpression:r})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=n.where?n.where:null,o=null!=n.geometry?n.geometry:null;ge(r)||ge(i)||"extent"===o?.type||"tile"===n.resultType||(n.cacheHint=!0)},he=({query:e,layer:t,method:n})=>{Ie({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})},we=({queryPayload:e,layer:t,method:n})=>{Ie({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})};function Te(e,t,n){return e&&t&&n?"sublayer"===t.type?Ne({layers:t.layer?.sublayers,map:e,relatedLayer:t,relationship:n})||Ne({layers:t.layer?.subtables,map:e,relatedLayer:t,relationship:n}):Ne({layers:e.allLayers,map:e,relatedLayer:t,relationship:n})||Ne({layers:e.allTables,map:e,relatedLayer:t,relationship:n}):null}function Fe(e,t){return e&&"utilityNetworks"in e&&t?e.utilityNetworks?.find((e=>e.isUtilityLayer(t))):null}function je(e,t){return e?.allTables.find((e=>"feature"===e.type&&e.layerId===t.id&&e.url===t.layer?.url))}function Ne({map:e,relationship:t,relationship:{relatedTableId:n},relatedLayer:r,layers:i}){if(!i)return null;for(const o of i){if("map-image"===o.type){const n=Ne({layers:o.sublayers,map:e,relatedLayer:r,relationship:t})||Ne({layers:o.subtables,map:e,relatedLayer:r,relationship:t});if(n)return n;continue}if(!J(o))continue;if("sublayer"===r.type){if(o!==r&&o.id===n)return o.isTable?je(e,o):o;continue}const i="scene"===r.type&&r.associatedLayer?r.associatedLayer.url:r.url;if(!i)return null;if("sublayer"!==o.type){if(o!==r&&o.url===i&&o.layerId===n)return o}else if(o!==r&&o.layer?.url===i&&o.id===n)return o.isTable?je(e,o):o}return null}function Ze(e){const t=e.getObjectId();return null!=t?`oid:${t}`:`uid:${e.uid}`}export{le as applyTextFormattingHTML,ie as createFieldInfoMap,Te as findRelatedLayer,Fe as findUtilityNetwork,Q as fixTokens,se as formatAttributes,re as formatEditInfo,W as formatValueToFieldInfo,oe as getAllFieldInfos,ee as getFieldInfo,A as getFieldInfoLabel,M as getFixedFieldName,R as getFixedFieldNames,Ze as getHighlightKeyForFeature,L as getSourceLayer,q as graphicCallback,ae as htmlEntities,K as isAssociatedFeatureSupportedLayer,E as isExpressionField,H as isFeatureSupportedLayer,V as isGraphicForRelatableFeatureSupportedLayer,J as isRelatableFeatureSupportedLayer,B as isRelatableLayer,pe as isRelatedField,he as preLayerQueryCallback,we as preRequestCallback,fe as querySourceLayer,de as queryUpdatedFeature,x as shouldOpenInNewTab,z as substituteAttributes,D as substituteFieldsInLinksAndAttributes};
|
|
5
|
+
import has from"../../../core/has.js";import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{convertDateFormatToIntlOptions as n,formatDate as r}from"../../../intl/date.js";import{formatNumber as i,convertNumberFormatToIntlOptions as o}from"../../../intl/number.js";import{isRasterPixelValueField as a,featureHasFields as l,isTimeOnlyField as u}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as s}from"../../../layers/support/layerUtils.js";import{formatAnyDate as f,isAnyDateField as c}from"../../../smartMapping/support/utils.js";import{loadArcade as d}from"../../../support/loadArcade.js";import{getTimeZoneFormattingOptions as p}from"../../../time/timeZoneUtils.js";const y="esri.widgets.Feature.support.featureUtils",m=()=>e.getLogger(y),b=/href=(""|'')/gi,g=/(\{([^{\r\n]+)\})/g,I=/'/g,h=/^\s*expression\//i,w=/(\n)/gi,T=/[\u00A0-\u9999<>&]/gim,F=/href\s*=\s*(?:"([^"]+)"|'([^']+)')/gi,j=/^(?:mailto:|tel:)/,N="relationships/",Z=n("short-date-short-time");function L(e){if(null!=e)return(e.sourceLayer||e.layer)??void 0}async function q({type:e,value:t,event:n}){try{return"function"==typeof t?t(n):await t}catch(r){return void m().error("error",`An error occurred when calling the "${e}" function`,{error:r,graphic:n.graphic,value:t})}}function x(e=""){if(e)return!j.test(e.trim().toLowerCase())}function E(e){return!!e&&h.test(e)}function v(e,t){if(!t||!E(t)||!e)return;const n=t.replace(h,"").toLowerCase();return e.find((({name:e})=>e.toLowerCase()===n))}function A(e,t){const n=v(t,e?.fieldName);return n?n.title||null:e?e.label||e.fieldName:null}function C(e,t){const n=t.get(e.toLowerCase());return`{${n?.fieldName||e}}`}function U(e){return e.replaceAll(b,"")}function M(e,t){const n=$(t,e);return n?n.name:e}function R(e,t){return e&&e.map((e=>M(e,t)))}function $(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function k(e){return`${e}`.trim()}function D({attributes:e,globalAttributes:t,layer:n,text:r,expressionAttributes:i,fieldInfoMap:o}){return r?z({formattedAttributes:t,template:P(r,{...t,...i,...e},n),fieldInfoMap:o}):""}function z({formattedAttributes:e,template:n,fieldInfoMap:r}){return k(U(t(t(n,(e=>C(e,r))),e)))}function O(e,t,n=!1){const r=t[e];if("string"==typeof r){const i="%27",o=(n?encodeURIComponent(r):r).replaceAll(I,i);t[e]=o}}function G(e,t=!1){const n={...e};return Object.keys(n).forEach((e=>O(e,n,t))),n}function S(e,n,r){const i=(n=k(n))&&"{"!==n[0];return t(e,G(r,i||!1))}function Q(e,t){return e.replaceAll(g,((e,n,r)=>{const i=$(t,r);return i?`{${i.name}}`:n}))}function P(e,t,n){const r=Q(e,n);return r?r.replaceAll(F,((e,n,r)=>S(e,n||r,t))):r}function _(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function H(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&("feature"===e.type||"scene"===e.type||"subtype-group"===e.type||"subtype-sublayer"===e.type||"sublayer"===e.type)&&"when"in e}function B(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function J(e){return H(e)&&B(e)}function K(e){return!(!(e&&"object"==typeof e&&"createQuery"in e&&"getField"in e&&"queryFeatureCount"in e&&"queryFeatures"in e&&"queryObjectIds"in e&&"capabilities"in e&&"fields"in e&&"fieldsIndex"in e&&"type"in e)||"feature"!==e.type&&"subtype-group"!==e.type&&"subtype-sublayer"!==e.type&&"sublayer"!==e.type||!("when"in e))&&("subtype-sublayer"===e.type&&"parent"in e&&e.parent&&"object"==typeof e.parent?"globalIdField"in e.parent:"globalIdField"in e)}function V(e){return!!e&&"object"==typeof e&&"sourceLayer"in e&&J(e.sourceLayer)}function W(e,t){const{fieldInfos:n,fieldName:r,preventPlacesFormatting:l,layer:u,timeZone:s}=t,c=ee(n,r),d=$(u,r);if(c&&!a(r)){const t=d?.type,n=c.format?.dateFormat;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t||n)return f(e,{format:n,fieldType:t,timeZoneOptions:{layerTimeZone:u&&"preferredTimeZone"in u?u.preferredTimeZone:null,viewTimeZone:s,datesInUnknownTimezone:!(!u||!("datesInUnknownTimezone"in u))&&!!u.datesInUnknownTimezone}})}const p=c?.format;return"string"==typeof e&&a(r)&&p?X(e,p):"string"==typeof(e=_(e,p))||null==e||null==p?le(e):i(e,l?{...o(p),minimumFractionDigits:0,maximumFractionDigits:20}:o(p))}function X(e,t){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(",")?Y(e,",",", ",t):e.includes(";")?Y(e,";","; ",t):e.includes(" ")?Y(e," "," ",t):i(Number(e),o(t))}function Y(e,t,n,r){return e.trim().split(t).map((e=>i(Number(e),o(r)))).join(n)}function ee(e,t){if(e?.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function te({fieldName:e,graphic:t,layer:n}){if(pe(e))return null;if(!n||"function"!=typeof n.getFeatureType)return null;const{typeIdField:r}=n;if(!r||e!==r)return null;const i=n.getFeatureType(t);return i?i.name:null}function ne({fieldName:e,value:t,graphic:n,layer:r}){if(pe(e))return null;if(!r||"function"!=typeof r.getFieldDomain)return null;const i=n&&r.getFieldDomain(e,{feature:n,excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")});return i&&"coded-value"===i.type?i.getName(t):null}function re(e,t,n,i){const{creatorField:o,creationDateField:a,editorField:l,editDateField:u}=e;if(!t)return;const s=p(i&&"preferredTimeZone"in i?i.preferredTimeZone:null,!(!i||!("datesInUnknownTimezone"in i))&&!!i.datesInUnknownTimezone,n,Z,"date"),f={...Z,...s},c=t[u];if("number"==typeof c){const e=t[l];return{type:"edit",date:r(c,f),user:e}}const d=t[a];if("number"==typeof d){const e=t[o];return{type:"create",date:r(d,f),user:e}}return null}function ie(e,t){const n=new Map;if(!e)return n;for(const r of e){if(!r.fieldName)continue;const e=M(r.fieldName,t);r.fieldName=e,n.set(e.toLowerCase(),r)}return n}function oe(e){const t=[];if(!e)return t;const{fieldInfos:n,content:r}=e;return n&&t.push(...n),r&&Array.isArray(r)?(r.forEach((e=>{if("fields"===e.type){const n=e?.fieldInfos;n&&t.push(...n)}})),t):t}function ae(e){return e.replaceAll(T,(e=>`&#${e.charCodeAt(0)};`))}function le(e){return"string"==typeof e?e.replaceAll(w,'<br class="esri-text-new-line" />'):e}function ue(e){const{value:t,fieldName:n,fieldInfos:r,fieldInfoMap:i,layer:o,graphic:a,timeZone:l}=e;if(null==t)return"";const s=ne({fieldName:n,value:t,graphic:a,layer:o});if(s)return s;const d=te({fieldName:n,graphic:a,layer:o});if(d)return d;if(i.get(n.toLowerCase()))return W(t,{fieldInfos:r||Array.from(i.values()),fieldName:n,layer:o,timeZone:l});const p=o?.fieldsIndex?.get(n);return p&&(c(p)||u(p))?f(t,{fieldType:p.type,timeZoneOptions:{layerTimeZone:o&&"preferredTimeZone"in o?o.preferredTimeZone:null,viewTimeZone:l,datesInUnknownTimezone:!(!o||!("datesInUnknownTimezone"in o))&&!!o.datesInUnknownTimezone}}):le(t)}function se({fieldInfos:e,attributes:t,layer:n,graphic:r,fieldInfoMap:i,relatedInfos:o,timeZone:a}){const l={};return o?.forEach((t=>be({attributes:l,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:n,timeZone:a}))),t&&Object.keys(t).forEach((o=>{const u=t[o];l[o]=ue({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:n,value:u,graphic:r,timeZone:a})})),l}async function fe(e,t){const{layer:n,graphic:r,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,u=o[0];if("number"!=typeof u&&"string"!=typeof u){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:n,graphic:r,objectId:u,requiredFields:i};return m().warn(e,t),null}if(!s(n)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:n,graphic:r,requiredFields:i,returnGeometry:a};return m().warn(e,t),null}const f=n.createQuery();f.objectIds=o,f.outFields=i?.length?i:[n.objectIdField],f.returnGeometry=!!a,f.returnZ=!!a,f.returnM=!!a,f.outSpatialReference=l;return(await n.queryFeatures(f,t)).features[0]}async function ce(e){if(!e.expressionInfos?.length)return!1;const t=await d(),{arcadeUtils:{hasGeometryFunctions:n}}=t;return n(e)}async function de({graphic:e,popupTemplate:t,layer:n,spatialReference:r},i){if(!n||!t)return;if("function"==typeof n.load&&await n.load(i),!e.attributes)return;const o=n.objectIdField,a=e.attributes[o];if(null==a)return;const u=[a],s=await t.getRequiredFields(n.fieldsIndex),f=l(s,e),c=f?[]:s.includes(o)?s:[...s,o],d=t.returnGeometry||await ce(t);if(f&&!d)return;const p=await fe({layer:n,graphic:e,outFields:c,objectIds:u,returnGeometry:d,spatialReference:r},i);p&&(p.geometry&&(e.geometry=p.geometry),p.attributes&&(e.attributes={...e.attributes,...p.attributes}))}function pe(e=""){return!!e&&e.includes(N)}function ye(e){return`${N}${e.layerId}/${e.fieldName}`}function me({attributes:e,graphic:t,relatedInfo:n,fieldInfos:r,fieldInfoMap:i,layer:o,timeZone:a}){e&&t&&n&&Object.keys(t.attributes).forEach((l=>{const u=ye({layerId:n.relation.id.toString(),fieldName:l}),s=t.attributes[l];e[u]=ue({fieldName:u,fieldInfos:r,fieldInfoMap:i,layer:o,value:s,graphic:t,timeZone:a})}))}function be({attributes:e,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}){e&&t&&(t.relatedFeatures?.forEach((a=>me({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))),t.relatedStatsFeatures?.forEach((a=>me({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))))}const ge=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},Ie=({layer:e,method:t,query:n,definitionExpression:r})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=n.where?n.where:null,o=null!=n.geometry?n.geometry:null;ge(r)||ge(i)||"extent"===o?.type||"tile"===n.resultType||(n.cacheHint=!0)},he=({query:e,layer:t,method:n})=>{Ie({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})},we=({queryPayload:e,layer:t,method:n})=>{Ie({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})};function Te(e,t,n){return e&&t&&n?"sublayer"===t.type?Ne({layers:t.layer?.allSublayers,map:e,relatedLayer:t,relationship:n})||Ne({layers:t.layer?.subtables,map:e,relatedLayer:t,relationship:n}):Ne({layers:e.allLayers,map:e,relatedLayer:t,relationship:n})||Ne({layers:e.allTables,map:e,relatedLayer:t,relationship:n}):null}function Fe(e,t){return e&&"utilityNetworks"in e&&t?e.utilityNetworks?.find((e=>e.isUtilityLayer(t))):null}function je(e,t){return e?.allTables.find((e=>"feature"===e.type&&e.layerId===t.id&&e.url===t.layer?.url))}function Ne({map:e,relationship:t,relationship:{relatedTableId:n},relatedLayer:r,layers:i}){if(!i)return null;for(const o of i){if("map-image"===o.type){const n=Ne({layers:o.sublayers,map:e,relatedLayer:r,relationship:t})||Ne({layers:o.subtables,map:e,relatedLayer:r,relationship:t});if(n)return n;continue}if(!J(o))continue;if("sublayer"===r.type){if(o!==r&&o.id===n)return o.isTable?je(e,o):o;continue}const i="scene"===r.type&&r.associatedLayer?r.associatedLayer.url:r.url;if(!i)return null;if("sublayer"!==o.type){if(o!==r&&o.url===i&&o.layerId===n)return o}else if(o!==r&&o.layer?.url===i&&o.id===n)return o.isTable?je(e,o):o}return null}function Ze(e){const t=e.getObjectId();return null!=t?`oid:${t}`:`uid:${e.uid}`}export{le as applyTextFormattingHTML,ie as createFieldInfoMap,Te as findRelatedLayer,Fe as findUtilityNetwork,Q as fixTokens,se as formatAttributes,re as formatEditInfo,W as formatValueToFieldInfo,oe as getAllFieldInfos,ee as getFieldInfo,A as getFieldInfoLabel,M as getFixedFieldName,R as getFixedFieldNames,Ze as getHighlightKeyForFeature,L as getSourceLayer,q as graphicCallback,ae as htmlEntities,K as isAssociatedFeatureSupportedLayer,E as isExpressionField,H as isFeatureSupportedLayer,V as isGraphicForRelatableFeatureSupportedLayer,J as isRelatableFeatureSupportedLayer,B as isRelatableLayer,pe as isRelatedField,he as preLayerQueryCallback,we as preRequestCallback,fe as querySourceLayer,de as queryUpdatedFeature,x as shouldOpenInNewTab,z as substituteAttributes,D as substituteFieldsInLinksAndAttributes};
|
package/widgets/Features.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import i from"../core/Logger.js";import{ignoreAbortErrors as o}from"../core/promiseUtils.js";import{watch as s,when as n,initial as r}from"../core/reactiveUtils.js";import{waitAnimationFrame as l}from"../core/scheduling.js";import{throttle as a}from"../core/throttle.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{getPointFromGeometry as u}from"../geometry/support/geometryUtils.js";import{loadActionUtilsComponents as h,substituteActionImage as p,getActionStyles as m,renderAction as v}from"../support/actions/actionUtils.js";import g from"./Feature.js";import w from"./Spinner.js";import _ from"./Widget.js";import{css as M}from"./Feature/resources.js";import{FeatureContentMixin as f}from"./Feature/support/FeatureContentMixin.js";import{css as F}from"./Features/css.js";import y from"./Features/FeaturesDrillIn.js";import b from"./Features/FeaturesViewModel.js";import I from"./Features/FeaturesVisibleElements.js";import{ActionsCollection as C}from"./Popup/actions.js";import{zoomToLocation as x}from"./Popup/actionUtils.js";import{loadCalciteComponents as A}from"./support/componentsUtils.js";import{globalCss as N}from"./support/globalCss.js";import{Heading as T}from"./support/Heading.js";import{setFocus as k}from"./support/widgetUtils.js";import{messageBundle as O}from"./support/decorators/messageBundle.js";import{vmEvent as E}from"./support/decorators/vmEvent.js";import{tsx as j}from"./support/jsxFactory.js";import{substitute as L}from"../intl/substitute.js";import{formatNumber as W}from"../intl/number.js";const D="selected-index",B=0,S="features-spinner";function R(e){return e?.declaredClass.startsWith("esri.layers.")??!1}let H=class extends(f(_)){constructor(e,i){super(e,i),this._featureMenuIntersectionObserverCallback=([e])=>{e?.isIntersecting&&null!=this.viewModel.featurePage&&this.viewModel.featurePage++},this._featureMenuIntersectionObserver=new IntersectionObserver(this._featureMenuIntersectionObserverCallback,{root:window.document}),this._featureMenuIntersectionObserverNode=null,this._spinner=null,this._feature=null,this._focusAbortController=null,this._drillInFlowItems=new t,this._drillInWidget=new y({flowItems:this._drillInFlowItems}),this._rootNode=null,this._rootFlowItemNode=null,this._featureMenuViewportNode=null,this._actionBarMenuNode=null,this.collapsed=!1,this.featureNavigationTop=!1,this.headerActions=new C,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.responsiveActionsEnabled=!1,this.viewModel=new b,this.visibleElements=new I,this._previousFeature=()=>{this.viewModel.previous()},this._nextFeature=()=>{this.viewModel.next()},this._handleFeatureBack=()=>{"list"===this.initialDisplayMode?(this.selectedFeatureIndex=-1,this._focusFlowItemNode()):this._openFeatureMenu()},this._handleFeatureMenuBack=()=>{"list"===this.initialDisplayMode?(this.selectedFeatureIndex=-1,this._focusFlowItemNode()):this.featureMenuOpen&&this._closeFeatureMenu()},this._storeRootNode=e=>{this._rootNode=e},this._displaySpinnerThrottled=a((()=>this._displaySpinner()),B),this._addSelectedFeatureIndexHandle(),this.addHandles([this._displaySpinnerThrottled,s((()=>this.viewModel?.active),(()=>this._toggleScreenLocationEnabled())),s((()=>this.viewModel?.active),(e=>this._drillInWidget.closed=!e)),s((()=>this.visibleElements?.closeButton),(e=>this._drillInWidget.closable=e)),s((()=>this.visibleElements?.spinner),(e=>this._spinnerEnabledChange(e))),s((()=>this.viewModel?.view),((e,t)=>this._viewChange(e,t))),s((()=>this.viewModel?.view?.ready),((e,t)=>this._viewReadyChange(e??!1,t??!1))),s((()=>[this.viewModel?.waitingForResult,this.viewModel?.location]),(()=>{this._hideSpinner(),this._displaySpinnerThrottled()})),s((()=>this.viewModel?.screenLocation),(()=>this._closeOpenActionMenu())),s((()=>this.selectedFeatureWidget),(()=>this._destroyDrillInFlowItemWidgets())),s((()=>this.featureMenuOpen),(()=>this._drillInWidget.selectLastFlowItem="list"===this.initialDisplayMode||!this.featureMenuOpen),r),s((()=>{const e=this.selectedFeatureWidget?.viewModel;return[e?.title,e?.state]}),(()=>this._setTitleFromFeatureWidget())),s((()=>{const e=this.selectedFeatureWidget?.viewModel;return[e?.content,e?.state]}),(()=>this._setContentFromFeatureWidget())),s((()=>this.viewModel?.featureViewModels),(()=>this._featureMenuViewportScrollTop())),s((()=>this._drillInFlowItems.length),(()=>this._focusFlowItemNode())),this._drillInWidget.on("close",(()=>this.close())),this._drillInWidget.on("exit",(()=>this._destroyDrillInFlowItemWidgets())),this._drillInWidget.on("open-feature",(({feature:e})=>this._openRelatedFeature(e))),this._drillInWidget.on("zoom-to-feature",(({featureWidget:e})=>x(this.viewModel,e)))])}loadDependencies(){return Promise.all([h(),A({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),"list-item-group":()=>import("@esri/calcite-components/dist/components/calcite-list-item-group"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})])}destroy(){this._destroyDrillInFlowItemWidgets(),this._destroySelectedFeatureWidget(),this._destroySpinner(),this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver?.disconnect(),this._drillInWidget?.destroy(),this._focusAbortController?.abort()}get _hideActionText(){if(!this.responsiveActionsEnabled)return!1;const e=this.view?.widthBreakpoint;return"xsmall"===e||"small"===e||"medium"===e}get _featureNavigationVisible(){return this.viewModel.active&&this.viewModel.featureCount>1&&!!this.viewModel.selectedFeature&&this.visibleElements.featureNavigation}get _isCollapsed(){return this._collapseEnabled&&this.collapsed}get _collapseEnabled(){return this.visibleElements.collapseButton&&("list"===this.initialDisplayMode||!!this.title&&!!this.content)}get active(){return this.viewModel.active}get content(){return this.viewModel.content}set content(e){this.viewModel.content=e}get icon(){return null}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(e){this.viewModel.featureMenuOpen=e}get featureMenuTitle(){return this.viewModel.featureMenuTitle}set featureMenuTitle(e){this.viewModel.featureMenuTitle=e}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get initialDisplayMode(){return this.viewModel.initialDisplayMode}set initialDisplayMode(e){this.viewModel.initialDisplayMode=e}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get promises(){return this.viewModel.promises}set promises(e){this.viewModel.promises=e}get selectedFeature(){return this.viewModel.selectedFeature}get selectedDrillInFeature(){const e=Array.from(this._drillInFlowItems).at(-1);if(!e)return null;const{flowType:t}=e;return"feature-association"===t||"feature-relationship"===t?e.graphic??null:null}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(e){this.viewModel.selectedFeatureIndex=e}get selectedFeatureWidget(){const{_feature:e,headingLevel:t,_drillInFlowItems:i,timeZone:o,spatialReference:s,map:n}=this,{selectedFeatureViewModel:r}=this.viewModel,l={title:!1};return r?(e?(e.viewModel=r,e.visibleElements=l):this._feature=new g({flowItems:i,headingLevel:t+1,timeZone:o,spatialReference:s,map:n,viewModel:r,visibleElements:l}),this._feature):null}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(e){this.viewModel.updateLocationEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}blur(){const{active:e}=this.viewModel;e?this._rootFlowItemNode?.blur():i.getLogger(this).warn("Features can only be blurred when currently active.")}clear(){return this.viewModel.clear()}close(){this.viewModel.visible=!1}fetchFeatures(e,t){return this.viewModel.fetchFeatures(e,t)}focus(){const{active:e}=this.viewModel;e?this._focusFlowItemNode():i.getLogger(this).warn("Features can only be focused when currently active.")}next(){return this.viewModel.next()}open(e){this.removeHandles(D);const t={collapsed:e?.collapsed??!1};this.set(t),this.viewModel.open(e),this.addHandles(n((()=>!this.viewModel.waitingForResult),(()=>this._addSelectedFeatureIndexHandle()),{once:!0}))}previous(){return this.viewModel.previous()}triggerAction(e){return this.viewModel.triggerAction(e)}render(){return j("div",{afterCreate:this._storeRootNode,bind:this,class:this.classes(F.base,N.widget,N.panel),onkeydown:this._onMainKeydown},this._renderHeader(),this._renderContentContainer())}_renderFeatureNavigation(){return[this._renderPagination(),"list"===this.initialDisplayMode?this._renderFeaturePaginationText():this._renderFeatureMenuButton()]}_renderHeader(){return this.featureNavigationTop&&this._featureNavigationVisible?j("div",{class:F.header,key:"header-actions"},this._renderFeatureNavigation()):null}_renderFooter(){return!this.featureNavigationTop&&this._featureNavigationVisible?j("div",{class:F.footer,key:"footer-actions",slot:"footer"},this._renderFeatureNavigation()):null}_renderFeaturePaginationText(){const{messages:e,viewModel:t}=this,{featureCount:i,selectedFeatureIndex:o}=t;return j("div",{class:F.paginationText,key:"feature-pagination-text"},L(e.pageText,{index:W(o+1),total:W(i)}))}_renderFeatureMenuButton(){const{messages:e,viewModel:t}=this,{featureCount:i,selectedFeatureIndex:o,pendingPromisesCount:s}=t;return j("calcite-action",{appearance:"solid",bind:this,class:F.paginationMenuButton,icon:"list",key:"feature-menu-button",label:e.selectFeature,loading:s>0,onclick:this._handlePaginationMenuButton,scale:"s",text:L(e.pageText,{index:W(o+1),total:W(i)}),textEnabled:!0,title:e.selectFeature})}_renderPagination(){const{previous:e,next:t}=this.messagesCommon.pagination;return j("calcite-action-bar",{class:F.paginationActionBar,expandDisabled:!0,key:"pagination-action-bar",layout:"horizontal",overflowActionsDisabled:!0,scale:"s"},j("calcite-action-group",{scale:"s"},j("calcite-action",{appearance:"solid",class:F.paginationPrevious,icon:"chevron-left",iconFlipRtl:!0,label:e,onclick:this._previousFeature,scale:"s",text:e,title:e}),j("calcite-action",{appearance:"solid",icon:"chevron-right",iconFlipRtl:!0,label:t,onclick:this._nextFeature,scale:"s",text:t,title:t})))}_renderFeatureMenuItem(e){const{initialDisplayMode:t}=this,{selectedFeatureViewModel:i,featureViewModels:o}=this.viewModel,s=e===i,n=o.indexOf(e);return j("calcite-list-item",{bind:this,"data-feature-index":n,key:`feature-menu-item-${e.uid}`,onblur:this._removeActiveFeature,onfocus:this._setActiveFeature,onmouseleave:this._removeActiveFeature,onmouseover:this._setActiveFeature,selected:s,onCalciteListItemSelect:this._selectFeature},j("span",{innerHTML:e.title||this.messagesCommon.untitled,slot:"content"}),"list"===t?j("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}):null)}_groupResultsByLayer(){const{featureViewModels:e}=this.viewModel,t=new Map;return e.forEach((e=>{const i=e?.graphic;if(!i)return;const{layer:o,sourceLayer:s}=i,n=(R(o)?o:null)||(R(s)?s:null),r=t.get(n)??[];t.set(n,[...r,e])})),t}_renderFeatureMenu(){const{messages:e,viewModel:t}=this,i=this._groupResultsByLayer(),o="list"===this.initialDisplayMode?"none":"single";return t.featureViewModels.length?j("calcite-list",{displayMode:"flat",label:e?.featuresList,selectionAppearance:"icon",selectionMode:o},Array.from(i.keys(),(e=>{const t=i.get(e)?.map((e=>this._renderFeatureMenuItem(e))),o=e?e.title??this.messagesCommon.untitled:null;return this.visibleElements.featureListLayerTitle&&null!==o?j("calcite-list-item-group",{heading:o,key:e?.uid||"map-graphics"},t):t}))):null}_renderHeaderAction(e,t){const i=e.title||"";return e.visible?j("calcite-action",{active:"toggle"===e.type&&e.value,appearance:"solid",bind:this,"data-action-id":e.id,"data-action-uid":e.uid,disabled:e.disabled,icon:e.icon??void 0,indicator:e.indicator,key:`header-action-${t}`,loading:e.active,onclick:this._triggerHeaderAction,slot:"header-actions-end",text:i,title:i}):null}_renderHeaderActions(){return this.headerActions.map(((e,t)=>this._renderHeaderAction(e,t))).toArray()}_renderContentFeature(){const{headingLevel:e,visibleElements:t,_isCollapsed:i,_collapseEnabled:o,featureNavigationTop:s,_drillInFlowItems:n,initialDisplayMode:r,selectedFeature:l,featureMenuOpen:a}=this,{title:d,active:c}=this.viewModel,u=t.heading&&d?d:"";if("list"===r&&!l)return null;const h=0===n.length&&("list"===r?!!l:!a);return j("calcite-flow-item",{afterCreate:this._storeRootFlowItemNode,bind:this,class:this.classes({[F.contentFeature]:!0,[F.flowItemCollapsed]:i}),closable:t.closeButton,closed:!c,collapsed:i,collapseDirection:s?"down":"up",collapsible:o,headingLevel:e,key:"root-flow-item",selected:h,onCalciteFlowItemBack:this._handleFeatureBack,onCalciteFlowItemClose:this.close,onCalciteFlowItemToggle:this._handleCollapseToggle},u?j(T,{class:this.classes(F.featuresHeading,N.heading),innerHTML:u,key:"header-content",level:this.headingLevel,slot:"header-content"}):null,this._renderHeaderActions(),this._renderActionBar(),j("div",{class:this.classes(F.container,F.contentContainer)},this._renderContent()),this._renderFooter())}_renderFeatureMenuContainer(){const{viewModel:e,visibleElements:t,featureMenuTitle:i,messages:o,messagesCommon:s,initialDisplayMode:n,featureMenuOpen:r,selectedFeature:l,_collapseEnabled:a,_isCollapsed:d,featureNavigationTop:c,headingLevel:u}=this,{active:h,featureViewModels:p,pendingPromisesCount:m}=e,{featureMenuHeading:v}=t,g=i??o.selectFeature;if("feature"===n&&!r)return null;const w="list"===n?!l:r;return j("calcite-flow-item",{afterCreate:this._storeFeatureMenuFlowItemNode,bind:this,class:this.classes({[F.flowItemCollapsed]:d}),closable:"list"===n&&t.closeButton,closed:!h,collapsed:"list"===n&&d,collapseDirection:c?"down":"up",collapsible:"list"===n&&a,description:v?L(o.total,{total:p.length}):void 0,heading:v?g:void 0,headingLevel:u,key:"feature-menu",loading:e.waitingForContents,selected:w,onCalciteFlowItemBack:e=>{e.preventDefault(),this._handleFeatureMenuBack()},onCalciteFlowItemClose:this.close,onCalciteFlowItemToggle:this._handleCollapseToggle},"list"===n?this._renderHeaderActions():null,m>0?j("calcite-loader",{class:F.loader,inline:!0,key:"feature-menu-loader",label:s.loading,slot:"header-actions-end"}):null,j("div",{class:F.container},this._renderFeatureMenu()),j("div",{afterCreate:this._featureMenuIntersectionObserverCreated,bind:this,class:F.featureMenuObserver}),"feature"===n?j("calcite-button",{appearance:"transparent",onclick:this._handleFeatureMenuBack,slot:"footer-actions",width:"full"},s.back):null)}_renderContentContainer(){const e="list"===this.initialDisplayMode?[this._renderFeatureMenuContainer(),this._renderContentFeature(),this._drillInWidget.render()]:[this._renderContentFeature(),this._drillInWidget.render(),this._renderFeatureMenuContainer()];return this.visibleElements.flow?j("calcite-flow",{key:"content-container"},e):e}_getFallbackIcon(e){const{className:t,icon:i}=e;if(i)return null;const o=p({action:e,feature:this.selectedFeature}),s={[F.icon]:!!t,[F.actionImage]:!!o};return t&&(s[t]=!0),o||t?j("span",{"aria-hidden":"true",class:this.classes(F.icon,s),key:"icon",styles:m(o)}):null}_renderActionBar(){return!this._isCollapsed&&this.visibleElements.actionBar&&this.viewModel.allActions?.length?j("calcite-action-bar",{expandDisabled:!0,expanded:!this._hideActionText,key:"header-action-bar",scale:"s",slot:"action-bar"},j("calcite-action-group",{afterCreate:e=>this._actionBarMenuNode=e,overlayPositioning:"fixed",scale:"s"},this._renderActions())):null}_renderActions(){return this.viewModel.allActions.toArray().map(((e,t)=>{const i=this._getActionTitle(e);return v(e,{key:`action-${t}`,title:i,text:i,textEnabled:!this._hideActionText,onclick:this._triggerAction,bind:this},this._getFallbackIcon(e))}))}_renderContent(){const e=this.viewModel?.content;return e?"string"==typeof e?j("div",{class:M.contentNode,innerHTML:e,key:e}):this.renderNodeContent(e):null}_handleCollapseToggle(){this.collapsed=!this.collapsed}async _openRelatedFeature(e){await e.viewModel.updateGeometry();const t=e.graphic,i=t?.geometry;if(null==i||null==t)return;this._destroyDrillInFlowItemWidgets(),await this.viewModel.zoomTo({target:i});const o=u(i);this.open({features:[t],location:null!=o?o:void 0}),this._focusFlowItemNode()}_handlePaginationMenuButton(){this._updateFeatureMenu()}_openFeatureMenu(){this._updateFeatureMenu(!0)}_closeFeatureMenu(){this._updateFeatureMenu(!1)}_updateFeatureMenu(e=!this.featureMenuOpen){this.featureMenuOpen=e,this._focusFlowItemNode()}async _focusFlowItemNode(){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const e=this._focusAbortController.signal;await o(l(e));const t=this._rootNode?.querySelector("calcite-flow-item[selected]");k(t)}_storeRootFlowItemNode(e){this._rootFlowItemNode=e}_storeFeatureMenuFlowItemNode(e){this._featureMenuViewportNode=e}_setActiveFeature(e){const{viewModel:t}=this,i=e.currentTarget["data-feature-index"];t.activeFeature=t.features?.[i]||null}_removeActiveFeature(){this.viewModel.activeFeature=null}_selectFeature(e){const t=e.currentTarget["data-feature-index"];isNaN(t)||(this.viewModel.selectedFeatureIndex=t),"feature"===this.initialDisplayMode?this._handleFeatureMenuBack():this._focusFlowItemNode()}_unobserveFeatureMenuObserver(){this._featureMenuIntersectionObserverNode&&this._featureMenuIntersectionObserver.unobserve(this._featureMenuIntersectionObserverNode)}_featureMenuIntersectionObserverCreated(e){this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver.observe(e),this._featureMenuIntersectionObserverNode=e}_getActionTitle(e){const{messages:t,selectedFeature:i,messagesCommon:o}=this,{id:s}=e,n=i?.attributes,r=e.title??"",l="zoom-to-feature"===s?L(r,{messages:t}):"remove-selected-feature"===s?L(r,{messages:o}):"zoom-to-clustered-features"===s||"browse-clustered-features"===s?L(r,{messages:t}):e.title;return l&&n?L(l,n):l??""}_onMainKeydown(e){const{key:t}=e;"ArrowLeft"===t&&(e.stopPropagation(),this._handleFeatureMenuBack(),this.previous()),"ArrowRight"===t&&(e.stopPropagation(),this._handleFeatureMenuBack(),this.next())}_featureMenuViewportScrollTop(){this._featureMenuViewportNode&&this._featureMenuViewportNode.scrollContentTo({top:0})}_setContentFromFeatureWidget(){const{selectedFeatureWidget:e}=this;e&&(this.viewModel.content=e)}_setTitleFromFeatureWidget(){const{selectedFeatureWidget:e,messagesCommon:t}=this,i=e?.viewModel;e&&(this.viewModel.title="error"===i?.state?t?.errorMessage:i?.title||"")}_addSelectedFeatureIndexHandle(){const e=s((()=>this.viewModel?.selectedFeatureIndex),((e,t)=>this._selectedFeatureIndexUpdated(e,t)));this.addHandles(e,D)}_selectedFeatureIndexUpdated(e,t){const{featureCount:i}=this.viewModel;i&&e!==t&&-1!==e&&(this._destroyDrillInFlowItemWidgets(),this._rootFlowItemNode&&this._rootFlowItemNode.scrollContentTo({top:0}))}_triggerHeaderAction(e){const t=e.currentTarget;if(t.disabled)return;const i=t.dataset.actionUid,o=this.headerActions.find((({uid:e})=>e===i));o&&!o.disabled&&("toggle"===o?.type&&(o.value=!o.value),this.emit("trigger-header-action",{action:o}))}_triggerAction(e){const t=e.currentTarget;if(t.disabled)return;const i=t.dataset.actionUid,{allActions:o}=this.viewModel,s=o.findIndex((e=>e.uid===i)),n=o.at(s);n&&"toggle"===n.type&&(n.value=!n.value),this.viewModel.triggerAction(s)}_createSpinner(e){e&&(this._spinner=new w({view:e}),e.ui.add(this._spinner,{key:S,position:"manual",internal:!0}))}_wireUpView(e){this._destroySpinner(),e&&this.visibleElements?.spinner&&this._createSpinner(e)}_hideSpinner(){const{_spinner:e}=this;e&&(e.location=null,e.hide())}_viewReadyChange(e,t){e?this._wireUpView(this.viewModel?.view):t&&this.viewModel.clear()}_viewChange(e,t){e&&t&&this.viewModel.clear()}_destroySelectedFeatureWidget(){const{_feature:e}=this;e&&(e.viewModel=null,!e.destroyed&&e.destroy()),this._feature=null}_closeOpenActionMenu(){const{_actionBarMenuNode:e}=this;e&&(e.menuOpen=!1)}_destroyDrillInFlowItemWidgets(){this._drillInFlowItems.drain((e=>{"showAllEnabled"in e.viewModel&&(e.viewModel.showAllEnabled=!1),"activeCategory"in e.viewModel&&(e.viewModel.activeCategory=null),e.viewModel=null,e.destroy()}))}_toggleScreenLocationEnabled(){const{viewModel:e}=this;e&&(e.screenLocationEnabled=e.active)}_displaySpinner(){const{_spinner:e}=this;if(!e)return;const{location:t,waitingForResult:i}=this.viewModel;i&&t?e.show({location:t}):e.hide()}_destroySpinner(){const{_spinner:e}=this;e&&(e.view?.ui?.remove(e,S),e.destroy(),this._spinner=null)}_spinnerEnabledChange(e){this._destroySpinner(),e&&this._createSpinner(this.viewModel?.view)}};e([d()],H.prototype,"_drillInFlowItems",void 0),e([d()],H.prototype,"_hideActionText",null),e([d()],H.prototype,"_featureNavigationVisible",null),e([d()],H.prototype,"_isCollapsed",null),e([d()],H.prototype,"_collapseEnabled",null),e([d({readOnly:!0})],H.prototype,"active",null),e([d()],H.prototype,"collapsed",void 0),e([d()],H.prototype,"content",null),e([d()],H.prototype,"icon",null),e([d()],H.prototype,"featureMenuOpen",null),e([d()],H.prototype,"featureMenuTitle",null),e([d()],H.prototype,"featureNavigationTop",void 0),e([d()],H.prototype,"features",null),e([d()],H.prototype,"goToOverride",null),e([d({type:C})],H.prototype,"headerActions",void 0),e([d()],H.prototype,"headingLevel",void 0),e([d()],H.prototype,"initialDisplayMode",null),e([d()],H.prototype,"location",null),e([d()],H.prototype,"label",null),e([d()],H.prototype,"map",null),e([d(),O("esri/widgets/Features/t9n/Features")],H.prototype,"messages",void 0),e([d(),O("esri/t9n/common")],H.prototype,"messagesCommon",void 0),e([d()],H.prototype,"promises",null),e([d()],H.prototype,"responsiveActionsEnabled",void 0),e([d({readOnly:!0})],H.prototype,"selectedFeature",null),e([d({readOnly:!0})],H.prototype,"selectedDrillInFeature",null),e([d()],H.prototype,"selectedFeatureIndex",null),e([d({readOnly:!0})],H.prototype,"selectedFeatureWidget",null),e([d()],H.prototype,"spatialReference",null),e([d()],H.prototype,"title",null),e([d()],H.prototype,"timeZone",null),e([d()],H.prototype,"updateLocationEnabled",null),e([d()],H.prototype,"view",null),e([d({type:b}),E(["triggerAction","trigger-action"])],H.prototype,"viewModel",void 0),e([d({type:I,nonNullable:!0})],H.prototype,"visibleElements",void 0),e([d()],H.prototype,"visible",null),H=e([c("esri.widgets.Features")],H);const V=H;export{V as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import i from"../core/Logger.js";import{ignoreAbortErrors as o}from"../core/promiseUtils.js";import{watch as s,when as n,initial as r}from"../core/reactiveUtils.js";import{waitAnimationFrame as l}from"../core/scheduling.js";import{throttle as a}from"../core/throttle.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{getPointFromGeometry as u}from"../geometry/support/geometryUtils.js";import{loadActionUtilsComponents as h,substituteActionImage as p,getActionStyles as m,renderAction as v}from"../support/actions/actionUtils.js";import g from"./Feature.js";import w from"./Spinner.js";import _ from"./Widget.js";import{css as M}from"./Feature/resources.js";import{FeatureContentMixin as f}from"./Feature/support/FeatureContentMixin.js";import{css as F}from"./Features/css.js";import y from"./Features/FeaturesDrillIn.js";import b from"./Features/FeaturesViewModel.js";import I from"./Features/FeaturesVisibleElements.js";import{ActionsCollection as C}from"./Popup/actions.js";import{zoomToLocation as x}from"./Popup/actionUtils.js";import{loadCalciteComponents as A}from"./support/componentsUtils.js";import{globalCss as N}from"./support/globalCss.js";import{Heading as T}from"./support/Heading.js";import{setFocus as k}from"./support/widgetUtils.js";import{messageBundle as O}from"./support/decorators/messageBundle.js";import{vmEvent as E}from"./support/decorators/vmEvent.js";import{tsx as j}from"./support/jsxFactory.js";import{substitute as L}from"../intl/substitute.js";import{formatNumber as W}from"../intl/number.js";const D="selected-index",B=0,S="features-spinner";function R(e){return e?.declaredClass.startsWith("esri.layers.")??!1}let H=class extends(f(_)){constructor(e,i){super(e,i),this._featureMenuIntersectionObserverCallback=([e])=>{e?.isIntersecting&&null!=this.viewModel.featurePage&&this.viewModel.featurePage++},this._featureMenuIntersectionObserver=new IntersectionObserver(this._featureMenuIntersectionObserverCallback,{root:window.document}),this._featureMenuIntersectionObserverNode=null,this._spinner=null,this._feature=null,this._focusAbortController=null,this._drillInFlowItems=new t,this._drillInWidget=new y({flowItems:this._drillInFlowItems}),this._rootNode=null,this._rootFlowItemNode=null,this._featureMenuViewportNode=null,this._actionBarMenuNode=null,this.collapsed=!1,this.featureNavigationTop=!1,this.headerActions=new C,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.responsiveActionsEnabled=!1,this.viewModel=new b,this.visibleElements=new I,this._previousFeature=()=>{this.viewModel.previous()},this._nextFeature=()=>{this.viewModel.next()},this._handleFeatureBack=()=>{"list"===this.initialDisplayMode?(this.selectedFeatureIndex=-1,this._focusFlowItemNode()):this._openFeatureMenu()},this._handleFeatureMenuBack=()=>{"list"===this.initialDisplayMode?(this.selectedFeatureIndex=-1,this._focusFlowItemNode()):this.featureMenuOpen&&this._closeFeatureMenu()},this._storeRootNode=e=>{this._rootNode=e},this._displaySpinnerThrottled=a((()=>this._displaySpinner()),B),this._addSelectedFeatureIndexHandle(),this.addHandles([this._displaySpinnerThrottled,s((()=>this.viewModel?.active),(()=>this._toggleScreenLocationEnabled())),s((()=>this.viewModel?.active),(e=>this._drillInWidget.closed=!e)),s((()=>this.visibleElements?.closeButton),(e=>this._drillInWidget.closable=e)),s((()=>this.visibleElements?.spinner),(e=>this._spinnerEnabledChange(e))),s((()=>this.viewModel?.view),((e,t)=>this._viewChange(e,t))),s((()=>this.viewModel?.view?.ready),((e,t)=>this._viewReadyChange(e??!1,t??!1))),s((()=>[this.viewModel?.waitingForResult,this.viewModel?.location]),(()=>{this._hideSpinner(),this._displaySpinnerThrottled()})),s((()=>this.viewModel?.screenLocation),(()=>this._closeOpenActionMenu())),s((()=>this.selectedFeatureWidget?.viewModel),(()=>this._destroyDrillInFlowItemWidgets())),s((()=>this.featureMenuOpen),(()=>this._drillInWidget.selectLastFlowItem="list"===this.initialDisplayMode||!this.featureMenuOpen),r),s((()=>{const e=this.selectedFeatureWidget?.viewModel;return[e?.title,e?.state]}),(()=>this._setTitleFromFeatureWidget())),s((()=>{const e=this.selectedFeatureWidget?.viewModel;return[e?.content,e?.state]}),(()=>this._setContentFromFeatureWidget())),s((()=>this.viewModel?.featureViewModels),(()=>this._featureMenuViewportScrollTop())),s((()=>this._drillInFlowItems.length),(()=>this._focusFlowItemNode())),this._drillInWidget.on("close",(()=>this.close())),this._drillInWidget.on("exit",(()=>this._destroyDrillInFlowItemWidgets())),this._drillInWidget.on("open-feature",(({feature:e})=>this._openRelatedFeature(e))),this._drillInWidget.on("zoom-to-feature",(({featureWidget:e})=>x(this.viewModel,e)))])}loadDependencies(){return Promise.all([h(),A({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),"list-item-group":()=>import("@esri/calcite-components/dist/components/calcite-list-item-group"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})])}destroy(){this._destroyDrillInFlowItemWidgets(),this._destroySelectedFeatureWidget(),this._destroySpinner(),this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver?.disconnect(),this._drillInWidget?.destroy(),this._focusAbortController?.abort()}get _hideActionText(){if(!this.responsiveActionsEnabled)return!1;const e=this.view?.widthBreakpoint;return"xsmall"===e||"small"===e||"medium"===e}get _featureNavigationVisible(){return this.viewModel.active&&this.viewModel.featureCount>1&&!!this.viewModel.selectedFeature&&this.visibleElements.featureNavigation}get _isCollapsed(){return this._collapseEnabled&&this.collapsed}get _collapseEnabled(){return this.visibleElements.collapseButton&&("list"===this.initialDisplayMode||!!this.title&&!!this.content)}get active(){return this.viewModel.active}get content(){return this.viewModel.content}set content(e){this.viewModel.content=e}get icon(){return null}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(e){this.viewModel.featureMenuOpen=e}get featureMenuTitle(){return this.viewModel.featureMenuTitle}set featureMenuTitle(e){this.viewModel.featureMenuTitle=e}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get initialDisplayMode(){return this.viewModel.initialDisplayMode}set initialDisplayMode(e){this.viewModel.initialDisplayMode=e}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get promises(){return this.viewModel.promises}set promises(e){this.viewModel.promises=e}get selectedFeature(){return this.viewModel.selectedFeature}get selectedDrillInFeature(){const e=Array.from(this._drillInFlowItems).at(-1);if(!e)return null;const{flowType:t}=e;return"feature-association"===t||"feature-relationship"===t?e.graphic??null:null}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(e){this.viewModel.selectedFeatureIndex=e}get selectedFeatureWidget(){const{_feature:e,headingLevel:t,_drillInFlowItems:i,timeZone:o,spatialReference:s,map:n}=this,{selectedFeatureViewModel:r}=this.viewModel,l={title:!1};return r?(e?(e.viewModel=r,e.visibleElements=l):this._feature=new g({flowItems:i,headingLevel:t+1,timeZone:o,spatialReference:s,map:n,viewModel:r,visibleElements:l}),this._feature):null}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(e){this.viewModel.updateLocationEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}blur(){const{active:e}=this.viewModel;e?this._rootFlowItemNode?.blur():i.getLogger(this).warn("Features can only be blurred when currently active.")}clear(){return this.viewModel.clear()}close(){this.viewModel.visible=!1}fetchFeatures(e,t){return this.viewModel.fetchFeatures(e,t)}focus(){const{active:e}=this.viewModel;e?this._focusFlowItemNode():i.getLogger(this).warn("Features can only be focused when currently active.")}next(){return this.viewModel.next()}open(e){this.removeHandles(D);const t={collapsed:e?.collapsed??!1};this.set(t),this.viewModel.open(e),this.addHandles(n((()=>!this.viewModel.waitingForResult),(()=>this._addSelectedFeatureIndexHandle()),{once:!0}))}previous(){return this.viewModel.previous()}triggerAction(e){return this.viewModel.triggerAction(e)}render(){return j("div",{afterCreate:this._storeRootNode,bind:this,class:this.classes(F.base,N.widget,N.panel),onkeydown:this._onMainKeydown},this._renderHeader(),this._renderContentContainer())}_renderFeatureNavigation(){return[this._renderPagination(),"list"===this.initialDisplayMode?this._renderFeaturePaginationText():this._renderFeatureMenuButton()]}_renderHeader(){return this.featureNavigationTop&&this._featureNavigationVisible?j("div",{class:F.header,key:"header-actions"},this._renderFeatureNavigation()):null}_renderFooter(){return!this.featureNavigationTop&&this._featureNavigationVisible?j("div",{class:F.footer,key:"footer-actions",slot:"footer"},this._renderFeatureNavigation()):null}_renderFeaturePaginationText(){const{messages:e,viewModel:t}=this,{featureCount:i,selectedFeatureIndex:o}=t;return j("div",{class:F.paginationText,key:"feature-pagination-text"},L(e.pageText,{index:W(o+1),total:W(i)}))}_renderFeatureMenuButton(){const{messages:e,viewModel:t}=this,{featureCount:i,selectedFeatureIndex:o,pendingPromisesCount:s}=t;return j("calcite-action",{appearance:"solid",bind:this,class:F.paginationMenuButton,icon:"list",key:"feature-menu-button",label:e.selectFeature,loading:s>0,onclick:this._handlePaginationMenuButton,scale:"s",text:L(e.pageText,{index:W(o+1),total:W(i)}),textEnabled:!0,title:e.selectFeature})}_renderPagination(){const{previous:e,next:t}=this.messagesCommon.pagination;return j("calcite-action-bar",{class:F.paginationActionBar,expandDisabled:!0,key:"pagination-action-bar",layout:"horizontal",overflowActionsDisabled:!0,scale:"s"},j("calcite-action-group",{scale:"s"},j("calcite-action",{appearance:"solid",class:F.paginationPrevious,icon:"chevron-left",iconFlipRtl:!0,label:e,onclick:this._previousFeature,scale:"s",text:e,title:e}),j("calcite-action",{appearance:"solid",icon:"chevron-right",iconFlipRtl:!0,label:t,onclick:this._nextFeature,scale:"s",text:t,title:t})))}_renderFeatureMenuItem(e){const{initialDisplayMode:t}=this,{selectedFeatureViewModel:i,featureViewModels:o}=this.viewModel,s=e===i,n=o.indexOf(e);return j("calcite-list-item",{bind:this,"data-feature-index":n,key:`feature-menu-item-${e.uid}`,onblur:this._removeActiveFeature,onfocus:this._setActiveFeature,onmouseleave:this._removeActiveFeature,onmouseover:this._setActiveFeature,selected:s,onCalciteListItemSelect:this._selectFeature},j("span",{innerHTML:e.title||this.messagesCommon.untitled,slot:"content"}),"list"===t?j("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}):null)}_groupResultsByLayer(){const{featureViewModels:e}=this.viewModel,t=new Map;return e.forEach((e=>{const i=e?.graphic;if(!i)return;const{layer:o,sourceLayer:s}=i,n=(R(o)?o:null)||(R(s)?s:null),r=t.get(n)??[];t.set(n,[...r,e])})),t}_renderFeatureMenu(){const{messages:e,viewModel:t}=this,i=this._groupResultsByLayer(),o="list"===this.initialDisplayMode?"none":"single";return t.featureViewModels.length?j("calcite-list",{displayMode:"flat",label:e?.featuresList,selectionAppearance:"icon",selectionMode:o},Array.from(i.keys(),(e=>{const t=i.get(e)?.map((e=>this._renderFeatureMenuItem(e))),o=e?e.title??this.messagesCommon.untitled:null;return this.visibleElements.featureListLayerTitle&&null!==o?j("calcite-list-item-group",{heading:o,key:e?.uid||"map-graphics"},t):t}))):null}_renderHeaderAction(e,t){const i=e.title||"";return e.visible?j("calcite-action",{active:"toggle"===e.type&&e.value,appearance:"solid",bind:this,"data-action-id":e.id,"data-action-uid":e.uid,disabled:e.disabled,icon:e.icon??void 0,indicator:e.indicator,key:`header-action-${t}`,loading:e.active,onclick:this._triggerHeaderAction,slot:"header-actions-end",text:i,title:i}):null}_renderHeaderActions(){return this.headerActions.map(((e,t)=>this._renderHeaderAction(e,t))).toArray()}_renderContentFeature(){const{headingLevel:e,visibleElements:t,_isCollapsed:i,_collapseEnabled:o,featureNavigationTop:s,_drillInFlowItems:n,initialDisplayMode:r,selectedFeature:l,featureMenuOpen:a}=this,{title:d,active:c}=this.viewModel,u=t.heading&&d?d:"";if("list"===r&&!l)return null;const h=0===n.length&&("list"===r?!!l:!a);return j("calcite-flow-item",{afterCreate:this._storeRootFlowItemNode,bind:this,class:this.classes({[F.contentFeature]:!0,[F.flowItemCollapsed]:i}),closable:t.closeButton,closed:!c,collapsed:i,collapseDirection:s?"down":"up",collapsible:o,headingLevel:e,key:"root-flow-item",selected:h,onCalciteFlowItemBack:this._handleFeatureBack,onCalciteFlowItemClose:this.close,onCalciteFlowItemToggle:this._handleCollapseToggle},u?j(T,{class:this.classes(F.featuresHeading,N.heading),innerHTML:u,key:"header-content",level:this.headingLevel,slot:"header-content"}):null,this._renderHeaderActions(),this._renderActionBar(),j("div",{class:this.classes(F.container,F.contentContainer)},this._renderContent()),this._renderFooter())}_renderFeatureMenuContainer(){const{viewModel:e,visibleElements:t,featureMenuTitle:i,messages:o,messagesCommon:s,initialDisplayMode:n,featureMenuOpen:r,selectedFeature:l,_collapseEnabled:a,_isCollapsed:d,featureNavigationTop:c,headingLevel:u}=this,{active:h,featureViewModels:p,pendingPromisesCount:m}=e,{featureMenuHeading:v}=t,g=i??o.selectFeature;if("feature"===n&&!r)return null;const w="list"===n?!l:r;return j("calcite-flow-item",{afterCreate:this._storeFeatureMenuFlowItemNode,bind:this,class:this.classes({[F.flowItemCollapsed]:d}),closable:"list"===n&&t.closeButton,closed:!h,collapsed:"list"===n&&d,collapseDirection:c?"down":"up",collapsible:"list"===n&&a,description:v?L(o.total,{total:p.length}):void 0,heading:v?g:void 0,headingLevel:u,key:"feature-menu",loading:e.waitingForContents,selected:w,onCalciteFlowItemBack:e=>{e.preventDefault(),this._handleFeatureMenuBack()},onCalciteFlowItemClose:this.close,onCalciteFlowItemToggle:this._handleCollapseToggle},"list"===n?this._renderHeaderActions():null,m>0?j("calcite-loader",{class:F.loader,inline:!0,key:"feature-menu-loader",label:s.loading,slot:"header-actions-end"}):null,j("div",{class:F.container},this._renderFeatureMenu()),j("div",{afterCreate:this._featureMenuIntersectionObserverCreated,bind:this,class:F.featureMenuObserver}),"feature"===n?j("calcite-button",{appearance:"transparent",onclick:this._handleFeatureMenuBack,slot:"footer-actions",width:"full"},s.back):null)}_renderContentContainer(){const e="list"===this.initialDisplayMode?[this._renderFeatureMenuContainer(),this._renderContentFeature(),this._drillInWidget.render()]:[this._renderContentFeature(),this._drillInWidget.render(),this._renderFeatureMenuContainer()];return this.visibleElements.flow?j("calcite-flow",{key:"content-container"},e):e}_getFallbackIcon(e){const{className:t,icon:i}=e;if(i)return null;const o=p({action:e,feature:this.selectedFeature}),s={[F.icon]:!!t,[F.actionImage]:!!o};return t&&(s[t]=!0),o||t?j("span",{"aria-hidden":"true",class:this.classes(F.icon,s),key:"icon",styles:m(o)}):null}_renderActionBar(){return!this._isCollapsed&&this.visibleElements.actionBar&&this.viewModel.allActions?.length?j("calcite-action-bar",{expandDisabled:!0,expanded:!this._hideActionText,key:"header-action-bar",scale:"s",slot:"action-bar"},j("calcite-action-group",{afterCreate:e=>this._actionBarMenuNode=e,overlayPositioning:"fixed",scale:"s"},this._renderActions())):null}_renderActions(){return this.viewModel.allActions.toArray().map(((e,t)=>{const i=this._getActionTitle(e);return v(e,{key:`action-${t}`,title:i,text:i,textEnabled:!this._hideActionText,onclick:this._triggerAction,bind:this},this._getFallbackIcon(e))}))}_renderContent(){const e=this.viewModel?.content;return e?"string"==typeof e?j("div",{class:M.contentNode,innerHTML:e,key:e}):this.renderNodeContent(e):null}_handleCollapseToggle(){this.collapsed=!this.collapsed}async _openRelatedFeature(e){await e.viewModel.updateGeometry();const t=e.graphic,i=t?.geometry;if(null==i||null==t)return;this._destroyDrillInFlowItemWidgets(),await this.viewModel.zoomTo({target:i});const o=u(i);this.open({features:[t],location:null!=o?o:void 0}),this._focusFlowItemNode()}_handlePaginationMenuButton(){this._updateFeatureMenu()}_openFeatureMenu(){this._updateFeatureMenu(!0)}_closeFeatureMenu(){this._updateFeatureMenu(!1)}_updateFeatureMenu(e=!this.featureMenuOpen){this.featureMenuOpen=e,this._focusFlowItemNode()}async _focusFlowItemNode(){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const e=this._focusAbortController.signal;await o(l(e));const t=this._rootNode?.querySelector("calcite-flow-item[selected]");k(t)}_storeRootFlowItemNode(e){this._rootFlowItemNode=e}_storeFeatureMenuFlowItemNode(e){this._featureMenuViewportNode=e}_setActiveFeature(e){const{viewModel:t}=this,i=e.currentTarget["data-feature-index"];t.activeFeature=t.features?.[i]||null}_removeActiveFeature(){this.viewModel.activeFeature=null}_selectFeature(e){const t=e.currentTarget["data-feature-index"];isNaN(t)||(this.viewModel.selectedFeatureIndex=t),"feature"===this.initialDisplayMode?this._handleFeatureMenuBack():this._focusFlowItemNode()}_unobserveFeatureMenuObserver(){this._featureMenuIntersectionObserverNode&&this._featureMenuIntersectionObserver.unobserve(this._featureMenuIntersectionObserverNode)}_featureMenuIntersectionObserverCreated(e){this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver.observe(e),this._featureMenuIntersectionObserverNode=e}_getActionTitle(e){const{messages:t,selectedFeature:i,messagesCommon:o}=this,{id:s}=e,n=i?.attributes,r=e.title??"",l="zoom-to-feature"===s?L(r,{messages:t}):"remove-selected-feature"===s?L(r,{messages:o}):"zoom-to-clustered-features"===s||"browse-clustered-features"===s?L(r,{messages:t}):e.title;return l&&n?L(l,n):l??""}_onMainKeydown(e){const{key:t}=e;"ArrowLeft"===t&&(e.stopPropagation(),this._handleFeatureMenuBack(),this.previous()),"ArrowRight"===t&&(e.stopPropagation(),this._handleFeatureMenuBack(),this.next())}_featureMenuViewportScrollTop(){this._featureMenuViewportNode&&this._featureMenuViewportNode.scrollContentTo({top:0})}_setContentFromFeatureWidget(){const{selectedFeatureWidget:e}=this;e&&(this.viewModel.content=e)}_setTitleFromFeatureWidget(){const{selectedFeatureWidget:e,messagesCommon:t}=this,i=e?.viewModel;e&&(this.viewModel.title="error"===i?.state?t?.errorMessage:i?.title||"")}_addSelectedFeatureIndexHandle(){const e=s((()=>this.viewModel?.selectedFeatureIndex),((e,t)=>this._selectedFeatureIndexUpdated(e,t)));this.addHandles(e,D)}_selectedFeatureIndexUpdated(e,t){const{featureCount:i}=this.viewModel;i&&e!==t&&-1!==e&&(this._destroyDrillInFlowItemWidgets(),this._rootFlowItemNode&&this._rootFlowItemNode.scrollContentTo({top:0}))}_triggerHeaderAction(e){const t=e.currentTarget;if(t.disabled)return;const i=t.dataset.actionUid,o=this.headerActions.find((({uid:e})=>e===i));o&&!o.disabled&&("toggle"===o?.type&&(o.value=!o.value),this.emit("trigger-header-action",{action:o}))}_triggerAction(e){const t=e.currentTarget;if(t.disabled)return;const i=t.dataset.actionUid,{allActions:o}=this.viewModel,s=o.findIndex((e=>e.uid===i)),n=o.at(s);n&&"toggle"===n.type&&(n.value=!n.value),this.viewModel.triggerAction(s)}_createSpinner(e){e&&(this._spinner=new w({view:e}),e.ui.add(this._spinner,{key:S,position:"manual",internal:!0}))}_wireUpView(e){this._destroySpinner(),e&&this.visibleElements?.spinner&&this._createSpinner(e)}_hideSpinner(){const{_spinner:e}=this;e&&(e.location=null,e.hide())}_viewReadyChange(e,t){e?this._wireUpView(this.viewModel?.view):t&&this.viewModel.clear()}_viewChange(e,t){e&&t&&this.viewModel.clear()}_destroySelectedFeatureWidget(){const{_feature:e}=this;e&&(e.viewModel=null,!e.destroyed&&e.destroy()),this._feature=null}_closeOpenActionMenu(){const{_actionBarMenuNode:e}=this;e&&(e.menuOpen=!1)}_destroyDrillInFlowItemWidgets(){this._drillInFlowItems.drain((e=>{"showAllEnabled"in e.viewModel&&(e.viewModel.showAllEnabled=!1),"activeCategory"in e.viewModel&&(e.viewModel.activeCategory=null),e.viewModel=null,e.destroy()}))}_toggleScreenLocationEnabled(){const{viewModel:e}=this;e&&(e.screenLocationEnabled=e.active)}_displaySpinner(){const{_spinner:e}=this;if(!e)return;const{location:t,waitingForResult:i}=this.viewModel;i&&t?e.show({location:t}):e.hide()}_destroySpinner(){const{_spinner:e}=this;e&&(e.view?.ui?.remove(e,S),e.destroy(),this._spinner=null)}_spinnerEnabledChange(e){this._destroySpinner(),e&&this._createSpinner(this.viewModel?.view)}};e([d()],H.prototype,"_drillInFlowItems",void 0),e([d()],H.prototype,"_hideActionText",null),e([d()],H.prototype,"_featureNavigationVisible",null),e([d()],H.prototype,"_isCollapsed",null),e([d()],H.prototype,"_collapseEnabled",null),e([d({readOnly:!0})],H.prototype,"active",null),e([d()],H.prototype,"collapsed",void 0),e([d()],H.prototype,"content",null),e([d()],H.prototype,"icon",null),e([d()],H.prototype,"featureMenuOpen",null),e([d()],H.prototype,"featureMenuTitle",null),e([d()],H.prototype,"featureNavigationTop",void 0),e([d()],H.prototype,"features",null),e([d()],H.prototype,"goToOverride",null),e([d({type:C})],H.prototype,"headerActions",void 0),e([d()],H.prototype,"headingLevel",void 0),e([d()],H.prototype,"initialDisplayMode",null),e([d()],H.prototype,"location",null),e([d()],H.prototype,"label",null),e([d()],H.prototype,"map",null),e([d(),O("esri/widgets/Features/t9n/Features")],H.prototype,"messages",void 0),e([d(),O("esri/t9n/common")],H.prototype,"messagesCommon",void 0),e([d()],H.prototype,"promises",null),e([d()],H.prototype,"responsiveActionsEnabled",void 0),e([d({readOnly:!0})],H.prototype,"selectedFeature",null),e([d({readOnly:!0})],H.prototype,"selectedDrillInFeature",null),e([d()],H.prototype,"selectedFeatureIndex",null),e([d({readOnly:!0})],H.prototype,"selectedFeatureWidget",null),e([d()],H.prototype,"spatialReference",null),e([d()],H.prototype,"title",null),e([d()],H.prototype,"timeZone",null),e([d()],H.prototype,"updateLocationEnabled",null),e([d()],H.prototype,"view",null),e([d({type:b}),E(["triggerAction","trigger-action"])],H.prototype,"viewModel",void 0),e([d({type:I,nonNullable:!0})],H.prototype,"visibleElements",void 0),e([d()],H.prototype,"visible",null),H=e([c("esri.widgets.Features")],H);const V=H;export{V as default};
|
package/widgets/Search.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{deprecatedPropertyValue as t}from"../core/deprecate.js";import o from"../core/Logger.js";import{destroyMaybe as s,abortMaybe as r}from"../core/maybe.js";import{ignoreAbortErrors as i,isAbortError as l}from"../core/promiseUtils.js";import{watch as n,initial as a}from"../core/reactiveUtils.js";import{waitAnimationFrame as c}from"../core/scheduling.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import{css as p}from"./Search/css.js";import g from"./Search/SearchResultRenderer.js";import m from"./Search/SearchViewModel.js";import{loadCalciteComponents as v}from"./support/componentsUtils.js";import{globalCss as _}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as w}from"./support/decorators/messageBundle.js";import{vmEvent as M}from"./support/decorators/vmEvent.js";import{tsx as S}from"./support/jsxFactory.js";import{substitute as b}from"../intl/substitute.js";let y=class extends d{constructor(e,t){super(e,t),this._currentLocationValue=`${this.id}-search-use-current-location`,this._autocompleteNode=null,this._focusAbortController=null,this._searchResultRenderer=new g,this._suggestController=null,this._searchController=null,this._lastSearchTerm="",this._locateFailed=!1,this._showNoResults=!1,this.disabled=!1,this.messages=null,this.messagesCommon=null,this.viewModel=new m,this._renderSearchResultsContent=()=>this._searchResultRenderer,this.addHandles([n((()=>this.viewModel),(e=>this._searchResultRenderer.viewModel=e),a),n((()=>this.viewModel.results),(()=>this._searchResultRenderer.showMoreResultsOpen=!1)),n((()=>this.viewModel?.defaultPopupTemplate),(e=>{e&&(e.content=this._renderSearchResultsContent)}),a)])}loadDependencies(){return v({autocomplete:()=>import("@esri/calcite-components/dist/components/calcite-autocomplete"),"autocomplete-item-group":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item-group"),"autocomplete-item":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}destroy(){this._cancelQueries(),this._searchResultRenderer=s(this._searchResultRenderer),this._focusAbortController?.abort()}get _isDisabled(){const{state:e}=this.viewModel;return"disabled"===e||"loading"===e||this.disabled}get _showCurrentLocation(){return this.locationEnabled&&!this.searchTerm?.trim()}get _effectiveActiveMenu(){const{activeMenu:e}=this;return this._isDisabled?"none":"warning"===e?"suggestion":e}get activeMenu(){return"none"}set activeMenu(e){"warning"===e&&t(o.getLogger(this),"activeMenu","warning",{replacement:"Use the value 'suggestion' instead",version:"4.32",warnOnce:!0}),this._overrideIfSome("activeMenu",e)}get activeSource(){return this.viewModel?.activeSource}get activeSourceIndex(){return this.viewModel.activeSourceIndex}set activeSourceIndex(e){this.viewModel.activeSourceIndex=e}get allPlaceholder(){return this.viewModel.allPlaceholder}set allPlaceholder(e){this.viewModel.allPlaceholder=e}get allSources(){return this.viewModel.allSources}get autoNavigate(){return this.viewModel.autoNavigate}set autoNavigate(e){this.viewModel.autoNavigate=e}get autoSelect(){return this.viewModel.autoSelect}set autoSelect(e){this.viewModel.autoSelect=e}get defaultSources(){return this.viewModel.defaultSources}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"search"}set icon(e){this._overrideIfSome("icon",e)}get includeDefaultSources(){return this.viewModel.includeDefaultSources}set includeDefaultSources(e){this.viewModel.includeDefaultSources=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get locationEnabled(){return this.viewModel.locationEnabled}set locationEnabled(e){this.viewModel.locationEnabled=e}get maxResults(){return this.viewModel.maxResults}set maxResults(e){this.viewModel.maxResults=e}get maxSuggestions(){return this.viewModel.maxSuggestions}set maxSuggestions(e){this.viewModel.maxSuggestions=e}get minSuggestCharacters(){return this.viewModel.minSuggestCharacters}set minSuggestCharacters(e){this.viewModel.minSuggestCharacters=e}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get portal(){return this.viewModel?.portal}set portal(e){this.viewModel&&(this.viewModel.portal=e)}get resultGraphic(){return this.viewModel.resultGraphic}set resultGraphic(e){this.viewModel.resultGraphic=e}get resultGraphicEnabled(){return this.viewModel.resultGraphicEnabled}set resultGraphicEnabled(e){this.viewModel.resultGraphicEnabled=e}get results(){return this.viewModel.results}get searchAllEnabled(){return this.viewModel.searchAllEnabled}set searchAllEnabled(e){this.viewModel.searchAllEnabled=e}get searchTerm(){return this.viewModel.searchTerm}set searchTerm(e){this.viewModel.searchTerm=e}get selectedResult(){return this.viewModel.selectedResult}get sources(){return this.viewModel.sources}set sources(e){this.viewModel.sources=e}get suggestions(){return this.viewModel.suggestions}get suggestionsEnabled(){return this.viewModel.suggestionsEnabled}set suggestionsEnabled(e){this.viewModel.suggestionsEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}clear(){this._locateFailed=!1,this.viewModel.clear()}focus(){this._handleFocus(),this._emitFocus()}blur(){this._autocompleteNode?.blur(),this._emitBlur()}async search(e){this._cancelQueries();const t=new AbortController,{signal:o}=t;this._searchController=t;try{const s=await this.viewModel.search(e,{signal:o});if(this._searchController!==t)return;return s?.numResults||(this._showNoResults=!0,this.activeMenu="suggestion"),this._searchController=null,s}catch(s){if(this._searchController!==t)return;return void(this._searchController=null)}}async suggest(e){this._cancelSuggest();const t=new AbortController,{signal:o}=t;this._suggestController=t;try{const s=await this.viewModel.suggest(e,null,{signal:o});if(this._suggestController!==t)return;return this._suggestController=null,s?.numResults&&(this.activeMenu="suggestion",this._scrollToTopSuggestion()),s}catch(s){return this._suggestController!==t||(this._suggestController=null),null}}render(){return S("div",{class:this.classes(p.base,_.widget)},S("div",{class:p.container},this._renderSourcesMenu(),this._renderForm()))}_handleInputKeydown(e){"Tab"===e.key&&this._cancelSuggest()}_emitFocus(){this.emit("search-focus")}_emitBlur(){this.emit("search-blur")}async _handleFocus(){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const e=this._focusAbortController.signal;await i(c(e)),this._autocompleteNode?.setFocus()}_renderSourcesMenu(){const{messages:e,_isDisabled:t,_effectiveActiveMenu:o}=this,{allSources:s,searchAllEnabled:r}=this.viewModel;return s.length>1?S("calcite-dropdown",{bind:this,class:p.dropdown,disabled:t,open:"source"===o,overlayPositioning:"fixed",onCalciteDropdownClose:this._handleSourceClose,onCalciteDropdownOpen:this._handleSourceOpen,onCalciteDropdownSelect:this._handleSourceSelect},S("calcite-button",{appearance:"outline-fill",iconStart:"caret-down",kind:"neutral",label:e.searchIn,slot:"trigger"}),S("calcite-dropdown-group",{groupTitle:e.searchIn},r?this._renderSource(m.ALL_INDEX):null,s.map(((e,t)=>this._renderSource(t))).toArray())):null}_renderUseCurrentLocation(){const{_currentLocationValue:e}=this;return S("calcite-autocomplete-item",{heading:this.messages.useCurrentLocation,iconStart:"gps-on",key:e,value:e})}_handleAutocompleteCreate(e){this._autocompleteNode=e}_handleCalciteAutocompleteTextInput(e){const t=e.target.inputValue;t!==this.viewModel.searchTerm&&(this.viewModel.searchTerm=t,t||this.clear(),this.suggest())}_handleAutocompleteOpen(){this.activeMenu="suggestion"}_handleAutocompleteClose(){"suggestion"===this.activeMenu&&(this.activeMenu="none")}_handleCalciteAutocompleteChange(e){const t=e.target.value;if(t===this._currentLocationValue)return void this._useCurrentLocation();const o=this.viewModel.suggestions?.flatMap((e=>e.results??[])),s=o?.find((e=>`${e.key}`==`${t}`));s&&this.search(s)}_renderAutocomplete(){const{_effectiveActiveMenu:e,messages:t,_isDisabled:o}=this,{maxInputLength:s,placeholder:r,searchTerm:i,state:l}=this.viewModel,n=this.label??t.searchButtonTitle??"";return S("calcite-autocomplete",{afterCreate:this._handleAutocompleteCreate,autocomplete:"off",bind:this,class:p.autocomplete,disabled:o,icon:this.icon,inputValue:i,label:n,loading:"searching"===l,maxLength:s,name:this.id,onblur:this._emitBlur,onfocus:this._emitFocus,onkeydown:this._handleInputKeydown,open:"suggestion"===e,overlayPositioning:"fixed",placeholder:r,title:i?"":r,onCalciteAutocompleteChange:this._handleCalciteAutocompleteChange,onCalciteAutocompleteClose:this._handleAutocompleteClose,onCalciteAutocompleteOpen:this._handleAutocompleteOpen,onCalciteAutocompleteTextChange:this._handleCalciteAutocompleteTextInput,onCalciteAutocompleteTextInput:this._handleCalciteAutocompleteTextInput},this._renderSuggestions(),this._renderNotices())}_renderForm(){return S("form",{bind:this,class:p.form,disabled:this._isDisabled,key:p.form,onsubmit:this._formSubmit,role:"search"},this._renderAutocomplete())}_renderSuggestGroup(e){return e.results?.map((e=>this._renderSuggestion(e)))}_renderSuggestions(){const{suggestions:e}=this.viewModel;return this._showNoResults?null:this._showCurrentLocation?this._renderUseCurrentLocation():e?.map((e=>this._renderSuggestResults(e)))}_renderSuggestResults(e){const{allSources:t,activeSourceIndex:o}=this.viewModel,{sourceIndex:s}=e,r=e.results?.length,i=t.length>1&&o===m.ALL_INDEX,l=this._getSourceName(s);return r&&i?S("calcite-autocomplete-item-group",{heading:l,key:`suggestion-group-${l}-${s}`},this._renderSuggestGroup(e)):this._renderSuggestGroup(e)}_renderSuggestion(e){return S("calcite-autocomplete-item",{heading:e.text??this.messages.untitledResult,key:`suggestion_${e.key}`,value:`${e.key}`})}_renderSource(e){const t=this._getSourceName(e);return S("calcite-dropdown-item",{"data-source-index":`${e}`,key:`source-${t}-${e}`,selected:e===this.viewModel.activeSourceIndex},t)}_renderNoResultsWarning(e){const{messages:t}=this,o=e?b(t.noResultsFoundForValue,{value:`"${e}"`}):t.noResultsFound;return S("calcite-notice",{icon:"exclamation-mark-triangle",key:"no-results-warning",kind:"warning",open:!0,slot:"content-bottom"},S("div",{slot:"title"},t.noResults),S("div",{slot:"message"},o))}_renderLocateError(){return S("calcite-notice",{icon:"exclamation-mark-circle",key:"locate-warning",kind:"danger",open:!0,slot:"content-bottom"},S("div",{slot:"message"},this.messages.locateError))}_renderNotices(){return this._locateFailed?this._renderLocateError():this._showNoResults?this._renderNoResultsWarning(this._lastSearchTerm??this.viewModel.searchTerm):null}async _useCurrentLocation(){this._cancelQueries();const e=new AbortController,{signal:t}=e;this._searchController=e;try{await this.viewModel.searchNearby({signal:t})}catch(o){l(o)||(this._locateFailed=!0,this.activeMenu="suggestion")}finally{this._searchController=null}}_handleSourceOpen(){this.activeMenu="source"}_handleSourceClose(){"source"===this.activeMenu&&(this.activeMenu="none")}_handleSourceSelect(e){const t=e.target.selectedItems[0].getAttribute("data-source-index");t&&(this.viewModel.activeSourceIndex=parseInt(t,10))}_cancelSuggest(){this.activeMenu="none",this._locateFailed=!1,this._showNoResults=!1,this._suggestController=r(this._suggestController)}_cancelQueries(){this._cancelSuggest(),this._searchController=r(this._searchController)}_scrollToTopSuggestion(){this._autocompleteNode?.scrollContentTo({top:0})}_formSubmit(e){e.preventDefault(),this.activeMenu="none",this._lastSearchTerm=this.searchTerm,this.searchTerm&&this.search()}_getSourceName(e){const{messages:t}=this,{allSources:o}=this.viewModel,s=o.at(e);return e===m.ALL_INDEX?t.all:s?.name||t.untitledSource}};e([u()],y.prototype,"_locateFailed",void 0),e([u()],y.prototype,"_showNoResults",void 0),e([u()],y.prototype,"_isDisabled",null),e([u()],y.prototype,"_showCurrentLocation",null),e([u()],y.prototype,"_effectiveActiveMenu",null),e([u()],y.prototype,"activeMenu",null),e([u({readOnly:!0})],y.prototype,"activeSource",null),e([u()],y.prototype,"activeSourceIndex",null),e([u()],y.prototype,"allPlaceholder",null),e([u({readOnly:!0})],y.prototype,"allSources",null),e([u()],y.prototype,"autoNavigate",null),e([u()],y.prototype,"autoSelect",null),e([u({readOnly:!0})],y.prototype,"defaultSources",null),e([u()],y.prototype,"disabled",void 0),e([u()],y.prototype,"goToOverride",null),e([u()],y.prototype,"icon",null),e([u()],y.prototype,"includeDefaultSources",null),e([u()],y.prototype,"label",null),e([u()],y.prototype,"locationEnabled",null),e([u()],y.prototype,"maxResults",null),e([u()],y.prototype,"maxSuggestions",null),e([u(),w("esri/widgets/Search/t9n/Search")],y.prototype,"messages",void 0),e([u(),w("esri/t9n/common")],y.prototype,"messagesCommon",void 0),e([u()],y.prototype,"minSuggestCharacters",null),e([u()],y.prototype,"popupEnabled",null),e([u()],y.prototype,"popupTemplate",null),e([u()],y.prototype,"portal",null),e([u()],y.prototype,"resultGraphic",null),e([u()],y.prototype,"resultGraphicEnabled",null),e([u({readOnly:!0})],y.prototype,"results",null),e([u()],y.prototype,"searchAllEnabled",null),e([u()],y.prototype,"searchTerm",null),e([u({readOnly:!0})],y.prototype,"selectedResult",null),e([u()],y.prototype,"sources",null),e([u({readOnly:!0})],y.prototype,"suggestions",null),e([u()],y.prototype,"suggestionsEnabled",null),e([u()],y.prototype,"view",null),e([M(["search-complete","search-clear","search-start","select-result","suggest-start","suggest-complete"]),u({type:m})],y.prototype,"viewModel",void 0),y=e([h("esri.widgets.Search")],y);const C=y;export{C as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{deprecatedPropertyValue as t}from"../core/deprecate.js";import o from"../core/Logger.js";import{destroyMaybe as s,abortMaybe as r}from"../core/maybe.js";import{ignoreAbortErrors as i,isAbortError as l}from"../core/promiseUtils.js";import{watch as n,initial as a}from"../core/reactiveUtils.js";import{waitAnimationFrame as c}from"../core/scheduling.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import{css as p}from"./Search/css.js";import g from"./Search/SearchResultRenderer.js";import m from"./Search/SearchViewModel.js";import{loadCalciteComponents as v}from"./support/componentsUtils.js";import{globalCss as _}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as w}from"./support/decorators/messageBundle.js";import{vmEvent as S}from"./support/decorators/vmEvent.js";import{tsx as M}from"./support/jsxFactory.js";import{substitute as b}from"../intl/substitute.js";let y=class extends d{constructor(e,t){super(e,t),this._currentLocationValue=`${this.id}-search-use-current-location`,this._autocompleteNode=null,this._focusAbortController=null,this._searchResultRenderer=new g,this._suggestController=null,this._searchController=null,this._lastSearchTerm="",this._locateFailed=!1,this._showNoResults=!1,this.disabled=!1,this.messages=null,this.messagesCommon=null,this.viewModel=new m,this._renderSearchResultsContent=()=>this._searchResultRenderer,this.addHandles([n((()=>this.viewModel),(e=>this._searchResultRenderer.viewModel=e),a),n((()=>this.viewModel.results),(()=>this._searchResultRenderer.showMoreResultsOpen=!1)),n((()=>this.viewModel?.defaultPopupTemplate),(e=>{e&&(e.content=this._renderSearchResultsContent)}),a)])}loadDependencies(){return v({autocomplete:()=>import("@esri/calcite-components/dist/components/calcite-autocomplete"),"autocomplete-item-group":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item-group"),"autocomplete-item":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}destroy(){this._cancelQueries(),this._searchResultRenderer=s(this._searchResultRenderer),this._focusAbortController?.abort()}get _isDisabled(){const{state:e}=this.viewModel;return"disabled"===e||"loading"===e||this.disabled}get _showCurrentLocation(){return this.locationEnabled&&!this.searchTerm?.trim()}get _effectiveActiveMenu(){const{activeMenu:e}=this;return this._isDisabled?"none":"warning"===e?"suggestion":e}get activeMenu(){return"none"}set activeMenu(e){"warning"===e&&t(o.getLogger(this),"activeMenu","warning",{replacement:"Use the value 'suggestion' instead",version:"4.32",warnOnce:!0}),this._overrideIfSome("activeMenu",e)}get activeSource(){return this.viewModel?.activeSource}get activeSourceIndex(){return this.viewModel.activeSourceIndex}set activeSourceIndex(e){this.viewModel.activeSourceIndex=e}get allPlaceholder(){return this.viewModel.allPlaceholder}set allPlaceholder(e){this.viewModel.allPlaceholder=e}get allSources(){return this.viewModel.allSources}get autoNavigate(){return this.viewModel.autoNavigate}set autoNavigate(e){this.viewModel.autoNavigate=e}get autoSelect(){return this.viewModel.autoSelect}set autoSelect(e){this.viewModel.autoSelect=e}get defaultSources(){return this.viewModel.defaultSources}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"search"}set icon(e){this._overrideIfSome("icon",e)}get includeDefaultSources(){return this.viewModel.includeDefaultSources}set includeDefaultSources(e){this.viewModel.includeDefaultSources=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get locationEnabled(){return this.viewModel.locationEnabled}set locationEnabled(e){this.viewModel.locationEnabled=e}get maxResults(){return this.viewModel.maxResults}set maxResults(e){this.viewModel.maxResults=e}get maxSuggestions(){return this.viewModel.maxSuggestions}set maxSuggestions(e){this.viewModel.maxSuggestions=e}get minSuggestCharacters(){return this.viewModel.minSuggestCharacters}set minSuggestCharacters(e){this.viewModel.minSuggestCharacters=e}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get portal(){return this.viewModel?.portal}set portal(e){this.viewModel&&(this.viewModel.portal=e)}get resultGraphic(){return this.viewModel.resultGraphic}set resultGraphic(e){this.viewModel.resultGraphic=e}get resultGraphicEnabled(){return this.viewModel.resultGraphicEnabled}set resultGraphicEnabled(e){this.viewModel.resultGraphicEnabled=e}get results(){return this.viewModel.results}get searchAllEnabled(){return this.viewModel.searchAllEnabled}set searchAllEnabled(e){this.viewModel.searchAllEnabled=e}get searchTerm(){return this.viewModel.searchTerm}set searchTerm(e){this.viewModel.searchTerm=e}get selectedResult(){return this.viewModel.selectedResult}get sources(){return this.viewModel.sources}set sources(e){this.viewModel.sources=e}get suggestions(){return this.viewModel.suggestions}get suggestionsEnabled(){return this.viewModel.suggestionsEnabled}set suggestionsEnabled(e){this.viewModel.suggestionsEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}clear(){this._locateFailed=!1,this.viewModel.clear()}focus(){this._handleFocus(),this._emitFocus()}blur(){this._autocompleteNode?.blur(),this._emitBlur()}async search(e){this._cancelQueries();const t=new AbortController,{signal:o}=t;this._searchController=t;try{const s=await this.viewModel.search(e,{signal:o});if(this._searchController!==t)return;return s?.numResults||(this._showNoResults=!0,this.activeMenu="suggestion"),this._searchController=null,s}catch(s){if(this._searchController!==t)return;return void(this._searchController=null)}}async suggest(e){this._cancelSuggest();const t=new AbortController,{signal:o}=t;this._suggestController=t;try{const s=await this.viewModel.suggest(e,null,{signal:o});if(this._suggestController!==t)return;return this._suggestController=null,s?.numResults&&(this.activeMenu="suggestion",this._scrollToTopSuggestion()),s}catch(s){return this._suggestController!==t||(this._suggestController=null),null}}render(){return M("div",{class:this.classes(p.base,_.widget)},M("div",{class:p.container},this._renderSourcesMenu(),this._renderForm()))}_handleInputKeydown(e){"Tab"===e.key&&this._cancelSuggest()}_emitFocus(){this.emit("search-focus")}_emitBlur(){this.emit("search-blur")}async _handleFocus(){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const e=this._focusAbortController.signal;await i(c(e)),this._autocompleteNode?.setFocus()}_renderSourcesMenu(){const{messages:e,_isDisabled:t,_effectiveActiveMenu:o}=this,{allSources:s,searchAllEnabled:r}=this.viewModel;return s.length>1?M("calcite-dropdown",{bind:this,class:p.dropdown,disabled:t,open:"source"===o,overlayPositioning:"fixed",onCalciteDropdownClose:this._handleSourceClose,onCalciteDropdownOpen:this._handleSourceOpen,onCalciteDropdownSelect:this._handleSourceSelect},M("calcite-button",{appearance:"outline-fill",iconStart:"caret-down",kind:"neutral",label:e.searchIn,slot:"trigger"}),M("calcite-dropdown-group",{groupTitle:e.searchIn},r?this._renderSource(m.ALL_INDEX):null,s.map(((e,t)=>this._renderSource(t))).toArray())):null}_renderUseCurrentLocation(){const{_currentLocationValue:e}=this;return M("calcite-autocomplete-item",{heading:this.messages.useCurrentLocation,iconStart:"gps-on",key:e,value:e})}_handleAutocompleteCreate(e){this._autocompleteNode=e}_handleCalciteAutocompleteTextInput(e){const t=e.target.inputValue;t!==this.viewModel.searchTerm&&(this.viewModel.searchTerm=t,t||this.clear(),this.suggest())}_handleAutocompleteOpen(){this.activeMenu="suggestion"}_handleAutocompleteClose(){"suggestion"===this.activeMenu&&(this.activeMenu="none")}_handleCalciteAutocompleteChange(e){const t=e.target.value;if(t===this._currentLocationValue)return void this._useCurrentLocation();const o=JSON.parse(t),s=this.viewModel.suggestions?.find((({sourceIndex:e})=>e===o.sourceIndex))?.results?.find((({key:e})=>`${e}`==`${o.key}`));s&&this.search(s)}_renderAutocomplete(){const{_effectiveActiveMenu:e,messages:t,_isDisabled:o}=this,{maxInputLength:s,placeholder:r,searchTerm:i,state:l}=this.viewModel,n=this.label??t.searchButtonTitle??"";return M("calcite-autocomplete",{afterCreate:this._handleAutocompleteCreate,autocomplete:"off",bind:this,class:p.autocomplete,disabled:o,icon:this.icon,inputValue:i,label:n,loading:"searching"===l,maxLength:s,name:this.id,onblur:this._emitBlur,onfocus:this._emitFocus,onkeydown:this._handleInputKeydown,open:"suggestion"===e,overlayPositioning:"fixed",placeholder:r,title:i?"":r,onCalciteAutocompleteChange:this._handleCalciteAutocompleteChange,onCalciteAutocompleteClose:this._handleAutocompleteClose,onCalciteAutocompleteOpen:this._handleAutocompleteOpen,onCalciteAutocompleteTextChange:this._handleCalciteAutocompleteTextInput,onCalciteAutocompleteTextInput:this._handleCalciteAutocompleteTextInput},this._renderSuggestions(),this._renderNotices())}_renderForm(){return M("form",{bind:this,class:p.form,disabled:this._isDisabled,key:p.form,onsubmit:this._formSubmit,role:"search"},this._renderAutocomplete())}_renderSuggestGroup(e){return e.results?.map((e=>this._renderSuggestion(e)))}_renderSuggestions(){const{suggestions:e}=this.viewModel;return this._showNoResults?null:this._showCurrentLocation?this._renderUseCurrentLocation():e?.map((e=>this._renderSuggestResults(e)))}_renderSuggestResults(e){const{allSources:t,activeSourceIndex:o}=this.viewModel,{sourceIndex:s}=e,r=e.results?.length,i=t.length>1&&o===m.ALL_INDEX,l=this._getSourceName(s);return r&&i?M("calcite-autocomplete-item-group",{heading:l,key:`suggestion-group-${l}-${s}`},this._renderSuggestGroup(e)):this._renderSuggestGroup(e)}_renderSuggestion({key:e,sourceIndex:t,text:o}){const s={key:e,sourceIndex:t};return M("calcite-autocomplete-item",{heading:o??this.messages.untitledResult,key:`suggestion_${e}`,value:JSON.stringify(s)})}_renderSource(e){const t=this._getSourceName(e);return M("calcite-dropdown-item",{"data-source-index":`${e}`,key:`source-${t}-${e}`,selected:e===this.viewModel.activeSourceIndex},t)}_renderNoResultsWarning(e){const{messages:t}=this,o=e?b(t.noResultsFoundForValue,{value:`"${e}"`}):t.noResultsFound;return M("calcite-notice",{icon:"exclamation-mark-triangle",key:"no-results-warning",kind:"warning",open:!0,slot:"content-bottom"},M("div",{slot:"title"},t.noResults),M("div",{slot:"message"},o))}_renderLocateError(){return M("calcite-notice",{icon:"exclamation-mark-circle",key:"locate-warning",kind:"danger",open:!0,slot:"content-bottom"},M("div",{slot:"message"},this.messages.locateError))}_renderNotices(){return this._locateFailed?this._renderLocateError():this._showNoResults?this._renderNoResultsWarning(this._lastSearchTerm??this.viewModel.searchTerm):null}async _useCurrentLocation(){this._cancelQueries();const e=new AbortController,{signal:t}=e;this._searchController=e;try{await this.viewModel.searchNearby({signal:t})}catch(o){l(o)||(this._locateFailed=!0,this.activeMenu="suggestion")}finally{this._searchController=null}}_handleSourceOpen(){this.activeMenu="source"}_handleSourceClose(){"source"===this.activeMenu&&(this.activeMenu="none")}_handleSourceSelect(e){const t=e.target.selectedItems[0].getAttribute("data-source-index");t&&(this.viewModel.activeSourceIndex=parseInt(t,10))}_cancelSuggest(){this.activeMenu="none",this._locateFailed=!1,this._showNoResults=!1,this._suggestController=r(this._suggestController)}_cancelQueries(){this._cancelSuggest(),this._searchController=r(this._searchController)}_scrollToTopSuggestion(){this._autocompleteNode?.scrollContentTo({top:0})}_formSubmit(e){e.preventDefault(),this.activeMenu="none",this._lastSearchTerm=this.searchTerm,this.searchTerm&&this.search()}_getSourceName(e){const{messages:t}=this,{allSources:o}=this.viewModel,s=o.at(e);return e===m.ALL_INDEX?t.all:s?.name||t.untitledSource}};e([u()],y.prototype,"_locateFailed",void 0),e([u()],y.prototype,"_showNoResults",void 0),e([u()],y.prototype,"_isDisabled",null),e([u()],y.prototype,"_showCurrentLocation",null),e([u()],y.prototype,"_effectiveActiveMenu",null),e([u()],y.prototype,"activeMenu",null),e([u({readOnly:!0})],y.prototype,"activeSource",null),e([u()],y.prototype,"activeSourceIndex",null),e([u()],y.prototype,"allPlaceholder",null),e([u({readOnly:!0})],y.prototype,"allSources",null),e([u()],y.prototype,"autoNavigate",null),e([u()],y.prototype,"autoSelect",null),e([u({readOnly:!0})],y.prototype,"defaultSources",null),e([u()],y.prototype,"disabled",void 0),e([u()],y.prototype,"goToOverride",null),e([u()],y.prototype,"icon",null),e([u()],y.prototype,"includeDefaultSources",null),e([u()],y.prototype,"label",null),e([u()],y.prototype,"locationEnabled",null),e([u()],y.prototype,"maxResults",null),e([u()],y.prototype,"maxSuggestions",null),e([u(),w("esri/widgets/Search/t9n/Search")],y.prototype,"messages",void 0),e([u(),w("esri/t9n/common")],y.prototype,"messagesCommon",void 0),e([u()],y.prototype,"minSuggestCharacters",null),e([u()],y.prototype,"popupEnabled",null),e([u()],y.prototype,"popupTemplate",null),e([u()],y.prototype,"portal",null),e([u()],y.prototype,"resultGraphic",null),e([u()],y.prototype,"resultGraphicEnabled",null),e([u({readOnly:!0})],y.prototype,"results",null),e([u()],y.prototype,"searchAllEnabled",null),e([u()],y.prototype,"searchTerm",null),e([u({readOnly:!0})],y.prototype,"selectedResult",null),e([u()],y.prototype,"sources",null),e([u({readOnly:!0})],y.prototype,"suggestions",null),e([u()],y.prototype,"suggestionsEnabled",null),e([u()],y.prototype,"view",null),e([S(["search-complete","search-clear","search-start","select-result","suggest-start","suggest-complete"]),u({type:m})],y.prototype,"viewModel",void 0),y=e([h("esri.widgets.Search")],y);const C=y;export{C as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2282],{21015:(e,t,_)=>{_.d(t,{R:()=>o});var E=_(78888),n=_(60999),r=_(49186),R=_(74887),A=_(84952);class o{constructor(e){this._streamDataRequester=e}async loadJSON(e,t){return this._load("json",e,t)}async loadBinary(e,t){return(0,A.DB)(e)?((0,R.Te)(t),(0,A.lJ)(e)):this._load("binary",e,t)}async loadImage(e,t){return this._load("image",e,t)}async _load(e,t,_){if(null==this._streamDataRequester)return(await(0,E.A)(t,{responseType:T[e]})).data;const A=await(0,n.Ke)(this._streamDataRequester.request(t,e,_));if(!0===A.ok)return A.value;throw(0,R.QP)(A.error),new r.A("glt-loader-request-error",`Request for resource failed: ${A.error}`)}}const T={image:"image",binary:"array-buffer",json:"json","image+type":void 0}},43609:(e,t,_)=>{_.d(t,{a:()=>r,f:()=>R,n:()=>n});var E=_(34275);function n(e,t){r(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function r(e,t,_=2,n=_){const r=t.length/2;let R=0,A=0;if(!(0,E.iu)(t)||(0,E.dk)(t)){for(let E=0;E<r;++E)e[R]=t[A],e[R+1]=t[A+1],R+=_,A+=n;return}const o=(0,E.a3)(t);if((0,E.JI)(t))for(let E=0;E<r;++E)e[R]=Math.max(t[A]/o,-1),e[R+1]=Math.max(t[A+1]/o,-1),R+=_,A+=n;else for(let E=0;E<r;++E)e[R]=t[A]/o,e[R+1]=t[A+1]/o,R+=_,A+=n}function R(e,t,_,E){const n=e.typedBuffer,r=e.typedBufferStride,R=E?.count??e.count;let A=(E?.dstIndex??0)*r;for(let e=0;e<R;++e)n[A]=t,n[A+1]=_,A+=r}Object.freeze(Object.defineProperty({__proto__:null,fill:R,normalizeIntegerBuffer:r,normalizeIntegerBufferView:n},Symbol.toStringTag,{value:"Module"}))},46140:(e,t,_)=>{_.d(t,{R:()=>n});var E=_(49186);let n=class e{constructor(e,t,_=""){this.major=e,this.minor=t,this._context=_}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}greaterEqual(e,t){return!this.lessThan(e,t)}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",_=this._context&&this._context+" ";throw new E.A(t+"unsupported-version",`Required major ${_}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new e(this.major,this.minor,this._context)}static parse(t,_=""){const[n,r]=t.split("."),R=/^\s*\d+\s*$/;if(!n?.match||!R.test(n))throw new E.A((_&&_+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:t});if(!r?.match||!R.test(r))throw new E.A((_&&_+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:t});const A=parseInt(n,10),o=parseInt(r,10);return new e(A,o,_)}}},51530:(e,t,_)=>{_.d(t,{KB:()=>A,Xi:()=>r,pn:()=>o,x3:()=>R});var E=_(44208),n=_(89192);class r{constructor(e){this.data=e,this.type="encoded-mesh-texture",this.encoding=n.JS.KTX2_ENCODING}}function R(e){return"encoded-mesh-texture"===e?.type}async function A(e){const t=new Blob([e]),_=await t.text();return JSON.parse(_)}async function o(e,t){if(t===n.JS.KTX2_ENCODING)return new r(e);const _=new Blob([e],{type:t});let R=URL.createObjectURL(_);switch(t){case"image/jpeg":R+="#.jpg";break;case"image/png":R+="#.png"}const A=new Image;if((0,E.A)("esri-iPhone"))return new Promise(((e,t)=>{const _=()=>{n(),e(A)},E=e=>{n(),t(e)},n=()=>{URL.revokeObjectURL(R),A.removeEventListener("load",_),A.removeEventListener("error",E)};A.addEventListener("load",_),A.addEventListener("error",E),A.src=R}));try{A.src=R,await A.decode()}catch(e){console.warn("Failed decoding HTMLImageElement")}return URL.revokeObjectURL(R),A}},63907:(e,t,_)=>{var E,n,r,R,A,o,T,N,S,I,i,s,a,u,c,O,f,C,l,D,L,M,U,G,P,B,d;_.d(t,{Ab:()=>O,Ac:()=>N,Ap:()=>u,CQ:()=>H,Cj:()=>s,Fq:()=>p,H0:()=>f,H3:()=>c,Hr:()=>d,MT:()=>I,NV:()=>E,SB:()=>D,Tb:()=>A,WR:()=>r,Xo:()=>L,Y7:()=>T,bh:()=>X,dn:()=>R,eA:()=>i,iE:()=>l,j7:()=>C,ld:()=>M,nI:()=>y,pF:()=>a,pe:()=>S,r6:()=>F,vt:()=>B,yI:()=>m}),function(e){e[e.DEPTH=256]="DEPTH",e[e.STENCIL=1024]="STENCIL",e[e.COLOR=16384]="COLOR"}(E||(E={})),function(e){e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(n||(n={})),function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(r||(r={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(R||(R={})),function(e){e[e.ADD=32774]="ADD",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.SUBTRACT=32778]="SUBTRACT",e[e.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(A||(A={})),function(e){e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER"}(o||(o={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(T||(T={})),function(e){e[e.CW=2304]="CW",e[e.CCW=2305]="CCW"}(N||(N={})),function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.HALF_FLOAT=5131]="HALF_FLOAT"}(S||(S={})),function(e){e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS"}(I||(I={})),function(e){e[e.ZERO=0]="ZERO",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP"}(i||(i={})),function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(s||(s={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.REPEAT=10497]="REPEAT",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(a||(a={})),function(e){e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY"}(u||(u={})),function(e){e[e.MIN_LOD=33082]="MIN_LOD",e[e.MAX_LOD=33083]="MAX_LOD",e[e.BASE_LEVEL=33084]="BASE_LEVEL",e[e.MAX_LEVEL=33085]="MAX_LEVEL",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE"}(c||(c={})),function(e){e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.RED=6403]="RED",e[e.RG=33319]="RG",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER"}(O||(O={})),function(e){e[e.RGBA4=32854]="RGBA4",e[e.R16F=33325]="R16F",e[e.RG16F=33327]="RG16F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.R32F=33326]="R32F",e[e.RG32F=33328]="RG32F",e[e.RGBA32F=34836]="RGBA32F",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB5_A1=32855]="RGB5_A1",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.RGB16F=34843]="RGB16F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.RGB565=36194]="RGB565",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2=32857]="RGB10_A2",e[e.RGB10_A2UI=36975]="RGB10_A2UI"}(f||(f={})),function(e){e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(C||(C={})),function(e){e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8"}(l||(l={})),function(e){e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F"}(D||(D={})),function(e){e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8"}(L||(L={})),function(e){e[e.FLOAT=5126]="FLOAT",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.INT=5124]="INT",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV"}(M||(M={})),function(e){e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.STATIC_READ=35045]="STATIC_READ",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.STREAM_COPY=35042]="STREAM_COPY"}(U||(U={})),function(e){e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER"}(G||(G={})),function(e){e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(P||(P={})),function(e){e[e.Texture=0]="Texture",e[e.BufferObject=1]="BufferObject",e[e.VertexArrayObject=2]="VertexArrayObject",e[e.Shader=3]="Shader",e[e.Program=4]="Program",e[e.FramebufferObject=5]="FramebufferObject",e[e.Renderbuffer=6]="Renderbuffer",e[e.TransformFeedback=7]="TransformFeedback",e[e.Sync=8]="Sync",e[e.UNCOUNTED=9]="UNCOUNTED",e[e.LinesOfCode=9]="LinesOfCode",e[e.Uniform=10]="Uniform",e[e.COUNT=11]="COUNT"}(B||(B={})),function(e){e[e.NONE=0]="NONE",e[e.BACK=1029]="BACK"}(d||(d={}));const F=36064,m=36065,p=36066,y=33306;var H,g,x,h,V,b,v,X,Y;!function(e){e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(H||(H={})),function(e){e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT=5124]="INT",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(g||(g={})),function(e){e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS"}(x||(x={})),function(e){e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED"}(h||(h={})),function(e){e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED"}(V||(V={})),function(e){e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(b||(b={})),function(e){e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(v||(v={})),function(e){e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL"}(X||(X={})),function(e){e[e.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR"}(Y||(Y={}))},84498:(e,t,_)=>{_.d(t,{x:()=>R});var E=_(34275),n=_(97146),r=_(63907);function R(e,t){switch(t){case r.WR.TRIANGLES:return"number"==typeof(_=e)?(0,n.tM)(_):(0,E.mg)(_)?new Uint16Array(_):_;case r.WR.TRIANGLE_STRIP:return function(e){const t="number"==typeof e?e:e.length;if(t<3)return[];const _=t-2,E=(0,n.my)(3*_);if("number"==typeof e){let e=0;for(let t=0;t<_;t+=1)t%2==0?(E[e++]=t,E[e++]=t+1,E[e++]=t+2):(E[e++]=t+1,E[e++]=t,E[e++]=t+2)}else{let t=0;for(let n=0;n<_;n+=1)n%2==0?(E[t++]=e[n],E[t++]=e[n+1],E[t++]=e[n+2]):(E[t++]=e[n+1],E[t++]=e[n],E[t++]=e[n+2])}return E}(e);case r.WR.TRIANGLE_FAN:return function(e){const t="number"==typeof e?e:e.length;if(t<3)return new Uint16Array(0);const _=t-2,E=_<=65536?new Uint16Array(3*_):new Uint32Array(3*_);if("number"==typeof e){let e=0;for(let t=0;t<_;++t)E[e++]=0,E[e++]=t+1,E[e++]=t+2;return E}const n=e[0];let r=e[1],R=0;for(let t=0;t<_;++t){const _=e[t+2];E[R++]=n,E[R++]=r,E[R++]=_,r=_}return E}(e)}var _}},89192:(e,t,_)=>{var E,n,r,R,A,o,T,N;_.d(t,{Am:()=>R,C7:()=>r,JS:()=>N,Mg:()=>o,dd:()=>A,it:()=>n,s2:()=>E,sf:()=>T}),function(e){e[e.None=0]="None",e[e.Front=1]="Front",e[e.Back=2]="Back",e[e.COUNT=3]="COUNT"}(E||(E={})),function(e){e[e.Less=0]="Less",e[e.Lequal=1]="Lequal",e[e.COUNT=2]="COUNT"}(n||(n={})),function(e){e[e.BACKGROUND=0]="BACKGROUND",e[e.UPDATE=1]="UPDATE"}(r||(r={})),function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(R||(R={})),function(e){e[e.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",e[e.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(A||(A={})),function(e){e[e.Highlight=0]="Highlight",e[e.MaskOccludee=1]="MaskOccludee"}(o||(o={})),function(e){e[e.Blend=0]="Blend",e[e.Opaque=1]="Opaque",e[e.Mask=2]="Mask",e[e.MaskBlend=3]="MaskBlend",e[e.COUNT=4]="COUNT"}(T||(T={})),function(e){e.DDS_ENCODING="image/vnd-ms.dds",e.KTX2_ENCODING="image/ktx2",e.BASIS_ENCODING="image/x.basis"}(N||(N={}))},90239:(e,t,_)=>{function E(e){switch(e){case"u8":case"i8":return 1;case"u16":case"i16":case"f16":return 2;case"u32":case"i32":case"f32":return 4;case"f64":return 8}}_.d(t,{GJ:()=>E})},97375:(e,t,_)=>{_.r(t),_.d(t,{loadGLTFMesh:()=>g});var E=_(68197),n=_(40876),r=_(78888),R=_(49186),A=_(91869),o=_(34727),T=_(77690),N=_(29242),S=_(51850),I=_(91829),i=_(16939),s=_(80882),a=_(35063),u=_(51147),c=_(1193),O=_(27615),f=_(13030),C=_(73354),l=_(65686),D=_(90239);Object.freeze(Object.defineProperty({__proto__:null,copy:function(e,t,_){const E=e.typedBuffer,n=e.typedBufferStride,r=t.typedBuffer,R=t.typedBufferStride,A=_?_.count:t.count;let o=(_?.dstIndex??0)*n,T=(_?.srcIndex??0)*R;for(let e=0;e<A;++e){for(let e=0;e<9;++e)E[o+e]=r[T+e];o+=n,T+=R}}},Symbol.toStringTag,{value:"Module"})),Object.freeze(Object.defineProperty({__proto__:null,copy:function(e,t,_){const E=e.typedBuffer,n=e.typedBufferStride,r=t.typedBuffer,R=t.typedBufferStride,A=_?_.count:t.count;let o=(_?.dstIndex??0)*n,T=(_?.srcIndex??0)*R;for(let e=0;e<A;++e){for(let e=0;e<16;++e)E[o+e]=r[T+e];o+=n,T+=R}}},Symbol.toStringTag,{value:"Module"})),_(24045);var L=_(43609);function M(e,t,_=3,E=_){const n=t.length/E;let r=0,R=0;for(let A=0;A<n;++A)e[r]=t[R],e[r+1]=t[R+1],e[r+2]=t[R+2],r+=_,R+=E}function U(e,t,_,E,n){const r=e.typedBuffer,R=e.typedBufferStride,A=n?.count??e.count;let o=(n?.dstIndex??0)*R;for(let e=0;e<A;++e)r[o]=t,r[o+1]=_,r[o+2]=E,o+=R}function G(e,t,_=4){const E=t.typedBuffer,n=t.typedBufferStride,r=t.count;let R=0,A=0;for(let t=0;t<r;++t)e[R]=E[A],e[R+1]=E[A+1],e[R+2]=E[A+2],e[R+3]=E[A+3],R+=_,A+=n}function P(e,t,_,E,n,r){const R=e.typedBuffer,A=e.typedBufferStride,o=r?.count??e.count;let T=(r?.dstIndex??0)*A;for(let e=0;e<o;++e)R[T]=t,R[T+1]=_,R[T+2]=E,R[T+3]=n,T+=A}function B(e,t){return new e(new ArrayBuffer(t*e.ElementCount*(0,D.GJ)(e.ElementType)))}Object.freeze(Object.defineProperty({__proto__:null,copy:M,copyView:function(e,t){M(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)},fill:U},Symbol.toStringTag,{value:"Module"})),Object.freeze(Object.defineProperty({__proto__:null,copy:G,copyView:function(e,t){G(e.typedBuffer,t,e.typedBufferStride)},fill:P},Symbol.toStringTag,{value:"Module"}));var d=_(72258),F=_(21015),m=_(4399),p=_(84498),y=_(51530),H=_(63907);async function g(e,t,_){const n=new F.R(function(e){const t=e?.resolveFile;return t?{busy:!1,request:async(e,_,E)=>{const n=t?.(e)??e,R="image"===_?"image":"binary"===_||"image+type"===_?"array-buffer":"json";return(await(0,r.A)(n,{responseType:R,signal:E?.signal,timeout:0})).data}}:null}(_)),T=(await(0,m.loadGLTF)(n,t,_,!0)).model,N=T.lods.shift(),i=new Map,C=new Map;T.textures.forEach(((e,t)=>i.set(t,function(e){return new a.A({data:((0,y.x3)(e.data),e.data),wrap:v(e.parameters.wrap)})}(e)))),T.materials.forEach(((e,t)=>C.set(t,function(e,t){const _=new E.A(function(e,t){return(0,I.fA)(Y(e[0]),Y(e[1]),Y(e[2]),t)}(e.color,e.opacity)),n=e.emissiveFactor?new E.A(function(e){return(0,S.fA)(Y(e[0]),Y(e[1]),Y(e[2]))}(e.emissiveFactor)):null,r=e=>e?new u.A({scale:e.scale?[e.scale[0],e.scale[1]]:[1,1],rotation:(0,o.KJ)(e.rotation??0),offset:e.offset?[e.offset[0],e.offset[1]]:[0,0]}):null;return new s.A({color:_,colorTexture:t.get(e.colorTexture),normalTexture:t.get(e.normalTexture),emissiveColor:n,emissiveTexture:t.get(e.emissiveTexture),occlusionTexture:t.get(e.occlusionTexture),alphaMode:b(e.alphaMode),alphaCutoff:e.alphaCutoff,doubleSided:e.doubleSided,metallic:e.metallicFactor,roughness:e.roughnessFactor,metallicRoughnessTexture:t.get(e.metallicRoughnessTexture),colorTextureTransform:r(e.colorTextureTransform),normalTextureTransform:r(e.normalTextureTransform),occlusionTextureTransform:r(e.occlusionTextureTransform),emissiveTextureTransform:r(e.emissiveTextureTransform),metallicRoughnessTextureTransform:r(e.metallicRoughnessTextureTransform)})}(e,i))));const l=function(e){let t=0;const _={color:!1,tangent:!1,normal:!1,texCoord0:!1},E=new Map,n=new Map,r=[];for(const R of e.parts){const{position:e,normal:o,color:T,tangent:N,texCoord0:S}=R.attributes,I=`\n ${x(e,E)}/\n ${x(o,E)}/\n ${x(T,E)}/\n ${x(N,E)}/\n ${x(S,E)}/\n ${h(R.transform)}\n `;let i=!1;const s=(0,A.tE)(n,I,(()=>(i=!0,{start:t,length:e.count})));i&&(t+=e.count),o&&(_.normal=!0),T&&(_.color=!0),N&&(_.tangent=!0),S&&(_.texCoord0=!0),r.push({gltf:R,writeVertices:i,region:s})}return{vertexAttributes:{position:B(f.Xm,t),normal:_.normal?B(f.xs,t):null,tangent:_.tangent?B(f.Eq,t):null,color:_.color?B(f.XP,t):null,texCoord0:_.texCoord0?B(f.gH,t):null},parts:r,components:[]}}(N);for(const e of l.parts)V(l,e,C);const{position:D,normal:L,tangent:M,color:U,texCoord0:G}=l.vertexAttributes,P=(0,O.TE)(e,_),p=e.spatialReference.isGeographic?(0,O.TE)(e):P,H=(0,d.UR)({vertexAttributes:{position:D.typedBuffer,normal:L?.typedBuffer,tangent:M?.typedBuffer},vertexSpace:p,spatialReference:e.spatialReference},P,{allowBufferReuse:!0,sourceUnit:_?.unitConversionDisabled?void 0:"meters"});if(!H)throw new R.A("load-gltf-mesh:vertex-space-projection",`Failed to load mesh from glTF because we could not convert the vertex space from ${p.type} to ${P.type}`);return{transform:null,vertexSpace:P,components:l.components,spatialReference:e.spatialReference,vertexAttributes:new c.H({...H,color:U?.typedBuffer,uv:G?.typedBuffer})}}function x(e,t){if(null==e)return"-";const _=e.typedBuffer;return`${(0,A.tE)(t,_.buffer,(()=>t.size))}/${_.byteOffset}/${_.byteLength}`}function h(e){return null!=e?e.toString():"-"}function V(e,t,_){t.writeVertices&&function(e,t){const{position:_,normal:E,tangent:n,color:r,texCoord0:R}=e.vertexAttributes,A=t.region.start,{attributes:S,transform:I}=t.gltf,i=S.position.count;if((0,C.d)(_.slice(A,i),S.position,I),null!=S.normal&&null!=E){const e=(0,T.Ge)((0,N.vt)(),I),t=E.slice(A,i);(0,C.c)(t,S.normal,e),(0,o.or)(e)&&(0,C.e)(t,t)}else null!=E&&U(E,0,0,1,{dstIndex:A,count:i});if(null!=S.tangent&&null!=n){const e=(0,T.z0)((0,N.vt)(),I),t=n.slice(A,i);(0,l.a)(t,S.tangent,e),(0,o.or)(e)&&(0,l.n)(t,t)}else null!=n&&P(n,0,0,1,1,{dstIndex:A,count:i});if(null!=S.texCoord0&&null!=R?(0,L.n)(R.slice(A,i),S.texCoord0):null!=R&&(0,L.f)(R,0,0,{dstIndex:A,count:i}),null!=S.color&&null!=r){const e=S.color,t=r.slice(A,i);if(4===e.elementCount)e instanceof f.Eq?(0,l.l)(t,e,1,255):(e instanceof f.XP||e instanceof f.Uz)&&(0,l.l)(t,e,1/255,255);else{P(t,255,255,255,255);const _=f.eI.fromTypedArray(t.typedBuffer,t.typedBufferStride);e instanceof f.xs?(0,C.l)(_,e,1,255):(e instanceof f.eI||e instanceof f.nS)&&(0,C.l)(_,e,1/255,255)}}else null!=r&&P(r.slice(A,i),255,255,255,255)}(e,t);const{indices:E,attributes:n,primitiveType:r,material:R}=t.gltf;let A=(0,p.x)(E||n.position.count,r);const S=t.region.start;if(S){const e=new Uint32Array(A);for(let t=0;t<A.length;t++)e[t]+=S;A=e}e.components.push(new i.A({name:t.gltf.name,faces:A,material:_.get(R),shading:n.normal?"source":"flat",trustSourceNormals:!0}))}function b(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend"}}function v(e){return{horizontal:X(e.s),vertical:X(e.t)}}function X(e){switch(e){case H.pF.CLAMP_TO_EDGE:return"clamp";case H.pF.MIRRORED_REPEAT:return"mirror";case H.pF.REPEAT:return"repeat"}}function Y(e){return e**(1/n.Tf)*255}}}]);
|