@esri/solutions-components 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- 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,228 @@
|
|
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 { h as closestElementCrossShadowBoundary } from './dom.js';
|
7
|
+
import { h } from '@stencil/core/internal/client';
|
8
|
+
|
9
|
+
/*!
|
10
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
11
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
12
|
+
* v1.0.0-beta.97
|
13
|
+
*/
|
14
|
+
/**
|
15
|
+
* Exported for testing purposes.
|
16
|
+
*/
|
17
|
+
const hiddenFormInputSlotName = "hidden-form-input";
|
18
|
+
function isCheckable(component) {
|
19
|
+
return "checked" in component;
|
20
|
+
}
|
21
|
+
const onFormResetMap = new WeakMap();
|
22
|
+
const formComponentSet = new WeakSet();
|
23
|
+
function hasRegisteredFormComponentParent(form, formComponentEl) {
|
24
|
+
// we use events as a way to test for nested form-associated components across shadow bounds
|
25
|
+
const formComponentRegisterEventName = "calciteInternalFormComponentRegister";
|
26
|
+
let hasRegisteredFormComponentParent = false;
|
27
|
+
form.addEventListener(formComponentRegisterEventName, (event) => {
|
28
|
+
hasRegisteredFormComponentParent = event
|
29
|
+
.composedPath()
|
30
|
+
.some((element) => formComponentSet.has(element));
|
31
|
+
event.stopPropagation();
|
32
|
+
}, { once: true });
|
33
|
+
formComponentEl.dispatchEvent(new CustomEvent(formComponentRegisterEventName, {
|
34
|
+
bubbles: true,
|
35
|
+
composed: true
|
36
|
+
}));
|
37
|
+
return hasRegisteredFormComponentParent;
|
38
|
+
}
|
39
|
+
/**
|
40
|
+
* Helper to submit a form.
|
41
|
+
*
|
42
|
+
* @param component
|
43
|
+
* @returns true if its associated form was submitted, false otherwise.
|
44
|
+
*/
|
45
|
+
function submitForm(component) {
|
46
|
+
const { formEl } = component;
|
47
|
+
if (!formEl) {
|
48
|
+
return false;
|
49
|
+
}
|
50
|
+
"requestSubmit" in formEl ? formEl.requestSubmit() : formEl.submit();
|
51
|
+
return true;
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* Helper to reset a form.
|
55
|
+
*
|
56
|
+
* @param component
|
57
|
+
*/
|
58
|
+
function resetForm(component) {
|
59
|
+
var _a;
|
60
|
+
(_a = component.formEl) === null || _a === void 0 ? void 0 : _a.reset();
|
61
|
+
}
|
62
|
+
/**
|
63
|
+
* Helper to set up form interactions on connectedCallback.
|
64
|
+
*
|
65
|
+
* @param component
|
66
|
+
*/
|
67
|
+
function connectForm(component) {
|
68
|
+
const { el, value } = component;
|
69
|
+
const form = closestElementCrossShadowBoundary(el, "form");
|
70
|
+
if (!form || hasRegisteredFormComponentParent(form, el)) {
|
71
|
+
return;
|
72
|
+
}
|
73
|
+
component.formEl = form;
|
74
|
+
component.defaultValue = value;
|
75
|
+
if (isCheckable(component)) {
|
76
|
+
component.defaultChecked = component.checked;
|
77
|
+
}
|
78
|
+
const boundOnFormReset = (component.onFormReset || onFormReset).bind(component);
|
79
|
+
form.addEventListener("reset", boundOnFormReset);
|
80
|
+
onFormResetMap.set(component.el, boundOnFormReset);
|
81
|
+
formComponentSet.add(el);
|
82
|
+
}
|
83
|
+
function onFormReset() {
|
84
|
+
if (isCheckable(this)) {
|
85
|
+
this.checked = this.defaultChecked;
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
this.value = this.defaultValue;
|
89
|
+
}
|
90
|
+
/**
|
91
|
+
* Helper to tear down form interactions on disconnectedCallback.
|
92
|
+
*
|
93
|
+
* @param component
|
94
|
+
*/
|
95
|
+
function disconnectForm(component) {
|
96
|
+
const { el, formEl } = component;
|
97
|
+
if (!formEl) {
|
98
|
+
return;
|
99
|
+
}
|
100
|
+
const boundOnFormReset = onFormResetMap.get(el);
|
101
|
+
formEl.removeEventListener("reset", boundOnFormReset);
|
102
|
+
onFormResetMap.delete(el);
|
103
|
+
component.formEl = null;
|
104
|
+
formComponentSet.delete(el);
|
105
|
+
}
|
106
|
+
/**
|
107
|
+
* Helper for setting the default value on initialization after connectedCallback.
|
108
|
+
*
|
109
|
+
* Note that this is only needed if the default value cannot be determined on connectedCallback.
|
110
|
+
*
|
111
|
+
* @param component
|
112
|
+
* @param value
|
113
|
+
*/
|
114
|
+
function afterConnectDefaultValueSet(component, value) {
|
115
|
+
component.defaultValue = value;
|
116
|
+
}
|
117
|
+
const hiddenInputChangeHandler = (event) => {
|
118
|
+
event.target.dispatchEvent(new CustomEvent("calciteInternalHiddenInputChange", { bubbles: true }));
|
119
|
+
};
|
120
|
+
const removeHiddenInputChangeEventListener = (input) => input.removeEventListener("change", hiddenInputChangeHandler);
|
121
|
+
/**
|
122
|
+
* Helper for maintaining a form-associated's hidden input in sync with the component.
|
123
|
+
*
|
124
|
+
* Based on Ionic's approach: https://github.com/ionic-team/ionic-framework/blob/e4bf052794af9aac07f887013b9250d2a045eba3/core/src/utils/helpers.ts#L198
|
125
|
+
*
|
126
|
+
* @param component
|
127
|
+
*/
|
128
|
+
function syncHiddenFormInput(component) {
|
129
|
+
const { el, formEl, name, value } = component;
|
130
|
+
const { ownerDocument } = el;
|
131
|
+
const inputs = el.querySelectorAll(`input[slot="${hiddenFormInputSlotName}"]`);
|
132
|
+
if (!formEl || !name) {
|
133
|
+
inputs.forEach((input) => {
|
134
|
+
removeHiddenInputChangeEventListener(input);
|
135
|
+
input.remove();
|
136
|
+
});
|
137
|
+
return;
|
138
|
+
}
|
139
|
+
const values = Array.isArray(value) ? value : [value];
|
140
|
+
const extra = [];
|
141
|
+
const seen = new Set();
|
142
|
+
inputs.forEach((input) => {
|
143
|
+
const valueMatch = values.find((val) =>
|
144
|
+
/* intentional non-strict equality check */
|
145
|
+
val == input.value);
|
146
|
+
if (valueMatch != null) {
|
147
|
+
seen.add(valueMatch);
|
148
|
+
defaultSyncHiddenFormInput(component, input, valueMatch);
|
149
|
+
}
|
150
|
+
else {
|
151
|
+
extra.push(input);
|
152
|
+
}
|
153
|
+
});
|
154
|
+
let docFrag;
|
155
|
+
values.forEach((value) => {
|
156
|
+
if (seen.has(value)) {
|
157
|
+
return;
|
158
|
+
}
|
159
|
+
let input = extra.pop();
|
160
|
+
if (!input) {
|
161
|
+
input = ownerDocument.createElement("input");
|
162
|
+
input.slot = hiddenFormInputSlotName;
|
163
|
+
}
|
164
|
+
if (!docFrag) {
|
165
|
+
docFrag = ownerDocument.createDocumentFragment();
|
166
|
+
}
|
167
|
+
docFrag.append(input);
|
168
|
+
// emits when hidden input is autofilled
|
169
|
+
input.addEventListener("change", hiddenInputChangeHandler);
|
170
|
+
defaultSyncHiddenFormInput(component, input, value);
|
171
|
+
});
|
172
|
+
if (docFrag) {
|
173
|
+
el.append(docFrag);
|
174
|
+
}
|
175
|
+
extra.forEach((input) => {
|
176
|
+
removeHiddenInputChangeEventListener(input);
|
177
|
+
input.remove();
|
178
|
+
});
|
179
|
+
}
|
180
|
+
function defaultSyncHiddenFormInput(component, input, value) {
|
181
|
+
var _a;
|
182
|
+
const { defaultValue, disabled, name, required } = component;
|
183
|
+
// keep in sync to prevent losing reset value
|
184
|
+
input.defaultValue = defaultValue;
|
185
|
+
input.disabled = disabled;
|
186
|
+
input.name = name;
|
187
|
+
input.required = required;
|
188
|
+
input.tabIndex = -1;
|
189
|
+
if (isCheckable(component)) {
|
190
|
+
// keep in sync to prevent losing reset value
|
191
|
+
input.defaultChecked = component.defaultChecked;
|
192
|
+
// heuristic to support default/on mode from https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default-on
|
193
|
+
input.value = component.checked ? value || "on" : "";
|
194
|
+
// we disable the component when not checked to avoid having its value submitted
|
195
|
+
if (!disabled && !component.checked) {
|
196
|
+
input.disabled = true;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
else {
|
200
|
+
input.value = value || "";
|
201
|
+
}
|
202
|
+
(_a = component.syncHiddenFormInput) === null || _a === void 0 ? void 0 : _a.call(component, input);
|
203
|
+
}
|
204
|
+
/**
|
205
|
+
* Helper to render the slot for form-associated component's hidden input.
|
206
|
+
*
|
207
|
+
* If the component has a default slot, this must be placed at the bottom of the component's root container to ensure it is the last child.
|
208
|
+
*
|
209
|
+
* render(): VNode {
|
210
|
+
* <Host>
|
211
|
+
* <div class={CSS.container}>
|
212
|
+
* // ...
|
213
|
+
* <HiddenFormInputSlot component={this} />
|
214
|
+
* </div>
|
215
|
+
* </Host>
|
216
|
+
* }
|
217
|
+
*
|
218
|
+
* Note that the hidden-form-input Sass mixin must be added to the component's style to apply specific styles.
|
219
|
+
*
|
220
|
+
* @param root0
|
221
|
+
* @param root0.component
|
222
|
+
*/
|
223
|
+
const HiddenFormInputSlot = ({ component }) => {
|
224
|
+
syncHiddenFormInput(component);
|
225
|
+
return h("slot", { name: hiddenFormInputSlotName });
|
226
|
+
};
|
227
|
+
|
228
|
+
export { HiddenFormInputSlot as H, afterConnectDefaultValueSet as a, connectForm as c, disconnectForm as d, resetForm as r, submitForm as s };
|
@@ -0,0 +1,254 @@
|
|
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, forceUpdate, h } from '@stencil/core/internal/client';
|
7
|
+
import { g as guid } from './guid.js';
|
8
|
+
import { c as createObserver } from './observers.js';
|
9
|
+
|
10
|
+
/*!
|
11
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
12
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
13
|
+
* v1.0.0-beta.97
|
14
|
+
*/
|
15
|
+
/**
|
16
|
+
* Calculate slope of the tangents
|
17
|
+
* uses Steffen interpolation as it's monotonic
|
18
|
+
* http://jrwalsh1.github.io/posts/interpolations/
|
19
|
+
*
|
20
|
+
* @param p0
|
21
|
+
* @param p1
|
22
|
+
* @param p2
|
23
|
+
*/
|
24
|
+
function slope(p0, p1, p2) {
|
25
|
+
const dx = p1[0] - p0[0];
|
26
|
+
const dx1 = p2[0] - p1[0];
|
27
|
+
const dy = p1[1] - p0[1];
|
28
|
+
const dy1 = p2[1] - p1[1];
|
29
|
+
const m = dy / (dx || (dx1 < 0 && 0));
|
30
|
+
const m1 = dy1 / (dx1 || (dx < 0 && 0));
|
31
|
+
const p = (m * dx1 + m1 * dx) / (dx + dx1);
|
32
|
+
return (Math.sign(m) + Math.sign(m1)) * Math.min(Math.abs(m), Math.abs(m1), 0.5 * Math.abs(p)) || 0;
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Calculate slope for just one tangent (single-sided)
|
36
|
+
*
|
37
|
+
* @param p0
|
38
|
+
* @param p1
|
39
|
+
* @param m
|
40
|
+
*/
|
41
|
+
function slopeSingle(p0, p1, m) {
|
42
|
+
const dx = p1[0] - p0[0];
|
43
|
+
const dy = p1[1] - p0[1];
|
44
|
+
return dx ? ((3 * dy) / dx - m) / 2 : m;
|
45
|
+
}
|
46
|
+
/**
|
47
|
+
* Given two points and their tangent slopes,
|
48
|
+
* calculate the bezier handle coordinates and return draw command.
|
49
|
+
*
|
50
|
+
* Translates Hermite Spline to Beziér curve:
|
51
|
+
* stackoverflow.com/questions/42574940/
|
52
|
+
*
|
53
|
+
* @param p0
|
54
|
+
* @param p1
|
55
|
+
* @param m0
|
56
|
+
* @param m1
|
57
|
+
* @param t
|
58
|
+
*/
|
59
|
+
function bezier(p0, p1, m0, m1, t) {
|
60
|
+
const [x0, y0] = p0;
|
61
|
+
const [x1, y1] = p1;
|
62
|
+
const dx = (x1 - x0) / 3;
|
63
|
+
const h1 = t([x0 + dx, y0 + dx * m0]).join(",");
|
64
|
+
const h2 = t([x1 - dx, y1 - dx * m1]).join(",");
|
65
|
+
const p = t([x1, y1]).join(",");
|
66
|
+
return `C ${h1} ${h2} ${p}`;
|
67
|
+
}
|
68
|
+
/**
|
69
|
+
* Generate a function which will translate a point
|
70
|
+
* from the data coordinate space to svg viewbox oriented pixels
|
71
|
+
*
|
72
|
+
* @param root0
|
73
|
+
* @param root0.width
|
74
|
+
* @param root0.height
|
75
|
+
* @param root0.min
|
76
|
+
* @param root0.max
|
77
|
+
*/
|
78
|
+
function translate({ width, height, min, max }) {
|
79
|
+
const rangeX = max[0] - min[0];
|
80
|
+
const rangeY = max[1] - min[1];
|
81
|
+
return (point) => {
|
82
|
+
const x = ((point[0] - min[0]) / rangeX) * width;
|
83
|
+
const y = height - (point[1] / rangeY) * height;
|
84
|
+
return [x, y];
|
85
|
+
};
|
86
|
+
}
|
87
|
+
/**
|
88
|
+
* Get the min and max values from the dataset
|
89
|
+
*
|
90
|
+
* @param data
|
91
|
+
*/
|
92
|
+
function range(data) {
|
93
|
+
const [startX, startY] = data[0];
|
94
|
+
const min = [startX, startY];
|
95
|
+
const max = [startX, startY];
|
96
|
+
return data.reduce(({ min, max }, [x, y]) => ({
|
97
|
+
min: [Math.min(min[0], x), Math.min(min[1], y)],
|
98
|
+
max: [Math.max(max[0], x), Math.max(max[1], y)]
|
99
|
+
}), { min, max });
|
100
|
+
}
|
101
|
+
/**
|
102
|
+
* Generate drawing commands for an area graph
|
103
|
+
* returns a string can can be passed directly to a path element's `d` attribute
|
104
|
+
*
|
105
|
+
* @param root0
|
106
|
+
* @param root0.data
|
107
|
+
* @param root0.min
|
108
|
+
* @param root0.max
|
109
|
+
* @param root0.t
|
110
|
+
*/
|
111
|
+
function area({ data, min, max, t }) {
|
112
|
+
if (data.length === 0) {
|
113
|
+
return "";
|
114
|
+
}
|
115
|
+
// important points for beginning and ending the path
|
116
|
+
const [startX, startY] = t(data[0]);
|
117
|
+
const [minX, minY] = t(min);
|
118
|
+
const [maxX] = t(max);
|
119
|
+
// keep track of previous slope/points
|
120
|
+
let m;
|
121
|
+
let p0;
|
122
|
+
let p1;
|
123
|
+
// iterate over data points, calculating command for each
|
124
|
+
const commands = data.reduce((acc, point, i) => {
|
125
|
+
p0 = data[i - 2];
|
126
|
+
p1 = data[i - 1];
|
127
|
+
if (i > 1) {
|
128
|
+
const m1 = slope(p0, p1, point);
|
129
|
+
const m0 = m === undefined ? slopeSingle(p0, p1, m1) : m;
|
130
|
+
const command = bezier(p0, p1, m0, m1, t);
|
131
|
+
m = m1;
|
132
|
+
return `${acc} ${command}`;
|
133
|
+
}
|
134
|
+
return acc;
|
135
|
+
}, `M ${minX},${minY} L ${minX},${startY} L ${startX},${startY}`);
|
136
|
+
// close the path
|
137
|
+
const last = data[data.length - 1];
|
138
|
+
const end = bezier(p1, last, m, slopeSingle(p1, last, m), t);
|
139
|
+
return `${commands} ${end} L ${maxX},${minY} Z`;
|
140
|
+
}
|
141
|
+
|
142
|
+
const graphCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{display:block;block-size:100%}.svg{fill:currentColor;stroke:transparent;margin:0px;display:block;block-size:100%;inline-size:100%;padding:0px}.svg .graph-path--highlight{fill:var(--calcite-ui-brand);opacity:0.5}";
|
143
|
+
|
144
|
+
const Graph = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
145
|
+
constructor() {
|
146
|
+
super();
|
147
|
+
this.__registerHost();
|
148
|
+
this.__attachShadow();
|
149
|
+
//--------------------------------------------------------------------------
|
150
|
+
//
|
151
|
+
// Properties
|
152
|
+
//
|
153
|
+
//--------------------------------------------------------------------------
|
154
|
+
/**
|
155
|
+
* Array of tuples describing a single data point ([x, y])
|
156
|
+
* These data points should be sorted by x-axis value
|
157
|
+
*/
|
158
|
+
this.data = [];
|
159
|
+
//--------------------------------------------------------------------------
|
160
|
+
//
|
161
|
+
// Private State/Props
|
162
|
+
//
|
163
|
+
//--------------------------------------------------------------------------
|
164
|
+
this.graphId = `calcite-graph-${guid()}`;
|
165
|
+
this.resizeObserver = createObserver("resize", () => forceUpdate(this));
|
166
|
+
}
|
167
|
+
//--------------------------------------------------------------------------
|
168
|
+
//
|
169
|
+
// Lifecycle
|
170
|
+
//
|
171
|
+
//--------------------------------------------------------------------------
|
172
|
+
connectedCallback() {
|
173
|
+
var _a;
|
174
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el);
|
175
|
+
}
|
176
|
+
disconnectedCallback() {
|
177
|
+
var _a;
|
178
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
179
|
+
}
|
180
|
+
render() {
|
181
|
+
const { data, colorStops, el, highlightMax, highlightMin, min, max } = this;
|
182
|
+
const id = this.graphId;
|
183
|
+
const { clientHeight: height, clientWidth: width } = el;
|
184
|
+
// if we have no data, return empty svg
|
185
|
+
if (!data || data.length === 0) {
|
186
|
+
return (h("svg", { class: "svg", height: height, preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, width: width }));
|
187
|
+
}
|
188
|
+
const { min: rangeMin, max: rangeMax } = range(data);
|
189
|
+
let currentMin = rangeMin;
|
190
|
+
let currentMax = rangeMax;
|
191
|
+
if (min < rangeMin[0] || min > rangeMin[0]) {
|
192
|
+
currentMin = [min, 0];
|
193
|
+
}
|
194
|
+
if (max > rangeMax[0] || max < rangeMax[0]) {
|
195
|
+
currentMax = [max, rangeMax[1]];
|
196
|
+
}
|
197
|
+
const t = translate({ min: currentMin, max: currentMax, width, height });
|
198
|
+
const [hMinX] = t([highlightMin, currentMax[1]]);
|
199
|
+
const [hMaxX] = t([highlightMax, currentMax[1]]);
|
200
|
+
const areaPath = area({ data, min: rangeMin, max: rangeMax, t });
|
201
|
+
const fill = colorStops ? `url(#linear-gradient-${id})` : undefined;
|
202
|
+
return (h("svg", { 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 ? ([
|
203
|
+
h("mask", { height: "100%", id: `${id}1`, width: "100%", x: "0%", y: "0%" }, h("path", { d: `
|
204
|
+
M 0,0
|
205
|
+
L ${hMinX - 1},0
|
206
|
+
L ${hMinX - 1},${height}
|
207
|
+
L 0,${height}
|
208
|
+
Z
|
209
|
+
`, fill: "white" })),
|
210
|
+
h("mask", { height: "100%", id: `${id}2`, width: "100%", x: "0%", y: "0%" }, h("path", { d: `
|
211
|
+
M ${hMinX + 1},0
|
212
|
+
L ${hMaxX - 1},0
|
213
|
+
L ${hMaxX - 1},${height}
|
214
|
+
L ${hMinX + 1}, ${height}
|
215
|
+
Z
|
216
|
+
`, fill: "white" })),
|
217
|
+
h("mask", { height: "100%", id: `${id}3`, width: "100%", x: "0%", y: "0%" }, h("path", { d: `
|
218
|
+
M ${hMaxX + 1},0
|
219
|
+
L ${width},0
|
220
|
+
L ${width},${height}
|
221
|
+
L ${hMaxX + 1}, ${height}
|
222
|
+
Z
|
223
|
+
`, fill: "white" })),
|
224
|
+
h("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}1)` }),
|
225
|
+
h("path", { class: "graph-path--highlight", d: areaPath, fill: fill, mask: `url(#${id}2)` }),
|
226
|
+
h("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}3)` })
|
227
|
+
]) : (h("path", { class: "graph-path", d: areaPath, fill: fill }))));
|
228
|
+
}
|
229
|
+
get el() { return this; }
|
230
|
+
static get style() { return graphCss; }
|
231
|
+
}, [1, "calcite-graph", {
|
232
|
+
"data": [16],
|
233
|
+
"colorStops": [16],
|
234
|
+
"highlightMin": [2, "highlight-min"],
|
235
|
+
"highlightMax": [2, "highlight-max"],
|
236
|
+
"min": [514],
|
237
|
+
"max": [514]
|
238
|
+
}]);
|
239
|
+
function defineCustomElement() {
|
240
|
+
if (typeof customElements === "undefined") {
|
241
|
+
return;
|
242
|
+
}
|
243
|
+
const components = ["calcite-graph"];
|
244
|
+
components.forEach(tagName => { switch (tagName) {
|
245
|
+
case "calcite-graph":
|
246
|
+
if (!customElements.get(tagName)) {
|
247
|
+
customElements.define(tagName, Graph);
|
248
|
+
}
|
249
|
+
break;
|
250
|
+
} });
|
251
|
+
}
|
252
|
+
defineCustomElement();
|
253
|
+
|
254
|
+
export { Graph as G, defineCustomElement as d };
|
@@ -0,0 +1,24 @@
|
|
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
|
+
/*!
|
7
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
8
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
9
|
+
* v1.0.0-beta.97
|
10
|
+
*/
|
11
|
+
function gen(counts) {
|
12
|
+
return counts
|
13
|
+
.map((count) => {
|
14
|
+
let out = "";
|
15
|
+
for (let i = 0; i < count; i++) {
|
16
|
+
out += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
17
|
+
}
|
18
|
+
return out;
|
19
|
+
})
|
20
|
+
.join("-");
|
21
|
+
}
|
22
|
+
const guid = () => gen([2, 1, 1, 1, 3]);
|
23
|
+
|
24
|
+
export { guid as g };
|
@@ -0,0 +1,119 @@
|
|
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 } from '@stencil/core/internal/client';
|
7
|
+
import { t as toAriaBoolean } from './dom.js';
|
8
|
+
import { d as defineCustomElement$1 } from './icon.js';
|
9
|
+
|
10
|
+
/*!
|
11
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
12
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
13
|
+
* v1.0.0-beta.97
|
14
|
+
*/
|
15
|
+
const CSS = {
|
16
|
+
handle: "handle",
|
17
|
+
handleActivated: "handle--activated"
|
18
|
+
};
|
19
|
+
const ICONS = {
|
20
|
+
drag: "drag"
|
21
|
+
};
|
22
|
+
|
23
|
+
const handleCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{display:flex}.handle{display:flex;cursor:move;align-items:center;justify-content:center;align-self:stretch;border-style:none;background-color:transparent;outline-color:transparent;color:var(--calcite-ui-border-input);padding-block:0.75rem;padding-inline:0.25rem;line-height:0}.handle:hover{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}.handle:focus{color:var(--calcite-ui-text-1);outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.handle--activated{background-color:var(--calcite-ui-foreground-3);color:var(--calcite-ui-text-1)}.handle calcite-icon{color:inherit}";
|
24
|
+
|
25
|
+
const Handle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
26
|
+
constructor() {
|
27
|
+
super();
|
28
|
+
this.__registerHost();
|
29
|
+
this.__attachShadow();
|
30
|
+
this.calciteHandleNudge = createEvent(this, "calciteHandleNudge", 6);
|
31
|
+
// --------------------------------------------------------------------------
|
32
|
+
//
|
33
|
+
// Properties
|
34
|
+
//
|
35
|
+
// --------------------------------------------------------------------------
|
36
|
+
/**
|
37
|
+
* @internal
|
38
|
+
*/
|
39
|
+
this.activated = false;
|
40
|
+
/**
|
41
|
+
* Value for the button title attribute
|
42
|
+
*/
|
43
|
+
this.textTitle = "handle";
|
44
|
+
// --------------------------------------------------------------------------
|
45
|
+
//
|
46
|
+
// Private Methods
|
47
|
+
//
|
48
|
+
// --------------------------------------------------------------------------
|
49
|
+
this.handleKeyDown = (event) => {
|
50
|
+
switch (event.key) {
|
51
|
+
case " ":
|
52
|
+
this.activated = !this.activated;
|
53
|
+
event.preventDefault();
|
54
|
+
break;
|
55
|
+
case "ArrowUp":
|
56
|
+
case "ArrowDown":
|
57
|
+
if (!this.activated) {
|
58
|
+
return;
|
59
|
+
}
|
60
|
+
event.preventDefault();
|
61
|
+
const direction = event.key.toLowerCase().replace("arrow", "");
|
62
|
+
this.calciteHandleNudge.emit({ handle: this.el, direction });
|
63
|
+
break;
|
64
|
+
}
|
65
|
+
};
|
66
|
+
this.handleBlur = () => {
|
67
|
+
this.activated = false;
|
68
|
+
};
|
69
|
+
}
|
70
|
+
// --------------------------------------------------------------------------
|
71
|
+
//
|
72
|
+
// Methods
|
73
|
+
//
|
74
|
+
// --------------------------------------------------------------------------
|
75
|
+
/** Sets focus on the component. */
|
76
|
+
async setFocus() {
|
77
|
+
var _a;
|
78
|
+
(_a = this.handleButton) === null || _a === void 0 ? void 0 : _a.focus();
|
79
|
+
}
|
80
|
+
// --------------------------------------------------------------------------
|
81
|
+
//
|
82
|
+
// Render Methods
|
83
|
+
//
|
84
|
+
// --------------------------------------------------------------------------
|
85
|
+
render() {
|
86
|
+
return (
|
87
|
+
// Needs to be a span because of https://github.com/SortableJS/Sortable/issues/1486
|
88
|
+
h("span", { "aria-pressed": toAriaBoolean(this.activated), class: { [CSS.handle]: true, [CSS.handleActivated]: this.activated }, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
|
89
|
+
this.handleButton = el;
|
90
|
+
}, role: "button", tabindex: "0", title: this.textTitle }, h("calcite-icon", { icon: ICONS.drag, scale: "s" })));
|
91
|
+
}
|
92
|
+
get el() { return this; }
|
93
|
+
static get style() { return handleCss; }
|
94
|
+
}, [1, "calcite-handle", {
|
95
|
+
"activated": [1540],
|
96
|
+
"textTitle": [513, "text-title"],
|
97
|
+
"setFocus": [64]
|
98
|
+
}]);
|
99
|
+
function defineCustomElement() {
|
100
|
+
if (typeof customElements === "undefined") {
|
101
|
+
return;
|
102
|
+
}
|
103
|
+
const components = ["calcite-handle", "calcite-icon"];
|
104
|
+
components.forEach(tagName => { switch (tagName) {
|
105
|
+
case "calcite-handle":
|
106
|
+
if (!customElements.get(tagName)) {
|
107
|
+
customElements.define(tagName, Handle);
|
108
|
+
}
|
109
|
+
break;
|
110
|
+
case "calcite-icon":
|
111
|
+
if (!customElements.get(tagName)) {
|
112
|
+
defineCustomElement$1();
|
113
|
+
}
|
114
|
+
break;
|
115
|
+
} });
|
116
|
+
}
|
117
|
+
defineCustomElement();
|
118
|
+
|
119
|
+
export { Handle as H, defineCustomElement as d };
|