@esri/solutions-components 0.10.21 → 0.10.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -1287,6 +1287,8 @@ const EditCard = class {
1287
1287
  _editor;
1288
1288
  /**
1289
1289
  * esri/layers/FeatureLayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html
1290
+ * OR
1291
+ * esri/layers/support/SubtypeSublayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-SubtypeSublayer.html
1290
1292
  */
1291
1293
  _layer;
1292
1294
  /**
@@ -1391,7 +1393,9 @@ const EditCard = class {
1391
1393
  if (this._layerEditHandle) {
1392
1394
  this._layerEditHandle.remove();
1393
1395
  }
1394
- this._layerEditHandle = this._layer.on("edits", () => {
1396
+ // #896 Editing on sybtype group layer is failing in Manager
1397
+ const layer = this._layer.type === "subtype-sublayer" ? this._layer.parent : this._layer;
1398
+ this._layerEditHandle = layer.on("edits", () => {
1395
1399
  this.editsComplete.emit();
1396
1400
  });
1397
1401
  }
@@ -1406,7 +1410,7 @@ const EditCard = class {
1406
1410
  !this.graphics[0].layer.editingEnabled : true;
1407
1411
  const tableNodeClass = this._editorLoading ? "display-none" : "position-absolute";
1408
1412
  const loadingClass = this._editorLoading ? "" : "display-none";
1409
- return (index.h(index.Host, { key: '1520951922ca98ee92ccc8f7119d7fa3666eddfa' }, index.h("div", { key: 'd436d1660fd46bba90dd5dadc6962c619b99143e', class: "position-absolute" }, editDisabled ? (index.h("calcite-notice", { kind: "warning", open: true, slot: "content-top", width: "full" }, index.h("div", { slot: "message" }, this._translations.enableEditing))) : undefined, index.h("div", { key: 'cff16539fd7b4a85234e0d15d2170470d95d0ad9', class: "position-absolute" }, index.h("div", { key: '0b96a2d27a5df344da9192a01d5c42496e057cd1', class: tableNodeClass, id: "feature-form", ref: (el) => this._editContainer = el }), index.h("calcite-loader", { key: '49cadf3456d1f3289abde18c35b726471ac551cd', class: loadingClass, label: "", scale: "s" })))));
1413
+ return (index.h(index.Host, { key: '16dd78822ee6d7c4e2da97c4b7ec7c0678b51e68' }, index.h("div", { key: '8aba2b86c7bf8e7dfbf7567b156e02b23b728f4e', class: "position-absolute" }, editDisabled ? (index.h("calcite-notice", { kind: "warning", open: true, slot: "content-top", width: "full" }, index.h("div", { slot: "message" }, this._translations.enableEditing))) : undefined, index.h("div", { key: '8230d44ec05ff207681e6333b7f08c80748c4f3d', class: "position-absolute" }, index.h("div", { key: '71792b5737c43a024ebc677ae168d74569349585', class: tableNodeClass, id: "feature-form", ref: (el) => this._editContainer = el }), index.h("calcite-loader", { key: '47176534c25769af8ae107c3864901c4294b4359', class: loadingClass, label: "", scale: "s" })))));
1410
1414
  }
1411
1415
  //--------------------------------------------------------------------------
1412
1416
  //
@@ -64,6 +64,10 @@ const MapSelectTools = class {
64
64
  // Properties (protected)
65
65
  //
66
66
  //--------------------------------------------------------------------------
67
+ /**
68
+ * esri/request: https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html
69
+ */
70
+ _esriRequest;
67
71
  /**
68
72
  * esri/layers/FeatureLayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html
69
73
  */
@@ -293,7 +297,7 @@ const MapSelectTools = class {
293
297
  render() {
294
298
  const mapToolsClass = this.enableSketchTools ? "" : "display-none";
295
299
  const mapToolsContainerClass = this.enableSketchTools ? "padding-top-1" : "";
296
- return (index.h(index.Host, { key: 'd9b4042323733785938a45be76688099b8a81b23' }, this._getMapLayerPicker(), index.h("div", { key: 'd468cd2df9971c02909fd0bc9603603bb213164f', class: "border-bottom" }), index.h("div", { key: '8cecea0a4387371c3af1ea76bbafd1cf7f205d77', class: "padding-top-sides-1" }, index.h("div", { key: 'd5364d20f014611ca73bbe1bc5b638aaa8e38738', class: "search-widget", ref: (el) => { this._searchElement = el; } }), index.h("div", { key: '2c1f16ce050e934e8dbd25a0ef430d8590438ce5', class: mapToolsContainerClass }, index.h("map-draw-tools", { key: '256ee8262662c1c54cee34bdc084e7555e3985c6', active: true, class: mapToolsClass, editGraphicsEnabled: !this._useLayerFeaturesEnabled, graphics: this._graphics, mapView: this.mapView, onSketchGraphicsChange: (evt) => void this._sketchGraphicsChanged(evt), pointSymbol: this.sketchPointSymbol, polygonSymbol: this.sketchPolygonSymbol, polylineSymbol: this.sketchLineSymbol, ref: (el) => { this._drawTools = el; } })), this.enableSearchDistance ? this._getBufferOptions() : undefined, this.enableLayerFeatures ? this._getUseLayerFeaturesOptions() : undefined, this._getNumSelected()), index.h("div", { key: '92859f6a60356d7ddc0b5530a06e181d67f3274b', class: "border-bottom" }), this._getNameInput()));
300
+ return (index.h(index.Host, { key: '6753158d00a33dd5dfbb1f22cc27388baf4c0b5e' }, this._getMapLayerPicker(), index.h("div", { key: '082c6be48d3dfbe2e39be2c462959c7772a91d40', class: "border-bottom" }), index.h("div", { key: '0e8133a809b05bef34c2f19adeff43c1e57cc002', class: "padding-top-sides-1" }, index.h("div", { key: '4434b5b4d073f3ba9a7e44b82078b9b81733025b', class: "search-widget", ref: (el) => { this._searchElement = el; } }), index.h("div", { key: '6f01e27e06ea365de6ff98df3f9edd973d87117c', class: mapToolsContainerClass }, index.h("map-draw-tools", { key: '24ffe562d080955f2aacfd080c0baa1997f8eaab', active: true, class: mapToolsClass, editGraphicsEnabled: !this._useLayerFeaturesEnabled, graphics: this._graphics, mapView: this.mapView, onSketchGraphicsChange: (evt) => void this._sketchGraphicsChanged(evt), pointSymbol: this.sketchPointSymbol, polygonSymbol: this.sketchPolygonSymbol, polylineSymbol: this.sketchLineSymbol, ref: (el) => { this._drawTools = el; } })), this.enableSearchDistance ? this._getBufferOptions() : undefined, this.enableLayerFeatures ? this._getUseLayerFeaturesOptions() : undefined, this._getNumSelected()), index.h("div", { key: '4c7cf401b5bcc7e4adef34e140d22676fce8ebbc', class: "border-bottom" }), this._getNameInput()));
297
301
  }
298
302
  /**
299
303
  * Renders the buffer tools component.
@@ -360,13 +364,15 @@ const MapSelectTools = class {
360
364
  * @protected
361
365
  */
362
366
  async _initModules() {
363
- const [GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await locale.loadModules([
367
+ const [esriRequest, GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await locale.loadModules([
368
+ "esri/request",
364
369
  "esri/layers/GraphicsLayer",
365
370
  "esri/Graphic",
366
371
  "esri/widgets/Search",
367
372
  "esri/geometry/geometryEngine",
368
373
  "esri/layers/FeatureLayer"
369
374
  ]);
375
+ this._esriRequest = esriRequest;
370
376
  this.GraphicsLayer = GraphicsLayer;
371
377
  this.Graphic = Graphic;
372
378
  this.Search = Search;
@@ -443,25 +449,7 @@ const MapSelectTools = class {
443
449
  void this._clearResults(false, clearLabel);
444
450
  });
445
451
  this._searchWidget.on("select-result", (searchResults) => {
446
- if (searchResults.result) {
447
- this._searchResult = searchResults.result;
448
- const resultFeature = searchResults.result.feature;
449
- const resultLayer = resultFeature?.layer;
450
- const selectLayer = this.selectLayerView.layer;
451
- const oid = resultFeature?.getObjectId();
452
- const useOIDs = resultLayer?.url && selectLayer?.url && resultLayer.url === selectLayer.url && !isNaN(oid);
453
- const oids = useOIDs ? [oid] : undefined;
454
- this._workflowType = interfaces.EWorkflowType.SEARCH;
455
- void this._updateLabel();
456
- const graphics = [searchResults.result.feature];
457
- this._updateSelection(graphics, useOIDs, oids);
458
- this._drawTools.graphics = graphics;
459
- this._searchWidget.resultGraphic.visible = false;
460
- }
461
- else {
462
- const clearLabel = this._searchClearLabel();
463
- void this._clearResults(false, clearLabel);
464
- }
452
+ void this._selectResult(searchResults.result);
465
453
  });
466
454
  await this._searchWidget.when(() => {
467
455
  this._searchWidget.allPlaceholder = this.searchConfiguration?.allPlaceholder &&
@@ -470,6 +458,75 @@ const MapSelectTools = class {
470
458
  });
471
459
  }
472
460
  }
461
+ /**
462
+ * Handle the result from the search widget.
463
+ *
464
+ * @param url the url of the layer view
465
+ *
466
+ * @returns the url of the views source
467
+ * @protected
468
+ */
469
+ async _selectResult(result) {
470
+ if (result) {
471
+ this._searchResult = result;
472
+ const resultFeature = result.feature;
473
+ const resultLayer = resultFeature?.layer;
474
+ const selectLayer = this.selectLayerView.layer;
475
+ const oid = resultFeature?.getObjectId();
476
+ let resultLayerSourceUrl;
477
+ if (resultLayer.sourceJSON?.isView) {
478
+ resultLayerSourceUrl = await this._getViewSourceUrl(resultLayer.url);
479
+ }
480
+ let selectLayerSourceUrl;
481
+ if (selectLayer.sourceJSON?.isView) {
482
+ selectLayerSourceUrl = await this._getViewSourceUrl(selectLayer.url);
483
+ }
484
+ const rUrl = resultLayer?.url?.toLowerCase();
485
+ const rSourceUrl = resultLayerSourceUrl?.toLowerCase();
486
+ const sUrl = selectLayer?.url?.toLowerCase();
487
+ const sSourceUrl = selectLayerSourceUrl?.toLowerCase();
488
+ const useOIDs = rUrl && sUrl &&
489
+ (rUrl === sUrl || rUrl === sSourceUrl || rSourceUrl === sUrl || rSourceUrl === sSourceUrl) &&
490
+ !isNaN(oid);
491
+ const oids = useOIDs ? [oid] : undefined;
492
+ this._workflowType = interfaces.EWorkflowType.SEARCH;
493
+ void this._updateLabel();
494
+ const graphics = [result.feature];
495
+ this._updateSelection(graphics, useOIDs, oids);
496
+ this._drawTools.graphics = graphics;
497
+ this._searchWidget.resultGraphic.visible = false;
498
+ }
499
+ else {
500
+ const clearLabel = this._searchClearLabel();
501
+ void this._clearResults(false, clearLabel);
502
+ }
503
+ }
504
+ /**
505
+ * Get the source url for a view. This function supports single source views only.
506
+ *
507
+ * @param url the url of the layer view
508
+ *
509
+ * @returns the url of the views source
510
+ * @protected
511
+ */
512
+ async _getViewSourceUrl(url) {
513
+ let sourceUrl = "";
514
+ const resultLayerSourcesUrl = `${url}/sources?f=json`;
515
+ try {
516
+ const request = await this._esriRequest(resultLayerSourcesUrl, {
517
+ query: {
518
+ f: "json"
519
+ }
520
+ });
521
+ if (request?.data?.services?.length === 1) {
522
+ sourceUrl = request.data.services[0].url;
523
+ }
524
+ }
525
+ catch (error) {
526
+ console.log(error);
527
+ }
528
+ return sourceUrl;
529
+ }
473
530
  /**
474
531
  * Check if the current label should be cleared
475
532
  *
@@ -75,6 +75,8 @@ export class EditCard {
75
75
  _editor;
76
76
  /**
77
77
  * esri/layers/FeatureLayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html
78
+ * OR
79
+ * esri/layers/support/SubtypeSublayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-SubtypeSublayer.html
78
80
  */
79
81
  _layer;
80
82
  /**
@@ -179,7 +181,9 @@ export class EditCard {
179
181
  if (this._layerEditHandle) {
180
182
  this._layerEditHandle.remove();
181
183
  }
182
- this._layerEditHandle = this._layer.on("edits", () => {
184
+ // #896 Editing on sybtype group layer is failing in Manager
185
+ const layer = this._layer.type === "subtype-sublayer" ? this._layer.parent : this._layer;
186
+ this._layerEditHandle = layer.on("edits", () => {
183
187
  this.editsComplete.emit();
184
188
  });
185
189
  }
@@ -194,7 +198,7 @@ export class EditCard {
194
198
  !this.graphics[0].layer.editingEnabled : true;
195
199
  const tableNodeClass = this._editorLoading ? "display-none" : "position-absolute";
196
200
  const loadingClass = this._editorLoading ? "" : "display-none";
197
- return (h(Host, { key: '1520951922ca98ee92ccc8f7119d7fa3666eddfa' }, h("div", { key: 'd436d1660fd46bba90dd5dadc6962c619b99143e', class: "position-absolute" }, editDisabled ? (h("calcite-notice", { kind: "warning", open: true, slot: "content-top", width: "full" }, h("div", { slot: "message" }, this._translations.enableEditing))) : undefined, h("div", { key: 'cff16539fd7b4a85234e0d15d2170470d95d0ad9', class: "position-absolute" }, h("div", { key: '0b96a2d27a5df344da9192a01d5c42496e057cd1', class: tableNodeClass, id: "feature-form", ref: (el) => this._editContainer = el }), h("calcite-loader", { key: '49cadf3456d1f3289abde18c35b726471ac551cd', class: loadingClass, label: "", scale: "s" })))));
201
+ return (h(Host, { key: '16dd78822ee6d7c4e2da97c4b7ec7c0678b51e68' }, h("div", { key: '8aba2b86c7bf8e7dfbf7567b156e02b23b728f4e', class: "position-absolute" }, editDisabled ? (h("calcite-notice", { kind: "warning", open: true, slot: "content-top", width: "full" }, h("div", { slot: "message" }, this._translations.enableEditing))) : undefined, h("div", { key: '8230d44ec05ff207681e6333b7f08c80748c4f3d', class: "position-absolute" }, h("div", { key: '71792b5737c43a024ebc677ae168d74569349585', class: tableNodeClass, id: "feature-form", ref: (el) => this._editContainer = el }), h("calcite-loader", { key: '47176534c25769af8ae107c3864901c4294b4359', class: loadingClass, label: "", scale: "s" })))));
198
202
  }
199
203
  //--------------------------------------------------------------------------
200
204
  //
@@ -69,6 +69,10 @@ export class MapSelectTools {
69
69
  // Properties (protected)
70
70
  //
71
71
  //--------------------------------------------------------------------------
72
+ /**
73
+ * esri/request: https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html
74
+ */
75
+ _esriRequest;
72
76
  /**
73
77
  * esri/layers/FeatureLayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html
74
78
  */
@@ -298,7 +302,7 @@ export class MapSelectTools {
298
302
  render() {
299
303
  const mapToolsClass = this.enableSketchTools ? "" : "display-none";
300
304
  const mapToolsContainerClass = this.enableSketchTools ? "padding-top-1" : "";
301
- return (h(Host, { key: 'd9b4042323733785938a45be76688099b8a81b23' }, this._getMapLayerPicker(), h("div", { key: 'd468cd2df9971c02909fd0bc9603603bb213164f', class: "border-bottom" }), h("div", { key: '8cecea0a4387371c3af1ea76bbafd1cf7f205d77', class: "padding-top-sides-1" }, h("div", { key: 'd5364d20f014611ca73bbe1bc5b638aaa8e38738', class: "search-widget", ref: (el) => { this._searchElement = el; } }), h("div", { key: '2c1f16ce050e934e8dbd25a0ef430d8590438ce5', class: mapToolsContainerClass }, h("map-draw-tools", { key: '256ee8262662c1c54cee34bdc084e7555e3985c6', active: true, class: mapToolsClass, editGraphicsEnabled: !this._useLayerFeaturesEnabled, graphics: this._graphics, mapView: this.mapView, onSketchGraphicsChange: (evt) => void this._sketchGraphicsChanged(evt), pointSymbol: this.sketchPointSymbol, polygonSymbol: this.sketchPolygonSymbol, polylineSymbol: this.sketchLineSymbol, ref: (el) => { this._drawTools = el; } })), this.enableSearchDistance ? this._getBufferOptions() : undefined, this.enableLayerFeatures ? this._getUseLayerFeaturesOptions() : undefined, this._getNumSelected()), h("div", { key: '92859f6a60356d7ddc0b5530a06e181d67f3274b', class: "border-bottom" }), this._getNameInput()));
305
+ return (h(Host, { key: '6753158d00a33dd5dfbb1f22cc27388baf4c0b5e' }, this._getMapLayerPicker(), h("div", { key: '082c6be48d3dfbe2e39be2c462959c7772a91d40', class: "border-bottom" }), h("div", { key: '0e8133a809b05bef34c2f19adeff43c1e57cc002', class: "padding-top-sides-1" }, h("div", { key: '4434b5b4d073f3ba9a7e44b82078b9b81733025b', class: "search-widget", ref: (el) => { this._searchElement = el; } }), h("div", { key: '6f01e27e06ea365de6ff98df3f9edd973d87117c', class: mapToolsContainerClass }, h("map-draw-tools", { key: '24ffe562d080955f2aacfd080c0baa1997f8eaab', active: true, class: mapToolsClass, editGraphicsEnabled: !this._useLayerFeaturesEnabled, graphics: this._graphics, mapView: this.mapView, onSketchGraphicsChange: (evt) => void this._sketchGraphicsChanged(evt), pointSymbol: this.sketchPointSymbol, polygonSymbol: this.sketchPolygonSymbol, polylineSymbol: this.sketchLineSymbol, ref: (el) => { this._drawTools = el; } })), this.enableSearchDistance ? this._getBufferOptions() : undefined, this.enableLayerFeatures ? this._getUseLayerFeaturesOptions() : undefined, this._getNumSelected()), h("div", { key: '4c7cf401b5bcc7e4adef34e140d22676fce8ebbc', class: "border-bottom" }), this._getNameInput()));
302
306
  }
303
307
  /**
304
308
  * Renders the buffer tools component.
@@ -365,13 +369,15 @@ export class MapSelectTools {
365
369
  * @protected
366
370
  */
367
371
  async _initModules() {
368
- const [GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules([
372
+ const [esriRequest, GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules([
373
+ "esri/request",
369
374
  "esri/layers/GraphicsLayer",
370
375
  "esri/Graphic",
371
376
  "esri/widgets/Search",
372
377
  "esri/geometry/geometryEngine",
373
378
  "esri/layers/FeatureLayer"
374
379
  ]);
380
+ this._esriRequest = esriRequest;
375
381
  this.GraphicsLayer = GraphicsLayer;
376
382
  this.Graphic = Graphic;
377
383
  this.Search = Search;
@@ -448,25 +454,7 @@ export class MapSelectTools {
448
454
  void this._clearResults(false, clearLabel);
449
455
  });
450
456
  this._searchWidget.on("select-result", (searchResults) => {
451
- if (searchResults.result) {
452
- this._searchResult = searchResults.result;
453
- const resultFeature = searchResults.result.feature;
454
- const resultLayer = resultFeature?.layer;
455
- const selectLayer = this.selectLayerView.layer;
456
- const oid = resultFeature?.getObjectId();
457
- const useOIDs = resultLayer?.url && selectLayer?.url && resultLayer.url === selectLayer.url && !isNaN(oid);
458
- const oids = useOIDs ? [oid] : undefined;
459
- this._workflowType = EWorkflowType.SEARCH;
460
- void this._updateLabel();
461
- const graphics = [searchResults.result.feature];
462
- this._updateSelection(graphics, useOIDs, oids);
463
- this._drawTools.graphics = graphics;
464
- this._searchWidget.resultGraphic.visible = false;
465
- }
466
- else {
467
- const clearLabel = this._searchClearLabel();
468
- void this._clearResults(false, clearLabel);
469
- }
457
+ void this._selectResult(searchResults.result);
470
458
  });
471
459
  await this._searchWidget.when(() => {
472
460
  this._searchWidget.allPlaceholder = this.searchConfiguration?.allPlaceholder &&
@@ -475,6 +463,75 @@ export class MapSelectTools {
475
463
  });
476
464
  }
477
465
  }
466
+ /**
467
+ * Handle the result from the search widget.
468
+ *
469
+ * @param url the url of the layer view
470
+ *
471
+ * @returns the url of the views source
472
+ * @protected
473
+ */
474
+ async _selectResult(result) {
475
+ if (result) {
476
+ this._searchResult = result;
477
+ const resultFeature = result.feature;
478
+ const resultLayer = resultFeature?.layer;
479
+ const selectLayer = this.selectLayerView.layer;
480
+ const oid = resultFeature?.getObjectId();
481
+ let resultLayerSourceUrl;
482
+ if (resultLayer.sourceJSON?.isView) {
483
+ resultLayerSourceUrl = await this._getViewSourceUrl(resultLayer.url);
484
+ }
485
+ let selectLayerSourceUrl;
486
+ if (selectLayer.sourceJSON?.isView) {
487
+ selectLayerSourceUrl = await this._getViewSourceUrl(selectLayer.url);
488
+ }
489
+ const rUrl = resultLayer?.url?.toLowerCase();
490
+ const rSourceUrl = resultLayerSourceUrl?.toLowerCase();
491
+ const sUrl = selectLayer?.url?.toLowerCase();
492
+ const sSourceUrl = selectLayerSourceUrl?.toLowerCase();
493
+ const useOIDs = rUrl && sUrl &&
494
+ (rUrl === sUrl || rUrl === sSourceUrl || rSourceUrl === sUrl || rSourceUrl === sSourceUrl) &&
495
+ !isNaN(oid);
496
+ const oids = useOIDs ? [oid] : undefined;
497
+ this._workflowType = EWorkflowType.SEARCH;
498
+ void this._updateLabel();
499
+ const graphics = [result.feature];
500
+ this._updateSelection(graphics, useOIDs, oids);
501
+ this._drawTools.graphics = graphics;
502
+ this._searchWidget.resultGraphic.visible = false;
503
+ }
504
+ else {
505
+ const clearLabel = this._searchClearLabel();
506
+ void this._clearResults(false, clearLabel);
507
+ }
508
+ }
509
+ /**
510
+ * Get the source url for a view. This function supports single source views only.
511
+ *
512
+ * @param url the url of the layer view
513
+ *
514
+ * @returns the url of the views source
515
+ * @protected
516
+ */
517
+ async _getViewSourceUrl(url) {
518
+ let sourceUrl = "";
519
+ const resultLayerSourcesUrl = `${url}/sources?f=json`;
520
+ try {
521
+ const request = await this._esriRequest(resultLayerSourcesUrl, {
522
+ query: {
523
+ f: "json"
524
+ }
525
+ });
526
+ if (request?.data?.services?.length === 1) {
527
+ sourceUrl = request.data.services[0].url;
528
+ }
529
+ }
530
+ catch (error) {
531
+ console.log(error);
532
+ }
533
+ return sourceUrl;
534
+ }
478
535
  /**
479
536
  * Check if the current label should be cleared
480
537
  *
@@ -67,6 +67,8 @@ const EditCard = /*@__PURE__*/ proxyCustomElement(class EditCard extends HTMLEle
67
67
  _editor;
68
68
  /**
69
69
  * esri/layers/FeatureLayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html
70
+ * OR
71
+ * esri/layers/support/SubtypeSublayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-SubtypeSublayer.html
70
72
  */
71
73
  _layer;
72
74
  /**
@@ -171,7 +173,9 @@ const EditCard = /*@__PURE__*/ proxyCustomElement(class EditCard extends HTMLEle
171
173
  if (this._layerEditHandle) {
172
174
  this._layerEditHandle.remove();
173
175
  }
174
- this._layerEditHandle = this._layer.on("edits", () => {
176
+ // #896 Editing on sybtype group layer is failing in Manager
177
+ const layer = this._layer.type === "subtype-sublayer" ? this._layer.parent : this._layer;
178
+ this._layerEditHandle = layer.on("edits", () => {
175
179
  this.editsComplete.emit();
176
180
  });
177
181
  }
@@ -186,7 +190,7 @@ const EditCard = /*@__PURE__*/ proxyCustomElement(class EditCard extends HTMLEle
186
190
  !this.graphics[0].layer.editingEnabled : true;
187
191
  const tableNodeClass = this._editorLoading ? "display-none" : "position-absolute";
188
192
  const loadingClass = this._editorLoading ? "" : "display-none";
189
- return (h(Host, { key: '1520951922ca98ee92ccc8f7119d7fa3666eddfa' }, h("div", { key: 'd436d1660fd46bba90dd5dadc6962c619b99143e', class: "position-absolute" }, editDisabled ? (h("calcite-notice", { kind: "warning", open: true, slot: "content-top", width: "full" }, h("div", { slot: "message" }, this._translations.enableEditing))) : undefined, h("div", { key: 'cff16539fd7b4a85234e0d15d2170470d95d0ad9', class: "position-absolute" }, h("div", { key: '0b96a2d27a5df344da9192a01d5c42496e057cd1', class: tableNodeClass, id: "feature-form", ref: (el) => this._editContainer = el }), h("calcite-loader", { key: '49cadf3456d1f3289abde18c35b726471ac551cd', class: loadingClass, label: "", scale: "s" })))));
193
+ return (h(Host, { key: '16dd78822ee6d7c4e2da97c4b7ec7c0678b51e68' }, h("div", { key: '8aba2b86c7bf8e7dfbf7567b156e02b23b728f4e', class: "position-absolute" }, editDisabled ? (h("calcite-notice", { kind: "warning", open: true, slot: "content-top", width: "full" }, h("div", { slot: "message" }, this._translations.enableEditing))) : undefined, h("div", { key: '8230d44ec05ff207681e6333b7f08c80748c4f3d', class: "position-absolute" }, h("div", { key: '71792b5737c43a024ebc677ae168d74569349585', class: tableNodeClass, id: "feature-form", ref: (el) => this._editContainer = el }), h("calcite-loader", { key: '47176534c25769af8ae107c3864901c4294b4359', class: loadingClass, label: "", scale: "s" })))));
190
194
  }
191
195
  //--------------------------------------------------------------------------
192
196
  //
@@ -81,6 +81,10 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class MapSelectTools ext
81
81
  // Properties (protected)
82
82
  //
83
83
  //--------------------------------------------------------------------------
84
+ /**
85
+ * esri/request: https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html
86
+ */
87
+ _esriRequest;
84
88
  /**
85
89
  * esri/layers/FeatureLayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html
86
90
  */
@@ -310,7 +314,7 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class MapSelectTools ext
310
314
  render() {
311
315
  const mapToolsClass = this.enableSketchTools ? "" : "display-none";
312
316
  const mapToolsContainerClass = this.enableSketchTools ? "padding-top-1" : "";
313
- return (h(Host, { key: 'd9b4042323733785938a45be76688099b8a81b23' }, this._getMapLayerPicker(), h("div", { key: 'd468cd2df9971c02909fd0bc9603603bb213164f', class: "border-bottom" }), h("div", { key: '8cecea0a4387371c3af1ea76bbafd1cf7f205d77', class: "padding-top-sides-1" }, h("div", { key: 'd5364d20f014611ca73bbe1bc5b638aaa8e38738', class: "search-widget", ref: (el) => { this._searchElement = el; } }), h("div", { key: '2c1f16ce050e934e8dbd25a0ef430d8590438ce5', class: mapToolsContainerClass }, h("map-draw-tools", { key: '256ee8262662c1c54cee34bdc084e7555e3985c6', active: true, class: mapToolsClass, editGraphicsEnabled: !this._useLayerFeaturesEnabled, graphics: this._graphics, mapView: this.mapView, onSketchGraphicsChange: (evt) => void this._sketchGraphicsChanged(evt), pointSymbol: this.sketchPointSymbol, polygonSymbol: this.sketchPolygonSymbol, polylineSymbol: this.sketchLineSymbol, ref: (el) => { this._drawTools = el; } })), this.enableSearchDistance ? this._getBufferOptions() : undefined, this.enableLayerFeatures ? this._getUseLayerFeaturesOptions() : undefined, this._getNumSelected()), h("div", { key: '92859f6a60356d7ddc0b5530a06e181d67f3274b', class: "border-bottom" }), this._getNameInput()));
317
+ return (h(Host, { key: '6753158d00a33dd5dfbb1f22cc27388baf4c0b5e' }, this._getMapLayerPicker(), h("div", { key: '082c6be48d3dfbe2e39be2c462959c7772a91d40', class: "border-bottom" }), h("div", { key: '0e8133a809b05bef34c2f19adeff43c1e57cc002', class: "padding-top-sides-1" }, h("div", { key: '4434b5b4d073f3ba9a7e44b82078b9b81733025b', class: "search-widget", ref: (el) => { this._searchElement = el; } }), h("div", { key: '6f01e27e06ea365de6ff98df3f9edd973d87117c', class: mapToolsContainerClass }, h("map-draw-tools", { key: '24ffe562d080955f2aacfd080c0baa1997f8eaab', active: true, class: mapToolsClass, editGraphicsEnabled: !this._useLayerFeaturesEnabled, graphics: this._graphics, mapView: this.mapView, onSketchGraphicsChange: (evt) => void this._sketchGraphicsChanged(evt), pointSymbol: this.sketchPointSymbol, polygonSymbol: this.sketchPolygonSymbol, polylineSymbol: this.sketchLineSymbol, ref: (el) => { this._drawTools = el; } })), this.enableSearchDistance ? this._getBufferOptions() : undefined, this.enableLayerFeatures ? this._getUseLayerFeaturesOptions() : undefined, this._getNumSelected()), h("div", { key: '4c7cf401b5bcc7e4adef34e140d22676fce8ebbc', class: "border-bottom" }), this._getNameInput()));
314
318
  }
315
319
  /**
316
320
  * Renders the buffer tools component.
@@ -377,13 +381,15 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class MapSelectTools ext
377
381
  * @protected
378
382
  */
379
383
  async _initModules() {
380
- const [GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules([
384
+ const [esriRequest, GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules([
385
+ "esri/request",
381
386
  "esri/layers/GraphicsLayer",
382
387
  "esri/Graphic",
383
388
  "esri/widgets/Search",
384
389
  "esri/geometry/geometryEngine",
385
390
  "esri/layers/FeatureLayer"
386
391
  ]);
392
+ this._esriRequest = esriRequest;
387
393
  this.GraphicsLayer = GraphicsLayer;
388
394
  this.Graphic = Graphic;
389
395
  this.Search = Search;
@@ -460,25 +466,7 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class MapSelectTools ext
460
466
  void this._clearResults(false, clearLabel);
461
467
  });
462
468
  this._searchWidget.on("select-result", (searchResults) => {
463
- if (searchResults.result) {
464
- this._searchResult = searchResults.result;
465
- const resultFeature = searchResults.result.feature;
466
- const resultLayer = resultFeature?.layer;
467
- const selectLayer = this.selectLayerView.layer;
468
- const oid = resultFeature?.getObjectId();
469
- const useOIDs = resultLayer?.url && selectLayer?.url && resultLayer.url === selectLayer.url && !isNaN(oid);
470
- const oids = useOIDs ? [oid] : undefined;
471
- this._workflowType = EWorkflowType.SEARCH;
472
- void this._updateLabel();
473
- const graphics = [searchResults.result.feature];
474
- this._updateSelection(graphics, useOIDs, oids);
475
- this._drawTools.graphics = graphics;
476
- this._searchWidget.resultGraphic.visible = false;
477
- }
478
- else {
479
- const clearLabel = this._searchClearLabel();
480
- void this._clearResults(false, clearLabel);
481
- }
469
+ void this._selectResult(searchResults.result);
482
470
  });
483
471
  await this._searchWidget.when(() => {
484
472
  this._searchWidget.allPlaceholder = this.searchConfiguration?.allPlaceholder &&
@@ -487,6 +475,75 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class MapSelectTools ext
487
475
  });
488
476
  }
489
477
  }
478
+ /**
479
+ * Handle the result from the search widget.
480
+ *
481
+ * @param url the url of the layer view
482
+ *
483
+ * @returns the url of the views source
484
+ * @protected
485
+ */
486
+ async _selectResult(result) {
487
+ if (result) {
488
+ this._searchResult = result;
489
+ const resultFeature = result.feature;
490
+ const resultLayer = resultFeature?.layer;
491
+ const selectLayer = this.selectLayerView.layer;
492
+ const oid = resultFeature?.getObjectId();
493
+ let resultLayerSourceUrl;
494
+ if (resultLayer.sourceJSON?.isView) {
495
+ resultLayerSourceUrl = await this._getViewSourceUrl(resultLayer.url);
496
+ }
497
+ let selectLayerSourceUrl;
498
+ if (selectLayer.sourceJSON?.isView) {
499
+ selectLayerSourceUrl = await this._getViewSourceUrl(selectLayer.url);
500
+ }
501
+ const rUrl = resultLayer?.url?.toLowerCase();
502
+ const rSourceUrl = resultLayerSourceUrl?.toLowerCase();
503
+ const sUrl = selectLayer?.url?.toLowerCase();
504
+ const sSourceUrl = selectLayerSourceUrl?.toLowerCase();
505
+ const useOIDs = rUrl && sUrl &&
506
+ (rUrl === sUrl || rUrl === sSourceUrl || rSourceUrl === sUrl || rSourceUrl === sSourceUrl) &&
507
+ !isNaN(oid);
508
+ const oids = useOIDs ? [oid] : undefined;
509
+ this._workflowType = EWorkflowType.SEARCH;
510
+ void this._updateLabel();
511
+ const graphics = [result.feature];
512
+ this._updateSelection(graphics, useOIDs, oids);
513
+ this._drawTools.graphics = graphics;
514
+ this._searchWidget.resultGraphic.visible = false;
515
+ }
516
+ else {
517
+ const clearLabel = this._searchClearLabel();
518
+ void this._clearResults(false, clearLabel);
519
+ }
520
+ }
521
+ /**
522
+ * Get the source url for a view. This function supports single source views only.
523
+ *
524
+ * @param url the url of the layer view
525
+ *
526
+ * @returns the url of the views source
527
+ * @protected
528
+ */
529
+ async _getViewSourceUrl(url) {
530
+ let sourceUrl = "";
531
+ const resultLayerSourcesUrl = `${url}/sources?f=json`;
532
+ try {
533
+ const request = await this._esriRequest(resultLayerSourcesUrl, {
534
+ query: {
535
+ f: "json"
536
+ }
537
+ });
538
+ if (request?.data?.services?.length === 1) {
539
+ sourceUrl = request.data.services[0].url;
540
+ }
541
+ }
542
+ catch (error) {
543
+ console.log(error);
544
+ }
545
+ return sourceUrl;
546
+ }
490
547
  /**
491
548
  * Check if the current label should be cleared
492
549
  *
@@ -1283,6 +1283,8 @@ const EditCard = class {
1283
1283
  _editor;
1284
1284
  /**
1285
1285
  * esri/layers/FeatureLayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html
1286
+ * OR
1287
+ * esri/layers/support/SubtypeSublayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-SubtypeSublayer.html
1286
1288
  */
1287
1289
  _layer;
1288
1290
  /**
@@ -1387,7 +1389,9 @@ const EditCard = class {
1387
1389
  if (this._layerEditHandle) {
1388
1390
  this._layerEditHandle.remove();
1389
1391
  }
1390
- this._layerEditHandle = this._layer.on("edits", () => {
1392
+ // #896 Editing on sybtype group layer is failing in Manager
1393
+ const layer = this._layer.type === "subtype-sublayer" ? this._layer.parent : this._layer;
1394
+ this._layerEditHandle = layer.on("edits", () => {
1391
1395
  this.editsComplete.emit();
1392
1396
  });
1393
1397
  }
@@ -1402,7 +1406,7 @@ const EditCard = class {
1402
1406
  !this.graphics[0].layer.editingEnabled : true;
1403
1407
  const tableNodeClass = this._editorLoading ? "display-none" : "position-absolute";
1404
1408
  const loadingClass = this._editorLoading ? "" : "display-none";
1405
- return (h(Host, { key: '1520951922ca98ee92ccc8f7119d7fa3666eddfa' }, h("div", { key: 'd436d1660fd46bba90dd5dadc6962c619b99143e', class: "position-absolute" }, editDisabled ? (h("calcite-notice", { kind: "warning", open: true, slot: "content-top", width: "full" }, h("div", { slot: "message" }, this._translations.enableEditing))) : undefined, h("div", { key: 'cff16539fd7b4a85234e0d15d2170470d95d0ad9', class: "position-absolute" }, h("div", { key: '0b96a2d27a5df344da9192a01d5c42496e057cd1', class: tableNodeClass, id: "feature-form", ref: (el) => this._editContainer = el }), h("calcite-loader", { key: '49cadf3456d1f3289abde18c35b726471ac551cd', class: loadingClass, label: "", scale: "s" })))));
1409
+ return (h(Host, { key: '16dd78822ee6d7c4e2da97c4b7ec7c0678b51e68' }, h("div", { key: '8aba2b86c7bf8e7dfbf7567b156e02b23b728f4e', class: "position-absolute" }, editDisabled ? (h("calcite-notice", { kind: "warning", open: true, slot: "content-top", width: "full" }, h("div", { slot: "message" }, this._translations.enableEditing))) : undefined, h("div", { key: '8230d44ec05ff207681e6333b7f08c80748c4f3d', class: "position-absolute" }, h("div", { key: '71792b5737c43a024ebc677ae168d74569349585', class: tableNodeClass, id: "feature-form", ref: (el) => this._editContainer = el }), h("calcite-loader", { key: '47176534c25769af8ae107c3864901c4294b4359', class: loadingClass, label: "", scale: "s" })))));
1406
1410
  }
1407
1411
  //--------------------------------------------------------------------------
1408
1412
  //