@esri/solutions-components 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/t9n/map-select-tools/resources.json +1 -1
- package/dist/assets/t9n/map-select-tools/resources_en.json +1 -1
- package/dist/assets/t9n/public-notification/resources.json +5 -5
- package/dist/assets/t9n/public-notification/resources_en.json +5 -5
- package/dist/assets/t9n/refine-selection/resources.json +3 -3
- package/dist/assets/t9n/refine-selection/resources_en.json +3 -3
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +1344 -18
- package/dist/cjs/{calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-da276a1c.js → downloadUtils-99981c6b.js} +278 -1383
- package/dist/cjs/{index.es-176629d8.js → index.es-53f3bc97.js} +3 -13
- package/dist/cjs/layer-table.cjs.entry.js +5 -15
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +25 -10
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/layer-table/layer-table.js +4 -16
- package/dist/collection/components/map-search/map-search.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +43 -39
- package/dist/collection/components/pdf-download/pdf-download.js +33 -80
- package/dist/collection/components/public-notification/public-notification.js +26 -11
- package/dist/collection/components/refine-selection/refine-selection.js +1 -1
- package/dist/collection/utils/csvUtils.js +4 -0
- package/dist/collection/utils/csvUtils.ts +7 -0
- package/dist/collection/utils/downloadUtils.js +254 -0
- package/dist/collection/utils/downloadUtils.ts +344 -0
- package/dist/collection/utils/interfaces.ts +3 -2
- package/dist/collection/utils/pdfUtils.js +7 -0
- package/dist/collection/utils/pdfUtils.ts +13 -2
- package/dist/components/downloadUtils.js +2352 -0
- package/dist/components/index.es.js +1 -1
- package/dist/components/layer-table.js +5 -16
- package/dist/components/map-layer-picker2.js +1 -1
- package/dist/components/map-search.js +1 -1
- package/dist/components/map-select-tools2.js +45 -41
- package/dist/components/pdf-download2.js +14 -2126
- package/dist/components/public-notification.js +26 -11
- package/dist/components/queryUtils.js +1 -1
- package/dist/components/refine-selection-tools2.js +1 -1
- package/dist/components/refine-selection2.js +1 -1
- package/dist/esm/buffer-tools_6.entry.js +1 -1
- package/dist/esm/calcite-combobox_3.entry.js +1 -1
- package/dist/esm/calcite-input-message_5.entry.js +1343 -13
- package/dist/esm/{calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-c6f63458.js → downloadUtils-4bb47330.js} +279 -1381
- package/dist/esm/{index.es-54a6f3a3.js → index.es-4424d2f7.js} +2 -12
- package/dist/esm/layer-table.entry.js +6 -16
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{mapViewUtils-63e118f8.js → mapViewUtils-02696ab6.js} +1 -1
- package/dist/esm/public-notification.entry.js +26 -11
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/p-0aed9b0d.js +437 -0
- package/dist/solutions-components/p-0d3b0fa0.entry.js +17 -0
- package/dist/solutions-components/{p-cc2e20c8.js → p-1bfd07e3.js} +1 -1
- package/dist/solutions-components/{p-117174e8.entry.js → p-335fce8c.entry.js} +1 -1
- package/dist/solutions-components/{p-1e459361.js → p-50117f71.js} +3 -3
- package/dist/solutions-components/p-5e4dfbe4.entry.js +6 -0
- package/dist/solutions-components/{p-8a0c0935.entry.js → p-a3b60bc9.entry.js} +1 -1
- package/dist/solutions-components/p-ec7f7804.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/csvUtils.ts +7 -0
- package/dist/solutions-components/utils/downloadUtils.ts +344 -0
- package/dist/solutions-components/utils/interfaces.ts +3 -2
- package/dist/solutions-components/utils/pdfUtils.ts +13 -2
- package/dist/types/components/map-select-tools/map-select-tools.d.ts +12 -6
- package/dist/types/components/pdf-download/pdf-download.d.ts +4 -20
- package/dist/types/components/public-notification/public-notification.d.ts +9 -1
- package/dist/types/components.d.ts +4 -2
- package/dist/types/utils/downloadUtils.d.ts +42 -0
- package/dist/types/utils/interfaces.d.ts +2 -3
- package/dist/types/utils/pdfUtils.d.ts +3 -1
- package/package.json +1 -1
- package/dist/cjs/csvUtils-3a56c6d8.js +0 -54
- package/dist/components/csvUtils.js +0 -52
- package/dist/esm/csvUtils-23b5418f.js +0 -52
- package/dist/solutions-components/p-3069e3b7.js +0 -21
- package/dist/solutions-components/p-6d28f991.entry.js +0 -6
- package/dist/solutions-components/p-80f5e33c.js +0 -416
- package/dist/solutions-components/p-8927862a.entry.js +0 -6
- package/dist/solutions-components/p-e69c58e5.entry.js +0 -6
|
@@ -5,960 +5,60 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
+
const _commonjsHelpers = require('./_commonjsHelpers-384729db.js');
|
|
8
9
|
const index = require('./index-c6979cbb.js');
|
|
9
|
-
const dom = require('./dom-4a580af6.js');
|
|
10
|
-
const interfaces = require('./interfaces-e76f31e9.js');
|
|
11
|
-
const conditionalSlot = require('./conditionalSlot-baada7a3.js');
|
|
12
10
|
const loadModules = require('./loadModules-918ff3e7.js');
|
|
13
11
|
const mapViewUtils = require('./mapViewUtils-d250b1ed.js');
|
|
14
|
-
const interfaces$1 = require('./interfaces-17c631bf.js');
|
|
15
|
-
const publicNotificationStore = require('./publicNotificationStore-20e924f5.js');
|
|
16
|
-
const locale = require('./locale-db1db902.js');
|
|
17
|
-
const csvUtils = require('./csvUtils-3a56c6d8.js');
|
|
18
|
-
const _commonjsHelpers = require('./_commonjsHelpers-384729db.js');
|
|
19
|
-
const publicNotificationUtils = require('./publicNotificationUtils-9d585d8d.js');
|
|
20
|
-
|
|
21
|
-
/*!
|
|
22
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
23
|
-
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
24
|
-
* v1.0.0-beta.97
|
|
25
|
-
*/
|
|
26
|
-
var StatusIconDefaults;
|
|
27
|
-
(function (StatusIconDefaults) {
|
|
28
|
-
StatusIconDefaults["valid"] = "check-circle";
|
|
29
|
-
StatusIconDefaults["invalid"] = "exclamation-mark-triangle";
|
|
30
|
-
StatusIconDefaults["idle"] = "information";
|
|
31
|
-
})(StatusIconDefaults || (StatusIconDefaults = {}));
|
|
32
|
-
|
|
33
|
-
const inputMessageCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host([active][scale=m]),:host([active][scale=l]){--calcite-input-message-spacing-value:0.25rem}:host{visibility:hidden;box-sizing:border-box;display:flex;block-size:0px;inline-size:100%;align-items:center;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}:host([active]){visibility:visible;block-size:auto;opacity:1;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}:host([active][scale=m]),:host([active][scale=l]){-webkit-margin-before:var(--calcite-input-message-spacing-value);margin-block-start:var(--calcite-input-message-spacing-value)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.calcite-input-message-icon{pointer-events:none;display:inline-flex;flex-shrink:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}:host([status=invalid]) .calcite-input-message-icon{color:var(--calcite-ui-danger)}:host([status=warning]) .calcite-input-message-icon{color:var(--calcite-ui-warning)}:host([status=valid]) .calcite-input-message-icon{color:var(--calcite-ui-success)}:host([status=idle]) .calcite-input-message-icon{color:var(--calcite-ui-brand)}:host([status][active]){color:var(--calcite-ui-text-1)}:host([status][scale=s]){font-size:var(--calcite-font-size--3);line-height:0.75rem}:host([status][scale=m]){-webkit-margin-before:0.25rem;margin-block-start:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([status][scale=l]){-webkit-margin-before:0.25rem;margin-block-start:0.25rem;font-size:var(--calcite-font-size--1);line-height:1rem}";
|
|
34
|
-
|
|
35
|
-
const InputMessage = class {
|
|
36
|
-
constructor(hostRef) {
|
|
37
|
-
index.registerInstance(this, hostRef);
|
|
38
|
-
//--------------------------------------------------------------------------
|
|
39
|
-
//
|
|
40
|
-
// Properties
|
|
41
|
-
//
|
|
42
|
-
//--------------------------------------------------------------------------
|
|
43
|
-
/** When `true`, the component is active. */
|
|
44
|
-
this.active = false;
|
|
45
|
-
/** Specifies the size of the component. */
|
|
46
|
-
this.scale = "m";
|
|
47
|
-
/** Specifies the status of the input field, which determines message and icons. */
|
|
48
|
-
this.status = "idle";
|
|
49
|
-
}
|
|
50
|
-
handleIconEl() {
|
|
51
|
-
this.requestedIcon = dom.setRequestedIcon(StatusIconDefaults, this.icon, this.status);
|
|
52
|
-
}
|
|
53
|
-
//--------------------------------------------------------------------------
|
|
54
|
-
//
|
|
55
|
-
// Lifecycle
|
|
56
|
-
//
|
|
57
|
-
//--------------------------------------------------------------------------
|
|
58
|
-
connectedCallback() {
|
|
59
|
-
this.status = dom.getElementProp(this.el, "status", this.status);
|
|
60
|
-
this.scale = dom.getElementProp(this.el, "scale", this.scale);
|
|
61
|
-
this.requestedIcon = dom.setRequestedIcon(StatusIconDefaults, this.icon, this.status);
|
|
62
|
-
}
|
|
63
|
-
render() {
|
|
64
|
-
const hidden = !this.active;
|
|
65
|
-
return (index.h(index.Host, { "calcite-hydrated-hidden": hidden }, this.renderIcon(this.requestedIcon), index.h("slot", null)));
|
|
66
|
-
}
|
|
67
|
-
//--------------------------------------------------------------------------
|
|
68
|
-
//
|
|
69
|
-
// Private Methods
|
|
70
|
-
//
|
|
71
|
-
//--------------------------------------------------------------------------
|
|
72
|
-
renderIcon(iconName) {
|
|
73
|
-
if (iconName) {
|
|
74
|
-
return index.h("calcite-icon", { class: "calcite-input-message-icon", icon: iconName, scale: "s" });
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
get el() { return index.getElement(this); }
|
|
78
|
-
static get watchers() { return {
|
|
79
|
-
"status": ["handleIconEl"],
|
|
80
|
-
"icon": ["handleIconEl"]
|
|
81
|
-
}; }
|
|
82
|
-
};
|
|
83
|
-
InputMessage.style = inputMessageCss;
|
|
84
12
|
|
|
85
|
-
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
*
|
|
132
|
-
* @deprecated use `closable` instead.
|
|
133
|
-
*/
|
|
134
|
-
this.dismissible = false;
|
|
135
|
-
/** When `true`, a close button is added to the component. */
|
|
136
|
-
this.closable = false;
|
|
137
|
-
/**
|
|
138
|
-
* Accessible name for the close button.
|
|
139
|
-
*
|
|
140
|
-
* @default "Close"
|
|
141
|
-
*/
|
|
142
|
-
this.intlClose = TEXT.close;
|
|
143
|
-
/** Specifies the size of the component. */
|
|
144
|
-
this.scale = "m";
|
|
145
|
-
/** Specifies the width of the component. */
|
|
146
|
-
this.width = "auto";
|
|
147
|
-
//--------------------------------------------------------------------------
|
|
148
|
-
//
|
|
149
|
-
// Private Methods
|
|
150
|
-
//
|
|
151
|
-
//--------------------------------------------------------------------------
|
|
152
|
-
this.close = () => {
|
|
153
|
-
this.open = false;
|
|
154
|
-
this.calciteNoticeClose.emit();
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
activeHandler(value) {
|
|
158
|
-
this.open = value;
|
|
159
|
-
}
|
|
160
|
-
openHandler(value) {
|
|
161
|
-
this.active = value;
|
|
162
|
-
}
|
|
163
|
-
handleDismissible(value) {
|
|
164
|
-
this.closable = value;
|
|
165
|
-
}
|
|
166
|
-
handleClosable(value) {
|
|
167
|
-
this.dismissible = value;
|
|
168
|
-
}
|
|
169
|
-
updateRequestedIcon() {
|
|
170
|
-
this.requestedIcon = dom.setRequestedIcon(interfaces.StatusIcons, this.icon, this.color);
|
|
171
|
-
}
|
|
172
|
-
//--------------------------------------------------------------------------
|
|
173
|
-
//
|
|
174
|
-
// Lifecycle
|
|
175
|
-
//
|
|
176
|
-
//--------------------------------------------------------------------------
|
|
177
|
-
connectedCallback() {
|
|
178
|
-
conditionalSlot.connectConditionalSlotComponent(this);
|
|
179
|
-
const isOpen = this.active || this.open;
|
|
180
|
-
if (isOpen) {
|
|
181
|
-
this.activeHandler(isOpen);
|
|
182
|
-
this.openHandler(isOpen);
|
|
183
|
-
}
|
|
184
|
-
if (this.dismissible) {
|
|
185
|
-
this.handleDismissible(this.dismissible);
|
|
186
|
-
}
|
|
187
|
-
if (this.closable) {
|
|
188
|
-
this.handleClosable(this.closable);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
disconnectedCallback() {
|
|
192
|
-
conditionalSlot.disconnectConditionalSlotComponent(this);
|
|
193
|
-
}
|
|
194
|
-
componentWillLoad() {
|
|
195
|
-
this.requestedIcon = dom.setRequestedIcon(interfaces.StatusIcons, this.icon, this.color);
|
|
196
|
-
}
|
|
197
|
-
render() {
|
|
198
|
-
const { el } = this;
|
|
199
|
-
const closeButton = (index.h("button", { "aria-label": this.intlClose, class: CSS.close, onClick: this.close, ref: (el) => (this.closeButton = el) }, index.h("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })));
|
|
200
|
-
const hasActionEnd = dom.getSlotted(el, SLOTS.actionsEnd);
|
|
201
|
-
return (index.h("div", { class: CSS.container }, this.requestedIcon ? (index.h("div", { class: CSS.icon }, index.h("calcite-icon", { icon: this.requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, index.h("div", { class: CSS.content }, index.h("slot", { name: SLOTS.title }), index.h("slot", { name: SLOTS.message }), index.h("slot", { name: SLOTS.link })), hasActionEnd ? (index.h("div", { class: CSS.actionsEnd }, index.h("slot", { name: SLOTS.actionsEnd }))) : null, this.closable ? closeButton : null));
|
|
202
|
-
}
|
|
203
|
-
//--------------------------------------------------------------------------
|
|
204
|
-
//
|
|
205
|
-
// Public Methods
|
|
206
|
-
//
|
|
207
|
-
//--------------------------------------------------------------------------
|
|
208
|
-
/** Sets focus on the component. */
|
|
209
|
-
async setFocus() {
|
|
210
|
-
const noticeLinkEl = this.el.querySelector("calcite-link");
|
|
211
|
-
if (!this.closeButton && !noticeLinkEl) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
if (noticeLinkEl) {
|
|
215
|
-
noticeLinkEl.setFocus();
|
|
216
|
-
}
|
|
217
|
-
else if (this.closeButton) {
|
|
218
|
-
this.closeButton.focus();
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
get el() { return index.getElement(this); }
|
|
222
|
-
static get watchers() { return {
|
|
223
|
-
"active": ["activeHandler"],
|
|
224
|
-
"open": ["openHandler"],
|
|
225
|
-
"dismissible": ["handleDismissible"],
|
|
226
|
-
"closable": ["handleClosable"],
|
|
227
|
-
"icon": ["updateRequestedIcon"],
|
|
228
|
-
"color": ["updateRequestedIcon"]
|
|
229
|
-
}; }
|
|
230
|
-
};
|
|
231
|
-
Notice.style = noticeCss;
|
|
232
|
-
|
|
233
|
-
const mapSelectToolsCss = ":host{display:block}.div-visible{display:inherit}.div-visible-search{display:flex;height:44px;align-items:center;padding-bottom:0}.div-not-visible{display:none}.padding-bottom-1{padding-bottom:1rem}.search-widget{width:100% !important;border:1px solid var(--calcite-ui-border-input)}.w-100{width:100%}.w-50{width:50%}.search-distance-container{padding-top:\"1rem\" !important}.end-border{-webkit-border-end:1px solid var(--calcite-ui-border-2);border-inline-end:1px solid var(--calcite-ui-border-2)}.search-distance{display:flex;padding-top:1rem}";
|
|
234
|
-
|
|
235
|
-
const MapSelectTools = class {
|
|
236
|
-
constructor(hostRef) {
|
|
237
|
-
index.registerInstance(this, hostRef);
|
|
238
|
-
this.selectionSetChange = index.createEvent(this, "selectionSetChange", 7);
|
|
239
|
-
this.sketchTypeChange = index.createEvent(this, "sketchTypeChange", 7);
|
|
240
|
-
this.workflowTypeChange = index.createEvent(this, "workflowTypeChange", 7);
|
|
241
|
-
/**
|
|
242
|
-
* number[]: the oids of the selected features
|
|
243
|
-
*/
|
|
244
|
-
this._selectedIds = [];
|
|
245
|
-
/**
|
|
246
|
-
* string: A label to help uniquely identify the selection set
|
|
247
|
-
*/
|
|
248
|
-
this._selectionLabel = "";
|
|
249
|
-
/**
|
|
250
|
-
* boolean: When false the geometries will be used for selection
|
|
251
|
-
* When true a list of OIDs will be used
|
|
252
|
-
* see https://github.com/Esri/solutions-components/issues/148
|
|
253
|
-
*/
|
|
254
|
-
this._skipGeomQuery = false;
|
|
255
|
-
this.bufferColor = [227, 139, 79, 0.8];
|
|
256
|
-
this.bufferOutlineColor = [255, 255, 255];
|
|
257
|
-
this.enabledLayerIds = [];
|
|
258
|
-
this.defaultBufferDistance = undefined;
|
|
259
|
-
this.defaultBufferUnit = undefined;
|
|
260
|
-
this.geometries = undefined;
|
|
261
|
-
this.isUpdate = false;
|
|
262
|
-
this.mapView = undefined;
|
|
263
|
-
this.searchConfiguration = undefined;
|
|
264
|
-
this.selectionSet = undefined;
|
|
265
|
-
this.selectLayerView = undefined;
|
|
266
|
-
this.showBufferTools = true;
|
|
267
|
-
this._layerSelectChecked = undefined;
|
|
268
|
-
this._searchTerm = undefined;
|
|
269
|
-
this._translations = undefined;
|
|
270
|
-
this._workflowType = undefined;
|
|
271
|
-
}
|
|
272
|
-
//--------------------------------------------------------------------------
|
|
273
|
-
//
|
|
274
|
-
// Watch handlers
|
|
275
|
-
//
|
|
276
|
-
//--------------------------------------------------------------------------
|
|
277
|
-
/**
|
|
278
|
-
* Called each time the geometries prop is changed.
|
|
279
|
-
*
|
|
280
|
-
* @returns Promise when complete
|
|
281
|
-
*/
|
|
282
|
-
async watchGeometriesHandler(newValue, oldValue) {
|
|
283
|
-
if (newValue !== oldValue) {
|
|
284
|
-
if (newValue.length > 0) {
|
|
285
|
-
if (this._skipGeomQuery) {
|
|
286
|
-
void mapViewUtils.highlightFeatures(this._selectedIds, this.selectLayerView, this.mapView);
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
return this._geomQuery(this.geometries);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
else if (newValue.length === 0) {
|
|
293
|
-
return this._clearResults(true, true);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Called each time the searchConfiguration prop is changed.
|
|
299
|
-
*
|
|
300
|
-
* @returns Promise when complete
|
|
301
|
-
*/
|
|
302
|
-
async watchSearchConfigurationHandler(newValue, oldValue) {
|
|
303
|
-
console.log("watchSearchConfigurationHandler");
|
|
304
|
-
console.log("newValue");
|
|
305
|
-
console.log(newValue);
|
|
306
|
-
console.log("oldValue");
|
|
307
|
-
console.log(oldValue);
|
|
308
|
-
if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
|
|
309
|
-
this._initSearchWidget();
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Called each time the workflowType prop is changed and emits the workflowTypeChange event.
|
|
314
|
-
*
|
|
315
|
-
* @returns Promise when complete
|
|
316
|
-
*/
|
|
317
|
-
async workflowTypeHandler(newValue, oldValue) {
|
|
318
|
-
if (newValue !== oldValue) {
|
|
319
|
-
this.mapView.popup.autoOpenEnabled = ["SELECT", "SKETCH", "REFINE"].indexOf(newValue) < 0;
|
|
320
|
-
this.workflowTypeChange.emit(newValue);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
//--------------------------------------------------------------------------
|
|
324
|
-
//
|
|
325
|
-
// Methods (public)
|
|
326
|
-
//
|
|
327
|
-
//--------------------------------------------------------------------------
|
|
328
|
-
/**
|
|
329
|
-
* Clear any selection results
|
|
330
|
-
*
|
|
331
|
-
* @returns Promise when the results have been cleared
|
|
332
|
-
*/
|
|
333
|
-
async clearSelection() {
|
|
334
|
-
return this._clearResults();
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Get the new selection set
|
|
338
|
-
*
|
|
339
|
-
* @returns Promise with the new selection set
|
|
340
|
-
*/
|
|
341
|
-
async getSelection() {
|
|
342
|
-
// Allow any non whitespace
|
|
343
|
-
if (!/\S+/gm.test(this._selectionLabel)) {
|
|
344
|
-
this._selectionLabel = this._getSelectionBaseLabel();
|
|
345
|
-
}
|
|
346
|
-
const isBaseLabel = this._selectionLabel === this._getSelectionBaseLabel();
|
|
347
|
-
return {
|
|
348
|
-
id: this.isUpdate ? this.selectionSet.id : Date.now(),
|
|
349
|
-
workflowType: this._workflowType,
|
|
350
|
-
searchResult: this._searchResult,
|
|
351
|
-
buffer: this._bufferGeometry,
|
|
352
|
-
distance: this._bufferTools.distance,
|
|
353
|
-
download: true,
|
|
354
|
-
unit: this._bufferTools.unit,
|
|
355
|
-
label: (this._selectionLabel && !isBaseLabel) ?
|
|
356
|
-
this._selectionLabel : `${this._selectionLabel} ${this._bufferTools.distance} ${this._bufferTools.unit}`,
|
|
357
|
-
selectedIds: this._selectedIds,
|
|
358
|
-
layerView: this.selectLayerView,
|
|
359
|
-
geometries: this.geometries,
|
|
360
|
-
refineSelectLayers: this._refineTools.layerViews,
|
|
361
|
-
skipGeomQuery: this._skipGeomQuery
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Handle changes to the selection sets
|
|
366
|
-
*/
|
|
367
|
-
labelChange(event) {
|
|
368
|
-
this._selectionLabel = event.detail;
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Handle changes to the search configuration
|
|
372
|
-
*/
|
|
373
|
-
searchConfigurationChangeChanged(event) {
|
|
374
|
-
this.searchConfiguration = event.detail;
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Listen to changes in the sketch graphics
|
|
378
|
-
*
|
|
379
|
-
*/
|
|
380
|
-
sketchGraphicsChange(event) {
|
|
381
|
-
this._updateSelection(interfaces$1.EWorkflowType.SKETCH, event.detail, this._selectionLabel || this._translations.sketch, true);
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Listen to changes in the refine graphics
|
|
385
|
-
*
|
|
386
|
-
*/
|
|
387
|
-
refineSelectionGraphicsChange(event) {
|
|
388
|
-
const graphics = event.detail.graphics;
|
|
389
|
-
this._skipGeomQuery = event.detail.useOIDs;
|
|
390
|
-
const oids = Array.isArray(graphics) ? graphics.map(g => g.attributes[g.layer.objectIdField]) : [];
|
|
391
|
-
this._updateSelection(interfaces$1.EWorkflowType.SELECT, graphics, this._selectionLabel || this._translations.select, !event.detail.useOIDs, oids);
|
|
392
|
-
return this._highlightFeatures(oids);
|
|
393
|
-
}
|
|
394
|
-
//--------------------------------------------------------------------------
|
|
395
|
-
//
|
|
396
|
-
// Functions (lifecycle)
|
|
397
|
-
//
|
|
398
|
-
//--------------------------------------------------------------------------
|
|
399
|
-
/**
|
|
400
|
-
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
401
|
-
*/
|
|
402
|
-
async componentWillLoad() {
|
|
403
|
-
await this._getTranslations();
|
|
404
|
-
await this._initModules();
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* StencilJS: Called once just after the component is fully loaded and the first render() occurs.
|
|
408
|
-
*/
|
|
409
|
-
async componentDidLoad() {
|
|
410
|
-
return this._init();
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* Renders the component.
|
|
414
|
-
*/
|
|
415
|
-
render() {
|
|
416
|
-
var _a, _b, _c;
|
|
417
|
-
const searchEnabled = this._workflowType === interfaces$1.EWorkflowType.SEARCH;
|
|
418
|
-
const showSearchClass = searchEnabled ? " div-visible-search" : " div-not-visible";
|
|
419
|
-
const drawEnabled = this._workflowType === interfaces$1.EWorkflowType.SKETCH || this._workflowType === interfaces$1.EWorkflowType.SELECT;
|
|
420
|
-
const showBufferToolsClass = this.showBufferTools ? "search-distance" : "div-not-visible";
|
|
421
|
-
const useSelectClass = this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
|
|
422
|
-
const useDrawClass = !this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
|
|
423
|
-
const showLayerChoiceClass = searchEnabled ? "div-not-visible" : "div-visible";
|
|
424
|
-
return (index.h(index.Host, null, index.h("div", { class: "padding-bottom-1" }, index.h("calcite-radio-group", { class: "w-100", onCalciteRadioGroupChange: (evt) => this._workflowChange(evt) }, index.h("calcite-radio-group-item", { checked: searchEnabled, class: "w-50 end-border", value: interfaces$1.EWorkflowType.SEARCH }, this._translations.search), index.h("calcite-radio-group-item", { checked: drawEnabled, class: "w-50", value: interfaces$1.EWorkflowType.SKETCH }, this._translations.sketch))), index.h("div", { class: showSearchClass }, index.h("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })), index.h("div", { class: showLayerChoiceClass }, index.h("calcite-label", { layout: "inline" }, index.h("calcite-checkbox", { checked: ((_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.workflowType) === interfaces$1.EWorkflowType.SELECT, onCalciteCheckboxChange: () => this._layerSelectChanged(), ref: (el) => this._selectFromLayerElement = el }), "Use layer features")), index.h("div", { class: useDrawClass }, index.h("map-draw-tools", { active: true, border: true, mapView: this.mapView, ref: (el) => { this._drawTools = el; } })), index.h("div", { class: useSelectClass }, index.h("refine-selection-tools", { active: true, border: true, enabledLayerIds: this.enabledLayerIds, layerView: this.selectLayerView, layerViews: this._refineSelectLayers, mapView: this.mapView, mode: interfaces$1.ESelectionMode.ADD, ref: (el) => { this._refineTools = el; }, refineMode: interfaces$1.ERefineMode.SUBSET })), index.h("calcite-label", { class: showBufferToolsClass }, this._translations.searchDistance, index.h("buffer-tools", { distance: ((_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.distance) || this.defaultBufferDistance, geometries: this.geometries, onBufferComplete: (evt) => this._bufferComplete(evt), ref: (el) => this._bufferTools = el, unit: ((_c = this.selectionSet) === null || _c === void 0 ? void 0 : _c.unit) || this.defaultBufferUnit })), index.h("slot", null)));
|
|
425
|
-
}
|
|
426
|
-
//--------------------------------------------------------------------------
|
|
427
|
-
//
|
|
428
|
-
// Functions (protected)
|
|
429
|
-
//
|
|
430
|
-
//--------------------------------------------------------------------------
|
|
431
|
-
/**
|
|
432
|
-
* Load esri javascript api modules
|
|
433
|
-
*
|
|
434
|
-
* @returns Promise resolving when function is done
|
|
435
|
-
*
|
|
436
|
-
* @protected
|
|
437
|
-
*/
|
|
438
|
-
async _initModules() {
|
|
439
|
-
const [GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules.loadModules([
|
|
440
|
-
"esri/layers/GraphicsLayer",
|
|
441
|
-
"esri/Graphic",
|
|
442
|
-
"esri/widgets/Search",
|
|
443
|
-
"esri/geometry/geometryEngine",
|
|
444
|
-
"esri/layers/FeatureLayer"
|
|
445
|
-
]);
|
|
446
|
-
this.GraphicsLayer = GraphicsLayer;
|
|
447
|
-
this.Graphic = Graphic;
|
|
448
|
-
this.Search = Search;
|
|
449
|
-
this._geometryEngine = geometryEngine;
|
|
450
|
-
this.FeatureLayer = FeatureLayer;
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Initialize the graphics layer, selection set, and search widget
|
|
454
|
-
*
|
|
455
|
-
* @returns Promise when the operation has completed
|
|
456
|
-
*/
|
|
457
|
-
async _init() {
|
|
458
|
-
this._initGraphicsLayer();
|
|
459
|
-
this._initSelectionSet();
|
|
460
|
-
this._initSearchWidget();
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* Initialize the state of the component with any stored values in a selection set
|
|
464
|
-
*
|
|
465
|
-
* @protected
|
|
466
|
-
*/
|
|
467
|
-
_initSelectionSet() {
|
|
468
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
469
|
-
if (this.selectionSet) {
|
|
470
|
-
this._searchTerm = (_b = (_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.searchResult) === null || _b === void 0 ? void 0 : _b.name;
|
|
471
|
-
this._workflowType = (_c = this.selectionSet) === null || _c === void 0 ? void 0 : _c.workflowType;
|
|
472
|
-
this._searchResult = (_d = this.selectionSet) === null || _d === void 0 ? void 0 : _d.searchResult;
|
|
473
|
-
this._refineSelectLayers = (_e = this.selectionSet) === null || _e === void 0 ? void 0 : _e.refineSelectLayers;
|
|
474
|
-
this._selectedIds = (_f = this.selectionSet) === null || _f === void 0 ? void 0 : _f.selectedIds;
|
|
475
|
-
this._skipGeomQuery = (_g = this.selectionSet) === null || _g === void 0 ? void 0 : _g.skipGeomQuery;
|
|
476
|
-
this.geometries = [
|
|
477
|
-
...((_h = this.selectionSet) === null || _h === void 0 ? void 0 : _h.geometries) || []
|
|
478
|
-
];
|
|
479
|
-
// reset selection label base
|
|
480
|
-
this._selectionLabel = ((_j = this.selectionSet) === null || _j === void 0 ? void 0 : _j.label) || this._getSelectionBaseLabel();
|
|
481
|
-
void mapViewUtils.goToSelection(this.selectionSet.selectedIds, this.selectionSet.layerView, this.mapView, false);
|
|
482
|
-
}
|
|
483
|
-
else {
|
|
484
|
-
this._workflowType = interfaces$1.EWorkflowType.SEARCH;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* Get the default label base when the user has not provided a value
|
|
489
|
-
*
|
|
490
|
-
* @protected
|
|
491
|
-
*/
|
|
492
|
-
_getSelectionBaseLabel() {
|
|
493
|
-
var _a, _b;
|
|
494
|
-
return this._workflowType === interfaces$1.EWorkflowType.SKETCH ?
|
|
495
|
-
this._translations.sketch : this._workflowType === interfaces$1.EWorkflowType.SELECT ?
|
|
496
|
-
this._translations.select : this._workflowType === interfaces$1.EWorkflowType.SEARCH && this._searchResult ?
|
|
497
|
-
(_a = this._searchResult) === null || _a === void 0 ? void 0 : _a.name : (_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.label;
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* Initialize the search widget
|
|
501
|
-
*
|
|
502
|
-
* @protected
|
|
503
|
-
*/
|
|
504
|
-
_initSearchWidget() {
|
|
505
|
-
console.log("_initSearchWidget");
|
|
506
|
-
console.log("this.mapView");
|
|
507
|
-
console.log(this.mapView);
|
|
508
|
-
console.log("this._searchElement");
|
|
509
|
-
console.log(this._searchElement);
|
|
510
|
-
if (this.mapView && this._searchElement) {
|
|
511
|
-
console.log("this._getSearchConfig");
|
|
512
|
-
const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
|
|
513
|
-
console.log("searchConfiguration");
|
|
514
|
-
console.log(searchConfiguration);
|
|
515
|
-
const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
|
|
516
|
-
this._searchWidget = new this.Search(searchOptions);
|
|
517
|
-
this._searchWidget.on("search-clear", () => {
|
|
518
|
-
void this._clearResults(false);
|
|
519
|
-
});
|
|
520
|
-
this._searchWidget.on("select-result", (searchResults) => {
|
|
521
|
-
var _a;
|
|
522
|
-
void this._clearResults(false);
|
|
523
|
-
if (searchResults.result) {
|
|
524
|
-
this._searchResult = searchResults.result;
|
|
525
|
-
this._updateSelection(interfaces$1.EWorkflowType.SEARCH, [searchResults.result.feature], (_a = searchResults === null || searchResults === void 0 ? void 0 : searchResults.result) === null || _a === void 0 ? void 0 : _a.name, true);
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
console.log("END search widget init");
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* Initialize the search widget based on user defined configuration
|
|
533
|
-
*
|
|
534
|
-
* @param searchConfiguration search configuration defined by the user
|
|
535
|
-
* @param view the current map view
|
|
536
|
-
*
|
|
537
|
-
* @protected
|
|
538
|
-
*/
|
|
539
|
-
_getSearchConfig(searchConfiguration, view) {
|
|
540
|
-
var _a;
|
|
541
|
-
const sources = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources;
|
|
542
|
-
if (sources) {
|
|
543
|
-
sources.forEach(source => {
|
|
544
|
-
var _a, _b, _c;
|
|
545
|
-
const isLayerSource = source.hasOwnProperty("layer");
|
|
546
|
-
if (isLayerSource) {
|
|
547
|
-
const layerSource = source;
|
|
548
|
-
const layerFromMap = ((_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id)
|
|
549
|
-
? view.map.findLayerById(layerSource.layer.id)
|
|
550
|
-
: null;
|
|
551
|
-
if (layerFromMap) {
|
|
552
|
-
layerSource.layer = layerFromMap;
|
|
553
|
-
}
|
|
554
|
-
else if ((_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url) {
|
|
555
|
-
layerSource.layer = new this.FeatureLayer((_c = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _c === void 0 ? void 0 : _c.url);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
(_a = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources) === null || _a === void 0 ? void 0 : _a.forEach(source => {
|
|
561
|
-
const isLocatorSource = source.hasOwnProperty("locator");
|
|
562
|
-
if (isLocatorSource) {
|
|
563
|
-
const locatorSource = source;
|
|
564
|
-
locatorSource.url = locatorSource.url;
|
|
565
|
-
delete locatorSource.url;
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
return searchConfiguration;
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Initialize the graphics layer used to store any buffer grapghics
|
|
572
|
-
*
|
|
573
|
-
* @protected
|
|
574
|
-
*/
|
|
575
|
-
_initGraphicsLayer() {
|
|
576
|
-
const title = this._translations.bufferLayer;
|
|
577
|
-
const bufferIndex = this.mapView.map.layers.findIndex((l) => l.title === title);
|
|
578
|
-
if (bufferIndex > -1) {
|
|
579
|
-
this._bufferGraphicsLayer = this.mapView.map.layers.getItemAt(bufferIndex);
|
|
580
|
-
}
|
|
581
|
-
else {
|
|
582
|
-
this._bufferGraphicsLayer = new this.GraphicsLayer({ title });
|
|
583
|
-
publicNotificationStore.state.managedLayers.push(title);
|
|
584
|
-
const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === this._translations.sketchLayer);
|
|
585
|
-
if (sketchIndex > -1) {
|
|
586
|
-
this.mapView.map.layers.add(this._bufferGraphicsLayer, sketchIndex);
|
|
587
|
-
}
|
|
588
|
-
else {
|
|
589
|
-
this.mapView.map.layers.add(this._bufferGraphicsLayer);
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
* Store the layer select checked change
|
|
595
|
-
*
|
|
596
|
-
* @protected
|
|
597
|
-
*/
|
|
598
|
-
_layerSelectChanged() {
|
|
599
|
-
this._layerSelectChecked = this._selectFromLayerElement.checked;
|
|
600
|
-
this.sketchTypeChange.emit(this._layerSelectChecked ? interfaces$1.ESketchType.LAYER : interfaces$1.ESketchType.INTERACTIVE);
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Store workflow type change
|
|
604
|
-
*
|
|
605
|
-
* @protected
|
|
606
|
-
*/
|
|
607
|
-
_workflowChange(evt) {
|
|
608
|
-
this._workflowType = evt.detail;
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* Highlight the features in the map
|
|
612
|
-
*
|
|
613
|
-
* @protected
|
|
614
|
-
*/
|
|
615
|
-
async _highlightFeatures(ids) {
|
|
616
|
-
var _a;
|
|
617
|
-
(_a = publicNotificationStore.state.highlightHandle) === null || _a === void 0 ? void 0 : _a.remove();
|
|
618
|
-
if (ids.length > 0) {
|
|
619
|
-
publicNotificationStore.state.highlightHandle = await mapViewUtils.highlightFeatures(ids, this.selectLayerView, this.mapView);
|
|
620
|
-
}
|
|
621
|
-
this.selectionSetChange.emit(ids.length);
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* Query the selectLayerView based on any user drawn geometries or buffers
|
|
625
|
-
*
|
|
626
|
-
* @param geometries Array of geometries used for the selection of ids from the select layer view
|
|
627
|
-
*
|
|
628
|
-
* @returns Promise when the selection is complete and the graphics have been highlighted
|
|
629
|
-
*/
|
|
630
|
-
async _selectFeatures(geometries) {
|
|
631
|
-
this._selectedIds = await mapViewUtils.queryObjectIds(geometries, this.selectLayerView.layer);
|
|
632
|
-
// Add geometries used for selecting features as graphics
|
|
633
|
-
this._drawTools.graphics = this.geometries.map(geom => {
|
|
634
|
-
var _a, _b, _c;
|
|
635
|
-
const props = {
|
|
636
|
-
"geometry": geom,
|
|
637
|
-
"symbol": geom.type === "point" ?
|
|
638
|
-
(_a = this._drawTools) === null || _a === void 0 ? void 0 : _a.pointSymbol : geom.type === "polyline" ?
|
|
639
|
-
(_b = this._drawTools) === null || _b === void 0 ? void 0 : _b.polylineSymbol : geom.type === "polygon" ?
|
|
640
|
-
(_c = this._drawTools) === null || _c === void 0 ? void 0 : _c.polygonSymbol : undefined
|
|
641
|
-
};
|
|
642
|
-
return new this.Graphic(props);
|
|
643
|
-
});
|
|
644
|
-
void this._highlightFeatures(this._selectedIds);
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* Query the selectLayerView based on any user drawn geometries or buffers
|
|
648
|
-
*
|
|
649
|
-
* @param evt CustomEvent that contains the result of the buffer
|
|
650
|
-
*
|
|
651
|
-
* @protected
|
|
652
|
-
*/
|
|
653
|
-
async _bufferComplete(evt) {
|
|
654
|
-
var _a, _b;
|
|
655
|
-
this._bufferGeometry = Array.isArray(evt.detail) ?
|
|
656
|
-
evt.detail[0] : evt.detail;
|
|
657
|
-
if (this._bufferGeometry) {
|
|
658
|
-
// Create a symbol for rendering the graphic
|
|
659
|
-
const symbol = {
|
|
660
|
-
type: "simple-fill",
|
|
661
|
-
color: this.bufferColor,
|
|
662
|
-
outline: {
|
|
663
|
-
color: this.bufferOutlineColor,
|
|
664
|
-
width: 1
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
// Add the geometry and symbol to a new graphic
|
|
668
|
-
const polygonGraphic = new this.Graphic({
|
|
669
|
-
geometry: this._bufferGeometry,
|
|
670
|
-
symbol
|
|
671
|
-
});
|
|
672
|
-
this._bufferGraphicsLayer.removeAll();
|
|
673
|
-
this._bufferGraphicsLayer.add(polygonGraphic);
|
|
674
|
-
void this._selectFeatures([this._bufferGeometry]);
|
|
675
|
-
void this.mapView.goTo(polygonGraphic.geometry.extent);
|
|
676
|
-
}
|
|
677
|
-
else {
|
|
678
|
-
if (this._bufferGraphicsLayer) {
|
|
679
|
-
this._bufferGraphicsLayer.removeAll();
|
|
680
|
-
}
|
|
681
|
-
if (this._skipGeomQuery || ((_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.skipGeomQuery)) {
|
|
682
|
-
this._selectedIds = (_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.selectedIds;
|
|
683
|
-
void this._highlightFeatures(this._selectedIds);
|
|
684
|
-
}
|
|
685
|
-
else {
|
|
686
|
-
void this._geomQuery(this.geometries);
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Fetch a single geometry for each potential geometry type
|
|
692
|
-
*
|
|
693
|
-
* @param geometries All current selection geometries
|
|
694
|
-
*
|
|
695
|
-
* @protected
|
|
696
|
-
*/
|
|
697
|
-
_geomQuery(geometries) {
|
|
698
|
-
const queryGeoms = mapViewUtils.getQueryGeoms(geometries, this._geometryEngine);
|
|
699
|
-
return this._selectFeatures(queryGeoms);
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* Clear all stored values and general state for the component
|
|
703
|
-
*
|
|
704
|
-
* @param clearSearchWidget Optional boolean for clearing the search widget (default is true)
|
|
705
|
-
* @param clearLabel Optional boolean for clearing the search label (default is true)
|
|
706
|
-
*
|
|
707
|
-
* @protected
|
|
708
|
-
*/
|
|
709
|
-
async _clearResults(clearSearchWidget = true, clearLabel = true) {
|
|
710
|
-
var _a, _b;
|
|
711
|
-
this._selectedIds = [];
|
|
712
|
-
if (clearLabel) {
|
|
713
|
-
this._selectionLabel = "";
|
|
714
|
-
}
|
|
715
|
-
if (this._bufferGraphicsLayer) {
|
|
716
|
-
this._bufferGraphicsLayer.removeAll();
|
|
717
|
-
}
|
|
718
|
-
if (clearSearchWidget && this._searchWidget) {
|
|
719
|
-
this._searchWidget.clear();
|
|
720
|
-
}
|
|
721
|
-
(_a = publicNotificationStore.state.highlightHandle) === null || _a === void 0 ? void 0 : _a.remove();
|
|
722
|
-
// for sketch
|
|
723
|
-
// checking for clear as it would throw off tests
|
|
724
|
-
if ((_b = this._drawTools) === null || _b === void 0 ? void 0 : _b.clear) {
|
|
725
|
-
void this._drawTools.clear();
|
|
726
|
-
}
|
|
727
|
-
this.selectionSetChange.emit(this._selectedIds.length);
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* Fetch a single geometry for the current geometry type
|
|
731
|
-
*
|
|
732
|
-
* @param type worflow type
|
|
733
|
-
* @param graphics graphics to be used for selection
|
|
734
|
-
* @param label selection label
|
|
735
|
-
* @param useGeoms indicates if the geometries should be used directly for selections
|
|
736
|
-
* @param oids list of IDs to select when useGeoms is false
|
|
737
|
-
*
|
|
738
|
-
* @protected
|
|
739
|
-
*/
|
|
740
|
-
_updateSelection(type, graphics, label, useGeoms, oids) {
|
|
741
|
-
this._selectedIds = oids ? oids : this._selectedIds;
|
|
742
|
-
// see https://github.com/Esri/solutions-components/issues/148
|
|
743
|
-
this._skipGeomQuery = !useGeoms;
|
|
744
|
-
this.geometries = Array.isArray(graphics) ? graphics.map(g => g.geometry) : this.geometries;
|
|
745
|
-
this._workflowType = type;
|
|
746
|
-
this._selectionLabel = label;
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
* Fetches the component's translations
|
|
750
|
-
*
|
|
751
|
-
* @protected
|
|
752
|
-
*/
|
|
753
|
-
async _getTranslations() {
|
|
754
|
-
const translations = await locale.getLocaleComponentStrings(this.el);
|
|
755
|
-
this._translations = translations[0];
|
|
13
|
+
/** @license
|
|
14
|
+
* Copyright 2022 Esri
|
|
15
|
+
*
|
|
16
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
* you may not use this file except in compliance with the License.
|
|
18
|
+
* You may obtain a copy of the License at
|
|
19
|
+
*
|
|
20
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
23
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
24
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
25
|
+
* See the License for the specific language governing permissions and
|
|
26
|
+
* limitations under the License.
|
|
27
|
+
*/
|
|
28
|
+
//#region Public functions
|
|
29
|
+
/**
|
|
30
|
+
* Export a csv of the attributes from the features that match the provided ids
|
|
31
|
+
*
|
|
32
|
+
* @param labels Labels to write
|
|
33
|
+
*/
|
|
34
|
+
function exportCSV(labels) {
|
|
35
|
+
// Format values to string so it doesn't get tripped up when a value has a comma
|
|
36
|
+
// another option could be to export with a different delimiter
|
|
37
|
+
const outputLines = labels.map(label => Object.values(label).map(v => `"${v}"`).join(",") + "\r\n");
|
|
38
|
+
_downloadCSVFile(outputLines, `notify-${Date.now().toString()}`);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region Private functions
|
|
42
|
+
/**
|
|
43
|
+
* Download the CSV file
|
|
44
|
+
*
|
|
45
|
+
* @param outputLines Lines of output to write to file
|
|
46
|
+
* @param fileTitle Title (without file extension) to use for file; defaults to "export"
|
|
47
|
+
*
|
|
48
|
+
* @see {@link https://medium.com/@danny.pule/export-json-to-csv-file-using-javascript-a0b7bc5b00d2}
|
|
49
|
+
*/
|
|
50
|
+
function _downloadCSVFile(outputLines, fileTitle) {
|
|
51
|
+
const link = document.createElement("a");
|
|
52
|
+
if (link.download !== undefined) {
|
|
53
|
+
link.href = URL.createObjectURL(new Blob(outputLines, { type: "text/csv;charset=utf-8;" }));
|
|
54
|
+
link.download = `${fileTitle}.csv` || "export.csv";
|
|
55
|
+
link.style.visibility = "hidden";
|
|
56
|
+
document.body.appendChild(link);
|
|
57
|
+
link.click();
|
|
58
|
+
document.body.removeChild(link);
|
|
756
59
|
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
"geometries": ["watchGeometriesHandler"],
|
|
760
|
-
"searchConfiguration": ["watchSearchConfigurationHandler"],
|
|
761
|
-
"_workflowType": ["workflowTypeHandler"]
|
|
762
|
-
}; }
|
|
763
|
-
};
|
|
764
|
-
MapSelectTools.style = mapSelectToolsCss;
|
|
765
|
-
|
|
766
|
-
const labelFormats = [
|
|
767
|
-
{
|
|
768
|
-
descriptionPDF: {
|
|
769
|
-
labelWidthDisplay: "2-5/8",
|
|
770
|
-
labelHeightDisplay: "1",
|
|
771
|
-
labelsPerPageDisplay: "30",
|
|
772
|
-
averyPartNumber: "*60"
|
|
773
|
-
},
|
|
774
|
-
labelSpec: {
|
|
775
|
-
type: "AVERY",
|
|
776
|
-
pageProperties: {
|
|
777
|
-
pageType: "ANSI A",
|
|
778
|
-
leftMargin: 0.1875,
|
|
779
|
-
rightMargin: 0.1875,
|
|
780
|
-
topMargin: 0.5,
|
|
781
|
-
bottomMargin: 0.5
|
|
782
|
-
},
|
|
783
|
-
numLabelsAcross: 3,
|
|
784
|
-
numLabelsDown: 10,
|
|
785
|
-
labelWidth: 2.625,
|
|
786
|
-
labelHeight: 1,
|
|
787
|
-
horizGapIn: 0.125,
|
|
788
|
-
vertGapIn: 0,
|
|
789
|
-
labelPadding: 0.1,
|
|
790
|
-
fontSizePx: 11,
|
|
791
|
-
maxNumLabelLines: 4
|
|
792
|
-
}
|
|
793
|
-
},
|
|
794
|
-
{
|
|
795
|
-
descriptionPDF: {
|
|
796
|
-
labelWidthDisplay: "4",
|
|
797
|
-
labelHeightDisplay: "1",
|
|
798
|
-
labelsPerPageDisplay: "20",
|
|
799
|
-
averyPartNumber: "*61"
|
|
800
|
-
},
|
|
801
|
-
labelSpec: {
|
|
802
|
-
type: "AVERY",
|
|
803
|
-
pageProperties: {
|
|
804
|
-
pageType: "ANSI A",
|
|
805
|
-
leftMargin: 0.15625,
|
|
806
|
-
rightMargin: 0.15625,
|
|
807
|
-
topMargin: 0.47637821,
|
|
808
|
-
bottomMargin: 0.5
|
|
809
|
-
},
|
|
810
|
-
numLabelsAcross: 2,
|
|
811
|
-
numLabelsDown: 10,
|
|
812
|
-
labelWidth: 4,
|
|
813
|
-
labelHeight: 1.0025,
|
|
814
|
-
horizGapIn: 0.1875,
|
|
815
|
-
vertGapIn: 0,
|
|
816
|
-
labelPadding: 0.1,
|
|
817
|
-
fontSizePx: 11,
|
|
818
|
-
maxNumLabelLines: 4
|
|
819
|
-
}
|
|
820
|
-
},
|
|
821
|
-
{
|
|
822
|
-
descriptionPDF: {
|
|
823
|
-
labelWidthDisplay: "4",
|
|
824
|
-
labelHeightDisplay: "1-1/3",
|
|
825
|
-
labelsPerPageDisplay: "14",
|
|
826
|
-
averyPartNumber: "*62"
|
|
827
|
-
},
|
|
828
|
-
labelSpec: {
|
|
829
|
-
type: "AVERY",
|
|
830
|
-
pageProperties: {
|
|
831
|
-
pageType: "ANSI A",
|
|
832
|
-
leftMargin: 0.15625,
|
|
833
|
-
rightMargin: 0.15625,
|
|
834
|
-
topMargin: 0.81889808,
|
|
835
|
-
bottomMargin: 0.83464612
|
|
836
|
-
},
|
|
837
|
-
numLabelsAcross: 2,
|
|
838
|
-
numLabelsDown: 7,
|
|
839
|
-
labelWidth: 4,
|
|
840
|
-
labelHeight: 1.3352,
|
|
841
|
-
horizGapIn: 0.1875,
|
|
842
|
-
vertGapIn: 0,
|
|
843
|
-
labelPadding: 0.1,
|
|
844
|
-
fontSizePx: 11,
|
|
845
|
-
maxNumLabelLines: 6
|
|
846
|
-
}
|
|
847
|
-
},
|
|
848
|
-
{
|
|
849
|
-
descriptionPDF: {
|
|
850
|
-
labelWidthDisplay: "4",
|
|
851
|
-
labelHeightDisplay: "2",
|
|
852
|
-
labelsPerPageDisplay: "10",
|
|
853
|
-
averyPartNumber: "*63"
|
|
854
|
-
},
|
|
855
|
-
labelSpec: {
|
|
856
|
-
type: "AVERY",
|
|
857
|
-
pageProperties: {
|
|
858
|
-
pageType: "ANSI A",
|
|
859
|
-
leftMargin: 0.15625,
|
|
860
|
-
rightMargin: 0.15625,
|
|
861
|
-
topMargin: 0.5,
|
|
862
|
-
bottomMargin: 0.5
|
|
863
|
-
},
|
|
864
|
-
numLabelsAcross: 2,
|
|
865
|
-
numLabelsDown: 5,
|
|
866
|
-
labelWidth: 4,
|
|
867
|
-
labelHeight: 2,
|
|
868
|
-
horizGapIn: 0.1875,
|
|
869
|
-
vertGapIn: 0,
|
|
870
|
-
labelPadding: 0.1,
|
|
871
|
-
fontSizePx: 12,
|
|
872
|
-
maxNumLabelLines: 10
|
|
873
|
-
}
|
|
874
|
-
},
|
|
875
|
-
{
|
|
876
|
-
descriptionPDF: {
|
|
877
|
-
labelWidthDisplay: "4",
|
|
878
|
-
labelHeightDisplay: "3-1/3",
|
|
879
|
-
labelsPerPageDisplay: "6",
|
|
880
|
-
averyPartNumber: "*64"
|
|
881
|
-
},
|
|
882
|
-
labelSpec: {
|
|
883
|
-
type: "AVERY",
|
|
884
|
-
pageProperties: {
|
|
885
|
-
pageType: "ANSI A",
|
|
886
|
-
leftMargin: 0.15625,
|
|
887
|
-
rightMargin: 0.15625,
|
|
888
|
-
topMargin: 0.4724412,
|
|
889
|
-
bottomMargin: 0.50000027
|
|
890
|
-
},
|
|
891
|
-
numLabelsAcross: 2,
|
|
892
|
-
numLabelsDown: 3,
|
|
893
|
-
labelWidth: 4,
|
|
894
|
-
labelHeight: 3.342,
|
|
895
|
-
horizGapIn: 0.1875,
|
|
896
|
-
vertGapIn: 0,
|
|
897
|
-
labelPadding: 0.1,
|
|
898
|
-
fontSizePx: 14,
|
|
899
|
-
maxNumLabelLines: 12
|
|
900
|
-
}
|
|
901
|
-
},
|
|
902
|
-
{
|
|
903
|
-
descriptionPDF: {
|
|
904
|
-
labelWidthDisplay: "1-3/4",
|
|
905
|
-
labelHeightDisplay: "1/2",
|
|
906
|
-
labelsPerPageDisplay: "80",
|
|
907
|
-
averyPartNumber: "*67"
|
|
908
|
-
},
|
|
909
|
-
labelSpec: {
|
|
910
|
-
type: "AVERY",
|
|
911
|
-
pageProperties: {
|
|
912
|
-
pageType: "ANSI A",
|
|
913
|
-
leftMargin: 0.307086375,
|
|
914
|
-
rightMargin: 0.307086375,
|
|
915
|
-
topMargin: 0.4724412,
|
|
916
|
-
bottomMargin: 0.49606326
|
|
917
|
-
},
|
|
918
|
-
numLabelsAcross: 4,
|
|
919
|
-
numLabelsDown: 20,
|
|
920
|
-
labelWidth: 1.75,
|
|
921
|
-
labelHeight: 0.50155,
|
|
922
|
-
horizGapIn: 0.29527575,
|
|
923
|
-
vertGapIn: 0,
|
|
924
|
-
labelPadding: 0.1,
|
|
925
|
-
fontSizePx: 8,
|
|
926
|
-
maxNumLabelLines: 3
|
|
927
|
-
}
|
|
928
|
-
},
|
|
929
|
-
{
|
|
930
|
-
descriptionPDF: {
|
|
931
|
-
labelWidthDisplay: "1-3/4",
|
|
932
|
-
labelHeightDisplay: "2/3",
|
|
933
|
-
labelsPerPageDisplay: "60",
|
|
934
|
-
averyPartNumber: "*95"
|
|
935
|
-
},
|
|
936
|
-
labelSpec: {
|
|
937
|
-
type: "AVERY",
|
|
938
|
-
pageProperties: {
|
|
939
|
-
pageType: "ANSI A",
|
|
940
|
-
leftMargin: 0.28936983,
|
|
941
|
-
rightMargin: 0.28936983,
|
|
942
|
-
topMargin: 0.53937037,
|
|
943
|
-
bottomMargin: 0.5511814
|
|
944
|
-
},
|
|
945
|
-
numLabelsAcross: 4,
|
|
946
|
-
numLabelsDown: 15,
|
|
947
|
-
labelWidth: 1.75,
|
|
948
|
-
labelHeight: 0.6605,
|
|
949
|
-
horizGapIn: 0.30708678,
|
|
950
|
-
vertGapIn: 0,
|
|
951
|
-
labelPadding: 0.1,
|
|
952
|
-
fontSizePx: 8,
|
|
953
|
-
maxNumLabelLines: 4
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
];
|
|
957
|
-
|
|
958
|
-
const pdfUtils = /*#__PURE__*/Object.freeze({
|
|
959
|
-
__proto__: null,
|
|
960
|
-
'default': labelFormats
|
|
961
|
-
});
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
962
62
|
|
|
963
63
|
var _typeof_1 = _commonjsHelpers.createCommonjsModule(function (module) {
|
|
964
64
|
function _typeof(obj) {
|
|
@@ -1982,7 +1082,7 @@ function(t){var e=function(t){for(var e=t.length,r=new Uint8Array(e),n=0;n<e;n++
|
|
|
1982
1082
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1983
1083
|
* ====================================================================
|
|
1984
1084
|
*/
|
|
1985
|
-
function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-
|
|
1085
|
+
function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-53f3bc97.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},
|
|
1986
1086
|
/** ====================================================================
|
|
1987
1087
|
* @license
|
|
1988
1088
|
* jsPDF XMP metadata plugin
|
|
@@ -2973,6 +2073,8 @@ class PDFLabels {
|
|
|
2973
2073
|
* See the License for the specific language governing permissions and
|
|
2974
2074
|
* limitations under the License.
|
|
2975
2075
|
*/
|
|
2076
|
+
//#endregion
|
|
2077
|
+
//#region Public functions
|
|
2976
2078
|
/**
|
|
2977
2079
|
* Exports a PDF of labels.
|
|
2978
2080
|
*
|
|
@@ -2982,6 +2084,8 @@ class PDFLabels {
|
|
|
2982
2084
|
function exportPDF(labels, labelPageDescription) {
|
|
2983
2085
|
_downloadPDFFile(labels, labelPageDescription, `notify-${Date.now().toString()}`);
|
|
2984
2086
|
}
|
|
2087
|
+
//#endregion
|
|
2088
|
+
//#region Private functions
|
|
2985
2089
|
/**
|
|
2986
2090
|
* Downloads the PDF file.
|
|
2987
2091
|
*
|
|
@@ -3002,159 +2106,210 @@ function _downloadPDFFile(labels, labelPageDescription, fileTitle) {
|
|
|
3002
2106
|
pdfLib.save();
|
|
3003
2107
|
});
|
|
3004
2108
|
});
|
|
3005
|
-
}
|
|
3006
|
-
|
|
3007
|
-
const pdfDownloadCss = ":host{display:block}";
|
|
2109
|
+
}
|
|
2110
|
+
//#endregion
|
|
3008
2111
|
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
2112
|
+
/** @license
|
|
2113
|
+
* Copyright 2022 Esri
|
|
2114
|
+
*
|
|
2115
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2116
|
+
* you may not use this file except in compliance with the License.
|
|
2117
|
+
* You may obtain a copy of the License at
|
|
2118
|
+
*
|
|
2119
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2120
|
+
*
|
|
2121
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2122
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2123
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2124
|
+
* See the License for the specific language governing permissions and
|
|
2125
|
+
* limitations under the License.
|
|
2126
|
+
*/
|
|
2127
|
+
//#endregion
|
|
2128
|
+
//#region Public functions
|
|
2129
|
+
/**
|
|
2130
|
+
* Downloads csv of mailing labels for the provided list of ids
|
|
2131
|
+
*
|
|
2132
|
+
* @param selectionSetNames Names of the selection sets used to provide ids
|
|
2133
|
+
* @param layer Layer providing features and attributes for download
|
|
2134
|
+
* @param ids List of ids to download
|
|
2135
|
+
* @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
|
|
2136
|
+
* all attributes are exported
|
|
2137
|
+
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
|
2138
|
+
* @param addColumnTitle Indicates if column headings should be included in output
|
|
2139
|
+
* @returns Promise resolving when function is done
|
|
2140
|
+
*/
|
|
2141
|
+
async function downloadCSV(selectionSetNames, layer, ids, formatUsingLayerPopup, removeDuplicates = false, addColumnTitle = false) {
|
|
2142
|
+
console.log("downloadCSV using selectionSetNames " + JSON.stringify(selectionSetNames)); //???
|
|
2143
|
+
const labels = await _prepareLabels(layer, ids, removeDuplicates, formatUsingLayerPopup, addColumnTitle);
|
|
2144
|
+
exportCSV(labels);
|
|
2145
|
+
return Promise.resolve();
|
|
2146
|
+
}
|
|
2147
|
+
/**
|
|
2148
|
+
* Downloads csv of mailing labels for the provided list of ids
|
|
2149
|
+
*
|
|
2150
|
+
* @param selectionSetNames Names of the selection sets used to provide ids
|
|
2151
|
+
* @param layer Layer providing features and attributes for download
|
|
2152
|
+
* @param ids List of ids to download
|
|
2153
|
+
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
|
2154
|
+
* @param labelPageDescription Provides PDF page layout info
|
|
2155
|
+
* @returns Promise resolving when function is done
|
|
2156
|
+
*/
|
|
2157
|
+
async function downloadPDF(selectionSetNames, layer, ids, removeDuplicates, labelPageDescription) {
|
|
2158
|
+
console.log("downloadPDF using selectionSetNames " + JSON.stringify(selectionSetNames)); //???
|
|
2159
|
+
const labels = await _prepareLabels(layer, ids, removeDuplicates);
|
|
2160
|
+
exportPDF(labels, labelPageDescription);
|
|
2161
|
+
return Promise.resolve();
|
|
2162
|
+
}
|
|
2163
|
+
//#endregion
|
|
2164
|
+
//#region Private functions
|
|
2165
|
+
/**
|
|
2166
|
+
* Converts a set of fieldInfos into template lines.
|
|
2167
|
+
*
|
|
2168
|
+
* @param fieldInfos Layer's fieldInfos structure
|
|
2169
|
+
* @param bypassFieldVisiblity Indicates if the configured fieldInfo visibility property should be ignored
|
|
2170
|
+
* @return Label spec
|
|
2171
|
+
*/
|
|
2172
|
+
function _convertPopupFieldsToLabelSpec(fieldInfos, bypassFieldVisiblity = false) {
|
|
2173
|
+
const labelSpec = [];
|
|
2174
|
+
// Every visible attribute is used
|
|
2175
|
+
fieldInfos.forEach(fieldInfo => {
|
|
2176
|
+
if (fieldInfo.visible || bypassFieldVisiblity) {
|
|
2177
|
+
labelSpec.push(`{${fieldInfo.fieldName}}`);
|
|
2178
|
+
}
|
|
2179
|
+
});
|
|
2180
|
+
return labelSpec;
|
|
2181
|
+
}
|
|
2182
|
+
/**
|
|
2183
|
+
* Converts the text of a custom popup into a multiline label specification; conversion splits text into
|
|
2184
|
+
* lines on <br>s, and removes HTML tags. It does not handle Arcade and related records.
|
|
2185
|
+
*
|
|
2186
|
+
* @param popupInfo Layer's popupInfo structure containing description, fieldInfos, and expressionInfos, e.g.,
|
|
2187
|
+
* "<div style='text-align: left;'>{NAME}<br />{STREET}<br />{CITY}, {STATE} {ZIP} <br /></div>"
|
|
2188
|
+
* @return Label spec
|
|
2189
|
+
*/
|
|
2190
|
+
function _convertPopupTextToLabelSpec(popupInfo) {
|
|
2191
|
+
// Replace <br>, <br/> with |
|
|
2192
|
+
popupInfo = popupInfo.replace(/<br\s*\/?>/gi, "|");
|
|
2193
|
+
// Remove remaining HTML tags, replace 0xA0 that popup uses for spaces, replace some char representations,
|
|
2194
|
+
// and split the label back into individual lines
|
|
2195
|
+
let labelSpec = popupInfo
|
|
2196
|
+
.replace(/<[\s.]*[^<>]*\/?>/gi, "")
|
|
2197
|
+
.replace(/\xA0/gi, " ")
|
|
2198
|
+
.replace(/</gi, "<")
|
|
2199
|
+
.replace(/>/gi, ">")
|
|
2200
|
+
.replace(/ /gi, " ")
|
|
2201
|
+
.split("|");
|
|
2202
|
+
// Trim lines and remove empties
|
|
2203
|
+
labelSpec = labelSpec.map(line => line.trim()).filter(line => line.length > 0);
|
|
2204
|
+
return labelSpec;
|
|
2205
|
+
}
|
|
2206
|
+
/**
|
|
2207
|
+
* Extracts Arcade expressions from the lines of a label format and creates an Arcade executor for each
|
|
2208
|
+
* referenced expression name.
|
|
2209
|
+
*
|
|
2210
|
+
* @param labelFormat Label to examine
|
|
2211
|
+
* @param layer Layer from which to fetch features
|
|
2212
|
+
* @return Promise resolving to a set of executors keyed using the expression name
|
|
2213
|
+
*/
|
|
2214
|
+
async function _createArcadeExecutors(labelFormat, layer) {
|
|
2215
|
+
const arcadeExecutors = {};
|
|
2216
|
+
// Are any Arcade expressions in the layer?
|
|
2217
|
+
if (!Array.isArray(layer.popupTemplate.expressionInfos) || layer.popupTemplate.expressionInfos.length === 0) {
|
|
2218
|
+
return Promise.resolve(arcadeExecutors);
|
|
2219
|
+
}
|
|
2220
|
+
// Are there any Arcade expressions in the label format?
|
|
2221
|
+
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
|
2222
|
+
const arcadeExpressionsMatches = labelFormat.join("|").match(arcadeExpressionRegExp);
|
|
2223
|
+
if (!arcadeExpressionsMatches) {
|
|
2224
|
+
return Promise.resolve(arcadeExecutors);
|
|
2225
|
+
}
|
|
2226
|
+
// Generate an Arcade executor for each match
|
|
2227
|
+
const [arcade] = await loadModules.loadModules(["esri/arcade"]);
|
|
2228
|
+
const labelingProfile = arcade.createArcadeProfile("popup");
|
|
2229
|
+
const createArcadeExecutorPromises = {};
|
|
2230
|
+
arcadeExpressionsMatches.forEach((match) => {
|
|
2231
|
+
const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
|
|
2232
|
+
(layer.popupTemplate.expressionInfos || []).forEach(expressionInfo => {
|
|
2233
|
+
if (expressionInfo.name === expressionName) {
|
|
2234
|
+
createArcadeExecutorPromises[expressionName] =
|
|
2235
|
+
arcade.createArcadeExecutor(expressionInfo.expression, labelingProfile);
|
|
2236
|
+
}
|
|
2237
|
+
});
|
|
2238
|
+
});
|
|
2239
|
+
const promises = Object.values(createArcadeExecutorPromises);
|
|
2240
|
+
return Promise.all(promises)
|
|
2241
|
+
.then(executors => {
|
|
2242
|
+
const expressionNames = Object.keys(createArcadeExecutorPromises);
|
|
2243
|
+
for (let i = 0; i < expressionNames.length; ++i) {
|
|
2244
|
+
arcadeExecutors[expressionNames[i]] = executors[i].valueOf();
|
|
2245
|
+
}
|
|
2246
|
+
return arcadeExecutors;
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2249
|
+
/**
|
|
2250
|
+
* Creates labels from items.
|
|
2251
|
+
*
|
|
2252
|
+
* @param layer Layer from which to fetch features
|
|
2253
|
+
* @param ids List of ids to download
|
|
2254
|
+
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
|
2255
|
+
* @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
|
|
2256
|
+
* all attributes are exported
|
|
2257
|
+
* @param includeHeaderNames Add the label format at the front of the list of generated labels
|
|
2258
|
+
* @returns Promise resolving when function is done
|
|
2259
|
+
*/
|
|
2260
|
+
async function _prepareLabels(layer, ids, removeDuplicates = true, formatUsingLayerPopup = true, includeHeaderNames = false) {
|
|
2261
|
+
var _a, _b, _c, _d;
|
|
2262
|
+
const [intl] = await loadModules.loadModules(["esri/intl"]);
|
|
2263
|
+
// Get the features to export
|
|
2264
|
+
const featureSet = await mapViewUtils.queryFeaturesByID(ids, layer);
|
|
2265
|
+
// Get the label formatting, if any
|
|
2266
|
+
let labelFormat;
|
|
2267
|
+
let arcadeExecutors = {};
|
|
2268
|
+
if (layer.popupEnabled) {
|
|
3150
2269
|
// What data fields are used in the labels?
|
|
3151
2270
|
// Example labelFormat: ['{NAME}', '{STREET}', '{CITY}, {STATE} {ZIP}']
|
|
3152
|
-
|
|
2271
|
+
if (formatUsingLayerPopup && ((_b = (_a = layer.popupTemplate) === null || _a === void 0 ? void 0 : _a.content[0]) === null || _b === void 0 ? void 0 : _b.type) === "fields") {
|
|
2272
|
+
labelFormat = _convertPopupFieldsToLabelSpec(layer.popupTemplate.fieldInfos);
|
|
2273
|
+
// If popup is configured with "no attribute information", then no fields will visible
|
|
2274
|
+
if (labelFormat.length === 0) {
|
|
2275
|
+
// Can we use the popup title?
|
|
2276
|
+
// eslint-disable-next-line unicorn/prefer-ternary
|
|
2277
|
+
if (typeof layer.popupTemplate.title === "string") {
|
|
2278
|
+
labelFormat = [layer.popupTemplate.title];
|
|
2279
|
+
// Otherwise revert to using attributes
|
|
2280
|
+
}
|
|
2281
|
+
else {
|
|
2282
|
+
labelFormat = _convertPopupFieldsToLabelSpec(layer.popupTemplate.fieldInfos, true);
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
else if (formatUsingLayerPopup && ((_d = (_c = layer.popupTemplate) === null || _c === void 0 ? void 0 : _c.content[0]) === null || _d === void 0 ? void 0 : _d.type) === "text") {
|
|
2287
|
+
labelFormat = _convertPopupTextToLabelSpec(layer.popupTemplate.content[0].text);
|
|
2288
|
+
// Do we need any Arcade executors?
|
|
2289
|
+
arcadeExecutors = await _createArcadeExecutors(labelFormat, layer);
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
// Apply the label format
|
|
2293
|
+
let labels;
|
|
2294
|
+
// eslint-disable-next-line unicorn/prefer-ternary
|
|
2295
|
+
if (labelFormat) {
|
|
2296
|
+
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
|
3153
2297
|
// Convert attributes into an array of labels
|
|
3154
|
-
|
|
2298
|
+
labels = featureSet.features.map(feature => {
|
|
3155
2299
|
const label = [];
|
|
3156
2300
|
labelFormat.forEach(labelLineTemplate => {
|
|
3157
|
-
|
|
2301
|
+
let labelLine = labelLineTemplate;
|
|
2302
|
+
// Replace Arcade expressions
|
|
2303
|
+
const arcadeExpressionsMatches = labelLine.match(arcadeExpressionRegExp);
|
|
2304
|
+
if (arcadeExpressionsMatches) {
|
|
2305
|
+
arcadeExpressionsMatches.forEach((match) => {
|
|
2306
|
+
const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
|
|
2307
|
+
const replacement = arcadeExecutors[expressionName].execute({ "$feature": feature });
|
|
2308
|
+
labelLine = labelLine.replace(match, replacement);
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
// Replace fields; must be done after Arcade check because `substitute` will discard Arcade expressions!
|
|
2312
|
+
labelLine = intl.substitute(labelLine, feature.attributes).trim();
|
|
3158
2313
|
if (labelLine.length > 0) {
|
|
3159
2314
|
label.push(labelLine);
|
|
3160
2315
|
}
|
|
@@ -3163,299 +2318,39 @@ const PdfDownload = class {
|
|
|
3163
2318
|
})
|
|
3164
2319
|
// Remove empty labels
|
|
3165
2320
|
.filter(label => label.length > 0);
|
|
3166
|
-
// Remove duplicates
|
|
3167
|
-
if (removeDuplicates) {
|
|
3168
|
-
const labelsAsStrings = labels.map(label => JSON.stringify(label));
|
|
3169
|
-
const uniqueLabels = new Set(labelsAsStrings);
|
|
3170
|
-
labels = Array.from(uniqueLabels, labelString => JSON.parse(labelString));
|
|
3171
|
-
}
|
|
3172
|
-
// Add header names
|
|
3173
|
-
if (includeHeaderNames) {
|
|
3174
|
-
const headerNames = labelFormat.map(labelFormatLine => labelFormatLine.replace(/\{/g, "").replace(/\}/g, ""));
|
|
3175
|
-
labels.unshift(headerNames);
|
|
3176
|
-
}
|
|
3177
|
-
return Promise.resolve(labels);
|
|
3178
2321
|
}
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
*
|
|
3184
|
-
* @protected
|
|
3185
|
-
*/
|
|
3186
|
-
_renderItems() {
|
|
3187
|
-
const s = pdfUtils;
|
|
3188
|
-
const sortedPdfIndo = (s.default || s).sort((a, b) => {
|
|
3189
|
-
const _a = parseInt(a.descriptionPDF.labelsPerPageDisplay, 10);
|
|
3190
|
-
const _b = parseInt(b.descriptionPDF.labelsPerPageDisplay, 10);
|
|
3191
|
-
return _a < _b ? -1 : _a > _b ? 1 : 0;
|
|
3192
|
-
});
|
|
3193
|
-
return sortedPdfIndo.map((l) => {
|
|
3194
|
-
return (index.h("calcite-option", { value: l }, this._getLabelSizeText(l)));
|
|
2322
|
+
else {
|
|
2323
|
+
// Export all attributes
|
|
2324
|
+
labels = featureSet.features.map(feature => {
|
|
2325
|
+
return Object.values(feature.attributes).map(attribute => `${attribute}`);
|
|
3195
2326
|
});
|
|
3196
2327
|
}
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
const RefineSelection = class {
|
|
3204
|
-
constructor(hostRef) {
|
|
3205
|
-
index.registerInstance(this, hostRef);
|
|
3206
|
-
this.selectionSetsChanged = index.createEvent(this, "selectionSetsChanged", 7);
|
|
3207
|
-
//--------------------------------------------------------------------------
|
|
3208
|
-
//
|
|
3209
|
-
// Properties (protected)
|
|
3210
|
-
//
|
|
3211
|
-
//--------------------------------------------------------------------------
|
|
3212
|
-
/**
|
|
3213
|
-
* boolean: Indicates if any new graphics should be added or removed
|
|
3214
|
-
*/
|
|
3215
|
-
this._addEnabled = true;
|
|
3216
|
-
this.addresseeLayer = undefined;
|
|
3217
|
-
this.enabledLayerIds = [];
|
|
3218
|
-
this.mapView = undefined;
|
|
3219
|
-
this.selectionSets = [];
|
|
3220
|
-
this.GraphicsLayer = undefined;
|
|
3221
|
-
this.SketchViewModel = undefined;
|
|
3222
|
-
this._translations = undefined;
|
|
2328
|
+
// Remove duplicates
|
|
2329
|
+
if (removeDuplicates) {
|
|
2330
|
+
const labelsAsStrings = labels.map(label => JSON.stringify(label));
|
|
2331
|
+
const uniqueLabels = new Set(labelsAsStrings);
|
|
2332
|
+
labels = Array.from(uniqueLabels, labelString => JSON.parse(labelString));
|
|
3223
2333
|
}
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
/**
|
|
3230
|
-
* Called each time the addresseeLayer is changed.
|
|
3231
|
-
* Add a new clean refine set for the new addressee layer.
|
|
3232
|
-
*/
|
|
3233
|
-
addresseeLayerWatchHandler() {
|
|
3234
|
-
const selectionSets = this.selectionSets.filter(ss => ss.workflowType !== interfaces$1.EWorkflowType.REFINE);
|
|
3235
|
-
this.selectionSets = this._initRefineSelectionSet(selectionSets);
|
|
3236
|
-
}
|
|
3237
|
-
/**
|
|
3238
|
-
* Handles changes to refine selection ids.
|
|
3239
|
-
*
|
|
3240
|
-
*/
|
|
3241
|
-
refineSelectionIdsChange(event) {
|
|
3242
|
-
var _a, _b;
|
|
3243
|
-
const addIds = ((_a = event.detail) === null || _a === void 0 ? void 0 : _a.addIds) || [];
|
|
3244
|
-
const removeIds = ((_b = event.detail) === null || _b === void 0 ? void 0 : _b.removeIds) || [];
|
|
3245
|
-
this._updateSelectionSets(removeIds);
|
|
3246
|
-
this._updateRefineSelectionSet(addIds, removeIds);
|
|
3247
|
-
}
|
|
3248
|
-
//--------------------------------------------------------------------------
|
|
3249
|
-
//
|
|
3250
|
-
// Functions (lifecycle)
|
|
3251
|
-
//
|
|
3252
|
-
//--------------------------------------------------------------------------
|
|
3253
|
-
/**
|
|
3254
|
-
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
3255
|
-
*/
|
|
3256
|
-
async componentWillLoad() {
|
|
3257
|
-
await this._getTranslations();
|
|
3258
|
-
const refineSet = this._getRefineSelectionSet(this.selectionSets);
|
|
3259
|
-
if (!refineSet) {
|
|
3260
|
-
this.selectionSets = this._initRefineSelectionSet(this.selectionSets);
|
|
2334
|
+
// Add header names
|
|
2335
|
+
if (includeHeaderNames) {
|
|
2336
|
+
let headerNames = [];
|
|
2337
|
+
if (labelFormat) {
|
|
2338
|
+
headerNames = labelFormat.map(labelFormatLine => labelFormatLine.replace(/\{/g, "").replace(/\}/g, ""));
|
|
3261
2339
|
}
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
return (index.h(index.Host, null, index.h("div", { class: "padding-1" }, index.h("div", null, index.h("calcite-radio-group", { class: "w-100", onCalciteRadioGroupChange: (evt) => this._modeChanged(evt) }, index.h("calcite-radio-group-item", { checked: this._addEnabled, class: "w-50", onClick: () => this._setSelectionMode(interfaces$1.ESelectionMode.ADD), value: interfaces$1.ESelectionMode.ADD }, this._translations.add), index.h("calcite-radio-group-item", { checked: !this._addEnabled, class: "w-50", onClick: () => this._setSelectionMode(interfaces$1.ESelectionMode.REMOVE), value: interfaces$1.ESelectionMode.REMOVE }, this._translations.remove)), index.h("refine-selection-tools", { border: true, enabledLayerIds: this.enabledLayerIds, ids: publicNotificationUtils.getSelectionIds(this.selectionSets), layerViews: [this.addresseeLayer], mapView: this.mapView, mode: this._addEnabled ? interfaces$1.ESelectionMode.ADD : interfaces$1.ESelectionMode.REMOVE, ref: (el) => { this._refineTools = el; }, refineMode: interfaces$1.ERefineMode.ALL, refineSelectionSet: this._getRefineSelectionSet(this.selectionSets), useLayerPicker: false })), index.h("br", null), (index.h("calcite-list", { class: "list-border" }, this._getRefineSelectionSetList())))));
|
|
3268
|
-
}
|
|
3269
|
-
//--------------------------------------------------------------------------
|
|
3270
|
-
//
|
|
3271
|
-
// Functions (protected)
|
|
3272
|
-
//
|
|
3273
|
-
//--------------------------------------------------------------------------
|
|
3274
|
-
/**
|
|
3275
|
-
* Store the Add/Remove mode
|
|
3276
|
-
*
|
|
3277
|
-
* @protected
|
|
3278
|
-
*/
|
|
3279
|
-
_modeChanged(evt) {
|
|
3280
|
-
this._addEnabled = evt.detail === interfaces$1.ESelectionMode.ADD;
|
|
3281
|
-
}
|
|
3282
|
-
/**
|
|
3283
|
-
* Set the refine tools selection mode
|
|
3284
|
-
*
|
|
3285
|
-
* @protected
|
|
3286
|
-
*/
|
|
3287
|
-
_setSelectionMode(mode) {
|
|
3288
|
-
this._refineTools.mode = mode;
|
|
3289
|
-
}
|
|
3290
|
-
/**
|
|
3291
|
-
* Create a list to show the number added/removed/total unique selected
|
|
3292
|
-
*
|
|
3293
|
-
* @returns the list node
|
|
3294
|
-
* @protected
|
|
3295
|
-
*/
|
|
3296
|
-
_getRefineSelectionSetList() {
|
|
3297
|
-
const total = publicNotificationUtils.getTotal(this.selectionSets);
|
|
3298
|
-
const refineSet = this._getRefineSelectionSet(this.selectionSets);
|
|
3299
|
-
const numAdded = (refineSet === null || refineSet === void 0 ? void 0 : refineSet.refineIds.addIds.length) || 0;
|
|
3300
|
-
const numRemoved = (refineSet === null || refineSet === void 0 ? void 0 : refineSet.refineIds.removeIds.length) || 0;
|
|
3301
|
-
return [(index.h("calcite-list-item", { label: this._translations.featuresAdded.replace("{{n}}", numAdded.toString()) })), (index.h("calcite-list-item", { label: this._translations.featuresRemoved.replace("{{n}}", numRemoved.toString()) })), (index.h("calcite-list-item", { label: this._translations.totalSelected.replace("{{n}}", total.toString()) }))];
|
|
3302
|
-
}
|
|
3303
|
-
/**
|
|
3304
|
-
* Fetch the refine selection set
|
|
3305
|
-
*
|
|
3306
|
-
* @returns the refine selection set
|
|
3307
|
-
* @protected
|
|
3308
|
-
*/
|
|
3309
|
-
_getRefineSelectionSet(selectionSets) {
|
|
3310
|
-
let refineSelectionSet;
|
|
3311
|
-
selectionSets.some(ss => {
|
|
3312
|
-
if (ss.workflowType === interfaces$1.EWorkflowType.REFINE) {
|
|
3313
|
-
refineSelectionSet = ss;
|
|
3314
|
-
return true;
|
|
3315
|
-
}
|
|
3316
|
-
});
|
|
3317
|
-
return refineSelectionSet;
|
|
3318
|
-
}
|
|
3319
|
-
/**
|
|
3320
|
-
* Remove ids from existing selection sets.
|
|
3321
|
-
* Remove any selection sets than have no selected ids
|
|
3322
|
-
* This can update any selection set not just the refine set.
|
|
3323
|
-
* We do not do something similar for adds as we will only ever add from refine tools to the single REFINE selection set.
|
|
3324
|
-
*
|
|
3325
|
-
* @param removeIds the ids to remove
|
|
3326
|
-
*
|
|
3327
|
-
* @protected
|
|
3328
|
-
*/
|
|
3329
|
-
_updateSelectionSets(removeIds) {
|
|
3330
|
-
if (removeIds.length > 0) {
|
|
3331
|
-
this.selectionSets = this.selectionSets.reduce((prev, cur) => {
|
|
3332
|
-
cur.selectedIds = cur.selectedIds.filter(id => removeIds.indexOf(id) < 0);
|
|
3333
|
-
if (cur.selectedIds.length > 0 || cur.workflowType === interfaces$1.EWorkflowType.REFINE) {
|
|
3334
|
-
prev.push(cur);
|
|
2340
|
+
else {
|
|
2341
|
+
const featuresAttrs = featureSet.features[0].attributes;
|
|
2342
|
+
Object.keys(featuresAttrs).forEach(k => {
|
|
2343
|
+
if (featuresAttrs[0].hasOwnProperty(k)) {
|
|
2344
|
+
headerNames.push(k);
|
|
3335
2345
|
}
|
|
3336
|
-
|
|
3337
|
-
}, []);
|
|
3338
|
-
this.selectionSetsChanged.emit(this.selectionSets);
|
|
3339
|
-
}
|
|
3340
|
-
}
|
|
3341
|
-
/**
|
|
3342
|
-
* Update the refine selection set with any adds or removes
|
|
3343
|
-
*
|
|
3344
|
-
* @param addIds any ids to add
|
|
3345
|
-
* @param removeIds any ids to remove
|
|
3346
|
-
*
|
|
3347
|
-
* @returns Promise resolving when function is done
|
|
3348
|
-
* @protected
|
|
3349
|
-
*/
|
|
3350
|
-
_updateRefineSelectionSet(addIds, removeIds) {
|
|
3351
|
-
const selectionSet = this._getRefineSelectionSet(this.selectionSets);
|
|
3352
|
-
this._updateRefineIds(selectionSet, addIds, removeIds);
|
|
3353
|
-
this.selectionSetsChanged.emit(this.selectionSets);
|
|
3354
|
-
}
|
|
3355
|
-
/**
|
|
3356
|
-
* Update the ids stored for the refine selection set
|
|
3357
|
-
*
|
|
3358
|
-
* @param selectionSet the refine selection set
|
|
3359
|
-
* @param addIds any ids to add
|
|
3360
|
-
* @param removeIds any ids to remove
|
|
3361
|
-
*
|
|
3362
|
-
* @returns updated selection sets
|
|
3363
|
-
* @protected
|
|
3364
|
-
*/
|
|
3365
|
-
_updateRefineIds(selectionSet, addIds, removeIds) {
|
|
3366
|
-
// remove ids if they exist in the current add or remove list
|
|
3367
|
-
selectionSet.refineIds.addIds = selectionSet.refineIds.addIds.filter(id => removeIds.indexOf(id) < 0);
|
|
3368
|
-
selectionSet.refineIds.removeIds = selectionSet.refineIds.removeIds.filter(id => addIds.indexOf(id) < 0);
|
|
3369
|
-
const _addIds = [...new Set(selectionSet.refineIds.addIds.concat(addIds))];
|
|
3370
|
-
const _removeIds = [...new Set(selectionSet.refineIds.removeIds.concat(removeIds))];
|
|
3371
|
-
selectionSet.refineIds = {
|
|
3372
|
-
addIds: _addIds.filter(id => _removeIds.indexOf(id) < 0),
|
|
3373
|
-
removeIds: _removeIds.filter(id => _addIds.indexOf(id) < 0)
|
|
3374
|
-
};
|
|
3375
|
-
selectionSet.selectedIds = selectionSet.refineIds.addIds.length > 0 ?
|
|
3376
|
-
[...new Set(selectionSet.selectedIds.concat(selectionSet.refineIds.addIds))] :
|
|
3377
|
-
selectionSet.selectedIds.filter(id => selectionSet.refineIds.removeIds.indexOf(id) < 0);
|
|
3378
|
-
return this.selectionSets.map(ss => {
|
|
3379
|
-
return ss.workflowType === interfaces$1.EWorkflowType.REFINE ? selectionSet : ss;
|
|
3380
|
-
});
|
|
3381
|
-
}
|
|
3382
|
-
/**
|
|
3383
|
-
* Add a new refine selection set
|
|
3384
|
-
*
|
|
3385
|
-
* @returns updated selection sets
|
|
3386
|
-
* @protected
|
|
3387
|
-
*/
|
|
3388
|
-
_initRefineSelectionSet(selectionSets) {
|
|
3389
|
-
return [
|
|
3390
|
-
...selectionSets,
|
|
3391
|
-
({
|
|
3392
|
-
buffer: undefined,
|
|
3393
|
-
distance: 0,
|
|
3394
|
-
download: true,
|
|
3395
|
-
geometries: [],
|
|
3396
|
-
id: Date.now(),
|
|
3397
|
-
label: "Refine",
|
|
3398
|
-
layerView: this.addresseeLayer,
|
|
3399
|
-
refineSelectLayers: [],
|
|
3400
|
-
searchResult: undefined,
|
|
3401
|
-
selectedIds: [],
|
|
3402
|
-
unit: "feet",
|
|
3403
|
-
workflowType: interfaces$1.EWorkflowType.REFINE,
|
|
3404
|
-
refineIds: {
|
|
3405
|
-
addIds: [],
|
|
3406
|
-
removeIds: []
|
|
3407
|
-
},
|
|
3408
|
-
redoStack: [],
|
|
3409
|
-
undoStack: []
|
|
3410
|
-
})
|
|
3411
|
-
];
|
|
3412
|
-
}
|
|
3413
|
-
/**
|
|
3414
|
-
* Fetches the component's translations
|
|
3415
|
-
*
|
|
3416
|
-
* @protected
|
|
3417
|
-
*/
|
|
3418
|
-
async _getTranslations() {
|
|
3419
|
-
const translations = await locale.getLocaleComponentStrings(this.el);
|
|
3420
|
-
this._translations = translations[0];
|
|
3421
|
-
}
|
|
3422
|
-
/** Provides access to protected methods for unit testing.
|
|
3423
|
-
*
|
|
3424
|
-
* @param methodName Name of protected method to run
|
|
3425
|
-
* @param arg1 First argument to forward to method, e.g., for "_modeChanged", `ESelectionMode`
|
|
3426
|
-
* @returns
|
|
3427
|
-
*/
|
|
3428
|
-
_testAccess(methodName, arg1) {
|
|
3429
|
-
switch (methodName) {
|
|
3430
|
-
case "_modeChanged":
|
|
3431
|
-
return this._modeChanged(arg1);
|
|
3432
|
-
case "_setSelectionMode":
|
|
3433
|
-
return this._setSelectionMode(arg1);
|
|
3434
|
-
// case "_getRefineSelectionSetList":
|
|
3435
|
-
// return this._getRefineSelectionSetList();
|
|
3436
|
-
// case "_getRefineSelectionSet":
|
|
3437
|
-
// return this._getRefineSelectionSet(arg1);
|
|
3438
|
-
// case "_updateSelectionSets":
|
|
3439
|
-
// return this._updateSelectionSets(arg1);
|
|
3440
|
-
// case "_updateRefineSelectionSet":
|
|
3441
|
-
// return this._updateRefineSelectionSet(arg1, arg2);
|
|
3442
|
-
// case "_updateRefineIds":
|
|
3443
|
-
// return this._updateRefineIds(arg1, arg2, arg3);
|
|
3444
|
-
// case "_addRefineSelectionSet":
|
|
3445
|
-
// return this._addRefineSelectionSet(arg1, arg2);
|
|
2346
|
+
});
|
|
3446
2347
|
}
|
|
3447
|
-
|
|
2348
|
+
labels.unshift(headerNames);
|
|
3448
2349
|
}
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
}; }
|
|
3453
|
-
};
|
|
3454
|
-
RefineSelection.style = refineSelectionCss;
|
|
2350
|
+
return Promise.resolve(labels);
|
|
2351
|
+
}
|
|
2352
|
+
//#endregion
|
|
3455
2353
|
|
|
3456
|
-
exports.InputMessage = InputMessage;
|
|
3457
|
-
exports.MapSelectTools = MapSelectTools;
|
|
3458
|
-
exports.Notice = Notice;
|
|
3459
|
-
exports.PdfDownload = PdfDownload;
|
|
3460
|
-
exports.RefineSelection = RefineSelection;
|
|
3461
2354
|
exports._typeof_1 = _typeof_1;
|
|
2355
|
+
exports.downloadCSV = downloadCSV;
|
|
2356
|
+
exports.downloadPDF = downloadPDF;
|