@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
@@ -26,8 +26,17 @@ const FloorFilter = /*@__PURE__*/ proxyCustomElement(class FloorFilter extends H
26
26
  //
27
27
  //--------------------------------------------------------------------------
28
28
  async mapViewWatchHandler() {
29
- await this.mapView.when(() => {
30
- this._initFloorFilter(this.mapView);
29
+ const webMap = this.mapView.map;
30
+ await webMap.when(() => {
31
+ if (this.floorFilterWidget) {
32
+ this.floorFilterWidget.destroy();
33
+ this.floorFilterWidget = undefined;
34
+ }
35
+ if (this._floorFilterElement) {
36
+ this._floorFilterElement.remove();
37
+ this._floorFilterElement = document.createElement("div");
38
+ }
39
+ this._initFloorFilter(this.mapView, webMap);
31
40
  });
32
41
  }
33
42
  //--------------------------------------------------------------------------
@@ -67,30 +76,25 @@ const FloorFilter = /*@__PURE__*/ proxyCustomElement(class FloorFilter extends H
67
76
  /**
68
77
  * Initialize the floor filter or reset the current view if it already exists
69
78
  */
70
- _initFloorFilter(view) {
71
- var _a, _b, _c, _d;
72
- if (view && this.enabled && this.FloorFilter && ((_a = view === null || view === void 0 ? void 0 : view.map) === null || _a === void 0 ? void 0 : _a.floorInfo)) {
73
- if (!this.floorFilterWidget) {
74
- this.floorFilterWidget = new this.FloorFilter({
75
- container: this._floorFilterElement,
76
- view
77
- });
78
- (_b = this._facilityHandle) === null || _b === void 0 ? void 0 : _b.remove();
79
- this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
80
- this.facilityChanged.emit(facility);
81
- });
82
- (_c = this._levelHandle) === null || _c === void 0 ? void 0 : _c.remove();
83
- this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
84
- this.levelChanged.emit(level);
85
- });
86
- (_d = this._siteHandle) === null || _d === void 0 ? void 0 : _d.remove();
87
- this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
88
- this.siteChanged.emit(site);
89
- });
90
- }
91
- else {
92
- this.floorFilterWidget.viewModel.view = view;
93
- }
79
+ _initFloorFilter(view, webMap) {
80
+ var _a, _b, _c;
81
+ if (view && this.enabled && this.FloorFilter && (webMap === null || webMap === void 0 ? void 0 : webMap.floorInfo)) {
82
+ this.floorFilterWidget = new this.FloorFilter({
83
+ container: this._floorFilterElement,
84
+ view
85
+ });
86
+ (_a = this._facilityHandle) === null || _a === void 0 ? void 0 : _a.remove();
87
+ this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
88
+ this.facilityChanged.emit(facility);
89
+ });
90
+ (_b = this._levelHandle) === null || _b === void 0 ? void 0 : _b.remove();
91
+ this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
92
+ this.levelChanged.emit(level);
93
+ });
94
+ (_c = this._siteHandle) === null || _c === void 0 ? void 0 : _c.remove();
95
+ this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
96
+ this.siteChanged.emit(site);
97
+ });
94
98
  }
95
99
  }
96
100
  get el() { return this; }
@@ -93,7 +93,6 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
93
93
  this.onTableNodeCreate = (node) => {
94
94
  this._tableNode = node;
95
95
  };
96
- this.defaultFilter = undefined;
97
96
  this.defaultGlobalId = undefined;
98
97
  this.defaultLayerId = undefined;
99
98
  this.defaultOid = undefined;
@@ -129,6 +128,18 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
129
128
  // Watch handlers
130
129
  //
131
130
  //--------------------------------------------------------------------------
131
+ /**
132
+ * Handle url defaults when defaultOid is set
133
+ */
134
+ async defaultOidWatchHandler() {
135
+ await this._handleDefaults();
136
+ }
137
+ /**
138
+ * Handle url defaults when defaultGlobalId is set
139
+ */
140
+ async defaultGlobalIdWatchHandler() {
141
+ await this._handleDefaults();
142
+ }
132
143
  /**
133
144
  * Reset the toolInfos when export csv is enabled/disabled
134
145
  */
