@esri/solutions-components 0.5.0 → 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 +88 -92
- 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} +131 -5
- 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 +19 -17
- 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-415ab342.js → downloadUtils-9359e9ff.js} +135 -44
- package/dist/cjs/{index.es-98008aa0.js → index.es-9c0d0ed6.js} +3 -3
- 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 +1 -1
- package/dist/cjs/{mapViewUtils-f617ae9a.js → mapViewUtils-090f4d4d.js} +3 -3
- package/dist/cjs/public-notification.cjs.entry.js +173 -48
- 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 +1 -1
- 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 +4 -8
- package/dist/collection/components/map-select-tools/map-select-tools.js +75 -15
- package/dist/collection/components/public-notification/public-notification.js +217 -25
- 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/queryUtils.js +2 -2
- package/dist/collection/utils/queryUtils.ts +2 -2
- 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 +19 -23
- package/dist/components/map-layer-picker2.js +1 -1
- package/dist/components/map-select-tools2.js +21 -16
- package/dist/components/public-notification.js +209 -81
- package/dist/components/queryUtils.js +2 -2
- 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 +79 -83
- 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} +134 -9
- 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 +19 -17
- 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-606b0f0e.js → downloadUtils-a8f139c5.js} +135 -44
- package/dist/esm/{index.es-c736c805.js → index.es-a75412ff.js} +3 -3
- 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 +1 -1
- package/dist/esm/{mapViewUtils-4e945e07.js → mapViewUtils-8ffcd36d.js} +4 -4
- package/dist/esm/public-notification.entry.js +169 -44
- 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 +1 -1
- 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-4f5641b4.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-72117a18.js → p-765a27f3.js} +1 -1
- 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-6a657ff6.js → p-bb64bd47.js} +25 -9
- package/dist/solutions-components/p-c392dd95.entry.js +17 -0
- 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-dc53c9c1.js +36 -0
- 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/queryUtils.ts +2 -2
- 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/map-select-tools/map-select-tools.d.ts +16 -1
- package/dist/types/components/public-notification/public-notification.d.ts +86 -4
- package/dist/types/components.d.ts +68 -0
- 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-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-5ee7b022.entry.js +0 -12
- 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-84bbaebf.entry.js +0 -6
- package/dist/solutions-components/p-88e28de2.js +0 -36
- package/dist/solutions-components/p-a57ef371.entry.js +0 -6
- package/dist/solutions-components/p-ac76d270.entry.js +0 -17
- package/dist/solutions-components/p-dbc9a5a8.js +0 -21
- package/dist/solutions-components/p-e162304e.entry.js +0 -6
- package/dist/solutions-components/p-f5c70be2.entry.js +0 -6
- package/dist/solutions-components/p-f6b17cc6.entry.js +0 -11
@@ -0,0 +1,429 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
7
|
+
import { l as loadModules } from './loadModules.js';
|
8
|
+
import { g as getLocaleComponentStrings } from './locale.js';
|
9
|
+
import { b as getMapLayerIds, g as getMapLayerView, a as goToSelection, d as defineCustomElement$1 } from './map-layer-picker2.js';
|
10
|
+
import { q as queryAllFeatures } from './queryUtils.js';
|
11
|
+
import { d as downloadCSV } from './downloadUtils.js';
|
12
|
+
import { d as defineCustomElement$n } from './action.js';
|
13
|
+
import { d as defineCustomElement$m } from './action-menu.js';
|
14
|
+
import { d as defineCustomElement$l } from './button.js';
|
15
|
+
import { d as defineCustomElement$k } from './chip.js';
|
16
|
+
import { d as defineCustomElement$j } from './combobox.js';
|
17
|
+
import { d as defineCustomElement$i } from './combobox-item.js';
|
18
|
+
import { d as defineCustomElement$h } from './dropdown.js';
|
19
|
+
import { d as defineCustomElement$g } from './dropdown-group.js';
|
20
|
+
import { d as defineCustomElement$f } from './dropdown-item.js';
|
21
|
+
import { d as defineCustomElement$e } from './icon.js';
|
22
|
+
import { d as defineCustomElement$d } from './input.js';
|
23
|
+
import { d as defineCustomElement$c } from './label.js';
|
24
|
+
import { d as defineCustomElement$b } from './loader.js';
|
25
|
+
import { d as defineCustomElement$a } from './modal.js';
|
26
|
+
import { d as defineCustomElement$9 } from './option.js';
|
27
|
+
import { d as defineCustomElement$8 } from './panel.js';
|
28
|
+
import { d as defineCustomElement$7 } from './popover.js';
|
29
|
+
import { d as defineCustomElement$6 } from './progress.js';
|
30
|
+
import { d as defineCustomElement$5 } from './scrim.js';
|
31
|
+
import { d as defineCustomElement$4 } from './select.js';
|
32
|
+
import { d as defineCustomElement$3 } from './split-button.js';
|
33
|
+
import { d as defineCustomElement$2 } from './edit-record-modal2.js';
|
34
|
+
|
35
|
+
const layerTableCss = ":host{display:block}.table-div{height:calc(100% - 35px)}.display-flex{display:flex}.table-border{border:1px solid var(--calcite-ui-border-2)}";
|
36
|
+
|
37
|
+
const LayerTable = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
38
|
+
constructor() {
|
39
|
+
super();
|
40
|
+
this.__registerHost();
|
41
|
+
/**
|
42
|
+
* string[]: List of field names to display
|
43
|
+
*/
|
44
|
+
this._fieldNames = [];
|
45
|
+
/**
|
46
|
+
* esri/Graphic[]: https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html
|
47
|
+
*/
|
48
|
+
this._graphics = [];
|
49
|
+
/**
|
50
|
+
* Store a reference to the table node after it's first created
|
51
|
+
* and initializes the FeatureTable
|
52
|
+
*
|
53
|
+
* @returns void
|
54
|
+
*/
|
55
|
+
this.onTableNodeCreate = (node) => {
|
56
|
+
this._tableNode = node;
|
57
|
+
this._getTable(node);
|
58
|
+
};
|
59
|
+
this.mapView = undefined;
|
60
|
+
this._layerView = undefined;
|
61
|
+
this._selectedIndexes = [];
|
62
|
+
this._translations = undefined;
|
63
|
+
}
|
64
|
+
//--------------------------------------------------------------------------
|
65
|
+
//
|
66
|
+
// Watch handlers
|
67
|
+
//
|
68
|
+
//--------------------------------------------------------------------------
|
69
|
+
async mapViewWatchHandler() {
|
70
|
+
const mapLayerIds = await getMapLayerIds(this.mapView);
|
71
|
+
this._layerView = await getMapLayerView(this.mapView, mapLayerIds[0]);
|
72
|
+
}
|
73
|
+
//--------------------------------------------------------------------------
|
74
|
+
//
|
75
|
+
// Methods (public)
|
76
|
+
//
|
77
|
+
//--------------------------------------------------------------------------
|
78
|
+
//--------------------------------------------------------------------------
|
79
|
+
//
|
80
|
+
// Events (public)
|
81
|
+
//
|
82
|
+
//--------------------------------------------------------------------------
|
83
|
+
//--------------------------------------------------------------------------
|
84
|
+
//
|
85
|
+
// Functions (lifecycle)
|
86
|
+
//
|
87
|
+
//--------------------------------------------------------------------------
|
88
|
+
/**
|
89
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
90
|
+
*
|
91
|
+
* @returns Promise when complete
|
92
|
+
*/
|
93
|
+
async componentWillLoad() {
|
94
|
+
await this._getTranslations();
|
95
|
+
await this._initModules();
|
96
|
+
}
|
97
|
+
/**
|
98
|
+
* Renders the component.
|
99
|
+
*/
|
100
|
+
render() {
|
101
|
+
if (!this._layerView) {
|
102
|
+
return null;
|
103
|
+
}
|
104
|
+
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 })));
|
105
|
+
}
|
106
|
+
//--------------------------------------------------------------------------
|
107
|
+
//
|
108
|
+
// Functions (protected)
|
109
|
+
//
|
110
|
+
//--------------------------------------------------------------------------
|
111
|
+
/**
|
112
|
+
* Load esri javascript api modules
|
113
|
+
*
|
114
|
+
* @returns Promise resolving when function is done
|
115
|
+
*
|
116
|
+
* @protected
|
117
|
+
*/
|
118
|
+
async _initModules() {
|
119
|
+
const [FeatureTable] = await loadModules([
|
120
|
+
"esri/widgets/FeatureTable"
|
121
|
+
]);
|
122
|
+
this.FeatureTable = FeatureTable;
|
123
|
+
}
|
124
|
+
/**
|
125
|
+
* Gets a row of controls that can be used for various interactions with the table
|
126
|
+
*
|
127
|
+
* @returns The dom node that contains the controls
|
128
|
+
*/
|
129
|
+
_getTableControlRow() {
|
130
|
+
const featuresSelected = this._selectedIndexes.length > 0;
|
131
|
+
const multiFeaturesSelected = this._selectedIndexes.length > 1;
|
132
|
+
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))))));
|
133
|
+
}
|
134
|
+
/**
|
135
|
+
* Initialize the FeatureTable
|
136
|
+
*
|
137
|
+
* @returns void
|
138
|
+
*/
|
139
|
+
_getTable(node) {
|
140
|
+
var _a;
|
141
|
+
if ((_a = this._layerView) === null || _a === void 0 ? void 0 : _a.layer) {
|
142
|
+
this._table = new this.FeatureTable({
|
143
|
+
layer: this._layerView.layer,
|
144
|
+
view: this.mapView,
|
145
|
+
editingEnabled: true,
|
146
|
+
highlightOnRowSelectEnabled: true,
|
147
|
+
multiSortEnabled: false,
|
148
|
+
visibleElements: {
|
149
|
+
header: false,
|
150
|
+
menu: false
|
151
|
+
},
|
152
|
+
container: node
|
153
|
+
});
|
154
|
+
}
|
155
|
+
}
|
156
|
+
/**
|
157
|
+
* Select or deselect all rows
|
158
|
+
*
|
159
|
+
* @param checked When true all rows will be selected
|
160
|
+
*
|
161
|
+
* @returns void
|
162
|
+
*/
|
163
|
+
_selectAll(checked) {
|
164
|
+
this._selectedIndexes = checked ? this._graphics.map((_g, i) => i) : [];
|
165
|
+
}
|
166
|
+
// need to discuss with team
|
167
|
+
_showSelected() {
|
168
|
+
console.log("_showSelected");
|
169
|
+
}
|
170
|
+
/**
|
171
|
+
* Clears the selected indexes
|
172
|
+
*
|
173
|
+
* @returns void
|
174
|
+
*/
|
175
|
+
_clearSelection() {
|
176
|
+
this._selectedIndexes = [];
|
177
|
+
}
|
178
|
+
/**
|
179
|
+
* Select all rows that are not currently selectd
|
180
|
+
*
|
181
|
+
* @returns void
|
182
|
+
*/
|
183
|
+
_switchSelected() {
|
184
|
+
const currentIndexes = [...this._selectedIndexes];
|
185
|
+
this._selectedIndexes = this._graphics.reduce((prev, _cur, i) => {
|
186
|
+
if (currentIndexes.indexOf(i) < 0) {
|
187
|
+
prev.push(i);
|
188
|
+
}
|
189
|
+
return prev;
|
190
|
+
}, []);
|
191
|
+
}
|
192
|
+
/**
|
193
|
+
* Export all selected rows as CSV
|
194
|
+
*
|
195
|
+
* @returns a promise that will resolve when the operation is complete
|
196
|
+
*/
|
197
|
+
async _exportToCSV() {
|
198
|
+
return downloadCSV([], this._layerView.layer, this._getSelectedIds(), false, // formatUsingLayerPopup
|
199
|
+
false, // removeDuplicates
|
200
|
+
true);
|
201
|
+
}
|
202
|
+
/**
|
203
|
+
* Zoom to all selected features
|
204
|
+
*
|
205
|
+
* @returns a promise that will resolve when the operation is complete
|
206
|
+
*/
|
207
|
+
_zoom() {
|
208
|
+
const ids = this._getSelectedIds();
|
209
|
+
void goToSelection(ids, this._layerView, this.mapView, true);
|
210
|
+
}
|
211
|
+
/**
|
212
|
+
* Open the edit multiple modal
|
213
|
+
*
|
214
|
+
* @returns void
|
215
|
+
*/
|
216
|
+
_editMultiple() {
|
217
|
+
this._editMultipleMpdal.open = true;
|
218
|
+
}
|
219
|
+
/**
|
220
|
+
* Delete all selected records
|
221
|
+
*
|
222
|
+
* @returns a promise that will resolve when the operation is complete
|
223
|
+
*/
|
224
|
+
_delete() {
|
225
|
+
console.log("delete");
|
226
|
+
}
|
227
|
+
/**
|
228
|
+
* Get the graphics for all selected indexes
|
229
|
+
*
|
230
|
+
* @param indexes the indexes for the graphics to fetch
|
231
|
+
*
|
232
|
+
* @returns An array of selected graphics
|
233
|
+
*/
|
234
|
+
_getGraphics(indexes) {
|
235
|
+
return this._graphics.filter((_g, i) => indexes.indexOf(i) > -1);
|
236
|
+
}
|
237
|
+
/**
|
238
|
+
* Gets the object ids for all selected rows
|
239
|
+
*
|
240
|
+
* @returns An array of object ids
|
241
|
+
*/
|
242
|
+
_getSelectedIds() {
|
243
|
+
const graphics = this._getGraphics(this._selectedIndexes);
|
244
|
+
return graphics.map(g => g.getObjectId());
|
245
|
+
}
|
246
|
+
/**
|
247
|
+
* Update the selected indexes based on the current row
|
248
|
+
*
|
249
|
+
* @param index the index of the selected row
|
250
|
+
*
|
251
|
+
* @returns void
|
252
|
+
*/
|
253
|
+
_rowSelected(index) {
|
254
|
+
const indexOfSelected = this._selectedIndexes.indexOf(index);
|
255
|
+
if (indexOfSelected > -1) {
|
256
|
+
this._selectedIndexes.splice(indexOfSelected, 1);
|
257
|
+
this._selectedIndexes = [...this._selectedIndexes];
|
258
|
+
}
|
259
|
+
else {
|
260
|
+
this._selectedIndexes = [...this._selectedIndexes, index];
|
261
|
+
}
|
262
|
+
}
|
263
|
+
/**
|
264
|
+
* Handles layer selection change to show new table
|
265
|
+
*
|
266
|
+
* @returns a promise that will resolve when the operation is complete
|
267
|
+
*/
|
268
|
+
async _layerSelectionChanged(evt) {
|
269
|
+
const layerName = evt.detail[0];
|
270
|
+
this._layerView = await getMapLayerView(this.mapView, layerName);
|
271
|
+
// TODO rethink this...when we use later we need to be able to lookup with name
|
272
|
+
this._fieldNames = this._layerView.layer.fields.map(f => f.alias || f.name);
|
273
|
+
this._graphics = await queryAllFeatures(0, this._layerView.layer, []);
|
274
|
+
this._selectedIndexes = [];
|
275
|
+
this._table.layer = this._layerView.layer;
|
276
|
+
this._table.render();
|
277
|
+
}
|
278
|
+
/**
|
279
|
+
* Fetches the component's translations
|
280
|
+
*
|
281
|
+
* @returns Promise when complete
|
282
|
+
* @protected
|
283
|
+
*/
|
284
|
+
async _getTranslations() {
|
285
|
+
const messages = await getLocaleComponentStrings(this.el);
|
286
|
+
this._translations = messages[0];
|
287
|
+
}
|
288
|
+
get el() { return this; }
|
289
|
+
static get watchers() { return {
|
290
|
+
"mapView": ["mapViewWatchHandler"]
|
291
|
+
}; }
|
292
|
+
static get style() { return layerTableCss; }
|
293
|
+
}, [0, "layer-table", {
|
294
|
+
"mapView": [16],
|
295
|
+
"_layerView": [32],
|
296
|
+
"_selectedIndexes": [32],
|
297
|
+
"_translations": [32]
|
298
|
+
}]);
|
299
|
+
function defineCustomElement() {
|
300
|
+
if (typeof customElements === "undefined") {
|
301
|
+
return;
|
302
|
+
}
|
303
|
+
const components = ["layer-table", "calcite-action", "calcite-action-menu", "calcite-button", "calcite-chip", "calcite-combobox", "calcite-combobox-item", "calcite-dropdown", "calcite-dropdown-group", "calcite-dropdown-item", "calcite-icon", "calcite-input", "calcite-label", "calcite-loader", "calcite-modal", "calcite-option", "calcite-panel", "calcite-popover", "calcite-progress", "calcite-scrim", "calcite-select", "calcite-split-button", "edit-record-modal", "map-layer-picker"];
|
304
|
+
components.forEach(tagName => { switch (tagName) {
|
305
|
+
case "layer-table":
|
306
|
+
if (!customElements.get(tagName)) {
|
307
|
+
customElements.define(tagName, LayerTable);
|
308
|
+
}
|
309
|
+
break;
|
310
|
+
case "calcite-action":
|
311
|
+
if (!customElements.get(tagName)) {
|
312
|
+
defineCustomElement$n();
|
313
|
+
}
|
314
|
+
break;
|
315
|
+
case "calcite-action-menu":
|
316
|
+
if (!customElements.get(tagName)) {
|
317
|
+
defineCustomElement$m();
|
318
|
+
}
|
319
|
+
break;
|
320
|
+
case "calcite-button":
|
321
|
+
if (!customElements.get(tagName)) {
|
322
|
+
defineCustomElement$l();
|
323
|
+
}
|
324
|
+
break;
|
325
|
+
case "calcite-chip":
|
326
|
+
if (!customElements.get(tagName)) {
|
327
|
+
defineCustomElement$k();
|
328
|
+
}
|
329
|
+
break;
|
330
|
+
case "calcite-combobox":
|
331
|
+
if (!customElements.get(tagName)) {
|
332
|
+
defineCustomElement$j();
|
333
|
+
}
|
334
|
+
break;
|
335
|
+
case "calcite-combobox-item":
|
336
|
+
if (!customElements.get(tagName)) {
|
337
|
+
defineCustomElement$i();
|
338
|
+
}
|
339
|
+
break;
|
340
|
+
case "calcite-dropdown":
|
341
|
+
if (!customElements.get(tagName)) {
|
342
|
+
defineCustomElement$h();
|
343
|
+
}
|
344
|
+
break;
|
345
|
+
case "calcite-dropdown-group":
|
346
|
+
if (!customElements.get(tagName)) {
|
347
|
+
defineCustomElement$g();
|
348
|
+
}
|
349
|
+
break;
|
350
|
+
case "calcite-dropdown-item":
|
351
|
+
if (!customElements.get(tagName)) {
|
352
|
+
defineCustomElement$f();
|
353
|
+
}
|
354
|
+
break;
|
355
|
+
case "calcite-icon":
|
356
|
+
if (!customElements.get(tagName)) {
|
357
|
+
defineCustomElement$e();
|
358
|
+
}
|
359
|
+
break;
|
360
|
+
case "calcite-input":
|
361
|
+
if (!customElements.get(tagName)) {
|
362
|
+
defineCustomElement$d();
|
363
|
+
}
|
364
|
+
break;
|
365
|
+
case "calcite-label":
|
366
|
+
if (!customElements.get(tagName)) {
|
367
|
+
defineCustomElement$c();
|
368
|
+
}
|
369
|
+
break;
|
370
|
+
case "calcite-loader":
|
371
|
+
if (!customElements.get(tagName)) {
|
372
|
+
defineCustomElement$b();
|
373
|
+
}
|
374
|
+
break;
|
375
|
+
case "calcite-modal":
|
376
|
+
if (!customElements.get(tagName)) {
|
377
|
+
defineCustomElement$a();
|
378
|
+
}
|
379
|
+
break;
|
380
|
+
case "calcite-option":
|
381
|
+
if (!customElements.get(tagName)) {
|
382
|
+
defineCustomElement$9();
|
383
|
+
}
|
384
|
+
break;
|
385
|
+
case "calcite-panel":
|
386
|
+
if (!customElements.get(tagName)) {
|
387
|
+
defineCustomElement$8();
|
388
|
+
}
|
389
|
+
break;
|
390
|
+
case "calcite-popover":
|
391
|
+
if (!customElements.get(tagName)) {
|
392
|
+
defineCustomElement$7();
|
393
|
+
}
|
394
|
+
break;
|
395
|
+
case "calcite-progress":
|
396
|
+
if (!customElements.get(tagName)) {
|
397
|
+
defineCustomElement$6();
|
398
|
+
}
|
399
|
+
break;
|
400
|
+
case "calcite-scrim":
|
401
|
+
if (!customElements.get(tagName)) {
|
402
|
+
defineCustomElement$5();
|
403
|
+
}
|
404
|
+
break;
|
405
|
+
case "calcite-select":
|
406
|
+
if (!customElements.get(tagName)) {
|
407
|
+
defineCustomElement$4();
|
408
|
+
}
|
409
|
+
break;
|
410
|
+
case "calcite-split-button":
|
411
|
+
if (!customElements.get(tagName)) {
|
412
|
+
defineCustomElement$3();
|
413
|
+
}
|
414
|
+
break;
|
415
|
+
case "edit-record-modal":
|
416
|
+
if (!customElements.get(tagName)) {
|
417
|
+
defineCustomElement$2();
|
418
|
+
}
|
419
|
+
break;
|
420
|
+
case "map-layer-picker":
|
421
|
+
if (!customElements.get(tagName)) {
|
422
|
+
defineCustomElement$1();
|
423
|
+
}
|
424
|
+
break;
|
425
|
+
} });
|
426
|
+
}
|
427
|
+
defineCustomElement();
|
428
|
+
|
429
|
+
export { LayerTable as L, defineCustomElement as d };
|