@esri/solutions-components 0.7.25 → 0.7.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/dist/cjs/calcite-alert_4.cjs.entry.js +2 -2
  2. package/dist/cjs/calcite-flow_4.cjs.entry.js +43 -12
  3. package/dist/cjs/card-manager_3.cjs.entry.js +3 -1
  4. package/dist/cjs/crowdsource-reporter.cjs.entry.js +11 -22
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/{popupUtils-a73902a6.js → popupUtils-7755782a.js} +9 -12
  7. package/dist/cjs/solutions-components.cjs.js +1 -1
  8. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +0 -21
  9. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +27 -21
  10. package/dist/collection/components/feature-list/feature-list.js +43 -10
  11. package/dist/collection/components/info-card/info-card.js +1 -1
  12. package/dist/collection/components/layer-list/layer-list.js +2 -1
  13. package/dist/collection/components/layer-table/layer-table.js +3 -1
  14. package/dist/collection/demos/crowdsource-reporter.html +92 -58
  15. package/dist/collection/demos/feature-list.html +65 -17
  16. package/dist/collection/demos/layer-list.html +43 -3
  17. package/dist/collection/utils/interfaces.ts +1 -1
  18. package/dist/collection/utils/popupUtils.js +9 -12
  19. package/dist/collection/utils/popupUtils.ts +30 -32
  20. package/dist/components/crowdsource-reporter.js +12 -23
  21. package/dist/components/feature-list2.js +42 -10
  22. package/dist/components/info-card2.js +1 -1
  23. package/dist/components/layer-list2.js +2 -1
  24. package/dist/components/layer-table2.js +3 -1
  25. package/dist/components/popupUtils.js +9 -12
  26. package/dist/esm/calcite-alert_4.entry.js +2 -2
  27. package/dist/esm/calcite-flow_4.entry.js +43 -12
  28. package/dist/esm/card-manager_3.entry.js +3 -1
  29. package/dist/esm/crowdsource-reporter.entry.js +12 -23
  30. package/dist/esm/loader.js +1 -1
  31. package/dist/esm/{popupUtils-a593bd78.js → popupUtils-d75edf93.js} +9 -12
  32. package/dist/esm/solutions-components.js +1 -1
  33. package/dist/solutions-components/demos/crowdsource-reporter.html +92 -58
  34. package/dist/solutions-components/demos/feature-list.html +65 -17
  35. package/dist/solutions-components/demos/layer-list.html +43 -3
  36. package/dist/solutions-components/p-515a319e.js +21 -0
  37. package/dist/solutions-components/p-6a452a84.entry.js +17 -0
  38. package/dist/solutions-components/p-8756eebb.entry.js +6 -0
  39. package/dist/solutions-components/{p-29f661f5.entry.js → p-934cbe40.entry.js} +2 -2
  40. package/dist/solutions-components/{p-5af99fd8.entry.js → p-9549b5b1.entry.js} +1 -1
  41. package/dist/solutions-components/solutions-components.esm.js +1 -1
  42. package/dist/solutions-components/utils/interfaces.ts +1 -1
  43. package/dist/solutions-components/utils/popupUtils.ts +30 -32
  44. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +5 -1
  45. package/dist/types/components/feature-list/feature-list.d.ts +8 -0
  46. package/dist/types/components.d.ts +19 -0
  47. package/dist/types/preact.d.ts +3 -1
  48. package/dist/types/utils/interfaces.d.ts +1 -1
  49. package/dist/types/utils/popupUtils.d.ts +3 -2
  50. package/package.json +1 -1
  51. package/dist/solutions-components/p-0b619197.entry.js +0 -17
  52. package/dist/solutions-components/p-db868283.js +0 -21
  53. package/dist/solutions-components/p-e88a64be.entry.js +0 -6
@@ -17,7 +17,7 @@ const t9n = require('./t9n-0556abcb.js');
17
17
  const resources = require('./resources-222ad22c.js');
