@esri/solutions-components 0.7.8 → 0.7.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. package/dist/assets/t9n/layer-table/resources.json +1 -0
  2. package/dist/assets/t9n/layer-table/resources_en.json +1 -0
  3. package/dist/cjs/basemap-gallery_7.cjs.entry.js +1 -1
  4. package/dist/cjs/calcite-alert_3.cjs.entry.js +1 -1
  5. package/dist/cjs/calcite-combobox_6.cjs.entry.js +16 -7
  6. package/dist/cjs/card-manager_3.cjs.entry.js +176 -22
  7. package/dist/cjs/crowdsource-manager.cjs.entry.js +12 -1
  8. package/dist/cjs/{downloadUtils-95e4a5b2.js → downloadUtils-8f50633d.js} +2 -2
  9. package/dist/cjs/{index.es-a88403f8.js → index.es-140aa937.js} +2 -2
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
  12. package/dist/cjs/{mapViewUtils-b7d9e71c.js → mapViewUtils-569e9644.js} +17 -0
  13. package/dist/cjs/public-notification.cjs.entry.js +2 -2
  14. package/dist/cjs/solutions-components.cjs.js +1 -1
  15. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +20 -2
  16. package/dist/collection/components/layer-table/layer-table.js +175 -21
  17. package/dist/collection/components/map-layer-picker/map-layer-picker.css +1 -0
  18. package/dist/collection/components/map-layer-picker/map-layer-picker.js +69 -5
  19. package/dist/collection/components/map-picker/map-picker.js +1 -1
  20. package/dist/collection/demos/crowdsource-manager.html +2 -2
  21. package/dist/collection/utils/interfaces.ts +5 -0
  22. package/dist/collection/utils/queryUtils.js +16 -0
  23. package/dist/collection/utils/queryUtils.ts +21 -0
  24. package/dist/components/crowdsource-manager.js +15 -3
  25. package/dist/components/layer-table2.js +175 -21
  26. package/dist/components/map-layer-picker2.js +17 -6
  27. package/dist/components/map-picker2.js +1 -1
  28. package/dist/components/map-select-tools2.js +1 -1
  29. package/dist/components/queryUtils.js +17 -1
  30. package/dist/components/refine-selection2.js +1 -1
  31. package/dist/esm/basemap-gallery_7.entry.js +1 -1
  32. package/dist/esm/calcite-alert_3.entry.js +1 -1
  33. package/dist/esm/calcite-combobox_6.entry.js +16 -7
  34. package/dist/esm/card-manager_3.entry.js +176 -22
  35. package/dist/esm/crowdsource-manager.entry.js +12 -1
  36. package/dist/esm/{downloadUtils-83dd2143.js → downloadUtils-9dee8bc0.js} +2 -2
  37. package/dist/esm/{index.es-0c98e2f3.js → index.es-54e86c8e.js} +2 -2
  38. package/dist/esm/loader.js +1 -1
  39. package/dist/esm/map-select-tools_3.entry.js +2 -2
  40. package/dist/esm/{mapViewUtils-3ff1c264.js → mapViewUtils-066602d5.js} +17 -1
  41. package/dist/esm/public-notification.entry.js +2 -2
  42. package/dist/esm/solutions-components.js +1 -1
  43. package/dist/solutions-components/demos/crowdsource-manager.html +2 -2
  44. package/dist/solutions-components/{p-546a3d3c.entry.js → p-13bfc206.entry.js} +2 -2
  45. package/dist/solutions-components/{p-d6050d57.js → p-1bdd64a0.js} +2 -2
  46. package/dist/solutions-components/{p-b7e2c75b.js → p-531d91d6.js} +1 -1
  47. package/dist/solutions-components/{p-dcd6e7b9.entry.js → p-6656c53e.entry.js} +1 -1
  48. package/dist/solutions-components/{p-a5d924a9.entry.js → p-683cded6.entry.js} +1 -1
  49. package/dist/solutions-components/{p-95ebc2e5.entry.js → p-c2b20b85.entry.js} +1 -1
  50. package/dist/solutions-components/p-c7ff24df.entry.js +6 -0
  51. package/dist/solutions-components/{p-b030a151.js → p-dfdb8411.js} +1 -1
  52. package/dist/solutions-components/p-f7870ec1.entry.js +6 -0
  53. package/dist/solutions-components/p-ffae568b.entry.js +6 -0
  54. package/dist/solutions-components/solutions-components.esm.js +1 -1
  55. package/dist/solutions-components/utils/interfaces.ts +5 -0
  56. package/dist/solutions-components/utils/queryUtils.ts +21 -0
  57. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +8 -0
  58. package/dist/types/components/layer-table/layer-table.d.ts +54 -1
  59. package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +15 -1
  60. package/dist/types/components.d.ts +23 -2
  61. package/dist/types/preact.d.ts +2 -1
  62. package/dist/types/utils/interfaces.d.ts +4 -0
  63. package/dist/types/utils/queryUtils.d.ts +11 -0
  64. package/package.json +1 -1
  65. package/dist/solutions-components/p-1b9709ce.entry.js +0 -6
  66. package/dist/solutions-components/p-4f1c4004.entry.js +0 -6
  67. package/dist/solutions-components/p-c556ed60.entry.js +0 -6
