@esri/solutions-components 0.7.9 → 0.7.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/basemap-gallery_7.cjs.entry.js +1 -1
- package/dist/cjs/calcite-alert_3.cjs.entry.js +1 -1
- package/dist/cjs/calcite-combobox_6.cjs.entry.js +1 -1
- package/dist/cjs/card-manager_3.cjs.entry.js +134 -17
- package/dist/cjs/{downloadUtils-95e4a5b2.js → downloadUtils-8f50633d.js} +2 -2
- package/dist/cjs/{index.es-a88403f8.js → index.es-140aa937.js} +2 -2
- package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
- package/dist/cjs/{mapViewUtils-b7d9e71c.js → mapViewUtils-569e9644.js} +17 -0
- package/dist/cjs/public-notification.cjs.entry.js +2 -2
- package/dist/collection/components/layer-table/layer-table.js +133 -16
- package/dist/collection/components/map-picker/map-picker.js +1 -1
- package/dist/collection/demos/crowdsource-manager.html +2 -2
- package/dist/collection/utils/queryUtils.js +16 -0
- package/dist/collection/utils/queryUtils.ts +21 -0
- package/dist/components/layer-table2.js +133 -16
- package/dist/components/map-picker2.js +1 -1
- package/dist/components/map-select-tools2.js +1 -1
- package/dist/components/queryUtils.js +17 -1
- package/dist/components/refine-selection2.js +1 -1
- package/dist/esm/basemap-gallery_7.entry.js +1 -1
- package/dist/esm/calcite-alert_3.entry.js +1 -1
- package/dist/esm/calcite-combobox_6.entry.js +1 -1
- package/dist/esm/card-manager_3.entry.js +134 -17
- package/dist/esm/{downloadUtils-83dd2143.js → downloadUtils-9dee8bc0.js} +2 -2
- package/dist/esm/{index.es-0c98e2f3.js → index.es-54e86c8e.js} +2 -2
- package/dist/esm/map-select-tools_3.entry.js +2 -2
- package/dist/esm/{mapViewUtils-3ff1c264.js → mapViewUtils-066602d5.js} +17 -1
- package/dist/esm/public-notification.entry.js +2 -2
- package/dist/solutions-components/demos/crowdsource-manager.html +2 -2
- package/dist/solutions-components/{p-a9bbd352.entry.js → p-13bfc206.entry.js} +1 -1
- package/dist/solutions-components/{p-d6050d57.js → p-1bdd64a0.js} +2 -2
- package/dist/solutions-components/{p-b7e2c75b.js → p-531d91d6.js} +1 -1
- package/dist/solutions-components/{p-dcd6e7b9.entry.js → p-6656c53e.entry.js} +1 -1
- package/dist/solutions-components/{p-a5d924a9.entry.js → p-683cded6.entry.js} +1 -1
- package/dist/solutions-components/{p-95ebc2e5.entry.js → p-c2b20b85.entry.js} +1 -1
- package/dist/solutions-components/p-c7ff24df.entry.js +6 -0
- package/dist/solutions-components/{p-b030a151.js → p-dfdb8411.js} +1 -1
- package/dist/solutions-components/p-ffae568b.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/queryUtils.ts +21 -0
- package/dist/types/components/layer-table/layer-table.d.ts +40 -1
- package/dist/types/utils/queryUtils.d.ts +11 -0
- package/package.json +1 -1
- package/dist/solutions-components/p-c556ed60.entry.js +0 -6
- package/dist/solutions-components/p-c9b4d52f.entry.js +0 -6
@@ -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
|
*
|
@@ -7,7 +7,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
|
|
7
7
|
import { l as loadModules } from './loadModules.js';
|
8
8
|
import { g as getLocaleComponentStrings } from './locale.js';
|
9
9
|
import { b as goToSelection, g as getLayerOrTable } from './mapViewUtils.js';
|
10
|
-
import { b as
|
10
|
+
import { b as queryFeatureIds, c as queryAllIds, d as queryFeaturesByGlobalID } from './queryUtils.js';
|
11
11
|
import { d as downloadCSV } from './downloadUtils.js';
|
12
12
|
import { d as defineCustomElement$C } from './action.js';
|
13
13
|
import { d as defineCustomElement$B } from './action-bar.js';
|
@@ -59,6 +59,10 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
|
|
59
59
|
* number[]: A list of all IDs for the current layer
|
60
60
|
*/
|
61
61
|
this._allIds = [];
|
62
|
+
/**
|
63
|
+
* boolean: When true the ctrl key is currently pressed
|
64
|
+
*/
|
65
|
+
this._ctrlIsPressed = false;
|
62
66
|
/**
|
63
67
|
* boolean: When true the default global id provided via url param has been honored and should now be ignored
|
64
68
|
*/
|
@@ -67,6 +71,14 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
|
|
67
71
|
* boolean: When true the default OID provided via url param has been honored and should now be ignored
|
68
72
|
*/
|
69
73
|
this._defaultOidHonored = false;
|
74
|
+
/**
|
75
|
+
* boolean: When true the shift key is currently pressed
|
76
|
+
*/
|
77
|
+
this._shiftIsPressed = false;
|
78
|
+
/**
|
79
|
+
* boolean: When true any onChange handeling will be skipped
|
80
|
+
*/
|
81
|
+
this._skipOnChange = false;
|
70
82
|
/**
|
71
83
|
* bool: When true the table is being sorted
|
72
84
|
*/
|
@@ -271,6 +283,8 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
|
|
271
283
|
async componentDidLoad() {
|
272
284
|
this._resizeObserver.observe(this._toolbar);
|
273
285
|
document.onclick = (e) => this._handleDocumentClick(e);
|
286
|
+
document.onkeydown = (e) => this._handleKeyDown(e);
|
287
|
+
document.onkeyup = (e) => this._handleKeyUp(e);
|
274
288
|
}
|
275
289
|
/**
|
276
290
|
* Called after the component is rendered
|
@@ -750,18 +764,8 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
|
|
750
764
|
this._initColumnsInfo();
|
751
765
|
this._checkEditEnabled();
|
752
766
|
await this._table.when(() => {
|
753
|
-
this._table.highlightIds.on("change", () => {
|
754
|
-
|
755
|
-
this._selectedIndexes = this._table.highlightIds.toArray().reverse();
|
756
|
-
if (this._showOnlySelected) {
|
757
|
-
if (this._featuresSelected()) {
|
758
|
-
this._table.filterBySelection();
|
759
|
-
}
|
760
|
-
else {
|
761
|
-
this._toggleShowSelected();
|
762
|
-
}
|
763
|
-
}
|
764
|
-
this.featureSelectionChange.emit(this._selectedIndexes);
|
767
|
+
this._table.highlightIds.on("change", (evt) => {
|
768
|
+
void this._handleOnChange(evt);
|
765
769
|
});
|
766
770
|
this.reactiveUtils.watch(() => this._table.activeSortOrders, (sortOrders) => {
|
767
771
|
var _a, _b, _c, _d;
|
@@ -771,6 +775,93 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
|
|
771
775
|
});
|
772
776
|
}
|
773
777
|
}
|
778
|
+
async _handleOnChange(evt) {
|
779
|
+
const ids = [...this._table.highlightIds.toArray()];
|
780
|
+
if (!this._skipOnChange) {
|
781
|
+
if (!this._ctrlIsPressed && !this._shiftIsPressed) {
|
782
|
+
if (this._selectedIndexes.length > 0) {
|
783
|
+
this._skipOnChange = true;
|
784
|
+
// only readd in specific case where we have multiple selected and then click one of the currently selected
|
785
|
+
const reAdd = this._selectedIndexes.length > 1 && evt.removed.length === 1;
|
786
|
+
const newIndexes = reAdd ? evt.removed : ids.filter(id => this._selectedIndexes.indexOf(id) < 0);
|
787
|
+
this._clearSelection();
|
788
|
+
this._selectedIndexes = [...newIndexes];
|
789
|
+
if (newIndexes.length > 0) {
|
790
|
+
this._table.highlightIds.add(newIndexes[0]);
|
791
|
+
}
|
792
|
+
}
|
793
|
+
else {
|
794
|
+
// https://github.com/Esri/solutions-components/issues/365
|
795
|
+
this._selectedIndexes = ids.reverse();
|
796
|
+
}
|
797
|
+
}
|
798
|
+
else if (this._ctrlIsPressed) {
|
799
|
+
this._selectedIndexes = ids.reverse();
|
800
|
+
}
|
801
|
+
else if (this._shiftIsPressed) {
|
802
|
+
this._skipOnChange = true;
|
803
|
+
this._previousCurrentId = this._currentId;
|
804
|
+
this._currentId = [...this._table.highlightIds.toArray()].reverse()[0];
|
805
|
+
if (this._previousCurrentId !== this._currentId) {
|
806
|
+
// query the layer based on current sort and filters then grab between the current id and previous id
|
807
|
+
const orderBy = this._table.activeSortOrders.reduce((prev, cur) => {
|
808
|
+
prev.push(`${cur.fieldName} ${cur.direction}`);
|
809
|
+
return prev;
|
810
|
+
}, []);
|
811
|
+
const oids = await queryFeatureIds(this._layer, this._layer.definitionExpression, orderBy);
|
812
|
+
let isBetween = false;
|
813
|
+
const _start = this._table.viewModel.getObjectIdIndex(this._previousCurrentId);
|
814
|
+
const _end = this._table.viewModel.getObjectIdIndex(this._currentId);
|
815
|
+
const startIndex = _start < _end ? _start : _end;
|
816
|
+
const endIndex = _end > _start ? _end : _start;
|
817
|
+
this._selectedIndexes = oids.reduce((prev, cur) => {
|
818
|
+
const id = cur;
|
819
|
+
const index = this._table.viewModel.getObjectIdIndex(id);
|
820
|
+
if ((id === this._currentId || id === this._previousCurrentId)) {
|
821
|
+
isBetween = !isBetween;
|
822
|
+
if (prev.indexOf(id) < 0) {
|
823
|
+
prev.push(id);
|
824
|
+
}
|
825
|
+
}
|
826
|
+
// The oids are sorted so after we have reached the start or end oid add all ids even if the index is -1.
|
827
|
+
// Index of -1 will occur for features between the start and and oid if
|
828
|
+
// you select a row then scroll faster than the FeatureTable loads the data to select the next id
|
829
|
+
if (isBetween && prev.indexOf(id) < 0) {
|
830
|
+
prev.push(id);
|
831
|
+
}
|
832
|
+
// Also add index based check.
|
833
|
+
// In some cases the FeatureTable and Layer query will have differences in how null/undefined field values are sorted
|
834
|
+
if ((this._selectedIndexes.indexOf(id) > -1 || (index >= startIndex && index <= endIndex)) && prev.indexOf(id) < 0 && index > -1) {
|
835
|
+
prev.push(id);
|
836
|
+
}
|
837
|
+
return prev;
|
838
|
+
}, []);
|
839
|
+
this._table.highlightIds.addMany(this._selectedIndexes.filter(i => ids.indexOf(i) < 0));
|
840
|
+
}
|
841
|
+
}
|
842
|
+
this._finishOnChange();
|
843
|
+
}
|
844
|
+
else {
|
845
|
+
this._skipOnChange = false;
|
846
|
+
}
|
847
|
+
this._currentId = [...this._table.highlightIds.toArray()].reverse()[0];
|
848
|
+
}
|
849
|
+
/**
|
850
|
+
* Handle any updates after a selection change has occured and emit the results
|
851
|
+
*
|
852
|
+
* @returns void
|
853
|
+
*/
|
854
|
+
_finishOnChange() {
|
855
|
+
if (this._showOnlySelected) {
|
856
|
+
if (this._featuresSelected()) {
|
857
|
+
this._table.filterBySelection();
|
858
|
+
}
|
859
|
+
else {
|
860
|
+
this._toggleShowSelected();
|
861
|
+
}
|
862
|
+
}
|
863
|
+
this.featureSelectionChange.emit(this._selectedIndexes);
|
864
|
+
}
|
774
865
|
/**
|
775
866
|
* Reset basic table props
|
776
867
|
*
|
@@ -906,6 +997,24 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
|
|
906
997
|
}
|
907
998
|
}
|
908
999
|
}
|
1000
|
+
/**
|
1001
|
+
* Keep track of key down for ctrl and shift
|
1002
|
+
*
|
1003
|
+
* @returns void
|
1004
|
+
*/
|
1005
|
+
_handleKeyDown(e) {
|
1006
|
+
this._ctrlIsPressed = e.ctrlKey;
|
1007
|
+
this._shiftIsPressed = e.shiftKey;
|
1008
|
+
}
|
1009
|
+
/**
|
1010
|
+
* Keep track of key up for ctrl and shift
|
1011
|
+
*
|
1012
|
+
* @returns void
|
1013
|
+
*/
|
1014
|
+
_handleKeyUp(e) {
|
1015
|
+
this._ctrlIsPressed = e.ctrlKey;
|
1016
|
+
this._shiftIsPressed = e.shiftKey;
|
1017
|
+
}
|
909
1018
|
/**
|
910
1019
|
* Show filter component in modal
|
911
1020
|
*
|
@@ -913,15 +1022,19 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
|
|
913
1022
|
*/
|
914
1023
|
_filterModal() {
|
915
1024
|
var _a, _b, _c;
|
916
|
-
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 }))));
|
1025
|
+
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 }))));
|
917
1026
|
}
|
918
1027
|
/**
|
919
1028
|
* Close the filter modal
|
920
1029
|
*
|
921
1030
|
* @returns void
|
922
1031
|
*/
|
923
|
-
_closeFilter() {
|
924
|
-
this._filterOpen
|
1032
|
+
async _closeFilter() {
|
1033
|
+
if (this._filterOpen) {
|
1034
|
+
// reset allIds
|
1035
|
+
this._allIds = await queryAllIds(this._layer);
|
1036
|
+
this._filterOpen = false;
|
1037
|
+
}
|
925
1038
|
}
|
926
1039
|
/**
|
927
1040
|
* Show delete confirmation message
|
@@ -994,8 +1107,10 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
|
|
994
1107
|
_selectAll() {
|
995
1108
|
const ids = this._allIds;
|
996
1109
|
this._table.highlightIds.removeAll();
|
1110
|
+
this._skipOnChange = true;
|
997
1111
|
this._table.highlightIds.addMany(ids);
|
998
1112
|
this._selectedIndexes = ids;
|
1113
|
+
this._finishOnChange();
|
999
1114
|
}
|
1000
1115
|
/**
|
1001
1116
|
* Toggle the show only selected flag
|
@@ -1055,8 +1170,10 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
|
|
1055
1170
|
}
|
1056
1171
|
return prev;
|
1057
1172
|
}, []).sort((a, b) => a - b);
|
1173
|
+
this._skipOnChange = true;
|
1058
1174
|
this._table.highlightIds.addMany(ids);
|
1059
1175
|
this._selectedIndexes = ids;
|
1176
|
+
this._finishOnChange();
|
1060
1177
|
}
|
1061
1178
|
/**
|
1062
1179
|
* Export all selected rows as CSV
|
@@ -141,7 +141,7 @@ const MapPicker = /*@__PURE__*/ proxyCustomElement(class MapPicker extends HTMLE
|
|
141
141
|
* @protected
|
142
142
|
*/
|
143
143
|
_getMapNameList(show) {
|
144
|
-
const listClass = show ? "map-list" : "display-none";
|
144
|
+
const listClass = show ? "map-list border-bottom-1" : "display-none";
|
145
145
|
return (h("div", { class: listClass }, h("calcite-list", { id: "mapList", ref: (el) => this._list = el, selectionAppearance: "border", selectionMode: "single" }, this.mapInfos.map(mapInfo => {
|
146
146
|
return (h("calcite-list-item", { label: mapInfo.name, onClick: () => this._webMapSelected(mapInfo), selected: mapInfo.id === this._loadedId, value: mapInfo.id }));
|
147
147
|
}))));
|
@@ -6,7 +6,7 @@
|
|
6
6
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
7
7
|
import { l as loadModules } from './loadModules.js';
|
8
8
|
import { b as goToSelection, h as highlightFeatures, e as getFeatureLayerView } from './mapViewUtils.js';
|
9
|
-
import {
|
9
|
+
import { e as queryObjectIds, g as getQueryGeoms, f as queryFeaturesByGeometry } from './queryUtils.js';
|
10
10
|
import { E as EWorkflowType } from './interfaces.js';
|
11
11
|
import { s as state } from './publicNotificationStore.js';
|
12
12
|
import { a as getComponentClosestLanguage, g as getLocaleComponentStrings } from './locale.js';
|
@@ -122,6 +122,22 @@ async function queryFeaturesByGeometry(start, layer, geometry, featuresCollectio
|
|
122
122
|
queryFeaturesByGeometry(start += num, layer, geometry, featuresCollection) :
|
123
123
|
Promise.resolve(featuresCollection);
|
124
124
|
}
|
125
|
+
/**
|
126
|
+
* Query the layer for feature ids that match the provided where clause.
|
127
|
+
* If no where clause is provided all features will be returned.
|
128
|
+
*
|
129
|
+
* @param layer the layer to retrieve features from
|
130
|
+
* @param where the where clause for the query
|
131
|
+
* @param orderBy any sort order to apply to the query
|
132
|
+
*
|
133
|
+
* @returns Promise with the ids from the layer that match the where and are sorted as defined by orderBy
|
134
|
+
*/
|
135
|
+
async function queryFeatureIds(layer, where, orderBy) {
|
136
|
+
const query = layer.createQuery();
|
137
|
+
query.where = where ? where : "1=1";
|
138
|
+
query.orderByFields = orderBy;
|
139
|
+
return await layer.queryObjectIds(query);
|
140
|
+
}
|
125
141
|
/**
|
126
142
|
* Query the layer for the extent of features with the provided OIDs
|
127
143
|
*
|
@@ -179,4 +195,4 @@ async function _intersectQuery(geometry, layer) {
|
|
179
195
|
return layer.queryObjectIds(q);
|
180
196
|
}
|
181
197
|
|
182
|
-
export { queryExtent as a,
|
198
|
+
export { queryExtent as a, queryFeatureIds as b, queryAllIds as c, queryFeaturesByGlobalID as d, queryObjectIds as e, queryFeaturesByGeometry as f, getQueryGeoms as g, queryFeaturesByID as q };
|
@@ -6,7 +6,7 @@
|
|
6
6
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
7
7
|
import { e as ESelectionMode, b as EDrawMode, E as EWorkflowType } from './interfaces.js';
|
8
8
|
import { e as getFeatureLayerView, f as getIdSets, i as highlightAllFeatures } from './mapViewUtils.js';
|
9
|
-
import {
|
9
|
+
import { f as queryFeaturesByGeometry } from './queryUtils.js';
|
10
10
|
import { s as state } from './publicNotificationStore.js';
|
11
11
|
import { g as getLocaleComponentStrings } from './locale.js';
|
12
12
|
import { d as defineCustomElement$s } from './action.js';
|
@@ -521,7 +521,7 @@ const MapPicker = class {
|
|
521
521
|
* @protected
|
522
522
|
*/
|
523
523
|
_getMapNameList(show) {
|
524
|
-
const listClass = show ? "map-list" : "display-none";
|
524
|
+
const listClass = show ? "map-list border-bottom-1" : "display-none";
|
525
525
|
return (h("div", { class: listClass }, h("calcite-list", { id: "mapList", ref: (el) => this._list = el, selectionAppearance: "border", selectionMode: "single" }, this.mapInfos.map(mapInfo => {
|
526
526
|
return (h("calcite-list-item", { label: mapInfo.name, onClick: () => this._webMapSelected(mapInfo), selected: mapInfo.id === this._loadedId, value: mapInfo.id }));
|
527
527
|
}))));
|
@@ -13,7 +13,7 @@ import { c as connectMessages, s as setUpMessages, d as disconnectMessages, u as
|
|
13
13
|
import { K as KindIcons } from './resources-6e00e0d1.js';
|
14
14
|
import { l as loadModules } from './loadModules-cea493da.js';
|
15
15
|
import { g as getLocaleComponentStrings } from './locale-834c52c6.js';
|
16
|
-
import {
|
16
|
+
import { m as getAllLayers } from './mapViewUtils-066602d5.js';
|
17
17
|
import './guid-36c6c6a5.js';
|
18
18
|
import './resources-cdc36705.js';
|
19
19
|
import './key-af303047.js';
|
@@ -22,7 +22,7 @@ import { d as debounce } from './debounce-229b1a22.js';
|
|
22
22
|
import { c as connectConditionalSlotComponent, d as disconnectConditionalSlotComponent } from './conditionalSlot-1149b5cb.js';
|
23
23
|
import { i as isActivationKey } from './key-af303047.js';
|
24
24
|
import { g as getLocaleComponentStrings } from './locale-834c52c6.js';
|
25
|
-
import {
|
25
|
+
import { n as getMapLayerHash, o as getMapTableHash } from './mapViewUtils-066602d5.js';
|
26
26
|
import { s as state } from './publicNotificationStore-9362d7ae.js';
|
27
27
|
import './resources-cdc36705.js';
|
28
28
|
import './browser-b4c16201.js';
|
@@ -5,9 +5,9 @@
|
|
5
5
|
*/
|
6
6
|
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-7183ce4a.js';
|
7
7
|
import { g as getLocaleComponentStrings } from './locale-834c52c6.js';
|
8
|
-
import { q as queryFeaturesByID, a as getLayerOrTable, g as goToSelection, b as
|
8
|
+
import { q as queryFeaturesByID, a as getLayerOrTable, g as goToSelection, b as queryFeatureIds, c as queryAllIds, d as queryFeaturesByGlobalID } from './mapViewUtils-066602d5.js';
|
9
9
|
import { l as loadModules } from './loadModules-cea493da.js';
|
10
|
-
import { d as downloadCSV } from './downloadUtils-
|
10
|
+
import { d as downloadCSV } from './downloadUtils-9dee8bc0.js';
|
11
11
|
import './esri-loader-eda07632.js';
|
12
12
|
import './_commonjsHelpers-d5f9d613.js';
|
13
13
|
import './interfaces-341e3ab3.js';
|
@@ -112,6 +112,10 @@ const LayerTable = class {
|
|
112
112
|
* number[]: A list of all IDs for the current layer
|
113
113
|
*/
|
114
114
|
this._allIds = [];
|
115
|
+
/**
|
116
|
+
* boolean: When true the ctrl key is currently pressed
|
117
|
+
*/
|
118
|
+
this._ctrlIsPressed = false;
|
115
119
|
/**
|
116
120
|
* boolean: When true the default global id provided via url param has been honored and should now be ignored
|
117
121
|
*/
|
@@ -120,6 +124,14 @@ const LayerTable = class {
|
|
120
124
|
* boolean: When true the default OID provided via url param has been honored and should now be ignored
|
121
125
|
*/
|
122
126
|
this._defaultOidHonored = false;
|
127
|
+
/**
|
128
|
+
* boolean: When true the shift key is currently pressed
|
129
|
+
*/
|
130
|
+
this._shiftIsPressed = false;
|
131
|
+
/**
|
132
|
+
* boolean: When true any onChange handeling will be skipped
|
133
|
+
*/
|
134
|
+
this._skipOnChange = false;
|
123
135
|
/**
|
124
136
|
* bool: When true the table is being sorted
|
125
137
|
*/
|
@@ -324,6 +336,8 @@ const LayerTable = class {
|
|
324
336
|
async componentDidLoad() {
|
325
337
|
this._resizeObserver.observe(this._toolbar);
|
326
338
|
document.onclick = (e) => this._handleDocumentClick(e);
|
339
|
+
document.onkeydown = (e) => this._handleKeyDown(e);
|
340
|
+
document.onkeyup = (e) => this._handleKeyUp(e);
|
327
341
|
}
|
328
342
|
/**
|
329
343
|
* Called after the component is rendered
|
@@ -803,18 +817,8 @@ const LayerTable = class {
|
|
803
817
|
this._initColumnsInfo();
|
804
818
|
this._checkEditEnabled();
|
805
819
|
await this._table.when(() => {
|
806
|
-
this._table.highlightIds.on("change", () => {
|
807
|
-
|
808
|
-
this._selectedIndexes = this._table.highlightIds.toArray().reverse();
|
809
|
-
if (this._showOnlySelected) {
|
810
|
-
if (this._featuresSelected()) {
|
811
|
-
this._table.filterBySelection();
|
812
|
-
}
|
813
|
-
else {
|
814
|
-
this._toggleShowSelected();
|
815
|
-
}
|
816
|
-
}
|
817
|
-
this.featureSelectionChange.emit(this._selectedIndexes);
|
820
|
+
this._table.highlightIds.on("change", (evt) => {
|
821
|
+
void this._handleOnChange(evt);
|
818
822
|
});
|
819
823
|
this.reactiveUtils.watch(() => this._table.activeSortOrders, (sortOrders) => {
|
820
824
|
var _a, _b, _c, _d;
|
@@ -824,6 +828,93 @@ const LayerTable = class {
|
|
824
828
|
});
|
825
829
|
}
|
826
830
|
}
|
831
|
+
async _handleOnChange(evt) {
|
832
|
+
const ids = [...this._table.highlightIds.toArray()];
|
833
|
+
if (!this._skipOnChange) {
|
834
|
+
if (!this._ctrlIsPressed && !this._shiftIsPressed) {
|
835
|
+
if (this._selectedIndexes.length > 0) {
|
836
|
+
this._skipOnChange = true;
|
837
|
+
// only readd in specific case where we have multiple selected and then click one of the currently selected
|
838
|
+
const reAdd = this._selectedIndexes.length > 1 && evt.removed.length === 1;
|
839
|
+
const newIndexes = reAdd ? evt.removed : ids.filter(id => this._selectedIndexes.indexOf(id) < 0);
|
840
|
+
this._clearSelection();
|
841
|
+
this._selectedIndexes = [...newIndexes];
|
842
|
+
if (newIndexes.length > 0) {
|
843
|
+
this._table.highlightIds.add(newIndexes[0]);
|
844
|
+
}
|
845
|
+
}
|
846
|
+
else {
|
847
|
+
// https://github.com/Esri/solutions-components/issues/365
|
848
|
+
this._selectedIndexes = ids.reverse();
|
849
|
+
}
|
850
|
+
}
|
851
|
+
else if (this._ctrlIsPressed) {
|
852
|
+
this._selectedIndexes = ids.reverse();
|
853
|
+
}
|
854
|
+
else if (this._shiftIsPressed) {
|
855
|
+
this._skipOnChange = true;
|
856
|
+
this._previousCurrentId = this._currentId;
|
857
|
+
this._currentId = [...this._table.highlightIds.toArray()].reverse()[0];
|
858
|
+
if (this._previousCurrentId !== this._currentId) {
|
859
|
+
// query the layer based on current sort and filters then grab between the current id and previous id
|
860
|
+
const orderBy = this._table.activeSortOrders.reduce((prev, cur) => {
|
861
|
+
prev.push(`${cur.fieldName} ${cur.direction}`);
|
862
|
+
return prev;
|
863
|
+
}, []);
|
864
|
+
const oids = await queryFeatureIds(this._layer, this._layer.definitionExpression, orderBy);
|
865
|
+
let isBetween = false;
|
866
|
+
const _start = this._table.viewModel.getObjectIdIndex(this._previousCurrentId);
|
867
|
+
const _end = this._table.viewModel.getObjectIdIndex(this._currentId);
|
868
|
+
const startIndex = _start < _end ? _start : _end;
|
869
|
+
const endIndex = _end > _start ? _end : _start;
|
870
|
+
this._selectedIndexes = oids.reduce((prev, cur) => {
|
871
|
+
const id = cur;
|
872
|
+
const index = this._table.viewModel.getObjectIdIndex(id);
|
873
|
+
if ((id === this._currentId || id === this._previousCurrentId)) {
|
874
|
+
isBetween = !isBetween;
|
875
|
+
if (prev.indexOf(id) < 0) {
|
876
|
+
prev.push(id);
|
877
|
+
}
|
878
|
+
}
|
879
|
+
// The oids are sorted so after we have reached the start or end oid add all ids even if the index is -1.
|
880
|
+
// Index of -1 will occur for features between the start and and oid if
|
881
|
+
// you select a row then scroll faster than the FeatureTable loads the data to select the next id
|
882
|
+
if (isBetween && prev.indexOf(id) < 0) {
|
883
|
+
prev.push(id);
|
884
|
+
}
|
885
|
+
// Also add index based check.
|
886
|
+
// In some cases the FeatureTable and Layer query will have differences in how null/undefined field values are sorted
|
887
|
+
if ((this._selectedIndexes.indexOf(id) > -1 || (index >= startIndex && index <= endIndex)) && prev.indexOf(id) < 0 && index > -1) {
|
888
|
+
prev.push(id);
|
889
|
+
}
|
890
|
+
return prev;
|
891
|
+
}, []);
|
892
|
+
this._table.highlightIds.addMany(this._selectedIndexes.filter(i => ids.indexOf(i) < 0));
|
893
|
+
}
|
894
|
+
}
|
895
|
+
this._finishOnChange();
|
896
|
+
}
|
897
|
+
else {
|
898
|
+
this._skipOnChange = false;
|
899
|
+
}
|
900
|
+
this._currentId = [...this._table.highlightIds.toArray()].reverse()[0];
|
901
|
+
}
|
902
|
+
/**
|
903
|
+
* Handle any updates after a selection change has occured and emit the results
|
904
|
+
*
|
905
|
+
* @returns void
|
906
|
+
*/
|
907
|
+
_finishOnChange() {
|
908
|
+
if (this._showOnlySelected) {
|
909
|
+
if (this._featuresSelected()) {
|
910
|
+
this._table.filterBySelection();
|
911
|
+
}
|
912
|
+
else {
|
913
|
+
this._toggleShowSelected();
|
914
|
+
}
|
915
|
+
}
|
916
|
+
this.featureSelectionChange.emit(this._selectedIndexes);
|
917
|
+
}
|
827
918
|
/**
|
828
919
|
* Reset basic table props
|
829
920
|
*
|
@@ -959,6 +1050,24 @@ const LayerTable = class {
|
|
959
1050
|
}
|
960
1051
|
}
|
961
1052
|
}
|
1053
|
+
/**
|
1054
|
+
* Keep track of key down for ctrl and shift
|
1055
|
+
*
|
1056
|
+
* @returns void
|
1057
|
+
*/
|
1058
|
+
_handleKeyDown(e) {
|
1059
|
+
this._ctrlIsPressed = e.ctrlKey;
|
1060
|
+
this._shiftIsPressed = e.shiftKey;
|
1061
|
+
}
|
1062
|
+
/**
|
1063
|
+
* Keep track of key up for ctrl and shift
|
1064
|
+
*
|
1065
|
+
* @returns void
|
1066
|
+
*/
|
1067
|
+
_handleKeyUp(e) {
|
1068
|
+
this._ctrlIsPressed = e.ctrlKey;
|
1069
|
+
this._shiftIsPressed = e.shiftKey;
|
1070
|
+
}
|
962
1071
|
/**
|
963
1072
|
* Show filter component in modal
|
964
1073
|
*
|
@@ -966,15 +1075,19 @@ const LayerTable = class {
|
|
966
1075
|
*/
|
967
1076
|
_filterModal() {
|
968
1077
|
var _a, _b, _c;
|
969
|
-
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 }))));
|
1078
|
+
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 }))));
|
970
1079
|
}
|
971
1080
|
/**
|
972
1081
|
* Close the filter modal
|
973
1082
|
*
|
974
1083
|
* @returns void
|
975
1084
|
*/
|
976
|
-
_closeFilter() {
|
977
|
-
this._filterOpen
|
1085
|
+
async _closeFilter() {
|
1086
|
+
if (this._filterOpen) {
|
1087
|
+
// reset allIds
|
1088
|
+
this._allIds = await queryAllIds(this._layer);
|
1089
|
+
this._filterOpen = false;
|
1090
|
+
}
|
978
1091
|
}
|
979
1092
|
/**
|
980
1093
|
* Show delete confirmation message
|
@@ -1047,8 +1160,10 @@ const LayerTable = class {
|
|
1047
1160
|
_selectAll() {
|
1048
1161
|
const ids = this._allIds;
|
1049
1162
|
this._table.highlightIds.removeAll();
|
1163
|
+
this._skipOnChange = true;
|
1050
1164
|
this._table.highlightIds.addMany(ids);
|
1051
1165
|
this._selectedIndexes = ids;
|
1166
|
+
this._finishOnChange();
|
1052
1167
|
}
|
1053
1168
|
/**
|
1054
1169
|
* Toggle the show only selected flag
|
@@ -1108,8 +1223,10 @@ const LayerTable = class {
|
|
1108
1223
|
}
|
1109
1224
|
return prev;
|
1110
1225
|
}, []).sort((a, b) => a - b);
|
1226
|
+
this._skipOnChange = true;
|
1111
1227
|
this._table.highlightIds.addMany(ids);
|
1112
1228
|
this._selectedIndexes = ids;
|
1229
|
+
this._finishOnChange();
|
1113
1230
|
}
|
1114
1231
|
/**
|
1115
1232
|
* Export all selected rows as CSV
|
@@ -6,7 +6,7 @@
|
|
6
6
|
import { c as createCommonjsModule, g as getDefaultExportFromCjs } from './_commonjsHelpers-d5f9d613.js';
|
7
7
|
import { a as getAssetPath } from './index-7183ce4a.js';
|
8
8
|
import { l as loadModules } from './loadModules-cea493da.js';
|
9
|
-
import { q as queryFeaturesByID } from './mapViewUtils-
|
9
|
+
import { q as queryFeaturesByID } from './mapViewUtils-066602d5.js';
|
10
10
|
import './solution-resource-7b8d302d.js';
|
11
11
|
import './index-a1e91462.js';
|
12
12
|
import { _ as __assign$1, r as request, c as cleanUrl, g as getJson } from './restHelpersGet-af032ab2.js';
|
@@ -1508,7 +1508,7 @@ function(t){var e=function(t){for(var e=t.length,r=new Uint8Array(e),n=0;n<e;n++
|
|
1508
1508
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1509
1509
|
* ====================================================================
|
1510
1510
|
*/
|
1511
|
-
function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):import('./index.es-
|
1511
|
+
function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):import('./index.es-54e86c8e.js')).catch((function(t){return Promise.reject(new Error("Could not load canvg: "+t))})).then((function(t){return t.default?t.default:t}))}E.API.addSvgAsImage=function(t,r,n,i,o,s,c,u){if(isNaN(r)||isNaN(n))throw a.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(i)||isNaN(o))throw a.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var h=document.createElement("canvas");h.width=i,h.height=o;var l=h.getContext("2d");l.fillStyle="#fff",l.fillRect(0,0,h.width,h.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},d=this;return e().then((function(e){return e.fromString(l,t,f)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(t){return t.render(f)})).then((function(){d.addImage(h.toDataURL("image/jpeg",1),r,n,i,o,c,u);}))};}(),E.API.putTotalPages=function(t){var e,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),r=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var i=0;i<this.internal.pages[n].length;i++)this.internal.pages[n][i]=this.internal.pages[n][i].replace(e,r);return this},E.API.viewerPreferences=function(e,r){var n;e=e||{},r=r||!1;var i,a,o,s={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},c=Object.keys(s),u=[],h=0,l=0,f=0;function d(t,e){var r,n=!1;for(r=0;r<t.length;r+=1)t[r]===e&&(n=!0);return n}if(void 0===this.internal.viewerpreferences&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(s)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,"reset"===e||!0===r){var p=c.length;for(f=0;f<p;f+=1)n[c[f]].value=n[c[f]].defaultValue,n[c[f]].explicitSet=!1;}if("object"===t(e))for(a in e)if(o=e[a],d(c,a)&&void 0!==o){if("boolean"===n[a].type&&"boolean"==typeof o)n[a].value=o;else if("name"===n[a].type&&d(n[a].valueSet,o))n[a].value=o;else if("integer"===n[a].type&&Number.isInteger(o))n[a].value=o;else if("array"===n[a].type){for(h=0;h<o.length;h+=1)if(i=!0,1===o[h].length&&"number"==typeof o[h][0])u.push(String(o[h]-1));else if(o[h].length>1){for(l=0;l<o[h].length;l+=1)"number"!=typeof o[h][l]&&(i=!1);!0===i&&u.push([o[h][0]-1,o[h][1]-1].join(" "));}n[a].value="["+u.join(" ")+"]";}else n[a].value=n[a].defaultValue;n[a].explicitSet=!0;}return !1===this.internal.viewerpreferences.isSubscribed&&(this.internal.events.subscribe("putCatalog",(function(){var t,e=[];for(t in n)!0===n[t].explicitSet&&("name"===n[t].type?e.push("/"+t+" /"+n[t].value):e.push("/"+t+" "+n[t].value));0!==e.length&&this.internal.write("/ViewerPreferences\n<<\n"+e.join("\n")+"\n>>");})),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},
|
1512
1512
|
/** ====================================================================
|
1513
1513
|
* @license
|
1514
1514
|
* jsPDF XMP metadata plugin
|
@@ -4,11 +4,11 @@
|
|
4
4
|
* http://www.apache.org/licenses/LICENSE-2.0
|
5
5
|
*/
|
6
6
|
import { a as commonjsGlobal, c as createCommonjsModule, g as getDefaultExportFromCjs } from './_commonjsHelpers-d5f9d613.js';
|
7
|
-
import { _ as _typeof_1 } from './downloadUtils-
|
7
|
+
import { _ as _typeof_1 } from './downloadUtils-9dee8bc0.js';
|
8
8
|
import './index-7183ce4a.js';
|
9
9
|
import './loadModules-cea493da.js';
|
10
10
|
import './esri-loader-eda07632.js';
|
11
|
-
import './mapViewUtils-
|
11
|
+
import './mapViewUtils-066602d5.js';
|
12
12
|
import './interfaces-341e3ab3.js';
|
13
13
|
import './solution-resource-7b8d302d.js';
|
14
14
|
import './index-a1e91462.js';
|
@@ -5,11 +5,11 @@
|
|
5
5
|
*/
|
6
6
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-7183ce4a.js';
|
7
7
|
import { l as loadModules } from './loadModules-cea493da.js';
|
8
|
-
import { g as goToSelection, h as highlightFeatures,
|
8
|
+
import { g as goToSelection, h as highlightFeatures, e as queryObjectIds, f as getQueryGeoms, i as getFeatureLayerView, j as queryFeaturesByGeometry, k as getIdSets, l as highlightAllFeatures } from './mapViewUtils-066602d5.js';
|
9
9
|
import { c as EWorkflowType, e as ESelectionMode, f as EDrawMode } from './interfaces-341e3ab3.js';
|
10
10
|
import { s as state } from './publicNotificationStore-9362d7ae.js';
|
11
11
|
import { a as getComponentClosestLanguage, g as getLocaleComponentStrings } from './locale-834c52c6.js';
|
12
|
-
import { d as downloadCSV, a as downloadPDF } from './downloadUtils-
|
12
|
+
import { d as downloadCSV, a as downloadPDF } from './downloadUtils-9dee8bc0.js';
|
13
13
|
import './esri-loader-eda07632.js';
|
14
14
|
import './_commonjsHelpers-d5f9d613.js';
|
15
15
|
import './index-857df22e.js';
|