18
18
  const locale$1 = require('./locale-a476e15d.js');
19
19
  const mapViewUtils = require('./mapViewUtils-8aa325de.js');
20
- const popupUtils = require('./popupUtils-a73902a6.js');
20
+ const popupUtils = require('./popupUtils-7755782a.js');
21
21
  require('./guid-1a466ca6.js');
22
22
  require('./resources-6c60363a.js');
23
23
  require('./key-b8c05387.js');
@@ -813,7 +813,7 @@ const InfoCard = class {
813
813
  if (this.graphics.length > 0) {
814
814
  this._layer = (_a = this.graphics[0]) === null || _a === void 0 ? void 0 : _a.layer;
815
815
  this._editEnabled = this._layer.editingEnabled && this._layer.capabilities.operations.supportsUpdate;
816
- this._mobileTitle = await this._popupUtils.getPopupTitle(this.graphics[0]);
816
+ this._mobileTitle = await this._popupUtils.getPopupTitle(this.graphics[0], this.mapView.map);
817
817
  this._features.open({
818
818
  features: this.graphics
819
819
  });
@@ -15,7 +15,7 @@ const interactive = require('./interactive-8aff886e.js');
15
15
  const locale = require('./locale-6a627639.js');
16
16
  const t9n = require('./t9n-0556abcb.js');
17
17
  const resources = require('./resources-8e3763a4.js');
18
- const popupUtils = require('./popupUtils-a73902a6.js');
18
+ const popupUtils = require('./popupUtils-7755782a.js');
19
19
  const mapViewUtils = require('./mapViewUtils-8aa325de.js');
20
20
  const locale$1 = require('./locale-a476e15d.js');
21
21
  require('./guid-1a466ca6.js');
@@ -357,6 +357,18 @@ const FeatureList = class {
357
357
  }
358
358
  //--------------------------------------------------------------------------
359
359
  //
360
+ // Watch handlers
361
+ //
362
+ //--------------------------------------------------------------------------
363
+ /**
364
+ * Watch for selectedLayerId change and update layer instance and features list for new layerId
365
+ */
366
+ async selectedLayerWatchHandler() {
367
+ this._selectedLayer = await mapViewUtils.getLayerOrTable(this.mapView, this.selectedLayerId);
368
+ await this.initializeFeatureItems();
369
+ }
370
+ //--------------------------------------------------------------------------
371
+ //
360
372
  // Functions (lifecycle)
361
373
  //
362
374
  //--------------------------------------------------------------------------
@@ -368,23 +380,22 @@ const FeatureList = class {
368
380
  await this._getTranslations();
369
381
  this._isLoading = true;
370
382
  this._popupUtils = new popupUtils.PopupUtils();
371
- this._selectedLayer = await mapViewUtils.getLayerOrTable(this.mapView, this.selectedLayerId);
383
+ if (this.mapView && this.selectedLayerId) {
384
+ this._selectedLayer = await mapViewUtils.getLayerOrTable(this.mapView, this.selectedLayerId);
385
+ }
372
386
  }
373
387
  /**
374
388
  * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
375
389
  */
376
390
  async componentDidLoad() {
377
- if (this._selectedLayer) {
378
- this._featureItems = await this.queryPage(0);
379
- this._featuresCount = await this._selectedLayer.queryFeatureCount();
380
- this._isLoading = false;
381
- }
391
+ await this.initializeFeatureItems();
382
392
  }
383
393
  /**
384
394
  * Renders the component.
385
395
  */
386
396
  render() {
387
- return (index.h("calcite-panel", { "full-height": true, "full-width": true }, this._isLoading && index.h("calcite-loader", { scale: "m" }), this._featureItems.length === 0 && !this._isLoading && index.h("calcite-notice", { class: "error-msg", icon: "feature-details", kind: "info", open: true }, index.h("div", { slot: "message" }, this.noFeaturesFoundMsg ? this.noFeaturesFoundMsg : this._translations.featureErrorMsg)), index.h("calcite-list", { "selection-appearance": "border", "selection-mode": "single" }, !this._isLoading && this._featureItems.length > 0 && this._featureItems), this._featuresCount > this.pageSize &&
397
+ return (index.h("calcite-panel", { "full-height": true, "full-width": true }, this._isLoading && index.h("calcite-loader", { scale: "m" }), this._featureItems.length === 0 && !this._isLoading &&
398
+ index.h("calcite-notice", { class: "error-msg", icon: "feature-details", kind: "info", open: true }, index.h("div", { slot: "message" }, this.noFeaturesFoundMsg ? this.noFeaturesFoundMsg : this._translations.featureErrorMsg)), index.h("calcite-list", { "selection-appearance": "border", "selection-mode": "single" }, !this._isLoading && this._featureItems.length > 0 && this._featureItems), this._featuresCount > this.pageSize &&
388
399
  index.h("div", { class: "width-full", slot: "footer" }, index.h("calcite-pagination", { class: "pagination", "full-width": true, onCalcitePaginationChange: this.pageChanged.bind(this), "page-size": this.pageSize, "start-item": "1", "total-items": this._featuresCount }))));
389
400
  }
390
401
  //--------------------------------------------------------------------------
@@ -392,6 +403,17 @@ const FeatureList = class {
392
403
  // Functions (protected)
393
404
  //
394
405
  //--------------------------------------------------------------------------
406
+ /**
407
+ * Initialize the features list using the selected layer
408
+ */
409
+ async initializeFeatureItems() {
410
+ if (this._selectedLayer) {
411
+ this._isLoading = true;
412
+ this._featureItems = await this.queryPage(0);
413
+ this._featuresCount = await this._selectedLayer.queryFeatureCount();
414
+ this._isLoading = false;
415
+ }
416
+ }
395
417
  /**
396
418
  * On page change get the next updated feature list
397
419
  * @param event page change event
@@ -436,14 +458,19 @@ const FeatureList = class {
436
458
  */
437
459
  async queryPage(page) {
438
460
  const featureLayer = this._selectedLayer;
461
+ const objectIdField = featureLayer.objectIdField;
439
462
  const query = {
440
463
  start: page,
441
464
  num: this.pageSize,
442
465
  outFields: ["*"],
443
- orderByFields: [featureLayer.objectIdField + " DESC"],
444
466
  returnGeometry: true,
445
- where: featureLayer.definitionExpression
467
+ where: featureLayer.definitionExpression,
468
+ outSpatialReference: this.mapView.spatialReference.toJSON()
446
469
  };
470
+ //sort only when objectId field is found
471
+ if (objectIdField) {
472
+ query.orderByFields = [objectIdField.toString() + " DESC"];
473
+ }
447
474
  const featureSet = await featureLayer.queryFeatures(query);
448
475
  return await this.createFeatureItem(featureSet);
449
476
  }
@@ -456,7 +483,7 @@ const FeatureList = class {
456
483
  async createFeatureItem(featureSet) {
457
484
  const currentFeatures = featureSet === null || featureSet === void 0 ? void 0 : featureSet.features;
458
485
  const items = currentFeatures.map(async (feature) => {
459
- const popupTitle = await this._popupUtils.getPopupTitle(feature);
486
+ const popupTitle = await this._popupUtils.getPopupTitle(feature, this.mapView.map);
460
487
  return this.getFeatureItem(feature, popupTitle);
461
488
  });
462
489
  return Promise.all(items);
@@ -485,6 +512,9 @@ const FeatureList = class {
485
512
  this._translations = messages[0];
486
513
  }
487
514
  get el() { return index.getElement(this); }
515
+ static get watchers() { return {
516
+ "selectedLayerId": ["selectedLayerWatchHandler"]
517
+ }; }
488
518
  };
489
519
  FeatureList.style = featureListCss;
490
520
 
@@ -527,7 +557,8 @@ const LayerList = class {
527
557
  * Renders the component.
528
558
  */
529
559
  render() {
530
- return (index.h(index.Fragment, null, this._isLoading && index.h("calcite-loader", { scale: "m" }), !this._isLoading && this.mapView && this._noLayersToDisplay && index.h("calcite-notice", { class: "error-msg", icon: "layers-reference", kind: "danger", open: true }, index.h("div", { slot: "title" }, this._translations.error), index.h("div", { slot: "message" }, this.noLayerErrorMsg ? this.noLayerErrorMsg : this._translations.noLayerToDisplayErrorMsg)), !this._isLoading && this.mapView &&
560
+ return (index.h(index.Fragment, null, this._isLoading && index.h("calcite-loader", { scale: "m" }), !this._isLoading && this.mapView && this._noLayersToDisplay &&
561
+ index.h("calcite-notice", { class: "error-msg", icon: "layers-reference", kind: "danger", open: true }, index.h("div", { slot: "title" }, this._translations.error), index.h("div", { slot: "message" }, this.noLayerErrorMsg ? this.noLayerErrorMsg : this._translations.noLayerToDisplayErrorMsg)), !this._isLoading && this.mapView &&
531
562
  index.h("calcite-list", null, this.renderLayerList())));
532
563
  }
533
564
  //--------------------------------------------------------------------------
@@ -1194,7 +1194,7 @@ const LayerTable = class {
1194
1194
  */
1195
1195
  _filterModal() {
1196
1196
  var _a, _b, _c;
1197
- return (index.h("calcite-modal", { "aria-labelledby": "modal-title", class: "modal", kind: "brand", onCalciteModalClose: async () => this._closeFilter(), open: this._filterOpen, widthScale: "s" }, index.h("div", { class: "display-flex align-center", id: "modal-title", slot: "header" }, (_b = (_a = this._translations) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.replace("{{title}}", (_c = this._layer) === null || _c === void 0 ? void 0 : _c.title)), index.h("div", { slot: "content" }, index.h("instant-apps-filter-list", { autoUpdateUrl: true, closeBtn: true, closeBtnOnClick: async () => this._closeFilter(), layerExpressions: this._layerExpressions, onFilterListReset: () => this._handleFilterListReset(), onFilterUpdate: () => this._handleFilterUpdate(), ref: (el) => this._filterList = el, view: this.mapView, zoomBtn: false }))));
1197
+ return (index.h("calcite-modal", { "aria-labelledby": "modal-title", class: "modal", kind: "brand", onCalciteModalClose: async () => this._closeFilter(), open: this._filterOpen, widthScale: "s" }, index.h("div", { class: "display-flex align-center", id: "modal-title", slot: "header" }, (_b = (_a = this._translations) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.replace("{{title}}", (_c = this._layer) === null || _c === void 0 ? void 0 : _c.title)), index.h("div", { slot: "content" }, index.h("instant-apps-filter-list", { autoUpdateUrl: false, closeBtn: true, closeBtnOnClick: async () => this._closeFilter(), layerExpressions: this._layerExpressions, onFilterListReset: () => this._handleFilterListReset(), onFilterUpdate: () => this._handleFilterUpdate(), ref: (el) => this._filterList = el, view: this.mapView, zoomBtn: false }))));
1198
1198
  }
1199
1199
  /**
1200
1200
  * Reset the filter active prop
@@ -1295,6 +1295,8 @@ const LayerTable = class {
1295
1295
  var _a, _b;
1296
1296
  const layerExpressions = (_b = (_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.layerExpressions;
1297
1297
  this._layerExpressions = layerExpressions ? layerExpressions.filter((exp) => exp.id === this._layer.id) : [];
1298
+ this._filterList.layerExpressions = this._layerExpressions;
1299
+ this._filterActive = false;
1298
1300
  }
1299
1301
  /**
1300
1302
  * Select all rows that are not currently selectd
@@ -12,11 +12,12 @@ const locale = require('./locale-a476e15d.js');
12
12
  require('./esri-loader-a91c0ec1.js');
13
13
  require('./_commonjsHelpers-384729db.js');
14
14
 
15
- const crowdsourceReporterCss = ":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.map-container{position:absolute;width:calc(100% - 390px);left:390px}.side-panel{padding:2px;width:390px;height:100%;position:absolute;top:0;left:0;z-index:60}.error-msg{padding:10px}.collapsed-side-panel{top:calc(100% - 55px);height:54px}";
15
+ const crowdsourceReporterCss = ":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.error-msg{padding:10px}";
16
16
 
17
17
  const CrowdsourceReporter = class {
18
18
  constructor(hostRef) {
19
19
  index.registerInstance(this, hostRef);
20
+ this.togglePanel = index.createEvent(this, "togglePanel", 7);
20
21
  this.description = undefined;
21
22
  this.isMobile = undefined;
22
23
  this.enableAnonymousAccess = undefined;
@@ -53,9 +54,7 @@ const CrowdsourceReporter = class {
53
54
  * Called each time the mapView prop is changed.
54
55
  */
55
56
  async isMobileWatchHandler() {
56
- if (this.isMobile) {
57
- this._sidePanelCollapsed = false;
58
- }
57
+ this._sidePanelCollapsed = false;
59
58
  }
60
59
  /**
61
60
  * Called each time the mapView prop is changed.
@@ -67,16 +66,6 @@ const CrowdsourceReporter = class {
67
66
  }
68
67
  //--------------------------------------------------------------------------
69
68
  //
70
- // Methods (public)
71
- //
72
- //--------------------------------------------------------------------------
73
- //--------------------------------------------------------------------------
74
- //
75
- // Events (public)
76
- //
77
- //--------------------------------------------------------------------------
78
- //--------------------------------------------------------------------------
79
- //
80
69
  // Functions (lifecycle)
81
70
  //
82
71
  //--------------------------------------------------------------------------
@@ -118,13 +107,8 @@ const CrowdsourceReporter = class {
118
107
  break;
119
108
  }
120
109
  });
121
- let sidePanelClass = "side-panel";
122
- //in case of mobile handle for collapsed styles of the panel
123
- if (this.isMobile && this._sidePanelCollapsed) {
124
- sidePanelClass += " collapsed-side-panel";
125
- }
126
110
  const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
127
- return (index.h("calcite-panel", { class: sidePanelClass + " width-full " + themeClass }, this.mapView
111
+ return (index.h("calcite-panel", { class: "width-full " + themeClass }, this.mapView
128
112
  ? index.h("calcite-flow", null, (renderLists === null || renderLists === void 0 ? void 0 : renderLists.length) > 0 && renderLists)
129
113
  : index.h("calcite-loader", { scale: "m" })));
130
114
  }
@@ -134,7 +118,10 @@ const CrowdsourceReporter = class {
134
118
  * @protected
135
119
  */
136
120
  getLayerListFlowItem() {
137
- return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this.reportsHeader }, this._hasValidLayers && index.h("calcite-action", { icon: "sort-ascending-arrow", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.sort, "text-enabled": this.isMobile }), this._hasValidLayers && index.h("calcite-action", { icon: "filter", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.filter, "text-enabled": this.isMobile }), this.isMobile && this.getActionToExpandCollapsePanel(), this._hasValidLayers && this.enableNewReports && index.h("calcite-button", { appearance: "secondary", slot: "footer", width: "full" }, this.reportButtonText), index.h("calcite-panel", { "full-height": true, "full-width": true }, index.h("layer-list", { class: "height-full", layers: this.layers, mapView: this.mapView, noLayerErrorMsg: this._translations.noLayerToDisplayErrorMsg, onLayerSelect: this.displayFeaturesList.bind(this), onLayersListLoaded: this.layerListLoaded.bind(this) }))));
121
+ return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: this.reportsHeader }, this._hasValidLayers &&
122
+ index.h("calcite-action", { icon: "sort-ascending-arrow", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.sort, "text-enabled": this.isMobile }), this._hasValidLayers &&
123
+ index.h("calcite-action", { icon: "filter", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.filter, "text-enabled": this.isMobile }), this.isMobile && this.getActionToExpandCollapsePanel(), this._hasValidLayers && this.enableNewReports &&
124
+ index.h("calcite-button", { appearance: "secondary", slot: "footer", width: "full" }, this.reportButtonText), index.h("calcite-panel", { "full-height": true, "full-width": true }, index.h("layer-list", { class: "height-full", layers: this.layers, mapView: this.mapView, noLayerErrorMsg: this._translations.noLayerToDisplayErrorMsg, onLayerSelect: this.displayFeaturesList.bind(this), onLayersListLoaded: this.layerListLoaded.bind(this) }))));
138
125
  }
139
126
  /**
140
127
  * When layer list is loaded, we will receive the list of layers, if its means we don't have any valid layer to be listed
@@ -169,6 +156,7 @@ const CrowdsourceReporter = class {
169
156
  */
170
157
  toggleSidePanel() {
171
158
  this._sidePanelCollapsed = !this._sidePanelCollapsed;
159
+ this.togglePanel.emit(this._sidePanelCollapsed);
172
160
  }
173
161
  /**
174
162
  * When feature is selected from list store that and show feature details
@@ -185,7 +173,8 @@ const CrowdsourceReporter = class {
185
173
  * @protected
186
174
  */
187
175
  getFeatureListFlowItem(layerId, layerName) {
188
- return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: layerName, onCalciteFlowItemBack: this.backFromFeatureList.bind(this) }, index.h("calcite-action", { icon: "sort-ascending-arrow", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.sort, "text-enabled": this.isMobile }), index.h("calcite-action", { icon: "filter", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.filter, "text-enabled": this.isMobile }), this.isMobile && this.getActionToExpandCollapsePanel(), this.enableNewReports && index.h("calcite-button", { appearance: "secondary", slot: "footer", width: "full" }, this.reportButtonText), index.h("calcite-panel", { "full-height": true }, index.h("feature-list", { class: "height-full", highlightOnMap: true, mapView: this.mapView, noFeaturesFoundMsg: this._translations.featureErrorMsg, onFeatureSelect: this.onFeatureSelectFromList.bind(this), pageSize: 100, selectedLayerId: layerId }))));
176
+ return (index.h("calcite-flow-item", { collapsed: this.isMobile && this._sidePanelCollapsed, heading: layerName, onCalciteFlowItemBack: this.backFromFeatureList.bind(this) }, index.h("calcite-action", { icon: "sort-ascending-arrow", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.sort, "text-enabled": this.isMobile }), index.h("calcite-action", { icon: "filter", slot: this.isMobile ? "header-menu-actions" : "header-actions-end", text: this._translations.filter, "text-enabled": this.isMobile }), this.isMobile && this.getActionToExpandCollapsePanel(), this.enableNewReports &&
177
+ index.h("calcite-button", { appearance: "secondary", slot: "footer", width: "full" }, this.reportButtonText), index.h("calcite-panel", { "full-height": true }, index.h("feature-list", { class: "height-full", highlightOnMap: true, mapView: this.mapView, noFeaturesFoundMsg: this._translations.featureErrorMsg, onFeatureSelect: this.onFeatureSelectFromList.bind(this), pageSize: 30, selectedLayerId: layerId }))));
189
178
  }
190
179
  /**
191
180
  * Returns the calcite-flow item for feature details