@@ -62,6 +62,7 @@ export class CrowdsourceManager {
62
62
  this._layoutMode = ELayoutMode.GRID;
63
63
  this._mapView = undefined;
64
64
  this._panelOpen = true;
65
+ this._tableOnly = false;
65
66
  }
66
67
  //--------------------------------------------------------------------------
67
68
  //
@@ -111,6 +112,16 @@ export class CrowdsourceManager {
111
112
  // Events (public)
112
113
  //
113
114
  //--------------------------------------------------------------------------
115
+ /**
116
+ * Listen for idsFound event to be fired so we can know that all layer ids have been fetched
117
+ */
118
+ async idsFound(evt) {
119
+ const ids = evt.detail;
120
+ this._tableOnly = ids.tableIds.length > 0 && ids.layerIds.length === 0;
121
+ if (this._tableOnly) {
122
+ this._expandPopup = true;
123
+ }
124
+ }
114
125
  /**
115
126
  * Listen for layoutChanged event to be fired so we can adjust the layout
116
127
  */
@@ -308,7 +319,7 @@ export class CrowdsourceManager {
308
319
  const tooltip = this._expandPopup ? this._translations.collapsePopup : this._translations.expandPopup;
309
320
  const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
310
321
  const popupNodeClass = !this._expandPopup ? "height-full" : ((_a = this.mapInfos) === null || _a === void 0 ? void 0 : _a.length) === 1 ? "position-absolute-0" : "position-absolute-50";
311
- return (h("div", { class: "calcite-mode-dark " + popupNodeClass }, h("calcite-panel", null, h("div", { class: "display-flex align-items-center", slot: "header-content" }, h("calcite-icon", { icon: "information", scale: "s" }), h("div", { class: "padding-inline-start-75" }, this._translations.information)), h("calcite-action", { icon: icon, id: id, onClick: () => this._togglePopup(), slot: "header-actions-end", text: "" }), h("calcite-tooltip", { class: themeClass, label: "", placement: "bottom", "reference-element": id }, h("span", null, tooltip)), this._getCardNode())));
322
+ return (h("div", { class: "calcite-mode-dark " + popupNodeClass }, h("calcite-panel", null, h("div", { class: "display-flex align-items-center", slot: "header-content" }, h("calcite-icon", { icon: "information", scale: "s" }), h("div", { class: "padding-inline-start-75" }, this._translations.information)), h("calcite-action", { disabled: this._tableOnly, icon: icon, id: id, onClick: () => this._togglePopup(), slot: "header-actions-end", text: "" }), !this._tableOnly ? h("calcite-tooltip", { class: themeClass, label: "", placement: "bottom", "reference-element": id }, h("span", null, tooltip)) : undefined, this._getCardNode())));
312
323
  }
313
324
  /**
314
325
  * Toggle the popup information
@@ -982,7 +993,8 @@ export class CrowdsourceManager {
982
993
  "_translations": {},
983
994
  "_layoutMode": {},
984
995
  "_mapView": {},
985
- "_panelOpen": {}
996
+ "_panelOpen": {},
997
+ "_tableOnly": {}
986
998
  };
987
999
  }
988
1000
  static get elementRef() { return "el"; }
@@ -1006,6 +1018,12 @@ export class CrowdsourceManager {
1006
1018
  }
1007
1019
  static get listeners() {
1008
1020
  return [{
1021
+ "name": "idsFound",
1022
+ "method": "idsFound",
1023
+ "target": "window",
1024
+ "capture": false,
1025
+ "passive": false
1026
+ }, {
1009
1027
  "name": "layoutChanged",
1010
1028
  "method": "layoutChanged",
1011
1029
  "target": "window",
@@ -22,7 +22,7 @@ import { Host, h } from "@stencil/core";
22
22
  import { loadModules } from "../../utils/loadModules";
23
23
  import { getLocaleComponentStrings } from "../../utils/locale";
24
24
  import { getLayerOrTable, goToSelection } from "../../utils/mapViewUtils";
25
- import { queryAllIds, queryFeaturesByGlobalID } from "../../utils/queryUtils";
25
+ import { queryAllIds, queryFeatureIds, queryFeaturesByGlobalID } from "../../utils/queryUtils";
26
26
  import * as downloadUtils from "../../utils/downloadUtils";
27
27
  import "@esri/instant-apps-components/dist/components/instant-apps-social-share";
28
28
  export class LayerTable {
@@ -31,6 +31,10 @@ export class LayerTable {
31
31
  * number[]: A list of all IDs for the current layer
32
32
  */
33
33
  this._allIds = [];
34
+ /**
35
+ * boolean: When true the ctrl key is currently pressed
36
+ */
37
+ this._ctrlIsPressed = false;
34
38
  /**
35
39
  * boolean: When true the default global id provided via url param has been honored and should now be ignored
36
40
  */
@@ -39,6 +43,14 @@ export class LayerTable {
39
43
  * boolean: When true the default OID provided via url param has been honored and should now be ignored
40
44
  */
41
45
  this._defaultOidHonored = false;
46
+ /**
47
+ * boolean: When true the shift key is currently pressed
48
+ */
49
+ this._shiftIsPressed = false;
50
+ /**
51
+ * boolean: When true any onChange handeling will be skipped
52
+ */
53
+ this._skipOnChange = false;
42
54
  /**
43
55
  * bool: When true the table is being sorted
44
56
  */
@@ -243,6 +255,8 @@ export class LayerTable {
243
255
  async componentDidLoad() {
244
256
  this._resizeObserver.observe(this._toolbar);
245
257
  document.onclick = (e) => this._handleDocumentClick(e);
258
+ document.onkeydown = (e) => this._handleKeyDown(e);
259
+ document.onkeyup = (e) => this._handleKeyUp(e);
246
260
  }
247
261
  /**
248
262
  * Called after the component is rendered
@@ -297,7 +311,7 @@ export class LayerTable {
297
311
  * @returns The dom node that contains the controls
298
312
  */
299
313
  _getActionBar() {
300
- return (h("calcite-action-bar", { expandDisabled: true, expanded: true, id: this._getId("bar"), layout: "horizontal" }, h("div", { class: "border-end", id: "solutions-map-layer-picker-container" }, h("map-layer-picker", { appearance: "transparent", defaultLayerId: this.defaultLayerId, mapView: this.mapView, onLayerSelectionChange: (evt) => this._layerSelectionChanged(evt), onlyShowUpdatableLayers: this.onlyShowUpdatableLayers, placeholderIcon: "layers", scale: "l", showSingleLayerAsLabel: true, showTables: true, type: "dropdown" })), this._getActions()));
314
+ return (h("calcite-action-bar", { expandDisabled: true, expanded: true, id: this._getId("bar"), layout: "horizontal" }, h("div", { class: "border-end", id: "solutions-map-layer-picker-container" }, h("map-layer-picker", { appearance: "transparent", defaultLayerId: this.defaultLayerId, display: "inline-flex", height: 50, mapView: this.mapView, onLayerSelectionChange: (evt) => this._layerSelectionChanged(evt), onlyShowUpdatableLayers: this.onlyShowUpdatableLayers, placeholderIcon: "layers", scale: "l", showSingleLayerAsLabel: true, showTables: true, type: "dropdown" })), this._getActions()));
301
315
  }
302
316
  /**
303
317
  * Get the actions that are used for various interactions with the table
@@ -722,18 +736,8 @@ export class LayerTable {
722
736
  this._initColumnsInfo();
723
737
  this._checkEditEnabled();
724
738
  await this._table.when(() => {
725
- this._table.highlightIds.on("change", () => {
726
- // https://github.com/Esri/solutions-components/issues/365
727
- this._selectedIndexes = this._table.highlightIds.toArray().reverse();
728
- if (this._showOnlySelected) {
729
- if (this._featuresSelected()) {
730
- this._table.filterBySelection();
731
- }
732
- else {
733
- this._toggleShowSelected();
734
- }
735
- }
736
- this.featureSelectionChange.emit(this._selectedIndexes);
739
+ this._table.highlightIds.on("change", (evt) => {
740
+ void this._handleOnChange(evt);
737
741
  });
738
742
  this.reactiveUtils.watch(() => this._table.activeSortOrders, (sortOrders) => {
739
743
  var _a, _b, _c, _d;
@@ -743,6 +747,93 @@ export class LayerTable {
743
747
  });
744
748
  }
745
749
  }
750
+ async _handleOnChange(evt) {
751
+ const ids = [...this._table.highlightIds.toArray()];
752
+ if (!this._skipOnChange) {
753
+ if (!this._ctrlIsPressed && !this._shiftIsPressed) {
754
+ if (this._selectedIndexes.length > 0) {
755
+ this._skipOnChange = true;
756
+ // only readd in specific case where we have multiple selected and then click one of the currently selected
757
+ const reAdd = this._selectedIndexes.length > 1 && evt.removed.length === 1;
758
+ const newIndexes = reAdd ? evt.removed : ids.filter(id => this._selectedIndexes.indexOf(id) < 0);
759
+ this._clearSelection();
760
+ this._selectedIndexes = [...newIndexes];
761
+ if (newIndexes.length > 0) {
762
+ this._table.highlightIds.add(newIndexes[0]);
763
+ }
764
+ }
765
+ else {
766
+ // https://github.com/Esri/solutions-components/issues/365
767
+ this._selectedIndexes = ids.reverse();
768
+ }
769
+ }
770
+ else if (this._ctrlIsPressed) {
771
+ this._selectedIndexes = ids.reverse();
772
+ }
773
+ else if (this._shiftIsPressed) {
774
+ this._skipOnChange = true;
775
+ this._previousCurrentId = this._currentId;
776
+ this._currentId = [...this._table.highlightIds.toArray()].reverse()[0];
777
+ if (this._previousCurrentId !== this._currentId) {
778
+ // query the layer based on current sort and filters then grab between the current id and previous id
779
+ const orderBy = this._table.activeSortOrders.reduce((prev, cur) => {
780
+ prev.push(`${cur.fieldName} ${cur.direction}`);
781
+ return prev;
782
+ }, []);
783
+ const oids = await queryFeatureIds(this._layer, this._layer.definitionExpression, orderBy);
784
+ let isBetween = false;
785
+ const _start = this._table.viewModel.getObjectIdIndex(this._previousCurrentId);
786
+ const _end = this._table.viewModel.getObjectIdIndex(this._currentId);
787
+ const startIndex = _start < _end ? _start : _end;
788
+ const endIndex = _end > _start ? _end : _start;
789
+ this._selectedIndexes = oids.reduce((prev, cur) => {
790
+ const id = cur;
791
+ const index = this._table.viewModel.getObjectIdIndex(id);
792
+ if ((id === this._currentId || id === this._previousCurrentId)) {
793
+ isBetween = !isBetween;
794
+ if (prev.indexOf(id) < 0) {
795
+ prev.push(id);
796
+ }
797
+ }
798
+ // The oids are sorted so after we have reached the start or end oid add all ids even if the index is -1.
799
+ // Index of -1 will occur for features between the start and and oid if
800
+ // you select a row then scroll faster than the FeatureTable loads the data to select the next id
801
+ if (isBetween && prev.indexOf(id) < 0) {
802
+ prev.push(id);
803
+ }
804
+ // Also add index based check.
805
+ // In some cases the FeatureTable and Layer query will have differences in how null/undefined field values are sorted
806
+ if ((this._selectedIndexes.indexOf(id) > -1 || (index >= startIndex && index <= endIndex)) && prev.indexOf(id) < 0 && index > -1) {
807
+ prev.push(id);
808
+ }
809
+ return prev;
810
+ }, []);
811
+ this._table.highlightIds.addMany(this._selectedIndexes.filter(i => ids.indexOf(i) < 0));
812
+ }
813
+ }
814
+ this._finishOnChange();
815
+ }
816
+ else {
817
+ this._skipOnChange = false;
818
+ }
819
+ this._currentId = [...this._table.highlightIds.toArray()].reverse()[0];
820
+ }
821
+ /**
822
+ * Handle any updates after a selection change has occured and emit the results
823
+ *
824
+ * @returns void
825
+ */
826
+ _finishOnChange() {
827
+ if (this._showOnlySelected) {
828
+ if (this._featuresSelected()) {
829
+ this._table.filterBySelection();
830
+ }
831
+ else {
832
+ this._toggleShowSelected();
833
+ }
834
+ }
835
+ this.featureSelectionChange.emit(this._selectedIndexes);
836
+ }
746
837
  /**
747
838
  * Reset basic table props
748
839
  *
@@ -878,6 +969,24 @@ export class LayerTable {
878
969
  }
879
970
  }
880
971
  }
972
+ /**
973
+ * Keep track of key down for ctrl and shift
974
+ *
975
+ * @returns void
976
+ */
977
+ _handleKeyDown(e) {
978
+ this._ctrlIsPressed = e.ctrlKey;
979
+ this._shiftIsPressed = e.shiftKey;
980
+ }
981
+ /**
982
+ * Keep track of key up for ctrl and shift
983
+ *
984
+ * @returns void
985
+ */
986
+ _handleKeyUp(e) {
987
+ this._ctrlIsPressed = e.ctrlKey;
988
+ this._shiftIsPressed = e.shiftKey;
989
+ }
881
990
  /**
882
991
  * Show filter component in modal
883
992
  *
@@ -885,15 +994,19 @@ export class LayerTable {
885
994
  */
886
995
  _filterModal() {
887
996
  var _a, _b, _c;
888
- return (h("calcite-modal", { "aria-labelledby": "modal-title", kind: "brand", onCalciteModalClose: () => this._closeFilter(), open: this._filterOpen, widthScale: "s" }, 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)), h("div", { slot: "content" }, h("instant-apps-filter-list", { autoUpdateUrl: false, closeBtn: true, closeBtnOnClick: () => this._closeFilter(), layerExpressions: this._layerExpressions, ref: (el) => this._filterList = el, view: this.mapView }))));
997
+ return (h("calcite-modal", { "aria-labelledby": "modal-title", kind: "brand", onCalciteModalClose: async () => this._closeFilter(), open: this._filterOpen, widthScale: "s" }, 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)), h("div", { slot: "content" }, h("instant-apps-filter-list", { autoUpdateUrl: false, closeBtn: true, closeBtnOnClick: async () => this._closeFilter(), layerExpressions: this._layerExpressions, ref: (el) => this._filterList = el, view: this.mapView }))));
889
998
  }
