@esri/solutions-components 0.7.49 → 0.7.51

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.
Files changed (28) hide show
  1. package/dist/cjs/basemap-gallery_7.cjs.entry.js +30 -26
  2. package/dist/cjs/card-manager_3.cjs.entry.js +72 -42
  3. package/dist/cjs/crowdsource-manager.cjs.entry.js +31 -45
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/solutions-components.cjs.js +1 -1
  6. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +31 -73
  7. package/dist/collection/components/floor-filter/floor-filter.js +30 -26
  8. package/dist/collection/components/layer-table/layer-table.js +76 -63
  9. package/dist/components/crowdsource-manager.js +31 -51
  10. package/dist/components/floor-filter2.js +30 -26
  11. package/dist/components/layer-table2.js +74 -43
  12. package/dist/esm/basemap-gallery_7.entry.js +30 -26
  13. package/dist/esm/card-manager_3.entry.js +72 -42
  14. package/dist/esm/crowdsource-manager.entry.js +31 -45
  15. package/dist/esm/loader.js +1 -1
  16. package/dist/esm/solutions-components.js +1 -1
  17. package/dist/solutions-components/p-697e9e11.entry.js +6 -0
  18. package/dist/solutions-components/p-7cfc4ba5.entry.js +6 -0
  19. package/dist/solutions-components/p-b4d2feb0.entry.js +6 -0
  20. package/dist/solutions-components/solutions-components.esm.js +1 -1
  21. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +6 -41
  22. package/dist/types/components/floor-filter/floor-filter.d.ts +1 -1
  23. package/dist/types/components/layer-table/layer-table.d.ts +25 -5
  24. package/dist/types/components.d.ts +0 -18
  25. package/package.json +1 -1
  26. package/dist/solutions-components/p-6a83b842.entry.js +0 -6
  27. package/dist/solutions-components/p-6d9f6b6a.entry.js +0 -6
  28. package/dist/solutions-components/p-766c0b57.entry.js +0 -6
@@ -136,8 +136,17 @@ const FloorFilter = class {
136
136
  //
137
137
  //--------------------------------------------------------------------------
138
138
  async mapViewWatchHandler() {
139
- await this.mapView.when(() => {
140
- this._initFloorFilter(this.mapView);
139
+ const webMap = this.mapView.map;
140
+ await webMap.when(() => {
141
+ if (this.floorFilterWidget) {
142
+ this.floorFilterWidget.destroy();
143
+ this.floorFilterWidget = undefined;
144
+ }
145
+ if (this._floorFilterElement) {
146
+ this._floorFilterElement.remove();
147
+ this._floorFilterElement = document.createElement("div");
148
+ }
149
+ this._initFloorFilter(this.mapView, webMap);
141
150
  });
142
151
  }
143
152
  //--------------------------------------------------------------------------
@@ -177,30 +186,25 @@ const FloorFilter = class {
177
186
  /**
178
187
  * Initialize the floor filter or reset the current view if it already exists
179
188
  */
180
- _initFloorFilter(view) {
181
- var _a, _b, _c, _d;
182
- if (view && this.enabled && this.FloorFilter && ((_a = view === null || view === void 0 ? void 0 : view.map) === null || _a === void 0 ? void 0 : _a.floorInfo)) {
183
- if (!this.floorFilterWidget) {
184
- this.floorFilterWidget = new this.FloorFilter({
185
- container: this._floorFilterElement,
186
- view
187
- });
188
- (_b = this._facilityHandle) === null || _b === void 0 ? void 0 : _b.remove();
189
- this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
190
- this.facilityChanged.emit(facility);
191
- });
192
- (_c = this._levelHandle) === null || _c === void 0 ? void 0 : _c.remove();
193
- this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
194
- this.levelChanged.emit(level);
195
- });
196
- (_d = this._siteHandle) === null || _d === void 0 ? void 0 : _d.remove();
197
- this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
198
- this.siteChanged.emit(site);
199
- });
200
- }
201
- else {
202
- this.floorFilterWidget.viewModel.view = view;
203
- }
189
+ _initFloorFilter(view, webMap) {
190
+ var _a, _b, _c;
191
+ if (view && this.enabled && this.FloorFilter && (webMap === null || webMap === void 0 ? void 0 : webMap.floorInfo)) {
192
+ this.floorFilterWidget = new this.FloorFilter({
193
+ container: this._floorFilterElement,
194
+ view
195
+ });
196
+ (_a = this._facilityHandle) === null || _a === void 0 ? void 0 : _a.remove();
197
+ this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
198
+ this.facilityChanged.emit(facility);
199
+ });
200
+ (_b = this._levelHandle) === null || _b === void 0 ? void 0 : _b.remove();
201
+ this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
202
+ this.levelChanged.emit(level);
203
+ });
204
+ (_c = this._siteHandle) === null || _c === void 0 ? void 0 : _c.remove();
205
+ this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
206
+ this.siteChanged.emit(site);
207
+ });
204
208
  }
