@esri/solutions-components 0.10.6 → 0.10.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/basemap-gallery_7.cjs.entry.js +24 -8
- package/dist/cjs/buffer-tools_3.cjs.entry.js +1 -1
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +354 -967
- package/dist/cjs/calcite-graph_2.cjs.entry.js +1082 -0
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +6 -6
- package/dist/cjs/calcite-tree_3.cjs.entry.js +1 -1
- package/dist/cjs/card-manager_3.cjs.entry.js +246 -18
- package/dist/cjs/crowdsource-manager.cjs.entry.js +169 -49
- package/dist/cjs/instant-apps-control-panel.cjs.entry.js +2 -1
- package/dist/cjs/instant-apps-time-filter.cjs.entry.js +40 -21
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +3 -3
- package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +1 -1
- package/dist/cjs/refine-results-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/share-item.cjs.entry.js +1 -1
- package/dist/cjs/solution-configuration.cjs.entry.js +3 -3
- package/dist/cjs/solution-contents_3.cjs.entry.js +3 -3
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/cjs/spatial-ref.cjs.entry.js +1 -1
- package/dist/collection/assets/t9n/crowdsource-manager/resources.json +5 -1
- package/dist/collection/assets/t9n/crowdsource-manager/resources_en.json +5 -1
- package/dist/collection/assets/t9n/layer-table/resources.json +1 -0
- package/dist/collection/assets/t9n/layer-table/resources_en.json +1 -0
- package/dist/collection/assets/t9n/map-card/resources.json +6 -1
- package/dist/collection/assets/t9n/map-card/resources_en.json +6 -1
- package/dist/collection/components/card-manager/card-manager.js +34 -8
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +173 -65
- package/dist/collection/components/layer-table/layer-table.js +175 -8
- package/dist/collection/components/map-card/map-card.css +4 -0
- package/dist/collection/components/map-card/map-card.js +368 -3
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
- package/dist/collection/components/map-fullscreen/map-fullscreen.js +1 -1
- package/dist/collection/components/map-layer-picker/map-layer-picker.js +9 -3
- package/dist/collection/components/map-legend/map-legend.js +1 -1
- package/dist/collection/components/map-picker/map-picker.css +8 -0
- package/dist/collection/components/map-picker/map-picker.js +74 -3
- package/dist/collection/components/map-search/map-search.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
- package/dist/collection/components/map-tools/map-tools.js +1 -1
- package/dist/collection/components/pci-calculator/pci-calculator.js +1 -1
- package/dist/collection/components/pdf-download/pdf-download.js +1 -1
- package/dist/collection/components/public-notification/public-notification.js +1 -1
- package/dist/collection/components/refine-results-flow-item/refine-results-flow-item.js +1 -1
- package/dist/collection/components/refine-selection/refine-selection.js +1 -1
- package/dist/collection/components/share-item/share-item.js +1 -1
- package/dist/collection/components/solution-configuration/solution-configuration.js +3 -3
- package/dist/collection/components/solution-contents/solution-contents.js +1 -1
- package/dist/collection/components/solution-item/solution-item.js +1 -1
- package/dist/collection/components/solution-item-details/solution-item-details.js +1 -1
- package/dist/collection/components/solution-item-icon/solution-item-icon.js +1 -1
- package/dist/collection/components/solution-item-sharing/solution-item-sharing.js +1 -1
- package/dist/collection/components/solution-organization-variables/solution-organization-variables.js +1 -1
- package/dist/collection/components/solution-resource-item/solution-resource-item.js +1 -1
- package/dist/collection/components/solution-spatial-ref/solution-spatial-ref.js +1 -1
- package/dist/collection/components/solution-template-data/solution-template-data.js +1 -1
- package/dist/collection/components/solution-variables/solution-variables.js +1 -1
- package/dist/collection/components/spatial-ref/spatial-ref.js +1 -1
- package/dist/collection/demos/crowdsource-manager.html +1 -0
- package/dist/components/card-manager2.js +20 -8
- package/dist/components/crowdsource-manager.js +172 -53
- package/dist/components/instant-apps-control-panel.js +2 -1
- package/dist/components/instant-apps-time-filter.js +46 -23
- package/dist/components/layer-table2.js +72 -10
- package/dist/components/map-card2.js +288 -47
- package/dist/components/map-draw-tools2.js +1 -1
- package/dist/components/map-fullscreen2.js +1 -1
- package/dist/components/map-layer-picker2.js +9 -3
- package/dist/components/map-legend2.js +1 -1
- package/dist/components/map-picker2.js +24 -5
- package/dist/components/map-search2.js +1 -1
- package/dist/components/map-select-tools2.js +1 -1
- package/dist/components/map-tools2.js +1 -1
- package/dist/components/pci-calculator.js +1 -1
- package/dist/components/pdf-download2.js +1 -1
- package/dist/components/public-notification.js +1 -1
- package/dist/components/refine-results-flow-item.js +1 -1
- package/dist/components/refine-selection2.js +1 -1
- package/dist/components/share-item.js +1 -1
- package/dist/components/solution-configuration.js +3 -3
- package/dist/components/solution-contents2.js +1 -1
- package/dist/components/solution-item-details2.js +1 -1
- package/dist/components/solution-item-icon2.js +1 -1
- package/dist/components/solution-item-sharing2.js +1 -1
- package/dist/components/solution-item2.js +1 -1
- package/dist/components/solution-organization-variables2.js +1 -1
- package/dist/components/solution-resource-item2.js +1 -1
- package/dist/components/solution-spatial-ref2.js +1 -1
- package/dist/components/solution-template-data2.js +1 -1
- package/dist/components/solution-variables2.js +1 -1
- package/dist/components/spatial-ref.js +1 -1
- package/dist/esm/basemap-gallery_7.entry.js +24 -8
- package/dist/esm/buffer-tools_3.entry.js +1 -1
- package/dist/esm/calcite-combobox_3.entry.js +369 -982
- package/dist/esm/calcite-graph_2.entry.js +1077 -0
- package/dist/esm/calcite-shell-panel_14.entry.js +6 -6
- package/dist/esm/calcite-tree_3.entry.js +1 -1
- package/dist/esm/card-manager_3.entry.js +248 -20
- package/dist/esm/crowdsource-manager.entry.js +170 -50
- package/dist/esm/instant-apps-control-panel.entry.js +2 -1
- package/dist/esm/instant-apps-time-filter.entry.js +41 -22
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +3 -3
- package/dist/esm/pci-calculator.entry.js +1 -1
- package/dist/esm/public-notification.entry.js +1 -1
- package/dist/esm/refine-results-flow-item.entry.js +1 -1
- package/dist/esm/share-item.entry.js +1 -1
- package/dist/esm/solution-configuration.entry.js +3 -3
- package/dist/esm/solution-contents_3.entry.js +3 -3
- package/dist/esm/solutions-components.js +1 -1
- package/dist/esm/spatial-ref.entry.js +1 -1
- package/dist/solutions-components/assets/t9n/crowdsource-manager/resources.json +5 -1
- package/dist/solutions-components/assets/t9n/crowdsource-manager/resources_en.json +5 -1
- package/dist/solutions-components/assets/t9n/layer-table/resources.json +1 -0
- package/dist/solutions-components/assets/t9n/layer-table/resources_en.json +1 -0
- package/dist/solutions-components/assets/t9n/map-card/resources.json +6 -1
- package/dist/solutions-components/assets/t9n/map-card/resources_en.json +6 -1
- package/dist/solutions-components/demos/crowdsource-manager.html +1 -0
- package/dist/solutions-components/p-0abc1354.entry.js +6 -0
- package/dist/solutions-components/p-0f7b5d36.entry.js +6 -0
- package/dist/solutions-components/p-1867168b.entry.js +6 -0
- package/dist/solutions-components/{p-a9818be2.entry.js → p-20c465e9.entry.js} +1 -1
- package/dist/solutions-components/{p-db18bce8.entry.js → p-36b50b5b.entry.js} +1 -1
- package/dist/solutions-components/{p-85512ae3.entry.js → p-445213cf.entry.js} +1 -1
- package/dist/solutions-components/{p-d49f895d.entry.js → p-4a5f0a97.entry.js} +1 -1
- package/dist/solutions-components/{p-002c97df.entry.js → p-5d201016.entry.js} +1 -1
- package/dist/solutions-components/{p-b7cec3bd.entry.js → p-618bafec.entry.js} +1 -1
- package/dist/solutions-components/p-6a66d5a9.entry.js +6 -0
- package/dist/solutions-components/p-71a2d5b8.entry.js +6 -0
- package/dist/solutions-components/p-7a64b026.entry.js +17 -0
- package/dist/solutions-components/p-85c25564.entry.js +6 -0
- package/dist/solutions-components/{p-235bf02e.entry.js → p-913413c3.entry.js} +1 -1
- package/dist/solutions-components/p-9af1cb14.entry.js +6 -0
- package/dist/solutions-components/{p-49aa2929.entry.js → p-bebd4646.entry.js} +1 -1
- package/dist/solutions-components/{p-ab2adcaf.entry.js → p-cc092b22.entry.js} +1 -1
- package/dist/solutions-components/p-ce454f5a.entry.js +11 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/types/components/card-manager/card-manager.d.ts +11 -0
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +86 -20
- package/dist/types/components/layer-table/layer-table.d.ts +30 -0
- package/dist/types/components/map-card/map-card.d.ts +124 -0
- package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +4 -0
- package/dist/types/components/map-picker/map-picker.d.ts +12 -0
- package/dist/types/components.d.ts +130 -0
- package/dist/types/preact.d.ts +4 -2
- package/package.json +2 -2
- package/dist/cjs/calcite-dropdown-group_2.cjs.entry.js +0 -453
- package/dist/esm/calcite-dropdown-group_2.entry.js +0 -448
- package/dist/solutions-components/p-129fd80e.entry.js +0 -6
- package/dist/solutions-components/p-3b426576.entry.js +0 -6
- package/dist/solutions-components/p-72b217f2.entry.js +0 -6
- package/dist/solutions-components/p-72f01088.entry.js +0 -6
- package/dist/solutions-components/p-8b999a2b.entry.js +0 -6
- package/dist/solutions-components/p-973ff7b2.entry.js +0 -23
- package/dist/solutions-components/p-a001f9c9.entry.js +0 -6
- package/dist/solutions-components/p-c683b3fe.entry.js +0 -6
- package/dist/solutions-components/p-e9d049bd.entry.js +0 -6
@@ -3,39 +3,46 @@
|
|
3
3
|
* Licensed under the Apache License, Version 2.0
|
4
4
|
* http://www.apache.org/licenses/LICENSE-2.0
|
5
5
|
*/
|
6
|
-
import { h, r as registerInstance, c as createEvent, H as Host, g as getElement
|
6
|
+
import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-e3f04fa1.js';
|
7
7
|
import { d as calciteSize48 } from './core-6a3c13ac.js';
|
8
8
|
import { f as filter, e as escapeRegExp } from './filter-4fc9cd19.js';
|
9
|
-
import { D as getElementWidth, E as getTextWidth, t as toAriaBoolean
|
9
|
+
import { D as getElementWidth, E as getTextWidth, t as toAriaBoolean } from './dom-982585e7.js';
|
10
10
|
import { d as defaultMenuPlacement, f as filterValidFlipPlacements, c as connectFloatingUI, r as reposition, a as disconnectFloatingUI, F as FloatingCSS } from './floating-ui-28a86be6.js';
|
11
11
|
import { s as submitForm, c as connectForm, a as afterConnectDefaultValueSet, d as disconnectForm, H as HiddenFormInputSlot } from './form-9827fc54.js';
|
12
12
|
import { g as guid } from './guid-5c959cfd.js';
|
13
13
|
import { c as connectInteractive, u as updateHostInteraction, d as disconnectInteractive, I as InteractiveContainer } from './interactive-1d03c7ff.js';
|
14
14
|
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from './label-38802319.js';
|
15
15
|
import { b as componentLoaded, c as componentFocusable, s as setUpLoadableComponent, a as setComponentLoaded } from './loadable-869378d9.js';
|
16
|
-
import { c as connectLocalized, d as disconnectLocalized
|
16
|
+
import { c as connectLocalized, d as disconnectLocalized } from './locale-53748f98.js';
|
17
17
|
import { c as createObserver } from './observers-0f4a5f9e.js';
|
18
18
|
import { o as onToggleOpenCloseComponent } from './openCloseComponent-f118bfc5.js';
|
19
19
|
import { D as DEBOUNCE } from './resources-3bc82696.js';
|
20
20
|
import { c as connectMessages, s as setUpMessages, d as disconnectMessages, u as updateMessages } from './t9n-5371b7ab.js';
|
21
21
|
import { g as getIconScale, c as componentOnReady } from './component-e3f05da5.js';
|
22
22
|
import { V as Validation } from './Validation-8ddc15e3.js';
|
23
|
-
import { i as isSingleLike, h as hasActiveChildren, C as CSS$
|
23
|
+
import { i as isSingleLike, h as hasActiveChildren, C as CSS$1, b as ComboboxChildSelector, c as getLabel, d as getItemAncestors, e as getItemChildren, f as ComboboxItem, j as ComboboxItemGroup } from './utils-ac0f19ea.js';
|
24
24
|
import { d as debounce } from './debounce-6e9ade8c.js';
|
25
|
-
import {
|
26
|
-
import {
|
25
|
+
import { C as CSS$2 } from './resources-27689859.js';
|
26
|
+
import { g as getLocaleComponentStrings } from './locale-7162b55a.js';
|
27
|
+
import { g as getLayerOrTable, d as getMapLayerHash, p as getMapTableHash } from './mapViewUtils-3e3d33ea.js';
|
28
|
+
import { s as state } from './publicNotificationStore-065c7136.js';
|
27
29
|
import './browser-8c71dd57.js';
|
30
|
+
import './key-7f394a98.js';
|
31
|
+
import './esri-loader-c6842c6b.js';
|
32
|
+
import './_commonjsHelpers-089957fe.js';
|
33
|
+
import './interfaces-659e3836.js';
|
34
|
+
import './index-1dc14abf.js';
|
28
35
|
|
29
36
|
/*!
|
30
37
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
31
38
|
* See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
32
39
|
* v2.11.1
|
33
40
|
*/
|
34
|
-
const CSS
|
41
|
+
const CSS = {
|
35
42
|
button: "x-button",
|
36
43
|
};
|
37
44
|
function XButton({ disabled, key, label, onClick, ref, scale, }) {
|
38
|
-
return (h("button", { "aria-label": label, class: CSS
|
45
|
+
return (h("button", { "aria-label": label, class: CSS.button, disabled: disabled, key: key, onClick: onClick, ref: ref, tabIndex: -1, type: "button" }, h("calcite-icon", { icon: "x", scale: getIconScale(scale) })));
|
39
46
|
}
|
40
47
|
|
41
48
|
const comboboxCss = ":host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:block}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}:host([scale=s]) .x-button{inline-size:1rem;block-size:1rem}:host([scale=m]) .x-button{inline-size:1.5rem;block-size:1.5rem}:host([scale=l]) .x-button{inline-size:2rem;block-size:2rem}.x-button{margin:0px;display:flex;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;align-content:center;align-items:center;justify-content:center;align-self:center;border-width:2px;background-color:transparent;color:var(--calcite-color-text-3);outline-color:transparent;transition:background-color, block-size, border-color, box-shadow, color, inset-block-end, inset-block-start, inset-inline-end, inset-inline-start inset-size, opacity, outline-color, transform var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-radius:50%;border-color:transparent;background-color:var(--calcite-color-foreground-2)}.x-button:active,.x-button:hover{color:var(--calcite-color-text-1);background-color:var(--calcite-color-foreground-3)}.x-button:active{border-style:solid;border-color:var(--calcite-color-brand)}.x-button calcite-icon{color:inherit}:host([scale=s]){font-size:var(--calcite-font-size--2);--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-input-height:1rem;--calcite-internal-combobox-input-margin-block:calc(0.25rem - 1px)}:host([scale=s]) .x-button{margin-inline:0.5rem}:host([scale=m]){font-size:var(--calcite-font-size--1);--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-input-height:1rem;--calcite-internal-combobox-input-margin-block:calc(0.5rem - 1px)}:host([scale=m]) .x-button{margin-inline-end:0.75rem}:host([scale=l]){font-size:var(--calcite-font-size-0);--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-input-height:1.5rem;--calcite-internal-combobox-input-margin-block:calc(0.625rem - 1px)}:host([scale=l]) .x-button{margin-inline-end:1rem}.wrapper{display:flex;border-width:1px;border-style:solid;border-color:var(--calcite-color-border-input);background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-1);outline-color:transparent;padding-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.wrapper:hover .icon{color:var(--calcite-color-text-1)}:host(:focus-within) .wrapper,.wrapper--active{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-color-brand));outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-offset-invert-focus),\n 1\n )\n )\n )}:host([read-only]) .wrapper{background-color:var(--calcite-color-background)}:host([read-only]) .label{font-weight:var(--calcite-font-weight-medium)}:host([status=invalid]) .wrapper{border-color:var(--calcite-color-status-danger)}:host([status=invalid]:focus-within) .wrapper{outline:2px solid var(--calcite-color-status-danger);outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-offset-invert-focus),\n 1\n )\n )\n )}.wrapper--single{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l);cursor:pointer;flex-wrap:nowrap}.grid-input{position:relative;display:flex;flex-grow:1;flex-wrap:wrap;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;gap:var(--calcite-combobox-item-spacing-unit-s);margin-inline-end:var(--calcite-combobox-item-spacing-unit-s)}.grid-input.selection-display-fit,.grid-input.selection-display-single{flex-wrap:nowrap;overflow:hidden}.input{flex-grow:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;overflow:hidden;text-overflow:ellipsis;border-style:none;background-color:transparent;padding:0px;font-family:inherit;color:var(--calcite-color-text-1);font-size:inherit;block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);inline-size:100%;margin-block-end:var(--calcite-combobox-item-spacing-unit-s);min-inline-size:4.8125rem}.input:focus{outline:2px solid transparent;outline-offset:2px}.input:-moz-placeholder-shown{text-overflow:ellipsis}.input:placeholder-shown{text-overflow:ellipsis}.input--single{padding:0px;margin-block:var(--calcite-internal-combobox-input-margin-block)}.wrapper--active .input-single{cursor:text}.input--hidden{pointer-events:none;inline-size:0px;min-inline-size:0px;opacity:0}.input--icon{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.input-wrap{display:flex;flex-grow:1;align-items:center}.input-wrap--single{flex:1 1 0%;overflow:hidden}.label{pointer-events:none;max-inline-size:100%;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;font-weight:var(--calcite-font-weight-normal);block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}.label--icon{padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.icon-end,.icon-start{display:flex;cursor:pointer;align-items:center}.icon-end{flex:none}.icon-end .icon{color:var(--calcite-color-text-3)}.floating-ui-container{--calcite-floating-ui-z-index:var(--calcite-z-index-dropdown);display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index);visibility:hidden}.floating-ui-container .calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-z-index);border-radius:0.25rem}.floating-ui-container[data-placement^=bottom] .calcite-floating-ui-anim{transform:translateY(-5px)}.floating-ui-container[data-placement^=top] .calcite-floating-ui-anim{transform:translateY(5px)}.floating-ui-container[data-placement^=left] .calcite-floating-ui-anim{transform:translateX(5px)}.floating-ui-container[data-placement^=right] .calcite-floating-ui-anim{transform:translateX(-5px)}.floating-ui-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}.floating-ui-container--active{visibility:visible}@media (forced-colors: active){.wrapper,.floating-ui-container--active{border:1px solid canvasText}}.screen-readers-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.list-container{max-block-size:45vh;overflow-y:auto;background-color:var(--calcite-color-foreground-1);inline-size:var(--calcite-dropdown-width)}.list{margin:0px;display:block;padding:0px}.list--hide{block-size:0px;overflow:hidden}calcite-chip{--calcite-animation-timing:0}.chip{margin-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);max-inline-size:100%}.chip--active{background-color:var(--calcite-color-foreground-3)}.chip--invisible{visibility:hidden;position:absolute}.item{display:block}.validation-container{display:flex;flex-direction:column;align-items:flex-start;align-self:stretch}:host([scale=m]) .validation-container,:host([scale=l]) .validation-container{padding-block-start:0.5rem}:host([scale=s]) .validation-container{padding-block-start:0.25rem}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}:host([hidden]){display:none}[hidden]{display:none}::slotted(calcite-combobox-item-group:not(:first-child)){padding-block-start:var(--calcite-combobox-item-spacing-unit-l)}";
|
@@ -256,7 +263,7 @@ const Combobox = class {
|
|
256
263
|
event.preventDefault();
|
257
264
|
return;
|
258
265
|
}
|
259
|
-
if (composedPath.some((node) => node.classList?.contains(CSS
|
266
|
+
if (composedPath.some((node) => node.classList?.contains(CSS.button))) {
|
260
267
|
this.clearValue();
|
261
268
|
event.preventDefault();
|
262
269
|
return;
|
@@ -693,10 +700,10 @@ const Combobox = class {
|
|
693
700
|
this.updateActiveItemIndex(targetIndex);
|
694
701
|
}
|
695
702
|
hideChip(chipEl) {
|
696
|
-
chipEl.classList.add(CSS$
|
703
|
+
chipEl.classList.add(CSS$1.chipInvisible);
|
697
704
|
}
|
698
705
|
showChip(chipEl) {
|
699
|
-
chipEl.classList.remove(CSS$
|
706
|
+
chipEl.classList.remove(CSS$1.chipInvisible);
|
700
707
|
}
|
701
708
|
refreshChipDisplay({ chipEls, availableHorizontalChipElSpace, chipContainerElGap, }) {
|
702
709
|
chipEls.forEach((chipEl) => {
|
@@ -724,7 +731,7 @@ const Combobox = class {
|
|
724
731
|
setVisibleAndHiddenChips(chipEls) {
|
725
732
|
let newSelectedVisibleChipsCount = 0;
|
726
733
|
chipEls.forEach((chipEl) => {
|
727
|
-
if (chipEl.selected && !chipEl.classList.contains(CSS$
|
734
|
+
if (chipEl.selected && !chipEl.classList.contains(CSS$1.chipInvisible)) {
|
728
735
|
newSelectedVisibleChipsCount++;
|
729
736
|
}
|
730
737
|
});
|
@@ -955,7 +962,7 @@ const Combobox = class {
|
|
955
962
|
const label = this.messages.allSelected;
|
956
963
|
return (h("calcite-chip", { class: {
|
957
964
|
chip: true,
|
958
|
-
[CSS$
|
965
|
+
[CSS$1.chipInvisible]: !(this.isAllSelected() &&
|
959
966
|
!selectedVisibleChipsCount &&
|
960
967
|
!compactSelectionDisplay),
|
961
968
|
}, ref: setAllSelectedIndicatorChipEl, scale: scale, title: label, value: "" }, label));
|
@@ -965,7 +972,7 @@ const Combobox = class {
|
|
965
972
|
const label = this.messages.all || "All";
|
966
973
|
return (h("calcite-chip", { class: {
|
967
974
|
chip: true,
|
968
|
-
[CSS$
|
975
|
+
[CSS$1.chipInvisible]: !(this.isAllSelected() &&
|
969
976
|
!selectedVisibleChipsCount &&
|
970
977
|
compactSelectionDisplay),
|
971
978
|
}, scale: scale, title: label, value: "" }, label));
|
@@ -1002,7 +1009,7 @@ const Combobox = class {
|
|
1002
1009
|
}
|
1003
1010
|
return (h("calcite-chip", { class: {
|
1004
1011
|
chip: true,
|
1005
|
-
[CSS$
|
1012
|
+
[CSS$1.chipInvisible]: chipInvisible,
|
1006
1013
|
}, ref: setSelectedIndicatorChipEl, scale: scale, title: label, value: "" }, label));
|
1007
1014
|
}
|
1008
1015
|
renderSelectedIndicatorChipCompact() {
|
@@ -1028,7 +1035,7 @@ const Combobox = class {
|
|
1028
1035
|
}
|
1029
1036
|
return (h("calcite-chip", { class: {
|
1030
1037
|
chip: true,
|
1031
|
-
[CSS$
|
1038
|
+
[CSS$1.chipInvisible]: chipInvisible,
|
1032
1039
|
}, scale: scale, title: label, value: "" }, label));
|
1033
1040
|
}
|
1034
1041
|
get showingInlineIcon() {
|
@@ -1052,7 +1059,7 @@ const Combobox = class {
|
|
1052
1059
|
label: true,
|
1053
1060
|
"label--icon": !!selectedItem?.icon,
|
1054
1061
|
}, key: "label" }, getLabel(selectedItem))), h("input", { "aria-activedescendant": this.activeDescendant, "aria-autocomplete": "list", "aria-controls": `${listboxUidPrefix}${guid}`, "aria-expanded": toAriaBoolean(open), "aria-haspopup": "listbox", "aria-label": getLabelText(this), "aria-owns": `${listboxUidPrefix}${guid}`, class: {
|
1055
|
-
[CSS$
|
1062
|
+
[CSS$1.input]: true,
|
1056
1063
|
"input--single": true,
|
1057
1064
|
"input--hidden": showLabel,
|
1058
1065
|
"input--icon": this.showingInlineIcon && !!this.placeholderIcon,
|
@@ -1064,7 +1071,7 @@ const Combobox = class {
|
|
1064
1071
|
renderFloatingUIContainer() {
|
1065
1072
|
const { setFloatingEl, setContainerEl, open } = this;
|
1066
1073
|
const classes = {
|
1067
|
-
[CSS$
|
1074
|
+
[CSS$1.listContainer]: true,
|
1068
1075
|
[FloatingCSS.animation]: true,
|
1069
1076
|
[FloatingCSS.animationActive]: open,
|
1070
1077
|
};
|
@@ -1081,7 +1088,7 @@ const Combobox = class {
|
|
1081
1088
|
}
|
1082
1089
|
renderChevronIcon() {
|
1083
1090
|
const { open } = this;
|
1084
|
-
return (h("span", { class: "icon-end", key: "chevron" }, h("calcite-icon", { class: CSS$
|
1091
|
+
return (h("span", { class: "icon-end", key: "chevron" }, h("calcite-icon", { class: CSS$1.icon, icon: open ? "chevron-up" : "chevron-down", scale: getIconScale(this.scale) })));
|
1085
1092
|
}
|
1086
1093
|
render() {
|
1087
1094
|
const { selectionDisplay, guid, label, open, readOnly } = this;
|
@@ -1096,8 +1103,8 @@ const Combobox = class {
|
|
1096
1103
|
"wrapper--active": open,
|
1097
1104
|
}, onClick: this.clickHandler, onKeyDown: this.keyDownHandler, ref: this.setReferenceEl }, this.renderSelectedOrPlaceholderIcon(), h("div", { class: {
|
1098
1105
|
"grid-input": true,
|
1099
|
-
[CSS$
|
1100
|
-
[CSS$
|
1106
|
+
[CSS$1.selectionDisplayFit]: fitSelectionDisplay,
|
1107
|
+
[CSS$1.selectionDisplaySingle]: singleSelectionDisplay,
|
1101
1108
|
}, key: "grid", ref: this.setChipContainerEl }, !singleSelectionMode && !singleSelectionDisplay && this.renderChips(), !singleSelectionMode &&
|
1102
1109
|
!allSelectionDisplay && [
|
1103
1110
|
this.renderSelectedIndicatorChip(),
|
@@ -1125,152 +1132,23 @@ const Combobox = class {
|
|
1125
1132
|
};
|
1126
1133
|
Combobox.style = CalciteComboboxStyle0;
|
1127
1134
|
|
1128
|
-
|
1129
|
-
|
1130
|
-
* See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
1131
|
-
* v2.11.1
|
1132
|
-
*/
|
1133
|
-
/**
|
1134
|
-
* Calculate slope of the tangents
|
1135
|
-
* uses Steffen interpolation as it's monotonic
|
1136
|
-
* http://jrwalsh1.github.io/posts/interpolations/
|
1137
|
-
*
|
1138
|
-
* @param p0
|
1139
|
-
* @param p1
|
1140
|
-
* @param p2
|
1141
|
-
*/
|
1142
|
-
function slope(p0, p1, p2) {
|
1143
|
-
const dx = p1[0] - p0[0];
|
1144
|
-
const dx1 = p2[0] - p1[0];
|
1145
|
-
const dy = p1[1] - p0[1];
|
1146
|
-
const dy1 = p2[1] - p1[1];
|
1147
|
-
const m = dy / (dx || (dx1 < 0 && 0));
|
1148
|
-
const m1 = dy1 / (dx1 || (dx < 0 && 0));
|
1149
|
-
const p = (m * dx1 + m1 * dx) / (dx + dx1);
|
1150
|
-
return (Math.sign(m) + Math.sign(m1)) * Math.min(Math.abs(m), Math.abs(m1), 0.5 * Math.abs(p)) || 0;
|
1151
|
-
}
|
1152
|
-
/**
|
1153
|
-
* Calculate slope for just one tangent (single-sided)
|
1154
|
-
*
|
1155
|
-
* @param p0
|
1156
|
-
* @param p1
|
1157
|
-
* @param m
|
1158
|
-
*/
|
1159
|
-
function slopeSingle(p0, p1, m) {
|
1160
|
-
const dx = p1[0] - p0[0];
|
1161
|
-
const dy = p1[1] - p0[1];
|
1162
|
-
return dx ? ((3 * dy) / dx - m) / 2 : m;
|
1163
|
-
}
|
1164
|
-
/**
|
1165
|
-
* Given two points and their tangent slopes,
|
1166
|
-
* calculate the bezier handle coordinates and return draw command.
|
1167
|
-
*
|
1168
|
-
* Translates Hermite Spline to Bézier curve:
|
1169
|
-
* https://stackoverflow.com/questions/42574940/
|
1170
|
-
*
|
1171
|
-
* @param p0
|
1172
|
-
* @param p1
|
1173
|
-
* @param m0
|
1174
|
-
* @param m1
|
1175
|
-
* @param t
|
1176
|
-
*/
|
1177
|
-
function bezier(p0, p1, m0, m1, t) {
|
1178
|
-
const [x0, y0] = p0;
|
1179
|
-
const [x1, y1] = p1;
|
1180
|
-
const dx = (x1 - x0) / 3;
|
1181
|
-
const h1 = t([x0 + dx, y0 + dx * m0]).join(",");
|
1182
|
-
const h2 = t([x1 - dx, y1 - dx * m1]).join(",");
|
1183
|
-
const p = t([x1, y1]).join(",");
|
1184
|
-
return `C ${h1} ${h2} ${p}`;
|
1185
|
-
}
|
1186
|
-
/**
|
1187
|
-
* Generate a function which will translate a point
|
1188
|
-
* from the data coordinate space to svg viewbox oriented pixels
|
1189
|
-
*
|
1190
|
-
* @param root0
|
1191
|
-
* @param root0.width
|
1192
|
-
* @param root0.height
|
1193
|
-
* @param root0.min
|
1194
|
-
* @param root0.max
|
1195
|
-
*/
|
1196
|
-
function translate({ width, height, min, max }) {
|
1197
|
-
const rangeX = max[0] - min[0];
|
1198
|
-
const rangeY = max[1] - min[1];
|
1199
|
-
return (point) => {
|
1200
|
-
const x = ((point[0] - min[0]) / rangeX) * width;
|
1201
|
-
const y = height - (point[1] / rangeY) * height;
|
1202
|
-
return [x, y];
|
1203
|
-
};
|
1204
|
-
}
|
1205
|
-
/**
|
1206
|
-
* Get the min and max values from the dataset
|
1207
|
-
*
|
1208
|
-
* @param data
|
1209
|
-
*/
|
1210
|
-
function range(data) {
|
1211
|
-
const [startX, startY] = data[0];
|
1212
|
-
const min = [startX, startY];
|
1213
|
-
const max = [startX, startY];
|
1214
|
-
return data.reduce(({ min, max }, [x, y]) => ({
|
1215
|
-
min: [Math.min(min[0], x), Math.min(min[1], y)],
|
1216
|
-
max: [Math.max(max[0], x), Math.max(max[1], y)],
|
1217
|
-
}), { min, max });
|
1218
|
-
}
|
1219
|
-
/**
|
1220
|
-
* Generate drawing commands for an area graph
|
1221
|
-
* returns a string can can be passed directly to a path element's `d` attribute
|
1222
|
-
*
|
1223
|
-
* @param root0
|
1224
|
-
* @param root0.data
|
1225
|
-
* @param root0.min
|
1226
|
-
* @param root0.max
|
1227
|
-
* @param root0.t
|
1228
|
-
*/
|
1229
|
-
function area({ data, min, max, t }) {
|
1230
|
-
if (data.length === 0) {
|
1231
|
-
return "";
|
1232
|
-
}
|
1233
|
-
// important points for beginning and ending the path
|
1234
|
-
const [startX, startY] = t(data[0]);
|
1235
|
-
const [minX, minY] = t(min);
|
1236
|
-
const [maxX] = t(max);
|
1237
|
-
// keep track of previous slope/points
|
1238
|
-
let m;
|
1239
|
-
let p0;
|
1240
|
-
let p1;
|
1241
|
-
// iterate over data points, calculating command for each
|
1242
|
-
const commands = data.reduce((acc, point, i) => {
|
1243
|
-
p0 = data[i - 2];
|
1244
|
-
p1 = data[i - 1];
|
1245
|
-
if (i > 1) {
|
1246
|
-
const m1 = slope(p0, p1, point);
|
1247
|
-
const m0 = m === undefined ? slopeSingle(p0, p1, m1) : m;
|
1248
|
-
const command = bezier(p0, p1, m0, m1, t);
|
1249
|
-
m = m1;
|
1250
|
-
return `${acc} ${command}`;
|
1251
|
-
}
|
1252
|
-
return acc;
|
1253
|
-
}, `M ${minX},${minY} L ${minX},${startY} L ${startX},${startY}`);
|
1254
|
-
// close the path
|
1255
|
-
const last = data[data.length - 1];
|
1256
|
-
const end = bezier(p1, last, m, slopeSingle(p1, last, m), t);
|
1257
|
-
return `${commands} ${end} L ${maxX},${minY} Z`;
|
1258
|
-
}
|
1135
|
+
const dropdownGroupCss = ":host{position:relative;display:block}.container{text-align:start}.dropdown-title{margin-block-end:-1px;display:block;cursor:default;overflow-wrap:break-word;border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-color-border-3);font-weight:var(--calcite-font-weight-bold);color:var(--calcite-color-text-2)}.dropdown-separator{display:block;block-size:1px;background-color:var(--calcite-color-border-3)}:host([scale=s]){font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=s]) .dropdown-title{padding:0.5rem}:host([scale=m]){font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=m]) .dropdown-title{padding:0.75rem}:host([scale=l]){font-size:var(--calcite-font-size-0);line-height:1.25rem}:host([scale=l]) .dropdown-title{padding:1rem}:host([hidden]){display:none}[hidden]{display:none}";
|
1136
|
+
const CalciteDropdownGroupStyle0 = dropdownGroupCss;
|
1259
1137
|
|
1260
|
-
const
|
1261
|
-
const CalciteGraphStyle0 = graphCss;
|
1262
|
-
|
1263
|
-
const Graph = class {
|
1138
|
+
const DropdownGroup = class {
|
1264
1139
|
constructor(hostRef) {
|
1265
1140
|
registerInstance(this, hostRef);
|
1266
|
-
this.
|
1267
|
-
this.
|
1268
|
-
|
1269
|
-
|
1270
|
-
this.
|
1271
|
-
this.
|
1272
|
-
this.
|
1273
|
-
this.
|
1141
|
+
this.calciteInternalDropdownItemChange = createEvent(this, "calciteInternalDropdownItemChange", 6);
|
1142
|
+
this.updateItems = () => {
|
1143
|
+
Array.from(this.el.querySelectorAll("calcite-dropdown-item")).forEach((item) => (item.selectionMode = this.selectionMode));
|
1144
|
+
};
|
1145
|
+
this.mutationObserver = createObserver("mutation", () => this.updateItems());
|
1146
|
+
this.groupTitle = undefined;
|
1147
|
+
this.scale = "m";
|
1148
|
+
this.selectionMode = "single";
|
1149
|
+
}
|
1150
|
+
handlePropsChange() {
|
1151
|
+
this.updateItems();
|
1274
1152
|
}
|
1275
1153
|
//--------------------------------------------------------------------------
|
1276
1154
|
//
|
@@ -1278,907 +1156,416 @@ const Graph = class {
|
|
1278
1156
|
//
|
1279
1157
|
//--------------------------------------------------------------------------
|
1280
1158
|
connectedCallback() {
|
1281
|
-
this.
|
1159
|
+
this.updateItems();
|
1160
|
+
this.mutationObserver?.observe(this.el, { childList: true });
|
1161
|
+
}
|
1162
|
+
componentWillLoad() {
|
1163
|
+
this.groupPosition = this.getGroupPosition();
|
1282
1164
|
}
|
1283
1165
|
disconnectedCallback() {
|
1284
|
-
this.
|
1166
|
+
this.mutationObserver?.disconnect();
|
1285
1167
|
}
|
1286
1168
|
render() {
|
1287
|
-
const
|
1288
|
-
const
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
return (h("svg", { "aria-hidden": "true", class: "svg", height: height, preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, width: width }));
|
1293
|
-
}
|
1294
|
-
const { min: rangeMin, max: rangeMax } = range(data);
|
1295
|
-
let currentMin = rangeMin;
|
1296
|
-
let currentMax = rangeMax;
|
1297
|
-
if (min < rangeMin[0] || min > rangeMin[0]) {
|
1298
|
-
currentMin = [min, 0];
|
1299
|
-
}
|
1300
|
-
if (max > rangeMax[0] || max < rangeMax[0]) {
|
1301
|
-
currentMax = [max, rangeMax[1]];
|
1302
|
-
}
|
1303
|
-
const t = translate({ min: currentMin, max: currentMax, width, height });
|
1304
|
-
const [hMinX] = t([highlightMin, currentMax[1]]);
|
1305
|
-
const [hMaxX] = t([highlightMax, currentMax[1]]);
|
1306
|
-
const areaPath = area({ data, min: rangeMin, max: rangeMax, t });
|
1307
|
-
const fill = colorStops ? `url(#linear-gradient-${id})` : undefined;
|
1308
|
-
return (h("svg", { "aria-hidden": "true", class: "svg", height: height, preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, width: width }, colorStops ? (h("defs", null, h("linearGradient", { id: `linear-gradient-${id}`, x1: "0", x2: "1", y1: "0", y2: "0" }, colorStops.map(({ offset, color, opacity }) => (h("stop", { offset: `${offset * 100}%`, "stop-color": color, "stop-opacity": opacity })))))) : null, highlightMin !== undefined ? ([
|
1309
|
-
h("mask", { height: "100%", id: `${id}1`, width: "100%", x: "0%", y: "0%" }, h("path", { d: `
|
1310
|
-
M 0,0
|
1311
|
-
L ${hMinX - 1},0
|
1312
|
-
L ${hMinX - 1},${height}
|
1313
|
-
L 0,${height}
|
1314
|
-
Z
|
1315
|
-
`, fill: "white" })),
|
1316
|
-
h("mask", { height: "100%", id: `${id}2`, width: "100%", x: "0%", y: "0%" }, h("path", { d: `
|
1317
|
-
M ${hMinX + 1},0
|
1318
|
-
L ${hMaxX - 1},0
|
1319
|
-
L ${hMaxX - 1},${height}
|
1320
|
-
L ${hMinX + 1}, ${height}
|
1321
|
-
Z
|
1322
|
-
`, fill: "white" })),
|
1323
|
-
h("mask", { height: "100%", id: `${id}3`, width: "100%", x: "0%", y: "0%" }, h("path", { d: `
|
1324
|
-
M ${hMaxX + 1},0
|
1325
|
-
L ${width},0
|
1326
|
-
L ${width},${height}
|
1327
|
-
L ${hMaxX + 1}, ${height}
|
1328
|
-
Z
|
1329
|
-
`, fill: "white" })),
|
1330
|
-
h("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}1)` }),
|
1331
|
-
h("path", { class: "graph-path--highlight", d: areaPath, fill: fill, mask: `url(#${id}2)` }),
|
1332
|
-
h("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}3)` }),
|
1333
|
-
]) : (h("path", { class: "graph-path", d: areaPath, fill: fill }))));
|
1169
|
+
const groupTitle = this.groupTitle ? (h("span", { "aria-hidden": "true", class: "dropdown-title" }, this.groupTitle)) : null;
|
1170
|
+
const dropdownSeparator = this.groupPosition > 0 ? h("div", { class: "dropdown-separator", role: "separator" }) : null;
|
1171
|
+
return (h(Host, { key: '1c189e8ff87a118d296781b729c889307c2b4a5b', "aria-label": this.groupTitle, role: "group" }, h("div", { key: '2afc3aee9c68b26af882168ce24cb2937a17c9e8', class: {
|
1172
|
+
[CSS$2.container]: true,
|
1173
|
+
} }, dropdownSeparator, groupTitle, h("slot", { key: '3fdcfab750b0541a4a24764f1a1875c867db06e8' }))));
|
1334
1174
|
}
|
1175
|
+
//--------------------------------------------------------------------------
|
1176
|
+
//
|
1177
|
+
// Event Listeners
|
1178
|
+
//
|
1179
|
+
//--------------------------------------------------------------------------
|
1180
|
+
updateActiveItemOnChange(event) {
|
1181
|
+
this.requestedDropdownGroup = event.detail.requestedDropdownGroup;
|
1182
|
+
this.requestedDropdownItem = event.detail.requestedDropdownItem;
|
1183
|
+
this.calciteInternalDropdownItemChange.emit({
|
1184
|
+
requestedDropdownGroup: this.requestedDropdownGroup,
|
1185
|
+
requestedDropdownItem: this.requestedDropdownItem,
|
1186
|
+
});
|
1187
|
+
}
|
1188
|
+
//--------------------------------------------------------------------------
|
1189
|
+
//
|
1190
|
+
// Private Methods
|
1191
|
+
//
|
1192
|
+
//--------------------------------------------------------------------------
|
1193
|
+
getGroupPosition() {
|
1194
|
+
return Array.prototype.indexOf.call(this.el.parentElement.querySelectorAll("calcite-dropdown-group"), this.el);
|
1195
|
+
}
|
1196
|
+
static get delegatesFocus() { return true; }
|
1335
1197
|
get el() { return getElement(this); }
|
1198
|
+
static get watchers() { return {
|
1199
|
+
"selectionMode": ["handlePropsChange"]
|
1200
|
+
}; }
|
1336
1201
|
};
|
1337
|
-
|
1338
|
-
|
1339
|
-
/*!
|
1340
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
1341
|
-
* See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
1342
|
-
* v2.11.1
|
1343
|
-
*/
|
1344
|
-
const CSS = {
|
1345
|
-
container: "container",
|
1346
|
-
containerRange: "container--range",
|
1347
|
-
graph: "graph",
|
1348
|
-
handle: "handle",
|
1349
|
-
handleExtension: "handle-extension",
|
1350
|
-
handleLabel: "handle__label",
|
1351
|
-
handleLabelMinValue: "handle__label--minValue",
|
1352
|
-
handleLabelValue: "handle__label--value",
|
1353
|
-
hyphen: "hyphen",
|
1354
|
-
hyphenWrap: "hyphen--wrap",
|
1355
|
-
static: "static",
|
1356
|
-
thumb: "thumb",
|
1357
|
-
thumbActive: "thumb--active",
|
1358
|
-
thumbContainer: "thumb-container",
|
1359
|
-
thumbMinValue: "thumb--minValue",
|
1360
|
-
thumbPrecise: "thumb--precise",
|
1361
|
-
thumbValue: "thumb--value",
|
1362
|
-
tick: "tick",
|
1363
|
-
tickActive: "tick--active",
|
1364
|
-
tickLabel: "tick__label",
|
1365
|
-
tickMax: "tick__label--max",
|
1366
|
-
tickMin: "tick__label--min",
|
1367
|
-
ticks: "ticks",
|
1368
|
-
track: "track",
|
1369
|
-
trackRange: "track__range",
|
1370
|
-
transformed: "transformed",
|
1371
|
-
};
|
1372
|
-
const maxTickElementThreshold = 250;
|
1202
|
+
DropdownGroup.style = CalciteDropdownGroupStyle0;
|
1373
1203
|
|
1374
|
-
const
|
1375
|
-
const
|
1204
|
+
const mapLayerPickerCss = ":host{display:block}.map-layer-picker-container{width:100%;align-items:center}.map-layer-picker{position:relative;width:100%;display:inline-block}.padding-bottom-1{padding-bottom:1rem}.layer-picker-dropdown{height:100%;width:100%}.max-width-350{max-width:350px}.height-100{height:100%}.disabled{cursor:default !important;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.no-bottom-margin{--calcite-label-margin-bottom:0px}.layer-picker-label-container{align-items:center;display:inline-flex;height:100%;padding-inline-start:1rem;padding-inline-end:1rem}.padding-start-1{padding-inline-start:1rem}.cursor-default{cursor:default}";
|
1205
|
+
const MapLayerPickerStyle0 = mapLayerPickerCss;
|
1376
1206
|
|
1377
|
-
|
1378
|
-
return Array.isArray(value);
|
1379
|
-
}
|
1380
|
-
const Slider = class {
|
1207
|
+
const MapLayerPicker = class {
|
1381
1208
|
constructor(hostRef) {
|
1382
1209
|
registerInstance(this, hostRef);
|
1383
|
-
this.
|
1384
|
-
this.
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
this.
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
return;
|
1398
|
-
}
|
1399
|
-
let adjustment;
|
1400
|
-
if (key === "ArrowUp" || key === "ArrowRight") {
|
1401
|
-
const directionFactor = mirror && key === "ArrowRight" ? -1 : 1;
|
1402
|
-
adjustment = value + step * directionFactor;
|
1403
|
-
}
|
1404
|
-
else if (key === "ArrowDown" || key === "ArrowLeft") {
|
1405
|
-
const directionFactor = mirror && key === "ArrowLeft" ? -1 : 1;
|
1406
|
-
adjustment = value - step * directionFactor;
|
1407
|
-
}
|
1408
|
-
else if (key === "PageUp") {
|
1409
|
-
if (pageStep) {
|
1410
|
-
adjustment = value + pageStep;
|
1411
|
-
}
|
1412
|
-
}
|
1413
|
-
else if (key === "PageDown") {
|
1414
|
-
if (pageStep) {
|
1415
|
-
adjustment = value - pageStep;
|
1416
|
-
}
|
1417
|
-
}
|
1418
|
-
else if (key === "Home") {
|
1419
|
-
adjustment = min;
|
1420
|
-
}
|
1421
|
-
else if (key === "End") {
|
1422
|
-
adjustment = max;
|
1423
|
-
}
|
1424
|
-
if (isNaN(adjustment)) {
|
1425
|
-
return;
|
1426
|
-
}
|
1427
|
-
event.preventDefault();
|
1428
|
-
const fixedDecimalAdjustment = Number(adjustment.toFixed(decimalPlaces(step)));
|
1429
|
-
this.setValue({
|
1430
|
-
[activeProp]: this.clamp(fixedDecimalAdjustment, activeProp),
|
1431
|
-
});
|
1432
|
-
};
|
1433
|
-
this.activeProp = "value";
|
1434
|
-
this.guid = `calcite-slider-${guid()}`;
|
1435
|
-
this.onThumbBlur = () => {
|
1436
|
-
this.activeProp = null;
|
1437
|
-
};
|
1438
|
-
this.onThumbFocus = (event) => {
|
1439
|
-
const thumb = event.currentTarget;
|
1440
|
-
this.activeProp = thumb.getAttribute("data-value-prop");
|
1441
|
-
};
|
1442
|
-
this.onThumbPointerDown = (event) => {
|
1443
|
-
const thumb = event.currentTarget;
|
1444
|
-
this.pointerDownDragStart(event, thumb.getAttribute("data-value-prop"));
|
1445
|
-
};
|
1446
|
-
this.onTrackPointerDown = (event) => {
|
1447
|
-
this.pointerDownDragStart(event, "minMaxValue");
|
1448
|
-
};
|
1449
|
-
this.dragUpdate = (event) => {
|
1450
|
-
if (this.disabled) {
|
1451
|
-
return;
|
1452
|
-
}
|
1453
|
-
event.preventDefault();
|
1454
|
-
if (this.dragProp) {
|
1455
|
-
const value = this.translate(event.clientX || event.pageX);
|
1456
|
-
if (isRange(this.value) && this.dragProp === "minMaxValue") {
|
1457
|
-
if (this.minValueDragRange && this.maxValueDragRange && this.minMaxValueRange) {
|
1458
|
-
const newMinValue = value - this.minValueDragRange;
|
1459
|
-
const newMaxValue = value + this.maxValueDragRange;
|
1460
|
-
if (newMaxValue <= this.max &&
|
1461
|
-
newMinValue >= this.min &&
|
1462
|
-
newMaxValue - newMinValue === this.minMaxValueRange) {
|
1463
|
-
this.setValue({
|
1464
|
-
minValue: this.clamp(newMinValue, "minValue"),
|
1465
|
-
maxValue: this.clamp(newMaxValue, "maxValue"),
|
1466
|
-
});
|
1467
|
-
}
|
1468
|
-
}
|
1469
|
-
else {
|
1470
|
-
this.minValueDragRange = value - this.minValue;
|
1471
|
-
this.maxValueDragRange = this.maxValue - value;
|
1472
|
-
this.minMaxValueRange = this.maxValue - this.minValue;
|
1473
|
-
}
|
1474
|
-
}
|
1475
|
-
else {
|
1476
|
-
this.setValue({ [this.dragProp]: this.clamp(value, this.dragProp) });
|
1477
|
-
}
|
1478
|
-
}
|
1479
|
-
};
|
1480
|
-
this.pointerUpDragEnd = (event) => {
|
1481
|
-
if (this.disabled || !isPrimaryPointerButton(event)) {
|
1482
|
-
return;
|
1483
|
-
}
|
1484
|
-
this.dragEnd(event);
|
1485
|
-
};
|
1486
|
-
this.dragEnd = (event) => {
|
1487
|
-
if (this.disabled) {
|
1488
|
-
return;
|
1489
|
-
}
|
1490
|
-
this.removeDragListeners();
|
1491
|
-
this.focusActiveHandle(event.clientX);
|
1492
|
-
if (this.lastDragPropValue != this[this.dragProp]) {
|
1493
|
-
this.emitChange();
|
1494
|
-
}
|
1495
|
-
this.dragProp = null;
|
1496
|
-
this.lastDragPropValue = null;
|
1497
|
-
this.minValueDragRange = null;
|
1498
|
-
this.maxValueDragRange = null;
|
1499
|
-
this.minMaxValueRange = null;
|
1500
|
-
};
|
1501
|
-
this.storeTrackRef = (node) => {
|
1502
|
-
this.trackEl = node;
|
1503
|
-
};
|
1504
|
-
this.storeThumbRef = (el) => {
|
1505
|
-
if (!el) {
|
1506
|
-
return;
|
1507
|
-
}
|
1508
|
-
const valueProp = el.getAttribute("data-value-prop");
|
1509
|
-
valueProp === "minValue" ? (this.minHandle = el) : (this.maxHandle = el);
|
1510
|
-
};
|
1511
|
-
/**
|
1512
|
-
* Returns a string representing the localized label value based if the groupSeparator prop is parsed.
|
1513
|
-
*
|
1514
|
-
* @param value
|
1515
|
-
*/
|
1516
|
-
this.formatValue = (value) => {
|
1517
|
-
numberStringFormatter.numberFormatOptions = {
|
1518
|
-
locale: this.effectiveLocale,
|
1519
|
-
numberingSystem: this.numberingSystem,
|
1520
|
-
useGrouping: this.groupSeparator,
|
1521
|
-
};
|
1522
|
-
return numberStringFormatter.localize(value.toString());
|
1523
|
-
};
|
1524
|
-
this.disabled = false;
|
1525
|
-
this.fillPlacement = "start";
|
1526
|
-
this.form = undefined;
|
1527
|
-
this.groupSeparator = false;
|
1528
|
-
this.hasHistogram = false;
|
1529
|
-
this.histogram = undefined;
|
1530
|
-
this.histogramStops = undefined;
|
1531
|
-
this.labelHandles = false;
|
1532
|
-
this.labelFormatter = undefined;
|
1533
|
-
this.labelTicks = false;
|
1534
|
-
this.max = 100;
|
1535
|
-
this.maxLabel = undefined;
|
1536
|
-
this.maxValue = undefined;
|
1537
|
-
this.min = 0;
|
1538
|
-
this.minLabel = undefined;
|
1539
|
-
this.minValue = undefined;
|
1540
|
-
this.mirrored = false;
|
1541
|
-
this.name = undefined;
|
1542
|
-
this.numberingSystem = undefined;
|
1543
|
-
this.pageStep = undefined;
|
1544
|
-
this.precise = false;
|
1545
|
-
this.required = false;
|
1546
|
-
this.snap = false;
|
1547
|
-
this.step = 1;
|
1548
|
-
this.ticks = undefined;
|
1549
|
-
this.value = 0;
|
1210
|
+
this.idsFound = createEvent(this, "idsFound", 7);
|
1211
|
+
this.noLayersFound = createEvent(this, "noLayersFound", 7);
|
1212
|
+
this.layerSelectionChange = createEvent(this, "layerSelectionChange", 7);
|
1213
|
+
this.appearance = "transparent";
|
1214
|
+
this.defaultLayerId = "";
|
1215
|
+
this.display = "inline-block";
|
1216
|
+
this.enabledLayerIds = [];
|
1217
|
+
this.enabledTableIds = [];
|
1218
|
+
this.height = undefined;
|
1219
|
+
this.isMobile = undefined;
|
1220
|
+
this.mapView = undefined;
|
1221
|
+
this.onlyShowUpdatableLayers = undefined;
|
1222
|
+
this.placeholderIcon = "";
|
1223
|
+
this.selectedIds = [];
|
1550
1224
|
this.scale = "m";
|
1551
|
-
this.
|
1552
|
-
this.
|
1553
|
-
this.
|
1554
|
-
this.
|
1555
|
-
this.
|
1556
|
-
|
1557
|
-
|
1558
|
-
this.
|
1559
|
-
|
1560
|
-
ticksWatcher() {
|
1561
|
-
this.tickValues = this.generateTickValues();
|
1562
|
-
}
|
1563
|
-
valueHandler() {
|
1564
|
-
this.setMinMaxFromValue();
|
1565
|
-
}
|
1566
|
-
minMaxValueHandler() {
|
1567
|
-
this.setValueFromMinMax();
|
1225
|
+
this.showTables = undefined;
|
1226
|
+
this.showSingleLayerAsLabel = false;
|
1227
|
+
this.type = "select";
|
1228
|
+
this._hasMultipleLayers = true;
|
1229
|
+
this._hasValidLayers = true;
|
1230
|
+
this._isDropdownOpen = undefined;
|
1231
|
+
this.ids = [];
|
1232
|
+
this.selectedName = "";
|
1233
|
+
this._translations = undefined;
|
1568
1234
|
}
|
1235
|
+
get el() { return getElement(this); }
|
1569
1236
|
//--------------------------------------------------------------------------
|
1570
1237
|
//
|
1571
|
-
//
|
1238
|
+
// Properties (protected)
|
1572
1239
|
//
|
1573
1240
|
//--------------------------------------------------------------------------
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
this.
|
1604
|
-
if (isRange(this.value)) {
|
1605
|
-
this.adjustHostObscuredHandleLabel("minValue");
|
1606
|
-
if (!(this.precise && !this.hasHistogram)) {
|
1607
|
-
this.hyphenateCollidingRangeHandleLabels();
|
1608
|
-
}
|
1609
|
-
}
|
1610
|
-
}
|
1611
|
-
this.hideObscuredBoundingTickLabels();
|
1612
|
-
updateHostInteraction(this);
|
1613
|
-
}
|
1614
|
-
render() {
|
1615
|
-
const id = this.el.id || this.guid;
|
1616
|
-
const value = isRange(this.value) ? this.maxValue : this.value;
|
1617
|
-
const min = this.minValue || this.min;
|
1618
|
-
const useMinValue = this.shouldUseMinValue();
|
1619
|
-
const minInterval = this.getUnitInterval(useMinValue ? this.minValue : min) * 100;
|
1620
|
-
const maxInterval = this.getUnitInterval(value) * 100;
|
1621
|
-
const mirror = this.shouldMirror();
|
1622
|
-
const valueIsRange = isRange(this.value);
|
1623
|
-
const thumbTypes = this.buildThumbType("max");
|
1624
|
-
const thumb = this.renderThumb({
|
1625
|
-
type: thumbTypes,
|
1626
|
-
thumbPlacement: thumbTypes.includes("histogram") ? "below" : "above",
|
1627
|
-
maxInterval,
|
1628
|
-
minInterval,
|
1629
|
-
mirror,
|
1630
|
-
});
|
1631
|
-
const minThumbTypes = this.buildThumbType("min");
|
1632
|
-
const minThumb = valueIsRange &&
|
1633
|
-
this.renderThumb({
|
1634
|
-
type: minThumbTypes,
|
1635
|
-
thumbPlacement: minThumbTypes.includes("histogram") || minThumbTypes.includes("precise")
|
1636
|
-
? "below"
|
1637
|
-
: "above",
|
1638
|
-
maxInterval,
|
1639
|
-
minInterval,
|
1640
|
-
mirror,
|
1641
|
-
});
|
1642
|
-
const fillPlacement = valueIsRange ? "start" : this.fillPlacement;
|
1643
|
-
const trackRangePlacementStyles = fillPlacement === "none"
|
1644
|
-
? {
|
1645
|
-
left: `unset`,
|
1646
|
-
right: `unset`,
|
1647
|
-
}
|
1648
|
-
: fillPlacement === "end"
|
1649
|
-
? {
|
1650
|
-
left: `${mirror ? minInterval : maxInterval}%`,
|
1651
|
-
right: `${mirror ? maxInterval : minInterval}%`,
|
1652
|
-
}
|
1653
|
-
: /* default */
|
1654
|
-
{
|
1655
|
-
left: `${mirror ? 100 - maxInterval : minInterval}%`,
|
1656
|
-
right: `${mirror ? minInterval : 100 - maxInterval}%`,
|
1657
|
-
};
|
1658
|
-
return (h(Host, { key: '345553b84f2336fe5a98bb2b3050d137130c41ef', id: id, onKeyDown: this.handleKeyDown, onTouchStart: this.handleTouchStart }, h(InteractiveContainer, { key: '0d9db31db94152095071d9ff40dbf3cf8ba685d6', disabled: this.disabled }, h("div", { key: '767ab1401000b02717013231c935fe1747def1b3', "aria-label": getLabelText(this), class: {
|
1659
|
-
[CSS.container]: true,
|
1660
|
-
[CSS.containerRange]: valueIsRange,
|
1661
|
-
[`scale--${this.scale}`]: true,
|
1662
|
-
} }, this.renderGraph(), h("div", { key: '1a104ad97079f71d37efea9d933f364520d49397', class: CSS.track, ref: this.storeTrackRef }, h("div", { key: '84f8033505dc0f373a0d19a641886e49ca4fe732', class: CSS.trackRange, onPointerDown: this.onTrackPointerDown, style: trackRangePlacementStyles }), h("div", { key: '79f89b93a6acbb05ffce09bd2aa34ef134b3e219', class: CSS.ticks }, this.tickValues.map((tick) => {
|
1663
|
-
const tickOffset = `${this.getUnitInterval(tick) * 100}%`;
|
1664
|
-
let activeTicks = false;
|
1665
|
-
if (fillPlacement === "start" || fillPlacement === "end") {
|
1666
|
-
if (useMinValue) {
|
1667
|
-
activeTicks = tick >= this.minValue && tick <= this.maxValue;
|
1668
|
-
}
|
1669
|
-
else {
|
1670
|
-
const rangeStart = fillPlacement === "start" ? min : value;
|
1671
|
-
const rangeEnd = fillPlacement === "start" ? value : this.max;
|
1672
|
-
activeTicks = tick >= rangeStart && tick <= rangeEnd;
|
1673
|
-
}
|
1674
|
-
}
|
1675
|
-
return (h("span", { class: {
|
1676
|
-
[CSS.tick]: true,
|
1677
|
-
[CSS.tickActive]: activeTicks,
|
1678
|
-
}, style: {
|
1679
|
-
left: mirror ? "" : tickOffset,
|
1680
|
-
right: mirror ? tickOffset : "",
|
1681
|
-
} }, this.renderTickLabel(tick)));
|
1682
|
-
}))), h("div", { key: '9bc6ea406e2036adb87da4a6053533283434864d', class: CSS.thumbContainer }, minThumb, thumb, h(HiddenFormInputSlot, { key: 'c13236898b527a1ffc058914fe87e6004b93aaf5', component: this }))))));
|
1683
|
-
}
|
1684
|
-
renderThumb({ type, mirror, thumbPlacement, minInterval, maxInterval, }) {
|
1685
|
-
const isLabeled = type.includes("labeled");
|
1686
|
-
const isPrecise = type.includes("precise");
|
1687
|
-
const isMinThumb = type.includes("min");
|
1688
|
-
const valueIsRange = isRange(this.value);
|
1689
|
-
const value = isMinThumb
|
1690
|
-
? this.minValue
|
1691
|
-
: valueIsRange
|
1692
|
-
? this.maxValue
|
1693
|
-
: this.value;
|
1694
|
-
const valueProp = isMinThumb ? "minValue" : valueIsRange ? "maxValue" : "value";
|
1695
|
-
const ariaLabel = isMinThumb ? this.minLabel : valueIsRange ? this.maxLabel : this.minLabel;
|
1696
|
-
const ariaValuenow = isMinThumb ? this.minValue : value;
|
1697
|
-
const displayedValue = valueProp === "minValue"
|
1698
|
-
? this.internalLabelFormatter(this.minValue, "min")
|
1699
|
-
: valueProp === "maxValue"
|
1700
|
-
? this.internalLabelFormatter(this.maxValue, "max")
|
1701
|
-
: this.internalLabelFormatter(value, "value");
|
1702
|
-
const thumbStyle = isMinThumb
|
1703
|
-
? { left: `${mirror ? 100 - minInterval : minInterval}%` }
|
1704
|
-
: { right: `${mirror ? maxInterval : 100 - maxInterval}%` };
|
1705
|
-
const thumbLabelClasses = `${CSS.handleLabel} ${isMinThumb ? CSS.handleLabelMinValue : CSS.handleLabelValue}`;
|
1706
|
-
const labels = isLabeled
|
1707
|
-
? [
|
1708
|
-
h("span", { "aria-hidden": "true", class: thumbLabelClasses }, displayedValue),
|
1709
|
-
h("span", { "aria-hidden": "true", class: `${thumbLabelClasses} ${CSS.static}` }, displayedValue),
|
1710
|
-
h("span", { "aria-hidden": "true", class: `${thumbLabelClasses} ${CSS.transformed}` }, displayedValue),
|
1711
|
-
]
|
1712
|
-
: [];
|
1713
|
-
const thumbContent = [
|
1714
|
-
...labels,
|
1715
|
-
h("div", { class: CSS.handle }),
|
1716
|
-
isPrecise && h("div", { class: CSS.handleExtension }),
|
1717
|
-
];
|
1718
|
-
if (thumbPlacement === "below") {
|
1719
|
-
thumbContent.reverse();
|
1720
|
-
}
|
1721
|
-
return (h("div", { "aria-disabled": this.disabled, "aria-label": ariaLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": ariaValuenow, class: {
|
1722
|
-
[CSS.thumb]: true,
|
1723
|
-
[CSS.thumbValue]: !isMinThumb,
|
1724
|
-
[CSS.thumbActive]: this.lastDragProp !== "minMaxValue" && this.dragProp === valueProp,
|
1725
|
-
[CSS.thumbPrecise]: isPrecise,
|
1726
|
-
[CSS.thumbMinValue]: isMinThumb,
|
1727
|
-
}, "data-value-prop": valueProp, key: type, onBlur: this.onThumbBlur, onFocus: this.onThumbFocus, onPointerDown: this.onThumbPointerDown, ref: this.storeThumbRef, role: "slider", style: thumbStyle, tabIndex: 0 }, thumbContent));
|
1728
|
-
}
|
1729
|
-
renderGraph() {
|
1730
|
-
return this.histogram ? (h("calcite-graph", { class: CSS.graph, colorStops: this.histogramStops, data: this.histogram, highlightMax: isRange(this.value) ? this.maxValue : this.value, highlightMin: isRange(this.value) ? this.minValue : this.min, max: this.max, min: this.min })) : null;
|
1731
|
-
}
|
1732
|
-
renderTickLabel(tick) {
|
1733
|
-
const { hasHistogram, labelHandles, labelTicks, max, min, precise, value } = this;
|
1734
|
-
const valueIsRange = isRange(value);
|
1735
|
-
const isMinTickLabel = tick === min;
|
1736
|
-
const isMaxTickLabel = tick === max;
|
1737
|
-
const isAtEdge = isMinTickLabel || isMaxTickLabel;
|
1738
|
-
const shouldDisplayLabel = labelTicks &&
|
1739
|
-
((!hasHistogram && (isAtEdge || !precise || !valueIsRange)) ||
|
1740
|
-
(hasHistogram && (isAtEdge || (!precise && !labelHandles))));
|
1741
|
-
return shouldDisplayLabel ? (h("span", { class: {
|
1742
|
-
[CSS.tickLabel]: true,
|
1743
|
-
[CSS.tickMin]: isMinTickLabel,
|
1744
|
-
[CSS.tickMax]: isMaxTickLabel,
|
1745
|
-
} }, this.internalLabelFormatter(tick, "tick"))) : null;
|
1746
|
-
}
|
1747
|
-
pointerDownHandler(event) {
|
1748
|
-
if (this.disabled || !isPrimaryPointerButton(event)) {
|
1749
|
-
return;
|
1750
|
-
}
|
1751
|
-
const x = event.clientX || event.pageX;
|
1752
|
-
const position = this.translate(x);
|
1753
|
-
let prop = "value";
|
1754
|
-
if (isRange(this.value)) {
|
1755
|
-
const inRange = position >= this.minValue && position <= this.maxValue;
|
1756
|
-
if (inRange && this.lastDragProp === "minMaxValue") {
|
1757
|
-
prop = "minMaxValue";
|
1758
|
-
}
|
1759
|
-
else {
|
1760
|
-
const closerToMax = Math.abs(this.maxValue - position) < Math.abs(this.minValue - position);
|
1761
|
-
prop = closerToMax || position >= this.maxValue ? "maxValue" : "minValue";
|
1762
|
-
}
|
1241
|
+
/**
|
1242
|
+
* boolean: When true the default layer has been loaded once and should no longer be used
|
1243
|
+
*/
|
1244
|
+
defaultLayerHonored = false;
|
1245
|
+
/**
|
1246
|
+
* HTMLCalciteSelectElement: The html element for selecting layers
|
1247
|
+
*/
|
1248
|
+
_layerElement;
|
1249
|
+
/**
|
1250
|
+
* IMapItemHash: id/name lookup
|
1251
|
+
*/
|
1252
|
+
_layerNameHash;
|
1253
|
+
/**
|
1254
|
+
* IMapItemHash: id/name lookup
|
1255
|
+
*/
|
1256
|
+
_tableNameHash;
|
1257
|
+
//--------------------------------------------------------------------------
|
1258
|
+
//
|
1259
|
+
// Watch handlers
|
1260
|
+
//
|
1261
|
+
//--------------------------------------------------------------------------
|
1262
|
+
/**
|
1263
|
+
* Called each time the mapView prop is changed.
|
1264
|
+
*/
|
1265
|
+
async mapViewWatchHandler() {
|
1266
|
+
await this._setLayers();
|
1267
|
+
if (this.ids.length > 0) {
|
1268
|
+
this._hasValidLayers = true;
|
1269
|
+
this._hasMultipleLayers = this.ids.length > 1;
|
1270
|
+
this._setSelectedLayer(this.ids[0]);
|
1763
1271
|
}
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
if (!isThumbActive) {
|
1768
|
-
this.setValue({ [prop]: this.clamp(position, prop) });
|
1272
|
+
else {
|
1273
|
+
this._hasValidLayers = false;
|
1274
|
+
this.noLayersFound.emit();
|
1769
1275
|
}
|
1770
|
-
this.focusActiveHandle(x);
|
1771
|
-
}
|
1772
|
-
handleTouchStart(event) {
|
1773
|
-
// needed to prevent extra click at the end of a handle drag
|
1774
|
-
event.preventDefault();
|
1775
1276
|
}
|
1776
1277
|
//--------------------------------------------------------------------------
|
1777
1278
|
//
|
1778
|
-
//
|
1279
|
+
// Methods (public)
|
1779
1280
|
//
|
1780
1281
|
//--------------------------------------------------------------------------
|
1781
|
-
/** Sets focus on the component. */
|
1782
|
-
async setFocus() {
|
1783
|
-
await componentFocusable(this);
|
1784
|
-
const handle = this.minHandle ? this.minHandle : this.maxHandle;
|
1785
|
-
handle?.focus();
|
1786
|
-
}
|
1787
1282
|
//--------------------------------------------------------------------------
|
1788
1283
|
//
|
1789
|
-
//
|
1284
|
+
// Events (public)
|
1790
1285
|
//
|
1791
1286
|
//--------------------------------------------------------------------------
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
onLabelClick() {
|
1819
|
-
this.setFocus();
|
1820
|
-
}
|
1821
|
-
shouldMirror() {
|
1822
|
-
return this.mirrored && !this.hasHistogram;
|
1287
|
+
/**
|
1288
|
+
* Emitted on demand when no valid layers are found
|
1289
|
+
*
|
1290
|
+
*/
|
1291
|
+
idsFound;
|
1292
|
+
/**
|
1293
|
+
* Emitted on demand when no valid layers are found
|
1294
|
+
*
|
1295
|
+
*/
|
1296
|
+
noLayersFound;
|
1297
|
+
/**
|
1298
|
+
* Emitted on demand when a layer is selected
|
1299
|
+
*
|
1300
|
+
*/
|
1301
|
+
layerSelectionChange;
|
1302
|
+
//--------------------------------------------------------------------------
|
1303
|
+
//
|
1304
|
+
// Functions (lifecycle)
|
1305
|
+
//
|
1306
|
+
//--------------------------------------------------------------------------
|
1307
|
+
/**
|
1308
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
1309
|
+
*/
|
1310
|
+
async componentWillLoad() {
|
1311
|
+
await this._getTranslations();
|
1312
|
+
await this._setLayers();
|
1823
1313
|
}
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1314
|
+
/**
|
1315
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
1316
|
+
*/
|
1317
|
+
async componentWillRender() {
|
1318
|
+
if (this.ids.length > 0 || this.selectedIds.length === 1) {
|
1319
|
+
const layer = await getLayerOrTable(this.mapView, this.selectedIds[0]);
|
1320
|
+
this.selectedName = layer?.title;
|
1827
1321
|
}
|
1828
|
-
return ((this.hasHistogram && this.maxValue === 0) || (!this.hasHistogram && this.minValue === 0));
|
1829
1322
|
}
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1323
|
+
/**
|
1324
|
+
* Renders the component.
|
1325
|
+
*/
|
1326
|
+
render() {
|
1327
|
+
const id = "map-layer-picker";
|
1328
|
+
let style = this.height > 0 ? { "height": `${this.height.toString()}px` } : {};
|
1329
|
+
style = { ...style, "display": this.display };
|
1330
|
+
return (h(Host, { key: '47a42a4855654930ebaf59b1567ab4bd5ccf3133' }, h("div", { key: 'acc05150c663d68ae633a7d293984ae282cfbdfa', class: "map-layer-picker-container", style: style }, h("div", { key: '811bde9a5118862f58b6a9ed99abec0f46fb4a1f', class: "map-layer-picker", style: style }, !this._hasValidLayers ? this._getInvalidPlaceholder() :
|
1331
|
+
!this._hasMultipleLayers && this.showSingleLayerAsLabel ? this._getSingleLayerPlaceholder() :
|
1332
|
+
this.type === "combobox" ? this._getCombobox(id) :
|
1333
|
+
this.type === "select" ? this._getSelect(id) : this._getDropdown(id)))));
|
1833
1334
|
}
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
ticks.push(this.max);
|
1335
|
+
/**
|
1336
|
+
* StencilJS: Called once just after the component is fully loaded and the first render() occurs.
|
1337
|
+
*/
|
1338
|
+
async componentDidLoad() {
|
1339
|
+
if (this.ids.length > 0 || this.selectedIds.length === 1) {
|
1340
|
+
const id = this.selectedIds.length === 1 ? this.selectedIds[0] : this.ids[0];
|
1341
|
+
if (this.type === "select") {
|
1342
|
+
this._layerElement.value = id;
|
1343
|
+
}
|
1344
|
+
else if (this.type === "dropdown") {
|
1345
|
+
this.selectedName = Object.keys(this._layerNameHash).indexOf(id) > -1 ?
|
1346
|
+
this._layerNameHash[id].name : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
|
1347
|
+
this._tableNameHash[id].name : "";
|
1348
|
+
}
|
1849
1349
|
}
|
1850
|
-
return ticks;
|
1851
1350
|
}
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
window.addEventListener("pointercancel", this.dragEnd);
|
1865
|
-
}
|
1866
|
-
focusActiveHandle(valueX) {
|
1867
|
-
if (this.dragProp === "minValue") {
|
1868
|
-
this.minHandle.focus();
|
1869
|
-
}
|
1870
|
-
else if (this.dragProp === "maxValue" || this.dragProp === "value") {
|
1871
|
-
this.maxHandle.focus();
|
1872
|
-
}
|
1873
|
-
else if (this.dragProp === "minMaxValue") {
|
1874
|
-
this.getClosestHandle(valueX).focus();
|
1875
|
-
}
|
1351
|
+
//--------------------------------------------------------------------------
|
1352
|
+
//
|
1353
|
+
// Functions (protected)
|
1354
|
+
//
|
1355
|
+
//--------------------------------------------------------------------------
|
1356
|
+
/**
|
1357
|
+
* Create a notice to inform the user that no layers were found
|
1358
|
+
*
|
1359
|
+
* @returns Calcite Notice component with the message
|
1360
|
+
*/
|
1361
|
+
_getInvalidPlaceholder() {
|
1362
|
+
return (h("div", null, h("calcite-notice", { class: "height-100", icon: "exclamation-mark-triangle", id: "no-valid-layers", kind: "danger", open: true }, h("div", { slot: "message" }, this._translations.noLayersFound)), h("calcite-tooltip", { label: this._translations.enableEditUpdate, placement: "bottom", "reference-element": "no-valid-layers" }, h("span", null, this._translations.enableEditUpdate))));
|
1876
1363
|
}
|
1877
|
-
|
1878
|
-
|
1364
|
+
/**
|
1365
|
+
* Show layer name as a label with icon
|
1366
|
+
*
|
1367
|
+
* @returns Calcite label with the layer name and icon
|
1368
|
+
*/
|
1369
|
+
_getSingleLayerPlaceholder() {
|
1370
|
+
return (h("div", { class: "layer-picker-label-container cursor-default" }, h("calcite-icon", { icon: "layers", scale: "s" }), h("calcite-label", { class: "no-bottom-margin padding-start-1" }, this.selectedName)));
|
1879
1371
|
}
|
1880
|
-
|
1881
|
-
|
1372
|
+
/**
|
1373
|
+
* Create a list of layers from the map
|
1374
|
+
* Used for selecting a single layer.
|
1375
|
+
*
|
1376
|
+
* @param id the id for the select component used to support the tooltip
|
1377
|
+
*
|
1378
|
+
* @returns Calcite Select component with the ids of the layers from the map
|
1379
|
+
*/
|
1380
|
+
_getSelect(id) {
|
1381
|
+
return (h("calcite-select", { id: id, label: "", onCalciteSelectChange: () => this._layerSelectionChange(), ref: (el) => { this._layerElement = el; }, scale: this.scale }, this._getMapLayerOptions()));
|
1882
1382
|
}
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1383
|
+
/**
|
1384
|
+
* Create a list of layer ids from the map
|
1385
|
+
* Used for selecting multiple layers
|
1386
|
+
*
|
1387
|
+
* @param id the id for the combobox component used to support the tooltip
|
1388
|
+
*
|
1389
|
+
* @returns Calcite ComboBox component with the ids of the layers from the map
|
1390
|
+
*/
|
1391
|
+
_getCombobox(id) {
|
1392
|
+
return (h("calcite-combobox", { clearDisabled: true, id: id, label: "", onCalciteComboboxChange: () => this._layerSelectionChange(), "placeholder-icon": this.placeholderIcon, ref: (el) => { this._layerElement = el; }, scale: this.scale, "selection-mode": "single" }, this._getMapLayerOptions()));
|
1887
1393
|
}
|
1888
1394
|
/**
|
1889
|
-
*
|
1395
|
+
* Hydrate a dropdown component with items to display the layer names
|
1396
|
+
*
|
1397
|
+
* @param id the id for the dropdown component used to support the tooltip
|
1890
1398
|
*
|
1891
|
-
* @
|
1399
|
+
* @returns Array of Dropdown items with layer names
|
1892
1400
|
*/
|
1893
|
-
|
1894
|
-
|
1895
|
-
Object.keys(values).forEach((propName) => {
|
1896
|
-
const newValue = values[propName];
|
1897
|
-
if (!valueChanged) {
|
1898
|
-
const oldValue = this[propName];
|
1899
|
-
valueChanged = oldValue !== newValue;
|
1900
|
-
}
|
1901
|
-
this[propName] = newValue;
|
1902
|
-
});
|
1903
|
-
if (!valueChanged) {
|
1904
|
-
return;
|
1905
|
-
}
|
1906
|
-
const dragging = this.dragProp;
|
1907
|
-
if (!dragging) {
|
1908
|
-
this.emitChange();
|
1909
|
-
}
|
1910
|
-
this.emitInput();
|
1401
|
+
_getDropdown(id) {
|
1402
|
+
return (h("calcite-dropdown", { class: "layer-picker-dropdown", onCalciteDropdownBeforeClose: () => this._isDropdownOpen = false, onCalciteDropdownBeforeOpen: () => this._isDropdownOpen = true }, this.isMobile ? this._getDropdownButton() : this._getActionDropdownButton(id), h("calcite-dropdown-group", { "selection-mode": "single" }, this._getMapLayerOptions())));
|
1911
1403
|
}
|
1912
1404
|
/**
|
1913
|
-
*
|
1405
|
+
* Get the button that will open the dropdown list wrapped in an action
|
1914
1406
|
*
|
1915
|
-
* @
|
1916
|
-
* @param prop
|
1917
|
-
* @internal
|
1407
|
+
* @returns the node for the action and button
|
1918
1408
|
*/
|
1919
|
-
|
1920
|
-
|
1921
|
-
// ensure that maxValue and minValue don't swap positions
|
1922
|
-
if (prop === "maxValue") {
|
1923
|
-
value = Math.max(value, this.minValue);
|
1924
|
-
}
|
1925
|
-
if (prop === "minValue") {
|
1926
|
-
value = Math.min(value, this.maxValue);
|
1927
|
-
}
|
1928
|
-
return value;
|
1409
|
+
_getActionDropdownButton(id) {
|
1410
|
+
return (h("calcite-action", { id: id, slot: "trigger", text: "" }, this._getDropdownButton()));
|
1929
1411
|
}
|
1930
1412
|
/**
|
1931
|
-
*
|
1413
|
+
* Get the button that will open the dropdown list
|
1932
1414
|
*
|
1933
|
-
* @
|
1934
|
-
* @internal
|
1415
|
+
* @returns the node for the button
|
1935
1416
|
*/
|
1936
|
-
|
1937
|
-
const
|
1938
|
-
const
|
1939
|
-
const
|
1940
|
-
|
1941
|
-
const clampedValue = this.clamp(this.min + range * (mirror ? 1 - percent : percent));
|
1942
|
-
const value = Number(clampedValue.toFixed(decimalPlaces(this.step)));
|
1943
|
-
return !(this.snap && this.step) ? value : this.getClosestStep(value);
|
1417
|
+
_getDropdownButton() {
|
1418
|
+
const buttonClass = this.isMobile ? "" : "max-width-350";
|
1419
|
+
const buttonSlot = this.isMobile ? "trigger" : "";
|
1420
|
+
const buttonIcon = this._isDropdownOpen ? "chevron-up" : "chevron-down";
|
1421
|
+
return (h("calcite-button", { alignment: "icon-end-space-between", appearance: this.appearance, class: buttonClass, iconEnd: buttonIcon, iconStart: "layers", kind: "neutral", slot: buttonSlot, width: "full" }, h("div", null, this.selectedName)));
|
1944
1422
|
}
|
1945
1423
|
/**
|
1946
|
-
* Get
|
1424
|
+
* Get the appropriate type of dom nodes for each valid layer or table
|
1947
1425
|
*
|
1948
|
-
* @
|
1949
|
-
* @internal
|
1426
|
+
* @returns Array of dom nodes with the names of the layers and optionally of the tables
|
1950
1427
|
*/
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1428
|
+
_getMapLayerOptions() {
|
1429
|
+
return this.ids.reduce((prev, cur) => {
|
1430
|
+
if (this._validLayer(cur)) {
|
1431
|
+
prev.push(this._getItem(cur, "layer"));
|
1432
|
+
}
|
1433
|
+
else if (this._validTable(cur)) {
|
1434
|
+
prev.push(this._getItem(cur, "table"));
|
1435
|
+
}
|
1436
|
+
return prev;
|
1437
|
+
}, []);
|
1959
1438
|
}
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1439
|
+
/**
|
1440
|
+
* Get the appropriate type of dom node for the current layer or table id
|
1441
|
+
*
|
1442
|
+
* @returns A dom node with the name of the layer or table
|
1443
|
+
*/
|
1444
|
+
_getItem(id, itemType) {
|
1445
|
+
const item = itemType === "layer" ? this._layerNameHash[id] : this._tableNameHash[id];
|
1446
|
+
const disabled = this.onlyShowUpdatableLayers ? !item.supportsUpdate : false;
|
1447
|
+
const name = item.name;
|
1448
|
+
const selected = this.selectedIds.indexOf(id) > -1;
|
1449
|
+
return this.type === "combobox" ? (h("calcite-combobox-item", { disabled: disabled, selected: selected, textLabel: name, value: id })) :
|
1450
|
+
this.type === "select" ? (h("calcite-option", { disabled: disabled, label: name, selected: selected, value: id })) : (h("calcite-dropdown-group", { class: disabled ? "disabled" : "", selectionMode: disabled ? "none" : "single" }, h("calcite-dropdown-item", { onClick: disabled ? undefined : () => void this._setSelectedLayer(id), selected: selected }, name)));
|
1964
1451
|
}
|
1965
|
-
|
1966
|
-
|
1452
|
+
/**
|
1453
|
+
* Store the layer name based on the user selection
|
1454
|
+
*/
|
1455
|
+
_setSelectedLayer(id) {
|
1456
|
+
let item;
|
1457
|
+
const hasDefaultLayer = this.defaultLayerId && !this.defaultLayerHonored;
|
1458
|
+
if (hasDefaultLayer) {
|
1459
|
+
item = this._getLayerFromHash(this.defaultLayerId);
|
1460
|
+
this.defaultLayerHonored = item !== undefined;
|
1461
|
+
id = this.defaultLayerHonored ? this.defaultLayerId : id;
|
1462
|
+
}
|
1463
|
+
item = item ? item : this._getLayerFromHash(id);
|
1464
|
+
this.selectedName = item?.name;
|
1465
|
+
this.selectedIds = [id];
|
1466
|
+
this.layerSelectionChange.emit(this.selectedIds);
|
1967
1467
|
}
|
1968
|
-
|
1969
|
-
|
1468
|
+
/**
|
1469
|
+
* Fetch layer hash info for the given id
|
1470
|
+
*
|
1471
|
+
* @returns ILayerHashInfo for the id
|
1472
|
+
*/
|
1473
|
+
_getLayerFromHash(id) {
|
1474
|
+
return Object.keys(this._layerNameHash).indexOf(id) > -1 ?
|
1475
|
+
this._layerNameHash[id] : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
|
1476
|
+
this._tableNameHash[id] : undefined;
|
1970
1477
|
}
|
1971
1478
|
/**
|
1972
|
-
*
|
1479
|
+
* Fetch the ids of the layers from the map
|
1973
1480
|
*
|
1974
|
-
* @
|
1975
|
-
* @return {number} number in the unit interval [0,1]
|
1976
|
-
* @internal
|
1481
|
+
* @returns Promise when the operation has completed
|
1977
1482
|
*/
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
const { shadowRoot } = this.el;
|
1994
|
-
const mirror = this.shouldMirror();
|
1995
|
-
const leftModifier = mirror ? "value" : "minValue";
|
1996
|
-
const rightModifier = mirror ? "minValue" : "value";
|
1997
|
-
const leftValueLabel = shadowRoot.querySelector(`.handle__label--${leftModifier}`);
|
1998
|
-
const leftValueLabelStatic = shadowRoot.querySelector(`.handle__label--${leftModifier}.static`);
|
1999
|
-
const leftValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${leftModifier}.transformed`);
|
2000
|
-
const leftValueLabelStaticHostOffset = this.getHostOffset(leftValueLabelStatic.getBoundingClientRect().left, leftValueLabelStatic.getBoundingClientRect().right);
|
2001
|
-
const rightValueLabel = shadowRoot.querySelector(`.handle__label--${rightModifier}`);
|
2002
|
-
const rightValueLabelStatic = shadowRoot.querySelector(`.handle__label--${rightModifier}.static`);
|
2003
|
-
const rightValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${rightModifier}.transformed`);
|
2004
|
-
const rightValueLabelStaticHostOffset = this.getHostOffset(rightValueLabelStatic.getBoundingClientRect().left, rightValueLabelStatic.getBoundingClientRect().right);
|
2005
|
-
const labelFontSize = this.getFontSizeForElement(leftValueLabel);
|
2006
|
-
const labelTransformedOverlap = this.getRangeLabelOverlap(leftValueLabelTransformed, rightValueLabelTransformed);
|
2007
|
-
const hyphenLabel = leftValueLabel;
|
2008
|
-
const labelOffset = labelFontSize / 2;
|
2009
|
-
if (labelTransformedOverlap > 0) {
|
2010
|
-
hyphenLabel.classList.add(CSS.hyphen, CSS.hyphenWrap);
|
2011
|
-
if (rightValueLabelStaticHostOffset === 0 && leftValueLabelStaticHostOffset === 0) {
|
2012
|
-
// Neither handle overlaps the host boundary
|
2013
|
-
let leftValueLabelTranslate = labelTransformedOverlap / 2 - labelOffset;
|
2014
|
-
leftValueLabelTranslate =
|
2015
|
-
Math.sign(leftValueLabelTranslate) === -1
|
2016
|
-
? Math.abs(leftValueLabelTranslate)
|
2017
|
-
: -leftValueLabelTranslate;
|
2018
|
-
const leftValueLabelTransformedHostOffset = this.getHostOffset(leftValueLabelTransformed.getBoundingClientRect().left +
|
2019
|
-
leftValueLabelTranslate -
|
2020
|
-
labelOffset, leftValueLabelTransformed.getBoundingClientRect().right +
|
2021
|
-
leftValueLabelTranslate -
|
2022
|
-
labelOffset);
|
2023
|
-
let rightValueLabelTranslate = labelTransformedOverlap / 2;
|
2024
|
-
const rightValueLabelTransformedHostOffset = this.getHostOffset(rightValueLabelTransformed.getBoundingClientRect().left + rightValueLabelTranslate, rightValueLabelTransformed.getBoundingClientRect().right + rightValueLabelTranslate);
|
2025
|
-
if (leftValueLabelTransformedHostOffset !== 0) {
|
2026
|
-
leftValueLabelTranslate += leftValueLabelTransformedHostOffset;
|
2027
|
-
rightValueLabelTranslate += leftValueLabelTransformedHostOffset;
|
2028
|
-
}
|
2029
|
-
if (rightValueLabelTransformedHostOffset !== 0) {
|
2030
|
-
leftValueLabelTranslate += rightValueLabelTransformedHostOffset;
|
2031
|
-
rightValueLabelTranslate += rightValueLabelTransformedHostOffset;
|
2032
|
-
}
|
2033
|
-
leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
|
2034
|
-
leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
|
2035
|
-
rightValueLabel.style.transform = `translateX(${rightValueLabelTranslate}px)`;
|
2036
|
-
rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelTranslate}px)`;
|
2037
|
-
}
|
2038
|
-
else if (leftValueLabelStaticHostOffset > 0 || rightValueLabelStaticHostOffset > 0) {
|
2039
|
-
// labels overlap host boundary on the left side
|
2040
|
-
leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset + labelOffset}px)`;
|
2041
|
-
rightValueLabel.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
|
2042
|
-
rightValueLabelTransformed.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
|
2043
|
-
}
|
2044
|
-
else if (leftValueLabelStaticHostOffset < 0 || rightValueLabelStaticHostOffset < 0) {
|
2045
|
-
// labels overlap host boundary on the right side
|
2046
|
-
let leftValueLabelTranslate = Math.abs(leftValueLabelStaticHostOffset) + labelTransformedOverlap - labelOffset;
|
2047
|
-
leftValueLabelTranslate =
|
2048
|
-
Math.sign(leftValueLabelTranslate) === -1
|
2049
|
-
? Math.abs(leftValueLabelTranslate)
|
2050
|
-
: -leftValueLabelTranslate;
|
2051
|
-
leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
|
2052
|
-
leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
|
2053
|
-
}
|
2054
|
-
}
|
2055
|
-
else {
|
2056
|
-
hyphenLabel.classList.remove(CSS.hyphen, CSS.hyphenWrap);
|
2057
|
-
leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
|
2058
|
-
leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
|
2059
|
-
rightValueLabel.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
|
2060
|
-
rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
|
1483
|
+
async _setLayers() {
|
1484
|
+
if (this.mapView) {
|
1485
|
+
await this._initLayerTableHash();
|
1486
|
+
const layerIds = this.onlyShowUpdatableLayers ?
|
1487
|
+
this._getEditableIds(this._layerNameHash) : Object.keys(this._layerNameHash);
|
1488
|
+
const tableIds = this.showTables ? this.onlyShowUpdatableLayers ?
|
1489
|
+
this._getEditableIds(this._tableNameHash) : Object.keys(this._tableNameHash) : [];
|
1490
|
+
this.ids = [
|
1491
|
+
...layerIds.reverse().filter(n => this.enabledLayerIds?.length > 0 ? this.enabledLayerIds.reverse().indexOf(n) > -1 : true),
|
1492
|
+
...tableIds.reverse().filter(n => this.enabledTableIds?.length > 0 ? this.enabledTableIds.reverse().indexOf(n) > -1 : true),
|
1493
|
+
];
|
1494
|
+
this.idsFound.emit({
|
1495
|
+
layerIds,
|
1496
|
+
tableIds
|
1497
|
+
});
|
2061
1498
|
}
|
2062
1499
|
}
|
2063
1500
|
/**
|
2064
|
-
*
|
1501
|
+
* Fetch the ids of all layers that support edits with the update capability
|
1502
|
+
*
|
1503
|
+
* @returns array of layer ids
|
2065
1504
|
*/
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
2072
|
-
|
2073
|
-
}
|
2074
|
-
if (!this.hasHistogram && !valueIsRange && !this.labelHandles && this.precise) {
|
2075
|
-
return;
|
2076
|
-
}
|
2077
|
-
if (!this.hasHistogram && !valueIsRange && this.labelHandles && this.precise) {
|
2078
|
-
return;
|
2079
|
-
}
|
2080
|
-
if (!this.hasHistogram && valueIsRange && !this.precise) {
|
2081
|
-
return;
|
2082
|
-
}
|
2083
|
-
if (this.hasHistogram && !this.precise && !this.labelHandles) {
|
2084
|
-
return;
|
2085
|
-
}
|
2086
|
-
const minHandle = this.el.shadowRoot.querySelector(`.${CSS.thumbMinValue}`);
|
2087
|
-
const maxHandle = this.el.shadowRoot.querySelector(`.${CSS.thumbValue}`);
|
2088
|
-
const minTickLabel = this.el.shadowRoot.querySelector(`.${CSS.tickMin}`);
|
2089
|
-
const maxTickLabel = this.el.shadowRoot.querySelector(`.${CSS.tickMax}`);
|
2090
|
-
if (!minHandle && maxHandle && minTickLabel && maxTickLabel) {
|
2091
|
-
minTickLabel.style.opacity = this.isMinTickLabelObscured(minTickLabel, maxHandle) ? "0" : "1";
|
2092
|
-
maxTickLabel.style.opacity = this.isMaxTickLabelObscured(maxTickLabel, maxHandle) ? "0" : "1";
|
2093
|
-
}
|
2094
|
-
if (minHandle && maxHandle && minTickLabel && maxTickLabel) {
|
2095
|
-
minTickLabel.style.opacity =
|
2096
|
-
this.isMinTickLabelObscured(minTickLabel, minHandle) ||
|
2097
|
-
this.isMinTickLabelObscured(minTickLabel, maxHandle)
|
2098
|
-
? "0"
|
2099
|
-
: "1";
|
2100
|
-
maxTickLabel.style.opacity =
|
2101
|
-
this.isMaxTickLabelObscured(maxTickLabel, minHandle) ||
|
2102
|
-
(this.isMaxTickLabelObscured(maxTickLabel, maxHandle) && this.hasHistogram)
|
2103
|
-
? "0"
|
2104
|
-
: "1";
|
2105
|
-
}
|
1505
|
+
_getEditableIds(hash) {
|
1506
|
+
return Object.keys(hash).reduce((prev, cur) => {
|
1507
|
+
if (hash[cur].supportsUpdate) {
|
1508
|
+
prev.push(cur);
|
1509
|
+
}
|
1510
|
+
return prev;
|
1511
|
+
}, []);
|
2106
1512
|
}
|
2107
1513
|
/**
|
2108
|
-
*
|
1514
|
+
* Create a layer id:title hash for layer name display
|
2109
1515
|
*
|
2110
|
-
* @
|
2111
|
-
* @param rightBounds
|
2112
|
-
* @internal
|
1516
|
+
* @returns Promise when the operation has completed
|
2113
1517
|
*/
|
2114
|
-
|
2115
|
-
|
2116
|
-
|
2117
|
-
if (leftBounds + buffer < hostBounds.left) {
|
2118
|
-
return hostBounds.left - leftBounds - buffer;
|
2119
|
-
}
|
2120
|
-
if (rightBounds - buffer > hostBounds.right) {
|
2121
|
-
return -(rightBounds - hostBounds.right) + buffer;
|
2122
|
-
}
|
2123
|
-
return 0;
|
1518
|
+
async _initLayerTableHash() {
|
1519
|
+
this._layerNameHash = await getMapLayerHash(this.mapView, this.onlyShowUpdatableLayers);
|
1520
|
+
this._tableNameHash = this.showTables ? await getMapTableHash(this.mapView, this.onlyShowUpdatableLayers) : {};
|
2124
1521
|
}
|
2125
1522
|
/**
|
2126
|
-
*
|
2127
|
-
* a space in between the two spans equal to the font-size set on them to account for the space needed to render a hyphen.
|
1523
|
+
* Evaluate if the id exists in the current hash and verify if it should be excluded
|
2128
1524
|
*
|
2129
|
-
* @
|
2130
|
-
* @param rightLabel
|
1525
|
+
* @returns boolean when true the layer will be used in the current layer picker type
|
2131
1526
|
*/
|
2132
|
-
|
2133
|
-
const
|
2134
|
-
|
2135
|
-
|
2136
|
-
const rangeLabelOverlap = leftLabelBounds.right + leftLabelFontSize - rightLabelBounds.left;
|
2137
|
-
return Math.max(rangeLabelOverlap, 0);
|
1527
|
+
_validLayer(id) {
|
1528
|
+
const name = this._layerNameHash[id]?.name;
|
1529
|
+
return name && Object.keys(state.managedLayers).indexOf(name) < 0 && (this.enabledLayerIds.length > 0 ?
|
1530
|
+
this.enabledLayerIds.indexOf(id) > -1 : true);
|
2138
1531
|
}
|
2139
1532
|
/**
|
2140
|
-
*
|
1533
|
+
* Evaluate if the id exists in the current hash and verify if it should be excluded
|
2141
1534
|
*
|
2142
|
-
* @
|
2143
|
-
* @param handle
|
1535
|
+
* @returns boolean when true the table will be used in the current layer picker type
|
2144
1536
|
*/
|
2145
|
-
|
2146
|
-
const
|
2147
|
-
const
|
2148
|
-
return
|
1537
|
+
_validTable(id) {
|
1538
|
+
const name = this._tableNameHash[id]?.name;
|
1539
|
+
const validName = name && this.showTables;
|
1540
|
+
return validName ? state.managedTables.indexOf(name) < 0 &&
|
1541
|
+
(this.enabledTableIds.length > 0 ? this.enabledTableIds.indexOf(id) > -1 : true) : validName;
|
2149
1542
|
}
|
2150
1543
|
/**
|
2151
|
-
*
|
1544
|
+
* Fetch the ids of the layers from the map
|
2152
1545
|
*
|
2153
|
-
* @
|
2154
|
-
* @param handle
|
1546
|
+
* @returns Promise when the operation has completed
|
2155
1547
|
*/
|
2156
|
-
|
2157
|
-
const
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2161
|
-
internalLabelFormatter(value, type) {
|
2162
|
-
const customFormatter = this.labelFormatter;
|
2163
|
-
if (!customFormatter) {
|
2164
|
-
return this.formatValue(value);
|
2165
|
-
}
|
2166
|
-
const formattedValue = customFormatter(value, type, this.formatValue);
|
2167
|
-
if (formattedValue == null) {
|
2168
|
-
return this.formatValue(value);
|
1548
|
+
_layerSelectionChange() {
|
1549
|
+
const ids = Array.isArray(this._layerElement.value) ? this._layerElement.value : [this._layerElement.value];
|
1550
|
+
if (JSON.stringify(ids) !== JSON.stringify([""])) {
|
1551
|
+
this.selectedIds = ids;
|
1552
|
+
this.layerSelectionChange.emit(this.selectedIds);
|
2169
1553
|
}
|
2170
|
-
return formattedValue;
|
2171
1554
|
}
|
2172
|
-
|
2173
|
-
|
1555
|
+
/**
|
1556
|
+
* Fetches the component's translations
|
1557
|
+
*
|
1558
|
+
* @returns Promise when complete
|
1559
|
+
* @protected
|
1560
|
+
*/
|
1561
|
+
async _getTranslations() {
|
1562
|
+
const messages = await getLocaleComponentStrings(this.el);
|
1563
|
+
this._translations = messages[0];
|
1564
|
+
}
|
2174
1565
|
static get watchers() { return {
|
2175
|
-
"
|
2176
|
-
"ticks": ["ticksWatcher"],
|
2177
|
-
"value": ["valueHandler"],
|
2178
|
-
"minValue": ["minMaxValueHandler"],
|
2179
|
-
"maxValue": ["minMaxValueHandler"]
|
1566
|
+
"mapView": ["mapViewWatchHandler"]
|
2180
1567
|
}; }
|
2181
1568
|
};
|
2182
|
-
|
1569
|
+
MapLayerPicker.style = MapLayerPickerStyle0;
|
2183
1570
|
|
2184
|
-
export { Combobox as calcite_combobox,
|
1571
|
+
export { Combobox as calcite_combobox, DropdownGroup as calcite_dropdown_group, MapLayerPicker as map_layer_picker };
|