@esri/solutions-components 0.3.9 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/t9n/public-notification/resources.json +0 -2
- package/dist/assets/t9n/public-notification/resources_en.json +0 -2
- package/dist/cjs/buffer-tools_6.cjs.entry.js +5 -2
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +1342 -18
- package/dist/cjs/{calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-cd8ad61e.js → downloadUtils-27dbd8b9.js} +205 -1337
- package/dist/cjs/{index.es-e89ba2a1.js → index.es-40d341ed.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 +23 -2
- 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 +73 -17
- package/dist/collection/components/pdf-download/pdf-download.js +9 -76
- package/dist/collection/components/public-notification/public-notification.js +45 -3
- package/dist/collection/components/refine-selection/refine-selection.js +1 -1
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +13 -5
- package/dist/collection/demos/buffer-tools.html +1 -1
- package/dist/collection/utils/csvUtils.js +4 -0
- package/dist/collection/utils/csvUtils.ts +7 -0
- package/dist/collection/utils/downloadUtils.js +181 -0
- package/dist/collection/utils/downloadUtils.ts +235 -0
- package/dist/collection/utils/interfaces.ts +8 -1
- package/dist/collection/utils/pdfUtils.js +7 -0
- package/dist/collection/utils/pdfUtils.ts +13 -2
- package/dist/components/downloadUtils.js +2279 -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 +69 -19
- package/dist/components/pdf-download2.js +10 -2124
- package/dist/components/public-notification.js +24 -3
- package/dist/components/queryUtils.js +1 -1
- package/dist/components/refine-selection-tools2.js +6 -3
- package/dist/components/refine-selection2.js +1 -1
- package/dist/esm/buffer-tools_6.entry.js +6 -3
- package/dist/esm/calcite-combobox_3.entry.js +1 -1
- package/dist/esm/calcite-input-message_5.entry.js +1341 -13
- package/dist/esm/{calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-ddd74bd6.js → downloadUtils-76e38a94.js} +206 -1335
- package/dist/esm/{index.es-8edafdb2.js → index.es-489f4f08.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 +24 -3
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/demos/buffer-tools.html +1 -1
- 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-4ef94c6b.entry.js +6 -0
- package/dist/solutions-components/p-5d27b47d.entry.js +17 -0
- package/dist/solutions-components/p-92cb569a.entry.js +6 -0
- package/dist/solutions-components/{p-2a96314a.entry.js → p-a3b60bc9.entry.js} +2 -2
- package/dist/solutions-components/{p-98884f44.js → p-bff8aa4e.js} +3 -3
- package/dist/solutions-components/p-caa7e7a7.js +437 -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 +235 -0
- package/dist/solutions-components/utils/interfaces.ts +8 -1
- package/dist/solutions-components/utils/pdfUtils.ts +13 -2
- package/dist/types/components/json-editor/assets/monaco-editor/monaco.d.ts +8262 -0
- package/dist/types/components/map-select-tools/map-select-tools.d.ts +19 -1
- package/dist/types/components/pdf-download/pdf-download.d.ts +0 -18
- package/dist/types/components/public-notification/public-notification.d.ts +10 -0
- package/dist/types/components/refine-selection-tools/refine-selection-tools.d.ts +2 -2
- package/dist/types/components.d.ts +6 -2
- package/dist/types/preact.d.ts +2 -1
- package/dist/types/utils/downloadUtils.d.ts +40 -0
- package/dist/types/utils/interfaces.d.ts +6 -2
- 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-15f9b0a0.entry.js +0 -6
- package/dist/solutions-components/p-238db156.js +0 -416
- package/dist/solutions-components/p-3069e3b7.js +0 -21
- package/dist/solutions-components/p-6d28f991.entry.js +0 -6
- package/dist/solutions-components/p-c5341977.entry.js +0 -6
@@ -5,914 +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
|
-
|
85
|
-
/*!
|
86
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
87
|
-
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
88
|
-
* v1.0.0-beta.97
|
89
|
-
*/
|
90
|
-
const TEXT = {
|
91
|
-
close: "Close"
|
92
|
-
};
|
93
|
-
const SLOTS = {
|
94
|
-
title: "title",
|
95
|
-
message: "message",
|
96
|
-
link: "link",
|
97
|
-
actionsEnd: "actions-end"
|
98
|
-
};
|
99
|
-
const CSS = {
|
100
|
-
actionsEnd: "actions-end",
|
101
|
-
close: "notice-close",
|
102
|
-
container: "container",
|
103
|
-
content: "notice-content",
|
104
|
-
icon: "notice-icon"
|
105
|
-
};
|
106
|
-
|
107
|
-
const noticeCss = "@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([scale=s]){--calcite-notice-spacing-token-small:0.5rem;--calcite-notice-spacing-token-large:0.75rem}:host([scale=s]) .container slot[name=title]::slotted(*),:host([scale=s]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=s]) .container slot[name=message]::slotted(*),:host([scale=s]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) .notice-close{padding:0.5rem}:host([scale=m]){--calcite-notice-spacing-token-small:0.75rem;--calcite-notice-spacing-token-large:1rem}:host([scale=m]) .container slot[name=title]::slotted(*),:host([scale=m]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=m]) .container slot[name=message]::slotted(*),:host([scale=m]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=l]){--calcite-notice-spacing-token-small:1rem;--calcite-notice-spacing-token-large:1.25rem}:host([scale=l]) .container slot[name=title]::slotted(*),:host([scale=l]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host([scale=l]) .container slot[name=message]::slotted(*),:host([scale=l]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([width=auto]){--calcite-notice-width:auto}:host([width=half]){--calcite-notice-width:50%}:host([width=full]){--calcite-notice-width:100%}:host{margin-inline:auto;display:none;max-inline-size:100%;align-items:center;inline-size:var(--calcite-notice-width)}.container{pointer-events:none;margin-block:0px;box-sizing:border-box;display:none;inline-size:100%;background-color:var(--calcite-ui-foreground-1);opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;max-block-size:0;text-align:start;-webkit-border-start:0px solid;border-inline-start:0px solid;box-shadow:0 0 0 0 transparent}.notice-close{outline-color:transparent}.notice-close:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host{display:flex}:host([open]) .container{pointer-events:auto;display:flex;max-block-size:100%;align-items:center;border-width:2px;opacity:1;--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.container slot[name=title]::slotted(*),.container *::slotted([slot=title]){margin:0px;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}.container slot[name=message]::slotted(*),.container *::slotted([slot=message]){margin:0px;display:inline;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);-webkit-margin-end:var(--calcite-notice-spacing-token-small);margin-inline-end:var(--calcite-notice-spacing-token-small)}.notice-content{box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;display:flex;min-inline-size:0px;flex-direction:column;overflow-wrap:break-word;flex:1 1 0;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:0 var(--calcite-notice-spacing-token-small)}.notice-content:first-of-type:not(:only-child){-webkit-padding-start:var(--calcite-notice-spacing-token-large);padding-inline-start:var(--calcite-notice-spacing-token-large)}.notice-content:only-of-type{padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large)}.notice-icon{display:flex;align-items:center;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto}.notice-close{display:flex;cursor:pointer;align-items:center;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;-webkit-appearance:none}.notice-close:hover,.notice-close:focus{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}.notice-close:active{background-color:var(--calcite-ui-foreground-3)}.actions-end{display:flex;align-self:stretch}:host([color=blue]) .container{border-color:var(--calcite-ui-brand)}:host([color=blue]) .container .notice-icon{color:var(--calcite-ui-brand)}:host([color=red]) .container{border-color:var(--calcite-ui-danger)}:host([color=red]) .container .notice-icon{color:var(--calcite-ui-danger)}:host([color=yellow]) .container{border-color:var(--calcite-ui-warning)}:host([color=yellow]) .container .notice-icon{color:var(--calcite-ui-warning)}:host([color=green]) .container{border-color:var(--calcite-ui-success)}:host([color=green]) .container .notice-icon{color:var(--calcite-ui-success)}";
|
108
|
-
|
109
|
-
const Notice = class {
|
110
|
-
constructor(hostRef) {
|
111
|
-
index.registerInstance(this, hostRef);
|
112
|
-
this.calciteNoticeClose = index.createEvent(this, "calciteNoticeClose", 6);
|
113
|
-
this.calciteNoticeOpen = index.createEvent(this, "calciteNoticeOpen", 6);
|
114
|
-
//--------------------------------------------------------------------------
|
115
|
-
//
|
116
|
-
// Properties
|
117
|
-
//
|
118
|
-
//---------------------------------------------------------------------------
|
119
|
-
/**
|
120
|
-
* When `true`, the component is active.
|
121
|
-
*
|
122
|
-
* @deprecated Use `open` instead.
|
123
|
-
*/
|
124
|
-
this.active = false;
|
125
|
-
/** When `true`, the component is visible. */
|
126
|
-
this.open = false;
|
127
|
-
/** The color for the component's top border and icon. */
|
128
|
-
this.color = "blue";
|
129
|
-
/**
|
130
|
-
* When `true`, a close button is added to the component.
|
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
12
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
else if (newValue.length === 0) {
|
282
|
-
return this._clearResults(true, true);
|
283
|
-
}
|
284
|
-
}
|
285
|
-
}
|
286
|
-
/**
|
287
|
-
* Called each time the searchConfiguration prop is changed.
|
288
|
-
*
|
289
|
-
* @returns Promise when complete
|
290
|
-
*/
|
291
|
-
async watchSearchConfigurationHandler(newValue, oldValue) {
|
292
|
-
if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
|
293
|
-
this._initSearchWidget();
|
294
|
-
}
|
295
|
-
}
|
296
|
-
/**
|
297
|
-
* Called each time the workflowType prop is changed and emits the workflowTypeChange event.
|
298
|
-
*
|
299
|
-
* @returns Promise when complete
|
300
|
-
*/
|
301
|
-
async workflowTypeHandler(newValue, oldValue) {
|
302
|
-
if (newValue !== oldValue) {
|
303
|
-
this.mapView.popup.autoOpenEnabled = ["SELECT", "SKETCH", "REFINE"].indexOf(newValue) < 0;
|
304
|
-
this.workflowTypeChange.emit(newValue);
|
305
|
-
}
|
306
|
-
}
|
307
|
-
//--------------------------------------------------------------------------
|
308
|
-
//
|
309
|
-
// Methods (public)
|
310
|
-
//
|
311
|
-
//--------------------------------------------------------------------------
|
312
|
-
/**
|
313
|
-
* Clear any selection results
|
314
|
-
*
|
315
|
-
* @returns Promise when the results have been cleared
|
316
|
-
*/
|
317
|
-
async clearSelection() {
|
318
|
-
return this._clearResults();
|
319
|
-
}
|
320
|
-
/**
|
321
|
-
* Get the new selection set
|
322
|
-
*
|
323
|
-
* @returns Promise with the new selection set
|
324
|
-
*/
|
325
|
-
async getSelection() {
|
326
|
-
// Allow any non whitespace
|
327
|
-
if (!/\S+/gm.test(this._selectionLabel)) {
|
328
|
-
this._selectionLabel = this._getSelectionBaseLabel();
|
329
|
-
}
|
330
|
-
const isBaseLabel = this._selectionLabel === this._getSelectionBaseLabel();
|
331
|
-
return {
|
332
|
-
id: this.isUpdate ? this.selectionSet.id : Date.now(),
|
333
|
-
workflowType: this._workflowType,
|
334
|
-
searchResult: this._searchResult,
|
335
|
-
buffer: this._bufferGeometry,
|
336
|
-
distance: this._bufferTools.distance,
|
337
|
-
download: true,
|
338
|
-
unit: this._bufferTools.unit,
|
339
|
-
label: (this._selectionLabel && !isBaseLabel) ?
|
340
|
-
this._selectionLabel : `${this._selectionLabel} ${this._bufferTools.distance} ${this._bufferTools.unit}`,
|
341
|
-
selectedIds: this._selectedIds,
|
342
|
-
layerView: this.selectLayerView,
|
343
|
-
geometries: this.geometries,
|
344
|
-
refineSelectLayers: this._refineTools.layerViews
|
345
|
-
};
|
346
|
-
}
|
347
|
-
/**
|
348
|
-
* Handle changes to the selection sets
|
349
|
-
*/
|
350
|
-
labelChange(event) {
|
351
|
-
this._selectionLabel = event.detail;
|
352
|
-
}
|
353
|
-
/**
|
354
|
-
* Listen to changes in the sketch graphics
|
355
|
-
*
|
356
|
-
*/
|
357
|
-
sketchGraphicsChange(event) {
|
358
|
-
this._updateSelection(interfaces$1.EWorkflowType.SKETCH, event.detail, this._selectionLabel || this._translations.sketch);
|
359
|
-
}
|
360
|
-
/**
|
361
|
-
* Listen to changes in the refine graphics
|
362
|
-
*
|
363
|
-
*/
|
364
|
-
refineSelectionGraphicsChange(event) {
|
365
|
-
const graphics = event.detail;
|
366
|
-
this._updateSelection(interfaces$1.EWorkflowType.SELECT, graphics, this._selectionLabel || this._translations.select);
|
367
|
-
// Using OIDs to avoid issue with points
|
368
|
-
const oids = Array.isArray(graphics) ? graphics.map(g => g.attributes[g.layer.objectIdField]) : [];
|
369
|
-
return this._highlightFeatures(oids);
|
370
|
-
}
|
371
|
-
//--------------------------------------------------------------------------
|
372
|
-
//
|
373
|
-
// Functions (lifecycle)
|
374
|
-
//
|
375
|
-
//--------------------------------------------------------------------------
|
376
|
-
/**
|
377
|
-
* StencilJS: Called once just after the component is first connected to the DOM.
|
378
|
-
*/
|
379
|
-
async componentWillLoad() {
|
380
|
-
await this._getTranslations();
|
381
|
-
await this._initModules();
|
382
|
-
}
|
383
|
-
/**
|
384
|
-
* StencilJS: Called once just after the component is fully loaded and the first render() occurs.
|
385
|
-
*/
|
386
|
-
async componentDidLoad() {
|
387
|
-
return this._init();
|
388
|
-
}
|
389
|
-
/**
|
390
|
-
* Renders the component.
|
391
|
-
*/
|
392
|
-
render() {
|
393
|
-
var _a, _b, _c;
|
394
|
-
const searchEnabled = this._workflowType === interfaces$1.EWorkflowType.SEARCH;
|
395
|
-
const showSearchClass = searchEnabled ? " div-visible-search" : " div-not-visible";
|
396
|
-
const drawEnabled = this._workflowType === interfaces$1.EWorkflowType.SKETCH || this._workflowType === interfaces$1.EWorkflowType.SELECT;
|
397
|
-
const showBufferToolsClass = this.showBufferTools ? "search-distance" : "div-not-visible";
|
398
|
-
const useSelectClass = this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
|
399
|
-
const useDrawClass = !this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
|
400
|
-
const showLayerChoiceClass = searchEnabled ? "div-not-visible" : "div-visible";
|
401
|
-
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, 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)));
|
402
|
-
}
|
403
|
-
//--------------------------------------------------------------------------
|
404
|
-
//
|
405
|
-
// Functions (protected)
|
406
|
-
//
|
407
|
-
//--------------------------------------------------------------------------
|
408
|
-
/**
|
409
|
-
* Load esri javascript api modules
|
410
|
-
*
|
411
|
-
* @returns Promise resolving when function is done
|
412
|
-
*
|
413
|
-
* @protected
|
414
|
-
*/
|
415
|
-
async _initModules() {
|
416
|
-
const [GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules.loadModules([
|
417
|
-
"esri/layers/GraphicsLayer",
|
418
|
-
"esri/Graphic",
|
419
|
-
"esri/widgets/Search",
|
420
|
-
"esri/geometry/geometryEngine",
|
421
|
-
"esri/layers/FeatureLayer"
|
422
|
-
]);
|
423
|
-
this.GraphicsLayer = GraphicsLayer;
|
424
|
-
this.Graphic = Graphic;
|
425
|
-
this.Search = Search;
|
426
|
-
this._geometryEngine = geometryEngine;
|
427
|
-
this.FeatureLayer = FeatureLayer;
|
428
|
-
}
|
429
|
-
/**
|
430
|
-
* Initialize the graphics layer, selection set, and search widget
|
431
|
-
*
|
432
|
-
* @returns Promise when the operation has completed
|
433
|
-
*/
|
434
|
-
async _init() {
|
435
|
-
this._initGraphicsLayer();
|
436
|
-
this._initSelectionSet();
|
437
|
-
this._initSearchWidget();
|
438
|
-
}
|
439
|
-
/**
|
440
|
-
* Initialize the state of the component with any stored values in a selection set
|
441
|
-
*
|
442
|
-
* @protected
|
443
|
-
*/
|
444
|
-
_initSelectionSet() {
|
445
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
446
|
-
if (this.selectionSet) {
|
447
|
-
this._searchTerm = (_b = (_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.searchResult) === null || _b === void 0 ? void 0 : _b.name;
|
448
|
-
this._workflowType = (_c = this.selectionSet) === null || _c === void 0 ? void 0 : _c.workflowType;
|
449
|
-
this._searchResult = (_d = this.selectionSet) === null || _d === void 0 ? void 0 : _d.searchResult;
|
450
|
-
this._refineSelectLayers = (_e = this.selectionSet) === null || _e === void 0 ? void 0 : _e.refineSelectLayers;
|
451
|
-
this.geometries = [
|
452
|
-
...(_f = this.selectionSet) === null || _f === void 0 ? void 0 : _f.geometries
|
453
|
-
];
|
454
|
-
// reset selection label base
|
455
|
-
this._selectionLabel = ((_g = this.selectionSet) === null || _g === void 0 ? void 0 : _g.label) || this._getSelectionBaseLabel();
|
456
|
-
void mapViewUtils.goToSelection(this.selectionSet.selectedIds, this.selectionSet.layerView, this.mapView, false);
|
457
|
-
}
|
458
|
-
else {
|
459
|
-
this._workflowType = interfaces$1.EWorkflowType.SEARCH;
|
460
|
-
}
|
461
|
-
}
|
462
|
-
/**
|
463
|
-
* Get the default label base when the user has not provided a value
|
464
|
-
*
|
465
|
-
* @protected
|
466
|
-
*/
|
467
|
-
_getSelectionBaseLabel() {
|
468
|
-
var _a, _b;
|
469
|
-
return this._workflowType === interfaces$1.EWorkflowType.SKETCH ?
|
470
|
-
this._translations.sketch : this._workflowType === interfaces$1.EWorkflowType.SELECT ?
|
471
|
-
this._translations.select : this._workflowType === interfaces$1.EWorkflowType.SEARCH && this._searchResult ?
|
472
|
-
(_a = this._searchResult) === null || _a === void 0 ? void 0 : _a.name : (_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.label;
|
473
|
-
}
|
474
|
-
/**
|
475
|
-
* Initialize the search widget
|
476
|
-
*
|
477
|
-
* @protected
|
478
|
-
*/
|
479
|
-
_initSearchWidget() {
|
480
|
-
if (this.mapView && this._searchElement) {
|
481
|
-
const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
|
482
|
-
const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
|
483
|
-
this._searchWidget = new this.Search(searchOptions);
|
484
|
-
this._searchWidget.on("search-clear", () => {
|
485
|
-
void this._clearResults(false);
|
486
|
-
});
|
487
|
-
this._searchWidget.on("select-result", (searchResults) => {
|
488
|
-
var _a;
|
489
|
-
void this._clearResults(false);
|
490
|
-
if (searchResults.result) {
|
491
|
-
this._searchResult = searchResults.result;
|
492
|
-
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);
|
493
|
-
}
|
494
|
-
});
|
495
|
-
}
|
496
|
-
}
|
497
|
-
/**
|
498
|
-
* Initialize the search widget based on user defined configuration
|
499
|
-
*
|
500
|
-
* @param searchConfiguration search configuration defined by the user
|
501
|
-
* @param view the current map view
|
502
|
-
*
|
503
|
-
* @protected
|
504
|
-
*/
|
505
|
-
_getSearchConfig(searchConfiguration, view) {
|
506
|
-
var _a;
|
507
|
-
const sources = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources;
|
508
|
-
if (sources) {
|
509
|
-
sources.forEach(source => {
|
510
|
-
var _a, _b, _c;
|
511
|
-
const isLayerSource = source.hasOwnProperty("layer");
|
512
|
-
if (isLayerSource) {
|
513
|
-
const layerSource = source;
|
514
|
-
const layerFromMap = ((_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id)
|
515
|
-
? view.map.findLayerById(layerSource.layer.id)
|
516
|
-
: null;
|
517
|
-
if (layerFromMap) {
|
518
|
-
layerSource.layer = layerFromMap;
|
519
|
-
}
|
520
|
-
else if ((_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url) {
|
521
|
-
layerSource.layer = new this.FeatureLayer((_c = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _c === void 0 ? void 0 : _c.url);
|
522
|
-
}
|
523
|
-
}
|
524
|
-
});
|
525
|
-
}
|
526
|
-
(_a = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources) === null || _a === void 0 ? void 0 : _a.forEach(source => {
|
527
|
-
const isLocatorSource = source.hasOwnProperty("locator");
|
528
|
-
if (isLocatorSource) {
|
529
|
-
const locatorSource = source;
|
530
|
-
locatorSource.url = locatorSource.url;
|
531
|
-
delete locatorSource.url;
|
532
|
-
}
|
533
|
-
});
|
534
|
-
return searchConfiguration;
|
535
|
-
}
|
536
|
-
/**
|
537
|
-
* Initialize the graphics layer used to store any buffer grapghics
|
538
|
-
*
|
539
|
-
* @protected
|
540
|
-
*/
|
541
|
-
_initGraphicsLayer() {
|
542
|
-
const title = this._translations.bufferLayer;
|
543
|
-
const bufferIndex = this.mapView.map.layers.findIndex((l) => l.title === title);
|
544
|
-
if (bufferIndex > -1) {
|
545
|
-
this._bufferGraphicsLayer = this.mapView.map.layers.getItemAt(bufferIndex);
|
546
|
-
}
|
547
|
-
else {
|
548
|
-
this._bufferGraphicsLayer = new this.GraphicsLayer({ title });
|
549
|
-
publicNotificationStore.state.managedLayers.push(title);
|
550
|
-
const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === this._translations.sketchLayer);
|
551
|
-
if (sketchIndex > -1) {
|
552
|
-
this.mapView.map.layers.add(this._bufferGraphicsLayer, sketchIndex);
|
553
|
-
}
|
554
|
-
else {
|
555
|
-
this.mapView.map.layers.add(this._bufferGraphicsLayer);
|
556
|
-
}
|
557
|
-
}
|
558
|
-
}
|
559
|
-
/**
|
560
|
-
* Store the layer select checked change
|
561
|
-
*
|
562
|
-
* @protected
|
563
|
-
*/
|
564
|
-
_layerSelectChanged() {
|
565
|
-
this._layerSelectChecked = this._selectFromLayerElement.checked;
|
566
|
-
this.sketchTypeChange.emit(this._layerSelectChecked ? interfaces$1.ESketchType.LAYER : interfaces$1.ESketchType.INTERACTIVE);
|
567
|
-
}
|
568
|
-
/**
|
569
|
-
* Store workflow type change
|
570
|
-
*
|
571
|
-
* @protected
|
572
|
-
*/
|
573
|
-
_workflowChange(evt) {
|
574
|
-
this._workflowType = evt.detail;
|
575
|
-
}
|
576
|
-
/**
|
577
|
-
* Highlight the features in the map
|
578
|
-
*
|
579
|
-
* @protected
|
580
|
-
*/
|
581
|
-
async _highlightFeatures(ids) {
|
582
|
-
var _a;
|
583
|
-
(_a = publicNotificationStore.state.highlightHandle) === null || _a === void 0 ? void 0 : _a.remove();
|
584
|
-
if (ids.length > 0) {
|
585
|
-
publicNotificationStore.state.highlightHandle = await mapViewUtils.highlightFeatures(ids, this.selectLayerView, this.mapView);
|
586
|
-
}
|
587
|
-
this.selectionSetChange.emit(ids.length);
|
588
|
-
}
|
589
|
-
/**
|
590
|
-
* Query the selectLayerView based on any user drawn geometries or buffers
|
591
|
-
*
|
592
|
-
* @param geometries Array of geometries used for the selection of ids from the select layer view
|
593
|
-
*
|
594
|
-
* @returns Promise when the selection is complete and the graphics have been highlighted
|
595
|
-
*/
|
596
|
-
async _selectFeatures(geometries) {
|
597
|
-
this._selectedIds = await mapViewUtils.queryObjectIds(geometries, this.selectLayerView.layer);
|
598
|
-
// Add geometries used for selecting features as graphics
|
599
|
-
this._drawTools.graphics = this.geometries.map(geom => {
|
600
|
-
var _a, _b, _c;
|
601
|
-
const props = {
|
602
|
-
"geometry": geom,
|
603
|
-
"symbol": geom.type === "point" ?
|
604
|
-
(_a = this._drawTools) === null || _a === void 0 ? void 0 : _a.pointSymbol : geom.type === "polyline" ?
|
605
|
-
(_b = this._drawTools) === null || _b === void 0 ? void 0 : _b.polylineSymbol : geom.type === "polygon" ?
|
606
|
-
(_c = this._drawTools) === null || _c === void 0 ? void 0 : _c.polygonSymbol : undefined
|
607
|
-
};
|
608
|
-
return new this.Graphic(props);
|
609
|
-
});
|
610
|
-
void this._highlightFeatures(this._selectedIds);
|
611
|
-
}
|
612
|
-
/**
|
613
|
-
* Query the selectLayerView based on any user drawn geometries or buffers
|
614
|
-
*
|
615
|
-
* @param evt CustomEvent that contains the result of the buffer
|
616
|
-
*
|
617
|
-
* @protected
|
618
|
-
*/
|
619
|
-
async _bufferComplete(evt) {
|
620
|
-
this._bufferGeometry = Array.isArray(evt.detail) ?
|
621
|
-
evt.detail[0] : evt.detail;
|
622
|
-
if (this._bufferGeometry) {
|
623
|
-
// Create a symbol for rendering the graphic
|
624
|
-
const symbol = {
|
625
|
-
type: "simple-fill",
|
626
|
-
color: this.bufferColor,
|
627
|
-
outline: {
|
628
|
-
color: this.bufferOutlineColor,
|
629
|
-
width: 1
|
630
|
-
}
|
631
|
-
};
|
632
|
-
// Add the geometry and symbol to a new graphic
|
633
|
-
const polygonGraphic = new this.Graphic({
|
634
|
-
geometry: this._bufferGeometry,
|
635
|
-
symbol
|
636
|
-
});
|
637
|
-
this._bufferGraphicsLayer.removeAll();
|
638
|
-
this._bufferGraphicsLayer.add(polygonGraphic);
|
639
|
-
void this._selectFeatures([this._bufferGeometry]);
|
640
|
-
void this.mapView.goTo(polygonGraphic.geometry.extent);
|
641
|
-
}
|
642
|
-
else {
|
643
|
-
if (this._bufferGraphicsLayer) {
|
644
|
-
this._bufferGraphicsLayer.removeAll();
|
645
|
-
}
|
646
|
-
void this._geomQuery(this.geometries);
|
647
|
-
}
|
648
|
-
}
|
649
|
-
/**
|
650
|
-
* Fetch a single geometry for each potential geometry type
|
651
|
-
*
|
652
|
-
* @param geometries All current selection geometries
|
653
|
-
*
|
654
|
-
* @protected
|
655
|
-
*/
|
656
|
-
_geomQuery(geometries) {
|
657
|
-
const queryGeoms = mapViewUtils.getQueryGeoms(geometries, this._geometryEngine);
|
658
|
-
return this._selectFeatures(queryGeoms);
|
659
|
-
}
|
660
|
-
/**
|
661
|
-
* Clear all stored values and general state for the component
|
662
|
-
*
|
663
|
-
* @param clearSearchWidget Optional boolean for clearing the search widget (default is true)
|
664
|
-
* @param clearLabel Optional boolean for clearing the search label (default is true)
|
665
|
-
*
|
666
|
-
* @protected
|
667
|
-
*/
|
668
|
-
async _clearResults(clearSearchWidget = true, clearLabel = true) {
|
669
|
-
var _a, _b;
|
670
|
-
this._selectedIds = [];
|
671
|
-
if (clearLabel) {
|
672
|
-
this._selectionLabel = "";
|
673
|
-
}
|
674
|
-
if (this._bufferGraphicsLayer) {
|
675
|
-
this._bufferGraphicsLayer.removeAll();
|
676
|
-
}
|
677
|
-
if (clearSearchWidget && this._searchWidget) {
|
678
|
-
this._searchWidget.clear();
|
679
|
-
}
|
680
|
-
(_a = publicNotificationStore.state.highlightHandle) === null || _a === void 0 ? void 0 : _a.remove();
|
681
|
-
// for sketch
|
682
|
-
// checking for clear as it would throw off tests
|
683
|
-
if ((_b = this._drawTools) === null || _b === void 0 ? void 0 : _b.clear) {
|
684
|
-
void this._drawTools.clear();
|
685
|
-
}
|
686
|
-
this.selectionSetChange.emit(this._selectedIds.length);
|
687
|
-
}
|
688
|
-
/**
|
689
|
-
* Fetch a single geometry for the current geometry type
|
690
|
-
*
|
691
|
-
* @param type worflow type
|
692
|
-
* @param graphics graphics to be used for selection
|
693
|
-
* @param label selection label
|
694
|
-
*
|
695
|
-
* @protected
|
696
|
-
*/
|
697
|
-
_updateSelection(type, graphics, label) {
|
698
|
-
this.geometries = Array.isArray(graphics) ? graphics.map(g => g.geometry) : this.geometries;
|
699
|
-
this._workflowType = type;
|
700
|
-
this._selectionLabel = label;
|
701
|
-
}
|
702
|
-
/**
|
703
|
-
* Fetches the component's translations
|
704
|
-
*
|
705
|
-
* @protected
|
706
|
-
*/
|
707
|
-
async _getTranslations() {
|
708
|
-
const translations = await locale.getLocaleComponentStrings(this.el);
|
709
|
-
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);
|
710
59
|
}
|
711
|
-
|
712
|
-
|
713
|
-
"geometries": ["watchGeometriesHandler"],
|
714
|
-
"searchConfiguration": ["watchSearchConfigurationHandler"],
|
715
|
-
"_workflowType": ["workflowTypeHandler"]
|
716
|
-
}; }
|
717
|
-
};
|
718
|
-
MapSelectTools.style = mapSelectToolsCss;
|
719
|
-
|
720
|
-
const labelFormats = [
|
721
|
-
{
|
722
|
-
descriptionPDF: {
|
723
|
-
labelWidthDisplay: "2-5/8",
|
724
|
-
labelHeightDisplay: "1",
|
725
|
-
labelsPerPageDisplay: "30",
|
726
|
-
averyPartNumber: "*60"
|
727
|
-
},
|
728
|
-
labelSpec: {
|
729
|
-
type: "AVERY",
|
730
|
-
pageProperties: {
|
731
|
-
pageType: "ANSI A",
|
732
|
-
leftMargin: 0.1875,
|
733
|
-
rightMargin: 0.1875,
|
734
|
-
topMargin: 0.5,
|
735
|
-
bottomMargin: 0.5
|
736
|
-
},
|
737
|
-
numLabelsAcross: 3,
|
738
|
-
numLabelsDown: 10,
|
739
|
-
labelWidth: 2.625,
|
740
|
-
labelHeight: 1,
|
741
|
-
horizGapIn: 0.125,
|
742
|
-
vertGapIn: 0,
|
743
|
-
labelPadding: 0.1,
|
744
|
-
fontSizePx: 11,
|
745
|
-
maxNumLabelLines: 4
|
746
|
-
}
|
747
|
-
},
|
748
|
-
{
|
749
|
-
descriptionPDF: {
|
750
|
-
labelWidthDisplay: "4",
|
751
|
-
labelHeightDisplay: "1",
|
752
|
-
labelsPerPageDisplay: "20",
|
753
|
-
averyPartNumber: "*61"
|
754
|
-
},
|
755
|
-
labelSpec: {
|
756
|
-
type: "AVERY",
|
757
|
-
pageProperties: {
|
758
|
-
pageType: "ANSI A",
|
759
|
-
leftMargin: 0.15625,
|
760
|
-
rightMargin: 0.15625,
|
761
|
-
topMargin: 0.47637821,
|
762
|
-
bottomMargin: 0.5
|
763
|
-
},
|
764
|
-
numLabelsAcross: 2,
|
765
|
-
numLabelsDown: 10,
|
766
|
-
labelWidth: 4,
|
767
|
-
labelHeight: 1.0025,
|
768
|
-
horizGapIn: 0.1875,
|
769
|
-
vertGapIn: 0,
|
770
|
-
labelPadding: 0.1,
|
771
|
-
fontSizePx: 11,
|
772
|
-
maxNumLabelLines: 4
|
773
|
-
}
|
774
|
-
},
|
775
|
-
{
|
776
|
-
descriptionPDF: {
|
777
|
-
labelWidthDisplay: "4",
|
778
|
-
labelHeightDisplay: "1-1/3",
|
779
|
-
labelsPerPageDisplay: "14",
|
780
|
-
averyPartNumber: "*62"
|
781
|
-
},
|
782
|
-
labelSpec: {
|
783
|
-
type: "AVERY",
|
784
|
-
pageProperties: {
|
785
|
-
pageType: "ANSI A",
|
786
|
-
leftMargin: 0.15625,
|
787
|
-
rightMargin: 0.15625,
|
788
|
-
topMargin: 0.81889808,
|
789
|
-
bottomMargin: 0.83464612
|
790
|
-
},
|
791
|
-
numLabelsAcross: 2,
|
792
|
-
numLabelsDown: 7,
|
793
|
-
labelWidth: 4,
|
794
|
-
labelHeight: 1.3352,
|
795
|
-
horizGapIn: 0.1875,
|
796
|
-
vertGapIn: 0,
|
797
|
-
labelPadding: 0.1,
|
798
|
-
fontSizePx: 11,
|
799
|
-
maxNumLabelLines: 6
|
800
|
-
}
|
801
|
-
},
|
802
|
-
{
|
803
|
-
descriptionPDF: {
|
804
|
-
labelWidthDisplay: "4",
|
805
|
-
labelHeightDisplay: "2",
|
806
|
-
labelsPerPageDisplay: "10",
|
807
|
-
averyPartNumber: "*63"
|
808
|
-
},
|
809
|
-
labelSpec: {
|
810
|
-
type: "AVERY",
|
811
|
-
pageProperties: {
|
812
|
-
pageType: "ANSI A",
|
813
|
-
leftMargin: 0.15625,
|
814
|
-
rightMargin: 0.15625,
|
815
|
-
topMargin: 0.5,
|
816
|
-
bottomMargin: 0.5
|
817
|
-
},
|
818
|
-
numLabelsAcross: 2,
|
819
|
-
numLabelsDown: 5,
|
820
|
-
labelWidth: 4,
|
821
|
-
labelHeight: 2,
|
822
|
-
horizGapIn: 0.1875,
|
823
|
-
vertGapIn: 0,
|
824
|
-
labelPadding: 0.1,
|
825
|
-
fontSizePx: 12,
|
826
|
-
maxNumLabelLines: 10
|
827
|
-
}
|
828
|
-
},
|
829
|
-
{
|
830
|
-
descriptionPDF: {
|
831
|
-
labelWidthDisplay: "4",
|
832
|
-
labelHeightDisplay: "3-1/3",
|
833
|
-
labelsPerPageDisplay: "6",
|
834
|
-
averyPartNumber: "*64"
|
835
|
-
},
|
836
|
-
labelSpec: {
|
837
|
-
type: "AVERY",
|
838
|
-
pageProperties: {
|
839
|
-
pageType: "ANSI A",
|
840
|
-
leftMargin: 0.15625,
|
841
|
-
rightMargin: 0.15625,
|
842
|
-
topMargin: 0.4724412,
|
843
|
-
bottomMargin: 0.50000027
|
844
|
-
},
|
845
|
-
numLabelsAcross: 2,
|
846
|
-
numLabelsDown: 3,
|
847
|
-
labelWidth: 4,
|
848
|
-
labelHeight: 3.342,
|
849
|
-
horizGapIn: 0.1875,
|
850
|
-
vertGapIn: 0,
|
851
|
-
labelPadding: 0.1,
|
852
|
-
fontSizePx: 14,
|
853
|
-
maxNumLabelLines: 12
|
854
|
-
}
|
855
|
-
},
|
856
|
-
{
|
857
|
-
descriptionPDF: {
|
858
|
-
labelWidthDisplay: "1-3/4",
|
859
|
-
labelHeightDisplay: "1/2",
|
860
|
-
labelsPerPageDisplay: "80",
|
861
|
-
averyPartNumber: "*67"
|
862
|
-
},
|
863
|
-
labelSpec: {
|
864
|
-
type: "AVERY",
|
865
|
-
pageProperties: {
|
866
|
-
pageType: "ANSI A",
|
867
|
-
leftMargin: 0.307086375,
|
868
|
-
rightMargin: 0.307086375,
|
869
|
-
topMargin: 0.4724412,
|
870
|
-
bottomMargin: 0.49606326
|
871
|
-
},
|
872
|
-
numLabelsAcross: 4,
|
873
|
-
numLabelsDown: 20,
|
874
|
-
labelWidth: 1.75,
|
875
|
-
labelHeight: 0.50155,
|
876
|
-
horizGapIn: 0.29527575,
|
877
|
-
vertGapIn: 0,
|
878
|
-
labelPadding: 0.1,
|
879
|
-
fontSizePx: 8,
|
880
|
-
maxNumLabelLines: 3
|
881
|
-
}
|
882
|
-
},
|
883
|
-
{
|
884
|
-
descriptionPDF: {
|
885
|
-
labelWidthDisplay: "1-3/4",
|
886
|
-
labelHeightDisplay: "2/3",
|
887
|
-
labelsPerPageDisplay: "60",
|
888
|
-
averyPartNumber: "*95"
|
889
|
-
},
|
890
|
-
labelSpec: {
|
891
|
-
type: "AVERY",
|
892
|
-
pageProperties: {
|
893
|
-
pageType: "ANSI A",
|
894
|
-
leftMargin: 0.28936983,
|
895
|
-
rightMargin: 0.28936983,
|
896
|
-
topMargin: 0.53937037,
|
897
|
-
bottomMargin: 0.5511814
|
898
|
-
},
|
899
|
-
numLabelsAcross: 4,
|
900
|
-
numLabelsDown: 15,
|
901
|
-
labelWidth: 1.75,
|
902
|
-
labelHeight: 0.6605,
|
903
|
-
horizGapIn: 0.30708678,
|
904
|
-
vertGapIn: 0,
|
905
|
-
labelPadding: 0.1,
|
906
|
-
fontSizePx: 8,
|
907
|
-
maxNumLabelLines: 4
|
908
|
-
}
|
909
|
-
}
|
910
|
-
];
|
911
|
-
|
912
|
-
const pdfUtils = /*#__PURE__*/Object.freeze({
|
913
|
-
__proto__: null,
|
914
|
-
'default': labelFormats
|
915
|
-
});
|
60
|
+
}
|
61
|
+
//#endregion
|
916
62
|
|
917
63
|
var _typeof_1 = _commonjsHelpers.createCommonjsModule(function (module) {
|
918
64
|
function _typeof(obj) {
|
@@ -1936,7 +1082,7 @@ function(t){var e=function(t){for(var e=t.length,r=new Uint8Array(e),n=0;n<e;n++
|
|
1936
1082
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1937
1083
|
* ====================================================================
|
1938
1084
|
*/
|
1939
|
-
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-40d341ed.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},
|
1940
1086
|
/** ====================================================================
|
1941
1087
|
* @license
|
1942
1088
|
* jsPDF XMP metadata plugin
|
@@ -2927,6 +2073,8 @@ class PDFLabels {
|
|
2927
2073
|
* See the License for the specific language governing permissions and
|
2928
2074
|
* limitations under the License.
|
2929
2075
|
*/
|
2076
|
+
//#endregion
|
2077
|
+
//#region Public functions
|
2930
2078
|
/**
|
2931
2079
|
* Exports a PDF of labels.
|
2932
2080
|
*
|
@@ -2936,6 +2084,8 @@ class PDFLabels {
|
|
2936
2084
|
function exportPDF(labels, labelPageDescription) {
|
2937
2085
|
_downloadPDFFile(labels, labelPageDescription, `notify-${Date.now().toString()}`);
|
2938
2086
|
}
|
2087
|
+
//#endregion
|
2088
|
+
//#region Private functions
|
2939
2089
|
/**
|
2940
2090
|
* Downloads the PDF file.
|
2941
2091
|
*
|
@@ -2956,159 +2106,138 @@ function _downloadPDFFile(labels, labelPageDescription, fileTitle) {
|
|
2956
2106
|
pdfLib.save();
|
2957
2107
|
});
|
2958
2108
|
});
|
2959
|
-
}
|
2960
|
-
|
2961
|
-
const pdfDownloadCss = ":host{display:block}";
|
2109
|
+
}
|
2110
|
+
//#endregion
|
2962
2111
|
|
2963
|
-
|
2964
|
-
|
2965
|
-
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
2969
|
-
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
2974
|
-
|
2975
|
-
|
2976
|
-
|
2977
|
-
|
2978
|
-
|
2979
|
-
|
2980
|
-
|
2981
|
-
|
2982
|
-
|
2983
|
-
|
2984
|
-
|
2985
|
-
|
2986
|
-
|
2987
|
-
|
2988
|
-
|
2989
|
-
|
2990
|
-
|
2991
|
-
|
2992
|
-
|
2993
|
-
|
2994
|
-
|
2995
|
-
|
2996
|
-
|
2997
|
-
|
2998
|
-
|
2999
|
-
|
3000
|
-
|
3001
|
-
|
3002
|
-
|
3003
|
-
|
3004
|
-
|
3005
|
-
|
3006
|
-
|
3007
|
-
|
3008
|
-
|
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
|
-
* @returns the pdf label as a string
|
3076
|
-
* @protected
|
3077
|
-
*/
|
3078
|
-
_getLabelSizeText(labelInfo) {
|
3079
|
-
const lNum = labelInfo.descriptionPDF.labelsPerPageDisplay;
|
3080
|
-
const lSize = `${labelInfo.descriptionPDF.labelWidthDisplay} x ${labelInfo.descriptionPDF.labelHeightDisplay}`;
|
3081
|
-
return this._translations.pdfLabel.replace("{{n}}", lNum).replace("{{labelSize}}", lSize);
|
3082
|
-
}
|
3083
|
-
/**
|
3084
|
-
* Fetches the component's translations
|
3085
|
-
*
|
3086
|
-
* @protected
|
3087
|
-
*/
|
3088
|
-
async _getTranslations() {
|
3089
|
-
const translations = await locale.getLocaleComponentStrings(this.el);
|
3090
|
-
this._translations = translations[0];
|
3091
|
-
}
|
3092
|
-
/**
|
3093
|
-
* Creates labels from items.
|
3094
|
-
*
|
3095
|
-
* @param ids List of ids to download
|
3096
|
-
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
3097
|
-
* @param includeHeaderNames Add the label format at the front of the list of generated labels
|
3098
|
-
* @returns Promise resolving when function is done
|
3099
|
-
*/
|
3100
|
-
async _prepareLabels(ids, removeDuplicates, includeHeaderNames = false) {
|
3101
|
-
// Get the attributes of the features to export
|
3102
|
-
const featureSet = await mapViewUtils.queryFeaturesByID(ids, this.layerView.layer);
|
3103
|
-
const featuresAttrs = featureSet.features.map(f => f.attributes);
|
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 layer Layer providing features and attributes for download
|
2133
|
+
* @param ids List of ids to download
|
2134
|
+
* @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
|
2135
|
+
* all attributes are exported
|
2136
|
+
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
2137
|
+
* @param addColumnTitle Indicates if column headings should be included in output
|
2138
|
+
* @returns Promise resolving when function is done
|
2139
|
+
*/
|
2140
|
+
async function downloadCSV(layer, ids, formatUsingLayerPopup, removeDuplicates = false, addColumnTitle = false) {
|
2141
|
+
const labels = await _prepareLabels(layer, ids, removeDuplicates, formatUsingLayerPopup, addColumnTitle);
|
2142
|
+
exportCSV(labels);
|
2143
|
+
return Promise.resolve();
|
2144
|
+
}
|
2145
|
+
/**
|
2146
|
+
* Downloads csv of mailing labels for the provided list of ids
|
2147
|
+
*
|
2148
|
+
* @param layer Layer providing features and attributes for download
|
2149
|
+
* @param ids List of ids to download
|
2150
|
+
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
2151
|
+
* @param labelPageDescription Provides PDF page layout info
|
2152
|
+
* @returns Promise resolving when function is done
|
2153
|
+
*/
|
2154
|
+
async function downloadPDF(layer, ids, removeDuplicates, labelPageDescription) {
|
2155
|
+
const labels = await _prepareLabels(layer, ids, removeDuplicates);
|
2156
|
+
exportPDF(labels, labelPageDescription);
|
2157
|
+
return Promise.resolve();
|
2158
|
+
}
|
2159
|
+
//#endregion
|
2160
|
+
//#region Private functions
|
2161
|
+
/**
|
2162
|
+
* Converts a set of fieldInfos into template lines.
|
2163
|
+
*
|
2164
|
+
* @param fieldInfos Layer's fieldInfos structure
|
2165
|
+
* @return Label spec
|
2166
|
+
*/
|
2167
|
+
function _convertPopupFieldsToLabelSpec(fieldInfos) {
|
2168
|
+
const labelSpec = [];
|
2169
|
+
// Every visible attribute is used
|
2170
|
+
fieldInfos.forEach(fieldInfo => {
|
2171
|
+
if (fieldInfo.visible) {
|
2172
|
+
labelSpec.push(`{${fieldInfo.fieldName}}`);
|
2173
|
+
}
|
2174
|
+
});
|
2175
|
+
return labelSpec;
|
2176
|
+
}
|
2177
|
+
/**
|
2178
|
+
* Converts the text of a custom popup into a multiline label specification; conversion splits text into
|
2179
|
+
* lines on <br>s, and removes HTML tags. It does not handle Arcade and related records.
|
2180
|
+
*
|
2181
|
+
* @param popupInfo Layer's popupInfo structure containing description, fieldInfos, and expressionInfos, e.g.,
|
2182
|
+
* "<div style='text-align: left;'>{NAME}<br />{STREET}<br />{CITY}, {STATE} {ZIP} <br /></div>"
|
2183
|
+
* @return Label spec
|
2184
|
+
*/
|
2185
|
+
function _convertPopupTextToLabelSpec(popupInfo) {
|
2186
|
+
// Replace <br>, <br/> with |
|
2187
|
+
popupInfo = popupInfo.replace(/<br\s*\/?>/gi, "|");
|
2188
|
+
// Remove remaining HTML tags, replace 0xA0 that popup uses for spaces, replace some char representations,
|
2189
|
+
// and split the label back into individual lines
|
2190
|
+
let labelSpec = popupInfo
|
2191
|
+
.replace(/<[\s.]*[^<>]*\/?>/gi, "")
|
2192
|
+
.replace(/\xA0/gi, " ")
|
2193
|
+
.replace(/</gi, "<")
|
2194
|
+
.replace(/>/gi, ">")
|
2195
|
+
.replace(/ /gi, " ")
|
2196
|
+
.split("|");
|
2197
|
+
// Trim lines and remove empties
|
2198
|
+
labelSpec = labelSpec.map(line => line.trim()).filter(line => line.length > 0);
|
2199
|
+
return labelSpec;
|
2200
|
+
}
|
2201
|
+
/**
|
2202
|
+
* Creates labels from items.
|
2203
|
+
*
|
2204
|
+
* @param layer Layer from which to fetch features
|
2205
|
+
* @param ids List of ids to download
|
2206
|
+
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
2207
|
+
* @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
|
2208
|
+
* all attributes are exported
|
2209
|
+
* @param includeHeaderNames Add the label format at the front of the list of generated labels
|
2210
|
+
* @returns Promise resolving when function is done
|
2211
|
+
*/
|
2212
|
+
async function _prepareLabels(layer, ids, removeDuplicates = true, formatUsingLayerPopup = true, includeHeaderNames = false) {
|
2213
|
+
var _a, _b, _c, _d;
|
2214
|
+
const [intl] = await loadModules.loadModules([
|
2215
|
+
"esri/intl"
|
2216
|
+
]);
|
2217
|
+
// Get the attributes of the features to export
|
2218
|
+
const featureSet = await mapViewUtils.queryFeaturesByID(ids, layer);
|
2219
|
+
const featuresAttrs = featureSet.features.map(f => f.attributes);
|
2220
|
+
// Get the label formatting, if any
|
2221
|
+
let labelFormat;
|
2222
|
+
if (layer.popupEnabled) {
|
3104
2223
|
// What data fields are used in the labels?
|
3105
2224
|
// Example labelFormat: ['{NAME}', '{STREET}', '{CITY}, {STATE} {ZIP}']
|
3106
|
-
|
2225
|
+
if (formatUsingLayerPopup && ((_b = (_a = layer.popupTemplate) === null || _a === void 0 ? void 0 : _a.content[0]) === null || _b === void 0 ? void 0 : _b.type) === "fields") {
|
2226
|
+
labelFormat = _convertPopupFieldsToLabelSpec(layer.popupTemplate.fieldInfos);
|
2227
|
+
}
|
2228
|
+
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") {
|
2229
|
+
labelFormat = _convertPopupTextToLabelSpec(layer.popupTemplate.content[0].text);
|
2230
|
+
}
|
2231
|
+
}
|
2232
|
+
// Apply the label format
|
2233
|
+
let labels;
|
2234
|
+
// eslint-disable-next-line unicorn/prefer-ternary
|
2235
|
+
if (labelFormat) {
|
3107
2236
|
// Convert attributes into an array of labels
|
3108
|
-
|
2237
|
+
labels = featuresAttrs.map(featureAttributes => {
|
3109
2238
|
const label = [];
|
3110
2239
|
labelFormat.forEach(labelLineTemplate => {
|
3111
|
-
const labelLine =
|
2240
|
+
const labelLine = intl.substitute(labelLineTemplate, featureAttributes).trim();
|
3112
2241
|
if (labelLine.length > 0) {
|
3113
2242
|
label.push(labelLine);
|
3114
2243
|
}
|
@@ -3117,299 +2246,38 @@ const PdfDownload = class {
|
|
3117
2246
|
})
|
3118
2247
|
// Remove empty labels
|
3119
2248
|
.filter(label => label.length > 0);
|
3120
|
-
// Remove duplicates
|
3121
|
-
if (removeDuplicates) {
|
3122
|
-
const labelsAsStrings = labels.map(label => JSON.stringify(label));
|
3123
|
-
const uniqueLabels = new Set(labelsAsStrings);
|
3124
|
-
labels = Array.from(uniqueLabels, labelString => JSON.parse(labelString));
|
3125
|
-
}
|
3126
|
-
// Add header names
|
3127
|
-
if (includeHeaderNames) {
|
3128
|
-
const headerNames = labelFormat.map(labelFormatLine => labelFormatLine.replace(/\{/g, "").replace(/\}/g, ""));
|
3129
|
-
labels.unshift(headerNames);
|
3130
|
-
}
|
3131
|
-
return Promise.resolve(labels);
|
3132
2249
|
}
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
*
|
3138
|
-
* @protected
|
3139
|
-
*/
|
3140
|
-
_renderItems() {
|
3141
|
-
const s = pdfUtils;
|
3142
|
-
const sortedPdfIndo = (s.default || s).sort((a, b) => {
|
3143
|
-
const _a = parseInt(a.descriptionPDF.labelsPerPageDisplay, 10);
|
3144
|
-
const _b = parseInt(b.descriptionPDF.labelsPerPageDisplay, 10);
|
3145
|
-
return _a < _b ? -1 : _a > _b ? 1 : 0;
|
3146
|
-
});
|
3147
|
-
return sortedPdfIndo.map((l) => {
|
3148
|
-
return (index.h("calcite-option", { value: l }, this._getLabelSizeText(l)));
|
2250
|
+
else {
|
2251
|
+
// Export all attributes
|
2252
|
+
labels = featuresAttrs.map(featureAttributes => {
|
2253
|
+
return Object.values(featureAttributes).map(attribute => `${attribute}`);
|
3149
2254
|
});
|
3150
2255
|
}
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
|
3155
|
-
|
3156
|
-
|
3157
|
-
const RefineSelection = class {
|
3158
|
-
constructor(hostRef) {
|
3159
|
-
index.registerInstance(this, hostRef);
|
3160
|
-
this.selectionSetsChanged = index.createEvent(this, "selectionSetsChanged", 7);
|
3161
|
-
//--------------------------------------------------------------------------
|
3162
|
-
//
|
3163
|
-
// Properties (protected)
|
3164
|
-
//
|
3165
|
-
//--------------------------------------------------------------------------
|
3166
|
-
/**
|
3167
|
-
* boolean: Indicates if any new graphics should be added or removed
|
3168
|
-
*/
|
3169
|
-
this._addEnabled = true;
|
3170
|
-
this.addresseeLayer = undefined;
|
3171
|
-
this.enabledLayerIds = [];
|
3172
|
-
this.mapView = undefined;
|
3173
|
-
this.selectionSets = [];
|
3174
|
-
this.GraphicsLayer = undefined;
|
3175
|
-
this.SketchViewModel = undefined;
|
3176
|
-
this._translations = undefined;
|
3177
|
-
}
|
3178
|
-
//--------------------------------------------------------------------------
|
3179
|
-
//
|
3180
|
-
// Watch handlers
|
3181
|
-
//
|
3182
|
-
//--------------------------------------------------------------------------
|
3183
|
-
/**
|
3184
|
-
* Called each time the addresseeLayer is changed.
|
3185
|
-
* Add a new clean refine set for the new addressee layer.
|
3186
|
-
*/
|
3187
|
-
addresseeLayerWatchHandler() {
|
3188
|
-
const selectionSets = this.selectionSets.filter(ss => ss.workflowType !== interfaces$1.EWorkflowType.REFINE);
|
3189
|
-
this.selectionSets = this._initRefineSelectionSet(selectionSets);
|
2256
|
+
// Remove duplicates
|
2257
|
+
if (removeDuplicates) {
|
2258
|
+
const labelsAsStrings = labels.map(label => JSON.stringify(label));
|
2259
|
+
const uniqueLabels = new Set(labelsAsStrings);
|
2260
|
+
labels = Array.from(uniqueLabels, labelString => JSON.parse(labelString));
|
3190
2261
|
}
|
3191
|
-
|
3192
|
-
|
3193
|
-
|
3194
|
-
|
3195
|
-
|
3196
|
-
var _a, _b;
|
3197
|
-
const addIds = ((_a = event.detail) === null || _a === void 0 ? void 0 : _a.addIds) || [];
|
3198
|
-
const removeIds = ((_b = event.detail) === null || _b === void 0 ? void 0 : _b.removeIds) || [];
|
3199
|
-
this._updateSelectionSets(removeIds);
|
3200
|
-
this._updateRefineSelectionSet(addIds, removeIds);
|
3201
|
-
}
|
3202
|
-
//--------------------------------------------------------------------------
|
3203
|
-
//
|
3204
|
-
// Functions (lifecycle)
|
3205
|
-
//
|
3206
|
-
//--------------------------------------------------------------------------
|
3207
|
-
/**
|
3208
|
-
* StencilJS: Called once just after the component is first connected to the DOM.
|
3209
|
-
*/
|
3210
|
-
async componentWillLoad() {
|
3211
|
-
await this._getTranslations();
|
3212
|
-
const refineSet = this._getRefineSelectionSet(this.selectionSets);
|
3213
|
-
if (!refineSet) {
|
3214
|
-
this.selectionSets = this._initRefineSelectionSet(this.selectionSets);
|
2262
|
+
// Add header names
|
2263
|
+
if (includeHeaderNames) {
|
2264
|
+
let headerNames = [];
|
2265
|
+
if (labelFormat) {
|
2266
|
+
headerNames = labelFormat.map(labelFormatLine => labelFormatLine.replace(/\{/g, "").replace(/\}/g, ""));
|
3215
2267
|
}
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
render() {
|
3221
|
-
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())))));
|
3222
|
-
}
|
3223
|
-
//--------------------------------------------------------------------------
|
3224
|
-
//
|
3225
|
-
// Functions (protected)
|
3226
|
-
//
|
3227
|
-
//--------------------------------------------------------------------------
|
3228
|
-
/**
|
3229
|
-
* Store the Add/Remove mode
|
3230
|
-
*
|
3231
|
-
* @protected
|
3232
|
-
*/
|
3233
|
-
_modeChanged(evt) {
|
3234
|
-
this._addEnabled = evt.detail === interfaces$1.ESelectionMode.ADD;
|
3235
|
-
}
|
3236
|
-
/**
|
3237
|
-
* Set the refine tools selection mode
|
3238
|
-
*
|
3239
|
-
* @protected
|
3240
|
-
*/
|
3241
|
-
_setSelectionMode(mode) {
|
3242
|
-
this._refineTools.mode = mode;
|
3243
|
-
}
|
3244
|
-
/**
|
3245
|
-
* Create a list to show the number added/removed/total unique selected
|
3246
|
-
*
|
3247
|
-
* @returns the list node
|
3248
|
-
* @protected
|
3249
|
-
*/
|
3250
|
-
_getRefineSelectionSetList() {
|
3251
|
-
const total = publicNotificationUtils.getTotal(this.selectionSets);
|
3252
|
-
const refineSet = this._getRefineSelectionSet(this.selectionSets);
|
3253
|
-
const numAdded = (refineSet === null || refineSet === void 0 ? void 0 : refineSet.refineIds.addIds.length) || 0;
|
3254
|
-
const numRemoved = (refineSet === null || refineSet === void 0 ? void 0 : refineSet.refineIds.removeIds.length) || 0;
|
3255
|
-
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()) }))];
|
3256
|
-
}
|
3257
|
-
/**
|
3258
|
-
* Fetch the refine selection set
|
3259
|
-
*
|
3260
|
-
* @returns the refine selection set
|
3261
|
-
* @protected
|
3262
|
-
*/
|
3263
|
-
_getRefineSelectionSet(selectionSets) {
|
3264
|
-
let refineSelectionSet;
|
3265
|
-
selectionSets.some(ss => {
|
3266
|
-
if (ss.workflowType === interfaces$1.EWorkflowType.REFINE) {
|
3267
|
-
refineSelectionSet = ss;
|
3268
|
-
return true;
|
3269
|
-
}
|
3270
|
-
});
|
3271
|
-
return refineSelectionSet;
|
3272
|
-
}
|
3273
|
-
/**
|
3274
|
-
* Remove ids from existing selection sets.
|
3275
|
-
* Remove any selection sets than have no selected ids
|
3276
|
-
* This can update any selection set not just the refine set.
|
3277
|
-
* We do not do something similar for adds as we will only ever add from refine tools to the single REFINE selection set.
|
3278
|
-
*
|
3279
|
-
* @param removeIds the ids to remove
|
3280
|
-
*
|
3281
|
-
* @protected
|
3282
|
-
*/
|
3283
|
-
_updateSelectionSets(removeIds) {
|
3284
|
-
if (removeIds.length > 0) {
|
3285
|
-
this.selectionSets = this.selectionSets.reduce((prev, cur) => {
|
3286
|
-
cur.selectedIds = cur.selectedIds.filter(id => removeIds.indexOf(id) < 0);
|
3287
|
-
if (cur.selectedIds.length > 0 || cur.workflowType === interfaces$1.EWorkflowType.REFINE) {
|
3288
|
-
prev.push(cur);
|
2268
|
+
else {
|
2269
|
+
Object.keys(featuresAttrs[0]).forEach(k => {
|
2270
|
+
if (featuresAttrs[0].hasOwnProperty(k)) {
|
2271
|
+
headerNames.push(k);
|
3289
2272
|
}
|
3290
|
-
|
3291
|
-
}, []);
|
3292
|
-
this.selectionSetsChanged.emit(this.selectionSets);
|
3293
|
-
}
|
3294
|
-
}
|
3295
|
-
/**
|
3296
|
-
* Update the refine selection set with any adds or removes
|
3297
|
-
*
|
3298
|
-
* @param addIds any ids to add
|
3299
|
-
* @param removeIds any ids to remove
|
3300
|
-
*
|
3301
|
-
* @returns Promise resolving when function is done
|
3302
|
-
* @protected
|
3303
|
-
*/
|
3304
|
-
_updateRefineSelectionSet(addIds, removeIds) {
|
3305
|
-
const selectionSet = this._getRefineSelectionSet(this.selectionSets);
|
3306
|
-
this._updateRefineIds(selectionSet, addIds, removeIds);
|
3307
|
-
this.selectionSetsChanged.emit(this.selectionSets);
|
3308
|
-
}
|
3309
|
-
/**
|
3310
|
-
* Update the ids stored for the refine selection set
|
3311
|
-
*
|
3312
|
-
* @param selectionSet the refine selection set
|
3313
|
-
* @param addIds any ids to add
|
3314
|
-
* @param removeIds any ids to remove
|
3315
|
-
*
|
3316
|
-
* @returns updated selection sets
|
3317
|
-
* @protected
|
3318
|
-
*/
|
3319
|
-
_updateRefineIds(selectionSet, addIds, removeIds) {
|
3320
|
-
// remove ids if they exist in the current add or remove list
|
3321
|
-
selectionSet.refineIds.addIds = selectionSet.refineIds.addIds.filter(id => removeIds.indexOf(id) < 0);
|
3322
|
-
selectionSet.refineIds.removeIds = selectionSet.refineIds.removeIds.filter(id => addIds.indexOf(id) < 0);
|
3323
|
-
const _addIds = [...new Set(selectionSet.refineIds.addIds.concat(addIds))];
|
3324
|
-
const _removeIds = [...new Set(selectionSet.refineIds.removeIds.concat(removeIds))];
|
3325
|
-
selectionSet.refineIds = {
|
3326
|
-
addIds: _addIds.filter(id => _removeIds.indexOf(id) < 0),
|
3327
|
-
removeIds: _removeIds.filter(id => _addIds.indexOf(id) < 0)
|
3328
|
-
};
|
3329
|
-
selectionSet.selectedIds = selectionSet.refineIds.addIds.length > 0 ?
|
3330
|
-
[...new Set(selectionSet.selectedIds.concat(selectionSet.refineIds.addIds))] :
|
3331
|
-
selectionSet.selectedIds.filter(id => selectionSet.refineIds.removeIds.indexOf(id) < 0);
|
3332
|
-
return this.selectionSets.map(ss => {
|
3333
|
-
return ss.workflowType === interfaces$1.EWorkflowType.REFINE ? selectionSet : ss;
|
3334
|
-
});
|
3335
|
-
}
|
3336
|
-
/**
|
3337
|
-
* Add a new refine selection set
|
3338
|
-
*
|
3339
|
-
* @returns updated selection sets
|
3340
|
-
* @protected
|
3341
|
-
*/
|
3342
|
-
_initRefineSelectionSet(selectionSets) {
|
3343
|
-
return [
|
3344
|
-
...selectionSets,
|
3345
|
-
({
|
3346
|
-
buffer: undefined,
|
3347
|
-
distance: 0,
|
3348
|
-
download: true,
|
3349
|
-
geometries: [],
|
3350
|
-
id: Date.now(),
|
3351
|
-
label: "Refine",
|
3352
|
-
layerView: this.addresseeLayer,
|
3353
|
-
refineSelectLayers: [],
|
3354
|
-
searchResult: undefined,
|
3355
|
-
selectedIds: [],
|
3356
|
-
unit: "feet",
|
3357
|
-
workflowType: interfaces$1.EWorkflowType.REFINE,
|
3358
|
-
refineIds: {
|
3359
|
-
addIds: [],
|
3360
|
-
removeIds: []
|
3361
|
-
},
|
3362
|
-
redoStack: [],
|
3363
|
-
undoStack: []
|
3364
|
-
})
|
3365
|
-
];
|
3366
|
-
}
|
3367
|
-
/**
|
3368
|
-
* Fetches the component's translations
|
3369
|
-
*
|
3370
|
-
* @protected
|
3371
|
-
*/
|
3372
|
-
async _getTranslations() {
|
3373
|
-
const translations = await locale.getLocaleComponentStrings(this.el);
|
3374
|
-
this._translations = translations[0];
|
3375
|
-
}
|
3376
|
-
/** Provides access to protected methods for unit testing.
|
3377
|
-
*
|
3378
|
-
* @param methodName Name of protected method to run
|
3379
|
-
* @param arg1 First argument to forward to method, e.g., for "_modeChanged", `ESelectionMode`
|
3380
|
-
* @returns
|
3381
|
-
*/
|
3382
|
-
_testAccess(methodName, arg1) {
|
3383
|
-
switch (methodName) {
|
3384
|
-
case "_modeChanged":
|
3385
|
-
return this._modeChanged(arg1);
|
3386
|
-
case "_setSelectionMode":
|
3387
|
-
return this._setSelectionMode(arg1);
|
3388
|
-
// case "_getRefineSelectionSetList":
|
3389
|
-
// return this._getRefineSelectionSetList();
|
3390
|
-
// case "_getRefineSelectionSet":
|
3391
|
-
// return this._getRefineSelectionSet(arg1);
|
3392
|
-
// case "_updateSelectionSets":
|
3393
|
-
// return this._updateSelectionSets(arg1);
|
3394
|
-
// case "_updateRefineSelectionSet":
|
3395
|
-
// return this._updateRefineSelectionSet(arg1, arg2);
|
3396
|
-
// case "_updateRefineIds":
|
3397
|
-
// return this._updateRefineIds(arg1, arg2, arg3);
|
3398
|
-
// case "_addRefineSelectionSet":
|
3399
|
-
// return this._addRefineSelectionSet(arg1, arg2);
|
2273
|
+
});
|
3400
2274
|
}
|
3401
|
-
|
2275
|
+
labels.unshift(headerNames);
|
3402
2276
|
}
|
3403
|
-
|
3404
|
-
|
3405
|
-
|
3406
|
-
}; }
|
3407
|
-
};
|
3408
|
-
RefineSelection.style = refineSelectionCss;
|
2277
|
+
return Promise.resolve(labels);
|
2278
|
+
}
|
2279
|
+
//#endregion
|
3409
2280
|
|
3410
|
-
exports.InputMessage = InputMessage;
|
3411
|
-
exports.MapSelectTools = MapSelectTools;
|
3412
|
-
exports.Notice = Notice;
|
3413
|
-
exports.PdfDownload = PdfDownload;
|
3414
|
-
exports.RefineSelection = RefineSelection;
|
3415
2281
|
exports._typeof_1 = _typeof_1;
|
2282
|
+
exports.downloadCSV = downloadCSV;
|
2283
|
+
exports.downloadPDF = downloadPDF;
|