@@ -816,22 +827,6 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
816
827
  else {
817
828
  urlObj.searchParams.delete("oid");
818
829
  }
819
- if (this._filterActive) {
820
- const filter = JSON.parse(this._filterList.urlParams.get("filter"));
821
- const layerExpressions = this._filterList.layerExpressions.map(layerExp => {
822
- layerExp.expressions = layerExp.expressions.map(exp => {
823
- if (exp.id.toString() === filter.expressionId.toString()) {
824
- exp.active = true;
825
- }
826
- return exp;
827
- });
828
- return layerExp;
829
- });
830
- urlObj.searchParams.set("filter", JSON.stringify(layerExpressions));
831
- }
832
- else {
833
- urlObj.searchParams.delete("filter");
834
- }
835
830
  this._shareNode.shareUrl = urlObj.href;
836
831
  }
837
832
  /**
@@ -845,7 +840,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
845
840
  * @returns VNode The tooltip node
846
841
  */
847
842
  _getToolTip(placement, referenceElement, text) {
848
- return (h("calcite-tooltip", { placement: placement, "reference-element": referenceElement }, h("span", null, text)));
843
+ return document.getElementById(referenceElement) ? (h("calcite-tooltip", { placement: placement, "reference-element": referenceElement }, h("span", null, text))) : undefined;
849
844
  }
