@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
|
@@ -7,28 +7,1354 @@
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
require('./
|
|
12
|
-
require('./
|
|
10
|
+
const index = require('./index-c6979cbb.js');
|
|
11
|
+
const dom = require('./dom-4a580af6.js');
|
|
12
|
+
const interfaces = require('./interfaces-e76f31e9.js');
|
|
13
|
+
const conditionalSlot = require('./conditionalSlot-baada7a3.js');
|
|
14
|
+
const loadModules = require('./loadModules-918ff3e7.js');
|
|
15
|
+
const mapViewUtils = require('./mapViewUtils-d250b1ed.js');
|
|
16
|
+
const interfaces$1 = require('./interfaces-17c631bf.js');
|
|
17
|
+
const publicNotificationStore = require('./publicNotificationStore-20e924f5.js');
|
|
18
|
+
const locale = require('./locale-db1db902.js');
|
|
19
|
+
const downloadUtils = require('./downloadUtils-99981c6b.js');
|
|
20
|
+
const publicNotificationUtils = require('./publicNotificationUtils-9d585d8d.js');
|
|
13
21
|
require('./resources-b56bce71.js');
|
|
14
22
|
require('./guid-84ac4d91.js');
|
|
15
|
-
require('./interfaces-e76f31e9.js');
|
|
16
|
-
require('./conditionalSlot-baada7a3.js');
|
|
17
23
|
require('./observers-5311faf8.js');
|
|
18
|
-
require('./loadModules-918ff3e7.js');
|
|
19
|
-
require('./locale-db1db902.js');
|
|
20
|
-
require('./_commonjsHelpers-384729db.js');
|
|
21
|
-
require('./mapViewUtils-d250b1ed.js');
|
|
22
|
-
require('./interfaces-17c631bf.js');
|
|
23
|
-
require('./publicNotificationStore-20e924f5.js');
|
|
24
24
|
require('./index-763f87ac.js');
|
|
25
|
-
require('./
|
|
26
|
-
|
|
25
|
+
require('./_commonjsHelpers-384729db.js');
|
|
26
|
+
|
|
27
|
+
/*!
|
|
28
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
29
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
30
|
+
* v1.0.0-beta.97
|
|
31
|
+
*/
|
|
32
|
+
var StatusIconDefaults;
|
|
33
|
+
(function (StatusIconDefaults) {
|
|
34
|
+
StatusIconDefaults["valid"] = "check-circle";
|
|
35
|
+
StatusIconDefaults["invalid"] = "exclamation-mark-triangle";
|
|
36
|
+
StatusIconDefaults["idle"] = "information";
|
|
37
|
+
})(StatusIconDefaults || (StatusIconDefaults = {}));
|
|
38
|
+
|
|
39
|
+
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}";
|
|
40
|
+
|
|
41
|
+
const InputMessage = class {
|
|
42
|
+
constructor(hostRef) {
|
|
43
|
+
index.registerInstance(this, hostRef);
|
|
44
|
+
//--------------------------------------------------------------------------
|
|
45
|
+
//
|
|
46
|
+
// Properties
|
|
47
|
+
//
|
|
48
|
+
//--------------------------------------------------------------------------
|
|
49
|
+
/** When `true`, the component is active. */
|
|
50
|
+
this.active = false;
|
|
51
|
+
/** Specifies the size of the component. */
|
|
52
|
+
this.scale = "m";
|
|
53
|
+
/** Specifies the status of the input field, which determines message and icons. */
|
|
54
|
+
this.status = "idle";
|
|
55
|
+
}
|
|
56
|
+
handleIconEl() {
|
|
57
|
+
this.requestedIcon = dom.setRequestedIcon(StatusIconDefaults, this.icon, this.status);
|
|
58
|
+
}
|
|
59
|
+
//--------------------------------------------------------------------------
|
|
60
|
+
//
|
|
61
|
+
// Lifecycle
|
|
62
|
+
//
|
|
63
|
+
//--------------------------------------------------------------------------
|
|
64
|
+
connectedCallback() {
|
|
65
|
+
this.status = dom.getElementProp(this.el, "status", this.status);
|
|
66
|
+
this.scale = dom.getElementProp(this.el, "scale", this.scale);
|
|
67
|
+
this.requestedIcon = dom.setRequestedIcon(StatusIconDefaults, this.icon, this.status);
|
|
68
|
+
}
|
|
69
|
+
render() {
|
|
70
|
+
const hidden = !this.active;
|
|
71
|
+
return (index.h(index.Host, { "calcite-hydrated-hidden": hidden }, this.renderIcon(this.requestedIcon), index.h("slot", null)));
|
|
72
|
+
}
|
|
73
|
+
//--------------------------------------------------------------------------
|
|
74
|
+
//
|
|
75
|
+
// Private Methods
|
|
76
|
+
//
|
|
77
|
+
//--------------------------------------------------------------------------
|
|
78
|
+
renderIcon(iconName) {
|
|
79
|
+
if (iconName) {
|
|
80
|
+
return index.h("calcite-icon", { class: "calcite-input-message-icon", icon: iconName, scale: "s" });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
get el() { return index.getElement(this); }
|
|
84
|
+
static get watchers() { return {
|
|
85
|
+
"status": ["handleIconEl"],
|
|
86
|
+
"icon": ["handleIconEl"]
|
|
87
|
+
}; }
|
|
88
|
+
};
|
|
89
|
+
InputMessage.style = inputMessageCss;
|
|
90
|
+
|
|
91
|
+
/*!
|
|
92
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
93
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
94
|
+
* v1.0.0-beta.97
|
|
95
|
+
*/
|
|
96
|
+
const TEXT = {
|
|
97
|
+
close: "Close"
|
|
98
|
+
};
|
|
99
|
+
const SLOTS = {
|
|
100
|
+
title: "title",
|
|
101
|
+
message: "message",
|
|
102
|
+
link: "link",
|
|
103
|
+
actionsEnd: "actions-end"
|
|
104
|
+
};
|
|
105
|
+
const CSS = {
|
|
106
|
+
actionsEnd: "actions-end",
|
|
107
|
+
close: "notice-close",
|
|
108
|
+
container: "container",
|
|
109
|
+
content: "notice-content",
|
|
110
|
+
icon: "notice-icon"
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
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)}";
|
|
114
|
+
|
|
115
|
+
const Notice = class {
|
|
116
|
+
constructor(hostRef) {
|
|
117
|
+
index.registerInstance(this, hostRef);
|
|
118
|
+
this.calciteNoticeClose = index.createEvent(this, "calciteNoticeClose", 6);
|
|
119
|
+
this.calciteNoticeOpen = index.createEvent(this, "calciteNoticeOpen", 6);
|
|
120
|
+
//--------------------------------------------------------------------------
|
|
121
|
+
//
|
|
122
|
+
// Properties
|
|
123
|
+
//
|
|
124
|
+
//---------------------------------------------------------------------------
|
|
125
|
+
/**
|
|
126
|
+
* When `true`, the component is active.
|
|
127
|
+
*
|
|
128
|
+
* @deprecated Use `open` instead.
|
|
129
|
+
*/
|
|
130
|
+
this.active = false;
|
|
131
|
+
/** When `true`, the component is visible. */
|
|
132
|
+
this.open = false;
|
|
133
|
+
/** The color for the component's top border and icon. */
|
|
134
|
+
this.color = "blue";
|
|
135
|
+
/**
|
|
136
|
+
* When `true`, a close button is added to the component.
|
|
137
|
+
*
|
|
138
|
+
* @deprecated use `closable` instead.
|
|
139
|
+
*/
|
|
140
|
+
this.dismissible = false;
|
|
141
|
+
/** When `true`, a close button is added to the component. */
|
|
142
|
+
this.closable = false;
|
|
143
|
+
/**
|
|
144
|
+
* Accessible name for the close button.
|
|
145
|
+
*
|
|
146
|
+
* @default "Close"
|
|
147
|
+
*/
|
|
148
|
+
this.intlClose = TEXT.close;
|
|
149
|
+
/** Specifies the size of the component. */
|
|
150
|
+
this.scale = "m";
|
|
151
|
+
/** Specifies the width of the component. */
|
|
152
|
+
this.width = "auto";
|
|
153
|
+
//--------------------------------------------------------------------------
|
|
154
|
+
//
|
|
155
|
+
// Private Methods
|
|
156
|
+
//
|
|
157
|
+
//--------------------------------------------------------------------------
|
|
158
|
+
this.close = () => {
|
|
159
|
+
this.open = false;
|
|
160
|
+
this.calciteNoticeClose.emit();
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
activeHandler(value) {
|
|
164
|
+
this.open = value;
|
|
165
|
+
}
|
|
166
|
+
openHandler(value) {
|
|
167
|
+
this.active = value;
|
|
168
|
+
}
|
|
169
|
+
handleDismissible(value) {
|
|
170
|
+
this.closable = value;
|
|
171
|
+
}
|
|
172
|
+
handleClosable(value) {
|
|
173
|
+
this.dismissible = value;
|
|
174
|
+
}
|
|
175
|
+
updateRequestedIcon() {
|
|
176
|
+
this.requestedIcon = dom.setRequestedIcon(interfaces.StatusIcons, this.icon, this.color);
|
|
177
|
+
}
|
|
178
|
+
//--------------------------------------------------------------------------
|
|
179
|
+
//
|
|
180
|
+
// Lifecycle
|
|
181
|
+
//
|
|
182
|
+
//--------------------------------------------------------------------------
|
|
183
|
+
connectedCallback() {
|
|
184
|
+
conditionalSlot.connectConditionalSlotComponent(this);
|
|
185
|
+
const isOpen = this.active || this.open;
|
|
186
|
+
if (isOpen) {
|
|
187
|
+
this.activeHandler(isOpen);
|
|
188
|
+
this.openHandler(isOpen);
|
|
189
|
+
}
|
|
190
|
+
if (this.dismissible) {
|
|
191
|
+
this.handleDismissible(this.dismissible);
|
|
192
|
+
}
|
|
193
|
+
if (this.closable) {
|
|
194
|
+
this.handleClosable(this.closable);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
disconnectedCallback() {
|
|
198
|
+
conditionalSlot.disconnectConditionalSlotComponent(this);
|
|
199
|
+
}
|
|
200
|
+
componentWillLoad() {
|
|
201
|
+
this.requestedIcon = dom.setRequestedIcon(interfaces.StatusIcons, this.icon, this.color);
|
|
202
|
+
}
|
|
203
|
+
render() {
|
|
204
|
+
const { el } = this;
|
|
205
|
+
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" })));
|
|
206
|
+
const hasActionEnd = dom.getSlotted(el, SLOTS.actionsEnd);
|
|
207
|
+
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));
|
|
208
|
+
}
|
|
209
|
+
//--------------------------------------------------------------------------
|
|
210
|
+
//
|
|
211
|
+
// Public Methods
|
|
212
|
+
//
|
|
213
|
+
//--------------------------------------------------------------------------
|
|
214
|
+
/** Sets focus on the component. */
|
|
215
|
+
async setFocus() {
|
|
216
|
+
const noticeLinkEl = this.el.querySelector("calcite-link");
|
|
217
|
+
if (!this.closeButton && !noticeLinkEl) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (noticeLinkEl) {
|
|
221
|
+
noticeLinkEl.setFocus();
|
|
222
|
+
}
|
|
223
|
+
else if (this.closeButton) {
|
|
224
|
+
this.closeButton.focus();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
get el() { return index.getElement(this); }
|
|
228
|
+
static get watchers() { return {
|
|
229
|
+
"active": ["activeHandler"],
|
|
230
|
+
"open": ["openHandler"],
|
|
231
|
+
"dismissible": ["handleDismissible"],
|
|
232
|
+
"closable": ["handleClosable"],
|
|
233
|
+
"icon": ["updateRequestedIcon"],
|
|
234
|
+
"color": ["updateRequestedIcon"]
|
|
235
|
+
}; }
|
|
236
|
+
};
|
|
237
|
+
Notice.style = noticeCss;
|
|
238
|
+
|
|
239
|
+
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}";
|
|
240
|
+
|
|
241
|
+
const MapSelectTools = class {
|
|
242
|
+
constructor(hostRef) {
|
|
243
|
+
index.registerInstance(this, hostRef);
|
|
244
|
+
this.selectionSetChange = index.createEvent(this, "selectionSetChange", 7);
|
|
245
|
+
this.sketchTypeChange = index.createEvent(this, "sketchTypeChange", 7);
|
|
246
|
+
this.workflowTypeChange = index.createEvent(this, "workflowTypeChange", 7);
|
|
247
|
+
/**
|
|
248
|
+
* number[]: the oids of the selected features
|
|
249
|
+
*/
|
|
250
|
+
this._selectedIds = [];
|
|
251
|
+
/**
|
|
252
|
+
* string: A label to help uniquely identify the selection set
|
|
253
|
+
*/
|
|
254
|
+
this._selectionLabel = "";
|
|
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
|
+
return this._highlightWithOIDsOrGeoms();
|
|
286
|
+
}
|
|
287
|
+
else if (newValue.length === 0) {
|
|
288
|
+
return this._clearResults(true, true);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Called each time the searchConfiguration prop is changed.
|
|
294
|
+
*
|
|
295
|
+
* @returns Promise when complete
|
|
296
|
+
*/
|
|
297
|
+
async watchSearchConfigurationHandler(newValue, oldValue) {
|
|
298
|
+
console.log("watchSearchConfigurationHandler");
|
|
299
|
+
console.log("newValue");
|
|
300
|
+
console.log(newValue);
|
|
301
|
+
console.log("oldValue");
|
|
302
|
+
console.log(oldValue);
|
|
303
|
+
if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
|
|
304
|
+
this._initSearchWidget();
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Called each time the workflowType prop is changed and emits the workflowTypeChange event.
|
|
309
|
+
*
|
|
310
|
+
* @returns Promise when complete
|
|
311
|
+
*/
|
|
312
|
+
async workflowTypeHandler(newValue, oldValue) {
|
|
313
|
+
if (newValue !== oldValue) {
|
|
314
|
+
this.mapView.popup.autoOpenEnabled = ["SELECT", "SKETCH", "REFINE", "SEARCH"].indexOf(newValue) < 0;
|
|
315
|
+
this.workflowTypeChange.emit(newValue);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
//--------------------------------------------------------------------------
|
|
319
|
+
//
|
|
320
|
+
// Methods (public)
|
|
321
|
+
//
|
|
322
|
+
//--------------------------------------------------------------------------
|
|
323
|
+
/**
|
|
324
|
+
* Clear any selection results
|
|
325
|
+
*
|
|
326
|
+
* @returns Promise when the results have been cleared
|
|
327
|
+
*/
|
|
328
|
+
async clearSelection() {
|
|
329
|
+
return this._clearResults();
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Get the new selection set
|
|
333
|
+
*
|
|
334
|
+
* @returns Promise with the new selection set
|
|
335
|
+
*/
|
|
336
|
+
async getSelection() {
|
|
337
|
+
// Allow any non whitespace
|
|
338
|
+
if (!/\S+/gm.test(this._selectionLabel)) {
|
|
339
|
+
this._selectionLabel = this._getSelectionBaseLabel();
|
|
340
|
+
}
|
|
341
|
+
const isBaseLabel = this._selectionLabel === this._getSelectionBaseLabel();
|
|
342
|
+
return {
|
|
343
|
+
id: this.isUpdate ? this.selectionSet.id : Date.now(),
|
|
344
|
+
workflowType: this._workflowType,
|
|
345
|
+
searchResult: this._searchResult,
|
|
346
|
+
buffer: this._bufferGeometry,
|
|
347
|
+
distance: this._bufferTools.distance,
|
|
348
|
+
download: true,
|
|
349
|
+
unit: this._bufferTools.unit,
|
|
350
|
+
label: (this._selectionLabel && !isBaseLabel) ?
|
|
351
|
+
this._selectionLabel : `${this._selectionLabel} ${this._bufferTools.distance} ${this._bufferTools.unit}`,
|
|
352
|
+
selectedIds: this._selectedIds,
|
|
353
|
+
layerView: this.selectLayerView,
|
|
354
|
+
geometries: this.geometries,
|
|
355
|
+
refineSelectLayers: this._refineTools.layerViews,
|
|
356
|
+
skipGeomOIDs: this._skipGeomOIDs
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Handle changes to the selection sets
|
|
361
|
+
*/
|
|
362
|
+
labelChange(event) {
|
|
363
|
+
this._selectionLabel = event.detail;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Handle changes to the search configuration
|
|
367
|
+
*/
|
|
368
|
+
searchConfigurationChangeChanged(event) {
|
|
369
|
+
console.log("searchConfigurationChange listener");
|
|
370
|
+
this.searchConfiguration = event.detail;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Listen to changes in the sketch graphics
|
|
374
|
+
*
|
|
375
|
+
*/
|
|
376
|
+
sketchGraphicsChange(event) {
|
|
377
|
+
this._updateSelection(interfaces$1.EWorkflowType.SKETCH, event.detail, this._selectionLabel || this._translations.sketch, false);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Listen to changes in the refine graphics
|
|
381
|
+
*
|
|
382
|
+
*/
|
|
383
|
+
refineSelectionGraphicsChange(event) {
|
|
384
|
+
const graphics = event.detail.graphics;
|
|
385
|
+
const oids = Array.isArray(graphics) ? graphics.map(g => g.attributes[g.layer.objectIdField]) : [];
|
|
386
|
+
this._updateSelection(interfaces$1.EWorkflowType.SELECT, graphics, this._selectionLabel || this._translations.select, event.detail.useOIDs, oids);
|
|
387
|
+
return this._highlightFeatures(oids);
|
|
388
|
+
}
|
|
389
|
+
//--------------------------------------------------------------------------
|
|
390
|
+
//
|
|
391
|
+
// Functions (lifecycle)
|
|
392
|
+
//
|
|
393
|
+
//--------------------------------------------------------------------------
|
|
394
|
+
/**
|
|
395
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
396
|
+
*/
|
|
397
|
+
async componentWillLoad() {
|
|
398
|
+
await this._getTranslations();
|
|
399
|
+
await this._initModules();
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* StencilJS: Called once just after the component is fully loaded and the first render() occurs.
|
|
403
|
+
*/
|
|
404
|
+
async componentDidLoad() {
|
|
405
|
+
return this._init();
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Renders the component.
|
|
409
|
+
*/
|
|
410
|
+
render() {
|
|
411
|
+
var _a, _b;
|
|
412
|
+
const searchEnabled = this._workflowType === interfaces$1.EWorkflowType.SEARCH;
|
|
413
|
+
const showSearchClass = searchEnabled ? " div-visible-search" : " div-not-visible";
|
|
414
|
+
const drawEnabled = this._workflowType === interfaces$1.EWorkflowType.SKETCH || this._workflowType === interfaces$1.EWorkflowType.SELECT;
|
|
415
|
+
const showBufferToolsClass = this.showBufferTools ? "search-distance" : "div-not-visible";
|
|
416
|
+
const useSelectClass = this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
|
|
417
|
+
const useDrawClass = !this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
|
|
418
|
+
const showLayerChoiceClass = searchEnabled ? "div-not-visible" : "div-visible";
|
|
419
|
+
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: this._layerSelectChecked, 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: ((_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.distance) || this.defaultBufferDistance, geometries: this.geometries, onBufferComplete: (evt) => this._bufferComplete(evt), ref: (el) => this._bufferTools = el, unit: ((_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.unit) || this.defaultBufferUnit })), index.h("slot", null)));
|
|
420
|
+
}
|
|
421
|
+
//--------------------------------------------------------------------------
|
|
422
|
+
//
|
|
423
|
+
// Functions (protected)
|
|
424
|
+
//
|
|
425
|
+
//--------------------------------------------------------------------------
|
|
426
|
+
/**
|
|
427
|
+
* Load esri javascript api modules
|
|
428
|
+
*
|
|
429
|
+
* @returns Promise resolving when function is done
|
|
430
|
+
*
|
|
431
|
+
* @protected
|
|
432
|
+
*/
|
|
433
|
+
async _initModules() {
|
|
434
|
+
const [GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules.loadModules([
|
|
435
|
+
"esri/layers/GraphicsLayer",
|
|
436
|
+
"esri/Graphic",
|
|
437
|
+
"esri/widgets/Search",
|
|
438
|
+
"esri/geometry/geometryEngine",
|
|
439
|
+
"esri/layers/FeatureLayer"
|
|
440
|
+
]);
|
|
441
|
+
this.GraphicsLayer = GraphicsLayer;
|
|
442
|
+
this.Graphic = Graphic;
|
|
443
|
+
this.Search = Search;
|
|
444
|
+
this._geometryEngine = geometryEngine;
|
|
445
|
+
this.FeatureLayer = FeatureLayer;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Initialize the graphics layer, selection set, and search widget
|
|
449
|
+
*
|
|
450
|
+
* @returns Promise when the operation has completed
|
|
451
|
+
*/
|
|
452
|
+
async _init() {
|
|
453
|
+
this._initGraphicsLayer();
|
|
454
|
+
this._initSelectionSet();
|
|
455
|
+
this._initSearchWidget();
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Initialize the state of the component with any stored values in a selection set
|
|
459
|
+
*
|
|
460
|
+
* @protected
|
|
461
|
+
*/
|
|
462
|
+
_initSelectionSet() {
|
|
463
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
464
|
+
if (this.selectionSet) {
|
|
465
|
+
this._searchTerm = (_b = (_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.searchResult) === null || _b === void 0 ? void 0 : _b.name;
|
|
466
|
+
this._workflowType = (_c = this.selectionSet) === null || _c === void 0 ? void 0 : _c.workflowType;
|
|
467
|
+
this._searchResult = (_d = this.selectionSet) === null || _d === void 0 ? void 0 : _d.searchResult;
|
|
468
|
+
this._refineSelectLayers = (_e = this.selectionSet) === null || _e === void 0 ? void 0 : _e.refineSelectLayers;
|
|
469
|
+
this._selectedIds = (_f = this.selectionSet) === null || _f === void 0 ? void 0 : _f.selectedIds;
|
|
470
|
+
this._skipGeomOIDs = (_g = this.selectionSet) === null || _g === void 0 ? void 0 : _g.skipGeomOIDs;
|
|
471
|
+
this._layerSelectChecked = ((_h = this.selectionSet) === null || _h === void 0 ? void 0 : _h.workflowType) === interfaces$1.EWorkflowType.SELECT;
|
|
472
|
+
this.geometries = [
|
|
473
|
+
...((_j = this.selectionSet) === null || _j === void 0 ? void 0 : _j.geometries) || []
|
|
474
|
+
];
|
|
475
|
+
// reset selection label base
|
|
476
|
+
this._selectionLabel = ((_k = this.selectionSet) === null || _k === void 0 ? void 0 : _k.label) || this._getSelectionBaseLabel();
|
|
477
|
+
void mapViewUtils.goToSelection(this.selectionSet.selectedIds, this.selectionSet.layerView, this.mapView, false);
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
this._workflowType = interfaces$1.EWorkflowType.SEARCH;
|
|
481
|
+
this.mapView.popup.autoOpenEnabled = false;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Get the default label base when the user has not provided a value
|
|
486
|
+
*
|
|
487
|
+
* @protected
|
|
488
|
+
*/
|
|
489
|
+
_getSelectionBaseLabel() {
|
|
490
|
+
var _a, _b;
|
|
491
|
+
return this._workflowType === interfaces$1.EWorkflowType.SKETCH ?
|
|
492
|
+
this._translations.sketch : this._workflowType === interfaces$1.EWorkflowType.SELECT ?
|
|
493
|
+
this._translations.select : this._workflowType === interfaces$1.EWorkflowType.SEARCH && this._searchResult ?
|
|
494
|
+
(_a = this._searchResult) === null || _a === void 0 ? void 0 : _a.name : (_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.label;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Initialize the search widget
|
|
498
|
+
*
|
|
499
|
+
* @protected
|
|
500
|
+
*/
|
|
501
|
+
_initSearchWidget() {
|
|
502
|
+
console.log("_initSearchWidget");
|
|
503
|
+
console.log("this.mapView");
|
|
504
|
+
console.log(this.mapView);
|
|
505
|
+
console.log("this._searchElement");
|
|
506
|
+
console.log(this._searchElement);
|
|
507
|
+
if (this.mapView && this._searchElement) {
|
|
508
|
+
console.log("this._getSearchConfig");
|
|
509
|
+
const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
|
|
510
|
+
console.log("searchConfiguration");
|
|
511
|
+
console.log(searchConfiguration);
|
|
512
|
+
const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
|
|
513
|
+
this._searchWidget = new this.Search(searchOptions);
|
|
514
|
+
this._searchWidget.popupEnabled = false;
|
|
515
|
+
this._searchWidget.on("search-clear", () => {
|
|
516
|
+
void this._clearResults(false);
|
|
517
|
+
});
|
|
518
|
+
this._searchWidget.on("select-result", (searchResults) => {
|
|
519
|
+
var _a, _b;
|
|
520
|
+
void this._clearResults(false);
|
|
521
|
+
if (searchResults.result) {
|
|
522
|
+
this._searchResult = searchResults.result;
|
|
523
|
+
const useOIDs = ((_a = searchResults.source) === null || _a === void 0 ? void 0 : _a.layer.id) === this.selectLayerView.layer.id;
|
|
524
|
+
const oids = useOIDs ? [searchResults.result.feature.getObjectId()] : undefined;
|
|
525
|
+
this._updateSelection(interfaces$1.EWorkflowType.SEARCH, [searchResults.result.feature], (_b = searchResults === null || searchResults === void 0 ? void 0 : searchResults.result) === null || _b === void 0 ? void 0 : _b.name, useOIDs, oids);
|
|
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
|
+
console.log("layerFromMap");
|
|
553
|
+
layerSource.layer = layerFromMap;
|
|
554
|
+
}
|
|
555
|
+
else if ((_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url) {
|
|
556
|
+
console.log("create new");
|
|
557
|
+
layerSource.layer = new this.FeatureLayer((_c = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _c === void 0 ? void 0 : _c.url);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
(_a = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources) === null || _a === void 0 ? void 0 : _a.forEach(source => {
|
|
563
|
+
const isLocatorSource = source.hasOwnProperty("locator");
|
|
564
|
+
if (isLocatorSource) {
|
|
565
|
+
const locatorSource = source;
|
|
566
|
+
locatorSource.url = locatorSource.url;
|
|
567
|
+
delete locatorSource.url;
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
return searchConfiguration;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Initialize the graphics layer used to store any buffer grapghics
|
|
574
|
+
*
|
|
575
|
+
* @protected
|
|
576
|
+
*/
|
|
577
|
+
_initGraphicsLayer() {
|
|
578
|
+
const title = this._translations.bufferLayer;
|
|
579
|
+
const bufferIndex = this.mapView.map.layers.findIndex((l) => l.title === title);
|
|
580
|
+
if (bufferIndex > -1) {
|
|
581
|
+
this._bufferGraphicsLayer = this.mapView.map.layers.getItemAt(bufferIndex);
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
this._bufferGraphicsLayer = new this.GraphicsLayer({ title });
|
|
585
|
+
publicNotificationStore.state.managedLayers.push(title);
|
|
586
|
+
const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === this._translations.sketchLayer);
|
|
587
|
+
if (sketchIndex > -1) {
|
|
588
|
+
this.mapView.map.layers.add(this._bufferGraphicsLayer, sketchIndex);
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
this.mapView.map.layers.add(this._bufferGraphicsLayer);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Store the layer select checked change
|
|
597
|
+
*
|
|
598
|
+
* @protected
|
|
599
|
+
*/
|
|
600
|
+
_layerSelectChanged() {
|
|
601
|
+
this._layerSelectChecked = this._selectFromLayerElement.checked;
|
|
602
|
+
this.sketchTypeChange.emit(this._layerSelectChecked ? interfaces$1.ESketchType.LAYER : interfaces$1.ESketchType.INTERACTIVE);
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Store workflow type change
|
|
606
|
+
*
|
|
607
|
+
* @protected
|
|
608
|
+
*/
|
|
609
|
+
_workflowChange(evt) {
|
|
610
|
+
this._workflowType = evt.detail;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Highlight the features in the map based on OIDs when skipOIDs have been defined
|
|
614
|
+
*
|
|
615
|
+
* @protected
|
|
616
|
+
*/
|
|
617
|
+
async _highlightWithOIDsOrGeoms() {
|
|
618
|
+
var _a;
|
|
619
|
+
if (((_a = this._skipGeomOIDs) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
620
|
+
this._selectedIds = this._skipGeomOIDs;
|
|
621
|
+
return this._highlightFeatures(this._selectedIds);
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
return this._geomQuery(this.geometries);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Highlight the features in the map
|
|
629
|
+
*
|
|
630
|
+
* @protected
|
|
631
|
+
*/
|
|
632
|
+
async _highlightFeatures(ids) {
|
|
633
|
+
var _a;
|
|
634
|
+
(_a = publicNotificationStore.state.highlightHandle) === null || _a === void 0 ? void 0 : _a.remove();
|
|
635
|
+
if (ids.length > 0) {
|
|
636
|
+
publicNotificationStore.state.highlightHandle = await mapViewUtils.highlightFeatures(ids, this.selectLayerView, this.mapView);
|
|
637
|
+
}
|
|
638
|
+
this.selectionSetChange.emit(ids.length);
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Query the selectLayerView based on any user drawn geometries or buffers
|
|
642
|
+
*
|
|
643
|
+
* @param geometries Array of geometries used for the selection of ids from the select layer view
|
|
644
|
+
*
|
|
645
|
+
* @returns Promise when the selection is complete and the graphics have been highlighted
|
|
646
|
+
*/
|
|
647
|
+
async _selectFeatures(geometries) {
|
|
648
|
+
this._selectedIds = await mapViewUtils.queryObjectIds(geometries, this.selectLayerView.layer);
|
|
649
|
+
// Add geometries used for selecting features as graphics
|
|
650
|
+
this._drawTools.graphics = this.geometries.map(geom => {
|
|
651
|
+
var _a, _b, _c;
|
|
652
|
+
const props = {
|
|
653
|
+
"geometry": geom,
|
|
654
|
+
"symbol": geom.type === "point" ?
|
|
655
|
+
(_a = this._drawTools) === null || _a === void 0 ? void 0 : _a.pointSymbol : geom.type === "polyline" ?
|
|
656
|
+
(_b = this._drawTools) === null || _b === void 0 ? void 0 : _b.polylineSymbol : geom.type === "polygon" ?
|
|
657
|
+
(_c = this._drawTools) === null || _c === void 0 ? void 0 : _c.polygonSymbol : undefined
|
|
658
|
+
};
|
|
659
|
+
return new this.Graphic(props);
|
|
660
|
+
});
|
|
661
|
+
void this._highlightFeatures(this._selectedIds);
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Query the selectLayerView based on any user drawn geometries or buffers
|
|
665
|
+
*
|
|
666
|
+
* @param evt CustomEvent that contains the result of the buffer
|
|
667
|
+
*
|
|
668
|
+
* @protected
|
|
669
|
+
*/
|
|
670
|
+
async _bufferComplete(evt) {
|
|
671
|
+
this._bufferGeometry = Array.isArray(evt.detail) ?
|
|
672
|
+
evt.detail[0] : evt.detail;
|
|
673
|
+
if (this._bufferGeometry) {
|
|
674
|
+
// Create a symbol for rendering the graphic
|
|
675
|
+
const symbol = {
|
|
676
|
+
type: "simple-fill",
|
|
677
|
+
color: this.bufferColor,
|
|
678
|
+
outline: {
|
|
679
|
+
color: this.bufferOutlineColor,
|
|
680
|
+
width: 1
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
// Add the geometry and symbol to a new graphic
|
|
684
|
+
const polygonGraphic = new this.Graphic({
|
|
685
|
+
geometry: this._bufferGeometry,
|
|
686
|
+
symbol
|
|
687
|
+
});
|
|
688
|
+
this._bufferGraphicsLayer.removeAll();
|
|
689
|
+
this._bufferGraphicsLayer.add(polygonGraphic);
|
|
690
|
+
void this._selectFeatures([this._bufferGeometry]);
|
|
691
|
+
void this.mapView.goTo(polygonGraphic.geometry.extent);
|
|
692
|
+
}
|
|
693
|
+
else {
|
|
694
|
+
if (this._bufferGraphicsLayer) {
|
|
695
|
+
this._bufferGraphicsLayer.removeAll();
|
|
696
|
+
}
|
|
697
|
+
return this._highlightWithOIDsOrGeoms();
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Fetch a single geometry for each potential geometry type
|
|
702
|
+
*
|
|
703
|
+
* @param geometries All current selection geometries
|
|
704
|
+
*
|
|
705
|
+
* @protected
|
|
706
|
+
*/
|
|
707
|
+
_geomQuery(geometries) {
|
|
708
|
+
const queryGeoms = mapViewUtils.getQueryGeoms(geometries, this._geometryEngine);
|
|
709
|
+
return this._selectFeatures(queryGeoms);
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Clear all stored values and general state for the component
|
|
713
|
+
*
|
|
714
|
+
* @param clearSearchWidget Optional boolean for clearing the search widget (default is true)
|
|
715
|
+
* @param clearLabel Optional boolean for clearing the search label (default is true)
|
|
716
|
+
*
|
|
717
|
+
* @protected
|
|
718
|
+
*/
|
|
719
|
+
async _clearResults(clearSearchWidget = true, clearLabel = true) {
|
|
720
|
+
var _a, _b;
|
|
721
|
+
this._selectedIds = [];
|
|
722
|
+
if (clearLabel) {
|
|
723
|
+
this._selectionLabel = "";
|
|
724
|
+
}
|
|
725
|
+
if (this._bufferGraphicsLayer) {
|
|
726
|
+
this._bufferGraphicsLayer.removeAll();
|
|
727
|
+
}
|
|
728
|
+
if (clearSearchWidget && this._searchWidget) {
|
|
729
|
+
this._searchWidget.clear();
|
|
730
|
+
}
|
|
731
|
+
(_a = publicNotificationStore.state.highlightHandle) === null || _a === void 0 ? void 0 : _a.remove();
|
|
732
|
+
// for sketch
|
|
733
|
+
// checking for clear as it would throw off tests
|
|
734
|
+
if ((_b = this._drawTools) === null || _b === void 0 ? void 0 : _b.clear) {
|
|
735
|
+
void this._drawTools.clear();
|
|
736
|
+
}
|
|
737
|
+
this.selectionSetChange.emit(this._selectedIds.length);
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Fetch a single geometry for the current geometry type
|
|
741
|
+
*
|
|
742
|
+
* @param type worflow type
|
|
743
|
+
* @param graphics graphics to be used for selection
|
|
744
|
+
* @param label selection label
|
|
745
|
+
* @param useOIDs indicates if the OIDs should override the geometry for selection
|
|
746
|
+
* @param oids list of IDs to select when useOIDs is true
|
|
747
|
+
*
|
|
748
|
+
* @protected
|
|
749
|
+
*/
|
|
750
|
+
_updateSelection(type, graphics, label, useOIDs, oids) {
|
|
751
|
+
this._selectedIds = useOIDs && oids ? oids : this._selectedIds;
|
|
752
|
+
// see https://github.com/Esri/solutions-components/issues/148
|
|
753
|
+
this._skipGeomOIDs = useOIDs ? oids : undefined;
|
|
754
|
+
this.geometries = Array.isArray(graphics) ? graphics.map(g => g.geometry) : this.geometries;
|
|
755
|
+
this._workflowType = type;
|
|
756
|
+
this._selectionLabel = label;
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Fetches the component's translations
|
|
760
|
+
*
|
|
761
|
+
* @protected
|
|
762
|
+
*/
|
|
763
|
+
async _getTranslations() {
|
|
764
|
+
const translations = await locale.getLocaleComponentStrings(this.el);
|
|
765
|
+
this._translations = translations[0];
|
|
766
|
+
}
|
|
767
|
+
get el() { return index.getElement(this); }
|
|
768
|
+
static get watchers() { return {
|
|
769
|
+
"geometries": ["watchGeometriesHandler"],
|
|
770
|
+
"searchConfiguration": ["watchSearchConfigurationHandler"],
|
|
771
|
+
"_workflowType": ["workflowTypeHandler"]
|
|
772
|
+
}; }
|
|
773
|
+
};
|
|
774
|
+
MapSelectTools.style = mapSelectToolsCss;
|
|
775
|
+
|
|
776
|
+
const labelFormats = [
|
|
777
|
+
{
|
|
778
|
+
descriptionPDF: {
|
|
779
|
+
labelWidthDisplay: "2-5/8",
|
|
780
|
+
labelHeightDisplay: "1",
|
|
781
|
+
labelsPerPageDisplay: "30",
|
|
782
|
+
averyPartNumber: "*60"
|
|
783
|
+
},
|
|
784
|
+
labelSpec: {
|
|
785
|
+
type: "AVERY",
|
|
786
|
+
pageProperties: {
|
|
787
|
+
pageType: "ANSI A",
|
|
788
|
+
leftMargin: 0.1875,
|
|
789
|
+
rightMargin: 0.1875,
|
|
790
|
+
topMargin: 0.5,
|
|
791
|
+
bottomMargin: 0.5
|
|
792
|
+
},
|
|
793
|
+
numLabelsAcross: 3,
|
|
794
|
+
numLabelsDown: 10,
|
|
795
|
+
labelWidth: 2.625,
|
|
796
|
+
labelHeight: 1,
|
|
797
|
+
horizGapIn: 0.125,
|
|
798
|
+
vertGapIn: 0,
|
|
799
|
+
labelPadding: 0.1,
|
|
800
|
+
fontSizePx: 11,
|
|
801
|
+
maxNumLabelLines: 4
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
{
|
|
805
|
+
descriptionPDF: {
|
|
806
|
+
labelWidthDisplay: "4",
|
|
807
|
+
labelHeightDisplay: "1",
|
|
808
|
+
labelsPerPageDisplay: "20",
|
|
809
|
+
averyPartNumber: "*61"
|
|
810
|
+
},
|
|
811
|
+
labelSpec: {
|
|
812
|
+
type: "AVERY",
|
|
813
|
+
pageProperties: {
|
|
814
|
+
pageType: "ANSI A",
|
|
815
|
+
leftMargin: 0.15625,
|
|
816
|
+
rightMargin: 0.15625,
|
|
817
|
+
topMargin: 0.47637821,
|
|
818
|
+
bottomMargin: 0.5
|
|
819
|
+
},
|
|
820
|
+
numLabelsAcross: 2,
|
|
821
|
+
numLabelsDown: 10,
|
|
822
|
+
labelWidth: 4,
|
|
823
|
+
labelHeight: 1.0025,
|
|
824
|
+
horizGapIn: 0.1875,
|
|
825
|
+
vertGapIn: 0,
|
|
826
|
+
labelPadding: 0.1,
|
|
827
|
+
fontSizePx: 11,
|
|
828
|
+
maxNumLabelLines: 4
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
descriptionPDF: {
|
|
833
|
+
labelWidthDisplay: "4",
|
|
834
|
+
labelHeightDisplay: "1-1/3",
|
|
835
|
+
labelsPerPageDisplay: "14",
|
|
836
|
+
averyPartNumber: "*62"
|
|
837
|
+
},
|
|
838
|
+
labelSpec: {
|
|
839
|
+
type: "AVERY",
|
|
840
|
+
pageProperties: {
|
|
841
|
+
pageType: "ANSI A",
|
|
842
|
+
leftMargin: 0.15625,
|
|
843
|
+
rightMargin: 0.15625,
|
|
844
|
+
topMargin: 0.81889808,
|
|
845
|
+
bottomMargin: 0.83464612
|
|
846
|
+
},
|
|
847
|
+
numLabelsAcross: 2,
|
|
848
|
+
numLabelsDown: 7,
|
|
849
|
+
labelWidth: 4,
|
|
850
|
+
labelHeight: 1.3352,
|
|
851
|
+
horizGapIn: 0.1875,
|
|
852
|
+
vertGapIn: 0,
|
|
853
|
+
labelPadding: 0.1,
|
|
854
|
+
fontSizePx: 11,
|
|
855
|
+
maxNumLabelLines: 6
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
descriptionPDF: {
|
|
860
|
+
labelWidthDisplay: "4",
|
|
861
|
+
labelHeightDisplay: "2",
|
|
862
|
+
labelsPerPageDisplay: "10",
|
|
863
|
+
averyPartNumber: "*63"
|
|
864
|
+
},
|
|
865
|
+
labelSpec: {
|
|
866
|
+
type: "AVERY",
|
|
867
|
+
pageProperties: {
|
|
868
|
+
pageType: "ANSI A",
|
|
869
|
+
leftMargin: 0.15625,
|
|
870
|
+
rightMargin: 0.15625,
|
|
871
|
+
topMargin: 0.5,
|
|
872
|
+
bottomMargin: 0.5
|
|
873
|
+
},
|
|
874
|
+
numLabelsAcross: 2,
|
|
875
|
+
numLabelsDown: 5,
|
|
876
|
+
labelWidth: 4,
|
|
877
|
+
labelHeight: 2,
|
|
878
|
+
horizGapIn: 0.1875,
|
|
879
|
+
vertGapIn: 0,
|
|
880
|
+
labelPadding: 0.1,
|
|
881
|
+
fontSizePx: 12,
|
|
882
|
+
maxNumLabelLines: 10
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
descriptionPDF: {
|
|
887
|
+
labelWidthDisplay: "4",
|
|
888
|
+
labelHeightDisplay: "3-1/3",
|
|
889
|
+
labelsPerPageDisplay: "6",
|
|
890
|
+
averyPartNumber: "*64"
|
|
891
|
+
},
|
|
892
|
+
labelSpec: {
|
|
893
|
+
type: "AVERY",
|
|
894
|
+
pageProperties: {
|
|
895
|
+
pageType: "ANSI A",
|
|
896
|
+
leftMargin: 0.15625,
|
|
897
|
+
rightMargin: 0.15625,
|
|
898
|
+
topMargin: 0.4724412,
|
|
899
|
+
bottomMargin: 0.50000027
|
|
900
|
+
},
|
|
901
|
+
numLabelsAcross: 2,
|
|
902
|
+
numLabelsDown: 3,
|
|
903
|
+
labelWidth: 4,
|
|
904
|
+
labelHeight: 3.342,
|
|
905
|
+
horizGapIn: 0.1875,
|
|
906
|
+
vertGapIn: 0,
|
|
907
|
+
labelPadding: 0.1,
|
|
908
|
+
fontSizePx: 14,
|
|
909
|
+
maxNumLabelLines: 12
|
|
910
|
+
}
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
descriptionPDF: {
|
|
914
|
+
labelWidthDisplay: "1-3/4",
|
|
915
|
+
labelHeightDisplay: "1/2",
|
|
916
|
+
labelsPerPageDisplay: "80",
|
|
917
|
+
averyPartNumber: "*67"
|
|
918
|
+
},
|
|
919
|
+
labelSpec: {
|
|
920
|
+
type: "AVERY",
|
|
921
|
+
pageProperties: {
|
|
922
|
+
pageType: "ANSI A",
|
|
923
|
+
leftMargin: 0.307086375,
|
|
924
|
+
rightMargin: 0.307086375,
|
|
925
|
+
topMargin: 0.4724412,
|
|
926
|
+
bottomMargin: 0.49606326
|
|
927
|
+
},
|
|
928
|
+
numLabelsAcross: 4,
|
|
929
|
+
numLabelsDown: 20,
|
|
930
|
+
labelWidth: 1.75,
|
|
931
|
+
labelHeight: 0.50155,
|
|
932
|
+
horizGapIn: 0.29527575,
|
|
933
|
+
vertGapIn: 0,
|
|
934
|
+
labelPadding: 0.1,
|
|
935
|
+
fontSizePx: 8,
|
|
936
|
+
maxNumLabelLines: 3
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
descriptionPDF: {
|
|
941
|
+
labelWidthDisplay: "1-3/4",
|
|
942
|
+
labelHeightDisplay: "2/3",
|
|
943
|
+
labelsPerPageDisplay: "60",
|
|
944
|
+
averyPartNumber: "*95"
|
|
945
|
+
},
|
|
946
|
+
labelSpec: {
|
|
947
|
+
type: "AVERY",
|
|
948
|
+
pageProperties: {
|
|
949
|
+
pageType: "ANSI A",
|
|
950
|
+
leftMargin: 0.28936983,
|
|
951
|
+
rightMargin: 0.28936983,
|
|
952
|
+
topMargin: 0.53937037,
|
|
953
|
+
bottomMargin: 0.5511814
|
|
954
|
+
},
|
|
955
|
+
numLabelsAcross: 4,
|
|
956
|
+
numLabelsDown: 15,
|
|
957
|
+
labelWidth: 1.75,
|
|
958
|
+
labelHeight: 0.6605,
|
|
959
|
+
horizGapIn: 0.30708678,
|
|
960
|
+
vertGapIn: 0,
|
|
961
|
+
labelPadding: 0.1,
|
|
962
|
+
fontSizePx: 8,
|
|
963
|
+
maxNumLabelLines: 4
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
];
|
|
967
|
+
|
|
968
|
+
const pdfLabelFormats = /*#__PURE__*/Object.freeze({
|
|
969
|
+
__proto__: null,
|
|
970
|
+
'default': labelFormats
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
const pdfDownloadCss = ":host{display:block}";
|
|
974
|
+
|
|
975
|
+
const PdfDownload = class {
|
|
976
|
+
constructor(hostRef) {
|
|
977
|
+
index.registerInstance(this, hostRef);
|
|
978
|
+
this.disabled = false;
|
|
979
|
+
this.layerView = undefined;
|
|
980
|
+
this._translations = undefined;
|
|
981
|
+
}
|
|
982
|
+
//--------------------------------------------------------------------------
|
|
983
|
+
//
|
|
984
|
+
// Watch handlers
|
|
985
|
+
//
|
|
986
|
+
//--------------------------------------------------------------------------
|
|
987
|
+
//--------------------------------------------------------------------------
|
|
988
|
+
//
|
|
989
|
+
// Methods (public)
|
|
990
|
+
//
|
|
991
|
+
//--------------------------------------------------------------------------
|
|
992
|
+
/**
|
|
993
|
+
* Downloads csv of mailing labels for the provided list of ids
|
|
994
|
+
*
|
|
995
|
+
* @param selectionSetNames Names of the selection sets used to provide ids
|
|
996
|
+
* @param ids List of ids to download
|
|
997
|
+
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
|
998
|
+
* @param addColumnTitle Indicates if column headings should be included in output
|
|
999
|
+
* @returns Promise resolving when function is done
|
|
1000
|
+
*/
|
|
1001
|
+
async downloadCSV(selectionSetNames, ids, removeDuplicates, addColumnTitle = true) {
|
|
1002
|
+
return downloadUtils.downloadCSV(selectionSetNames, this.layerView.layer, ids, true, // formatUsingLayerPopup
|
|
1003
|
+
removeDuplicates, addColumnTitle);
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* Downloads pdf of mailing labels for the provided list of ids
|
|
1007
|
+
*
|
|
1008
|
+
* @param selectionSetNames Names of the selection sets used to provide ids
|
|
1009
|
+
* @param ids List of ids to download
|
|
1010
|
+
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
|
1011
|
+
* @returns Promise resolving when function is done
|
|
1012
|
+
*/
|
|
1013
|
+
async downloadPDF(selectionSetNames, ids, removeDuplicates) {
|
|
1014
|
+
return downloadUtils.downloadPDF(selectionSetNames, this.layerView.layer, ids, removeDuplicates, this._labelInfoElement.selectedOption.value);
|
|
1015
|
+
}
|
|
1016
|
+
//--------------------------------------------------------------------------
|
|
1017
|
+
//
|
|
1018
|
+
// Events (public)
|
|
1019
|
+
//
|
|
1020
|
+
//--------------------------------------------------------------------------
|
|
1021
|
+
//--------------------------------------------------------------------------
|
|
1022
|
+
//
|
|
1023
|
+
// Functions (lifecycle)
|
|
1024
|
+
//
|
|
1025
|
+
//--------------------------------------------------------------------------
|
|
1026
|
+
/**
|
|
1027
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
1028
|
+
*/
|
|
1029
|
+
async componentWillLoad() {
|
|
1030
|
+
await this._getTranslations();
|
|
1031
|
+
await this._initModules();
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Renders the component.
|
|
1035
|
+
*/
|
|
1036
|
+
render() {
|
|
1037
|
+
return (index.h(index.Host, null, index.h("calcite-select", { disabled: this.disabled, label: "", ref: (el) => { this._labelInfoElement = el; } }, this._renderItems())));
|
|
1038
|
+
}
|
|
1039
|
+
//--------------------------------------------------------------------------
|
|
1040
|
+
//
|
|
1041
|
+
// Functions (protected)
|
|
1042
|
+
//
|
|
1043
|
+
//--------------------------------------------------------------------------
|
|
1044
|
+
/**
|
|
1045
|
+
* Load esri javascript api modules
|
|
1046
|
+
*
|
|
1047
|
+
* @returns Promise resolving when function is done
|
|
1048
|
+
*
|
|
1049
|
+
* @protected
|
|
1050
|
+
*/
|
|
1051
|
+
async _initModules() {
|
|
1052
|
+
const [intl] = await loadModules.loadModules([
|
|
1053
|
+
"esri/intl"
|
|
1054
|
+
]);
|
|
1055
|
+
this._intl = intl;
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Gets the formatted pdf export size text
|
|
1059
|
+
*
|
|
1060
|
+
* @param labelInfo current user selected label info
|
|
1061
|
+
*
|
|
1062
|
+
* @returns the pdf label as a string
|
|
1063
|
+
* @protected
|
|
1064
|
+
*/
|
|
1065
|
+
_getLabelSizeText(labelInfo) {
|
|
1066
|
+
const lNum = labelInfo.descriptionPDF.labelsPerPageDisplay;
|
|
1067
|
+
const lSize = `${labelInfo.descriptionPDF.labelWidthDisplay} x ${labelInfo.descriptionPDF.labelHeightDisplay}`;
|
|
1068
|
+
return this._translations.pdfLabel.replace("{{n}}", lNum).replace("{{labelSize}}", lSize);
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Fetches the component's translations
|
|
1072
|
+
*
|
|
1073
|
+
* @protected
|
|
1074
|
+
*/
|
|
1075
|
+
async _getTranslations() {
|
|
1076
|
+
const translations = await locale.getLocaleComponentStrings(this.el);
|
|
1077
|
+
this._translations = translations[0];
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Renders the pdf export size options
|
|
1081
|
+
*
|
|
1082
|
+
* @returns Node array of size options
|
|
1083
|
+
*
|
|
1084
|
+
* @protected
|
|
1085
|
+
*/
|
|
1086
|
+
_renderItems() {
|
|
1087
|
+
const s = pdfLabelFormats;
|
|
1088
|
+
const sortedPdfIndo = (s.default || s).sort((a, b) => {
|
|
1089
|
+
const _a = parseInt(a.descriptionPDF.labelsPerPageDisplay, 10);
|
|
1090
|
+
const _b = parseInt(b.descriptionPDF.labelsPerPageDisplay, 10);
|
|
1091
|
+
return _a < _b ? -1 : _a > _b ? 1 : 0;
|
|
1092
|
+
});
|
|
1093
|
+
return sortedPdfIndo.map((l) => {
|
|
1094
|
+
return (index.h("calcite-option", { value: l }, this._getLabelSizeText(l)));
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
get el() { return index.getElement(this); }
|
|
1098
|
+
};
|
|
1099
|
+
PdfDownload.style = pdfDownloadCss;
|
|
27
1100
|
|
|
1101
|
+
const refineSelectionCss = ":host{display:block}";
|
|
28
1102
|
|
|
1103
|
+
const RefineSelection = class {
|
|
1104
|
+
constructor(hostRef) {
|
|
1105
|
+
index.registerInstance(this, hostRef);
|
|
1106
|
+
this.selectionSetsChanged = index.createEvent(this, "selectionSetsChanged", 7);
|
|
1107
|
+
//--------------------------------------------------------------------------
|
|
1108
|
+
//
|
|
1109
|
+
// Properties (protected)
|
|
1110
|
+
//
|
|
1111
|
+
//--------------------------------------------------------------------------
|
|
1112
|
+
/**
|
|
1113
|
+
* boolean: Indicates if any new graphics should be added or removed
|
|
1114
|
+
*/
|
|
1115
|
+
this._addEnabled = true;
|
|
1116
|
+
this.addresseeLayer = undefined;
|
|
1117
|
+
this.enabledLayerIds = [];
|
|
1118
|
+
this.mapView = undefined;
|
|
1119
|
+
this.selectionSets = [];
|
|
1120
|
+
this.GraphicsLayer = undefined;
|
|
1121
|
+
this.SketchViewModel = undefined;
|
|
1122
|
+
this._translations = undefined;
|
|
1123
|
+
}
|
|
1124
|
+
//--------------------------------------------------------------------------
|
|
1125
|
+
//
|
|
1126
|
+
// Watch handlers
|
|
1127
|
+
//
|
|
1128
|
+
//--------------------------------------------------------------------------
|
|
1129
|
+
/**
|
|
1130
|
+
* Called each time the addresseeLayer is changed.
|
|
1131
|
+
* Add a new clean refine set for the new addressee layer.
|
|
1132
|
+
*/
|
|
1133
|
+
addresseeLayerWatchHandler() {
|
|
1134
|
+
const selectionSets = this.selectionSets.filter(ss => ss.workflowType !== interfaces$1.EWorkflowType.REFINE);
|
|
1135
|
+
this.selectionSets = this._initRefineSelectionSet(selectionSets);
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Handles changes to refine selection ids.
|
|
1139
|
+
*
|
|
1140
|
+
*/
|
|
1141
|
+
refineSelectionIdsChange(event) {
|
|
1142
|
+
var _a, _b;
|
|
1143
|
+
const addIds = ((_a = event.detail) === null || _a === void 0 ? void 0 : _a.addIds) || [];
|
|
1144
|
+
const removeIds = ((_b = event.detail) === null || _b === void 0 ? void 0 : _b.removeIds) || [];
|
|
1145
|
+
this._updateSelectionSets(removeIds);
|
|
1146
|
+
this._updateRefineSelectionSet(addIds, removeIds);
|
|
1147
|
+
}
|
|
1148
|
+
//--------------------------------------------------------------------------
|
|
1149
|
+
//
|
|
1150
|
+
// Functions (lifecycle)
|
|
1151
|
+
//
|
|
1152
|
+
//--------------------------------------------------------------------------
|
|
1153
|
+
/**
|
|
1154
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
1155
|
+
*/
|
|
1156
|
+
async componentWillLoad() {
|
|
1157
|
+
await this._getTranslations();
|
|
1158
|
+
const refineSet = this._getRefineSelectionSet(this.selectionSets);
|
|
1159
|
+
if (!refineSet) {
|
|
1160
|
+
this.selectionSets = this._initRefineSelectionSet(this.selectionSets);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Renders the component.
|
|
1165
|
+
*/
|
|
1166
|
+
render() {
|
|
1167
|
+
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())))));
|
|
1168
|
+
}
|
|
1169
|
+
//--------------------------------------------------------------------------
|
|
1170
|
+
//
|
|
1171
|
+
// Functions (protected)
|
|
1172
|
+
//
|
|
1173
|
+
//--------------------------------------------------------------------------
|
|
1174
|
+
/**
|
|
1175
|
+
* Store the Add/Remove mode
|
|
1176
|
+
*
|
|
1177
|
+
* @protected
|
|
1178
|
+
*/
|
|
1179
|
+
_modeChanged(evt) {
|
|
1180
|
+
this._addEnabled = evt.detail === interfaces$1.ESelectionMode.ADD;
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Set the refine tools selection mode
|
|
1184
|
+
*
|
|
1185
|
+
* @protected
|
|
1186
|
+
*/
|
|
1187
|
+
_setSelectionMode(mode) {
|
|
1188
|
+
this._refineTools.mode = mode;
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Create a list to show the number added/removed/total unique selected
|
|
1192
|
+
*
|
|
1193
|
+
* @returns the list node
|
|
1194
|
+
* @protected
|
|
1195
|
+
*/
|
|
1196
|
+
_getRefineSelectionSetList() {
|
|
1197
|
+
const total = publicNotificationUtils.getTotal(this.selectionSets);
|
|
1198
|
+
const refineSet = this._getRefineSelectionSet(this.selectionSets);
|
|
1199
|
+
const numAdded = (refineSet === null || refineSet === void 0 ? void 0 : refineSet.refineIds.addIds.length) || 0;
|
|
1200
|
+
const numRemoved = (refineSet === null || refineSet === void 0 ? void 0 : refineSet.refineIds.removeIds.length) || 0;
|
|
1201
|
+
return [(index.h("calcite-list-item", { label: this._translations.featuresAdded.replace("{{n}}", numAdded.toString()), "non-interactive": true })), (index.h("calcite-list-item", { label: this._translations.featuresRemoved.replace("{{n}}", numRemoved.toString()), "non-interactive": true })), (index.h("calcite-list-item", { label: this._translations.totalSelected.replace("{{n}}", total.toString()), "non-interactive": true }))];
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Fetch the refine selection set
|
|
1205
|
+
*
|
|
1206
|
+
* @returns the refine selection set
|
|
1207
|
+
* @protected
|
|
1208
|
+
*/
|
|
1209
|
+
_getRefineSelectionSet(selectionSets) {
|
|
1210
|
+
let refineSelectionSet;
|
|
1211
|
+
selectionSets.some(ss => {
|
|
1212
|
+
if (ss.workflowType === interfaces$1.EWorkflowType.REFINE) {
|
|
1213
|
+
refineSelectionSet = ss;
|
|
1214
|
+
return true;
|
|
1215
|
+
}
|
|
1216
|
+
});
|
|
1217
|
+
return refineSelectionSet;
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Remove ids from existing selection sets.
|
|
1221
|
+
* Remove any selection sets than have no selected ids
|
|
1222
|
+
* This can update any selection set not just the refine set.
|
|
1223
|
+
* We do not do something similar for adds as we will only ever add from refine tools to the single REFINE selection set.
|
|
1224
|
+
*
|
|
1225
|
+
* @param removeIds the ids to remove
|
|
1226
|
+
*
|
|
1227
|
+
* @protected
|
|
1228
|
+
*/
|
|
1229
|
+
_updateSelectionSets(removeIds) {
|
|
1230
|
+
if (removeIds.length > 0) {
|
|
1231
|
+
this.selectionSets = this.selectionSets.reduce((prev, cur) => {
|
|
1232
|
+
cur.selectedIds = cur.selectedIds.filter(id => removeIds.indexOf(id) < 0);
|
|
1233
|
+
if (cur.selectedIds.length > 0 || cur.workflowType === interfaces$1.EWorkflowType.REFINE) {
|
|
1234
|
+
prev.push(cur);
|
|
1235
|
+
}
|
|
1236
|
+
return prev;
|
|
1237
|
+
}, []);
|
|
1238
|
+
this.selectionSetsChanged.emit(this.selectionSets);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Update the refine selection set with any adds or removes
|
|
1243
|
+
*
|
|
1244
|
+
* @param addIds any ids to add
|
|
1245
|
+
* @param removeIds any ids to remove
|
|
1246
|
+
*
|
|
1247
|
+
* @returns Promise resolving when function is done
|
|
1248
|
+
* @protected
|
|
1249
|
+
*/
|
|
1250
|
+
_updateRefineSelectionSet(addIds, removeIds) {
|
|
1251
|
+
const selectionSet = this._getRefineSelectionSet(this.selectionSets);
|
|
1252
|
+
this._updateRefineIds(selectionSet, addIds, removeIds);
|
|
1253
|
+
this.selectionSetsChanged.emit(this.selectionSets);
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Update the ids stored for the refine selection set
|
|
1257
|
+
*
|
|
1258
|
+
* @param selectionSet the refine selection set
|
|
1259
|
+
* @param addIds any ids to add
|
|
1260
|
+
* @param removeIds any ids to remove
|
|
1261
|
+
*
|
|
1262
|
+
* @returns updated selection sets
|
|
1263
|
+
* @protected
|
|
1264
|
+
*/
|
|
1265
|
+
_updateRefineIds(selectionSet, addIds, removeIds) {
|
|
1266
|
+
// remove ids if they exist in the current add or remove list
|
|
1267
|
+
selectionSet.refineIds.addIds = selectionSet.refineIds.addIds.filter(id => removeIds.indexOf(id) < 0);
|
|
1268
|
+
selectionSet.refineIds.removeIds = selectionSet.refineIds.removeIds.filter(id => addIds.indexOf(id) < 0);
|
|
1269
|
+
const _addIds = [...new Set(selectionSet.refineIds.addIds.concat(addIds))];
|
|
1270
|
+
const _removeIds = [...new Set(selectionSet.refineIds.removeIds.concat(removeIds))];
|
|
1271
|
+
selectionSet.refineIds = {
|
|
1272
|
+
addIds: _addIds.filter(id => _removeIds.indexOf(id) < 0),
|
|
1273
|
+
removeIds: _removeIds.filter(id => _addIds.indexOf(id) < 0)
|
|
1274
|
+
};
|
|
1275
|
+
selectionSet.selectedIds = selectionSet.refineIds.addIds.length > 0 ?
|
|
1276
|
+
[...new Set(selectionSet.selectedIds.concat(selectionSet.refineIds.addIds))] :
|
|
1277
|
+
selectionSet.selectedIds.filter(id => selectionSet.refineIds.removeIds.indexOf(id) < 0);
|
|
1278
|
+
return this.selectionSets.map(ss => {
|
|
1279
|
+
return ss.workflowType === interfaces$1.EWorkflowType.REFINE ? selectionSet : ss;
|
|
1280
|
+
});
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Add a new refine selection set
|
|
1284
|
+
*
|
|
1285
|
+
* @returns updated selection sets
|
|
1286
|
+
* @protected
|
|
1287
|
+
*/
|
|
1288
|
+
_initRefineSelectionSet(selectionSets) {
|
|
1289
|
+
return [
|
|
1290
|
+
...selectionSets,
|
|
1291
|
+
({
|
|
1292
|
+
buffer: undefined,
|
|
1293
|
+
distance: 0,
|
|
1294
|
+
download: true,
|
|
1295
|
+
geometries: [],
|
|
1296
|
+
id: Date.now(),
|
|
1297
|
+
label: "Refine",
|
|
1298
|
+
layerView: this.addresseeLayer,
|
|
1299
|
+
refineSelectLayers: [],
|
|
1300
|
+
searchResult: undefined,
|
|
1301
|
+
selectedIds: [],
|
|
1302
|
+
unit: "feet",
|
|
1303
|
+
workflowType: interfaces$1.EWorkflowType.REFINE,
|
|
1304
|
+
refineIds: {
|
|
1305
|
+
addIds: [],
|
|
1306
|
+
removeIds: []
|
|
1307
|
+
},
|
|
1308
|
+
redoStack: [],
|
|
1309
|
+
undoStack: []
|
|
1310
|
+
})
|
|
1311
|
+
];
|
|
1312
|
+
}
|
|
1313
|
+
/**
|
|
1314
|
+
* Fetches the component's translations
|
|
1315
|
+
*
|
|
1316
|
+
* @protected
|
|
1317
|
+
*/
|
|
1318
|
+
async _getTranslations() {
|
|
1319
|
+
const translations = await locale.getLocaleComponentStrings(this.el);
|
|
1320
|
+
this._translations = translations[0];
|
|
1321
|
+
}
|
|
1322
|
+
/** Provides access to protected methods for unit testing.
|
|
1323
|
+
*
|
|
1324
|
+
* @param methodName Name of protected method to run
|
|
1325
|
+
* @param arg1 First argument to forward to method, e.g., for "_modeChanged", `ESelectionMode`
|
|
1326
|
+
* @returns
|
|
1327
|
+
*/
|
|
1328
|
+
_testAccess(methodName, arg1) {
|
|
1329
|
+
switch (methodName) {
|
|
1330
|
+
case "_modeChanged":
|
|
1331
|
+
return this._modeChanged(arg1);
|
|
1332
|
+
case "_setSelectionMode":
|
|
1333
|
+
return this._setSelectionMode(arg1);
|
|
1334
|
+
// case "_getRefineSelectionSetList":
|
|
1335
|
+
// return this._getRefineSelectionSetList();
|
|
1336
|
+
// case "_getRefineSelectionSet":
|
|
1337
|
+
// return this._getRefineSelectionSet(arg1);
|
|
1338
|
+
// case "_updateSelectionSets":
|
|
1339
|
+
// return this._updateSelectionSets(arg1);
|
|
1340
|
+
// case "_updateRefineSelectionSet":
|
|
1341
|
+
// return this._updateRefineSelectionSet(arg1, arg2);
|
|
1342
|
+
// case "_updateRefineIds":
|
|
1343
|
+
// return this._updateRefineIds(arg1, arg2, arg3);
|
|
1344
|
+
// case "_addRefineSelectionSet":
|
|
1345
|
+
// return this._addRefineSelectionSet(arg1, arg2);
|
|
1346
|
+
}
|
|
1347
|
+
return null;
|
|
1348
|
+
}
|
|
1349
|
+
get el() { return index.getElement(this); }
|
|
1350
|
+
static get watchers() { return {
|
|
1351
|
+
"addresseeLayer": ["addresseeLayerWatchHandler"]
|
|
1352
|
+
}; }
|
|
1353
|
+
};
|
|
1354
|
+
RefineSelection.style = refineSelectionCss;
|
|
29
1355
|
|
|
30
|
-
exports.calcite_input_message =
|
|
31
|
-
exports.calcite_notice =
|
|
32
|
-
exports.map_select_tools =
|
|
33
|
-
exports.pdf_download =
|
|
34
|
-
exports.refine_selection =
|
|
1356
|
+
exports.calcite_input_message = InputMessage;
|
|
1357
|
+
exports.calcite_notice = Notice;
|
|
1358
|
+
exports.map_select_tools = MapSelectTools;
|
|
1359
|
+
exports.pdf_download = PdfDownload;
|
|
1360
|
+
exports.refine_selection = RefineSelection;
|