@esri/solutions-components 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/buffer-tools_6.cjs.entry.js +8 -5
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +2 -2
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +6 -4
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
- package/dist/cjs/{csvUtils-83af7ae1.js → csvUtils-34666909.js} +1 -1
- package/dist/cjs/{interfaces-772edf61.js → interfaces-17c631bf.js} +1 -1
- package/dist/cjs/layer-table.cjs.entry.js +3 -3
- package/dist/cjs/map-card.cjs.entry.js +1 -1
- package/dist/cjs/{mapViewUtils-55ac76cb.js → mapViewUtils-24d1d859.js} +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +16 -10
- package/dist/cjs/solution-configuration.cjs.entry.js +2 -2
- package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
- package/dist/cjs/{solution-store-39726b81.js → solution-store-2dbab624.js} +1 -1
- package/dist/collection/components/buffer-tools/buffer-tools.js +2 -2
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +2 -1
- package/dist/collection/components/public-notification/public-notification.js +14 -8
- package/dist/collection/components/refine-selection/refine-selection.js +4 -2
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.css +1 -0
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +3 -1
- package/dist/collection/demos/new-public-notification.html +2 -1
- package/dist/collection/utils/interfaces.js +1 -1
- package/dist/collection/utils/interfaces.ts +2 -2
- package/dist/components/interfaces3.js +1 -1
- package/dist/components/map-draw-tools2.js +2 -1
- package/dist/components/public-notification.js +14 -8
- package/dist/components/refine-selection-tools2.js +4 -2
- package/dist/components/refine-selection2.js +4 -2
- package/dist/esm/buffer-tools_6.entry.js +8 -5
- package/dist/esm/calcite-combobox_3.entry.js +2 -2
- package/dist/esm/calcite-input-message_5.entry.js +6 -4
- package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
- package/dist/esm/{csvUtils-eb231cfb.js → csvUtils-ae3004b9.js} +1 -1
- package/dist/esm/{interfaces-3b23a5f9.js → interfaces-d0d83efa.js} +1 -1
- package/dist/esm/layer-table.entry.js +3 -3
- package/dist/esm/map-card.entry.js +1 -1
- package/dist/esm/{mapViewUtils-e5d8a1e1.js → mapViewUtils-541e7a3c.js} +1 -1
- package/dist/esm/public-notification.entry.js +16 -10
- package/dist/esm/solution-configuration.entry.js +2 -2
- package/dist/esm/solution-contents_3.entry.js +2 -2
- package/dist/esm/{solution-store-c0bf9200.js → solution-store-41e15f1c.js} +1 -1
- package/dist/solutions-components/demos/new-public-notification.html +2 -1
- package/dist/solutions-components/p-05e64bd1.js +498 -2
- package/dist/solutions-components/p-08a95b33.entry.js +138 -0
- package/dist/solutions-components/p-0da5bbdf.entry.js +91 -0
- package/dist/solutions-components/p-0ef91144.entry.js +913 -0
- package/dist/solutions-components/p-0f523243.entry.js +1916 -0
- package/dist/solutions-components/p-11b9510e.entry.js +173 -0
- package/dist/solutions-components/p-1b875d94.entry.js +58 -0
- package/dist/solutions-components/p-1c567f3a.js +23 -16
- package/dist/solutions-components/p-1c883db9.entry.js +43 -0
- package/dist/solutions-components/p-1f225056.js +322 -0
- package/dist/solutions-components/p-1f499e67.entry.js +72 -0
- package/dist/solutions-components/p-20d3d758.entry.js +881 -0
- package/dist/solutions-components/p-2274ac9e.entry.js +160 -0
- package/dist/solutions-components/p-23ec5ac5.entry.js +93 -0
- package/dist/solutions-components/p-2447798c.entry.js +155 -0
- package/dist/solutions-components/p-2525e691.entry.js +432 -0
- package/dist/solutions-components/p-2561f5b5.js +4092 -0
- package/dist/solutions-components/p-29f887c0.entry.js +234 -0
- package/dist/solutions-components/p-2a0d8047.entry.js +345 -0
- package/dist/solutions-components/p-2c177e6a.entry.js +101 -0
- package/dist/solutions-components/p-2e9ed892.js +46 -1
- package/dist/solutions-components/p-316f56db.js +219 -2
- package/dist/solutions-components/p-327f3ebf.entry.js +98 -0
- package/dist/solutions-components/p-356f8b54.entry.js +138 -0
- package/dist/solutions-components/p-359c58de.entry.js +172 -0
- package/dist/solutions-components/p-37336c0d.entry.js +116 -0
- package/dist/solutions-components/p-374a5031.js +105 -2
- package/dist/solutions-components/p-39ea6ef4.entry.js +71 -0
- package/dist/solutions-components/p-3b010ce1.js +17 -1
- package/dist/solutions-components/p-4307dacd.js +194 -1
- package/dist/solutions-components/p-44da2507.js +405 -14
- package/dist/solutions-components/p-46bdffe8.entry.js +54 -0
- package/dist/solutions-components/p-4894bbeb.js +53 -2
- package/dist/solutions-components/p-4cd569f1.entry.js +1298 -0
- package/dist/solutions-components/p-4d4160f9.entry.js +121 -0
- package/dist/solutions-components/p-4e32bf8c.js +482 -1
- package/dist/solutions-components/p-4e9cbd32.entry.js +184 -0
- package/dist/solutions-components/p-508317b3.js +13 -2
- package/dist/solutions-components/p-54697d58.entry.js +198 -0
- package/dist/solutions-components/p-55c79103.entry.js +311 -0
- package/dist/solutions-components/p-57fd19c0.entry.js +706 -0
- package/dist/solutions-components/p-59b48fde.entry.js +443 -0
- package/dist/solutions-components/p-60e0e6a0.entry.js +214 -0
- package/dist/solutions-components/p-621d0534.entry.js +123 -0
- package/dist/solutions-components/p-63f6e8f1.js +14 -1
- package/dist/solutions-components/p-66aeec57.entry.js +61 -0
- package/dist/solutions-components/p-69834f46.entry.js +618 -0
- package/dist/solutions-components/p-6d9da8e5.entry.js +21530 -0
- package/dist/solutions-components/p-6e0da576.js +13 -1
- package/dist/solutions-components/p-6ec3f294.entry.js +106 -0
- package/dist/solutions-components/p-6fe17794.js +9 -1
- package/dist/solutions-components/p-7024cb16.entry.js +72 -0
- package/dist/solutions-components/p-70535506.entry.js +226 -0
- package/dist/solutions-components/p-708a63a8.js +12 -1
- package/dist/solutions-components/p-729708a3.js +14 -1
- package/dist/solutions-components/p-73e23995.js +6 -1
- package/dist/solutions-components/p-74b29d75.entry.js +231 -0
- package/dist/solutions-components/p-74b7ee25.entry.js +711 -0
- package/dist/solutions-components/p-77182c3a.js +3015 -1
- package/dist/solutions-components/p-78b3ef80.entry.js +456 -0
- package/dist/solutions-components/p-79709c19.js +60 -3
- package/dist/solutions-components/p-7a46ef97.js +181 -2
- package/dist/solutions-components/p-7be159e6.entry.js +175 -0
- package/dist/solutions-components/p-7d4451c2.entry.js +71 -0
- package/dist/solutions-components/p-7daea1df.js +41 -1
- package/dist/solutions-components/p-7e39e5ad.entry.js +102 -0
- package/dist/solutions-components/p-7fb45059.entry.js +43 -0
- package/dist/solutions-components/p-815533de.js +306 -3
- package/dist/solutions-components/p-816622ca.entry.js +248 -0
- package/dist/solutions-components/p-83166522.js +205 -2
- package/dist/solutions-components/p-83bd1991.entry.js +36 -0
- package/dist/solutions-components/p-856464d7.entry.js +572 -0
- package/dist/solutions-components/p-8c349bad.entry.js +347 -0
- package/dist/solutions-components/p-8dccb390.entry.js +1986 -0
- package/dist/solutions-components/p-904c185a.entry.js +228 -0
- package/dist/solutions-components/p-9092f8b3.entry.js +156 -0
- package/dist/solutions-components/p-9371145a.entry.js +477 -0
- package/dist/solutions-components/p-93d3119d.js +1948 -1
- package/dist/solutions-components/p-95ec8062.entry.js +173 -0
- package/dist/solutions-components/p-991ee695.js +109 -1
- package/dist/solutions-components/p-9a57dab7.entry.js +213 -0
- package/dist/solutions-components/p-9a9955db.js +41 -1
- package/dist/solutions-components/p-9c1ebc90.js +35 -16
- package/dist/solutions-components/p-9eba5c66.js +399 -3
- package/dist/solutions-components/p-a033a507.entry.js +252 -0
- package/dist/solutions-components/p-a3773415.entry.js +1132 -0
- package/dist/solutions-components/p-a44fe40f.entry.js +94 -0
- package/dist/solutions-components/p-a5b1ab03.js +33 -3
- package/dist/solutions-components/p-a5b2c13d.entry.js +723 -0
- package/dist/solutions-components/p-a6d729b7.entry.js +85 -0
- package/dist/solutions-components/p-a8005026.entry.js +565 -0
- package/dist/solutions-components/p-a80b3880.js +14 -1
- package/dist/solutions-components/p-a89198a3.entry.js +2620 -0
- package/dist/solutions-components/p-aa04bd1f.entry.js +95 -0
- package/dist/solutions-components/p-aa0a0922.entry.js +80 -0
- package/dist/solutions-components/p-ae1fd76b.js +11 -1
- package/dist/solutions-components/p-b2cf435e.entry.js +87 -0
- package/dist/solutions-components/p-b359dc78.js +41 -1
- package/dist/solutions-components/p-b57bc4eb.entry.js +71 -0
- package/dist/solutions-components/p-b75cc407.entry.js +145 -0
- package/dist/solutions-components/p-b911cb75.entry.js +71 -0
- package/dist/solutions-components/p-b965e177.entry.js +335 -0
- package/dist/solutions-components/p-b978636e.js +14 -1
- package/dist/solutions-components/p-ba10a5c8.entry.js +42 -0
- package/dist/solutions-components/p-bd67334c.js +122 -2
- package/dist/solutions-components/p-bde20dba.entry.js +212 -0
- package/dist/solutions-components/p-be0b5a94.entry.js +248 -0
- package/dist/solutions-components/p-c023e6a1.js +2028 -2
- package/dist/solutions-components/p-c27b0c2d.entry.js +150 -0
- package/dist/solutions-components/p-c579ed60.entry.js +447 -0
- package/dist/solutions-components/p-c92bc231.js +101 -2
- package/dist/solutions-components/p-cc815aca.js +839 -16
- package/dist/solutions-components/p-cc8beabb.entry.js +695 -0
- package/dist/solutions-components/p-cdc46c0c.js +1751 -2
- package/dist/solutions-components/p-d12e6992.entry.js +118 -0
- package/dist/solutions-components/p-d1dfed6b.entry.js +179 -0
- package/dist/solutions-components/p-d48a24e6.js +754 -2
- package/dist/solutions-components/p-d96ee3ef.entry.js +579 -0
- package/dist/solutions-components/p-dbc9a5a8.js +80 -0
- package/dist/solutions-components/p-dcdbe712.entry.js +278 -0
- package/dist/solutions-components/p-de39206f.entry.js +113 -0
- package/dist/solutions-components/p-de5416e8.js +28 -1
- package/dist/solutions-components/p-df420d54.entry.js +213 -0
- package/dist/solutions-components/p-e3138cf0.entry.js +20 -0
- package/dist/solutions-components/p-e4845fec.entry.js +152 -0
- package/dist/solutions-components/p-e611d8c8.js +28 -1
- package/dist/solutions-components/p-e947d3b0.js +5 -1
- package/dist/solutions-components/p-ea534300.js +41 -2
- package/dist/solutions-components/p-ec84ee85.entry.js +55 -0
- package/dist/solutions-components/p-ed36c637.entry.js +85 -0
- package/dist/solutions-components/p-f0add71c.js +74 -0
- package/dist/solutions-components/p-f42e014b.js +171 -2
- package/dist/solutions-components/p-fc02e7de.entry.js +308 -0
- package/dist/solutions-components/p-fc884dd6.js +28 -16
- package/dist/solutions-components/p-fcbfa59c.entry.js +181 -0
- package/dist/solutions-components/p-fdc5cf5f.entry.js +138 -0
- package/dist/solutions-components/solutions-components.esm.js +20 -1
- package/dist/solutions-components/utils/interfaces.ts +2 -2
- package/dist/types/components/buffer-tools/buffer-tools.d.ts +2 -2
- package/dist/types/components/public-notification/public-notification.d.ts +9 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
- package/dist/solutions-components/p-021432b8.entry.js +0 -12
- package/dist/solutions-components/p-03440b1e.entry.js +0 -11
- package/dist/solutions-components/p-0512635b.entry.js +0 -6
- package/dist/solutions-components/p-086ef115.entry.js +0 -29
- package/dist/solutions-components/p-0b4bf57f.entry.js +0 -6
- package/dist/solutions-components/p-0c088725.entry.js +0 -6
- package/dist/solutions-components/p-0f820c08.entry.js +0 -6
- package/dist/solutions-components/p-164780a0.entry.js +0 -6
- package/dist/solutions-components/p-179a68a0.entry.js +0 -6
- package/dist/solutions-components/p-184b5005.entry.js +0 -11
- package/dist/solutions-components/p-1d082fee.entry.js +0 -11
- package/dist/solutions-components/p-1e6c02a2.entry.js +0 -11
- package/dist/solutions-components/p-20a58e62.entry.js +0 -17
- package/dist/solutions-components/p-20b2458c.entry.js +0 -11
- package/dist/solutions-components/p-245d47c1.entry.js +0 -6
- package/dist/solutions-components/p-2cb057a9.entry.js +0 -11
- package/dist/solutions-components/p-2cc72806.entry.js +0 -23
- package/dist/solutions-components/p-2de1db9c.entry.js +0 -11
- package/dist/solutions-components/p-2e9c7055.entry.js +0 -11
- package/dist/solutions-components/p-2ed5e6c8.entry.js +0 -11
- package/dist/solutions-components/p-3109d940.entry.js +0 -6
- package/dist/solutions-components/p-31a8bcfa.entry.js +0 -6
- package/dist/solutions-components/p-3649acb3.entry.js +0 -18
- package/dist/solutions-components/p-3f88ba73.entry.js +0 -6
- package/dist/solutions-components/p-3fa9b3c8.js +0 -36
- package/dist/solutions-components/p-40c41709.entry.js +0 -6
- package/dist/solutions-components/p-40e963c7.entry.js +0 -11
- package/dist/solutions-components/p-40f480da.entry.js +0 -11
- package/dist/solutions-components/p-49d5d2d3.entry.js +0 -11
- package/dist/solutions-components/p-4f7049a4.entry.js +0 -11
- package/dist/solutions-components/p-506e4d78.entry.js +0 -6
- package/dist/solutions-components/p-576fdcab.entry.js +0 -6
- package/dist/solutions-components/p-5bd0cf34.entry.js +0 -23
- package/dist/solutions-components/p-65e177f1.entry.js +0 -6
- package/dist/solutions-components/p-67d710c2.entry.js +0 -6
- package/dist/solutions-components/p-7268b445.entry.js +0 -11
- package/dist/solutions-components/p-75ea4667.entry.js +0 -6
- package/dist/solutions-components/p-778c0a36.entry.js +0 -17
- package/dist/solutions-components/p-7a22509b.entry.js +0 -12
- package/dist/solutions-components/p-7bff51db.entry.js +0 -6
- package/dist/solutions-components/p-7d2d0d5d.entry.js +0 -6
- package/dist/solutions-components/p-7f0036f1.entry.js +0 -11
- package/dist/solutions-components/p-8060fb94.entry.js +0 -6
- package/dist/solutions-components/p-80a1b305.entry.js +0 -6
- package/dist/solutions-components/p-81eae877.entry.js +0 -12
- package/dist/solutions-components/p-84e86b8b.entry.js +0 -6
- package/dist/solutions-components/p-851e04ae.entry.js +0 -6
- package/dist/solutions-components/p-9106950a.entry.js +0 -11
- package/dist/solutions-components/p-979804a4.entry.js +0 -11
- package/dist/solutions-components/p-9862baa8.entry.js +0 -11
- package/dist/solutions-components/p-9b5a9117.entry.js +0 -12
- package/dist/solutions-components/p-9deff0c2.entry.js +0 -6
- package/dist/solutions-components/p-9f400eeb.entry.js +0 -6
- package/dist/solutions-components/p-a0639ad1.entry.js +0 -11
- package/dist/solutions-components/p-a33c044e.entry.js +0 -6
- package/dist/solutions-components/p-a516c658.entry.js +0 -6
- package/dist/solutions-components/p-aa0ef36d.entry.js +0 -11
- package/dist/solutions-components/p-aaccbdf3.entry.js +0 -18
- package/dist/solutions-components/p-ab03a5c9.entry.js +0 -11
- package/dist/solutions-components/p-ad469b92.entry.js +0 -11
- package/dist/solutions-components/p-adc86ac3.entry.js +0 -6
- package/dist/solutions-components/p-addc1156.entry.js +0 -11
- package/dist/solutions-components/p-ae846934.entry.js +0 -11
- package/dist/solutions-components/p-b0572fc4.entry.js +0 -37
- package/dist/solutions-components/p-b4e476b7.js +0 -257
- package/dist/solutions-components/p-b668daf8.js +0 -21
- package/dist/solutions-components/p-b6e6eae1.entry.js +0 -6
- package/dist/solutions-components/p-bc317a7f.entry.js +0 -6
- package/dist/solutions-components/p-be41429f.js +0 -21
- package/dist/solutions-components/p-bf6b6353.entry.js +0 -11
- package/dist/solutions-components/p-c2e3dfbb.entry.js +0 -11
- package/dist/solutions-components/p-c4afae53.entry.js +0 -12
- package/dist/solutions-components/p-c9da1c26.entry.js +0 -6
- package/dist/solutions-components/p-cbf8cd49.entry.js +0 -6
- package/dist/solutions-components/p-cc1a064a.entry.js +0 -11
- package/dist/solutions-components/p-d09a168c.entry.js +0 -6
- package/dist/solutions-components/p-d377f913.entry.js +0 -11
- package/dist/solutions-components/p-d4cefead.entry.js +0 -37
- package/dist/solutions-components/p-d7bc0baf.entry.js +0 -16
- package/dist/solutions-components/p-d8968487.entry.js +0 -11
- package/dist/solutions-components/p-e00a0b86.entry.js +0 -11
- package/dist/solutions-components/p-e9a7ed49.entry.js +0 -11
- package/dist/solutions-components/p-ec27e493.entry.js +0 -11
- package/dist/solutions-components/p-ed6404eb.entry.js +0 -6
- package/dist/solutions-components/p-ef21e195.entry.js +0 -23
- package/dist/solutions-components/p-f6068a2d.entry.js +0 -11
- package/dist/solutions-components/p-f6c4cff3.entry.js +0 -11
- package/dist/solutions-components/p-f847291f.entry.js +0 -6
- package/dist/solutions-components/p-f90fd262.entry.js +0 -11
- package/dist/solutions-components/p-fc973005.entry.js +0 -6
- package/dist/solutions-components/p-ff9fb6bc.entry.js +0 -11
@@ -0,0 +1,572 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './p-c023e6a1.js';
|
7
|
+
import { a as getSlotted, i as isPrimaryPointerButton, s as setRequestedIcon, g as getElementProp, b as getElementDir } from './p-83166522.js';
|
8
|
+
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from './p-bd67334c.js';
|
9
|
+
import { s as submitForm, c as connectForm, d as disconnectForm, H as HiddenFormInputSlot } from './p-316f56db.js';
|
10
|
+
import { n as numberStringFormatter, i as isValidNumber, p as parseNumberString, s as sanitizeNumberString, a as defaultNumberingSystem, u as updateEffectiveLocale, c as connectLocalized, d as disconnectLocalized } from './p-9eba5c66.js';
|
11
|
+
import { n as numberKeys } from './p-73e23995.js';
|
12
|
+
import { T as TEXT$1, C as CSS_UTILITY } from './p-729708a3.js';
|
13
|
+
import { d as decimalPlaces } from './p-63f6e8f1.js';
|
14
|
+
import { c as createObserver } from './p-9a9955db.js';
|
15
|
+
import { u as updateHostInteraction } from './p-7daea1df.js';
|
16
|
+
import './p-a80b3880.js';
|
17
|
+
|
18
|
+
/*!
|
19
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
20
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
21
|
+
* v1.0.0-beta.97
|
22
|
+
*/
|
23
|
+
const CSS = {
|
24
|
+
loader: "loader",
|
25
|
+
clearButton: "clear-button",
|
26
|
+
editingEnabled: "editing-enabled",
|
27
|
+
inlineChild: "inline-child",
|
28
|
+
inputIcon: "icon",
|
29
|
+
prefix: "prefix",
|
30
|
+
suffix: "suffix",
|
31
|
+
numberButtonWrapper: "number-button-wrapper",
|
32
|
+
buttonItemHorizontal: "number-button-item--horizontal",
|
33
|
+
wrapper: "element-wrapper",
|
34
|
+
inputWrapper: "wrapper",
|
35
|
+
actionWrapper: "action-wrapper",
|
36
|
+
resizeIconWrapper: "resize-icon-wrapper",
|
37
|
+
numberButtonItem: "number-button-item"
|
38
|
+
};
|
39
|
+
const SLOTS = {
|
40
|
+
action: "action"
|
41
|
+
};
|
42
|
+
const TEXT = {
|
43
|
+
clear: "Clear value"
|
44
|
+
};
|
45
|
+
|
46
|
+
const inputNumberCss = "@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([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{display:block}:host([scale=s]) input,:host([scale=s]) .prefix,:host([scale=s]) .suffix{block-size:1.5rem;padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=s]) .number-button-wrapper,:host([scale=s]) .action-wrapper calcite-button,:host([scale=s]) .action-wrapper calcite-button button{block-size:1.5rem}:host([scale=s]) .clear-button{min-block-size:1.5rem;min-inline-size:1.5rem}:host([scale=m]) input,:host([scale=m]) .prefix,:host([scale=m]) .suffix{block-size:2rem;padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=m]) .number-button-wrapper,:host([scale=m]) .action-wrapper calcite-button,:host([scale=m]) .action-wrapper calcite-button button{block-size:2rem}:host([scale=m]) .clear-button{min-block-size:2rem;min-inline-size:2rem}:host([scale=l]) input,:host([scale=l]) .prefix,:host([scale=l]) .suffix{block-size:2.75rem;padding-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}:host([scale=l]) .number-button-wrapper,:host([scale=l]) .action-wrapper calcite-button,:host([scale=l]) .action-wrapper calcite-button button{block-size:2.75rem}:host([scale=l]) .clear-button{min-block-size:2.75rem;min-inline-size:2.75rem}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host input{transition:var(--calcite-animation-timing), block-size 0, outline-offset 0s;-webkit-appearance:none;position:relative;margin:0px;box-sizing:border-box;display:flex;max-block-size:100%;inline-size:100%;max-inline-size:100%;flex:1 1 0%;border-radius:0px;background-color:var(--calcite-ui-foreground-1);font-family:inherit;font-weight:var(--calcite-font-weight-normal);border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);color:var(--calcite-ui-text-1)}:host input::placeholder,:host input:-ms-input-placeholder,:host input::-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}:host input:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-1)}:host input[readonly]{background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium)}:host input[readonly]:focus{color:var(--calcite-ui-text-1)}:host calcite-icon{color:var(--calcite-ui-text-3)}:host input{outline-color:transparent}:host input:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host([status=invalid]) input{border-color:var(--calcite-ui-danger)}:host([status=invalid]) input:focus{outline:2px solid var(--calcite-ui-danger);outline-offset:-2px}:host([scale=s]) .icon{inset-inline-start:0.5rem}:host([scale=m]) .icon{inset-inline-start:0.75rem}:host([scale=l]) .icon{inset-inline-start:1rem}:host([icon][scale=s]) input{-webkit-padding-start:2rem;padding-inline-start:2rem}:host([icon][scale=m]) input{-webkit-padding-start:2.5rem;padding-inline-start:2.5rem}:host([icon][scale=l]) input{-webkit-padding-start:3rem;padding-inline-start:3rem}.element-wrapper{position:relative;order:3;display:inline-flex;flex:1 1 0%;align-items:center}.icon{pointer-events:none;position:absolute;z-index:1;display:block;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.clear-button{pointer-events:initial;order:4;margin:0px;box-sizing:border-box;display:flex;min-block-size:100%;cursor:pointer;align-items:center;justify-content:center;align-self:stretch;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);outline-color:transparent;border-inline-start-width:0px}.clear-button:hover{background-color:var(--calcite-ui-foreground-2);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.clear-button:hover calcite-icon{color:var(--calcite-ui-text-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.clear-button:active{background-color:var(--calcite-ui-foreground-3)}.clear-button:active calcite-icon{color:var(--calcite-ui-text-1)}.clear-button:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.clear-button:disabled{opacity:var(--calcite-ui-opacity-disabled)}.loader{inset-block-start:1px;inset-inline:1px;pointer-events:none;position:absolute;display:block}.action-wrapper{order:7;display:flex}.prefix,.suffix{box-sizing:border-box;display:flex;block-size:auto;min-block-size:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-content:center;align-items:center;overflow-wrap:break-word;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium);line-height:1;color:var(--calcite-ui-text-2)}.prefix{order:2;border-inline-end-width:0px}.suffix{order:5;border-inline-start-width:0px}:host([alignment=start]) input{text-align:start}:host([alignment=end]) input{text-align:end}.number-button-wrapper{pointer-events:none;order:6;box-sizing:border-box;display:flex;flex-direction:column;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}:host([number-button-type=vertical]) .wrapper{flex-direction:row;display:flex}:host([number-button-type=vertical]) input{order:2}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=down] calcite-icon{transform:rotate(-90deg)}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=up] calcite-icon{transform:rotate(-90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down],.number-button-item.number-button-item--horizontal[data-adjustment=up]{order:1;max-block-size:100%;min-block-size:100%;align-self:stretch}.number-button-item.number-button-item--horizontal[data-adjustment=down] calcite-icon,.number-button-item.number-button-item--horizontal[data-adjustment=up] calcite-icon{transform:rotate(90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down]{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);border-inline-end-width:0px}.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover{background-color:var(--calcite-ui-foreground-2)}.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover calcite-icon{color:var(--calcite-ui-text-1)}.number-button-item.number-button-item--horizontal[data-adjustment=up]{order:5}.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover{background-color:var(--calcite-ui-foreground-2)}.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover{background-color:var(--calcite-ui-foreground-2)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover{background-color:var(--calcite-ui-foreground-2)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]{border-block-start-width:0px}.number-button-item{max-block-size:50%;min-block-size:50%;pointer-events:initial;margin:0px;box-sizing:border-box;display:flex;cursor:pointer;align-items:center;align-self:center;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);padding-block:0px;padding-inline:0.5rem;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-inline-start-width:0px}.number-button-item calcite-icon{pointer-events:none;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.number-button-item:focus{background-color:var(--calcite-ui-foreground-2)}.number-button-item:focus calcite-icon{color:var(--calcite-ui-text-1)}.number-button-item:active{background-color:var(--calcite-ui-foreground-3)}.number-button-item:disabled{pointer-events:none}.wrapper{position:relative;display:flex;flex-direction:row;align-items:center}:host(.no-bottom-border) input{border-block-end-width:0px}:host(.border-top-color-one) input{border-block-start-color:var(--calcite-ui-border-1)}:host .inline-child{background-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}:host .inline-child .editing-enabled{background-color:inherit}:host .inline-child:not(.editing-enabled){display:flex;cursor:pointer;border-color:transparent;-webkit-padding-start:0;padding-inline-start:0}::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}";
|
47
|
+
|
48
|
+
const InputNumber = class {
|
49
|
+
constructor(hostRef) {
|
50
|
+
registerInstance(this, hostRef);
|
51
|
+
this.calciteInternalInputNumberFocus = createEvent(this, "calciteInternalInputNumberFocus", 6);
|
52
|
+
this.calciteInternalInputNumberBlur = createEvent(this, "calciteInternalInputNumberBlur", 6);
|
53
|
+
this.calciteInputNumberInput = createEvent(this, "calciteInputNumberInput", 7);
|
54
|
+
this.calciteInputNumberChange = createEvent(this, "calciteInputNumberChange", 6);
|
55
|
+
//--------------------------------------------------------------------------
|
56
|
+
//
|
57
|
+
// Properties
|
58
|
+
//
|
59
|
+
//--------------------------------------------------------------------------
|
60
|
+
/** Specifies the text alignment of the component's value. */
|
61
|
+
this.alignment = "start";
|
62
|
+
/**
|
63
|
+
* When `true`, the component is focused on page load.
|
64
|
+
*
|
65
|
+
* @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
66
|
+
*/
|
67
|
+
this.autofocus = false;
|
68
|
+
/**
|
69
|
+
* When `true`, a clear button is displayed when the component has a value.
|
70
|
+
*/
|
71
|
+
this.clearable = false;
|
72
|
+
/**
|
73
|
+
* When `true`, interaction is prevented and the component is displayed with lower opacity.
|
74
|
+
*
|
75
|
+
* @mdn [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled)
|
76
|
+
*/
|
77
|
+
this.disabled = false;
|
78
|
+
/**
|
79
|
+
* When `true`, number values are displayed with a group separator corresponding to the language and country format.
|
80
|
+
*/
|
81
|
+
this.groupSeparator = false;
|
82
|
+
/**
|
83
|
+
* When `true`, the component will not be visible.
|
84
|
+
*
|
85
|
+
* @mdn [hidden](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden)
|
86
|
+
*/
|
87
|
+
this.hidden = false;
|
88
|
+
/**
|
89
|
+
* Accessible name that will appear while loading.
|
90
|
+
*
|
91
|
+
* @default "Loading"
|
92
|
+
*/
|
93
|
+
this.intlLoading = TEXT$1.loading;
|
94
|
+
/** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
|
95
|
+
this.iconFlipRtl = false;
|
96
|
+
/** When `true`, the component is in the loading state and `calcite-progress` is displayed. */
|
97
|
+
this.loading = false;
|
98
|
+
/**
|
99
|
+
* Toggles locale formatting for numbers.
|
100
|
+
*
|
101
|
+
* @internal
|
102
|
+
*/
|
103
|
+
this.localeFormat = false;
|
104
|
+
/** Specifies the placement of the buttons. */
|
105
|
+
this.numberButtonType = "vertical";
|
106
|
+
/**
|
107
|
+
* When `true`, the component's value can be read, but cannot be modified.
|
108
|
+
*
|
109
|
+
* @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
|
110
|
+
*/
|
111
|
+
this.readOnly = false;
|
112
|
+
/** When `true`, the component must have a value in order for the form to submit. */
|
113
|
+
this.required = false;
|
114
|
+
/** Specifies the size of the component. */
|
115
|
+
this.scale = "m";
|
116
|
+
/** Specifies the status of the input field, which determines message and icons. */
|
117
|
+
this.status = "idle";
|
118
|
+
/**
|
119
|
+
* @internal
|
120
|
+
*/
|
121
|
+
this.editingEnabled = false;
|
122
|
+
/** The component's value. */
|
123
|
+
this.value = "";
|
124
|
+
this.previousValueOrigin = "initial";
|
125
|
+
this.mutationObserver = createObserver("mutation", () => this.setDisabledAction());
|
126
|
+
this.userChangedValue = false;
|
127
|
+
//--------------------------------------------------------------------------
|
128
|
+
//
|
129
|
+
// State
|
130
|
+
//
|
131
|
+
//--------------------------------------------------------------------------
|
132
|
+
this.effectiveLocale = "";
|
133
|
+
//--------------------------------------------------------------------------
|
134
|
+
//
|
135
|
+
// Private Methods
|
136
|
+
//
|
137
|
+
//--------------------------------------------------------------------------
|
138
|
+
this.keyDownHandler = (event) => {
|
139
|
+
if (this.readOnly || this.disabled) {
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
if (this.isClearable && event.key === "Escape") {
|
143
|
+
this.clearInputValue(event);
|
144
|
+
event.preventDefault();
|
145
|
+
}
|
146
|
+
if (event.key === "Enter" && !event.defaultPrevented) {
|
147
|
+
if (submitForm(this)) {
|
148
|
+
event.preventDefault();
|
149
|
+
}
|
150
|
+
}
|
151
|
+
};
|
152
|
+
this.clearInputValue = (nativeEvent) => {
|
153
|
+
this.setNumberValue({
|
154
|
+
committing: true,
|
155
|
+
nativeEvent,
|
156
|
+
origin: "user",
|
157
|
+
value: ""
|
158
|
+
});
|
159
|
+
};
|
160
|
+
this.emitChangeIfUserModified = () => {
|
161
|
+
if (this.previousValueOrigin === "user" && this.value !== this.previousEmittedValue) {
|
162
|
+
this.calciteInputNumberChange.emit();
|
163
|
+
}
|
164
|
+
this.previousEmittedValue = this.value;
|
165
|
+
};
|
166
|
+
this.inputNumberBlurHandler = () => {
|
167
|
+
this.calciteInternalInputNumberBlur.emit();
|
168
|
+
this.emitChangeIfUserModified();
|
169
|
+
};
|
170
|
+
this.inputNumberFocusHandler = (event) => {
|
171
|
+
const slottedActionEl = getSlotted(this.el, "action");
|
172
|
+
if (event.target !== slottedActionEl) {
|
173
|
+
this.setFocus();
|
174
|
+
}
|
175
|
+
this.calciteInternalInputNumberFocus.emit();
|
176
|
+
};
|
177
|
+
this.inputNumberInputHandler = (nativeEvent) => {
|
178
|
+
if (this.disabled || this.readOnly) {
|
179
|
+
return;
|
180
|
+
}
|
181
|
+
const value = nativeEvent.target.value;
|
182
|
+
numberStringFormatter.numberFormatOptions = {
|
183
|
+
locale: this.effectiveLocale,
|
184
|
+
numberingSystem: this.numberingSystem,
|
185
|
+
useGrouping: this.groupSeparator
|
186
|
+
};
|
187
|
+
const delocalizedValue = numberStringFormatter.delocalize(value);
|
188
|
+
if (nativeEvent.inputType === "insertFromPaste") {
|
189
|
+
if (!isValidNumber(delocalizedValue)) {
|
190
|
+
nativeEvent.preventDefault();
|
191
|
+
}
|
192
|
+
this.setNumberValue({
|
193
|
+
nativeEvent,
|
194
|
+
origin: "user",
|
195
|
+
value: parseNumberString(delocalizedValue)
|
196
|
+
});
|
197
|
+
this.childNumberEl.value = this.localizedValue;
|
198
|
+
}
|
199
|
+
else {
|
200
|
+
this.setNumberValue({
|
201
|
+
nativeEvent,
|
202
|
+
origin: "user",
|
203
|
+
value: delocalizedValue
|
204
|
+
});
|
205
|
+
}
|
206
|
+
};
|
207
|
+
this.inputNumberKeyDownHandler = (event) => {
|
208
|
+
if (this.disabled || this.readOnly) {
|
209
|
+
return;
|
210
|
+
}
|
211
|
+
if (event.key === "ArrowUp") {
|
212
|
+
/* prevent default behavior of moving cursor to the beginning of the input when holding down ArrowUp */
|
213
|
+
event.preventDefault();
|
214
|
+
this.nudgeNumberValue("up", event);
|
215
|
+
return;
|
216
|
+
}
|
217
|
+
if (event.key === "ArrowDown") {
|
218
|
+
this.nudgeNumberValue("down", event);
|
219
|
+
return;
|
220
|
+
}
|
221
|
+
const supportedKeys = [
|
222
|
+
...numberKeys,
|
223
|
+
"ArrowLeft",
|
224
|
+
"ArrowRight",
|
225
|
+
"Backspace",
|
226
|
+
"Delete",
|
227
|
+
"Enter",
|
228
|
+
"Escape",
|
229
|
+
"Tab"
|
230
|
+
];
|
231
|
+
if (event.altKey || event.ctrlKey || event.metaKey) {
|
232
|
+
return;
|
233
|
+
}
|
234
|
+
const isShiftTabEvent = event.shiftKey && event.key === "Tab";
|
235
|
+
if (supportedKeys.includes(event.key) && (!event.shiftKey || isShiftTabEvent)) {
|
236
|
+
if (event.key === "Enter") {
|
237
|
+
this.emitChangeIfUserModified();
|
238
|
+
}
|
239
|
+
return;
|
240
|
+
}
|
241
|
+
numberStringFormatter.numberFormatOptions = {
|
242
|
+
locale: this.effectiveLocale,
|
243
|
+
numberingSystem: this.numberingSystem,
|
244
|
+
useGrouping: this.groupSeparator
|
245
|
+
};
|
246
|
+
if (event.key === numberStringFormatter.decimal) {
|
247
|
+
if (!this.value && !this.childNumberEl.value) {
|
248
|
+
return;
|
249
|
+
}
|
250
|
+
if (this.value && this.childNumberEl.value.indexOf(numberStringFormatter.decimal) === -1) {
|
251
|
+
return;
|
252
|
+
}
|
253
|
+
}
|
254
|
+
if (/[eE]/.test(event.key)) {
|
255
|
+
if (!this.value && !this.childNumberEl.value) {
|
256
|
+
return;
|
257
|
+
}
|
258
|
+
if (this.value && !/[eE]/.test(this.childNumberEl.value)) {
|
259
|
+
return;
|
260
|
+
}
|
261
|
+
}
|
262
|
+
if (event.key === "-") {
|
263
|
+
if (!this.value && !this.childNumberEl.value) {
|
264
|
+
return;
|
265
|
+
}
|
266
|
+
if (this.value && this.childNumberEl.value.split("-").length <= 2) {
|
267
|
+
return;
|
268
|
+
}
|
269
|
+
}
|
270
|
+
event.preventDefault();
|
271
|
+
};
|
272
|
+
this.nudgeNumberValue = (direction, nativeEvent) => {
|
273
|
+
if (nativeEvent instanceof KeyboardEvent && nativeEvent.repeat) {
|
274
|
+
return;
|
275
|
+
}
|
276
|
+
const inputMax = this.maxString ? parseFloat(this.maxString) : null;
|
277
|
+
const inputMin = this.minString ? parseFloat(this.minString) : null;
|
278
|
+
const valueNudgeDelayInMs = 100;
|
279
|
+
this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
|
280
|
+
if (this.nudgeNumberValueIntervalId) {
|
281
|
+
window.clearInterval(this.nudgeNumberValueIntervalId);
|
282
|
+
}
|
283
|
+
let firstValueNudge = true;
|
284
|
+
this.nudgeNumberValueIntervalId = window.setInterval(() => {
|
285
|
+
if (firstValueNudge) {
|
286
|
+
firstValueNudge = false;
|
287
|
+
return;
|
288
|
+
}
|
289
|
+
this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
|
290
|
+
}, valueNudgeDelayInMs);
|
291
|
+
};
|
292
|
+
this.nudgeButtonPointerUpAndOutHandler = (event) => {
|
293
|
+
if (!isPrimaryPointerButton(event)) {
|
294
|
+
return;
|
295
|
+
}
|
296
|
+
window.clearInterval(this.nudgeNumberValueIntervalId);
|
297
|
+
};
|
298
|
+
this.nudgeButtonPointerDownHandler = (event) => {
|
299
|
+
if (!isPrimaryPointerButton(event)) {
|
300
|
+
return;
|
301
|
+
}
|
302
|
+
event.preventDefault();
|
303
|
+
const direction = event.target.dataset.adjustment;
|
304
|
+
if (!this.disabled) {
|
305
|
+
this.nudgeNumberValue(direction, event);
|
306
|
+
}
|
307
|
+
};
|
308
|
+
this.hiddenInputChangeHandler = (event) => {
|
309
|
+
if (event.target.name === this.name) {
|
310
|
+
this.setNumberValue({
|
311
|
+
value: event.target.value,
|
312
|
+
origin: "direct"
|
313
|
+
});
|
314
|
+
}
|
315
|
+
event.stopPropagation();
|
316
|
+
};
|
317
|
+
this.setChildNumberElRef = (el) => {
|
318
|
+
this.childNumberEl = el;
|
319
|
+
};
|
320
|
+
this.setInputNumberValue = (newInputValue) => {
|
321
|
+
if (!this.childNumberEl) {
|
322
|
+
return;
|
323
|
+
}
|
324
|
+
this.childNumberEl.value = newInputValue;
|
325
|
+
};
|
326
|
+
this.setPreviousEmittedNumberValue = (newPreviousEmittedValue) => {
|
327
|
+
this.previousEmittedValue = isValidNumber(newPreviousEmittedValue)
|
328
|
+
? newPreviousEmittedValue
|
329
|
+
: "";
|
330
|
+
};
|
331
|
+
this.setPreviousNumberValue = (newPreviousValue) => {
|
332
|
+
this.previousValue = isValidNumber(newPreviousValue) ? newPreviousValue : "";
|
333
|
+
};
|
334
|
+
this.setNumberValue = ({ committing = false, nativeEvent, origin, previousValue, value }) => {
|
335
|
+
numberStringFormatter.numberFormatOptions = {
|
336
|
+
locale: this.effectiveLocale,
|
337
|
+
numberingSystem: this.numberingSystem,
|
338
|
+
useGrouping: this.groupSeparator
|
339
|
+
};
|
340
|
+
const sanitizedValue = sanitizeNumberString((this.numberingSystem && this.numberingSystem !== "latn") || defaultNumberingSystem !== "latn"
|
341
|
+
? numberStringFormatter.delocalize(value)
|
342
|
+
: value);
|
343
|
+
const newValue = value && !sanitizedValue
|
344
|
+
? isValidNumber(this.previousValue)
|
345
|
+
? this.previousValue
|
346
|
+
: ""
|
347
|
+
: sanitizedValue;
|
348
|
+
const newLocalizedValue = numberStringFormatter.localize(newValue);
|
349
|
+
this.setPreviousNumberValue(previousValue || this.value);
|
350
|
+
this.previousValueOrigin = origin;
|
351
|
+
this.userChangedValue = origin === "user" && this.value !== newValue;
|
352
|
+
this.value = newValue;
|
353
|
+
this.localizedValue = newLocalizedValue;
|
354
|
+
if (origin === "direct") {
|
355
|
+
this.setInputNumberValue(newLocalizedValue);
|
356
|
+
}
|
357
|
+
if (nativeEvent) {
|
358
|
+
const calciteInputNumberInputEvent = this.calciteInputNumberInput.emit({
|
359
|
+
element: this.childNumberEl,
|
360
|
+
nativeEvent,
|
361
|
+
value: this.value
|
362
|
+
});
|
363
|
+
if (calciteInputNumberInputEvent.defaultPrevented) {
|
364
|
+
const previousLocalizedValue = numberStringFormatter.localize(this.previousValue);
|
365
|
+
this.value = this.previousValue;
|
366
|
+
this.localizedValue = previousLocalizedValue;
|
367
|
+
}
|
368
|
+
else if (committing) {
|
369
|
+
this.emitChangeIfUserModified();
|
370
|
+
}
|
371
|
+
}
|
372
|
+
};
|
373
|
+
this.inputNumberKeyUpHandler = () => {
|
374
|
+
window.clearInterval(this.nudgeNumberValueIntervalId);
|
375
|
+
};
|
376
|
+
}
|
377
|
+
disabledWatcher() {
|
378
|
+
this.setDisabledAction();
|
379
|
+
}
|
380
|
+
localeChanged() {
|
381
|
+
updateEffectiveLocale(this);
|
382
|
+
}
|
383
|
+
/** watcher to update number-to-string for max */
|
384
|
+
maxWatcher() {
|
385
|
+
var _a;
|
386
|
+
this.maxString = ((_a = this.max) === null || _a === void 0 ? void 0 : _a.toString()) || null;
|
387
|
+
}
|
388
|
+
/** watcher to update number-to-string for min */
|
389
|
+
minWatcher() {
|
390
|
+
var _a;
|
391
|
+
this.minString = ((_a = this.min) === null || _a === void 0 ? void 0 : _a.toString()) || null;
|
392
|
+
}
|
393
|
+
valueWatcher(newValue, previousValue) {
|
394
|
+
if (!this.userChangedValue) {
|
395
|
+
this.setNumberValue({
|
396
|
+
origin: "direct",
|
397
|
+
previousValue,
|
398
|
+
value: newValue == null || newValue == ""
|
399
|
+
? ""
|
400
|
+
: isValidNumber(newValue)
|
401
|
+
? newValue
|
402
|
+
: this.previousValue || ""
|
403
|
+
});
|
404
|
+
this.warnAboutInvalidNumberValue(newValue);
|
405
|
+
}
|
406
|
+
this.userChangedValue = false;
|
407
|
+
}
|
408
|
+
updateRequestedIcon() {
|
409
|
+
this.requestedIcon = setRequestedIcon({}, this.icon, "number");
|
410
|
+
}
|
411
|
+
get isClearable() {
|
412
|
+
return this.clearable && this.value.length > 0;
|
413
|
+
}
|
414
|
+
//--------------------------------------------------------------------------
|
415
|
+
//
|
416
|
+
// Lifecycle
|
417
|
+
//
|
418
|
+
//--------------------------------------------------------------------------
|
419
|
+
connectedCallback() {
|
420
|
+
var _a;
|
421
|
+
connectLocalized(this);
|
422
|
+
this.scale = getElementProp(this.el, "scale", this.scale);
|
423
|
+
this.status = getElementProp(this.el, "status", this.status);
|
424
|
+
this.inlineEditableEl = this.el.closest("calcite-inline-editable");
|
425
|
+
if (this.inlineEditableEl) {
|
426
|
+
this.editingEnabled = this.inlineEditableEl.editingEnabled || false;
|
427
|
+
}
|
428
|
+
connectLabel(this);
|
429
|
+
connectForm(this);
|
430
|
+
this.setPreviousEmittedNumberValue(this.value);
|
431
|
+
this.setPreviousNumberValue(this.value);
|
432
|
+
this.warnAboutInvalidNumberValue(this.value);
|
433
|
+
this.setNumberValue({
|
434
|
+
origin: "connected",
|
435
|
+
value: isValidNumber(this.value) ? this.value : ""
|
436
|
+
});
|
437
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
|
438
|
+
this.setDisabledAction();
|
439
|
+
this.el.addEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
|
440
|
+
}
|
441
|
+
disconnectedCallback() {
|
442
|
+
var _a;
|
443
|
+
disconnectLabel(this);
|
444
|
+
disconnectForm(this);
|
445
|
+
disconnectLocalized(this);
|
446
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
447
|
+
this.el.removeEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
|
448
|
+
}
|
449
|
+
componentWillLoad() {
|
450
|
+
var _a, _b;
|
451
|
+
this.maxString = (_a = this.max) === null || _a === void 0 ? void 0 : _a.toString();
|
452
|
+
this.minString = (_b = this.min) === null || _b === void 0 ? void 0 : _b.toString();
|
453
|
+
this.requestedIcon = setRequestedIcon({}, this.icon, "number");
|
454
|
+
}
|
455
|
+
componentShouldUpdate(newValue, oldValue, property) {
|
456
|
+
if (property === "value" && newValue && !isValidNumber(newValue)) {
|
457
|
+
this.setNumberValue({
|
458
|
+
origin: "reset",
|
459
|
+
value: oldValue
|
460
|
+
});
|
461
|
+
return false;
|
462
|
+
}
|
463
|
+
return true;
|
464
|
+
}
|
465
|
+
componentDidRender() {
|
466
|
+
updateHostInteraction(this);
|
467
|
+
}
|
468
|
+
//--------------------------------------------------------------------------
|
469
|
+
//
|
470
|
+
// Public Methods
|
471
|
+
//
|
472
|
+
//--------------------------------------------------------------------------
|
473
|
+
/** Sets focus on the component. */
|
474
|
+
async setFocus() {
|
475
|
+
var _a;
|
476
|
+
(_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.focus();
|
477
|
+
}
|
478
|
+
/** Selects all text of the component's `value`. */
|
479
|
+
async selectText() {
|
480
|
+
var _a;
|
481
|
+
(_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.select();
|
482
|
+
}
|
483
|
+
onLabelClick() {
|
484
|
+
this.setFocus();
|
485
|
+
}
|
486
|
+
incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent) {
|
487
|
+
const { value } = this;
|
488
|
+
const inputStep = this.step === "any" ? 1 : Math.abs(this.step || 1);
|
489
|
+
const inputVal = value && value !== "" ? parseFloat(value) : 0;
|
490
|
+
const adjustment = direction === "up" ? 1 : -1;
|
491
|
+
const nudgedValue = inputVal + inputStep * adjustment;
|
492
|
+
const finalValue = (typeof inputMin === "number" && !isNaN(inputMin) && nudgedValue < inputMin) ||
|
493
|
+
(typeof inputMax === "number" && !isNaN(inputMax) && nudgedValue > inputMax)
|
494
|
+
? inputVal
|
495
|
+
: nudgedValue;
|
496
|
+
const inputValPlaces = decimalPlaces(inputVal);
|
497
|
+
const inputStepPlaces = decimalPlaces(inputStep);
|
498
|
+
this.setNumberValue({
|
499
|
+
committing: true,
|
500
|
+
nativeEvent,
|
501
|
+
origin: "user",
|
502
|
+
value: finalValue.toFixed(Math.max(inputValPlaces, inputStepPlaces))
|
503
|
+
});
|
504
|
+
}
|
505
|
+
onFormReset() {
|
506
|
+
this.setNumberValue({
|
507
|
+
origin: "reset",
|
508
|
+
value: this.defaultValue
|
509
|
+
});
|
510
|
+
}
|
511
|
+
syncHiddenFormInput(input) {
|
512
|
+
var _a, _b, _c, _d;
|
513
|
+
input.type = "number";
|
514
|
+
input.min = (_b = (_a = this.min) === null || _a === void 0 ? void 0 : _a.toString(10)) !== null && _b !== void 0 ? _b : "";
|
515
|
+
input.max = (_d = (_c = this.max) === null || _c === void 0 ? void 0 : _c.toString(10)) !== null && _d !== void 0 ? _d : "";
|
516
|
+
}
|
517
|
+
setDisabledAction() {
|
518
|
+
const slottedActionEl = getSlotted(this.el, "action");
|
519
|
+
if (!slottedActionEl) {
|
520
|
+
return;
|
521
|
+
}
|
522
|
+
this.disabled
|
523
|
+
? slottedActionEl.setAttribute("disabled", "")
|
524
|
+
: slottedActionEl.removeAttribute("disabled");
|
525
|
+
}
|
526
|
+
warnAboutInvalidNumberValue(value) {
|
527
|
+
if (value && !isValidNumber(value)) {
|
528
|
+
console.warn(`The specified value "${value}" cannot be parsed, or is out of range.`);
|
529
|
+
}
|
530
|
+
}
|
531
|
+
// --------------------------------------------------------------------------
|
532
|
+
//
|
533
|
+
// Render Methods
|
534
|
+
//
|
535
|
+
// --------------------------------------------------------------------------
|
536
|
+
render() {
|
537
|
+
const dir = getElementDir(this.el);
|
538
|
+
const loader = (h("div", { class: CSS.loader }, h("calcite-progress", { label: this.intlLoading, type: "indeterminate" })));
|
539
|
+
const inputClearButton = (h("button", { "aria-label": this.intlClear || TEXT.clear, class: CSS.clearButton, disabled: this.disabled || this.readOnly, onClick: this.clearInputValue, tabIndex: -1, type: "button" }, h("calcite-icon", { icon: "x", scale: "s" })));
|
540
|
+
const iconEl = (h("calcite-icon", { class: CSS.inputIcon, flipRtl: this.iconFlipRtl, icon: this.requestedIcon, scale: "s" }));
|
541
|
+
const isHorizontalNumberButton = this.numberButtonType === "horizontal";
|
542
|
+
const numberButtonsHorizontalUp = (h("button", { "aria-hidden": "true", class: {
|
543
|
+
[CSS.numberButtonItem]: true,
|
544
|
+
[CSS.buttonItemHorizontal]: isHorizontalNumberButton
|
545
|
+
}, "data-adjustment": "up", disabled: this.disabled || this.readOnly, onPointerDown: this.nudgeButtonPointerDownHandler, onPointerOut: this.nudgeButtonPointerUpAndOutHandler, onPointerUp: this.nudgeButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, h("calcite-icon", { icon: "chevron-up", scale: "s" })));
|
546
|
+
const numberButtonsHorizontalDown = (h("button", { "aria-hidden": "true", class: {
|
547
|
+
[CSS.numberButtonItem]: true,
|
548
|
+
[CSS.buttonItemHorizontal]: isHorizontalNumberButton
|
549
|
+
}, "data-adjustment": "down", disabled: this.disabled || this.readOnly, onPointerDown: this.nudgeButtonPointerDownHandler, onPointerOut: this.nudgeButtonPointerUpAndOutHandler, onPointerUp: this.nudgeButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, h("calcite-icon", { icon: "chevron-down", scale: "s" })));
|
550
|
+
const numberButtonsVertical = (h("div", { class: CSS.numberButtonWrapper }, numberButtonsHorizontalUp, numberButtonsHorizontalDown));
|
551
|
+
const prefixText = h("div", { class: CSS.prefix }, this.prefixText);
|
552
|
+
const suffixText = h("div", { class: CSS.suffix }, this.suffixText);
|
553
|
+
const childEl = (h("input", { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, key: "localized-input", maxLength: this.maxLength, minLength: this.minLength, name: undefined, onBlur: this.inputNumberBlurHandler, onFocus: this.inputNumberFocusHandler, onInput: this.inputNumberInputHandler, onKeyDown: this.inputNumberKeyDownHandler, onKeyUp: this.inputNumberKeyUpHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildNumberElRef, type: "text", value: this.localizedValue }));
|
554
|
+
return (h(Host, { onClick: this.inputNumberFocusHandler, onKeyDown: this.keyDownHandler }, h("div", { class: { [CSS.inputWrapper]: true, [CSS_UTILITY.rtl]: dir === "rtl" } }, this.numberButtonType === "horizontal" && !this.readOnly
|
555
|
+
? numberButtonsHorizontalDown
|
556
|
+
: null, this.prefixText ? prefixText : null, h("div", { class: CSS.wrapper }, childEl, this.isClearable ? inputClearButton : null, this.requestedIcon ? iconEl : null, this.loading ? loader : null), h("div", { class: CSS.actionWrapper }, h("slot", { name: SLOTS.action })), this.numberButtonType === "vertical" && !this.readOnly ? numberButtonsVertical : null, this.suffixText ? suffixText : null, this.numberButtonType === "horizontal" && !this.readOnly
|
557
|
+
? numberButtonsHorizontalUp
|
558
|
+
: null, h(HiddenFormInputSlot, { component: this }))));
|
559
|
+
}
|
560
|
+
get el() { return getElement(this); }
|
561
|
+
static get watchers() { return {
|
562
|
+
"disabled": ["disabledWatcher"],
|
563
|
+
"locale": ["localeChanged"],
|
564
|
+
"max": ["maxWatcher"],
|
565
|
+
"min": ["minWatcher"],
|
566
|
+
"value": ["valueWatcher"],
|
567
|
+
"icon": ["updateRequestedIcon"]
|
568
|
+
}; }
|
569
|
+
};
|
570
|
+
InputNumber.style = inputNumberCss;
|
571
|
+
|
572
|
+
export { InputNumber as calcite_input_number };
|