850
845
  /**
851
846
  * Get an id with a prefix to the user supplied value
@@ -1008,7 +1003,11 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
1008
1003
  _resetColumnTemplates() {
1009
1004
  var _a, _b;
1010
1005
  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);
1011
- if (this._table && columnTemplates) {
1006
+ const hasChange = columnTemplates === null || columnTemplates === void 0 ? void 0 : columnTemplates.some((ct, i) => {
1007
+ var _a;
1008
+ return JSON.stringify((_a = this._table) === null || _a === void 0 ? void 0 : _a.tableTemplate.columnTemplates[i]) !== JSON.stringify(ct);
1009
+ });
1010
+ if (this._table && columnTemplates && hasChange) {
1012
1011
  this._table.tableTemplate = new this.TableTemplate({
1013
1012
  columnTemplates
1014
1013
  });
@@ -1031,37 +1030,67 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
1031
1030
  this._table.view = this.mapView;
1032
1031
  this._table.layer = this._layer;
1033
1032
  }
1033
+ await this._initLayerRefresh();
1034
1034
  this._checkEditEnabled();
1035
1035
  this._table.editingEnabled = this._editEnabled && this.enableInlineEdit;
1036
1036
  await this.reactiveUtils.once(() => this._table.state === "loaded")
1037
1037
  .then(async () => {
1038
- var _a, _b, _c;
1039
1038
  this._table.highlightIds.removeAll();
1040
1039
  this._table.clearSelectionFilter();
1041
1040
  this._resetColumnTemplates();
1042
- if (!this._defaultOidHonored && ((_a = this.defaultOid) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.defaultOid[0] > -1) {
1043
- this._selectDefaultFeature(this.defaultOid);
1044
- this._defaultOidHonored = true;
1045
- }
1046
- if (!this._defaultGlobalIdHonored && ((_b = this.defaultGlobalId) === null || _b === void 0 ? void 0 : _b.length) > 0) {
1047
- const features = await queryFeaturesByGlobalID(this.defaultGlobalId, this._layer);
1048
- const oids = (features === null || features === void 0 ? void 0 : features.length) > 0 ? features.map(f => f.getObjectId()) : undefined;
1049
- if (oids) {
1050
- this._selectDefaultFeature(oids);
1051
- }
1052
- this._defaultGlobalIdHonored = true;
1053
- }
1054
- if (!this._defaultFilterHonored && ((_c = this.defaultFilter) === null || _c === void 0 ? void 0 : _c.length) > 0 && this._filterList) {
1055
- this._layerExpressions = this.defaultFilter;
1056
- this._filterActive = true;
1057
- this._defaultFilterHonored = true;
1058
- }
1059
1041
  this._showOnlySelected = false;
1042
+ await this._handleDefaults();
1060
1043
  await this._sortTable();
1061
1044
  this._initToolInfos();
1062
1045
  this._updateToolbar();
1063
1046
  });
1064
1047
  }
1048
+ /**
1049
+ * Update the current IDs when that layers data is modified
1050
+ */
1051
+ async _initLayerRefresh() {
1052
+ if (this._refreshHandle) {
1053
+ this._refreshHandle.remove();
1054
+ }
1055
+ this._refreshHandle = this._layer.on("refresh", (evt) => {
1056
+ if (evt.dataChanged) {
1057
+ this._skipOnChange = true;
1058
+ void this._updateAllIds();
1059
+ }
1060
+ });
1061
+ }
1062
+ /**
1063
+ * Reset _allIds when the layers data has changed and refresh the selection ids and table
1064
+ */
1065
+ async _updateAllIds() {
1066
+ this._allIds = await queryAllIds(this._layer);
1067
+ this.selectedIds = this.selectedIds.filter(id => this._allIds.indexOf(id) > -1);
1068
+ await this._refresh();
1069
+ }
1070
+ /**
1071
+ * Handle default OID or GlobalID from url parameters
1072
+ */
1073
+ async _handleDefaults() {
1074
+ var _a, _b;
1075
+ if (!this._defaultOidHonored && ((_a = this.defaultOid) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.defaultOid[0] > -1 && this._table) {
1076
+ await this._selectDefaultFeature(this.defaultOid);
1077
+ this._defaultOidHonored = true;
1078
+ this.defaultOid = undefined;
1079
+ this._showOnlySelected = false;
1080
+ this._toggleShowSelected();
1081
+ }
1082
+ if (!this._defaultGlobalIdHonored && ((_b = this.defaultGlobalId) === null || _b === void 0 ? void 0 : _b.length) > 0 && this._table) {
1083
+ const features = await queryFeaturesByGlobalID(this.defaultGlobalId, this._layer);
1084
+ const oids = (features === null || features === void 0 ? void 0 : features.length) > 0 ? features.map(f => f.getObjectId()) : undefined;
1085
+ if (oids) {
1086
+ await this._selectDefaultFeature(oids);
1087
+ }
1088
+ this._defaultGlobalIdHonored = true;
1089
+ this.defaultGlobalId = undefined;
1090
+ this._showOnlySelected = false;
1091
+ this._toggleShowSelected();
1092
+ }
1093
+ }
1065
1094
  /**
1066
1095
  * Store the column names and current hidden status to support show/hide of columns
1067
1096
  * @param fieldNames optional list of names from new config options
@@ -1090,13 +1119,12 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
1090
1119
  /**
1091
1120
  * Select the feature that was specified via url params
1092
1121
  */
1093
- _selectDefaultFeature(oids) {
1122
+ async _selectDefaultFeature(oids) {
1094
1123
  if (oids.length > 0) {
1095
1124
  this._table.highlightIds.addMany(oids);
1096
- void this._table.when(() => {
1097
- const i = this._table.viewModel.getObjectIdIndex(oids[0]);
1098
- this._table.viewModel.scrollToIndex(i);
1099
- });
1125
+ // This is messed up and only make this worse
1126
+ //const i = this._table.viewModel.getObjectIdIndex(oids[0]);
1127
+ //this._table.viewModel.scrollToIndex(i);
1100
1128
  }
1101
1129
  }
1102
1130
  /**
@@ -1472,6 +1500,8 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
1472
1500
  }
1473
1501
  get el() { return this; }
1474
1502
  static get watchers() { return {
1503
+ "defaultOid": ["defaultOidWatchHandler"],
1504
+ "defaultGlobalId": ["defaultGlobalIdWatchHandler"],
1475
1505
  "enableCSV": ["enableCSVWatchHandler"],
1476
1506
  "enableInlineEdit": ["enableInlineEditWatchHandler"],
1477
1507
  "enableShare": ["enableShareWatchHandler"],
@@ -1484,7 +1514,6 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
1484
1514
  }; }
1485
1515
  static get style() { return layerTableCss; }
1486
1516
  }, [0, "layer-table", {
1487
- "defaultFilter": [16],
1488
1517
  "defaultGlobalId": [16],
1489
1518
  "defaultLayerId": [1, "default-layer-id"],
1490
1519
  "defaultOid": [16],
@@ -1515,6 +1544,8 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
1515
1544
  "_toolInfos": [32],
1516
1545
  "_translations": [32]
1517
1546
  }, [[8, "selectionChanged", "selectionChanged"], [8, "editsComplete", "editsComplete"], [8, "facilityChanged", "facilityChanged"], [8, "levelChanged", "levelChanged"], [8, "siteChanged", "siteChanged"], [8, "noLayersFound", "noLayersFound"]], {
1547
+ "defaultOid": ["defaultOidWatchHandler"],
1548
+ "defaultGlobalId": ["defaultGlobalIdWatchHandler"],
1518
1549
  "enableCSV": ["enableCSVWatchHandler"],
1519
1550
  "enableInlineEdit": ["enableInlineEditWatchHandler"],
1520
1551
  "enableShare": ["enableShareWatchHandler"],
@@ -132,8 +132,17 @@ const FloorFilter = class {
132
132
  //
133
133
  //--------------------------------------------------------------------------
134
134
  async mapViewWatchHandler() {
135
- await this.mapView.when(() => {
136
- this._initFloorFilter(this.mapView);
135
+ const webMap = this.mapView.map;
136
+ await webMap.when(() => {
137
+ if (this.floorFilterWidget) {
138
+ this.floorFilterWidget.destroy();
139
+ this.floorFilterWidget = undefined;
140
+ }
141
+ if (this._floorFilterElement) {
142
+ this._floorFilterElement.remove();
143
+ this._floorFilterElement = document.createElement("div");
144
+ }
145
+ this._initFloorFilter(this.mapView, webMap);
137
146
  });
138
147
  }
139
148
  //--------------------------------------------------------------------------
@@ -173,30 +182,25 @@ const FloorFilter = class {
173
182
  /**
174
183
  * Initialize the floor filter or reset the current view if it already exists
175
184
  */
176
- _initFloorFilter(view) {
177
- var _a, _b, _c, _d;
178
- if (view && this.enabled && this.FloorFilter && ((_a = view === null || view === void 0 ? void 0 : view.map) === null || _a === void 0 ? void 0 : _a.floorInfo)) {
179
- if (!this.floorFilterWidget) {
180
- this.floorFilterWidget = new this.FloorFilter({
181
- container: this._floorFilterElement,
182
- view
183
- });
184
- (_b = this._facilityHandle) === null || _b === void 0 ? void 0 : _b.remove();
185
- this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
186
- this.facilityChanged.emit(facility);
187
- });
188
- (_c = this._levelHandle) === null || _c === void 0 ? void 0 : _c.remove();
189
- this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
190
- this.levelChanged.emit(level);
191
- });
192
- (_d = this._siteHandle) === null || _d === void 0 ? void 0 : _d.remove();
193
- this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
194
- this.siteChanged.emit(site);
195
- });
196
- }
197
- else {
198
- this.floorFilterWidget.viewModel.view = view;
199
- }
185
+ _initFloorFilter(view, webMap) {
186
+ var _a, _b, _c;
187
+ if (view && this.enabled && this.FloorFilter && (webMap === null || webMap === void 0 ? void 0 : webMap.floorInfo)) {
188
+ this.floorFilterWidget = new this.FloorFilter({
189
+ container: this._floorFilterElement,
190
+ view
191
+ });
192
+ (_a = this._facilityHandle) === null || _a === void 0 ? void 0 : _a.remove();
193
+ this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
194
+ this.facilityChanged.emit(facility);
195
+ });
196
+ (_b = this._levelHandle) === null || _b === void 0 ? void 0 : _b.remove();
197
+ this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
198
+ this.levelChanged.emit(level);
199
+ });
200
+ (_c = this._siteHandle) === null || _c === void 0 ? void 0 : _c.remove();
201
+ this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
202
+ this.siteChanged.emit(site);
203
+ });
200
204
  }
