@esri/solutions-components 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
- package/dist/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
- package/dist/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
- package/dist/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
- package/dist/assets/arcgis-pdf-creator/grid.js +1 -1
- package/dist/assets/data/images/grid.png +0 -0
- package/dist/assets/data/images/horizontal.png +0 -0
- package/dist/assets/data/images/vertical.png +0 -0
- package/dist/assets/t9n/crowdsource-manager/resources.json +7 -1
- package/dist/assets/t9n/crowdsource-manager/resources_en.json +7 -1
- package/dist/cjs/buffer-tools_6.cjs.entry.js +85 -85
- package/dist/cjs/{calcite-block_2.cjs.entry.js → calcite-action-bar_4.cjs.entry.js} +307 -18
- package/dist/cjs/{calcite-action.cjs.entry.js → calcite-action_2.cjs.entry.js} +84 -1
- package/dist/cjs/{calcite-combobox_3.cjs.entry.js → calcite-chip_4.cjs.entry.js} +187 -61
- package/dist/cjs/{calcite-dropdown-group_4.cjs.entry.js → calcite-dropdown_5.cjs.entry.js} +467 -1
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +283 -283
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
- package/dist/cjs/{calcite-action-bar_2.cjs.entry.js → calcite-tooltip.cjs.entry.js} +2 -208
- package/dist/cjs/crowdsource-manager.cjs.entry.js +88 -14
- package/dist/cjs/{downloadUtils-b85476e8.js → downloadUtils-9359e9ff.js} +1218 -1127
- package/dist/cjs/{index.es-3ba50626.js → index.es-9c0d0ed6.js} +10682 -10682
- package/dist/cjs/{interfaces-17c631bf.js → interfaces-cac36920.js} +6 -0
- package/dist/cjs/layer-table_2.cjs.entry.js +512 -0
- package/dist/cjs/loader.cjs.js +30 -30
- package/dist/cjs/{mapViewUtils-df63bfa4.js → mapViewUtils-090f4d4d.js} +24 -24
- package/dist/cjs/public-notification.cjs.entry.js +69 -49
- package/dist/cjs/solution-configuration.cjs.entry.js +2 -2
- package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
- package/dist/cjs/{solution-store-b86759b2.js → solution-store-d28c332e.js} +1 -1
- package/dist/cjs/solutions-components.cjs.js +31 -31
- package/dist/collection/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
- package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
- package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
- package/dist/collection/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
- package/dist/collection/assets/arcgis-pdf-creator/grid.js +1 -1
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +122 -0
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +130 -14
- package/dist/collection/components/layer-table/layer-table.css +2 -70
- package/dist/collection/components/layer-table/layer-table.js +66 -106
- package/dist/collection/components/map-card/map-card.css +4 -7
- package/dist/collection/components/map-card/map-card.js +44 -10
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
- package/dist/collection/components/public-notification/public-notification.js +45 -27
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +1 -1
- package/dist/collection/demos/crowdsource-manager.html +14 -41
- package/dist/collection/utils/csvDownload.js +41 -0
- package/dist/collection/utils/csvDownload.ts +42 -0
- package/dist/collection/utils/csvUtils.js +6 -23
- package/dist/collection/utils/csvUtils.ts +8 -27
- package/dist/collection/utils/downloadUtils.js +30 -14
- package/dist/collection/utils/downloadUtils.ts +36 -14
- package/dist/collection/utils/interfaces.js +6 -0
- package/dist/collection/utils/interfaces.ts +6 -0
- package/dist/collection/utils/pdfUtils.js +9 -6
- package/dist/collection/utils/pdfUtils.ts +13 -8
- package/dist/collection/utils/test/csvUtils.spec.tsx +56 -0
- package/dist/collection/utils/test/downloadUtils.spec.tsx +133 -0
- package/dist/components/crowdsource-manager.js +293 -17
- package/dist/components/downloadUtils.js +133 -42
- package/dist/components/interfaces3.js +7 -1
- package/dist/components/layer-table.js +1 -443
- package/dist/components/layer-table2.js +429 -0
- package/dist/components/map-card.js +1 -339
- package/dist/{esm/map-card.entry.js → components/map-card2.js} +118 -22
- package/dist/components/map-draw-tools2.js +16 -16
- package/dist/components/map-layer-picker2.js +1 -1
- package/dist/components/map-select-tools2.js +38 -38
- package/dist/components/public-notification.js +102 -82
- package/dist/components/queryUtils.js +10 -10
- package/dist/components/refine-selection-tools2.js +3 -3
- package/dist/components/refine-selection2.js +1 -1
- package/dist/components/solution-resource-item2.js +1 -1
- package/dist/components/solution-store.js +1 -1
- package/dist/esm/buffer-tools_6.entry.js +76 -76
- package/dist/esm/{calcite-block_2.entry.js → calcite-action-bar_4.entry.js} +307 -20
- package/dist/esm/{calcite-action.entry.js → calcite-action_2.entry.js} +84 -2
- package/dist/esm/{calcite-combobox_3.entry.js → calcite-chip_4.entry.js} +181 -56
- package/dist/esm/{calcite-dropdown-group_4.entry.js → calcite-dropdown_5.entry.js} +468 -3
- package/dist/esm/calcite-input-message_5.entry.js +275 -275
- package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
- package/dist/esm/{calcite-action-bar_2.entry.js → calcite-tooltip.entry.js} +4 -209
- package/dist/esm/crowdsource-manager.entry.js +88 -14
- package/dist/esm/{downloadUtils-f278742f.js → downloadUtils-a8f139c5.js} +1214 -1123
- package/dist/esm/{index.es-6f3a1143.js → index.es-a75412ff.js} +10596 -10596
- package/dist/esm/{interfaces-d0d83efa.js → interfaces-cd4054e5.js} +7 -1
- package/dist/esm/layer-table_2.entry.js +507 -0
- package/dist/esm/loader.js +26 -26
- package/dist/esm/{mapViewUtils-bd1809f0.js → mapViewUtils-8ffcd36d.js} +12 -12
- package/dist/esm/public-notification.entry.js +65 -45
- package/dist/esm/solution-configuration.entry.js +2 -2
- package/dist/esm/solution-contents_3.entry.js +2 -2
- package/dist/esm/{solution-store-477288ac.js → solution-store-1b67f2c8.js} +1 -1
- package/dist/esm/solutions-components.js +26 -26
- package/dist/solutions-components/demos/crowdsource-manager.html +14 -41
- package/dist/solutions-components/{p-dd11eeb2.js → p-1395b0ef.js} +1 -1
- package/dist/solutions-components/{p-cbac29fb.entry.js → p-1affd711.entry.js} +18 -18
- package/dist/solutions-components/p-30de8da1.entry.js +17 -0
- package/dist/solutions-components/{p-91cad71e.entry.js → p-439c878d.entry.js} +3 -9
- package/dist/solutions-components/{p-03e2c6fd.js → p-765a27f3.js} +60 -60
- package/dist/solutions-components/p-813a04c3.entry.js +6 -0
- package/dist/solutions-components/{p-9e8a371f.entry.js → p-874b39a7.entry.js} +3 -3
- package/dist/solutions-components/p-8cece97f.js +21 -0
- package/dist/solutions-components/{p-dd0241fb.entry.js → p-97aa7211.entry.js} +1 -1
- package/dist/solutions-components/{p-0e459cc7.entry.js → p-a955a3e6.entry.js} +10 -4
- package/dist/solutions-components/{p-40c12650.js → p-bb64bd47.js} +453 -437
- package/dist/solutions-components/{p-70e1d4d8.entry.js → p-c392dd95.entry.js} +17 -17
- package/dist/solutions-components/p-ca386a72.entry.js +6 -0
- package/dist/solutions-components/p-d47d74a6.entry.js +23 -0
- package/dist/solutions-components/p-db846ee2.entry.js +11 -0
- package/dist/solutions-components/{p-88e5a76d.js → p-dc53c9c1.js} +36 -36
- package/dist/solutions-components/p-e1c93241.entry.js +6 -0
- package/dist/solutions-components/{p-4cbaf0f1.entry.js → p-e6d235d6.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +6 -6
- package/dist/solutions-components/utils/csvDownload.ts +42 -0
- package/dist/solutions-components/utils/csvUtils.ts +8 -27
- package/dist/solutions-components/utils/downloadUtils.ts +36 -14
- package/dist/solutions-components/utils/interfaces.ts +6 -0
- package/dist/solutions-components/utils/pdfUtils.ts +13 -8
- package/dist/solutions-components/utils/test/csvUtils.spec.tsx +56 -0
- package/dist/solutions-components/utils/test/downloadUtils.spec.tsx +133 -0
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +39 -0
- package/dist/types/components/layer-table/layer-table.d.ts +35 -48
- package/dist/types/components/map-card/map-card.d.ts +10 -6
- package/dist/types/components/public-notification/public-notification.d.ts +18 -6
- package/dist/types/components.d.ts +1621 -1601
- package/dist/types/preact.d.ts +2 -1
- package/dist/types/utils/csvDownload.d.ts +24 -0
- package/dist/types/utils/csvUtils.d.ts +2 -1
- package/dist/types/utils/downloadUtils.d.ts +25 -0
- package/dist/types/utils/interfaces.d.ts +5 -0
- package/dist/types/utils/pdfUtils.d.ts +2 -1
- package/package.json +4 -4
- package/dist/cjs/calcite-chip.cjs.entry.js +0 -142
- package/dist/cjs/calcite-dropdown.cjs.entry.js +0 -481
- package/dist/cjs/calcite-handle.cjs.entry.js +0 -99
- package/dist/cjs/calcite-loader.cjs.entry.js +0 -95
- package/dist/cjs/layer-table.cjs.entry.js +0 -317
- package/dist/cjs/map-card.cjs.entry.js +0 -252
- package/dist/esm/calcite-chip.entry.js +0 -138
- package/dist/esm/calcite-dropdown.entry.js +0 -477
- package/dist/esm/calcite-handle.entry.js +0 -95
- package/dist/esm/calcite-loader.entry.js +0 -91
- package/dist/esm/layer-table.entry.js +0 -313
- package/dist/solutions-components/p-045d3988.entry.js +0 -12
- package/dist/solutions-components/p-11132485.entry.js +0 -11
- package/dist/solutions-components/p-15b43c29.entry.js +0 -11
- package/dist/solutions-components/p-5034aabc.entry.js +0 -11
- package/dist/solutions-components/p-6f012424.entry.js +0 -6
- package/dist/solutions-components/p-7fd10eb3.entry.js +0 -11
- package/dist/solutions-components/p-a57ef371.entry.js +0 -6
- package/dist/solutions-components/p-bc39f296.entry.js +0 -6
- package/dist/solutions-components/p-c93d8e80.entry.js +0 -6
- package/dist/solutions-components/p-dbc9a5a8.js +0 -21
- package/dist/solutions-components/p-f5c70be2.entry.js +0 -6
- package/dist/solutions-components/p-f6b17cc6.entry.js +0 -11
@@ -19,32 +19,45 @@
|
|
19
19
|
* limitations under the License.
|
20
20
|
*/
|
21
21
|
import { Host, h } from '@stencil/core';
|
22
|
+
import { loadModules } from "../../utils/loadModules";
|
22
23
|
import { getLocaleComponentStrings } from "../../utils/locale";
|
23
|
-
import { getMapLayerView, goToSelection } from "../../utils/mapViewUtils";
|
24
|
+
import { getMapLayerView, goToSelection, getMapLayerIds } from "../../utils/mapViewUtils";
|
24
25
|
import { queryAllFeatures } from "../../utils/queryUtils";
|
25
26
|
import * as downloadUtils from "../../utils/downloadUtils";
|
26
|
-
// TODO look for options to better handle very large number of records
|
27
|
-
// has a hard time especially with select all when we have many rows
|
28
|
-
// TODO test with data that contains domains
|
29
27
|
export class LayerTable {
|
30
28
|
constructor() {
|
29
|
+
/**
|
30
|
+
* string[]: List of field names to display
|
31
|
+
*/
|
32
|
+
this._fieldNames = [];
|
31
33
|
/**
|
32
34
|
* esri/Graphic[]: https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html
|
33
35
|
*/
|
34
36
|
this._graphics = [];
|
35
37
|
/**
|
36
|
-
*
|
38
|
+
* Store a reference to the table node after it's first created
|
39
|
+
* and initializes the FeatureTable
|
40
|
+
*
|
41
|
+
* @returns void
|
37
42
|
*/
|
38
|
-
this.
|
43
|
+
this.onTableNodeCreate = (node) => {
|
44
|
+
this._tableNode = node;
|
45
|
+
this._getTable(node);
|
46
|
+
};
|
39
47
|
this.mapView = undefined;
|
40
|
-
this.
|
48
|
+
this._layerView = undefined;
|
41
49
|
this._selectedIndexes = [];
|
50
|
+
this._translations = undefined;
|
42
51
|
}
|
43
52
|
//--------------------------------------------------------------------------
|
44
53
|
//
|
45
54
|
// Watch handlers
|
46
55
|
//
|
47
56
|
//--------------------------------------------------------------------------
|
57
|
+
async mapViewWatchHandler() {
|
58
|
+
const mapLayerIds = await getMapLayerIds(this.mapView);
|
59
|
+
this._layerView = await getMapLayerView(this.mapView, mapLayerIds[0]);
|
60
|
+
}
|
48
61
|
//--------------------------------------------------------------------------
|
49
62
|
//
|
50
63
|
// Methods (public)
|
@@ -67,18 +80,35 @@ export class LayerTable {
|
|
67
80
|
*/
|
68
81
|
async componentWillLoad() {
|
69
82
|
await this._getTranslations();
|
83
|
+
await this._initModules();
|
70
84
|
}
|
71
85
|
/**
|
72
86
|
* Renders the component.
|
73
87
|
*/
|
74
88
|
render() {
|
75
|
-
|
89
|
+
if (!this._layerView) {
|
90
|
+
return null;
|
91
|
+
}
|
92
|
+
return (h(Host, null, this._getTableControlRow(), h("div", { class: "table-div width-full" }, h("calcite-panel", { class: "height-full width-full" }, h("div", { ref: this.onTableNodeCreate }))), h("edit-record-modal", { ref: (el) => this._editMultipleMpdal = el })));
|
76
93
|
}
|
77
94
|
//--------------------------------------------------------------------------
|
78
95
|
//
|
79
96
|
// Functions (protected)
|
80
97
|
//
|
81
98
|
//--------------------------------------------------------------------------
|
99
|
+
/**
|
100
|
+
* Load esri javascript api modules
|
101
|
+
*
|
102
|
+
* @returns Promise resolving when function is done
|
103
|
+
*
|
104
|
+
* @protected
|
105
|
+
*/
|
106
|
+
async _initModules() {
|
107
|
+
const [FeatureTable] = await loadModules([
|
108
|
+
"esri/widgets/FeatureTable"
|
109
|
+
]);
|
110
|
+
this.FeatureTable = FeatureTable;
|
111
|
+
}
|
82
112
|
/**
|
83
113
|
* Gets a row of controls that can be used for various interactions with the table
|
84
114
|
*
|
@@ -90,104 +120,26 @@ export class LayerTable {
|
|
90
120
|
return (h("div", { class: "display-flex table-border" }, h("map-layer-picker", { mapView: this.mapView, onLayerSelectionChange: (evt) => this._layerSelectionChanged(evt) }), h("div", null, h("calcite-button", { appearance: 'transparent', color: 'neutral', disabled: !featuresSelected, iconStart: 'magnifying-glass', onClick: () => this._zoom() }, this._translations.zoom), h("calcite-button", { appearance: 'transparent', color: 'neutral', disabled: !multiFeaturesSelected, iconStart: 'pencil', onClick: () => this._editMultiple() }, this._translations.editMultiple), h("calcite-button", { appearance: 'transparent', color: 'neutral', disabled: !featuresSelected, iconStart: 'trash', onClick: () => this._delete() }, this._translations.delete), h("calcite-split-button", { appearance: "transparent", color: "neutral", "primary-text": this._translations.more }, h("calcite-dropdown-group", { "selection-mode": "none" }, h("calcite-dropdown-item", { iconStart: 'list-check-all', onClick: () => this._selectAll(true) }, this._translations.selectAll), h("calcite-dropdown-item", { iconStart: 'selected-items-filter', onClick: () => this._showSelected() }, this._translations.showSelected), h("calcite-dropdown-item", { iconStart: 'erase', onClick: () => this._clearSelection() }, this._translations.clearSelection), h("calcite-dropdown-item", { iconStart: 'refresh', onClick: () => this._switchSelected() }, this._translations.switchSelected), h("calcite-dropdown-item", { iconStart: 'export', onClick: () => this._exportToCSV() }, this._translations.exportCSV))))));
|
91
121
|
}
|
92
122
|
/**
|
93
|
-
*
|
94
|
-
*
|
95
|
-
* @returns The dom node that contains the header
|
96
|
-
*/
|
97
|
-
_getTableHeader() {
|
98
|
-
return (h("div", { class: "header" }, h("div", { class: "table-header-cell padding-3-4" }, h("calcite-checkbox", { class: "display-flex justify-center", onClick: () => this._selectAll(this._selectAllElement.checked), ref: (el) => this._selectAllElement = el })), this._fieldNames.map(name => this._getTableHeaderCell(name))));
|
99
|
-
}
|
100
|
-
/**
|
101
|
-
* Gets a header cell for the table header
|
123
|
+
* Initialize the FeatureTable
|
102
124
|
*
|
103
|
-
* @
|
104
|
-
*
|
105
|
-
* @returns The dom node that contains the header cell
|
106
|
-
*/
|
107
|
-
_getTableHeaderCell(name) {
|
108
|
-
return (h("div", { class: "table-header-cell field-width" }, name));
|
109
|
-
}
|
110
|
-
/**
|
111
|
-
* Gets the table rows for all features
|
112
|
-
*
|
113
|
-
* @returns The dom node that contains the body of the table
|
114
|
-
*/
|
115
|
-
_getTableRows() {
|
116
|
-
return (h("div", { class: "table-body" }, this._graphics.map((g, i) => this._getTableRow(g, i))));
|
117
|
-
}
|
118
|
-
/**
|
119
|
-
* Gets the individual table row for a feature
|
120
|
-
*
|
121
|
-
* @param g the graphic the row is based on
|
122
|
-
* @param index the index location of the row within the table
|
123
|
-
*
|
124
|
-
* @returns The dom node that contains the row
|
125
|
-
*/
|
126
|
-
_getTableRow(g, index) {
|
127
|
-
// TODO think through this more...should build the fieldType info once up front rather
|
128
|
-
// than on every single value...
|
129
|
-
const checked = this._selectedIndexes.indexOf(index) > -1;
|
130
|
-
return (h("div", { class: "row" }, h("div", { class: "table-cell table-border padding-3-4" }, h("calcite-checkbox", { checked: checked, class: "display-flex justify-center", onClick: () => this._rowSelected(index), value: index })), this._fieldNames.map(name => {
|
131
|
-
const field = this._layerView.layer.fieldsIndex.get(name);
|
132
|
-
return this._getTableRowCell(g.attributes[name], field, checked);
|
133
|
-
})));
|
134
|
-
}
|
135
|
-
/**
|
136
|
-
* Gets the individual table cell for the provided field
|
137
|
-
*
|
138
|
-
* @param v the value to display
|
139
|
-
* @param field the field the row is based on
|
140
|
-
* @param rowSelected when true editable fields will render a control that will allow the value to be updated
|
141
|
-
*
|
142
|
-
* @returns The dom node that contains the table cell
|
125
|
+
* @returns void
|
143
126
|
*/
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
domainInput = (h("calcite-input", { max: range.maxValue, min: range.minValue, type: "number", value: v }));
|
160
|
-
}
|
127
|
+
_getTable(node) {
|
128
|
+
var _a;
|
129
|
+
if ((_a = this._layerView) === null || _a === void 0 ? void 0 : _a.layer) {
|
130
|
+
this._table = new this.FeatureTable({
|
131
|
+
layer: this._layerView.layer,
|
132
|
+
view: this.mapView,
|
133
|
+
editingEnabled: true,
|
134
|
+
highlightOnRowSelectEnabled: true,
|
135
|
+
multiSortEnabled: false,
|
136
|
+
visibleElements: {
|
137
|
+
header: false,
|
138
|
+
menu: false
|
139
|
+
},
|
140
|
+
container: node
|
141
|
+
});
|
161
142
|
}
|
162
|
-
;
|
163
|
-
return (h("div", { class: "table-cell table-border field-width" }, editable && domainInput ? domainInput : editable ? (h("calcite-input", { type: inputType, value: v })) : v));
|
164
|
-
}
|
165
|
-
/**
|
166
|
-
* Simple lookup that will get the appropriate edit control for the value type
|
167
|
-
*
|
168
|
-
* @param type the Esri field type
|
169
|
-
*
|
170
|
-
* @returns A string for the type of control to create based on the provided field type
|
171
|
-
*/
|
172
|
-
_getInputType(type) {
|
173
|
-
// JS API field types
|
174
|
-
// "string" | "small-integer" | "integer" | "single" | "double" | "long" | "date" | "oid" | "geometry" | "blob" | "raster" | "guid" | "global-id" | "xml"
|
175
|
-
// not sure about these: "geometry" | "blob" | "raster" | | "xml"
|
176
|
-
// Calcite input types
|
177
|
-
// color date datetime-local email file image month number password search tel text(default) textarea time url week
|
178
|
-
const inputTypes = {
|
179
|
-
"string": 'text',
|
180
|
-
"small-integer": "number",
|
181
|
-
"integer": "number",
|
182
|
-
"single": "number",
|
183
|
-
"double": "number",
|
184
|
-
"long": "number",
|
185
|
-
"date": "datetime-local",
|
186
|
-
"oid": "number",
|
187
|
-
"guid": "text",
|
188
|
-
"global-id": "text"
|
189
|
-
};
|
190
|
-
return Object.keys(inputTypes).indexOf(type) > -1 ? inputTypes[type] : "text";
|
191
143
|
}
|
192
144
|
/**
|
193
145
|
* Select or deselect all rows
|
@@ -308,6 +260,8 @@ export class LayerTable {
|
|
308
260
|
this._fieldNames = this._layerView.layer.fields.map(f => f.alias || f.name);
|
309
261
|
this._graphics = await queryAllFeatures(0, this._layerView.layer, []);
|
310
262
|
this._selectedIndexes = [];
|
263
|
+
this._table.layer = this._layerView.layer;
|
264
|
+
this._table.render();
|
311
265
|
}
|
312
266
|
/**
|
313
267
|
* Fetches the component's translations
|
@@ -320,7 +274,6 @@ export class LayerTable {
|
|
320
274
|
this._translations = messages[0];
|
321
275
|
}
|
322
276
|
static get is() { return "layer-table"; }
|
323
|
-
static get encapsulation() { return "shadow"; }
|
324
277
|
static get originalStyleUrls() {
|
325
278
|
return {
|
326
279
|
"$": ["layer-table.css"]
|
@@ -356,9 +309,16 @@ export class LayerTable {
|
|
356
309
|
}
|
357
310
|
static get states() {
|
358
311
|
return {
|
359
|
-
"
|
360
|
-
"_selectedIndexes": {}
|
312
|
+
"_layerView": {},
|
313
|
+
"_selectedIndexes": {},
|
314
|
+
"_translations": {}
|
361
315
|
};
|
362
316
|
}
|
363
317
|
static get elementRef() { return "el"; }
|
318
|
+
static get watchers() {
|
319
|
+
return [{
|
320
|
+
"propName": "mapView",
|
321
|
+
"methodName": "mapViewWatchHandler"
|
322
|
+
}];
|
323
|
+
}
|
364
324
|
}
|
@@ -61,6 +61,10 @@
|
|
61
61
|
display: flex;
|
62
62
|
}
|
63
63
|
|
64
|
+
.display-grid {
|
65
|
+
display: inline-grid;
|
66
|
+
}
|
67
|
+
|
64
68
|
/* only used if we need to do the map action seperately */
|
65
69
|
.block-button {
|
66
70
|
border-bottom: 0;
|
@@ -74,13 +78,6 @@
|
|
74
78
|
background-color: var(--calcite-ui-foreground-3);
|
75
79
|
}
|
76
80
|
|
77
|
-
.map-view {
|
78
|
-
padding: 0;
|
79
|
-
margin: 0;
|
80
|
-
height: 100%;
|
81
|
-
width: 100%;
|
82
|
-
}
|
83
|
-
|
84
81
|
.map-list {
|
85
82
|
position: absolute;
|
86
83
|
inset: 3.5rem 0 0 0;
|
@@ -35,13 +35,9 @@ export class MapCard {
|
|
35
35
|
* string: the id of map currently displayed
|
36
36
|
*/
|
37
37
|
this._loadedId = "";
|
38
|
-
/**
|
39
|
-
* string: the id of the container div for the map
|
40
|
-
*/
|
41
|
-
this._mapDivId = "map-div";
|
42
38
|
this.mapInfos = [];
|
39
|
+
this.mapView = undefined;
|
43
40
|
this._mapListExpanded = false;
|
44
|
-
this._mapView = undefined;
|
45
41
|
this._translations = undefined;
|
46
42
|
this._webMapId = "";
|
47
43
|
}
|
@@ -89,7 +85,7 @@ export class MapCard {
|
|
89
85
|
* Renders the component.
|
90
86
|
*/
|
91
87
|
render() {
|
92
|
-
return (h(Host, null, this._getToolbar(), this._getMapNameList(this._mapListExpanded), h("div", { class: "map-height",
|
88
|
+
return (h(Host, null, this._getToolbar(), this._getMapNameList(this._mapListExpanded), h("div", { class: "map-height", ref: (el) => (this._mapDiv = el) })));
|
93
89
|
}
|
94
90
|
//--------------------------------------------------------------------------
|
95
91
|
//
|
@@ -139,13 +135,14 @@ export class MapCard {
|
|
139
135
|
const webMap = new this.WebMap({
|
140
136
|
portalItem: { id }
|
141
137
|
});
|
142
|
-
this.
|
143
|
-
container: this.
|
138
|
+
this.mapView = new this.MapView({
|
139
|
+
container: this._mapDiv,
|
144
140
|
map: webMap,
|
145
141
|
// TODO consider this more...seems to cause less overflow issues when the component is resized
|
146
142
|
resizeAlign: "top-left"
|
147
143
|
});
|
148
144
|
this._loadedId = id;
|
145
|
+
this.mapChanged.emit(this.mapView);
|
149
146
|
}
|
150
147
|
}
|
151
148
|
/**
|
@@ -173,7 +170,7 @@ export class MapCard {
|
|
173
170
|
*/
|
174
171
|
_getMapPicker() {
|
175
172
|
const mapListIcon = this._mapListExpanded ? "chevron-up" : "chevron-down";
|
176
|
-
return (h("calcite-action-group", { class: "action-center width-1-6", layout: "horizontal" }, h("calcite-block", { class: "action-center block-button width-full height-full", heading: '', onClick: () => this._chooseMap() }, h("calcite-icon", { icon: "map", scale: "s", slot: "icon" }), h("calcite-icon", { icon: mapListIcon, scale: "s", slot: "icon" }), h("calcite-tooltip", { label: "", placement: "bottom" }, h("span", null, this._translations.mapName)))));
|
173
|
+
return (h("calcite-action-group", { class: "action-center width-1-6", layout: "horizontal" }, h("calcite-block", { class: "action-center block-button width-full height-full display-grid", heading: '', onClick: () => this._chooseMap() }, h("calcite-icon", { icon: "map", scale: "s", slot: "icon" }), h("calcite-icon", { icon: mapListIcon, scale: "s", slot: "icon" }), h("calcite-tooltip", { label: "", placement: "bottom" }, h("span", null, this._translations.mapName)))));
|
177
174
|
}
|
178
175
|
/**
|
179
176
|
* Get a pick list for all maps in mapInfos
|
@@ -291,13 +288,31 @@ export class MapCard {
|
|
291
288
|
"text": "IMapInfo[]: array of map infos (name and id)"
|
292
289
|
},
|
293
290
|
"defaultValue": "[]"
|
291
|
+
},
|
292
|
+
"mapView": {
|
293
|
+
"type": "unknown",
|
294
|
+
"mutable": false,
|
295
|
+
"complexType": {
|
296
|
+
"original": "__esri.MapView",
|
297
|
+
"resolved": "MapView",
|
298
|
+
"references": {
|
299
|
+
"___esri": {
|
300
|
+
"location": "global"
|
301
|
+
}
|
302
|
+
}
|
303
|
+
},
|
304
|
+
"required": false,
|
305
|
+
"optional": false,
|
306
|
+
"docs": {
|
307
|
+
"tags": [],
|
308
|
+
"text": "esri/views/View: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html"
|
309
|
+
}
|
294
310
|
}
|
295
311
|
};
|
296
312
|
}
|
297
313
|
static get states() {
|
298
314
|
return {
|
299
315
|
"_mapListExpanded": {},
|
300
|
-
"_mapView": {},
|
301
316
|
"_translations": {},
|
302
317
|
"_webMapId": {}
|
303
318
|
};
|
@@ -323,6 +338,25 @@ export class MapCard {
|
|
323
338
|
}
|
324
339
|
}
|
325
340
|
}
|
341
|
+
}, {
|
342
|
+
"method": "mapChanged",
|
343
|
+
"name": "mapChanged",
|
344
|
+
"bubbles": true,
|
345
|
+
"cancelable": true,
|
346
|
+
"composed": true,
|
347
|
+
"docs": {
|
348
|
+
"tags": [],
|
349
|
+
"text": "Emitted when a new map is loaded"
|
350
|
+
},
|
351
|
+
"complexType": {
|
352
|
+
"original": "__esri.MapView",
|
353
|
+
"resolved": "MapView",
|
354
|
+
"references": {
|
355
|
+
"___esri": {
|
356
|
+
"location": "global"
|
357
|
+
}
|
358
|
+
}
|
359
|
+
}
|
326
360
|
}];
|
327
361
|
}
|
328
362
|
static get elementRef() { return "el"; }
|
@@ -142,7 +142,7 @@ export class MapDrawTools {
|
|
142
142
|
this._sketchGraphicsLayer = this.mapView.map.layers.getItemAt(sketchIndex);
|
143
143
|
}
|
144
144
|
else {
|
145
|
-
this._sketchGraphicsLayer = new this.GraphicsLayer({ title });
|
145
|
+
this._sketchGraphicsLayer = new this.GraphicsLayer({ title, listMode: "hide" });
|
146
146
|
state.managedLayers.push(title);
|
147
147
|
this.mapView.map.layers.add(this._sketchGraphicsLayer);
|
148
148
|
}
|
@@ -361,7 +361,7 @@ export class MapSelectTools {
|
|
361
361
|
this._bufferGraphicsLayer = this.mapView.map.layers.getItemAt(bufferIndex);
|
362
362
|
}
|
363
363
|
else {
|
364
|
-
this._bufferGraphicsLayer = new this.GraphicsLayer({ title });
|
364
|
+
this._bufferGraphicsLayer = new this.GraphicsLayer({ title, listMode: "hide" });
|
365
365
|
state.managedLayers.push(title);
|
366
366
|
const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === this._translations.sketchLayer);
|
367
367
|
if (sketchIndex > -1) {
|
@@ -85,17 +85,6 @@ export class PublicNotification {
|
|
85
85
|
void this._home();
|
86
86
|
}
|
87
87
|
}
|
88
|
-
/**
|
89
|
-
* Called each time the selectionSets prop is changed.
|
90
|
-
*/
|
91
|
-
async selectionSetsWatchHandler(v, oldV) {
|
92
|
-
if (v && v !== oldV && v.length > 0) {
|
93
|
-
const nonRefineSets = v.filter(ss => ss.workflowType !== EWorkflowType.REFINE);
|
94
|
-
if (nonRefineSets.length === 0) {
|
95
|
-
this._selectionSets = [];
|
96
|
-
}
|
97
|
-
}
|
98
|
-
}
|
99
88
|
/**
|
100
89
|
* Called each time the sketchLineSymbol prop is changed.
|
101
90
|
*/
|
@@ -338,7 +327,7 @@ export class PublicNotification {
|
|
338
327
|
* @protected
|
339
328
|
*/
|
340
329
|
_getListPage() {
|
341
|
-
const hasSets = this.
|
330
|
+
const hasSets = this._hasSelections();
|
342
331
|
const total = utils.getTotal(this._selectionSets);
|
343
332
|
return hasSets ? (h("calcite-panel", null, h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "font-bold" }, this._translations.myLists)), this._getNotice(this._translations.listHasSetsTip, "padding-sides-1 padding-bottom-1"), this._getMapLayerPicker(), h("div", { class: "display-block padding-sides-1 height-1-1-2" }, h("div", { class: "display-block float-left" }, h("calcite-label", { alignment: "start", class: "font-bold" }, this._translations.notifications)), h("div", { class: "display-block float-right" }, h("calcite-input-message", { active: true, class: "info-blue margin-top-0", scale: "m" }, this._translations.uniqueCout.replace("{{n}}", total.toString())))), hasSets ? this._getSelectionSetList() : (h("div", { class: "info-message" }, h("calcite-input-message", { active: true, class: "info-blue", scale: "m" }, this._translations.noNotifications))), h("div", { class: "display-flex padding-1" }, h("calcite-button", { onClick: () => { this._setPageType(EPageType.SELECT); }, width: "full" }, this._translations.add)), this._showModal(this._showLayerSelectionChangeModal))) : (h("calcite-panel", null, h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "font-bold" }, this._translations.myLists)), h("div", { class: "padding-sides-1" }, h("calcite-label", null, this._translations.notifications)), h("div", { class: "info-message padding-bottom-1" }, h("calcite-input-message", { active: true, class: "info-blue", scale: "m" }, this._translations.noNotifications)), this._getNotice(this._translations.selectLayerAndAdd, "padding-sides-1 padding-bottom-1"), this._getMapLayerPicker(), h("div", { class: "display-flex padding-1" }, h("calcite-button", { onClick: () => { this._setPageType(EPageType.SELECT); }, width: "full" }, this._translations.add))));
|
344
333
|
}
|
@@ -363,7 +352,8 @@ export class PublicNotification {
|
|
363
352
|
// REFINE is handled seperately from the core selection sets
|
364
353
|
// You can only access after clicking the refine action
|
365
354
|
this._selectionSets.reduce((prev, cur, i) => {
|
366
|
-
|
355
|
+
const validSet = this._isValidSet(cur);
|
356
|
+
if (validSet) {
|
367
357
|
prev.push((h("calcite-list-item", { description: this._translations.selectedFeatures.replace("{{n}}", cur.selectedIds.length.toString()), label: cur.label, onClick: () => this._gotoSelection(cur, this.mapView) }, this._getAction(true, "pencil", "", (evt) => this._openSelection(cur, evt), false, "actions-end"), this._getAction(true, "x", "", (evt) => this._deleteSelection(i, evt), false, "actions-end"))));
|
368
358
|
}
|
369
359
|
return prev;
|
@@ -404,14 +394,38 @@ export class PublicNotification {
|
|
404
394
|
await this._updateAddresseeLayer(id);
|
405
395
|
}
|
406
396
|
/**
|
407
|
-
* Check if any selection sets exist.
|
397
|
+
* Check if any valid selection sets exist.
|
408
398
|
*
|
409
|
-
* @returns true if selection sets exist
|
399
|
+
* @returns true if valid selection sets exist
|
410
400
|
*
|
411
401
|
* @protected
|
412
402
|
*/
|
413
403
|
_hasSelections() {
|
414
|
-
return this._selectionSets.length > 0;
|
404
|
+
return this._selectionSets.filter(ss => this._isValidSet(ss)).length > 0;
|
405
|
+
}
|
406
|
+
/**
|
407
|
+
* Check if any duplicates exist
|
408
|
+
*
|
409
|
+
* @returns true if duplicates are found
|
410
|
+
*
|
411
|
+
* @protected
|
412
|
+
*/
|
413
|
+
_hasDuplicates() {
|
414
|
+
const selectedIds = this._selectionSets.reduce((prev, cur) => {
|
415
|
+
return prev.concat(cur.download ? cur.selectedIds : []);
|
416
|
+
}, []);
|
417
|
+
return selectedIds.length > new Set(selectedIds).size;
|
418
|
+
}
|
419
|
+
/**
|
420
|
+
* Check if a selection set is valid (exists or has at least one added if its a refine set)
|
421
|
+
*
|
422
|
+
* @returns true if selection set is valid
|
423
|
+
*
|
424
|
+
* @protected
|
425
|
+
*/
|
426
|
+
_isValidSet(ss) {
|
427
|
+
var _a, _b;
|
428
|
+
return ss.workflowType === EWorkflowType.REFINE ? ((_b = (_a = ss === null || ss === void 0 ? void 0 : ss.refineIds) === null || _a === void 0 ? void 0 : _a.addIds) === null || _b === void 0 ? void 0 : _b.length) > 0 : true;
|
415
429
|
}
|
416
430
|
/**
|
417
431
|
* Create the Select page that shows the selection workflows
|
@@ -480,7 +494,8 @@ export class PublicNotification {
|
|
480
494
|
_getDownloadPage(type) {
|
481
495
|
const isPdf = type === EExportType.PDF;
|
482
496
|
const hasSelections = this._hasSelections();
|
483
|
-
|
497
|
+
const hasDuplicates = this._hasDuplicates();
|
498
|
+
return (h("calcite-panel", null, h("div", null, h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "font-bold" }, isPdf ? this._translations.downloadPDF : this._translations.downloadCSV)), hasSelections ? (h("div", null, h("div", { class: "padding-top-sides-1" }, h("calcite-label", null, this._translations.notifications)), this._getSelectionLists(), h("div", { class: "margin-side-1 padding-top-1 border-bottom" }), h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: isPdf ? "display-none" : "", disabled: !hasDuplicates, layout: "inline" }, h("calcite-checkbox", { disabled: !hasDuplicates, ref: (el) => { this._removeDuplicatesCSV = el; } }), this._translations.removeDuplicate), h("calcite-label", { class: isPdf ? "" : "display-none", disabled: !hasDuplicates, layout: "inline" }, h("calcite-checkbox", { disabled: !hasDuplicates, ref: (el) => { this._removeDuplicatesPDF = el; } }), this._translations.removeDuplicate)), h("div", { class: isPdf ? "" : "display-none" }, this._getLabel(this._translations.selectPDFLabelOption, false), h("div", { class: "padding-sides-1" }, h("pdf-download", { disabled: !this._downloadActive, layerView: this.addresseeLayer, ref: (el) => { this._downloadTools = el; } }))), h("div", { class: "padding-1 display-flex" }, h("calcite-button", { disabled: !this._downloadActive, onClick: isPdf ? () => this._downloadPDF() : () => this._downloadCSV(), width: "full" }, isPdf ? this._translations.downloadPDF : this._translations.downloadCSV)))) : (this._getNotice(this._translations.downloadNoLists, "padding-sides-1 padding-bottom-1")))));
|
484
499
|
}
|
485
500
|
/**
|
486
501
|
* Create the stacked navigation buttons for a page
|
@@ -530,7 +545,8 @@ export class PublicNotification {
|
|
530
545
|
*/
|
531
546
|
_getSelectionLists() {
|
532
547
|
return this._selectionSets.reduce((prev, cur) => {
|
533
|
-
|
548
|
+
const validSet = this._isValidSet(cur);
|
549
|
+
if (validSet) {
|
534
550
|
if (!this._downloadActive && cur.download) {
|
535
551
|
this._downloadActive = true;
|
536
552
|
}
|
@@ -693,7 +709,7 @@ export class PublicNotification {
|
|
693
709
|
* @protected
|
694
710
|
*/
|
695
711
|
async _updateSelectionSets(layerView) {
|
696
|
-
const _selectionSets = this._selectionSets
|
712
|
+
const _selectionSets = this._selectionSets;
|
697
713
|
const oidDefs = [];
|
698
714
|
_selectionSets.forEach(selectionSet => {
|
699
715
|
selectionSet.layerView = layerView;
|
@@ -777,11 +793,16 @@ export class PublicNotification {
|
|
777
793
|
*/
|
778
794
|
_openSelection(selectionSet, evt) {
|
779
795
|
evt.stopPropagation();
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
796
|
+
if (selectionSet.workflowType === EWorkflowType.REFINE) {
|
797
|
+
this._pageType = EPageType.REFINE;
|
798
|
+
}
|
799
|
+
else {
|
800
|
+
this._activeSelection = selectionSet;
|
801
|
+
this._distance = this._activeSelection.distance;
|
802
|
+
this._unit = this._activeSelection.unit;
|
803
|
+
this._customLabel = this._activeSelection.label;
|
804
|
+
this._pageType = EPageType.SELECT;
|
805
|
+
}
|
785
806
|
}
|
786
807
|
/**
|
787
808
|
* Highlight any selected features in the map
|
@@ -1217,9 +1238,6 @@ export class PublicNotification {
|
|
1217
1238
|
}, {
|
1218
1239
|
"propName": "searchConfiguration",
|
1219
1240
|
"methodName": "watchSearchConfigurationHandler"
|
1220
|
-
}, {
|
1221
|
-
"propName": "_selectionSets",
|
1222
|
-
"methodName": "selectionSetsWatchHandler"
|
1223
1241
|
}, {
|
1224
1242
|
"propName": "sketchLineSymbol",
|
1225
1243
|
"methodName": "sketchLineSymbolWatchHandler"
|
@@ -205,7 +205,7 @@ export class RefineSelectionTools {
|
|
205
205
|
this._sketchGraphicsLayer = this.mapView.map.layers.getItemAt(sketchIndex);
|
206
206
|
}
|
207
207
|
else {
|
208
|
-
this._sketchGraphicsLayer = new this.GraphicsLayer({ title });
|
208
|
+
this._sketchGraphicsLayer = new this.GraphicsLayer({ title, listMode: "hide" });
|
209
209
|
state.managedLayers.push(title);
|
210
210
|
this.mapView.map.layers.add(this._sketchGraphicsLayer);
|
211
211
|
}
|
@@ -22,26 +22,9 @@
|
|
22
22
|
| limitations under the License.
|
23
23
|
-->
|
24
24
|
<style>
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
height: 100%;
|
29
|
-
width: 100%;
|
30
|
-
}
|
31
|
-
.over-map {
|
32
|
-
position: absolute;
|
33
|
-
right: 0px;
|
34
|
-
background-color: var(--calcite-ui-foreground-1);
|
35
|
-
}
|
36
|
-
.column {
|
37
|
-
min-width: 300px;
|
38
|
-
padding: 1rem;
|
39
|
-
border: 1px solid var(--calcite-ui-border-2);
|
40
|
-
height: -webkit-fill-available;
|
41
|
-
height: 100%;
|
42
|
-
}
|
43
|
-
.column[dir="rtl"] {
|
44
|
-
float: left;
|
25
|
+
.crowdsource {
|
26
|
+
height: 100vh;
|
27
|
+
width: 100vw;
|
45
28
|
}
|
46
29
|
</style>
|
47
30
|
|
@@ -56,30 +39,20 @@
|
|
56
39
|
<script type="module" src="../solutions-components.esm.js"></script>
|
57
40
|
|
58
41
|
<script>
|
59
|
-
|
60
|
-
WebMap,
|
61
|
-
MapView
|
62
|
-
) => {
|
63
|
-
var webMap = new WebMap({
|
64
|
-
portalItem: {
|
65
|
-
// solutions
|
66
|
-
// id: "3715f4899bea4b2a948347c5c2357e58"
|
67
|
-
// InstantApps
|
68
|
-
id: "863e4f6f2a7840db896cc1b1606d552d"
|
69
|
-
}
|
70
|
-
});
|
71
|
-
|
42
|
+
function addValues() {
|
72
43
|
const demo = document.getElementById("demo");
|
73
|
-
demo.
|
74
|
-
|
75
|
-
|
76
|
-
}
|
77
|
-
|
44
|
+
demo.mapInfos = [{
|
45
|
+
id: "863e4f6f2a7840db896cc1b1606d552d",
|
46
|
+
name: "Name of map 1"
|
47
|
+
}, {
|
48
|
+
id: "3715f4899bea4b2a948347c5c2357e58",
|
49
|
+
name: "Name of map 2"
|
50
|
+
}];
|
51
|
+
}
|
78
52
|
</script>
|
79
53
|
</head>
|
80
54
|
|
81
|
-
<body>
|
82
|
-
<
|
83
|
-
<crowdsource-manager id="demo" class="over-map column"></crowdsource-manager>
|
55
|
+
<body onload="addValues()">
|
56
|
+
<crowdsource-manager id="demo" class="crowdsource"/>
|
84
57
|
</body>
|
85
58
|
</html>
|