@ui5/webcomponents 2.26.0 → 2.27.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/Avatar.d.ts +7 -0
- package/dist/Avatar.js +18 -5
- package/dist/Avatar.js.map +1 -1
- package/dist/ComboBoxItemGroup.d.ts +2 -0
- package/dist/ComboBoxItemGroup.js +2 -0
- package/dist/ComboBoxItemGroup.js.map +1 -1
- package/dist/DatePicker.d.ts +14 -0
- package/dist/DatePicker.js +14 -0
- package/dist/DatePicker.js.map +1 -1
- package/dist/ListBoxItemGroupTemplate.js +1 -1
- package/dist/ListBoxItemGroupTemplate.js.map +1 -1
- package/dist/ListItemBaseTemplate.d.ts +2 -0
- package/dist/ListItemBaseTemplate.js +1 -1
- package/dist/ListItemBaseTemplate.js.map +1 -1
- package/dist/MultiComboBoxItemGroup.d.ts +2 -0
- package/dist/MultiComboBoxItemGroup.js +2 -0
- package/dist/MultiComboBoxItemGroup.js.map +1 -1
- package/dist/NumberInput.d.ts +271 -0
- package/dist/NumberInput.js +719 -0
- package/dist/NumberInput.js.map +1 -0
- package/dist/NumberInputTemplate.d.ts +2 -0
- package/dist/NumberInputTemplate.js +18 -0
- package/dist/NumberInputTemplate.js.map +1 -0
- package/dist/Option.d.ts +10 -0
- package/dist/Option.js +6 -0
- package/dist/Option.js.map +1 -1
- package/dist/OptionGroup.d.ts +34 -0
- package/dist/OptionGroup.js +61 -0
- package/dist/OptionGroup.js.map +1 -0
- package/dist/OptionGroupTemplate.d.ts +2 -0
- package/dist/OptionGroupTemplate.js +6 -0
- package/dist/OptionGroupTemplate.js.map +1 -0
- package/dist/OptionTemplate.js +6 -1
- package/dist/OptionTemplate.js.map +1 -1
- package/dist/Select.d.ts +19 -2
- package/dist/Select.js +79 -28
- package/dist/Select.js.map +1 -1
- package/dist/SelectPopoverTemplate.js +1 -1
- package/dist/SelectPopoverTemplate.js.map +1 -1
- package/dist/SelectTemplate.js +2 -1
- package/dist/SelectTemplate.js.map +1 -1
- package/dist/StepInput.d.ts +14 -127
- package/dist/StepInput.js +40 -472
- package/dist/StepInput.js.map +1 -1
- package/dist/StepInputTemplate.js +4 -15
- package/dist/StepInputTemplate.js.map +1 -1
- package/dist/SuggestionItemGroup.d.ts +2 -0
- package/dist/SuggestionItemGroup.js +2 -0
- package/dist/SuggestionItemGroup.js.map +1 -1
- package/dist/bundle.esm.js +2 -0
- package/dist/bundle.esm.js.map +1 -1
- package/dist/css/themes/NumberInput.css +1 -0
- package/dist/css/themes/OptionGroup.css +1 -0
- package/dist/css/themes/StepInput.css +1 -1
- package/dist/css/themes/TimePickerClock.css +1 -1
- package/dist/css/themes/TimeSelectionClocks.css +1 -1
- package/dist/css/themes/sap_fiori_3/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_fiori_3_dark/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_fiori_3_hcb/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_fiori_3_hcw/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon_auto/parameters-bundle.css +30 -22
- package/dist/css/themes/sap_horizon_dark/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon_hc_auto/parameters-bundle.css +31 -24
- package/dist/css/themes/sap_horizon_hcb/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon_hcw/parameters-bundle.css +1 -1
- package/dist/custom-elements-internal.json +734 -142
- package/dist/custom-elements.json +666 -182
- package/dist/generated/assets/i18n/messagebundle_de.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_pl.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ru.json +1 -1
- package/dist/generated/assets/themes/sap_fiori_3/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_fiori_3_dark/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_fiori_3_hcb/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_fiori_3_hcw/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_auto/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_dark/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_hc_auto/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_hcb/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_hcw/parameters-bundle.css.json +1 -1
- package/dist/generated/i18n/i18n-defaults.d.ts +7 -6
- package/dist/generated/i18n/i18n-defaults.js +7 -6
- package/dist/generated/i18n/i18n-defaults.js.map +1 -1
- package/dist/generated/themes/NumberInput.css.d.ts +2 -0
- package/dist/generated/themes/NumberInput.css.js +8 -0
- package/dist/generated/themes/NumberInput.css.js.map +1 -0
- package/dist/generated/themes/OptionGroup.css.d.ts +2 -0
- package/dist/generated/themes/OptionGroup.css.js +8 -0
- package/dist/generated/themes/OptionGroup.css.js.map +1 -0
- package/dist/generated/themes/StepInput.css.d.ts +1 -1
- package/dist/generated/themes/StepInput.css.js +1 -1
- package/dist/generated/themes/StepInput.css.js.map +1 -1
- package/dist/generated/themes/TimePickerClock.css.d.ts +1 -1
- package/dist/generated/themes/TimePickerClock.css.js +1 -1
- package/dist/generated/themes/TimePickerClock.css.js.map +1 -1
- package/dist/generated/themes/TimeSelectionClocks.css.d.ts +1 -1
- package/dist/generated/themes/TimeSelectionClocks.css.js +1 -1
- package/dist/generated/themes/TimeSelectionClocks.css.js.map +1 -1
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_auto/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_horizon_auto/parameters-bundle.css.js +30 -22
- package/dist/generated/themes/sap_horizon_auto/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_hc_auto/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_horizon_hc_auto/parameters-bundle.css.js +31 -24
- package/dist/generated/themes/sap_horizon_hc_auto/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js.map +1 -1
- package/dist/vscode.html-custom-data.json +105 -5
- package/dist/web-types.json +272 -10
- package/package.json +9 -9
- package/src/ListBoxItemGroupTemplate.tsx +1 -1
- package/src/ListItemBaseTemplate.tsx +4 -0
- package/src/NumberInputTemplate.tsx +95 -0
- package/src/OptionGroupTemplate.tsx +20 -0
- package/src/OptionTemplate.tsx +6 -1
- package/src/SelectPopoverTemplate.tsx +1 -1
- package/src/SelectTemplate.tsx +6 -0
- package/src/StepInputTemplate.tsx +23 -86
- package/src/i18n/messagebundle.properties +10 -8
- package/src/i18n/messagebundle_de.properties +2 -2
- package/src/i18n/messagebundle_pl.properties +1 -1
- package/src/i18n/messagebundle_ru.properties +1 -1
- package/src/themes/NumberInput.css +321 -0
- package/src/themes/OptionGroup.css +28 -0
- package/src/themes/StepInput.css +0 -276
- package/src/themes/TimePickerClock.css +1 -1
- package/src/themes/TimeSelectionClocks.css +1 -1
- package/src/themes/base/NumberInput-parameters.css +31 -0
- package/src/themes/base/sizes-parameters.css +3 -3
- package/src/themes/sap_fiori_3/parameters-bundle.css +1 -1
- package/src/themes/sap_fiori_3_dark/parameters-bundle.css +1 -1
- package/src/themes/sap_fiori_3_hcb/parameters-bundle.css +1 -1
- package/src/themes/sap_fiori_3_hcw/parameters-bundle.css +1 -1
- package/src/themes/sap_horizon/NumberInput-parameters.css +26 -0
- package/src/themes/sap_horizon/parameters-bundle.css +1 -1
- package/src/themes/sap_horizon_dark/NumberInput-parameters.css +26 -0
- package/src/themes/sap_horizon_dark/parameters-bundle.css +1 -1
- package/src/themes/sap_horizon_hcb/NumberInput-parameters.css +14 -0
- package/src/themes/sap_horizon_hcb/parameters-bundle.css +2 -1
- package/src/themes/sap_horizon_hcw/NumberInput-parameters.css +14 -0
- package/src/themes/sap_horizon_hcw/parameters-bundle.css +2 -1
- package/src/themes/base/StepInput-parameters.css +0 -25
- package/src/themes/sap_horizon/StepInput-parameters.css +0 -25
- package/src/themes/sap_horizon_dark/StepInput-parameters.css +0 -25
|
@@ -0,0 +1,719 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var NumberInput_1;
|
|
8
|
+
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
9
|
+
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
10
|
+
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
11
|
+
import slot from "@ui5/webcomponents-base/dist/decorators/slot-strict.js";
|
|
12
|
+
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
|
13
|
+
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
14
|
+
import { isUp, isDown, isUpCtrl, isDownCtrl, isUpShift, isDownShift, isUpShiftCtrl, isDownShiftCtrl, isPageUpShift, isPageDownShift, isEscape, isEnter, isMinus, } from "@ui5/webcomponents-base/dist/Keys.js";
|
|
15
|
+
import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
|
|
16
|
+
import ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js";
|
|
17
|
+
import { getEffectiveAriaLabelText, getAssociatedLabelForTexts } from "@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js";
|
|
18
|
+
import { submitForm } from "@ui5/webcomponents-base/dist/features/InputElementsFormSupport.js";
|
|
19
|
+
import NumberInputTemplate from "./NumberInputTemplate.js";
|
|
20
|
+
import { NUMBERINPUT_DEC_ICON_TITLE, NUMBERINPUT_INC_ICON_TITLE, NUMBERINPUT_PATTERN_MISSMATCH, NUMBERINPUT_RANGEOVERFLOW, NUMBERINPUT_RANGEUNDERFLOW, } from "./generated/i18n/i18n-defaults.js";
|
|
21
|
+
import "@ui5/webcomponents-icons/dist/less.js";
|
|
22
|
+
import "@ui5/webcomponents-icons/dist/add.js";
|
|
23
|
+
import InputType from "./types/InputType.js";
|
|
24
|
+
import NumberFormat from "@ui5/webcomponents-localization/dist/NumberFormat.js";
|
|
25
|
+
// Styles
|
|
26
|
+
import NumberInputCss from "./generated/themes/NumberInput.css.js";
|
|
27
|
+
import getCachedLocaleDataInstance from "@ui5/webcomponents-localization/dist/getCachedLocaleDataInstance.js";
|
|
28
|
+
import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
|
|
29
|
+
import { attachLanguageChange, detachLanguageChange } from "@ui5/webcomponents-base/dist/locale/languageChange.js";
|
|
30
|
+
// Spin variables
|
|
31
|
+
const INITIAL_WAIT_TIMEOUT = 500; // milliseconds
|
|
32
|
+
const ACCELERATION = 0.8;
|
|
33
|
+
const MIN_WAIT_TIMEOUT = 50; // milliseconds
|
|
34
|
+
const INITIAL_SPEED = 120; // milliseconds
|
|
35
|
+
/**
|
|
36
|
+
* @class
|
|
37
|
+
*
|
|
38
|
+
* ### Overview
|
|
39
|
+
*
|
|
40
|
+
* The `ui5-number-input` component is a numeric input field. It allows users to enter, edit and select numeric values.
|
|
41
|
+
*
|
|
42
|
+
* ### Usage
|
|
43
|
+
*
|
|
44
|
+
* The default step is 1 but the app developer can set a different one.
|
|
45
|
+
*
|
|
46
|
+
* App developers can set a maximum and minimum value for `ui5-number-input`.
|
|
47
|
+
* The increase/decrease button and the up/down keyboard navigation become disabled when
|
|
48
|
+
* the value reaches the max/min or a new value is entered from the input which is greater/less than the max/min.
|
|
49
|
+
*
|
|
50
|
+
* #### When to use:
|
|
51
|
+
*
|
|
52
|
+
* - To enter or adjust numeric values.
|
|
53
|
+
* - To adjust values for a specific step.
|
|
54
|
+
*
|
|
55
|
+
* #### When not to use:
|
|
56
|
+
*
|
|
57
|
+
* - To enter a static number (for example, postal code, phone number, or ID). In this case,
|
|
58
|
+
* use the regular `ui5-input` instead.
|
|
59
|
+
* - To enter dates and times. In this case, use date/time related components instead.
|
|
60
|
+
*
|
|
61
|
+
* ### ES6 Module Import
|
|
62
|
+
*
|
|
63
|
+
* `import "@ui5/webcomponents/dist/NumberInput.js";`
|
|
64
|
+
* @constructor
|
|
65
|
+
* @extends UI5Element
|
|
66
|
+
* @since 2.26.0
|
|
67
|
+
* @experimental
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
let NumberInput = NumberInput_1 = class NumberInput extends UI5Element {
|
|
71
|
+
constructor() {
|
|
72
|
+
super(...arguments);
|
|
73
|
+
/**
|
|
74
|
+
* Defines a value of the component.
|
|
75
|
+
* @default 0
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
this.value = 0;
|
|
79
|
+
/**
|
|
80
|
+
* Defines a step of increasing/decreasing the value of the component.
|
|
81
|
+
* @default 1
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
this.step = 1;
|
|
85
|
+
/**
|
|
86
|
+
* Defines the value state of the component.
|
|
87
|
+
* @default "None"
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
this.valueState = "None";
|
|
91
|
+
/**
|
|
92
|
+
* Defines whether the component is required.
|
|
93
|
+
* @default false
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
this.required = false;
|
|
97
|
+
/**
|
|
98
|
+
* Determines whether the component is displayed as disabled.
|
|
99
|
+
* @default false
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
this.disabled = false;
|
|
103
|
+
/**
|
|
104
|
+
* Determines whether the component is displayed as read-only.
|
|
105
|
+
* @default false
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
this.readonly = false;
|
|
109
|
+
/**
|
|
110
|
+
* Determines the number of digits after the decimal point of the component.
|
|
111
|
+
* @default 0
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
this.valuePrecision = 0;
|
|
115
|
+
/**
|
|
116
|
+
* Controls whether the increment/decrement step buttons are shown.
|
|
117
|
+
* @default false
|
|
118
|
+
* @private
|
|
119
|
+
*/
|
|
120
|
+
this._showStepButtons = false;
|
|
121
|
+
this._decIconDisabled = false;
|
|
122
|
+
this._incIconDisabled = false;
|
|
123
|
+
this.focused = false;
|
|
124
|
+
this._inputFocused = false;
|
|
125
|
+
this._waitTimeout = INITIAL_WAIT_TIMEOUT;
|
|
126
|
+
this._speed = INITIAL_SPEED;
|
|
127
|
+
this._spinStarted = false;
|
|
128
|
+
this._languageChanged = false;
|
|
129
|
+
}
|
|
130
|
+
async formElementAnchor() {
|
|
131
|
+
return (await this.getFocusDomRefAsync())?.getFocusDomRefAsync();
|
|
132
|
+
}
|
|
133
|
+
get formValidityMessage() {
|
|
134
|
+
const validity = this.formValidity;
|
|
135
|
+
if (validity.patternMismatch) {
|
|
136
|
+
return NumberInput_1.i18nBundle.getText(NUMBERINPUT_PATTERN_MISSMATCH, this.valuePrecision);
|
|
137
|
+
}
|
|
138
|
+
if (validity.rangeUnderflow) {
|
|
139
|
+
return NumberInput_1.i18nBundle.getText(NUMBERINPUT_RANGEUNDERFLOW, this.min);
|
|
140
|
+
}
|
|
141
|
+
if (validity.rangeOverflow) {
|
|
142
|
+
return NumberInput_1.i18nBundle.getText(NUMBERINPUT_RANGEOVERFLOW, this.max);
|
|
143
|
+
}
|
|
144
|
+
return "";
|
|
145
|
+
}
|
|
146
|
+
get formValidity() {
|
|
147
|
+
return {
|
|
148
|
+
patternMismatch: this.value !== 0 && !this._isValueWithCorrectPrecision,
|
|
149
|
+
rangeOverflow: this.max !== undefined && this.value > this.max,
|
|
150
|
+
rangeUnderflow: this.min !== undefined && this.value < this.min,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
get formFormattedValue() {
|
|
154
|
+
return this.value.toString();
|
|
155
|
+
}
|
|
156
|
+
get type() {
|
|
157
|
+
return InputType.Text;
|
|
158
|
+
}
|
|
159
|
+
// icons-related
|
|
160
|
+
get decIconTitle() {
|
|
161
|
+
return NumberInput_1.i18nBundle.getText(NUMBERINPUT_DEC_ICON_TITLE);
|
|
162
|
+
}
|
|
163
|
+
get incIconTitle() {
|
|
164
|
+
return NumberInput_1.i18nBundle.getText(NUMBERINPUT_INC_ICON_TITLE);
|
|
165
|
+
}
|
|
166
|
+
get _decIconClickable() {
|
|
167
|
+
return !this._decIconDisabled && !this.readonly && !this.disabled;
|
|
168
|
+
}
|
|
169
|
+
get _incIconClickable() {
|
|
170
|
+
return !this._incIconDisabled && !this.readonly && !this.disabled;
|
|
171
|
+
}
|
|
172
|
+
get _isFocused() {
|
|
173
|
+
return this.focused;
|
|
174
|
+
}
|
|
175
|
+
get _displayValue() {
|
|
176
|
+
// For the cases when there is set value precision but the input value is not with correct precision we don't need to format it
|
|
177
|
+
const value = this.input?.value && !this._isValueWithCorrectPrecision ? this.input.value : this._formatNumber(this.value);
|
|
178
|
+
if ((this.value === 0) || (Number.isInteger(this.value))) {
|
|
179
|
+
return value;
|
|
180
|
+
}
|
|
181
|
+
if (this.input && this.value === this._parseNumber(this.input.value)) { // For the cases where the number is fractional and is ending with 0s.
|
|
182
|
+
return this.input.value;
|
|
183
|
+
}
|
|
184
|
+
return value;
|
|
185
|
+
}
|
|
186
|
+
get accInfo() {
|
|
187
|
+
return {
|
|
188
|
+
"ariaRequired": this.required,
|
|
189
|
+
"ariaLabel": getEffectiveAriaLabelText(this) || this._externalAriaLabel || getAssociatedLabelForTexts(this),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
get inputAttributes() {
|
|
193
|
+
return {
|
|
194
|
+
min: this.min === undefined ? undefined : this.min,
|
|
195
|
+
max: this.max === undefined ? undefined : this.max,
|
|
196
|
+
step: this.step,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
onBeforeRendering() {
|
|
200
|
+
if (this._languageChanged) {
|
|
201
|
+
this._inputValue = this._formatNumber(this.value);
|
|
202
|
+
this._languageChanged = false;
|
|
203
|
+
this.valueState = ValueState.None;
|
|
204
|
+
}
|
|
205
|
+
this._setButtonState();
|
|
206
|
+
}
|
|
207
|
+
onEnterDOM() {
|
|
208
|
+
this._setupLanguageChangeHandler();
|
|
209
|
+
}
|
|
210
|
+
onExitDOM() {
|
|
211
|
+
this._cleanupLanguageChangeHandler();
|
|
212
|
+
this._resetSpin();
|
|
213
|
+
}
|
|
214
|
+
_setupLanguageChangeHandler() {
|
|
215
|
+
if (this._languageChangeHandler) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
this._languageChangeHandler = () => {
|
|
219
|
+
this._formatter = undefined;
|
|
220
|
+
this._languageChanged = true;
|
|
221
|
+
this._delimiter = undefined;
|
|
222
|
+
this._groupSeparator = undefined;
|
|
223
|
+
return Promise.resolve();
|
|
224
|
+
};
|
|
225
|
+
attachLanguageChange(this._languageChangeHandler);
|
|
226
|
+
}
|
|
227
|
+
_cleanupLanguageChangeHandler() {
|
|
228
|
+
if (this._languageChangeHandler) {
|
|
229
|
+
detachLanguageChange(this._languageChangeHandler);
|
|
230
|
+
this._languageChangeHandler = undefined;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
get formatter() {
|
|
234
|
+
if (!this._formatter) {
|
|
235
|
+
this._formatter = NumberFormat.getFloatInstance({
|
|
236
|
+
decimals: this.valuePrecision,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
return this._formatter;
|
|
240
|
+
}
|
|
241
|
+
get delimiter() {
|
|
242
|
+
if (!this._delimiter) {
|
|
243
|
+
const localeData = getCachedLocaleDataInstance(getLocale());
|
|
244
|
+
this._delimiter = localeData.getNumberSymbol("decimal") || ".";
|
|
245
|
+
}
|
|
246
|
+
return this._delimiter;
|
|
247
|
+
}
|
|
248
|
+
get groupSeparator() {
|
|
249
|
+
if (!this._groupSeparator) {
|
|
250
|
+
const localeData = getCachedLocaleDataInstance(getLocale());
|
|
251
|
+
this._groupSeparator = localeData.getNumberSymbol("group") || ",";
|
|
252
|
+
}
|
|
253
|
+
return this._groupSeparator;
|
|
254
|
+
}
|
|
255
|
+
get input() {
|
|
256
|
+
return this.shadowRoot.querySelector("[ui5-input]");
|
|
257
|
+
}
|
|
258
|
+
get innerInput() {
|
|
259
|
+
return this.input.shadowRoot.querySelector("input");
|
|
260
|
+
}
|
|
261
|
+
_onButtonFocusOut() {
|
|
262
|
+
setTimeout(() => {
|
|
263
|
+
if (!this._inputFocused && !this.shadowRoot.activeElement) {
|
|
264
|
+
this.focused = false;
|
|
265
|
+
}
|
|
266
|
+
}, 0);
|
|
267
|
+
}
|
|
268
|
+
_onInput(e) {
|
|
269
|
+
const prevented = !this.fireDecoratorEvent("input", { inputType: e.detail.inputType });
|
|
270
|
+
if (prevented) {
|
|
271
|
+
e.preventDefault();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
_onInputFocusIn() {
|
|
275
|
+
this._inputFocused = true;
|
|
276
|
+
}
|
|
277
|
+
_onInputFocusOut() {
|
|
278
|
+
this._inputFocused = false;
|
|
279
|
+
this._onInputChange();
|
|
280
|
+
}
|
|
281
|
+
_onMouseWheel(e) {
|
|
282
|
+
if (this.disabled || this.readonly || !this._isFocused) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
e.preventDefault();
|
|
286
|
+
const isScrollUp = e.deltaY < 0;
|
|
287
|
+
const modifier = isScrollUp ? this.step : -this.step;
|
|
288
|
+
this._modifyValue(modifier, true);
|
|
289
|
+
}
|
|
290
|
+
_setButtonState() {
|
|
291
|
+
this._decIconDisabled = this.min !== undefined && this.value <= this.min;
|
|
292
|
+
this._incIconDisabled = this.max !== undefined && this.value >= this.max;
|
|
293
|
+
}
|
|
294
|
+
_validate() {
|
|
295
|
+
if (this._initialValueState === undefined) {
|
|
296
|
+
this._initialValueState = this.valueState;
|
|
297
|
+
}
|
|
298
|
+
this._updateValueState();
|
|
299
|
+
}
|
|
300
|
+
_updateValueState() {
|
|
301
|
+
const isWithinRange = (this.min === undefined || this._parseNumber(this.input.value) >= this.min)
|
|
302
|
+
&& (this.max === undefined || this._parseNumber(this.input.value) <= this.max);
|
|
303
|
+
const isValueWithCorrectPrecision = this._isValueWithCorrectPrecision;
|
|
304
|
+
const previousValueState = this.valueState;
|
|
305
|
+
const isValid = isWithinRange && isValueWithCorrectPrecision;
|
|
306
|
+
this.valueState = isValid ? ValueState.None : ValueState.Negative;
|
|
307
|
+
const eventPrevented = !this.fireDecoratorEvent("value-state-change", {
|
|
308
|
+
valueState: this.valueState,
|
|
309
|
+
valid: isValid,
|
|
310
|
+
});
|
|
311
|
+
if (eventPrevented) {
|
|
312
|
+
this.valueState = previousValueState;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
_preciseValue(value) {
|
|
316
|
+
const pow = 10 ** this.valuePrecision;
|
|
317
|
+
return Math.round(value * pow) / pow;
|
|
318
|
+
}
|
|
319
|
+
_fireChangeEvent() {
|
|
320
|
+
if (this._previousValue !== this.value) {
|
|
321
|
+
this._previousValue = this.value;
|
|
322
|
+
this.fireDecoratorEvent("change");
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Value modifier - modifies the value of the component, validates the new value and enables/disables increment and
|
|
327
|
+
* decrement buttons according to the value and min/max values (if set). Fires `change` event when requested
|
|
328
|
+
* @private
|
|
329
|
+
* @param modifier modifies the value of the component with the given modifier (positive or negative)
|
|
330
|
+
* @param fireChangeEvent if `true`, fires `change` event when the value is changed
|
|
331
|
+
*/
|
|
332
|
+
_modifyValue(modifier, fireChangeEvent = false) {
|
|
333
|
+
if (this.min !== undefined && this.max !== undefined && this.min > this.max) {
|
|
334
|
+
console.warn(`[ui5-number-input] Invalid configuration: 'min' (${this.min}) is greater than 'max' (${this.max}). Value modification skipped.`); // eslint-disable-line
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
let value;
|
|
338
|
+
value = this.value + modifier;
|
|
339
|
+
if (this.min !== undefined && value < this.min) {
|
|
340
|
+
value = this.min;
|
|
341
|
+
}
|
|
342
|
+
if (this.max !== undefined && value > this.max) {
|
|
343
|
+
value = this.max;
|
|
344
|
+
}
|
|
345
|
+
value = this._preciseValue(value);
|
|
346
|
+
if (value !== this.value) {
|
|
347
|
+
this.value = value;
|
|
348
|
+
this._inputValue = this._formatNumber(value);
|
|
349
|
+
this._validate();
|
|
350
|
+
this._setButtonState();
|
|
351
|
+
this.focused = true;
|
|
352
|
+
if (fireChangeEvent) {
|
|
353
|
+
this._fireChangeEvent();
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
this.input.focus();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Formats a number with thousands separator based on current locale
|
|
362
|
+
* @private
|
|
363
|
+
*/
|
|
364
|
+
_formatNumber(value) {
|
|
365
|
+
return this.formatter.format(value);
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Parses formatted number string back to numeric value
|
|
369
|
+
* @private
|
|
370
|
+
*/
|
|
371
|
+
_parseNumber(formattedValue) {
|
|
372
|
+
return this.formatter.parse(formattedValue);
|
|
373
|
+
}
|
|
374
|
+
_incValue() {
|
|
375
|
+
if (this._incIconClickable && !this.disabled && !this.readonly) {
|
|
376
|
+
this._modifyValue(this.step, true);
|
|
377
|
+
this._previousValue = this.value;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
_decValue() {
|
|
381
|
+
if (this._decIconClickable && !this.disabled && !this.readonly) {
|
|
382
|
+
this._modifyValue(-this.step, true);
|
|
383
|
+
this._previousValue = this.value;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
get _isValueWithCorrectPrecision() {
|
|
387
|
+
const delimiter = this.delimiter;
|
|
388
|
+
// check if the value will be displayed with correct precision
|
|
389
|
+
// _displayValue has special formatting logic
|
|
390
|
+
if (this.valuePrecision === 0 && !this.input?.value.includes(delimiter) && ((this.value === 0) || (Number.isInteger(this.value)))) {
|
|
391
|
+
// integers and zero will be formatted with toFixed, so they're always valid
|
|
392
|
+
return true;
|
|
393
|
+
}
|
|
394
|
+
const numberParts = this.input?.value?.split(delimiter);
|
|
395
|
+
const decimalPartLength = numberParts?.length > 1 ? numberParts[1].length : 0;
|
|
396
|
+
return decimalPartLength === this.valuePrecision;
|
|
397
|
+
}
|
|
398
|
+
_onInputChange() {
|
|
399
|
+
this._setDefaultInputValueIfNeeded();
|
|
400
|
+
const updatedValue = this._removeGroupSeparators(this.input.value);
|
|
401
|
+
const inputValue = this._parseNumber(updatedValue);
|
|
402
|
+
if (this._isValueChanged(inputValue)) {
|
|
403
|
+
this._updateValueAndValidate(Number.isNaN(inputValue) ? this.min || 0 : inputValue);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
_setDefaultInputValueIfNeeded() {
|
|
407
|
+
if (this.input.value === "") {
|
|
408
|
+
this._inputValue = this._formatNumber(this.min || 0);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
_isValueChanged(inputValue) {
|
|
412
|
+
const isValueWithCorrectPrecision = this._isValueWithCorrectPrecision;
|
|
413
|
+
const isWithinRange = (this.min === undefined || inputValue >= this.min) && (this.max === undefined || inputValue <= this.max);
|
|
414
|
+
// Treat values as distinct when the precision was just corrected (e.g., from 3.4000 to 3.40) while
|
|
415
|
+
// the value was previously invalid due to precision — but only when the value is in range. Without
|
|
416
|
+
// this guard the condition also triggers for range violations, causing a redundant second _validate call.
|
|
417
|
+
const isPrecisionCorrectButValueStateError = isValueWithCorrectPrecision && isWithinRange && this.valueState === ValueState.Negative;
|
|
418
|
+
return this.value !== this._previousValue
|
|
419
|
+
|| this.value !== inputValue
|
|
420
|
+
|| inputValue === 0
|
|
421
|
+
|| !isValueWithCorrectPrecision
|
|
422
|
+
|| isPrecisionCorrectButValueStateError
|
|
423
|
+
|| Number.isNaN(inputValue);
|
|
424
|
+
}
|
|
425
|
+
_updateValueAndValidate(inputValue) {
|
|
426
|
+
this.value = inputValue;
|
|
427
|
+
this._inputValue = undefined;
|
|
428
|
+
this._validate();
|
|
429
|
+
this._setButtonState();
|
|
430
|
+
this._fireChangeEvent();
|
|
431
|
+
}
|
|
432
|
+
_onfocusin() {
|
|
433
|
+
this.focused = true;
|
|
434
|
+
this._previousValue = this.value;
|
|
435
|
+
}
|
|
436
|
+
_onfocusout() {
|
|
437
|
+
this.focused = false;
|
|
438
|
+
this._previousValue = undefined;
|
|
439
|
+
}
|
|
440
|
+
_onInputRequestSubmit() {
|
|
441
|
+
if (this._internals.form) {
|
|
442
|
+
submitForm(this);
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
this.fireDecoratorEvent("_request-submit");
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
_onkeydown(e) {
|
|
449
|
+
let preventDefault = true;
|
|
450
|
+
if (this.disabled || this.readonly) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
if (isEnter(e)) {
|
|
454
|
+
this._onInputChange();
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
if (isUp(e)) {
|
|
458
|
+
// step up
|
|
459
|
+
this._modifyValue(this.step);
|
|
460
|
+
}
|
|
461
|
+
else if (isDown(e)) {
|
|
462
|
+
// step down
|
|
463
|
+
this._modifyValue(-this.step);
|
|
464
|
+
}
|
|
465
|
+
else if (isEscape(e)) {
|
|
466
|
+
// return previous value
|
|
467
|
+
if (this._previousValue === undefined) {
|
|
468
|
+
this._previousValue = this.value;
|
|
469
|
+
}
|
|
470
|
+
this.value = this._previousValue;
|
|
471
|
+
this._inputValue = this._formatNumber(this.value);
|
|
472
|
+
}
|
|
473
|
+
else if (this.max !== undefined && (isPageUpShift(e) || isUpShiftCtrl(e))) {
|
|
474
|
+
// step to max
|
|
475
|
+
this._modifyValue(this.max - this.value);
|
|
476
|
+
}
|
|
477
|
+
else if (this.min !== undefined && (isPageDownShift(e) || isDownShiftCtrl(e))) {
|
|
478
|
+
// step to min
|
|
479
|
+
this._modifyValue(this.min - this.value);
|
|
480
|
+
}
|
|
481
|
+
else if (!isUpCtrl(e) && !isDownCtrl(e) && !isUpShift(e) && !isDownShift(e)) {
|
|
482
|
+
preventDefault = false;
|
|
483
|
+
}
|
|
484
|
+
if (e.key && e.key.length !== 1) {
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
const caretPosition = this._getCaretPosition();
|
|
488
|
+
const inputValue = this.innerInput.value;
|
|
489
|
+
const typedValue = this._getValueOnkeyDown(e, inputValue, caretPosition);
|
|
490
|
+
const parsedValue = this._parseNumber(typedValue);
|
|
491
|
+
const isValidTypedValue = this._isInputValueValid(typedValue, parsedValue);
|
|
492
|
+
if (preventDefault || !isValidTypedValue) {
|
|
493
|
+
e.preventDefault();
|
|
494
|
+
}
|
|
495
|
+
if (caretPosition === 0 && isMinus(e)) {
|
|
496
|
+
this._updateValueAndValidate(parsedValue);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
_getCaretPosition() {
|
|
500
|
+
return this.input.getDomRef().querySelector("input").selectionStart;
|
|
501
|
+
}
|
|
502
|
+
_getValueOnkeyDown(e, inputValue, cursorPosition) {
|
|
503
|
+
const typedValue = `${inputValue.substring(0, cursorPosition)}${e.key}${inputValue.substring(cursorPosition)}`;
|
|
504
|
+
const updatedValue = this._removeGroupSeparators(typedValue);
|
|
505
|
+
return updatedValue;
|
|
506
|
+
}
|
|
507
|
+
_removeGroupSeparators(value) {
|
|
508
|
+
const groupSeparator = this.groupSeparator;
|
|
509
|
+
return value.replaceAll(groupSeparator, "");
|
|
510
|
+
}
|
|
511
|
+
_isInputValueValid(typedValue, parsedValue) {
|
|
512
|
+
return !Number.isNaN(parsedValue) && !/, {2,}/.test(typedValue);
|
|
513
|
+
}
|
|
514
|
+
_decSpin(e) {
|
|
515
|
+
if (this._isFocused || this._decIconDisabled) {
|
|
516
|
+
e.preventDefault();
|
|
517
|
+
}
|
|
518
|
+
if (!this._decIconDisabled) {
|
|
519
|
+
this._spinValue(false, true);
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
this.input.focus();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
_incSpin(e) {
|
|
526
|
+
if (this._isFocused || this._incIconDisabled) {
|
|
527
|
+
e.preventDefault();
|
|
528
|
+
}
|
|
529
|
+
if (!this._incIconDisabled) {
|
|
530
|
+
this._spinValue(true, true);
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
this.input.focus();
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Calculates the time which should be waited until _spinValue function is called.
|
|
538
|
+
*/
|
|
539
|
+
_calcWaitTimeout() {
|
|
540
|
+
this._speed *= ACCELERATION;
|
|
541
|
+
this._waitTimeout = ((this._waitTimeout - this._speed) < MIN_WAIT_TIMEOUT ? MIN_WAIT_TIMEOUT : (this._waitTimeout - this._speed));
|
|
542
|
+
return this._waitTimeout;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Called when the increment or decrement button is pressed and held to set new value.
|
|
546
|
+
* @private
|
|
547
|
+
* @param increment - is this the increment button or not so the values should be spin accordingly up or down
|
|
548
|
+
* @param resetVariables - whether to reset the spin-related variables or not
|
|
549
|
+
*/
|
|
550
|
+
_spinValue(increment, resetVariables = false) {
|
|
551
|
+
if (resetVariables) {
|
|
552
|
+
this._waitTimeout = INITIAL_WAIT_TIMEOUT;
|
|
553
|
+
this._speed = INITIAL_SPEED;
|
|
554
|
+
this._btnDown = true;
|
|
555
|
+
}
|
|
556
|
+
this._spinTimeoutId = setTimeout(() => {
|
|
557
|
+
if (this._btnDown) {
|
|
558
|
+
this._spinStarted = true;
|
|
559
|
+
this._modifyValue(increment ? this.step : -this.step);
|
|
560
|
+
this._setButtonState();
|
|
561
|
+
if ((!this._incIconDisabled && increment) || (!this._decIconDisabled && !increment)) {
|
|
562
|
+
this._spinValue(increment);
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
this._resetSpin();
|
|
566
|
+
this._fireChangeEvent();
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}, this._calcWaitTimeout());
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Resets spin process
|
|
573
|
+
*/
|
|
574
|
+
_resetSpin() {
|
|
575
|
+
clearTimeout(this._spinTimeoutId);
|
|
576
|
+
this._btnDown = false;
|
|
577
|
+
this._spinStarted = false;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Resets spin process when mouse outs + or - buttons
|
|
581
|
+
*/
|
|
582
|
+
_resetSpinOut() {
|
|
583
|
+
if (this._btnDown) {
|
|
584
|
+
this._resetSpin();
|
|
585
|
+
this._fireChangeEvent();
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
__decorate([
|
|
590
|
+
property({ type: Number })
|
|
591
|
+
], NumberInput.prototype, "value", void 0);
|
|
592
|
+
__decorate([
|
|
593
|
+
property({ type: Number })
|
|
594
|
+
], NumberInput.prototype, "min", void 0);
|
|
595
|
+
__decorate([
|
|
596
|
+
property({ type: Number })
|
|
597
|
+
], NumberInput.prototype, "max", void 0);
|
|
598
|
+
__decorate([
|
|
599
|
+
property({ type: Number })
|
|
600
|
+
], NumberInput.prototype, "step", void 0);
|
|
601
|
+
__decorate([
|
|
602
|
+
property()
|
|
603
|
+
], NumberInput.prototype, "valueState", void 0);
|
|
604
|
+
__decorate([
|
|
605
|
+
property({ type: Boolean })
|
|
606
|
+
], NumberInput.prototype, "required", void 0);
|
|
607
|
+
__decorate([
|
|
608
|
+
property({ type: Boolean })
|
|
609
|
+
], NumberInput.prototype, "disabled", void 0);
|
|
610
|
+
__decorate([
|
|
611
|
+
property({ type: Boolean })
|
|
612
|
+
], NumberInput.prototype, "readonly", void 0);
|
|
613
|
+
__decorate([
|
|
614
|
+
property()
|
|
615
|
+
], NumberInput.prototype, "placeholder", void 0);
|
|
616
|
+
__decorate([
|
|
617
|
+
property()
|
|
618
|
+
], NumberInput.prototype, "name", void 0);
|
|
619
|
+
__decorate([
|
|
620
|
+
property({ type: Number })
|
|
621
|
+
], NumberInput.prototype, "valuePrecision", void 0);
|
|
622
|
+
__decorate([
|
|
623
|
+
property()
|
|
624
|
+
], NumberInput.prototype, "accessibleName", void 0);
|
|
625
|
+
__decorate([
|
|
626
|
+
property()
|
|
627
|
+
], NumberInput.prototype, "accessibleNameRef", void 0);
|
|
628
|
+
__decorate([
|
|
629
|
+
property({ type: Boolean, noAttribute: true })
|
|
630
|
+
], NumberInput.prototype, "_showStepButtons", void 0);
|
|
631
|
+
__decorate([
|
|
632
|
+
property({ noAttribute: true })
|
|
633
|
+
], NumberInput.prototype, "_externalAriaLabel", void 0);
|
|
634
|
+
__decorate([
|
|
635
|
+
property({ noAttribute: true })
|
|
636
|
+
], NumberInput.prototype, "_decIconDisabled", void 0);
|
|
637
|
+
__decorate([
|
|
638
|
+
property({ noAttribute: true })
|
|
639
|
+
], NumberInput.prototype, "_incIconDisabled", void 0);
|
|
640
|
+
__decorate([
|
|
641
|
+
property({ type: Boolean })
|
|
642
|
+
], NumberInput.prototype, "focused", void 0);
|
|
643
|
+
__decorate([
|
|
644
|
+
property({ noAttribute: true })
|
|
645
|
+
], NumberInput.prototype, "_inputFocused", void 0);
|
|
646
|
+
__decorate([
|
|
647
|
+
property({ noAttribute: true })
|
|
648
|
+
], NumberInput.prototype, "_previousValue", void 0);
|
|
649
|
+
__decorate([
|
|
650
|
+
property({ noAttribute: true })
|
|
651
|
+
], NumberInput.prototype, "_waitTimeout", void 0);
|
|
652
|
+
__decorate([
|
|
653
|
+
property({ noAttribute: true })
|
|
654
|
+
], NumberInput.prototype, "_speed", void 0);
|
|
655
|
+
__decorate([
|
|
656
|
+
property({ noAttribute: true })
|
|
657
|
+
], NumberInput.prototype, "_btnDown", void 0);
|
|
658
|
+
__decorate([
|
|
659
|
+
property({ noAttribute: true })
|
|
660
|
+
], NumberInput.prototype, "_spinTimeoutId", void 0);
|
|
661
|
+
__decorate([
|
|
662
|
+
property({ noAttribute: true })
|
|
663
|
+
], NumberInput.prototype, "_spinStarted", void 0);
|
|
664
|
+
__decorate([
|
|
665
|
+
property({ noAttribute: true })
|
|
666
|
+
], NumberInput.prototype, "_inputValue", void 0);
|
|
667
|
+
__decorate([
|
|
668
|
+
slot()
|
|
669
|
+
], NumberInput.prototype, "valueStateMessage", void 0);
|
|
670
|
+
__decorate([
|
|
671
|
+
i18n("@ui5/webcomponents")
|
|
672
|
+
], NumberInput, "i18nBundle", void 0);
|
|
673
|
+
NumberInput = NumberInput_1 = __decorate([
|
|
674
|
+
customElement({
|
|
675
|
+
tag: "ui5-number-input",
|
|
676
|
+
cldr: true,
|
|
677
|
+
formAssociated: true,
|
|
678
|
+
renderer: jsxRenderer,
|
|
679
|
+
styles: NumberInputCss,
|
|
680
|
+
template: NumberInputTemplate,
|
|
681
|
+
languageAware: true,
|
|
682
|
+
})
|
|
683
|
+
/**
|
|
684
|
+
* Fired when the input operation has finished by pressing Enter or on focusout.
|
|
685
|
+
* @public
|
|
686
|
+
*/
|
|
687
|
+
,
|
|
688
|
+
event("change", {
|
|
689
|
+
bubbles: true,
|
|
690
|
+
})
|
|
691
|
+
/**
|
|
692
|
+
* Fired when the value of the component changes at each keystroke.
|
|
693
|
+
* @public
|
|
694
|
+
*/
|
|
695
|
+
,
|
|
696
|
+
event("input", {
|
|
697
|
+
cancelable: true,
|
|
698
|
+
bubbles: true,
|
|
699
|
+
})
|
|
700
|
+
/**
|
|
701
|
+
* Fired before the value state of the component is updated internally.
|
|
702
|
+
* The event is preventable, meaning that if its default action is
|
|
703
|
+
* prevented, the component will not update the value state.
|
|
704
|
+
* @public
|
|
705
|
+
* @param {string} valueState The new `valueState` that will be set.
|
|
706
|
+
* @param {boolean} valid Indicator if the value is in between the min and max value.
|
|
707
|
+
*/
|
|
708
|
+
,
|
|
709
|
+
event("value-state-change", {
|
|
710
|
+
bubbles: true,
|
|
711
|
+
cancelable: true,
|
|
712
|
+
}),
|
|
713
|
+
event("_request-submit", {
|
|
714
|
+
bubbles: true,
|
|
715
|
+
})
|
|
716
|
+
], NumberInput);
|
|
717
|
+
NumberInput.define();
|
|
718
|
+
export default NumberInput;
|
|
719
|
+
//# sourceMappingURL=NumberInput.js.map
|