201
205
  }
202
206
  get el() { return getElement(this); }
@@ -145,7 +145,6 @@ const LayerTable = class {
145
145
  this.onTableNodeCreate = (node) => {
146
146
  this._tableNode = node;
147
147
  };
148
- this.defaultFilter = undefined;
149
148
  this.defaultGlobalId = undefined;
150
149
  this.defaultLayerId = undefined;
151
150
  this.defaultOid = undefined;
@@ -181,6 +180,18 @@ const LayerTable = class {
181
180
  // Watch handlers
182
181
  //
183
182
  //--------------------------------------------------------------------------
183
+ /**
184
+ * Handle url defaults when defaultOid is set
185
+ */
186
+ async defaultOidWatchHandler() {
187
+ await this._handleDefaults();
188
+ }
189
+ /**
190
+ * Handle url defaults when defaultGlobalId is set
191
+ */
192
+ async defaultGlobalIdWatchHandler() {
193
+ await this._handleDefaults();
194
+ }
184
195
  /**
185
196
  * Reset the toolInfos when export csv is enabled/disabled
186
197
  */
@@ -868,22 +879,6 @@ const LayerTable = class {
868
879
  else {
869
880
  urlObj.searchParams.delete("oid");
870
881
  }
871
- if (this._filterActive) {
872
- const filter = JSON.parse(this._filterList.urlParams.get("filter"));
873
- const layerExpressions = this._filterList.layerExpressions.map(layerExp => {
874
- layerExp.expressions = layerExp.expressions.map(exp => {
875
- if (exp.id.toString() === filter.expressionId.toString()) {
876
- exp.active = true;
877
- }
878
- return exp;
879
- });
880
- return layerExp;
881
- });
882
- urlObj.searchParams.set("filter", JSON.stringify(layerExpressions));
883
- }
884
- else {
885
- urlObj.searchParams.delete("filter");
886
- }
887
882
  this._shareNode.shareUrl = urlObj.href;
888
883
  }
889
884
  /**
@@ -897,7 +892,7 @@ const LayerTable = class {
897
892
  * @returns VNode The tooltip node
898
893
  */
899
894
  _getToolTip(placement, referenceElement, text) {
900
- return (h("calcite-tooltip", { placement: placement, "reference-element": referenceElement }, h("span", null, text)));
895
+ return document.getElementById(referenceElement) ? (h("calcite-tooltip", { placement: placement, "reference-element": referenceElement }, h("span", null, text))) : undefined;
901
896
  }
902
897
  /**
903
898
  * Get an id with a prefix to the user supplied value
@@ -1060,7 +1055,11 @@ const LayerTable = class {
1060
1055
  _resetColumnTemplates() {
1061
1056
  var _a, _b;
1062
1057
  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);
1063
- if (this._table && columnTemplates) {
1058
+ const hasChange = columnTemplates === null || columnTemplates === void 0 ? void 0 : columnTemplates.some((ct, i) => {
1059
+ var _a;
1060
+ return JSON.stringify((_a = this._table) === null || _a === void 0 ? void 0 : _a.tableTemplate.columnTemplates[i]) !== JSON.stringify(ct);
1061
+ });
1062
+ if (this._table && columnTemplates && hasChange) {
1064
1063
  this._table.tableTemplate = new this.TableTemplate({
1065
1064
  columnTemplates
1066
1065
  });
@@ -1083,37 +1082,67 @@ const LayerTable = class {
1083
1082
  this._table.view = this.mapView;
1084
1083
  this._table.layer = this._layer;
1085
1084
  }
1085
+ await this._initLayerRefresh();
1086
1086
  this._checkEditEnabled();
1087
1087
  this._table.editingEnabled = this._editEnabled && this.enableInlineEdit;
1088
1088
  await this.reactiveUtils.once(() => this._table.state === "loaded")
1089
1089
  .then(async () => {
1090
- var _a, _b, _c;
1091
1090
  this._table.highlightIds.removeAll();
1092
1091
  this._table.clearSelectionFilter();
1093
1092
  this._resetColumnTemplates();
1094
- if (!this._defaultOidHonored && ((_a = this.defaultOid) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.defaultOid[0] > -1) {
1095
- this._selectDefaultFeature(this.defaultOid);
1096
- this._defaultOidHonored = true;
1097
- }
1098
- if (!this._defaultGlobalIdHonored && ((_b = this.defaultGlobalId) === null || _b === void 0 ? void 0 : _b.length) > 0) {
1099
- const features = await queryFeaturesByGlobalID(this.defaultGlobalId, this._layer);
1100
- const oids = (features === null || features === void 0 ? void 0 : features.length) > 0 ? features.map(f => f.getObjectId()) : undefined;
1101
- if (oids) {
1102
- this._selectDefaultFeature(oids);
1103
- }
1104
- this._defaultGlobalIdHonored = true;
1105
- }
1106
- if (!this._defaultFilterHonored && ((_c = this.defaultFilter) === null || _c === void 0 ? void 0 : _c.length) > 0 && this._filterList) {
1107
- this._layerExpressions = this.defaultFilter;
1108
- this._filterActive = true;
1109
- this._defaultFilterHonored = true;
1110
- }
1111
1093
  this._showOnlySelected = false;
1094
+ await this._handleDefaults();
1112
1095
  await this._sortTable();
1113
1096
  this._initToolInfos();
1114
1097
  this._updateToolbar();
1115
1098
  });
1116
1099
  }
1100
+ /**
1101
+ * Update the current IDs when that layers data is modified
1102
+ */
1103
+ async _initLayerRefresh() {
1104
+ if (this._refreshHandle) {
1105
+ this._refreshHandle.remove();
1106
+ }
1107
+ this._refreshHandle = this._layer.on("refresh", (evt) => {
1108
+ if (evt.dataChanged) {
1109
+ this._skipOnChange = true;
1110
+ void this._updateAllIds();
1111
+ }
1112
+ });
1113
+ }
1114
+ /**
1115
+ * Reset _allIds when the layers data has changed and refresh the selection ids and table
1116
+ */
1117
+ async _updateAllIds() {
1118
+ this._allIds = await queryAllIds(this._layer);
1119
+ this.selectedIds = this.selectedIds.filter(id => this._allIds.indexOf(id) > -1);
1120
+ await this._refresh();
1121
+ }
1122
+ /**
1123
+ * Handle default OID or GlobalID from url parameters
1124
+ */
1125
+ async _handleDefaults() {
1126
+ var _a, _b;
1127
+ if (!this._defaultOidHonored && ((_a = this.defaultOid) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.defaultOid[0] > -1 && this._table) {
1128
+ await this._selectDefaultFeature(this.defaultOid);
1129
+ this._defaultOidHonored = true;
1130
+ this.defaultOid = undefined;
1131
+ this._showOnlySelected = false;
1132
+ this._toggleShowSelected();
1133
+ }
1134
+ if (!this._defaultGlobalIdHonored && ((_b = this.defaultGlobalId) === null || _b === void 0 ? void 0 : _b.length) > 0 && this._table) {
1135
+ const features = await queryFeaturesByGlobalID(this.defaultGlobalId, this._layer);
1136
+ const oids = (features === null || features === void 0 ? void 0 : features.length) > 0 ? features.map(f => f.getObjectId()) : undefined;
1137
+ if (oids) {
1138
+ await this._selectDefaultFeature(oids);
1139
+ }
1140
+ this._defaultGlobalIdHonored = true;
1141
+ this.defaultGlobalId = undefined;
1142
+ this._showOnlySelected = false;
1143
+ this._toggleShowSelected();
1144
+ }
1145
+ }
1117
1146
  /**
1118
1147
  * Store the column names and current hidden status to support show/hide of columns
1119
1148
  * @param fieldNames optional list of names from new config options
@@ -1142,13 +1171,12 @@ const LayerTable = class {
1142
1171
  /**
1143
1172
  * Select the feature that was specified via url params
1144
1173
  */
1145
- _selectDefaultFeature(oids) {
1174
+ async _selectDefaultFeature(oids) {
1146
1175
  if (oids.length > 0) {
1147
1176
  this._table.highlightIds.addMany(oids);
1148
- void this._table.when(() => {
1149
- const i = this._table.viewModel.getObjectIdIndex(oids[0]);
1150
- this._table.viewModel.scrollToIndex(i);
1151
- });
1177
+ // This is messed up and only make this worse
1178
+ //const i = this._table.viewModel.getObjectIdIndex(oids[0]);
1179
+ //this._table.viewModel.scrollToIndex(i);
1152
1180
  }
1153
1181
  }
1154
1182
  /**
@@ -1524,6 +1552,8 @@ const LayerTable = class {
1524
1552
  }
1525
1553
  get el() { return getElement(this); }
1526
1554
  static get watchers() { return {
1555
+ "defaultOid": ["defaultOidWatchHandler"],
1556
+ "defaultGlobalId": ["defaultGlobalIdWatchHandler"],
1527
1557
  "enableCSV": ["enableCSVWatchHandler"],
1528
1558
  "enableInlineEdit": ["enableInlineEditWatchHandler"],
1529
1559
  "enableShare": ["enableShareWatchHandler"],
@@ -15,13 +15,27 @@ const crowdsourceManagerCss = ":host{display:block;--calcite-label-margin-bottom
15
15
  const CrowdsourceManager = class {
16
16
  constructor(hostRef) {
17
17
  registerInstance(this, hostRef);
18
+ //--------------------------------------------------------------------------
19
+ //
20
+ // Properties (protected)
21
+ //
22
+ //--------------------------------------------------------------------------
23
+ /**
24
+ * boolean: When true the map view will be set after render due to popup obstructing the view
25
+ * MapView.when is not fired when mapView is not currently visible
26
+ */
27
+ this._defaultCenterHonored = false;
28
+ /**
29
+ * boolean: When true the map view will be set after render due to popup obstructing the view
30
+ * MapView.when is not fired when mapView is not currently visible
31
+ */
32
+ this._defaultLevelHonored = false;
18
33
  /**
19
34
  * boolean: When true the map view will be set after render due to popup obstructing the view
20
35
  * MapView.when is not fired when mapView is not currently visible
21
36
  */
22
37
  this._shouldSetMapView = false;
23
38
  this.defaultCenter = "";
24
- this.defaultFilter = "";
25
39
  this.defaultGlobalId = "";
26
40
  this.defaultLayer = "";
27
41
  this.defaultLevel = "";
@@ -66,39 +80,6 @@ const CrowdsourceManager = class {
66
80
  // Watch handlers
67
81
  //
68
82
  //--------------------------------------------------------------------------
69
- /**
70
- * Watch for center url param to be set
71
- */
72
- defaultCenterWatchHandler() {
73
- this._defaultCenter = !this.defaultCenter ? undefined :
74
- this.defaultCenter.split(";").map(v => parseFloat(v));
75
- }
76
- /**
77
- * Watch for filter url param to be set
78
- */
79
- defaultFilterWatchHandler() {
80
- this._defaultFilter = JSON.parse(this.defaultFilter);
81
- }
82
- /**
83
- * Watch for globalid url param to be set
84
- */
85
- defaultGlobalIdWatchHandler() {
86
- this._defaultGlobalId = !this.defaultGlobalId ? undefined :
87
- this.defaultGlobalId.indexOf(",") > -1 ? this.defaultGlobalId.split(",") : [this.defaultGlobalId];
88
- }
89
- /**
90
- * Watch for oid url param to be set
91
- */
92
- defaultOidWatchHandler() {
93
- this._defaultOid = !this.defaultOid ? undefined :
94
- this.defaultOid.indexOf(",") > -1 ? this.defaultOid.split(",").map(o => parseInt(o, 10)) : [parseInt(this.defaultOid, 10)];
95
- }
96
- /**
97
- * Watch for zoom level param to be set
98
- */
99
- defaultLevelWatchHandler() {
100
- this._defaultLevel = !this.defaultLevel ? undefined : parseInt(this.defaultLevel, 10);
101
- }
102
83
  /**
103
84
  * When true the map zoom tools will be available
104
85
  */
@@ -390,6 +371,7 @@ const CrowdsourceManager = class {
390
371
  * @protected
391
372
  */
392
373
  _getTable(layoutMode, panelOpen, hideTable) {
374
+ var _a, _b;
393
375
  const tableClass = hideTable && this._isMobile ? "visibility-hidden" : "";
394
376
  const tableSizeClass = this._getTableSizeClass(layoutMode, panelOpen);
395
377
  const icon = this._getDividerIcon(layoutMode, panelOpen);
@@ -398,7 +380,11 @@ const CrowdsourceManager = class {
398
380
  const toggleLayout = layoutMode === ELayoutMode.HORIZONTAL ? "horizontal" : "vertical";
399
381
  const toggleSlot = layoutMode === ELayoutMode.HORIZONTAL ? "header" : "panel-start";
400
382
  const hasMapAndLayer = this.defaultWebmap && this.defaultLayer;
401
- return (h("calcite-shell", { class: `${tableSizeClass} ${tableClass} border-bottom` }, !this._isMobile ? (h("calcite-action-bar", { class: "border-sides", expandDisabled: true, layout: toggleLayout, slot: toggleSlot }, h("calcite-action", { class: "toggle-node", icon: icon, id: id, onClick: () => this._toggleLayout(), text: "" }), h("calcite-tooltip", { label: tooltip, placement: "bottom", "reference-element": id }, h("span", null, tooltip)))) : undefined, h("div", { class: `width-full height-full position-relative` }, 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 }))));
383
+ const globalId = !this.defaultGlobalId ? undefined :
384
+ ((_a = this.defaultGlobalId) === null || _a === void 0 ? void 0 : _a.indexOf(",")) > -1 ? this.defaultGlobalId.split(",") : [this.defaultGlobalId];
385
+ const defaultOid = !this.defaultOid ? undefined :
386
+ ((_b = this.defaultOid) === null || _b === void 0 ? void 0 : _b.indexOf(",")) > -1 ? this.defaultOid.split(",").map(o => parseInt(o, 10)) : [parseInt(this.defaultOid, 10)];
387
+ return (h("calcite-shell", { class: `${tableSizeClass} ${tableClass} border-bottom` }, !this._isMobile ? (h("calcite-action-bar", { class: "border-sides", expandDisabled: true, layout: toggleLayout, slot: toggleSlot }, h("calcite-action", { class: "toggle-node", icon: icon, id: id, onClick: () => this._toggleLayout(), text: "" }), h("calcite-tooltip", { label: tooltip, placement: "bottom", "reference-element": id }, h("span", null, tooltip)))) : undefined, h("div", { class: `width-full height-full position-relative` }, 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 }))));
402
388
  }
403
389
  /**
404
390
  * Update the component layout when its size changes
@@ -451,17 +437,22 @@ const CrowdsourceManager = class {
451
437
  * @protected
452
438
  */
453
439
  async _setMapView() {
440
+ var _a;
454
441
  this._mapInfo = this._getMapInfo(this._mapChange.id);
455
442
  this._mapView = this._mapChange.mapView;
456
443
  this._initMapZoom();
457
444
  this._mapView.popupEnabled = false;
458
- if (this._defaultCenter && this._defaultLevel) {
445
+ const center = !this.defaultCenter || this._defaultCenterHonored ?
446
+ undefined : (_a = this.defaultCenter) === null || _a === void 0 ? void 0 : _a.split(";").map(v => parseFloat(v));
447
+ const zoom = !this.defaultLevel || this._defaultLevelHonored ?
448
+ undefined : parseInt(this.defaultLevel, 10);
449
+ if (center && zoom) {
459
450
  await this._mapView.goTo({
460
- center: this._defaultCenter,
461
- zoom: this._defaultLevel
451
+ center,
452
+ zoom
462
453
  });
463
- this._defaultCenter = undefined;
464
- this._defaultLevel = undefined;
454
+ this._defaultCenterHonored = true;
455
+ this._defaultLevelHonored = true;
465
456
  }
466
457
  }
467
458
  /**
@@ -493,11 +484,6 @@ const CrowdsourceManager = class {
493
484
  }
494
485
  get el() { return getElement(this); }
495
486
  static get watchers() { return {
496
- "defaultCenter": ["defaultCenterWatchHandler"],
497
- "defaultFilter": ["defaultFilterWatchHandler"],
498
- "defaultGlobalId": ["defaultGlobalIdWatchHandler"],
499
- "defaultOid": ["defaultOidWatchHandler"],
500
- "defaultLevel": ["defaultLevelWatchHandler"],
501
487
  "enableZoom": ["enableZoomWatchHandler"]
502
488
  }; }
503
489
  };