@esri/solutions-components 0.7.8 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) 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/calcite-combobox_6.cjs.entry.js +15 -6
  4. package/dist/cjs/card-manager_3.cjs.entry.js +42 -5
  5. package/dist/cjs/crowdsource-manager.cjs.entry.js +12 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/solutions-components.cjs.js +1 -1
  8. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +20 -2
  9. package/dist/collection/components/layer-table/layer-table.js +42 -5
  10. package/dist/collection/components/map-layer-picker/map-layer-picker.css +1 -0
  11. package/dist/collection/components/map-layer-picker/map-layer-picker.js +69 -5
  12. package/dist/collection/utils/interfaces.ts +5 -0
  13. package/dist/components/crowdsource-manager.js +15 -3
  14. package/dist/components/layer-table2.js +42 -5
  15. package/dist/components/map-layer-picker2.js +17 -6
  16. package/dist/esm/calcite-combobox_6.entry.js +15 -6
  17. package/dist/esm/card-manager_3.entry.js +42 -5
  18. package/dist/esm/crowdsource-manager.entry.js +12 -1
  19. package/dist/esm/loader.js +1 -1
  20. package/dist/esm/solutions-components.js +1 -1
  21. package/dist/solutions-components/{p-546a3d3c.entry.js → p-a9bbd352.entry.js} +1 -1
  22. package/dist/solutions-components/p-c9b4d52f.entry.js +6 -0
  23. package/dist/solutions-components/p-f7870ec1.entry.js +6 -0
  24. package/dist/solutions-components/solutions-components.esm.js +1 -1
  25. package/dist/solutions-components/utils/interfaces.ts +5 -0
  26. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +8 -0
  27. package/dist/types/components/layer-table/layer-table.d.ts +14 -0
  28. package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +15 -1
  29. package/dist/types/components.d.ts +23 -2
  30. package/dist/types/preact.d.ts +2 -1
  31. package/dist/types/utils/interfaces.d.ts +4 -0
  32. package/package.json +1 -1
  33. package/dist/solutions-components/p-1b9709ce.entry.js +0 -6
  34. package/dist/solutions-components/p-4f1c4004.entry.js +0 -6
@@ -6,6 +6,7 @@
6
6
  "exportCSV": "Export to CSV",
7
7
  "filter": "Filter: {{title}}",
8
8
  "filters": "Filters",
9
+ "hideField": "Hide field",
9
10
  "more": "More",
10
11
  "selectAll": "Select all",
11
12
  "share": "Share",
@@ -6,6 +6,7 @@
6
6
  "exportCSV": "Export to CSV",
7
7
  "filter": "Filter: {{title}}",
8
8
  "filters": "Filters",
9
+ "hideField": "Hide field",
9
10
  "more": "More",
10
11
  "selectAll": "Select all",
11
12
  "share": "Share",
@@ -1899,11 +1899,12 @@ const DropdownItem = class {
1899
1899
  };
1900
1900
  DropdownItem.style = dropdownItemCss;
1901
1901
 
1902
- const mapLayerPickerCss = ":host{display:block}.map-layer-picker-container{width:100%}.map-layer-picker{position:relative;width:100%;display:inline-block}.padding-bottom-1{padding-bottom:1rem}.layer-picker-dropdown{height:100%;width:100%}.max-width-350{max-width:350px}.height-100{height:100%}.disabled{cursor:default !important;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.no-bottom-margin{--calcite-label-margin-bottom:0px}.layer-picker-label-container{align-items:center;display:inline-flex;height:100%;padding-inline-start:1rem;padding-inline-end:1rem}.padding-start-1{padding-inline-start:1rem}.cursor-default{cursor:default}";
1902
+ const mapLayerPickerCss = ":host{display:block}.map-layer-picker-container{width:100%;align-items:center}.map-layer-picker{position:relative;width:100%;display:inline-block}.padding-bottom-1{padding-bottom:1rem}.layer-picker-dropdown{height:100%;width:100%}.max-width-350{max-width:350px}.height-100{height:100%}.disabled{cursor:default !important;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.no-bottom-margin{--calcite-label-margin-bottom:0px}.layer-picker-label-container{align-items:center;display:inline-flex;height:100%;padding-inline-start:1rem;padding-inline-end:1rem}.padding-start-1{padding-inline-start:1rem}.cursor-default{cursor:default}";
1903
1903
 
