@vertigis/arcgis-extensions 37.2.1 → 37.3.0
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/AppConfig.schema.json +0 -16
- package/data/Feature.js +1 -1
- package/data/FeatureSet.js +1 -1
- package/data/FieldExtension.js +1 -1
- package/data/PopupContentExtension.js +1 -1
- package/declarations/arcgis-js-api-extensions/index.d.ts +19 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/Entity.EntityBase.html +9 -5
- package/docs/html/classes/Hyperlink.Hyperlink.html +9 -5
- package/docs/html/classes/LanguageResources.LanguageResources.html +9 -5
- package/docs/html/classes/data_ArcGISServiceTableExtension.ArcGISServiceTableExtension.html +9 -5
- package/docs/html/classes/data_Attachment.Attachment.html +9 -5
- package/docs/html/classes/data_Feature.Feature.html +9 -5
- package/docs/html/classes/data_FeatureList.FeatureList.html +7 -3
- package/docs/html/classes/data_FeatureSet.FeatureSet.html +9 -5
- package/docs/html/classes/data_FeatureSettings.FeatureSettings.html +9 -5
- package/docs/html/classes/data_FeatureSourceBase.FeatureSourceBase.html +9 -5
- package/docs/html/classes/data_FeatureSourceBase.RelationshipCollection.html +7 -3
- package/docs/html/classes/data_FeatureStream.FeatureStream.html +10 -6
- package/docs/html/classes/data_FieldExtension.FieldExtension.html +9 -5
- package/docs/html/classes/data_PopupContentExtension.PopupContentExtension.html +9 -5
- package/docs/html/classes/data_RelationshipBase.RelationshipBase.html +9 -5
- package/docs/html/classes/data_Schema.Schema.html +9 -5
- package/docs/html/classes/data_TaskSettings.TaskSettings.html +9 -5
- package/docs/html/classes/data__TableExtension.TableExtension.html +9 -5
- package/docs/html/classes/data__TableExtension.TableFeatureSettings.html +9 -5
- package/docs/html/classes/data__TableExtension.TableSchema.html +9 -5
- package/docs/html/classes/layer_preset_LayerPreset.LayerPreset.html +9 -5
- package/docs/html/classes/layer_preset_LayerPresetSettings.LayerPresetSetting.html +9 -5
- package/docs/html/classes/mapping_ArcGISSublayerExtension.ArcGISSublayerExtension.html +9 -5
- package/docs/html/classes/mapping_ArcGISSublayerExtension.ArcGISSublayerRelationshipCollection.html +7 -3
- package/docs/html/classes/mapping_BasemapExtension.BasemapExtension.html +9 -5
- package/docs/html/classes/mapping_Bookmark.Bookmark.html +9 -5
- package/docs/html/classes/mapping_BuildingComponentSublayerExtension.BuildingComponentSublayerExtension.html +9 -5
- package/docs/html/classes/mapping_BuildingComponentSublayerExtension.BuildingComponentSublayerSchema.html +9 -5
- package/docs/html/classes/mapping_BuildingGroupSublayerExtension.BuildingGroupSublayerExtension.html +9 -5
- package/docs/html/classes/mapping_BuildingGroupSublayerExtension.BuildingGroupSublayerSchema.html +9 -5
- package/docs/html/classes/mapping_BuildingSceneLayerExtension.BuildingSceneLayerExtension.html +9 -5
- package/docs/html/classes/mapping_BuildingSceneLayerExtension.BuildingSceneLayerReadOnlySchema.html +9 -5
- package/docs/html/classes/mapping_BuildingSublayerExtension.BuildingSublayerExtension.html +9 -5
- package/docs/html/classes/mapping_BuildingSublayerExtension.BuildingSublayerFeatureSettings.html +9 -5
- package/docs/html/classes/mapping_BuildingSublayerExtension.BuildingSublayerSchema.html +9 -5
- package/docs/html/classes/mapping_CSVLayerExtension.CSVLayerExtension.html +9 -5
- package/docs/html/classes/mapping_ElevationLayerExtension.ElevationLayerExtension.html +9 -5
- package/docs/html/classes/mapping_FeatureCollectionLayerExtension.FeatureCollectionLayerExtension.html +9 -5
- package/docs/html/classes/mapping_FeatureLayerExtension.FeatureLayerExtension.html +9 -5
- package/docs/html/classes/mapping_FeatureLayerExtensionBase.FeatureLayerExtensionBase.html +9 -5
- package/docs/html/classes/mapping_FeatureLayerExtensionBase.FeatureLayerReadOnlySchema.html +9 -5
- package/docs/html/classes/mapping_FeatureLayerExtensionBase.FeatureLayerSchema.html +9 -5
- package/docs/html/classes/mapping_GeoRSSLayerExtension.GeoRSSLayerExtension.html +9 -5
- package/docs/html/classes/mapping_GraphicsLayerExtension.GraphicsLayerExtension.html +9 -5
- package/docs/html/classes/mapping_GroundExtension.GroundExtension.html +9 -5
- package/docs/html/classes/mapping_GroupLayerExtension.GroupLayerExtension.html +9 -5
- package/docs/html/classes/mapping_GroupLayerExtension.GroupLayerExtensionCollection.html +7 -3
- package/docs/html/classes/mapping_ImageryLayerExtension.ImageryLayerExtension.html +9 -5
- package/docs/html/classes/mapping_ImageryTileLayerExtension.ImageryTileLayerExtension.html +9 -5
- package/docs/html/classes/mapping_IntegratedMeshLayerExtension.IntegratedMeshLayerExtension.html +9 -5
- package/docs/html/classes/mapping_KMLLayerExtension.KMLLayerExtension.html +9 -5
- package/docs/html/classes/mapping_KMLSublayerExtension.KMLSublayerExtension.html +9 -5
- package/docs/html/classes/mapping_MapConstraints.MapConstraints.html +9 -5
- package/docs/html/classes/mapping_MapExtension.MapExtension.html +9 -5
- package/docs/html/classes/mapping_MapImageLayerExtension.MapImageLayerExtension.html +9 -5
- package/docs/html/classes/mapping_MapImageSublayerExtension.MapImageSublayerExtension.html +9 -5
- package/docs/html/classes/mapping_OpenStreetMapLayerExtension.OpenStreetMapLayerExtension.html +9 -5
- package/docs/html/classes/mapping_PointCloudLayerExtension.PointCloudLayerExtension.html +9 -5
- package/docs/html/classes/mapping_SceneLayerExtension.SceneLayerExtension.html +9 -5
- package/docs/html/classes/mapping_StreamLayerExtension.StreamLayerExtension.html +9 -5
- package/docs/html/classes/mapping_StreamLayerExtension.StreamLayerSchema.html +9 -5
- package/docs/html/classes/mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerExtension.html +9 -5
- package/docs/html/classes/mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerRelationshipCollection.html +7 -3
- package/docs/html/classes/mapping_SubtypeSublayerExtension.SubtypeSublayerExtension.html +9 -5
- package/docs/html/classes/mapping_SubtypeSublayerExtension.SubtypeSublayerRelationshipCollection.html +7 -3
- package/docs/html/classes/mapping_SubtypeSublayerExtension.SubtypeSublayerSchema.html +9 -5
- package/docs/html/classes/mapping_TileLayerExtension.TileLayerExtension.html +9 -5
- package/docs/html/classes/mapping_TileSublayerExtension.TileSublayerExtension.html +9 -5
- package/docs/html/classes/mapping_UnsupportedLayerExtension.UnsupportedLayerExtension.html +9 -5
- package/docs/html/classes/mapping_VectorTileLayerExtension.VectorTileLayerExtension.html +9 -5
- package/docs/html/classes/mapping_WMSLayerExtension.WMSLayerExtension.html +9 -5
- package/docs/html/classes/mapping_WMSSublayerExtension.WMSSublayerExtension.html +9 -5
- package/docs/html/classes/mapping_WMTSLayerExtension.WMTSLayerExtension.html +9 -5
- package/docs/html/classes/mapping_WMTSSublayerExtension.WMTSSublayerExtension.html +9 -5
- package/docs/html/classes/mapping_WebTileLayerExtension.WebTileLayerExtension.html +9 -5
- package/docs/html/classes/mapping__LayerExtension.LayerExtension.html +9 -5
- package/docs/html/classes/mapping__LayerExtension.LayerExtensionSchema.html +9 -5
- package/docs/html/classes/mapping__SublayerExtension.SubSublayerExtensionCollection.html +7 -3
- package/docs/html/classes/mapping__SublayerExtension.SublayerExtension.html +9 -5
- package/docs/html/classes/mapping__SublayerExtension.SublayerSchema.html +9 -5
- package/docs/html/classes/mapping_support_ArrayWrappedCollection.ArrayWrappedCollection.html +7 -3
- package/docs/html/classes/mapping_support_LayerListSettings.ExtensionBaseLayerListSettings.html +9 -5
- package/docs/html/classes/mapping_support_LayerListSettings.LayerListSettings.html +9 -5
- package/docs/html/classes/mapping_support__LayerExtensionCollection.LayerExtensionCollectionBase.html +7 -3
- package/docs/html/classes/mapping_support__SublayerExtensionCollection.SublayerExtensionCollectionBase.html +7 -3
- package/docs/html/classes/menus_Menu.Menu.html +9 -5
- package/docs/html/classes/menus_MenuItem.MenuItem.html +9 -5
- package/docs/html/classes/support_FormatSettings.FormatSettings.html +9 -5
- package/docs/html/classes/support_InitializableBase.InitializableBase.html +9 -5
- package/docs/html/classes/support_InitializableCollectionProxy.InitializableCollectionProxy.html +7 -3
- package/docs/html/classes/support_Observable.Observable.html +14 -10
- package/docs/html/classes/support_ReadOnlyInitializableCollection.ReadOnlyInitializableCollection.html +7 -3
- package/docs/html/classes/support_Serializable.SerializableBase.html +9 -5
- package/docs/html/classes/support_Settings.Settings.html +9 -5
- package/docs/html/classes/support__ArcGISRelationshipCollection.ArcGISRelationshipCollection.html +7 -3
- package/docs/html/classes/tasks_geocoding_ArcGISGeocoder.ArcGISGeocoder.html +9 -5
- package/docs/html/classes/tasks_geocoding_Geocoder.Geocoder.html +9 -5
- package/docs/html/classes/tasks_query_ArcGISRelationship.ArcGISRelationship.html +9 -5
- package/docs/html/classes/tasks_query_QueryBasedRelationship.QueryBasedRelationship.html +9 -5
- package/docs/html/classes/utilities_CollectionProxy.CollectionProxy.html +7 -3
- package/docs/html/classes/utilities_CopyOnWriteCollection.CopyOnWriteCollection.html +7 -3
- package/docs/html/classes/utilities_MapTransformCollection.MapTransformCollection.html +7 -3
- package/docs/html/classes/utilities_ObservableMap.ObservableMap.html +9 -5
- package/docs/html/classes/utilities_ObservableSet.ObservableSet.html +9 -5
- package/docs/html/classes/utilities_ObservableWeakSet.ObservableWeakSet.html +9 -5
- package/docs/html/classes/utilities_ReadOnlyCollection.ReadOnlyCollection.html +7 -3
- package/docs/html/classes/utilities_ReadOnlyMap.ReadOnlyMap.html +9 -5
- package/docs/html/classes/utilities_asyncIterable.AsyncQueue.html +1 -1
- package/docs/html/classes/utilities_date.DateFormatter.html +9 -5
- package/docs/html/classes/utilities_number.NumberFormatter.html +9 -5
- package/docs/html/functions/utilities_watch.watchEach.html +66 -4
- package/docs/html/interfaces/data_Feature.PresentableAttributes.html +5 -1
- package/docs/html/interfaces/data__Relationship.Relationship-1.html +9 -5
- package/docs/html/variables/version.version.html +1 -1
- package/layer-preset/LayerPreset.js +1 -1
- package/mapping/BuildingComponentSublayerExtension.js +1 -1
- package/mapping/MapExtension.js +1 -1
- package/mapping/SubtypeSublayerExtension.js +1 -1
- package/mapping/_SublayerExtension.js +1 -1
- package/mapping/support/LayerListSettings.js +1 -1
- package/package.json +1 -1
- package/portal/SubtypeGroupLayer.js +1 -1
- package/portal/WMSLayer.js +1 -1
- package/support/Observable.d.ts +9 -25
- package/support/Observable.js +1 -1
- package/support/Settings.js +1 -1
- package/utilities/watch.d.ts +13 -1
- package/utilities/watch.js +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{whenOnce}from"@arcgis/core/core/
|
|
1
|
+
import{whenOnce}from"@arcgis/core/core/reactiveUtils.js";import{isSubtypeGroupLayer}from"../utilities/_layers.js";import{checkArg}from"../utilities/checkArg.js";import{LayerDefinition}from"./LayerDefinition.js";import{SubtypeSublayer}from"./SubtypeSublayer.js";import{ERR_LAYER_TYPE_MISMATCH,applyLayerBaseToEsriApiLayer,applyOperationalLayerToEsriApiLayer,fromEsriApiLayerToLayerBase,fromEsriApiLayerToOperationalLayer}from"./_layerHelper.js";export var SubtypeGroupLayer;!function(r){async function e(r,e){checkArg("layerJson",r).isNotMissing();const a=r.layerType||r.type;if(checkArg("layerJson.layerType",a).satisfies((r=>!r||"ArcGISSubtypeGroupLayer"===r),ERR_LAYER_TYPE_MISMATCH),checkArg("layer",e).isNotMissing().satisfies(isSubtypeGroupLayer,ERR_LAYER_TYPE_MISMATCH),applyLayerBaseToEsriApiLayer(r,e),applyOperationalLayerToEsriApiLayer(r,e),r.hasOwnProperty("url")&&(e.url=r.url),r.hasOwnProperty("customParameters")&&(e.customParameters={...r.customParameters},r.customParameters.hasOwnProperty("gdbVersion")&&(e.gdbVersion=r.customParameters.gdbVersion)),r.hasOwnProperty("layerDefinition")&&await LayerDefinition.applyToEsriApiLayer(r.layerDefinition,e),r.hasOwnProperty("layers")){const a=async()=>{await Promise.all(e.sublayers.map((e=>{const a=r.layers.find((r=>+r.subtypeCode===e.subtypeCode));if(a)return SubtypeSublayer.applyToEsriApiLayer(a,e)})))};e.loaded?await a():(async()=>{await whenOnce((()=>e.loaded)),await a()})()}}r.toEsriApiLayer=async function(r){checkArg("layerJson",r).isNotMissing();const a=r.layerType||r.type;checkArg("layerJson.layerType",a).satisfies((r=>!r||"ArcGISSubtypeGroupLayer"===r),ERR_LAYER_TYPE_MISMATCH);const i=new((await import("@arcgis/core/layers/SubtypeGroupLayer")).default);return await e(r,i),i},r.applyToEsriApiLayer=e,r.fromEsriApiSubtypeGroupLayer=function(r){checkArg("subtypeGroupLayer",r).isNotMissing();const e={...fromEsriApiLayerToLayerBase(r),...fromEsriApiLayerToOperationalLayer(r),layerType:"ArcGISSubtypeGroupLayer",url:r.url,customParameters:{...r.customParameters,gdbVersion:r.gdbVersion},layerDefinition:LayerDefinition.fromEsriApiLayer(r),layers:[]};return r.sublayers.forEach((r=>{e.layers.push(SubtypeSublayer.fromEsriApiSubtypeSublayer(r))})),e}}(SubtypeGroupLayer||(SubtypeGroupLayer={}));
|
package/portal/WMSLayer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{whenOnce}from"@arcgis/core/core/reactiveUtils.js";import EsriExtent from"@arcgis/core/geometry/Extent";import EsriSpatialReference from"@arcgis/core/geometry/SpatialReference";import{geographicToWebMercator,webMercatorToGeographic}from"@arcgis/core/geometry/support/webMercatorUtils";import Portal from"@arcgis/core/portal/Portal";import PortalItem from"@arcgis/core/portal/PortalItem";import{isWMSLayer}from"../utilities/_layers.js";import{checkArg}from"../utilities/checkArg.js";import{parallelEach}from"../utilities/promise.js";import{SpatialReference}from"./SpatialReference.js";import{WMSSublayer}from"./WMSSublayer.js";import{applyLayerBaseToEsriApiLayer,applyBasemapLayerToEsriApiLayer,applyOperationalLayerToEsriApiLayer,fromEsriApiLayerToLayerBase,fromEsriApiLayerToOperationalLayer}from"./_layerHelper.js";export var WMSLayer;!function(e){async function r(e,r,a){if(checkArg("layerJson",e).isNotMissing(),checkArg("layer",r).isNotMissing().satisfies(isWMSLayer),checkArg("layerJson.layerType",e.layerType).satisfies((e=>!e||"WMS"===e)),applyLayerBaseToEsriApiLayer(e,r),applyBasemapLayerToEsriApiLayer(e,r),applyOperationalLayerToEsriApiLayer(e,r),e.hasOwnProperty("copyright")&&(r.copyright=e.copyright),e.hasOwnProperty("customLayerParameters")&&(r.customLayerParameters={...e.customLayerParameters}),e.hasOwnProperty("customParameters")&&(r.customParameters={...e.customParameters}),e.hasOwnProperty("featureInfoFormat")&&(r.featureInfoFormat=e.featureInfoFormat),e.hasOwnProperty("featureInfoUrl")&&(r.featureInfoUrl=e.featureInfoUrl),r.imageFormat=e.hasOwnProperty("format")?e.format:"image/png",e.hasOwnProperty("itemId")&&(r.portalItem?r.portalItem.id=e.itemId:r.portalItem=new PortalItem({id:e.itemId,portal:a||Portal.getDefault()})),e.hasOwnProperty("layers")){const a=async()=>{await parallelEach(e.layers,(async e=>{const a=r.sublayers.find((r=>r.name===e.name));a&&await WMSSublayer.applyToEsriApiWMSSublayer(e,a)})),r.sublayers.removeMany(r.sublayers.filter((r=>!e.layers.some((e=>e.name===r.name)))))};r.sublayers?await a():(async()=>{await whenOnce((()=>r.sublayers)),await a()})()}if(e.hasOwnProperty("visibleLayers")){const a=()=>r.sublayers.forEach((r=>{r.visible=e.visibleLayers.includes(r.name)}));r.sublayers?a():(async()=>{await whenOnce((()=>r.sublayers)),a()})()}if(e.hasOwnProperty("mapUrl")&&(r.mapUrl=e.mapUrl),e.hasOwnProperty("maxHeight")&&(r.imageMaxHeight=e.maxHeight),e.hasOwnProperty("maxWidth")&&(r.imageMaxWidth=e.maxWidth),e.hasOwnProperty("spatialReferences")&&e.spatialReferences.length&&(r.spatialReferences=e.spatialReferences.slice(),r.spatialReference||(r.spatialReference=SpatialReference.toEsriApiSpatialReference({wkid:e.spatialReferences[0]}))),e.hasOwnProperty("extent")){const a=new EsriExtent({xmin:e.extent[0][0],ymin:e.extent[0][1],xmax:e.extent[1][0],ymax:e.extent[1][1],spatialReference:EsriSpatialReference.WGS84});(r.spatialReference.isWGS84||r.spatialReference.isWebMercator)&&(r.fullExtent=r.spatialReference.isWGS84?a:geographicToWebMercator(a))}e.hasOwnProperty("url")&&(r.url=e.url),e.hasOwnProperty("version")&&(r.version=e.version)}e.toEsriApiLayer=async function(e){checkArg("layerJson",e).isNotMissing(),checkArg("layerJson.layerType",e.layerType).satisfies((e=>!e||"WMS"===e));const a=new((await import("@arcgis/core/layers/WMSLayer")).default);return await r(e,a),a},e.applyToEsriApiLayer=r,e.fromEsriApiLayer=function(e){checkArg("layer",e).isNotMissing();const r={...fromEsriApiLayerToLayerBase(e),...fromEsriApiLayerToOperationalLayer(e),layerType:"WMS",visibleLayers:[]};if(e.copyright&&(r.copyright=e.copyright),e.customLayerParameters&&(r.customLayerParameters={...e.customLayerParameters}),e.customParameters&&(r.customParameters={...e.customParameters}),e.fullExtent&&(e.spatialReference.isWGS84||e.spatialReference.isWebMercator)){const a=e.spatialReference.isWGS84?e.fullExtent:webMercatorToGeographic(e.fullExtent,!1);r.extent=[[],[]],r.extent[0][0]=a.xmin,r.extent[0][1]=a.ymin,r.extent[1][0]=a.xmax,r.extent[1][1]=a.ymax}return e.featureInfoFormat&&(r.featureInfoFormat=e.featureInfoFormat),e.featureInfoUrl&&(r.featureInfoUrl=e.featureInfoUrl),e.imageFormat&&(r.format=e.imageFormat),e.portalItem&&(r.itemId=e.portalItem.id),e.sublayers&&(r.layers=[],e.sublayers.forEach((e=>{const a=WMSSublayer.fromEsriApiWMSSublayer(e);r.layers.unshift(a),e.visible&&r.visibleLayers.unshift(e.name)}))),e.imageMaxHeight&&(r.maxHeight=e.imageMaxHeight),e.imageMaxWidth&&(r.maxWidth=e.imageMaxWidth),e.mapUrl&&(r.mapUrl=e.mapUrl),e.spatialReferences&&(r.spatialReferences=e.spatialReferences.slice()),e.url&&(r.url=e.url),e.version&&(r.version=e.version),r}}(WMSLayer||(WMSLayer={}));
|
package/support/Observable.d.ts
CHANGED
|
@@ -3,18 +3,7 @@ import { AccessorLike, Evented, WatchCallback } from "./esri.js";
|
|
|
3
3
|
* An object whose properties can be observed for changes.
|
|
4
4
|
*/
|
|
5
5
|
export declare class Observable extends Evented implements AccessorLike {
|
|
6
|
-
|
|
7
|
-
* Property observers keyed by property name.
|
|
8
|
-
*/
|
|
9
|
-
private _observers;
|
|
10
|
-
/**
|
|
11
|
-
* Properties that have changed since the last notification.
|
|
12
|
-
*/
|
|
13
|
-
private _changed;
|
|
14
|
-
/**
|
|
15
|
-
* Determines whether a notification task is scheduled.
|
|
16
|
-
*/
|
|
17
|
-
private _notifyPending;
|
|
6
|
+
constructor();
|
|
18
7
|
/**
|
|
19
8
|
* Watches for property changes.
|
|
20
9
|
*
|
|
@@ -51,12 +40,12 @@ export declare class Observable extends Evented implements AccessorLike {
|
|
|
51
40
|
*/
|
|
52
41
|
set(props: HashMap<any>): this;
|
|
53
42
|
/**
|
|
54
|
-
* Indicates that the given property
|
|
55
|
-
* notified.
|
|
43
|
+
* Indicates that the given property might have changed, causing observers
|
|
44
|
+
* to be notified if it did.
|
|
56
45
|
*
|
|
57
|
-
* @param
|
|
46
|
+
* @param propertyName The property that changed (or might have changed).
|
|
58
47
|
*/
|
|
59
|
-
notifyChange(
|
|
48
|
+
notifyChange(propertyName: string): void;
|
|
60
49
|
/**
|
|
61
50
|
* Implements the watch() behavior for a single property. Subclasses that
|
|
62
51
|
* need specialized watch handling should generally override this function
|
|
@@ -78,17 +67,12 @@ export declare class Observable extends Evented implements AccessorLike {
|
|
|
78
67
|
* Indicates that the given property has changed, causing observers to be
|
|
79
68
|
* notified.
|
|
80
69
|
*
|
|
70
|
+
* @deprecated This function is no longer supported. Use `notifyChange()`
|
|
71
|
+
* instead. The `force=true` behavior is no longer possible.
|
|
81
72
|
* @param property The property that changed.
|
|
82
73
|
* @param force Whether to always invoke the callback, even if the value
|
|
83
|
-
* hasn't changed.
|
|
74
|
+
* hasn't changed. NO LONGER SUPPORTED. This will always effectively be
|
|
75
|
+
* `false`.
|
|
84
76
|
*/
|
|
85
77
|
protected _notifyChange(property: string, force?: boolean): void;
|
|
86
|
-
private _hasObservers;
|
|
87
|
-
private _isDirty;
|
|
88
|
-
/**
|
|
89
|
-
* Makes a property observable.
|
|
90
|
-
*
|
|
91
|
-
* @param property The property to make observable.
|
|
92
|
-
*/
|
|
93
|
-
private _observify;
|
|
94
78
|
}
|
package/support/Observable.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Property}from"@arcgis/core/core/accessorSupport/Property";import{trackAccess}from"@arcgis/core/core/accessorSupport/tracking";import{Evented}from"./esri.js";const classToProperties=new WeakMap;function getOrCreateProperty(t,e){classToProperties.has(t)||classToProperties.set(t,new Map);const r=classToProperties.get(t),o=String(e);if(!r.has(o)){const e=new Property({host:t},o,{});r.set(o,e)}return r.get(o)}const proxyHandler={get:(t,e,r)=>(trackAccess(getOrCreateProperty(r,e)),Reflect.get(t,e,r)),set:(t,e,r,o)=>(Reflect.set(t,e,r,o),o.notifyChange(String(e)),!0)};export class Observable extends Evented{constructor(){return super(),new Proxy(this,proxyHandler)}watch(t,e,r=!1){const o=[].concat(t),s=[];for(const t of o){const[o,n]=t.split(/\.(.*)/);if(n?.length){let i;const c=this[o];c&&"function"==typeof c.watch&&(i=c.watch(n,((r,o)=>{e(r,o,t,this)}),r));const a=this._watchProperty(o,n,((o,s)=>{i&&i.remove(),o&&"function"==typeof o.watch&&(i=o.watch(n,((r,o)=>{e(r,o,t,this)}),r));const c="function"==typeof s?.get?s.get(n):void 0,a=this.get(t);e(a,c,t,this)}),r);s.push({remove:()=>{a.remove(),i&&i.remove()}})}else s.push(this._watchProperty(o,"",e,r))}return 1===s.length?s[0]:{remove:()=>s.forEach((t=>t.remove()))}}get(t){if(!t)return;const e=t.split(".");let r=this;for(;r&&"object"==typeof r&&e.length;)r=r[e.shift()];return e.length?void 0:r}set(t,e){if(!t)return this;if("string"==typeof t){const r=t.split(".");let o=this;for(;o&&"object"==typeof o&&r.length>1;)o=o[r.shift()];o&&"object"==typeof o&&(o[r[0]]=e)}else for(const e of Object.keys(t))this.set(e,t[e]);return this}notifyChange(t){const e=getOrCreateProperty(this,t);e.invalidate(),e.commit()}_watchProperty(t,e,r,o){const s=o?new SyncObserver:new AsyncObserver;return s.callback=r,s.oldValue=this[t],s.property=getOrCreateProperty(this,t),s.property.observe(s)}_notifyChange(t,e=!1){console.warn("Observable._notifyChange() is deprecated and will be removed in a future update. Use notifyChange() instead."),this.notifyChange(t)}}class SyncObserver{onInvalidated(){}onCommitted(){const t=this.property.properties.host,{propertyName:e}=this.property,r=t[e];this.oldValue!==r&&(this.callback(r,this.oldValue,e,t),this.oldValue=r)}}class AsyncObserver{constructor(){this._notifyPending=!1}onInvalidated(){}onCommitted(){this._notifyPending||(this._notifyPending=!0,setTimeout((()=>{this._notifyPending=!1;const t=this.property.properties.host,{propertyName:e}=this.property,r=t[e];this.oldValue!==r&&(this.callback(r,this.oldValue,e,t),this.oldValue=r)}),0))}}
|
package/support/Settings.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CopyOnWriteCollection}from"../utilities/CopyOnWriteCollection.js";import{every}from"../utilities/iterable.js";import{isDefault,SerializableBase,shouldExcludeDefaults}from"./Serializable.js";import{Collection}from"./esri.js";export class Settings extends SerializableBase{get parent(){return this._parent}set parent(e){this._setParent(e)}reset(e){if(this._overrides)if(e)this.parent&&this._settingObservers&&this._settingObservers.forEach((e=>{this._watchParent(e)})),this._overrides.delete(e),this.
|
|
1
|
+
import{CopyOnWriteCollection}from"../utilities/CopyOnWriteCollection.js";import{every}from"../utilities/iterable.js";import{isDefault,SerializableBase,shouldExcludeDefaults}from"./Serializable.js";import{Collection}from"./esri.js";export class Settings extends SerializableBase{get parent(){return this._parent}set parent(e){this._setParent(e)}reset(e){if(this._overrides)if(e)this.parent&&this._settingObservers&&this._settingObservers.forEach((e=>{this._watchParent(e)})),this._overrides.delete(e),this.notifyChange(e);else{const e=[...this._overrides.keys()];this._overrides.clear();for(const t of e)this.parent&&this._settingObservers&&this._settingObservers.forEach((e=>{this._watchParent(e)})),this.notifyChange(t)}}isModified(e){if(!this._overrides)return!1;if(e){if(!this._overrides.has(e))return!1;const t=this._overrides.get(e);return t instanceof CopyOnWriteCollection?t.isModified:!(t instanceof Settings)||t.isModified()}return!every(this._overrides.values(),(e=>e instanceof CopyOnWriteCollection&&!e.isModified||e instanceof Settings&&!e.isModified()))}toJSON(e="all"){const t=super.toJSON(e);if(t)for(const e of Object.keys(t))this.isModified(e)||delete t[e];if(!shouldExcludeDefaults(e)||!isDefault(t))return t}getDefaults(){return{}}_watchProperty(e,t,s,i){const r={path:`${e}${t?`.${t}`:""}`,handle:super._watchProperty(e,t,s,i),callback:s,remove:()=>{r.handle.remove(),r.parentHandle&&r.parentHandle.remove(),this._settingObservers.delete(r)}};return!this.isModified(e)&&this.parent&&this._watchParent(r),this._settingObservers=this._settingObservers||new Set,this._settingObservers.add(r),r}_getSetting(e,t){return this._overrides?.has(e)?this._overrides.get(e):this.parent?this.parent[e]:t}_getCollectionSetting(e){if(!this._overrides||!this._overrides.has(e)){const t=this.parent?this.parent[e]:new Collection;this._overrides=this._overrides||new Map,this._overrides.set(e,new CopyOnWriteCollection(t))}return this._overrides.get(e)}_getNestedSettings(e,t){if(!this._overrides||!this._overrides.has(e)){const s=t();this.parent&&(s.parent=this.parent[e]),this._overrides=this._overrides||new Map,this._overrides.set(e,s)}return this._overrides.get(e)}_setSetting(e,t){!this.isModified(e)&&this.parent&&this._settingObservers&&this._settingObservers.forEach((t=>{t.path===e&&this._unwatchParent(t)})),this._overrides=this._overrides||new Map,this._overrides.set(e,t)}_setParent(e){this.parent&&this._settingObservers&&this._settingObservers.forEach((e=>{e.parentHandle&&e.parentHandle.remove(),e.parentHandle=void 0})),e&&this._settingObservers&&this._settingObservers.forEach((t=>{this.isModified(t.path)||(t.parentHandle=e.watch(t.path,((e,s,i)=>{t.callback(e,s,i,this)})))})),this._parent=e,this._settingObservers&&this._settingObservers.forEach((e=>{this.notifyChange(e.path)})),this._overrides&&this._overrides.forEach(((t,s)=>{t instanceof CopyOnWriteCollection?t.originalCollection=e?e.get(s):new Collection:t instanceof Settings&&(t.parent=e?e.get(s):void 0)}))}_watchParent(e){e.parentHandle||(e.parentHandle=this.parent.watch(e.path,((t,s,i)=>{e.callback(t,s,i,this)})))}_unwatchParent(e){e.parentHandle&&(e.parentHandle.remove(),e.parentHandle=void 0)}}
|
package/utilities/watch.d.ts
CHANGED
|
@@ -18,7 +18,19 @@ export declare function onEach<T extends Evented>(collection: Collection<T>, eve
|
|
|
18
18
|
* @param sync Whether to invoke the callback synchronously. The default is
|
|
19
19
|
* `false`.
|
|
20
20
|
*/
|
|
21
|
-
export declare function watchEach<T extends AccessorLike>(collection: Collection<T>, path: string | string[], callback: WatchCallback, sync?: boolean): IHandle;
|
|
21
|
+
export declare function watchEach<T extends AccessorLike, U = unknown>(collection: Collection<T>, path: string | string[], callback: WatchCallback<U, T>, sync?: boolean): IHandle;
|
|
22
|
+
/**
|
|
23
|
+
* Watches a property on each item in a collection.
|
|
24
|
+
*
|
|
25
|
+
* @param collection The collection of items to watch.
|
|
26
|
+
* @param getValue Function used to get the current value from each item. All
|
|
27
|
+
* accessed properties will be tracked.
|
|
28
|
+
* @param callback The callback to invoke. Note that the item that changed is
|
|
29
|
+
* passed as the last parameter of the callback.
|
|
30
|
+
* @param sync Whether to invoke the callback synchronously. The default is
|
|
31
|
+
* `false`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function watchEach<T extends AccessorLike, U = unknown>(collection: Collection<T>, getValue: (item: T) => U, callback: (newValue: U, oldValue: U, item: T) => void, sync?: boolean): IHandle;
|
|
22
34
|
/**
|
|
23
35
|
* Watches a property on each item in a collection property.
|
|
24
36
|
*
|
package/utilities/watch.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Collection}from"../support/esri.js";import{checkArg}from"./checkArg.js";export{}from"../support/esri.js";export function onEach(o,
|
|
1
|
+
import*as reactiveUtils from"@arcgis/core/core/reactiveUtils";import{Collection}from"../support/esri.js";import{checkArg}from"./checkArg.js";export{}from"../support/esri.js";export function onEach(e,o,t){checkArg("collection",e).isNotMissing(),checkArg("eventType",o).isNotMissing().isNotEmpty(),checkArg("callback",t).isNotMissing();const c=new Map;for(const r of e.toArray())c.set(r,r.on(o,t));const r=e.on("change",(e=>{for(const r of e.added)c.set(r,r.on(o,t));for(const o of e.removed){const e=c.get(o);e&&e.remove(),c.delete(o)}}));return{remove:()=>{r.remove(),c.forEach((e=>e.remove()))}}}export function watchEach(e,...o){let t;if(checkArg("collection",e).isNotMissing(),"function"==typeof o[0]){const[e,c,r=!1]=o;checkArg("getValue",e).isNotMissing(),checkArg("callback",c).isNotMissing(),t=o=>reactiveUtils.watch((()=>e(o)),((e,t)=>c(e,t,o)),{sync:r})}else{const[e,c,r=!1]=o;checkArg("path",e).isNotMissing().isNotEmpty(),checkArg("callback",c).isNotMissing(),t=o=>o.watch(e,c,r)}const c=new Map;for(const o of e.toArray())c.set(o,t(o));const r=e.on("change",(e=>{for(const o of e.added)c.set(o,t(o));for(const o of e.removed){const e=c.get(o);e&&e.remove(),c.delete(o)}}));return{remove:()=>{r.remove(),c.forEach((e=>e.remove()))}}}export function watchCollectionPropertyEach(e,o,t,c,r=!1){checkArg("obj",e).isNotMissing(),checkArg("collectionProperty",o).isNotMissing().isNotEmpty(),checkArg("path",t).isNotMissing().isNotEmpty(),checkArg("callback",c).isNotMissing();const n=new Map,s=e.get(o);if(s)for(const e of s.toArray())n.set(e,e.watch(t,c,r));const i=onCollectionPropertyChange(e,o,(e=>{for(const o of e.added)n.set(o,o.watch(t,c,r));for(const o of e.removed){const e=n.get(o);e&&e.remove(),n.delete(o)}}),r);return{remove:()=>{i.remove(),n.forEach((e=>e.remove()))}}}export function onCollectionPropertyChange(e,o,t,c=!1){let r;checkArg("obj",e).isNotMissing(),checkArg("property",o).isNotMissing().isNotEmpty(),checkArg("callback",t).isNotMissing();const n=e.get(o);n&&(r=n.on("change",t));const s=e.watch(o,((e,o)=>{r&&(r.remove(),r=void 0),e&&(r=e.on("change",t));const c=e??new Collection,n=o??new Collection,s=c,i=c.filter((e=>n.includes(e))),a=n.filter((e=>c.includes(e))),l={added:c.filter((e=>!n.includes(e))).toArray(),removed:n.filter((e=>!c.includes(e))).toArray(),moved:i.filter(((e,o)=>a.indexOf(e)!==o)).toArray(),target:s};(l.added.length||l.removed.length||l.moved.length)&&t(l)}),c);return{remove:()=>{r&&r.remove(),s.remove()}}}export function onOnce(e,o,t){const c=e.on(o,(e=>{t(e),c.remove()}));return c}
|
package/version.d.ts
CHANGED
package/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version="37.
|
|
1
|
+
export const version="37.3.0";
|