@esri/solutions-components 0.2.6 → 0.2.7
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/cjs/deduct-calculator.cjs.entry.js +1 -1
- package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
- package/dist/cjs/{pciUtils-6a806ba4.js → pciUtils-423cfc68.js} +25 -7
- package/dist/collection/demos/deduct-calculator.html +2 -5
- package/dist/collection/demos/new-public-notification.html +6 -4
- package/dist/collection/utils/pciUtils.js +25 -7
- package/dist/collection/utils/pciUtils.ts +30 -7
- package/dist/components/ExpandToggle.js +110 -0
- package/dist/components/Heading.js +22 -0
- package/dist/components/_commonjsHelpers.js +22 -0
- package/dist/components/action-bar.js +276 -0
- package/dist/components/action-group.js +149 -0
- package/dist/components/action-menu.js +356 -0
- package/dist/components/action.js +214 -0
- package/dist/components/add-record-modal.d.ts +11 -0
- package/dist/components/add-record-modal.js +171 -0
- package/dist/components/array.js +15 -0
- package/dist/components/block.js +272 -0
- package/dist/components/buffer-tools.d.ts +11 -0
- package/dist/components/buffer-tools.js +11 -0
- package/dist/components/buffer-tools2.js +262 -0
- package/dist/components/button.js +263 -0
- package/dist/components/calcite-accordion-item.js +244 -0
- package/dist/components/calcite-accordion.js +180 -0
- package/dist/components/calcite-action-bar.js +11 -0
- package/dist/components/calcite-action-group.js +11 -0
- package/dist/components/calcite-action-menu.js +11 -0
- package/dist/components/calcite-action-pad.js +197 -0
- package/dist/components/calcite-action.js +11 -0
- package/dist/components/calcite-alert.js +297 -0
- package/dist/components/calcite-avatar.js +182 -0
- package/dist/components/calcite-block-section.js +155 -0
- package/dist/components/calcite-block.js +11 -0
- package/dist/components/calcite-button.js +11 -0
- package/dist/components/calcite-card.js +187 -0
- package/dist/components/calcite-checkbox.js +11 -0
- package/dist/components/calcite-chip.js +11 -0
- package/dist/components/calcite-color-picker-hex-input.js +11 -0
- package/dist/components/calcite-color-picker-swatch.js +11 -0
- package/dist/components/calcite-color-picker.js +1036 -0
- package/dist/components/calcite-combobox-item-group.js +75 -0
- package/dist/components/calcite-combobox-item.js +11 -0
- package/dist/components/calcite-combobox.js +11 -0
- package/dist/components/calcite-date-picker-day.js +11 -0
- package/dist/components/calcite-date-picker-month-header.js +11 -0
- package/dist/components/calcite-date-picker-month.js +11 -0
- package/dist/components/calcite-date-picker.js +11 -0
- package/dist/components/calcite-dropdown-group.js +11 -0
- package/dist/components/calcite-dropdown-item.js +11 -0
- package/dist/components/calcite-dropdown.js +11 -0
- package/dist/components/calcite-fab.js +144 -0
- package/dist/components/calcite-filter.js +195 -0
- package/dist/components/calcite-flow-item.js +243 -0
- package/dist/components/calcite-flow.js +147 -0
- package/dist/components/calcite-graph.js +11 -0
- package/dist/components/calcite-handle.js +11 -0
- package/dist/components/calcite-icon.js +11 -0
- package/dist/components/calcite-inline-editable.js +294 -0
- package/dist/components/calcite-input-date-picker.js +713 -0
- package/dist/components/calcite-input-message.js +11 -0
- package/dist/components/calcite-input-number.js +637 -0
- package/dist/components/calcite-input-text.js +400 -0
- package/dist/components/calcite-input-time-picker.js +434 -0
- package/dist/components/calcite-input.js +11 -0
- package/dist/components/calcite-label.js +11 -0
- package/dist/components/calcite-link.js +11 -0
- package/dist/components/calcite-list-item-group.js +65 -0
- package/dist/components/calcite-list-item.js +11 -0
- package/dist/components/calcite-list.js +11 -0
- package/dist/components/calcite-loader.js +11 -0
- package/dist/components/calcite-modal.js +11 -0
- package/dist/components/calcite-notice.js +11 -0
- package/dist/components/calcite-option-group.js +64 -0
- package/dist/components/calcite-option.js +11 -0
- package/dist/components/calcite-pagination.js +258 -0
- package/dist/components/calcite-panel.js +11 -0
- package/dist/components/calcite-pick-list-group.js +74 -0
- package/dist/components/calcite-pick-list-item.js +11 -0
- package/dist/components/calcite-pick-list.js +11 -0
- package/dist/components/calcite-popover-manager.js +94 -0
- package/dist/components/calcite-popover.js +11 -0
- package/dist/components/calcite-progress.js +11 -0
- package/dist/components/calcite-radio-button-group.js +132 -0
- package/dist/components/calcite-radio-button.js +310 -0
- package/dist/components/calcite-radio-group-item.js +11 -0
- package/dist/components/calcite-radio-group.js +11 -0
- package/dist/components/calcite-rating.js +201 -0
- package/dist/components/calcite-scrim.js +11 -0
- package/dist/components/calcite-select.js +11 -0
- package/dist/components/calcite-shell-center-row.js +100 -0
- package/dist/components/calcite-shell-panel.js +11 -0
- package/dist/components/calcite-shell.js +11 -0
- package/dist/components/calcite-slider.js +11 -0
- package/dist/components/calcite-sortable-list.js +202 -0
- package/dist/components/calcite-split-button.js +11 -0
- package/dist/components/calcite-stepper-item.js +271 -0
- package/dist/components/calcite-stepper.js +256 -0
- package/dist/components/calcite-switch.js +11 -0
- package/dist/components/calcite-tab-nav.js +11 -0
- package/dist/components/calcite-tab-title.js +11 -0
- package/dist/components/calcite-tab.js +11 -0
- package/dist/components/calcite-tabs.js +11 -0
- package/dist/components/calcite-tile-select-group.js +65 -0
- package/dist/components/calcite-tile-select.js +266 -0
- package/dist/components/calcite-tile.js +11 -0
- package/dist/components/calcite-time-picker.js +11 -0
- package/dist/components/calcite-tip-group.js +41 -0
- package/dist/components/calcite-tip-manager.js +223 -0
- package/dist/components/calcite-tip.js +162 -0
- package/dist/components/calcite-tooltip-manager.js +57 -0
- package/dist/components/calcite-tooltip.js +11 -0
- package/dist/components/calcite-tree-item.js +11 -0
- package/dist/components/calcite-tree.js +11 -0
- package/dist/components/calcite-value-list-item.js +11 -0
- package/dist/components/calcite-value-list.js +11 -0
- package/dist/components/card-manager.d.ts +11 -0
- package/dist/components/card-manager.js +143 -0
- package/dist/components/check-list.d.ts +11 -0
- package/dist/components/check-list.js +11 -0
- package/dist/components/check-list2.js +131 -0
- package/dist/components/checkbox.js +165 -0
- package/dist/components/chip.js +170 -0
- package/dist/components/color-picker-hex-input.js +363 -0
- package/dist/components/color-picker-swatch.js +2034 -0
- package/dist/components/combobox-item.js +182 -0
- package/dist/components/combobox.js +912 -0
- package/dist/components/comment-card.d.ts +11 -0
- package/dist/components/comment-card.js +90 -0
- package/dist/components/conditionalSlot.js +50 -0
- package/dist/components/config-buffer-tools.d.ts +11 -0
- package/dist/components/config-buffer-tools.js +187 -0
- package/dist/components/config-draw-tools.d.ts +11 -0
- package/dist/components/config-draw-tools.js +121 -0
- package/dist/components/config-layer-picker.d.ts +11 -0
- package/dist/components/config-layer-picker.js +163 -0
- package/dist/components/config-pdf-download.d.ts +11 -0
- package/dist/components/config-pdf-download.js +154 -0
- package/dist/components/crowdsource-manager.d.ts +11 -0
- package/dist/components/crowdsource-manager.js +90 -0
- package/dist/components/crowdsource-reporter.d.ts +11 -0
- package/dist/components/crowdsource-reporter.js +90 -0
- package/dist/components/csvUtils.js +74 -0
- package/dist/components/date-picker-day.js +111 -0
- package/dist/components/date-picker-month-header.js +224 -0
- package/dist/components/date-picker-month.js +344 -0
- package/dist/components/date-picker.js +575 -0
- package/dist/components/date.js +180 -0
- package/dist/components/debounce.js +487 -0
- package/dist/components/deduct-calculator.d.ts +11 -0
- package/dist/components/deduct-calculator.js +11 -0
- package/dist/components/deduct-calculator2.js +1002 -0
- package/dist/components/dom.js +231 -0
- package/dist/components/dropdown-group.js +96 -0
- package/dist/components/dropdown-item.js +232 -0
- package/dist/components/dropdown.js +505 -0
- package/dist/components/edit-record-modal.d.ts +11 -0
- package/dist/components/edit-record-modal.js +11 -0
- package/dist/components/edit-record-modal2.js +161 -0
- package/dist/components/filter.js +763 -0
- package/dist/components/floating-ui.js +1768 -0
- package/dist/components/form.js +228 -0
- package/dist/components/graph.js +254 -0
- package/dist/components/guid.js +24 -0
- package/dist/components/handle.js +119 -0
- package/dist/components/icon.js +202 -0
- package/dist/components/index.d.ts +61 -0
- package/dist/components/index.js +196 -0
- package/dist/components/index2.js +199 -0
- package/dist/components/info-card.d.ts +11 -0
- package/dist/components/info-card.js +11 -0
- package/dist/components/info-card2.js +97 -0
- package/dist/components/input-message.js +101 -0
- package/dist/components/input.js +740 -0
- package/dist/components/interactive.js +51 -0
- package/dist/components/interfaces.js +19 -0
- package/dist/components/interfaces2.js +21 -0
- package/dist/components/interfaces3.js +80 -0
- package/dist/components/json-editor.d.ts +11 -0
- package/dist/components/json-editor.js +11 -0
- package/dist/components/json-editor2.js +441 -0
- package/dist/components/key.js +16 -0
- package/dist/components/label.js +106 -0
- package/dist/components/label2.js +131 -0
- package/dist/components/labelFormats.js +210 -0
- package/dist/components/layer-table.d.ts +11 -0
- package/dist/components/layer-table.js +453 -0
- package/dist/components/link.js +123 -0
- package/dist/components/list-item.d.ts +11 -0
- package/dist/components/list-item.js +90 -0
- package/dist/components/list-item2.js +149 -0
- package/dist/components/list.js +83 -0
- package/dist/components/loadModules.js +28 -0
- package/dist/components/loader.js +116 -0
- package/dist/components/locale.js +412 -0
- package/dist/components/locale2.js +413 -0
- package/dist/components/map-card.d.ts +11 -0
- package/dist/components/map-card.js +354 -0
- package/dist/components/map-draw-tools.d.ts +11 -0
- package/dist/components/map-draw-tools.js +11 -0
- package/dist/components/map-draw-tools2.js +228 -0
- package/dist/components/map-layer-picker.d.ts +11 -0
- package/dist/components/map-layer-picker.js +11 -0
- package/dist/components/map-layer-picker2.js +188 -0
- package/dist/components/map-search.d.ts +11 -0
- package/dist/components/map-search.js +155 -0
- package/dist/components/map-select-tools.d.ts +11 -0
- package/dist/components/map-select-tools.js +11 -0
- package/dist/components/map-select-tools2.js +588 -0
- package/dist/components/mapViewUtils.js +129 -0
- package/dist/components/math.js +24 -0
- package/dist/components/media-card.d.ts +11 -0
- package/dist/components/media-card.js +11 -0
- package/dist/components/media-card2.js +177 -0
- package/dist/components/modal.js +495 -0
- package/dist/components/nonChromiumPlatformUtils.js +503 -0
- package/dist/components/notice.js +192 -0
- package/dist/components/observers.js +56 -0
- package/dist/components/openCloseComponent.js +56 -0
- package/dist/components/option.js +109 -0
- package/dist/components/panel.js +459 -0
- package/dist/components/pci-calculator.d.ts +11 -0
- package/dist/components/pci-calculator.js +193 -0
- package/dist/components/pdf-download.d.ts +11 -0
- package/dist/components/pdf-download.js +11 -0
- package/dist/components/pdf-download2.js +189 -0
- package/dist/components/pick-list-item.js +255 -0
- package/dist/components/pick-list.js +170 -0
- package/dist/components/popover.js +500 -0
- package/dist/components/progress.js +60 -0
- package/dist/components/public-notification.d.ts +11 -0
- package/dist/components/public-notification.js +825 -0
- package/dist/components/publicNotificationStore.js +38 -0
- package/dist/components/queryUtils.js +187 -0
- package/dist/components/radio-group-item.js +101 -0
- package/dist/components/radio-group.js +235 -0
- package/dist/components/refine-selection-tools.d.ts +11 -0
- package/dist/components/refine-selection-tools.js +11 -0
- package/dist/components/refine-selection-tools2.js +492 -0
- package/dist/components/refine-selection.d.ts +11 -0
- package/dist/components/refine-selection.js +11 -0
- package/dist/components/refine-selection2.js +376 -0
- package/dist/components/resources.js +24 -0
- package/dist/components/resources2.js +21 -0
- package/dist/components/resources3.js +38 -0
- package/dist/components/scrim.js +83 -0
- package/dist/components/select.js +259 -0
- package/dist/components/shared-list-render.js +319 -0
- package/dist/components/shell-panel.js +281 -0
- package/dist/components/shell.js +121 -0
- package/dist/components/slider.js +896 -0
- package/dist/components/solution-configuration.d.ts +11 -0
- package/dist/components/solution-configuration.js +2233 -0
- package/dist/components/solution-contents.d.ts +11 -0
- package/dist/components/solution-contents.js +11 -0
- package/dist/components/solution-contents2.js +128 -0
- package/dist/components/solution-item-details.d.ts +11 -0
- package/dist/components/solution-item-details.js +11 -0
- package/dist/components/solution-item-details2.js +234 -0
- package/dist/components/solution-item-icon.d.ts +11 -0
- package/dist/components/solution-item-icon.js +11 -0
- package/dist/components/solution-item-icon2.js +342 -0
- package/dist/components/solution-item-sharing.d.ts +11 -0
- package/dist/components/solution-item-sharing.js +11 -0
- package/dist/components/solution-item-sharing2.js +167 -0
- package/dist/components/solution-item.d.ts +11 -0
- package/dist/components/solution-item.js +11 -0
- package/dist/components/solution-item2.js +315 -0
- package/dist/components/solution-organization-variables.d.ts +11 -0
- package/dist/components/solution-organization-variables.js +11 -0
- package/dist/components/solution-organization-variables2.js +132 -0
- package/dist/components/solution-resource-item.d.ts +11 -0
- package/dist/components/solution-resource-item.js +11 -0
- package/dist/components/solution-resource-item2.js +356 -0
- package/dist/components/solution-spatial-ref.d.ts +11 -0
- package/dist/components/solution-spatial-ref.js +11 -0
- package/dist/components/solution-spatial-ref2.js +21446 -0
- package/dist/components/solution-store.js +4092 -0
- package/dist/components/solution-template-data.d.ts +11 -0
- package/dist/components/solution-template-data.js +11 -0
- package/dist/components/solution-template-data2.js +233 -0
- package/dist/components/solution-variables.d.ts +11 -0
- package/dist/components/solution-variables.js +11 -0
- package/dist/components/solution-variables2.js +150 -0
- package/dist/components/sortable.esm.js +3026 -0
- package/dist/components/split-button.js +165 -0
- package/dist/components/store-manager.d.ts +11 -0
- package/dist/components/store-manager.js +83 -0
- package/dist/components/switch.js +139 -0
- package/dist/components/tab-nav.js +241 -0
- package/dist/components/tab-title.js +276 -0
- package/dist/components/tab.js +154 -0
- package/dist/components/tabs.js +188 -0
- package/dist/components/tile.js +129 -0
- package/dist/components/time-picker.js +943 -0
- package/dist/components/tooltip.js +399 -0
- package/dist/components/tree-item.js +294 -0
- package/dist/components/tree.js +327 -0
- package/dist/components/utils.js +119 -0
- package/dist/components/utils2.js +51 -0
- package/dist/components/value-list-item.js +204 -0
- package/dist/components/value-list.js +333 -0
- package/dist/esm/deduct-calculator.entry.js +1 -1
- package/dist/esm/pci-calculator.entry.js +1 -1
- package/dist/esm/{pciUtils-e3007a1c.js → pciUtils-ecda46e5.js} +25 -7
- package/dist/solutions-components/demos/deduct-calculator.html +2 -5
- package/dist/solutions-components/demos/new-public-notification.html +6 -4
- package/dist/solutions-components/{p-ff80ffbb.entry.js → p-0512635b.entry.js} +1 -1
- package/dist/solutions-components/{p-5ec407c2.entry.js → p-0c088725.entry.js} +1 -1
- package/dist/solutions-components/p-cc815aca.js +21 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/pciUtils.ts +30 -7
- package/dist/types/utils/pciUtils.d.ts +2 -1
- package/package.json +4 -3
- package/dist/solutions-components/p-647bbd18.js +0 -21
@@ -0,0 +1,492 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
7
|
+
import { g as ESelectionType, f as ERefineMode, e as ESelectionMode } from './interfaces3.js';
|
8
|
+
import { b as getMapLayerView, h as highlightFeatures } from './mapViewUtils.js';
|
9
|
+
import { c as queryFeaturesByGeometry } from './queryUtils.js';
|
10
|
+
import { s as state } from './publicNotificationStore.js';
|
11
|
+
import { l as loadModules } from './loadModules.js';
|
12
|
+
import { g as getLocaleComponentStrings } from './locale.js';
|
13
|
+
import { d as defineCustomElement$9 } from './action.js';
|
14
|
+
import { d as defineCustomElement$8 } from './chip.js';
|
15
|
+
import { d as defineCustomElement$7 } from './combobox.js';
|
16
|
+
import { d as defineCustomElement$6 } from './combobox-item.js';
|
17
|
+
import { d as defineCustomElement$5 } from './icon.js';
|
18
|
+
import { d as defineCustomElement$4 } from './loader.js';
|
19
|
+
import { d as defineCustomElement$3 } from './option.js';
|
20
|
+
import { d as defineCustomElement$2 } from './select.js';
|
21
|
+
import { d as defineCustomElement$1 } from './map-layer-picker2.js';
|
22
|
+
|
23
|
+
const refineSelectionToolsCss = ":host{display:block}.div-visible{display:inherit}.div-not-visible{display:none !important}.padding-top-1-2{padding-top:.5rem}.main-label{display:flex;float:left}html[dir=\"rtl\"] .main-label{display:flex;float:right}.border{outline:1px solid var(--calcite-ui-border-input)}.margin-top-1{margin-top:1rem}.esri-sketch{display:flex;flex-flow:column wrap}.esri-widget{box-sizing:border-box;color:#323232;font-size:14px;font-family:\"Avenir Next\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;line-height:1.3em;background-color:#fff}.esri-sketch__panel{align-items:center;display:flex;flex-flow:row nowrap;padding:0}*/ .esri-sketch__tool-section{border-right:1px solid rgba(110,110,110,.3)}.esri-sketch__section{align-items:center;display:flex;flex-flow:row nowrap;padding:0 7px;margin:6px 0;border-right:1px solid rgba(110,110,110,.3)}";
|
24
|
+
|
25
|
+
const RefineSelectionTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
26
|
+
constructor() {
|
27
|
+
super();
|
28
|
+
this.__registerHost();
|
29
|
+
this.__attachShadow();
|
30
|
+
this.refineSelectionGraphicsChange = createEvent(this, "refineSelectionGraphicsChange", 7);
|
31
|
+
this.refineSelectionIdsChange = createEvent(this, "refineSelectionIdsChange", 7);
|
32
|
+
/**
|
33
|
+
* {<layer title>: Graphic[]}: Collection of graphics returned from queries to the layer
|
34
|
+
*/
|
35
|
+
this._featuresCollection = {};
|
36
|
+
/**
|
37
|
+
* IRefineOperation[]: Array to maintain the possible redo operations
|
38
|
+
*/
|
39
|
+
this._redoStack = [];
|
40
|
+
/**
|
41
|
+
* IRefineOperation[]: Array to maintain the possible undo operations
|
42
|
+
*/
|
43
|
+
this._undoStack = [];
|
44
|
+
this.active = false;
|
45
|
+
this.border = false;
|
46
|
+
this.graphics = undefined;
|
47
|
+
this.ids = [];
|
48
|
+
this.layerView = undefined;
|
49
|
+
this.layerViews = [];
|
50
|
+
this.mapView = undefined;
|
51
|
+
this.mode = undefined;
|
52
|
+
this.refineMode = undefined;
|
53
|
+
this.useLayerPicker = true;
|
54
|
+
this._selectEnabled = false;
|
55
|
+
this._selectionMode = undefined;
|
56
|
+
this._translations = undefined;
|
57
|
+
}
|
58
|
+
//--------------------------------------------------------------------------
|
59
|
+
//
|
60
|
+
// Watch handlers
|
61
|
+
//
|
62
|
+
//--------------------------------------------------------------------------
|
63
|
+
/**
|
64
|
+
* Called each time the ids prop is changed.
|
65
|
+
* Highlight the features based on the provided ids
|
66
|
+
*/
|
67
|
+
idsWatchHandler(v, oldV) {
|
68
|
+
if (v && JSON.stringify(v) !== JSON.stringify(oldV)) {
|
69
|
+
void this._highlightFeatures(v);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
//--------------------------------------------------------------------------
|
73
|
+
//
|
74
|
+
// Methods (public)
|
75
|
+
//
|
76
|
+
//--------------------------------------------------------------------------
|
77
|
+
/**
|
78
|
+
* Reset the ids collection
|
79
|
+
*
|
80
|
+
* @returns Promise when complete
|
81
|
+
*/
|
82
|
+
async reset() {
|
83
|
+
this.ids = [];
|
84
|
+
}
|
85
|
+
/**
|
86
|
+
* Clear current highlight handle
|
87
|
+
*
|
88
|
+
* @returns Promise when complete
|
89
|
+
*/
|
90
|
+
async clearHighlight() {
|
91
|
+
this._clearHighlight();
|
92
|
+
}
|
93
|
+
//--------------------------------------------------------------------------
|
94
|
+
//
|
95
|
+
// Functions (lifecycle)
|
96
|
+
//
|
97
|
+
//--------------------------------------------------------------------------
|
98
|
+
/**
|
99
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
100
|
+
*/
|
101
|
+
async componentWillLoad() {
|
102
|
+
await this._getTranslations();
|
103
|
+
await this._initModules();
|
104
|
+
}
|
105
|
+
/**
|
106
|
+
* StencilJS: Called once just after the component is fully loaded and the first render() occurs.
|
107
|
+
*/
|
108
|
+
componentDidLoad() {
|
109
|
+
this._init();
|
110
|
+
}
|
111
|
+
/**
|
112
|
+
* StencilJS: Called every time the component is disconnected from the DOM, ie,
|
113
|
+
* it can be dispatched more than once, DO not confuse with a "onDestroy" kind of event.
|
114
|
+
*/
|
115
|
+
disconnectedCallback() {
|
116
|
+
this.active = false;
|
117
|
+
}
|
118
|
+
/**
|
119
|
+
* Called every time the component is connected to the DOM.
|
120
|
+
* When the component is first connected, this method is called before componentWillLoad.
|
121
|
+
*/
|
122
|
+
connectedCallback() {
|
123
|
+
this.active = true;
|
124
|
+
if (this.ids.length > 0) {
|
125
|
+
this._selectEnabled = true;
|
126
|
+
void this._highlightFeatures(this.ids);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
/**
|
130
|
+
* Renders the component.
|
131
|
+
*/
|
132
|
+
render() {
|
133
|
+
const showLayerPickerClass = this.useLayerPicker ? "div-visible" : "div-not-visible";
|
134
|
+
const drawClass = this.border ? " border" : "";
|
135
|
+
return (h(Host, null, h("div", null, h("map-layer-picker", { class: showLayerPickerClass, mapView: this.mapView, onLayerSelectionChange: (evt) => { void this._layerSelectionChange(evt); }, selectedLayers: this.layerViews.map(l => l.layer.title), selectionMode: "single" }), h("div", { class: "margin-top-1" + drawClass }, h("div", { class: "esri-sketch esri-widget" }, h("div", { class: "esri-sketch__panel" }, h("div", { class: "esri-sketch__tool-section esri-sketch__section" }, h("calcite-action", { disabled: !this._selectEnabled, icon: "select", onClick: () => this._setSelectionMode(ESelectionType.POINT), scale: "s", text: this._translations.select })), h("div", { class: "esri-sketch__tool-section esri-sketch__section" }, h("calcite-action", { disabled: !this._selectEnabled, icon: "line", onClick: () => this._setSelectionMode(ESelectionType.LINE), scale: "s", text: this._translations.selectLine }), h("calcite-action", { disabled: !this._selectEnabled, icon: "polygon", onClick: () => this._setSelectionMode(ESelectionType.POLY), scale: "s", text: this._translations.selectPolygon }), h("calcite-action", { disabled: !this._selectEnabled, icon: "rectangle", onClick: () => this._setSelectionMode(ESelectionType.RECT), scale: "s", text: this._translations.selectRectangle })), h("div", { class: "esri-sketch__tool-section esri-sketch__section" }, h("calcite-action", { disabled: this._undoStack.length === 0, icon: "undo", onClick: () => this._undo(), scale: "s", text: this._translations.undo }), h("calcite-action", { disabled: this._redoStack.length === 0, icon: "redo", onClick: () => this._redo(), scale: "s", text: this._translations.redo }))))))));
|
136
|
+
}
|
137
|
+
//--------------------------------------------------------------------------
|
138
|
+
//
|
139
|
+
// Functions (protected)
|
140
|
+
//
|
141
|
+
//--------------------------------------------------------------------------
|
142
|
+
/**
|
143
|
+
* Load esri javascript api modules
|
144
|
+
*
|
145
|
+
* @returns Promise resolving when function is done
|
146
|
+
*
|
147
|
+
* @protected
|
148
|
+
*/
|
149
|
+
async _initModules() {
|
150
|
+
const [GraphicsLayer, SketchViewModel] = await loadModules([
|
151
|
+
"esri/layers/GraphicsLayer",
|
152
|
+
"esri/widgets/Sketch/SketchViewModel"
|
153
|
+
]);
|
154
|
+
this.GraphicsLayer = GraphicsLayer;
|
155
|
+
this.SketchViewModel = SketchViewModel;
|
156
|
+
}
|
157
|
+
/**
|
158
|
+
* Initialize the graphics layer and skecth view model
|
159
|
+
*
|
160
|
+
* @returns Promise when the operation has completed
|
161
|
+
* @protected
|
162
|
+
*/
|
163
|
+
_init() {
|
164
|
+
this._initGraphicsLayer();
|
165
|
+
this._initSketchViewModel();
|
166
|
+
}
|
167
|
+
/**
|
168
|
+
* Initialize the skecth view model
|
169
|
+
*
|
170
|
+
* @returns Promise when the operation has completed
|
171
|
+
* @protected
|
172
|
+
*/
|
173
|
+
_initSketchViewModel() {
|
174
|
+
this._sketchViewModel = new this.SketchViewModel({
|
175
|
+
layer: this._sketchGraphicsLayer,
|
176
|
+
defaultUpdateOptions: {
|
177
|
+
tool: "reshape",
|
178
|
+
toggleToolOnClick: false
|
179
|
+
},
|
180
|
+
view: this.mapView
|
181
|
+
});
|
182
|
+
this._sketchViewModel.on("create", (event) => {
|
183
|
+
if (event.state === "complete" && this.active) {
|
184
|
+
this._featuresCollection = {};
|
185
|
+
this._sketchGeometry = event.graphic.geometry;
|
186
|
+
void this._selectFeatures(this._sketchGeometry);
|
187
|
+
}
|
188
|
+
});
|
189
|
+
}
|
190
|
+
/**
|
191
|
+
* Clear any skecth graphics
|
192
|
+
*
|
193
|
+
* @returns Promise when the operation has completed
|
194
|
+
* @protected
|
195
|
+
*/
|
196
|
+
_clear() {
|
197
|
+
this._sketchGeometry = null;
|
198
|
+
this._sketchViewModel.cancel();
|
199
|
+
this._sketchGraphicsLayer.removeAll();
|
200
|
+
}
|
201
|
+
/**
|
202
|
+
* Initialize the graphics layer
|
203
|
+
*
|
204
|
+
* @returns Promise when the operation has completed
|
205
|
+
* @protected
|
206
|
+
*/
|
207
|
+
_initGraphicsLayer() {
|
208
|
+
const title = this._translations.sketchLayer;
|
209
|
+
const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === title);
|
210
|
+
if (sketchIndex > -1) {
|
211
|
+
this._sketchGraphicsLayer = this.mapView.map.layers.getItemAt(sketchIndex);
|
212
|
+
}
|
213
|
+
else {
|
214
|
+
this._sketchGraphicsLayer = new this.GraphicsLayer({ title });
|
215
|
+
state.managedLayers.push(title);
|
216
|
+
this.mapView.map.layers.add(this._sketchGraphicsLayer);
|
217
|
+
}
|
218
|
+
if (this.graphics && this.graphics.length > 0) {
|
219
|
+
this._sketchGraphicsLayer.addMany(this.graphics);
|
220
|
+
}
|
221
|
+
}
|
222
|
+
/**
|
223
|
+
* Clear selection based on map click
|
224
|
+
*
|
225
|
+
* @protected
|
226
|
+
*/
|
227
|
+
_initHitTest() {
|
228
|
+
if (this._hitTestHandle) {
|
229
|
+
this._hitTestHandle.remove();
|
230
|
+
}
|
231
|
+
this._hitTestHandle = this.mapView.on("click", (event) => {
|
232
|
+
event.stopPropagation();
|
233
|
+
const opts = {
|
234
|
+
include: this.layerViews.map(lv => lv.layer)
|
235
|
+
};
|
236
|
+
void this.mapView.hitTest(event, opts).then((response) => {
|
237
|
+
let graphics = [];
|
238
|
+
if (response.results.length > 0) {
|
239
|
+
graphics = response.results.reduce((prev, cur) => {
|
240
|
+
const g = cur === null || cur === void 0 ? void 0 : cur.graphic;
|
241
|
+
if (g) {
|
242
|
+
prev.push(g);
|
243
|
+
}
|
244
|
+
return prev;
|
245
|
+
}, []);
|
246
|
+
}
|
247
|
+
this.refineSelectionGraphicsChange.emit(graphics);
|
248
|
+
this._clear();
|
249
|
+
});
|
250
|
+
});
|
251
|
+
}
|
252
|
+
/**
|
253
|
+
* Gets the layer views from the map when the layer selection changes
|
254
|
+
*
|
255
|
+
* @returns Promise resolving when function is done
|
256
|
+
*
|
257
|
+
* @protected
|
258
|
+
*/
|
259
|
+
async _layerSelectionChange(evt) {
|
260
|
+
if (Array.isArray(evt.detail) && evt.detail.length > 0) {
|
261
|
+
this._selectEnabled = true;
|
262
|
+
const layerPromises = evt.detail.map(title => {
|
263
|
+
return getMapLayerView(this.mapView, title);
|
264
|
+
});
|
265
|
+
return Promise.all(layerPromises).then((layerViews) => {
|
266
|
+
this.layerViews = layerViews;
|
267
|
+
});
|
268
|
+
}
|
269
|
+
else {
|
270
|
+
this._selectEnabled = false;
|
271
|
+
}
|
272
|
+
}
|
273
|
+
/**
|
274
|
+
* Store the current selection mode
|
275
|
+
*
|
276
|
+
* @protected
|
277
|
+
*/
|
278
|
+
_setSelectionMode(mode) {
|
279
|
+
this._selectionMode = mode;
|
280
|
+
if (this._hitTestHandle) {
|
281
|
+
this._hitTestHandle.remove();
|
282
|
+
}
|
283
|
+
switch (this._selectionMode) {
|
284
|
+
case ESelectionType.POINT:
|
285
|
+
this._sketchViewModel.create("point");
|
286
|
+
//this._initHitTest();
|
287
|
+
break;
|
288
|
+
case ESelectionType.LINE:
|
289
|
+
this._sketchViewModel.create("polyline");
|
290
|
+
break;
|
291
|
+
case ESelectionType.POLY:
|
292
|
+
this._sketchViewModel.create("polygon");
|
293
|
+
break;
|
294
|
+
case ESelectionType.RECT:
|
295
|
+
this._sketchViewModel.create("rectangle");
|
296
|
+
break;
|
297
|
+
}
|
298
|
+
}
|
299
|
+
/**
|
300
|
+
* Select features based on the input geometry
|
301
|
+
*
|
302
|
+
* @param geom the geometry used for selection
|
303
|
+
*
|
304
|
+
* @returns Promise resolving when function is done
|
305
|
+
*
|
306
|
+
* @protected
|
307
|
+
*/
|
308
|
+
async _selectFeatures(geom) {
|
309
|
+
const queryFeaturePromises = this.layerViews.map(layerView => {
|
310
|
+
this._featuresCollection[layerView.layer.title] = [];
|
311
|
+
return queryFeaturesByGeometry(0, layerView.layer, geom, this._featuresCollection);
|
312
|
+
});
|
313
|
+
return Promise.all(queryFeaturePromises).then(async (response) => {
|
314
|
+
let graphics = [];
|
315
|
+
response.forEach(r => {
|
316
|
+
Object.keys(r).forEach(k => {
|
317
|
+
graphics = graphics.concat(r[k]);
|
318
|
+
});
|
319
|
+
});
|
320
|
+
if (this.refineMode === ERefineMode.SUBSET) {
|
321
|
+
this.refineSelectionGraphicsChange.emit(graphics);
|
322
|
+
}
|
323
|
+
else {
|
324
|
+
const oids = Array.isArray(graphics) ? graphics.map(g => { var _a; return g.attributes[(_a = g === null || g === void 0 ? void 0 : g.layer) === null || _a === void 0 ? void 0 : _a.objectIdField]; }) : [];
|
325
|
+
await this._updateIds(oids, this.mode, this._undoStack, this.mode);
|
326
|
+
}
|
327
|
+
this._clear();
|
328
|
+
});
|
329
|
+
}
|
330
|
+
/**
|
331
|
+
* Highlight any selected features in the map
|
332
|
+
*
|
333
|
+
* @returns Promise resolving when function is done
|
334
|
+
* @protected
|
335
|
+
*/
|
336
|
+
async _highlightFeatures(ids, updateExtent = false) {
|
337
|
+
this._clearHighlight();
|
338
|
+
if (ids.length > 0) {
|
339
|
+
state.highlightHandle = await highlightFeatures(ids, this.layerViews[0], this.mapView, updateExtent);
|
340
|
+
}
|
341
|
+
}
|
342
|
+
/**
|
343
|
+
* Clear any highlighted features in the map
|
344
|
+
*
|
345
|
+
* @protected
|
346
|
+
*/
|
347
|
+
_clearHighlight() {
|
348
|
+
var _a;
|
349
|
+
(_a = state.highlightHandle) === null || _a === void 0 ? void 0 : _a.remove();
|
350
|
+
}
|
351
|
+
/**
|
352
|
+
* Update the ids for any ADD or REMOVE operation and highlight the features.
|
353
|
+
*
|
354
|
+
* @param oids the ids to add or remove
|
355
|
+
* @param mode ADD or REMOVE this will control if the ids are added or removed
|
356
|
+
* @param operationStack the undo or redo stack to push the operation to
|
357
|
+
* @param operationMode ADD or REMOVE the mode of the individual refine operation
|
358
|
+
*
|
359
|
+
* @returns Promise resolving when function is done
|
360
|
+
*
|
361
|
+
* @protected
|
362
|
+
*/
|
363
|
+
async _updateIds(oids, mode, operationStack, operationMode) {
|
364
|
+
const idUpdates = { addIds: [], removeIds: [] };
|
365
|
+
if (mode === ESelectionMode.ADD) {
|
366
|
+
idUpdates.addIds = oids.filter(id => this.ids.indexOf(id) < 0);
|
367
|
+
this.ids = [...this.ids, ...idUpdates.addIds];
|
368
|
+
operationStack.push({ mode: operationMode, ids: idUpdates.addIds });
|
369
|
+
}
|
370
|
+
else {
|
371
|
+
idUpdates.removeIds = oids.filter(id => this.ids.indexOf(id) > -1);
|
372
|
+
this.ids = this.ids.filter(id => idUpdates.removeIds.indexOf(id) < 0);
|
373
|
+
operationStack.push({ mode: operationMode, ids: idUpdates.removeIds });
|
374
|
+
}
|
375
|
+
await this._highlightFeatures(this.ids).then(() => {
|
376
|
+
this.refineSelectionIdsChange.emit(idUpdates);
|
377
|
+
});
|
378
|
+
}
|
379
|
+
/**
|
380
|
+
* Undo the most current ADD or REMOVE operation
|
381
|
+
*
|
382
|
+
* @returns Promise resolving when function is done
|
383
|
+
*
|
384
|
+
* @protected
|
385
|
+
*/
|
386
|
+
_undo() {
|
387
|
+
const undoOp = this._undoStack.pop();
|
388
|
+
void this._updateIds(undoOp.ids, undoOp.mode === ESelectionMode.ADD ? ESelectionMode.REMOVE : ESelectionMode.ADD, this._redoStack, undoOp.mode);
|
389
|
+
}
|
390
|
+
/**
|
391
|
+
* Redo the most current ADD or REMOVE operation
|
392
|
+
*
|
393
|
+
* @returns Promise resolving when function is done
|
394
|
+
*
|
395
|
+
* @protected
|
396
|
+
*/
|
397
|
+
_redo() {
|
398
|
+
const redoOp = this._redoStack.pop();
|
399
|
+
void this._updateIds(redoOp.ids, redoOp.mode, this._undoStack, redoOp.mode);
|
400
|
+
}
|
401
|
+
/**
|
402
|
+
* Fetches the component's translations
|
403
|
+
*
|
404
|
+
* @protected
|
405
|
+
*/
|
406
|
+
async _getTranslations() {
|
407
|
+
const translations = await getLocaleComponentStrings(this.el);
|
408
|
+
this._translations = translations[0];
|
409
|
+
}
|
410
|
+
get el() { return this; }
|
411
|
+
static get watchers() { return {
|
412
|
+
"ids": ["idsWatchHandler"]
|
413
|
+
}; }
|
414
|
+
static get style() { return refineSelectionToolsCss; }
|
415
|
+
}, [1, "refine-selection-tools", {
|
416
|
+
"active": [4],
|
417
|
+
"border": [4],
|
418
|
+
"graphics": [1040],
|
419
|
+
"ids": [16],
|
420
|
+
"layerView": [16],
|
421
|
+
"layerViews": [16],
|
422
|
+
"mapView": [16],
|
423
|
+
"mode": [1],
|
424
|
+
"refineMode": [1, "refine-mode"],
|
425
|
+
"useLayerPicker": [4, "use-layer-picker"],
|
426
|
+
"_selectEnabled": [32],
|
427
|
+
"_selectionMode": [32],
|
428
|
+
"_translations": [32],
|
429
|
+
"reset": [64],
|
430
|
+
"clearHighlight": [64]
|
431
|
+
}]);
|
432
|
+
function defineCustomElement() {
|
433
|
+
if (typeof customElements === "undefined") {
|
434
|
+
return;
|
435
|
+
}
|
436
|
+
const components = ["refine-selection-tools", "calcite-action", "calcite-chip", "calcite-combobox", "calcite-combobox-item", "calcite-icon", "calcite-loader", "calcite-option", "calcite-select", "map-layer-picker"];
|
437
|
+
components.forEach(tagName => { switch (tagName) {
|
438
|
+
case "refine-selection-tools":
|
439
|
+
if (!customElements.get(tagName)) {
|
440
|
+
customElements.define(tagName, RefineSelectionTools);
|
441
|
+
}
|
442
|
+
break;
|
443
|
+
case "calcite-action":
|
444
|
+
if (!customElements.get(tagName)) {
|
445
|
+
defineCustomElement$9();
|
446
|
+
}
|
447
|
+
break;
|
448
|
+
case "calcite-chip":
|
449
|
+
if (!customElements.get(tagName)) {
|
450
|
+
defineCustomElement$8();
|
451
|
+
}
|
452
|
+
break;
|
453
|
+
case "calcite-combobox":
|
454
|
+
if (!customElements.get(tagName)) {
|
455
|
+
defineCustomElement$7();
|
456
|
+
}
|
457
|
+
break;
|
458
|
+
case "calcite-combobox-item":
|
459
|
+
if (!customElements.get(tagName)) {
|
460
|
+
defineCustomElement$6();
|
461
|
+
}
|
462
|
+
break;
|
463
|
+
case "calcite-icon":
|
464
|
+
if (!customElements.get(tagName)) {
|
465
|
+
defineCustomElement$5();
|
466
|
+
}
|
467
|
+
break;
|
468
|
+
case "calcite-loader":
|
469
|
+
if (!customElements.get(tagName)) {
|
470
|
+
defineCustomElement$4();
|
471
|
+
}
|
472
|
+
break;
|
473
|
+
case "calcite-option":
|
474
|
+
if (!customElements.get(tagName)) {
|
475
|
+
defineCustomElement$3();
|
476
|
+
}
|
477
|
+
break;
|
478
|
+
case "calcite-select":
|
479
|
+
if (!customElements.get(tagName)) {
|
480
|
+
defineCustomElement$2();
|
481
|
+
}
|
482
|
+
break;
|
483
|
+
case "map-layer-picker":
|
484
|
+
if (!customElements.get(tagName)) {
|
485
|
+
defineCustomElement$1();
|
486
|
+
}
|
487
|
+
break;
|
488
|
+
} });
|
489
|
+
}
|
490
|
+
defineCustomElement();
|
491
|
+
|
492
|
+
export { RefineSelectionTools as R, defineCustomElement as d };
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
2
|
+
|
3
|
+
interface RefineSelection extends Components.RefineSelection, HTMLElement {}
|
4
|
+
export const RefineSelection: {
|
5
|
+
prototype: RefineSelection;
|
6
|
+
new (): RefineSelection;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* Used to define this component and all nested components recursively.
|
10
|
+
*/
|
11
|
+
export const defineCustomElement: () => void;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import { R as RefineSelection$1, d as defineCustomElement$1 } from './refine-selection2.js';
|
7
|
+
|
8
|
+
const RefineSelection = RefineSelection$1;
|
9
|
+
const defineCustomElement = defineCustomElement$1;
|
10
|
+
|
11
|
+
export { RefineSelection, defineCustomElement };
|