890
999
  /**
891
1000
  * Close the filter modal
892
1001
  *
893
1002
  * @returns void
894
1003
  */
895
- _closeFilter() {
896
- this._filterOpen = false;
1004
+ async _closeFilter() {
1005
+ if (this._filterOpen) {
1006
+ // reset allIds
1007
+ this._allIds = await queryAllIds(this._layer);
1008
+ this._filterOpen = false;
1009
+ }
897
1010
  }
898
1011
  /**
899
1012
  * Show delete confirmation message
@@ -966,8 +1079,10 @@ export class LayerTable {
966
1079
  _selectAll() {
967
1080
  const ids = this._allIds;
968
1081
  this._table.highlightIds.removeAll();
1082
+ this._skipOnChange = true;
969
1083
  this._table.highlightIds.addMany(ids);
970
1084
  this._selectedIndexes = ids;
1085
+ this._finishOnChange();
971
1086
  }
972
1087
  /**
973
1088
  * Toggle the show only selected flag
@@ -1009,9 +1124,9 @@ export class LayerTable {
1009
1124
  * @returns void
1010
1125
  */
1011
1126
  _initLayerExpressions() {
1012
- var _a;
1013
- const layerExpressions = (_a = this.mapInfo.filterConfig) === null || _a === void 0 ? void 0 : _a.layerExpressions;
1014
- this._layerExpressions = layerExpressions.filter((exp) => exp.id === this._layer.id);
1127
+ var _a, _b;
1128
+ const layerExpressions = (_b = (_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.layerExpressions;
1129
+ this._layerExpressions = layerExpressions ? layerExpressions.filter((exp) => exp.id === this._layer.id) : [];
1015
1130
  }
1016
1131
  /**
1017
1132
  * Select all rows that are not currently selectd
@@ -1027,8 +1142,10 @@ export class LayerTable {
1027
1142
  }
1028
1143
  return prev;
1029
1144
  }, []).sort((a, b) => a - b);
1145
+ this._skipOnChange = true;
1030
1146
  this._table.highlightIds.addMany(ids);
1031
1147
  this._selectedIndexes = ids;
1148
+ this._finishOnChange();
1032
1149
  }
1033
1150
  /**
1034
1151
  * Export all selected rows as CSV
@@ -1114,6 +1231,7 @@ export class LayerTable {
1114
1231
  fieldInfos.some(fieldInfo => {
1115
1232
  if (fieldInfo.name === columnTemplate.fieldName) {
1116
1233
  columnTemplate.label = fieldInfo.alias;
1234
+ columnTemplate.menuConfig = this._getMenuConfig(fieldInfo.name);
1117
1235
  return true;
1118
1236
  }
1119
1237
  });
@@ -1122,12 +1240,48 @@ export class LayerTable {
1122
1240
  return {
1123
1241
  type: "field",
1124
1242
  fieldName: fieldInfo.name,
1125
- label: fieldInfo.alias
1243
+ label: fieldInfo.alias,
1244
+ menuConfig: this._getMenuConfig(fieldInfo.name)
1126
1245
  };
1127
1246
  });
1128
1247
  }
1129
1248
  return columnTemplates;
1130
1249
  }
1250
+ /**
1251
+ * Get the menu config that adds the ability to hide the current column
1252
+ *
1253
+ * @returns void
1254
+ * @protected
1255
+ */
1256
+ _getMenuConfig(name) {
1257
+ return {
1258
+ items: [
1259
+ {
1260
+ label: this._translations.hideField,
1261
+ iconClass: "esri-icon-non-visible",
1262
+ autoCloseMenu: true,
1263
+ clickFunction: () => {
1264
+ this._handleHideClick(name);
1265
+ }
1266
+ }
1267
+ ]
1268
+ };
1269
+ }
1270
+ /**
1271
+ * Hide the table column for the provided name
1272
+ *
1273
+ * @returns void
1274
+ * @protected
1275
+ */
1276
+ _handleHideClick(name) {
1277
+ this._columnsInfo[name] = false;
1278
+ this._table.hideColumn(name);
1279
+ this._table.tableTemplate.columnTemplates.forEach((columnTemplate) => {
1280
+ if (columnTemplate.fieldName === name) {
1281
+ columnTemplate.visible = false;
1282
+ }
1283
+ });
1284
+ }
1131
1285
  /**
1132
1286
  * Fetches the component's translations
1133
1287
  *
@@ -20,6 +20,7 @@
20
20
 
21
21
  .map-layer-picker-container {
22
22
  width: 100%;
23
+ align-items: center;
23
24
  }
24
25
 
25
26
  .map-layer-picker {
@@ -35,8 +35,10 @@ export class MapLayerPicker {
35
35
  this.defaultLayerHonored = false;
36
36
  this.appearance = "transparent";
37
37
  this.defaultLayerId = "";
38
+ this.display = "inline-block";
38
39
  this.enabledLayerIds = [];
39
40
  this.enabledTableIds = [];
41
+ this.height = undefined;
40
42
  this.mapView = undefined;
41
43
  this.onlyShowUpdatableLayers = undefined;
42
44
  this.placeholderIcon = "";
@@ -91,7 +93,9 @@ export class MapLayerPicker {
91
93
  */
92
94
  render() {
93
95
  const id = "map-layer-picker";
94
- return (h(Host, null, h("div", { class: "map-layer-picker-container" }, h("div", { class: "map-layer-picker" }, !this._hasValidLayers ? this._getInvalidPlaceholder() :
96
+ let style = this.height > 0 ? { "height": `${this.height.toString()}px` } : {};
97
+ style = Object.assign(Object.assign({}, style), { "display": this.display });
98
+ return (h(Host, null, h("div", { class: "map-layer-picker-container", style: style }, h("div", { class: "map-layer-picker", style: style }, !this._hasValidLayers ? this._getInvalidPlaceholder() :
95
99
  !this._hasMultipleLayers && this.showSingleLayerAsLabel ? this._getSingleLayerPlaceholder() :
96
100
  this.type === "combobox" ? this._getCombobox(id) :
97
101
  this.type === "select" ? this._getSelect(id) : this._getDropdown(id), h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": id }, h("span", null, this._translations.switchLayer))))));
@@ -228,14 +232,18 @@ export class MapLayerPicker {
228
232
  async _setLayers() {
229
233
  if (this.mapView) {
230
234
  await this._initLayerTableHash();
231
- const mapLayerIds = this.onlyShowUpdatableLayers ?
235
+ const layerIds = this.onlyShowUpdatableLayers ?
232
236
  this._getEditableIds(this._layerNameHash) : Object.keys(this._layerNameHash);
233
- const mapTableIds = this.showTables ? this.onlyShowUpdatableLayers ?
237
+ const tableIds = this.showTables ? this.onlyShowUpdatableLayers ?
234
238
  this._getEditableIds(this._tableNameHash) : Object.keys(this._tableNameHash) : [];
235
239
  this.ids = [
236
- ...mapLayerIds.reverse().filter(n => { var _a; return ((_a = this.enabledLayerIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.enabledLayerIds.reverse().indexOf(n) > -1 : true; }),
237
- ...mapTableIds.reverse().filter(n => { var _a; return ((_a = this.enabledTableIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.enabledTableIds.reverse().indexOf(n) > -1 : true; }),
240
+ ...layerIds.reverse().filter(n => { var _a; return ((_a = this.enabledLayerIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.enabledLayerIds.reverse().indexOf(n) > -1 : true; }),
241
+ ...tableIds.reverse().filter(n => { var _a; return ((_a = this.enabledTableIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.enabledTableIds.reverse().indexOf(n) > -1 : true; }),
238
242
  ];
243
+ this.idsFound.emit({
244
+ layerIds,
245
+ tableIds
246
+ });
239
247
  }
240
248
  }
241
249
  /**
@@ -354,6 +362,24 @@ export class MapLayerPicker {
354
362
  "reflect": false,
355
363
  "defaultValue": "\"\""
356
364
  },
365
+ "display": {
366
+ "type": "string",
367
+ "mutable": false,
368
+ "complexType": {
369
+ "original": "\"inline-flex\" | \"inline-block\"",
370
+ "resolved": "\"inline-block\" | \"inline-flex\"",
371
+ "references": {}
372
+ },
373
+ "required": false,
374
+ "optional": false,
375
+ "docs": {
376
+ "tags": [],
377
+ "text": "\"inline-flex\" | \"inline-block\": controls the display style of the dropdown"
378
+ },
379
+ "attribute": "display",
380
+ "reflect": false,
381
+ "defaultValue": "\"inline-block\""
382
+ },
357
383
  "enabledLayerIds": {
358
384
  "type": "unknown",
359
385
  "mutable": false,
@@ -386,6 +412,23 @@ export class MapLayerPicker {
386
412
  },
387
413
  "defaultValue": "[]"
388
414
  },
415
+ "height": {
416
+ "type": "number",
417
+ "mutable": false,
418
+ "complexType": {
419
+ "original": "number",
420
+ "resolved": "number",
421
+ "references": {}
422
+ },
423
+ "required": false,
424
+ "optional": false,
425
+ "docs": {
426
+ "tags": [],
427
+ "text": "number: optional fixed height value for the control.\r\nSpecified as pixel height."
428
+ },
429
+ "attribute": "height",
430
+ "reflect": false
431
+ },
389
432
  "mapView": {
390
433
  "type": "unknown",
391
434
  "mutable": false,
@@ -541,6 +584,27 @@ export class MapLayerPicker {
541
584
  }
542
585
  static get events() {
543
586
  return [{
587
+ "method": "idsFound",
588
+ "name": "idsFound",
589
+ "bubbles": true,
590
+ "cancelable": true,
591
+ "composed": true,
592
+ "docs": {
593
+ "tags": [],
594
+ "text": "Emitted on demand when no valid layers are found"
595
+ },
596
+ "complexType": {
597
+ "original": "ILayerAndTableIds",
598
+ "resolved": "ILayerAndTableIds",
599
+ "references": {
600
+ "ILayerAndTableIds": {
601
+ "location": "import",
602
+ "path": "../../utils/interfaces",
603
+ "id": "src/utils/interfaces.ts::ILayerAndTableIds"
604
+ }
605
+ }
606
+ }
607
+ }, {
544
608
  "method": "noLayersFound",
545
609
  "name": "noLayersFound",
546
610
  "bubbles": true,
@@ -132,7 +132,7 @@ export class MapPicker {
132
132
  * @protected
133
133
  */
134
134
  _getMapNameList(show) {
135
- const listClass = show ? "map-list" : "display-none";
135
+ const listClass = show ? "map-list border-bottom-1" : "display-none";
136
136
  return (h("div", { class: listClass }, h("calcite-list", { id: "mapList", ref: (el) => this._list = el, selectionAppearance: "border", selectionMode: "single" }, this.mapInfos.map(mapInfo => {
137
137
  return (h("calcite-list-item", { label: mapInfo.name, onClick: () => this._webMapSelected(mapInfo), selected: mapInfo.id === this._loadedId, value: mapInfo.id }));
138
138
  }))));
@@ -94,10 +94,10 @@
94
94
  operator: " AND ",
95
95
  expressions: [
96
96
  {
97
- definitionExpression: "OBJECTID > 700",
97
+ definitionExpression: "OBJECTID > 690",
98
98
  id: 1701793260225,
99
99
  index: 0,
100
- name: "greater than 700",
100
+ name: "greater than 690",
101
101
  active: false
102
102
  }
103
103
  ]
@@ -532,3 +532,8 @@ export interface IExpression {
532
532
  step?: number;
533
533
  numDisplayOption?: "slider" | "drop-down";
534
534
  }
535
+
536
+ export interface ILayerAndTableIds {
537
+ layerIds: string[];
538
+ tableIds: string[];
539
+ }
@@ -165,6 +165,22 @@ export async function queryFeaturesByGeometry(start, layer, geometry, featuresCo
165
165
  queryFeaturesByGeometry(start += num, layer, geometry, featuresCollection) :
166
166
  Promise.resolve(featuresCollection);
167
167
  }
168
+ /**
169
+ * Query the layer for feature ids that match the provided where clause.
170
+ * If no where clause is provided all features will be returned.
171
+ *
172
+ * @param layer the layer to retrieve features from
173
+ * @param where the where clause for the query
174
+ * @param orderBy any sort order to apply to the query
175
+ *
176
+ * @returns Promise with the ids from the layer that match the where and are sorted as defined by orderBy
177
+ */
178
+ export async function queryFeatureIds(layer, where, orderBy) {
179
+ const query = layer.createQuery();
180
+ query.where = where ? where : "1=1";
181
+ query.orderByFields = orderBy;
182
+ return await layer.queryObjectIds(query);
183
+ }
168
184
  /**
169
185
  * Query the layer for the extent of features with the provided OIDs
170
186
  *
@@ -212,6 +212,27 @@ export async function queryFeaturesByGeometry(
212
212
  Promise.resolve(featuresCollection);
213
213
  }
214
214
 
215
+ /**
216
+ * Query the layer for feature ids that match the provided where clause.
217
+ * If no where clause is provided all features will be returned.
218
+ *
219
+ * @param layer the layer to retrieve features from
220
+ * @param where the where clause for the query
221
+ * @param orderBy any sort order to apply to the query
222
+ *
223
+ * @returns Promise with the ids from the layer that match the where and are sorted as defined by orderBy
224
+ */
225
+ export async function queryFeatureIds(
226
+ layer: any,
227
+ where: any,
228
+ orderBy: any
229
+ ): Promise<number[]> {
230
+ const query = layer.createQuery();
231
+ query.where = where ? where : "1=1";
232
+ query.orderByFields = orderBy;
233
+ return await layer.queryObjectIds(query);
234
+ }
235
+
215
236
  /**
216
237
  * Query the layer for the extent of features with the provided OIDs
217
238
  *
@@ -108,6 +108,7 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
108
108
  this._layoutMode = ELayoutMode.GRID;
109
109
  this._mapView = undefined;
110
110
  this._panelOpen = true;
111
+ this._tableOnly = false;
111
112
  }
112
113
  //--------------------------------------------------------------------------
113
114
  //
@@ -157,6 +158,16 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
157
158
  // Events (public)
158
159
  //
159
160
  //--------------------------------------------------------------------------
161
+ /**
162
+ * Listen for idsFound event to be fired so we can know that all layer ids have been fetched
163
+ */
164
+ async idsFound(evt) {
165
+ const ids = evt.detail;
166
+ this._tableOnly = ids.tableIds.length > 0 && ids.layerIds.length === 0;
167
+ if (this._tableOnly) {
168
+ this._expandPopup = true;
169
+ }
170
+ }
160
171
  /**
161
172
  * Listen for layoutChanged event to be fired so we can adjust the layout
162
173
  */
@@ -354,7 +365,7 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
354
365
  const tooltip = this._expandPopup ? this._translations.collapsePopup : this._translations.expandPopup;
355
366
  const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
356
367
  const popupNodeClass = !this._expandPopup ? "height-full" : ((_a = this.mapInfos) === null || _a === void 0 ? void 0 : _a.length) === 1 ? "position-absolute-0" : "position-absolute-50";
357
- return (h("div", { class: "calcite-mode-dark " + popupNodeClass }, h("calcite-panel", null, h("div", { class: "display-flex align-items-center", slot: "header-content" }, h("calcite-icon", { icon: "information", scale: "s" }), h("div", { class: "padding-inline-start-75" }, this._translations.information)), h("calcite-action", { icon: icon, id: id, onClick: () => this._togglePopup(), slot: "header-actions-end", text: "" }), h("calcite-tooltip", { class: themeClass, label: "", placement: "bottom", "reference-element": id }, h("span", null, tooltip)), this._getCardNode())));
368
+ return (h("div", { class: "calcite-mode-dark " + popupNodeClass }, h("calcite-panel", null, h("div", { class: "display-flex align-items-center", slot: "header-content" }, h("calcite-icon", { icon: "information", scale: "s" }), h("div", { class: "padding-inline-start-75" }, this._translations.information)), h("calcite-action", { disabled: this._tableOnly, icon: icon, id: id, onClick: () => this._togglePopup(), slot: "header-actions-end", text: "" }), !this._tableOnly ? h("calcite-tooltip", { class: themeClass, label: "", placement: "bottom", "reference-element": id }, h("span", null, tooltip)) : undefined, this._getCardNode())));
358
369
  }
359
370
  /**
360
371
  * Toggle the popup information
@@ -514,8 +525,9 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
514
525
  "_translations": [32],
515
526
  "_layoutMode": [32],
516
527
  "_mapView": [32],
517
- "_panelOpen": [32]
518
- }, [[8, "layoutChanged", "layoutChanged"], [8, "mapChanged", "mapChanged"], [8, "beforeMapChanged", "beforeMapChanged"]], {
528
+ "_panelOpen": [32],
529
+ "_tableOnly": [32]
530
+ }, [[8, "idsFound", "idsFound"], [8, "layoutChanged", "layoutChanged"], [8, "mapChanged", "mapChanged"], [8, "beforeMapChanged", "beforeMapChanged"]], {
519
531
  "defaultCenter": ["defaultCenterWatchHandler"],
520
532
  "defaultGlobalId": ["defaultGlobalIdWatchHandler"],
521
533
  "defaultOid": ["defaultOidWatchHandler"],