205
209
  }
206
210
  get el() { return index.getElement(this); }
@@ -149,7 +149,6 @@ const LayerTable = class {
149
149
  this.onTableNodeCreate = (node) => {
150
150
  this._tableNode = node;
151
151
  };
152
- this.defaultFilter = undefined;
153
152
  this.defaultGlobalId = undefined;
154
153
  this.defaultLayerId = undefined;
155
154
  this.defaultOid = undefined;
@@ -185,6 +184,18 @@ const LayerTable = class {
185
184
  // Watch handlers
186
185
  //
187
186
  //--------------------------------------------------------------------------
187
+ /**
188
+ * Handle url defaults when defaultOid is set
189
+ */
190
+ async defaultOidWatchHandler() {
191
+ await this._handleDefaults();
192
+ }
193
+ /**
194
+ * Handle url defaults when defaultGlobalId is set
195
+ */
196
+ async defaultGlobalIdWatchHandler() {
197
+ await this._handleDefaults();
198
+ }
188
199
  /**
189
200
  * Reset the toolInfos when export csv is enabled/disabled
190
201
  */
@@ -872,22 +883,6 @@ const LayerTable = class {
872
883
  else {
873
884
  urlObj.searchParams.delete("oid");
874
885
  }
875
- if (this._filterActive) {
876
- const filter = JSON.parse(this._filterList.urlParams.get("filter"));
877
- const layerExpressions = this._filterList.layerExpressions.map(layerExp => {
878
- layerExp.expressions = layerExp.expressions.map(exp => {
879
- if (exp.id.toString() === filter.expressionId.toString()) {
880
- exp.active = true;
881
- }
882
- return exp;
883
- });
884
- return layerExp;
885
- });
886
- urlObj.searchParams.set("filter", JSON.stringify(layerExpressions));
887
- }
888
- else {
889
- urlObj.searchParams.delete("filter");
890
- }
891
886
  this._shareNode.shareUrl = urlObj.href;
892
887
  }
893
888
  /**
@@ -901,7 +896,7 @@ const LayerTable = class {
901
896
  * @returns VNode The tooltip node
902
897
  */
903
898
  _getToolTip(placement, referenceElement, text) {
904
- return (index.h("calcite-tooltip", { placement: placement, "reference-element": referenceElement }, index.h("span", null, text)));
899
+ return document.getElementById(referenceElement) ? (index.h("calcite-tooltip", { placement: placement, "reference-element": referenceElement }, index.h("span", null, text))) : undefined;
905
900
  }
906
901
  /**
907
902
  * Get an id with a prefix to the user supplied value
@@ -1064,7 +1059,11 @@ const LayerTable = class {
1064
1059
  _resetColumnTemplates() {
1065
1060
  var _a, _b;
1066
1061
  const columnTemplates = this._getColumnTemplates((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id, (_b = this._layer) === null || _b === void 0 ? void 0 : _b.fields);
1067
- if (this._table && columnTemplates) {
1062
+ const hasChange = columnTemplates === null || columnTemplates === void 0 ? void 0 : columnTemplates.some((ct, i) => {
1063
+ var _a;
1064
+ return JSON.stringify((_a = this._table) === null || _a === void 0 ? void 0 : _a.tableTemplate.columnTemplates[i]) !== JSON.stringify(ct);
1065
+ });
1066
+ if (this._table && columnTemplates && hasChange) {
1068
1067
  this._table.tableTemplate = new this.TableTemplate({
1069
1068
  columnTemplates
1070
1069
  });
@@ -1087,37 +1086,67 @@ const LayerTable = class {
1087
1086
  this._table.view = this.mapView;
1088
1087
  this._table.layer = this._layer;
1089
1088
  }
1089
+ await this._initLayerRefresh();
1090
1090
  this._checkEditEnabled();
1091
1091
  this._table.editingEnabled = this._editEnabled && this.enableInlineEdit;
1092
1092
  await this.reactiveUtils.once(() => this._table.state === "loaded")
1093
1093
  .then(async () => {
1094
- var _a, _b, _c;
1095
1094
  this._table.highlightIds.removeAll();
1096
1095
  this._table.clearSelectionFilter();
1097
1096
  this._resetColumnTemplates();
1098
- if (!this._defaultOidHonored && ((_a = this.defaultOid) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.defaultOid[0] > -1) {
1099
- this._selectDefaultFeature(this.defaultOid);
1100
- this._defaultOidHonored = true;
1101
- }
1102
- if (!this._defaultGlobalIdHonored && ((_b = this.defaultGlobalId) === null || _b === void 0 ? void 0 : _b.length) > 0) {
1103
- const features = await mapViewUtils.queryFeaturesByGlobalID(this.defaultGlobalId, this._layer);
1104
- const oids = (features === null || features === void 0 ? void 0 : features.length) > 0 ? features.map(f => f.getObjectId()) : undefined;
1105
- if (oids) {
1106
- this._selectDefaultFeature(oids);
1107
- }
1108
- this._defaultGlobalIdHonored = true;
1109
- }
1110
- if (!this._defaultFilterHonored && ((_c = this.defaultFilter) === null || _c === void 0 ? void 0 : _c.length) > 0 && this._filterList) {
1111
- this._layerExpressions = this.defaultFilter;
1112
- this._filterActive = true;
1113
- this._defaultFilterHonored = true;
1114
- }
1115
1097
  this._showOnlySelected = false;
1098
+ await this._handleDefaults();
1116
1099
  await this._sortTable();
1117
1100
  this._initToolInfos();
1118
1101
  this._updateToolbar();
1119
1102
  });
1120
1103
  }
1104
+ /**
1105
+ * Update the current IDs when that layers data is modified
1106
+ */
1107
+ async _initLayerRefresh() {
1108
+ if (this._refreshHandle) {
1109
+ this._refreshHandle.remove();
1110
+ }
1111
+ this._refreshHandle = this._layer.on("refresh", (evt) => {
1112
+ if (evt.dataChanged) {
1113
+ this._skipOnChange = true;
1114
+ void this._updateAllIds();
1115
+ }
1116
+ });
1117
+ }
1118
+ /**
1119
+ * Reset _allIds when the layers data has changed and refresh the selection ids and table
1120
+ */
1121
+ async _updateAllIds() {
1122
+ this._allIds = await mapViewUtils.queryAllIds(this._layer);
1123
+ this.selectedIds = this.selectedIds.filter(id => this._allIds.indexOf(id) > -1);
1124
+ await this._refresh();
1125
+ }
1126
+ /**
1127
+ * Handle default OID or GlobalID from url parameters
1128
+ */
1129
+ async _handleDefaults() {
1130
+ var _a, _b;
1131
+ if (!this._defaultOidHonored && ((_a = this.defaultOid) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.defaultOid[0] > -1 && this._table) {
1132
+ await this._selectDefaultFeature(this.defaultOid);
1133
+ this._defaultOidHonored = true;
1134
+ this.defaultOid = undefined;
1135
+ this._showOnlySelected = false;
1136
+ this._toggleShowSelected();
1137
+ }
1138
+ if (!this._defaultGlobalIdHonored && ((_b = this.defaultGlobalId) === null || _b === void 0 ? void 0 : _b.length) > 0 && this._table) {
1139
+ const features = await mapViewUtils.queryFeaturesByGlobalID(this.defaultGlobalId, this._layer);
1140
+ const oids = (features === null || features === void 0 ? void 0 : features.length) > 0 ? features.map(f => f.getObjectId()) : undefined;
1141
+ if (oids) {
1142
+ await this._selectDefaultFeature(oids);
1143
+ }
1144
+ this._defaultGlobalIdHonored = true;
1145
+ this.defaultGlobalId = undefined;
1146
+ this._showOnlySelected = false;
1147
+ this._toggleShowSelected();
1148
+ }
1149
+ }
1121
1150
  /**
1122
1151
  * Store the column names and current hidden status to support show/hide of columns
1123
1152
  * @param fieldNames optional list of names from new config options
@@ -1146,13 +1175,12 @@ const LayerTable = class {
1146
1175
  /**
1147
1176
  * Select the feature that was specified via url params
1148
1177
  */
1149
- _selectDefaultFeature(oids) {
1178
+ async _selectDefaultFeature(oids) {
1150
1179
  if (oids.length > 0) {
1151
1180
  this._table.highlightIds.addMany(oids);
1152
- void this._table.when(() => {
1153
- const i = this._table.viewModel.getObjectIdIndex(oids[0]);
1154
- this._table.viewModel.scrollToIndex(i);
1155
- });
1181
+ // This is messed up and only make this worse
1182
+ //const i = this._table.viewModel.getObjectIdIndex(oids[0]);
1183
+ //this._table.viewModel.scrollToIndex(i);
1156
1184
  }
1157
1185
  }
1158
1186
  /**
@@ -1528,6 +1556,8 @@ const LayerTable = class {
1528
1556
  }
1529
1557
  get el() { return index.getElement(this); }
1530
1558
  static get watchers() { return {
1559
+ "defaultOid": ["defaultOidWatchHandler"],
1560
+ "defaultGlobalId": ["defaultGlobalIdWatchHandler"],
1531
1561
  "enableCSV": ["enableCSVWatchHandler"],
1532
1562
  "enableInlineEdit": ["enableInlineEditWatchHandler"],
1533
1563
  "enableShare": ["enableShareWatchHandler"],
@@ -19,13 +19,27 @@ const crowdsourceManagerCss = ":host{display:block;--calcite-label-margin-bottom
19
19
  const CrowdsourceManager = class {
20
20
  constructor(hostRef) {
21
21
  index.registerInstance(this, hostRef);
22
+ //--------------------------------------------------------------------------
23
+ //
24
+ // Properties (protected)
25
+ //
26
+ //--------------------------------------------------------------------------
27
+ /**
28
+ * boolean: When true the map view will be set after render due to popup obstructing the view
29
+ * MapView.when is not fired when mapView is not currently visible
30
+ */
31
+ this._defaultCenterHonored = false;
32
+ /**
33
+ * boolean: When true the map view will be set after render due to popup obstructing the view
34
+ * MapView.when is not fired when mapView is not currently visible
35
+ */
36
+ this._defaultLevelHonored = false;
22
37
  /**
23
38
  * boolean: When true the map view will be set after render due to popup obstructing the view
24
39
  * MapView.when is not fired when mapView is not currently visible
25
40
  */
26
41
  this._shouldSetMapView = false;
27
42
  this.defaultCenter = "";
28
- this.defaultFilter = "";
29
43
  this.defaultGlobalId = "";
30
44
  this.defaultLayer = "";
31
45
  this.defaultLevel = "";
@@ -70,39 +84,6 @@ const CrowdsourceManager = class {
70
84
  // Watch handlers
71
85
  //
72
86
  //--------------------------------------------------------------------------
73
- /**
74
- * Watch for center url param to be set
75
- */
76
- defaultCenterWatchHandler() {
77
- this._defaultCenter = !this.defaultCenter ? undefined :
78
- this.defaultCenter.split(";").map(v => parseFloat(v));
79
- }
80
- /**
81
- * Watch for filter url param to be set
82
- */
83
- defaultFilterWatchHandler() {
84
- this._defaultFilter = JSON.parse(this.defaultFilter);
85
- }
86
- /**
87
- * Watch for globalid url param to be set
88
- */
89
- defaultGlobalIdWatchHandler() {
90
- this._defaultGlobalId = !this.defaultGlobalId ? undefined :
91
- this.defaultGlobalId.indexOf(",") > -1 ? this.defaultGlobalId.split(",") : [this.defaultGlobalId];
92
- }
93
- /**
94
- * Watch for oid url param to be set
95
- */
96
- defaultOidWatchHandler() {
97
- this._defaultOid = !this.defaultOid ? undefined :
98
- this.defaultOid.indexOf(",") > -1 ? this.defaultOid.split(",").map(o => parseInt(o, 10)) : [parseInt(this.defaultOid, 10)];
99
- }
100
- /**
101
- * Watch for zoom level param to be set
102
- */
103
- defaultLevelWatchHandler() {
104
- this._defaultLevel = !this.defaultLevel ? undefined : parseInt(this.defaultLevel, 10);
105
- }
106
87
  /**
107
88
  * When true the map zoom tools will be available
108
89
  */
@@ -394,6 +375,7 @@ const CrowdsourceManager = class {
394
375
  * @protected
395
376
  */
396
377
  _getTable(layoutMode, panelOpen, hideTable) {
378
+ var _a, _b;
397
379
  const tableClass = hideTable && this._isMobile ? "visibility-hidden" : "";
398
380
  const tableSizeClass = this._getTableSizeClass(layoutMode, panelOpen);
399
381
  const icon = this._getDividerIcon(layoutMode, panelOpen);
@@ -402,7 +384,11 @@ const CrowdsourceManager = class {
402
384
  const toggleLayout = layoutMode === interfaces.ELayoutMode.HORIZONTAL ? "horizontal" : "vertical";
403
385
  const toggleSlot = layoutMode === interfaces.ELayoutMode.HORIZONTAL ? "header" : "panel-start";
404
386
  const hasMapAndLayer = this.defaultWebmap && this.defaultLayer;
405
- return (index.h("calcite-shell", { class: `${tableSizeClass} ${tableClass} border-bottom` }, !this._isMobile ? (index.h("calcite-action-bar", { class: "border-sides", expandDisabled: true, layout: toggleLayout, slot: toggleSlot }, index.h("calcite-action", { class: "toggle-node", icon: icon, id: id, onClick: () => this._toggleLayout(), text: "" }), index.h("calcite-tooltip", { label: tooltip, placement: "bottom", "reference-element": id }, index.h("span", null, tooltip)))) : undefined, index.h("div", { class: `width-full height-full position-relative` }, index.h("layer-table", { defaultFilter: hasMapAndLayer ? this._defaultFilter : undefined, defaultGlobalId: hasMapAndLayer ? this._defaultGlobalId : undefined, defaultLayerId: hasMapAndLayer ? this.defaultLayer : "", defaultOid: hasMapAndLayer && !this.defaultGlobalId ? this._defaultOid : undefined, enableAutoRefresh: this.enableAutoRefresh, enableCSV: this.enableCSV, enableColumnReorder: this.enableColumnReorder, enableInlineEdit: this.enableInlineEdit, enableShare: this.enableShare, isMobile: this._isMobile, mapInfo: this._mapInfo, mapView: this === null || this === void 0 ? void 0 : this._mapView, onlyShowUpdatableLayers: this.onlyShowUpdatableLayers, ref: (el) => this._layerTable = el, shareIncludeEmbed: this.shareIncludeEmbed, shareIncludeSocial: this.shareIncludeSocial, showNewestFirst: this.showNewestFirst, zoomAndScrollToSelected: this.zoomAndScrollToSelected }))));
387
+ const globalId = !this.defaultGlobalId ? undefined :
388
+ ((_a = this.defaultGlobalId) === null || _a === void 0 ? void 0 : _a.indexOf(",")) > -1 ? this.defaultGlobalId.split(",") : [this.defaultGlobalId];
389
+ const defaultOid = !this.defaultOid ? undefined :
390
+ ((_b = this.defaultOid) === null || _b === void 0 ? void 0 : _b.indexOf(",")) > -1 ? this.defaultOid.split(",").map(o => parseInt(o, 10)) : [parseInt(this.defaultOid, 10)];
391
+ return (index.h("calcite-shell", { class: `${tableSizeClass} ${tableClass} border-bottom` }, !this._isMobile ? (index.h("calcite-action-bar", { class: "border-sides", expandDisabled: true, layout: toggleLayout, slot: toggleSlot }, index.h("calcite-action", { class: "toggle-node", icon: icon, id: id, onClick: () => this._toggleLayout(), text: "" }), index.h("calcite-tooltip", { label: tooltip, placement: "bottom", "reference-element": id }, index.h("span", null, tooltip)))) : undefined, index.h("div", { class: `width-full height-full position-relative` }, index.h("layer-table", { defaultGlobalId: hasMapAndLayer ? globalId : undefined, defaultLayerId: hasMapAndLayer ? this.defaultLayer : "", defaultOid: hasMapAndLayer && !globalId ? defaultOid : undefined, enableAutoRefresh: this.enableAutoRefresh, enableCSV: this.enableCSV, enableColumnReorder: this.enableColumnReorder, enableInlineEdit: this.enableInlineEdit, enableShare: this.enableShare, isMobile: this._isMobile, mapInfo: this._mapInfo, mapView: this === null || this === void 0 ? void 0 : this._mapView, onlyShowUpdatableLayers: this.onlyShowUpdatableLayers, ref: (el) => this._layerTable = el, shareIncludeEmbed: this.shareIncludeEmbed, shareIncludeSocial: this.shareIncludeSocial, showNewestFirst: this.showNewestFirst, zoomAndScrollToSelected: this.zoomAndScrollToSelected }))));
406
392
  }
407
393
  /**
408
394
  * Update the component layout when its size changes
@@ -455,17 +441,22 @@ const CrowdsourceManager = class {
455
441
  * @protected
456
442
  */
457
443
  async _setMapView() {
444
+ var _a;
458
445
  this._mapInfo = this._getMapInfo(this._mapChange.id);
459
446
  this._mapView = this._mapChange.mapView;
460
447
  this._initMapZoom();
461
448
  this._mapView.popupEnabled = false;
462
- if (this._defaultCenter && this._defaultLevel) {
449
+ const center = !this.defaultCenter || this._defaultCenterHonored ?
450
+ undefined : (_a = this.defaultCenter) === null || _a === void 0 ? void 0 : _a.split(";").map(v => parseFloat(v));
451
+ const zoom = !this.defaultLevel || this._defaultLevelHonored ?
452
+ undefined : parseInt(this.defaultLevel, 10);
453
+ if (center && zoom) {
463
454
  await this._mapView.goTo({
464
- center: this._defaultCenter,
465
- zoom: this._defaultLevel
455
+ center,
456
+ zoom
466
457
  });
467
- this._defaultCenter = undefined;
468
- this._defaultLevel = undefined;
458
+ this._defaultCenterHonored = true;
459
+ this._defaultLevelHonored = true;
469
460
  }
470
461
  }
471
462
  /**
@@ -497,11 +488,6 @@ const CrowdsourceManager = class {
497
488
  }
498
489
  get el() { return index.getElement(this); }
499
490
  static get watchers() { return {
500
- "defaultCenter": ["defaultCenterWatchHandler"],
501
- "defaultFilter": ["defaultFilterWatchHandler"],
502
- "defaultGlobalId": ["defaultGlobalIdWatchHandler"],
503
- "defaultOid": ["defaultOidWatchHandler"],
504
- "defaultLevel": ["defaultLevelWatchHandler"],
505
491
  "enableZoom": ["enableZoomWatchHandler"]
506
492
  }; }
507
493
  };