1904
1904
  const MapLayerPicker = class {
1905
1905
  constructor(hostRef) {
1906
1906
  index.registerInstance(this, hostRef);
1907
+ this.idsFound = index.createEvent(this, "idsFound", 7);
1907
1908
  this.noLayersFound = index.createEvent(this, "noLayersFound", 7);
1908
1909
  this.layerSelectionChange = index.createEvent(this, "layerSelectionChange", 7);
1909
1910
  //--------------------------------------------------------------------------
@@ -1917,8 +1918,10 @@ const MapLayerPicker = class {
1917
1918
  this.defaultLayerHonored = false;
1918
1919
  this.appearance = "transparent";
1919
1920
  this.defaultLayerId = "";
1921
+ this.display = "inline-block";
1920
1922
  this.enabledLayerIds = [];
1921
1923
  this.enabledTableIds = [];
1924
+ this.height = undefined;
1922
1925
  this.mapView = undefined;
1923
1926
  this.onlyShowUpdatableLayers = undefined;
1924
1927
  this.placeholderIcon = "";
@@ -1973,7 +1976,9 @@ const MapLayerPicker = class {
1973
1976
  */
1974
1977
  render() {
1975
1978
  const id = "map-layer-picker";
1976
- return (index.h(index.Host, null, index.h("div", { class: "map-layer-picker-container" }, index.h("div", { class: "map-layer-picker" }, !this._hasValidLayers ? this._getInvalidPlaceholder() :
1979
+ let style = this.height > 0 ? { "height": `${this.height.toString()}px` } : {};
1980
+ style = Object.assign(Object.assign({}, style), { "display": this.display });
1981
+ return (index.h(index.Host, null, index.h("div", { class: "map-layer-picker-container", style: style }, index.h("div", { class: "map-layer-picker", style: style }, !this._hasValidLayers ? this._getInvalidPlaceholder() :
1977
1982
  !this._hasMultipleLayers && this.showSingleLayerAsLabel ? this._getSingleLayerPlaceholder() :
1978
1983
  this.type === "combobox" ? this._getCombobox(id) :
1979
1984
  this.type === "select" ? this._getSelect(id) : this._getDropdown(id), index.h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": id }, index.h("span", null, this._translations.switchLayer))))));
@@ -2110,14 +2115,18 @@ const MapLayerPicker = class {
2110
2115
  async _setLayers() {
2111
2116
  if (this.mapView) {
2112
2117
  await this._initLayerTableHash();
2113
- const mapLayerIds = this.onlyShowUpdatableLayers ?
2118
+ const layerIds = this.onlyShowUpdatableLayers ?
2114
2119
  this._getEditableIds(this._layerNameHash) : Object.keys(this._layerNameHash);
2115
- const mapTableIds = this.showTables ? this.onlyShowUpdatableLayers ?
2120
+ const tableIds = this.showTables ? this.onlyShowUpdatableLayers ?
2116
2121
  this._getEditableIds(this._tableNameHash) : Object.keys(this._tableNameHash) : [];
2117
2122
  this.ids = [
2118
- ...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; }),
2119
- ...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; }),
2123
+ ...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; }),
2124
+ ...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; }),
2120
2125
  ];
2126
+ this.idsFound.emit({
2127
+ layerIds,
2128
+ tableIds
2129
+ });
2121
2130
  }
2122
2131
  }
2123
2132
  /**
@@ -382,7 +382,7 @@ const LayerTable = class {
382
382
  * @returns The dom node that contains the controls
383
383
  */
384
384
  _getActionBar() {
385
- return (index.h("calcite-action-bar", { expandDisabled: true, expanded: true, id: this._getId("bar"), layout: "horizontal" }, index.h("div", { class: "border-end", id: "solutions-map-layer-picker-container" }, index.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()));
385
+ return (index.h("calcite-action-bar", { expandDisabled: true, expanded: true, id: this._getId("bar"), layout: "horizontal" }, index.h("div", { class: "border-end", id: "solutions-map-layer-picker-container" }, index.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()));
386
386
  }
387
387
  /**
388
388
  * Get the actions that are used for various interactions with the table
@@ -1094,9 +1094,9 @@ const LayerTable = class {
1094
1094
  * @returns void
1095
1095
  */
1096
1096
  _initLayerExpressions() {
1097
- var _a;
1098
- const layerExpressions = (_a = this.mapInfo.filterConfig) === null || _a === void 0 ? void 0 : _a.layerExpressions;
1099
- this._layerExpressions = layerExpressions.filter((exp) => exp.id === this._layer.id);
1097
+ var _a, _b;
1098
+ const layerExpressions = (_b = (_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.layerExpressions;
1099
+ this._layerExpressions = layerExpressions ? layerExpressions.filter((exp) => exp.id === this._layer.id) : [];
1100
1100
  }
1101
1101
  /**
1102
1102
  * Select all rows that are not currently selectd
@@ -1199,6 +1199,7 @@ const LayerTable = class {
1199
1199
  fieldInfos.some(fieldInfo => {
1200
1200
  if (fieldInfo.name === columnTemplate.fieldName) {
1201
1201
  columnTemplate.label = fieldInfo.alias;
1202
+ columnTemplate.menuConfig = this._getMenuConfig(fieldInfo.name);
1202
1203
  return true;
1203
1204
  }
1204
1205
  });
@@ -1207,12 +1208,48 @@ const LayerTable = class {
1207
1208
  return {
1208
1209
  type: "field",
1209
1210
  fieldName: fieldInfo.name,
1210
- label: fieldInfo.alias
1211
+ label: fieldInfo.alias,
1212
+ menuConfig: this._getMenuConfig(fieldInfo.name)
1211
1213
  };
1212
1214
  });
1213
1215
  }
1214
1216
  return columnTemplates;
1215
1217
  }
1218
+ /**
1219
+ * Get the menu config that adds the ability to hide the current column
1220
+ *
1221
+ * @returns void
1222
+ * @protected
1223
+ */
1224
+ _getMenuConfig(name) {
1225
+ return {
1226
+ items: [
1227
+ {
1228
+ label: this._translations.hideField,
1229
+ iconClass: "esri-icon-non-visible",
1230
+ autoCloseMenu: true,
1231
+ clickFunction: () => {
1232
+ this._handleHideClick(name);
1233
+ }
1234
+ }
1235
+ ]
1236
+ };
1237
+ }
1238
+ /**
1239
+ * Hide the table column for the provided name
1240
+ *
1241
+ * @returns void
1242
+ * @protected
1243
+ */
1244
+ _handleHideClick(name) {
1245
+ this._columnsInfo[name] = false;
1246
+ this._table.hideColumn(name);
1247
+ this._table.tableTemplate.columnTemplates.forEach((columnTemplate) => {
1248
+ if (columnTemplate.fieldName === name) {
1249
+ columnTemplate.visible = false;
1250
+ }
1251
+ });
1252
+ }
1216
1253
  /**
1217
1254
  * Fetches the component's translations
1218
1255
  *
@@ -57,6 +57,7 @@ const CrowdsourceManager = class {
57
57
  this._layoutMode = interfaces.ELayoutMode.GRID;
58
58
  this._mapView = undefined;
59
59
  this._panelOpen = true;
60
+ this._tableOnly = false;
60
61
  }
61
62
  //--------------------------------------------------------------------------
62
63
  //
@@ -106,6 +107,16 @@ const CrowdsourceManager = class {
106
107
  // Events (public)
107
108
  //
108
109
  //--------------------------------------------------------------------------
110
+ /**
111
+ * Listen for idsFound event to be fired so we can know that all layer ids have been fetched
112
+ */
113
+ async idsFound(evt) {
114
+ const ids = evt.detail;
115
+ this._tableOnly = ids.tableIds.length > 0 && ids.layerIds.length === 0;
116
+ if (this._tableOnly) {
117
+ this._expandPopup = true;
118
+ }
119
+ }
109
120
  /**
110
121
  * Listen for layoutChanged event to be fired so we can adjust the layout
111
122
  */
@@ -303,7 +314,7 @@ const CrowdsourceManager = class {
303
314
  const tooltip = this._expandPopup ? this._translations.collapsePopup : this._translations.expandPopup;
304
315
  const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
305
316
  const popupNodeClass = !this._expandPopup ? "height-full" : ((_a = this.mapInfos) === null || _a === void 0 ? void 0 : _a.length) === 1 ? "position-absolute-0" : "position-absolute-50";
306
- return (index.h("div", { class: "calcite-mode-dark " + popupNodeClass }, index.h("calcite-panel", null, index.h("div", { class: "display-flex align-items-center", slot: "header-content" }, index.h("calcite-icon", { icon: "information", scale: "s" }), index.h("div", { class: "padding-inline-start-75" }, this._translations.information)), index.h("calcite-action", { icon: icon, id: id, onClick: () => this._togglePopup(), slot: "header-actions-end", text: "" }), index.h("calcite-tooltip", { class: themeClass, label: "", placement: "bottom", "reference-element": id }, index.h("span", null, tooltip)), this._getCardNode())));
317
+ return (index.h("div", { class: "calcite-mode-dark " + popupNodeClass }, index.h("calcite-panel", null, index.h("div", { class: "display-flex align-items-center", slot: "header-content" }, index.h("calcite-icon", { icon: "information", scale: "s" }), index.h("div", { class: "padding-inline-start-75" }, this._translations.information)), index.h("calcite-action", { disabled: this._tableOnly, icon: icon, id: id, onClick: () => this._togglePopup(), slot: "header-actions-end", text: "" }), !this._tableOnly ? index.h("calcite-tooltip", { class: themeClass, label: "", placement: "bottom", "reference-element": id }, index.h("span", null, tooltip)) : undefined, this._getCardNode())));
307
318
  }
308
319
  /**
309
320
  * Toggle the popup information