@progress/kendo-angular-inputs 21.4.1 → 22.0.0-develop.1
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/colorpicker/localization/messages.d.ts +1 -1
- package/common/radio-checkbox.base.d.ts +1 -1
- package/fesm2022/progress-kendo-angular-inputs.mjs +321 -321
- package/numerictextbox/localization/messages.d.ts +1 -1
- package/otpinput/localization/messages.d.ts +1 -1
- package/package.json +17 -25
- package/rangeslider/localization/messages.d.ts +1 -1
- package/signature/localization/messages.d.ts +1 -1
- package/slider/localization/messages.d.ts +1 -1
- package/sliders-common/slider-base.d.ts +1 -1
- package/switch/localization/messages.d.ts +1 -1
- package/text-fields-common/text-fields-base.d.ts +1 -1
- package/textbox/localization/messages.d.ts +1 -1
- package/esm2022/checkbox/checkbox.component.mjs +0 -227
- package/esm2022/checkbox/checkbox.directive.mjs +0 -96
- package/esm2022/checkbox/checked-state.mjs +0 -5
- package/esm2022/checkbox.module.mjs +0 -42
- package/esm2022/colorpicker/adaptiveness/adaptive-close-button.component.mjs +0 -62
- package/esm2022/colorpicker/adaptiveness/adaptive-renderer.component.mjs +0 -219
- package/esm2022/colorpicker/color-contrast-svg.component.mjs +0 -108
- package/esm2022/colorpicker/color-gradient-numeric-label.directive.mjs +0 -37
- package/esm2022/colorpicker/color-gradient-text-label.directive.mjs +0 -34
- package/esm2022/colorpicker/color-gradient.component.mjs +0 -1110
- package/esm2022/colorpicker/color-input.component.mjs +0 -498
- package/esm2022/colorpicker/color-palette.component.mjs +0 -629
- package/esm2022/colorpicker/colorpicker.component.mjs +0 -1315
- package/esm2022/colorpicker/constants.mjs +0 -40
- package/esm2022/colorpicker/contrast-validation.component.mjs +0 -83
- package/esm2022/colorpicker/contrast.component.mjs +0 -114
- package/esm2022/colorpicker/events/active-color-click-event.mjs +0 -55
- package/esm2022/colorpicker/events/cancel-event.mjs +0 -18
- package/esm2022/colorpicker/events/close-event.mjs +0 -10
- package/esm2022/colorpicker/events/kendo-drag-event.mjs +0 -5
- package/esm2022/colorpicker/events/open-event.mjs +0 -10
- package/esm2022/colorpicker/events.mjs +0 -8
- package/esm2022/colorpicker/flatcolorpicker-actions.component.mjs +0 -112
- package/esm2022/colorpicker/flatcolorpicker-header.component.mjs +0 -244
- package/esm2022/colorpicker/flatcolorpicker.component.mjs +0 -942
- package/esm2022/colorpicker/localization/colorgradient-localization.service.mjs +0 -46
- package/esm2022/colorpicker/localization/colorpalette-localization.service.mjs +0 -46
- package/esm2022/colorpicker/localization/colorpicker-localization.service.mjs +0 -31
- package/esm2022/colorpicker/localization/custom-messages.component.mjs +0 -51
- package/esm2022/colorpicker/localization/flatcolorpicker-localization.service.mjs +0 -46
- package/esm2022/colorpicker/localization/localized-colorpicker-messages.directive.mjs +0 -39
- package/esm2022/colorpicker/localization/messages.mjs +0 -201
- package/esm2022/colorpicker/models/actions-layout.mjs +0 -5
- package/esm2022/colorpicker/models/adaptive-mode.mjs +0 -8
- package/esm2022/colorpicker/models/colorpicker-view.mjs +0 -5
- package/esm2022/colorpicker/models/gradient-settings.mjs +0 -5
- package/esm2022/colorpicker/models/hsva.mjs +0 -5
- package/esm2022/colorpicker/models/output-format.mjs +0 -5
- package/esm2022/colorpicker/models/palette-presets.mjs +0 -62
- package/esm2022/colorpicker/models/palette-settings.mjs +0 -5
- package/esm2022/colorpicker/models/popup-settings.mjs +0 -5
- package/esm2022/colorpicker/models/rgb.mjs +0 -5
- package/esm2022/colorpicker/models/rgba.mjs +0 -5
- package/esm2022/colorpicker/models/table-cell.mjs +0 -5
- package/esm2022/colorpicker/models/tile-size.mjs +0 -5
- package/esm2022/colorpicker/models.mjs +0 -16
- package/esm2022/colorpicker/services/color-palette.service.mjs +0 -65
- package/esm2022/colorpicker/services/flatcolorpicker.service.mjs +0 -39
- package/esm2022/colorpicker/utils/color-parser.mjs +0 -164
- package/esm2022/colorpicker/utils/contrast-curve.mjs +0 -85
- package/esm2022/colorpicker/utils.mjs +0 -6
- package/esm2022/colorpicker.module.mjs +0 -50
- package/esm2022/common/dom-utils.mjs +0 -36
- package/esm2022/common/formservice.service.mjs +0 -21
- package/esm2022/common/math.mjs +0 -65
- package/esm2022/common/models/fillmode.mjs +0 -5
- package/esm2022/common/models/gutters.mjs +0 -5
- package/esm2022/common/models/responsive-breakpoints.mjs +0 -5
- package/esm2022/common/models/rounded.mjs +0 -5
- package/esm2022/common/models/size.mjs +0 -5
- package/esm2022/common/models/styling-classes.mjs +0 -5
- package/esm2022/common/models/type.mjs +0 -5
- package/esm2022/common/models.mjs +0 -9
- package/esm2022/common/radio-checkbox.base.mjs +0 -295
- package/esm2022/common/utils.mjs +0 -88
- package/esm2022/directives.mjs +0 -430
- package/esm2022/form/form.component.mjs +0 -163
- package/esm2022/form/formseparator.component.mjs +0 -80
- package/esm2022/form/utils.mjs +0 -147
- package/esm2022/form.module.mjs +0 -46
- package/esm2022/formfield/error.component.mjs +0 -70
- package/esm2022/formfield/formfield.component.mjs +0 -353
- package/esm2022/formfield/hint.component.mjs +0 -65
- package/esm2022/formfield/models/message-align.mjs +0 -5
- package/esm2022/formfield/models/orientation.mjs +0 -5
- package/esm2022/formfield/models/show-options.mjs +0 -5
- package/esm2022/formfield.module.mjs +0 -43
- package/esm2022/formfieldset/formfieldset.component.mjs +0 -174
- package/esm2022/index.mjs +0 -91
- package/esm2022/inputs.module.mjs +0 -91
- package/esm2022/maskedtextbox/maskedtextbox.component.mjs +0 -876
- package/esm2022/maskedtextbox/masking.service.mjs +0 -189
- package/esm2022/maskedtextbox/parsing/combinators.mjs +0 -28
- package/esm2022/maskedtextbox/parsing/parsers.mjs +0 -148
- package/esm2022/maskedtextbox/parsing/result.mjs +0 -44
- package/esm2022/maskedtextbox/parsing/stream.mjs +0 -43
- package/esm2022/maskedtextbox.module.mjs +0 -43
- package/esm2022/numerictextbox/arrow-direction.mjs +0 -13
- package/esm2022/numerictextbox/constants.mjs +0 -28
- package/esm2022/numerictextbox/localization/custom-messages.component.mjs +0 -55
- package/esm2022/numerictextbox/localization/localized-numerictextbox-messages.directive.mjs +0 -39
- package/esm2022/numerictextbox/localization/messages.mjs +0 -33
- package/esm2022/numerictextbox/numerictextbox.component.mjs +0 -1314
- package/esm2022/numerictextbox/utils.mjs +0 -92
- package/esm2022/numerictextbox.module.mjs +0 -46
- package/esm2022/otp.module.mjs +0 -44
- package/esm2022/otpinput/localization/custom-messages.component.mjs +0 -45
- package/esm2022/otpinput/localization/localized-textbox-messages.directive.mjs +0 -39
- package/esm2022/otpinput/localization/messages.mjs +0 -34
- package/esm2022/otpinput/models/otpinput-type.mjs +0 -5
- package/esm2022/otpinput/models/separator-icon.mjs +0 -5
- package/esm2022/otpinput/otpinput-separator.component.mjs +0 -93
- package/esm2022/otpinput/otpinput.component.mjs +0 -936
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/progress-kendo-angular-inputs.mjs +0 -8
- package/esm2022/radiobutton/radiobutton.component.mjs +0 -212
- package/esm2022/radiobutton/radiobutton.directive.mjs +0 -81
- package/esm2022/radiobutton.module.mjs +0 -43
- package/esm2022/rangeslider/localization/custom-messages.component.mjs +0 -53
- package/esm2022/rangeslider/localization/localized-rangeslider-messages.directive.mjs +0 -39
- package/esm2022/rangeslider/localization/messages.mjs +0 -33
- package/esm2022/rangeslider/rangeslider-model.mjs +0 -53
- package/esm2022/rangeslider/rangeslider-value.type.mjs +0 -5
- package/esm2022/rangeslider/rangeslider.component.mjs +0 -625
- package/esm2022/rangeslider.module.mjs +0 -46
- package/esm2022/rating/directives/rating-hovered-item.directive.mjs +0 -35
- package/esm2022/rating/directives/rating-item.directive.mjs +0 -34
- package/esm2022/rating/directives/rating-selected-item.directive.mjs +0 -36
- package/esm2022/rating/models/precision.mjs +0 -5
- package/esm2022/rating/models/rating-item.interface.mjs +0 -5
- package/esm2022/rating/models/selection.mjs +0 -5
- package/esm2022/rating/rating.component.mjs +0 -754
- package/esm2022/rating.module.mjs +0 -46
- package/esm2022/shared/input-separator.component.mjs +0 -55
- package/esm2022/shared/input-spacer.component.mjs +0 -56
- package/esm2022/shared/shared-events.directive.mjs +0 -102
- package/esm2022/shared/utils.mjs +0 -13
- package/esm2022/signature/events/close-event.mjs +0 -10
- package/esm2022/signature/events/index.mjs +0 -6
- package/esm2022/signature/events/open-event.mjs +0 -10
- package/esm2022/signature/localization/custom-messages.component.mjs +0 -43
- package/esm2022/signature/localization/index.mjs +0 -7
- package/esm2022/signature/localization/localized-signature-messages.directive.mjs +0 -39
- package/esm2022/signature/localization/messages.mjs +0 -45
- package/esm2022/signature/signature.component.mjs +0 -981
- package/esm2022/signature.module.mjs +0 -47
- package/esm2022/slider/localization/custom-messages.component.mjs +0 -43
- package/esm2022/slider/localization/localized-slider-messages.directive.mjs +0 -39
- package/esm2022/slider/localization/messages.mjs +0 -39
- package/esm2022/slider/slider-model.mjs +0 -32
- package/esm2022/slider/slider.component.mjs +0 -671
- package/esm2022/slider.module.mjs +0 -48
- package/esm2022/sliders-common/label-template.directive.mjs +0 -37
- package/esm2022/sliders-common/slider-base.mjs +0 -300
- package/esm2022/sliders-common/slider-model.base.mjs +0 -118
- package/esm2022/sliders-common/slider-ticks.component.mjs +0 -147
- package/esm2022/sliders-common/sliders-util.mjs +0 -206
- package/esm2022/sliders-common/title-callback.mjs +0 -5
- package/esm2022/switch/events/blur-event.mjs +0 -13
- package/esm2022/switch/events/focus-event.mjs +0 -13
- package/esm2022/switch/localization/custom-messages.component.mjs +0 -43
- package/esm2022/switch/localization/localized-switch-messages.directive.mjs +0 -39
- package/esm2022/switch/localization/messages.mjs +0 -33
- package/esm2022/switch/switch.component.mjs +0 -585
- package/esm2022/switch.module.mjs +0 -44
- package/esm2022/text-fields-common/text-fields-base.mjs +0 -150
- package/esm2022/textarea/models/adornments-orientation.mjs +0 -5
- package/esm2022/textarea/models/flow.mjs +0 -5
- package/esm2022/textarea/models/resize.mjs +0 -5
- package/esm2022/textarea/models/textarea-settings.mjs +0 -5
- package/esm2022/textarea/textarea-prefix.component.mjs +0 -67
- package/esm2022/textarea/textarea-suffix.component.mjs +0 -67
- package/esm2022/textarea/textarea.component.mjs +0 -740
- package/esm2022/textarea/textarea.directive.mjs +0 -288
- package/esm2022/textarea.module.mjs +0 -46
- package/esm2022/textbox/localization/custom-messages.component.mjs +0 -43
- package/esm2022/textbox/localization/localized-textbox-messages.directive.mjs +0 -39
- package/esm2022/textbox/localization/messages.mjs +0 -27
- package/esm2022/textbox/models/icon-show-options.mjs +0 -5
- package/esm2022/textbox/textbox-prefix.directive.mjs +0 -50
- package/esm2022/textbox/textbox-suffix.directive.mjs +0 -49
- package/esm2022/textbox/textbox.component.mjs +0 -933
- package/esm2022/textbox/textbox.directive.mjs +0 -125
- package/esm2022/textbox.module.mjs +0 -51
- package/esm2022/validators/max.validator.mjs +0 -21
- package/esm2022/validators/min.validator.mjs +0 -21
|
@@ -1,1314 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
-
import { Component, ElementRef, EventEmitter, HostBinding, Input, Output, Renderer2, ViewChild, forwardRef, isDevMode, NgZone, ChangeDetectorRef, Injector, ContentChild } from '@angular/core';
|
|
7
|
-
import { anyChanged, hasObservers, Keys, guid, KendoInput, SuffixTemplateDirective, PrefixTemplateDirective, setHTMLAttributes, isControlRequired, isObjectPresent, removeHTMLAttributes, parseAttributes, EventsOutsideAngularDirective, normalizeKeys } from '@progress/kendo-angular-common';
|
|
8
|
-
import { areSame, getStylingClasses, requiresZoneOnBlur } from '../common/utils';
|
|
9
|
-
import { invokeElementMethod } from '../common/dom-utils';
|
|
10
|
-
import { add, toFixedPrecision, limitPrecision } from '../common/math';
|
|
11
|
-
import { createMaxValidator } from '../validators/max.validator';
|
|
12
|
-
import { createMinValidator } from '../validators/min.validator';
|
|
13
|
-
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, NgControl } from '@angular/forms';
|
|
14
|
-
import { IntlService } from '@progress/kendo-angular-intl';
|
|
15
|
-
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
16
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
17
|
-
import { packageMetadata } from '../package-metadata';
|
|
18
|
-
import { MIN_DOC_LINK, MAX_DOC_LINK, POINT, INITIAL_SPIN_DELAY, SPIN_DELAY, EXPONENT_REGEX } from './constants';
|
|
19
|
-
import { defined, noop, numericRegex, isNumber, pad, decimalPart, getDeltaFromMouseWheel, getCaretPosition, extractSignificantNumericChars, isRightClick } from './utils';
|
|
20
|
-
import { ArrowDirection } from './arrow-direction';
|
|
21
|
-
import { mobileOS } from '@progress/kendo-common';
|
|
22
|
-
import { caretAltUpIcon, caretAltDownIcon } from '@progress/kendo-svg-icons';
|
|
23
|
-
import { InputSeparatorComponent } from '../shared/input-separator.component';
|
|
24
|
-
import { NgTemplateOutlet } from '@angular/common';
|
|
25
|
-
import { SharedInputEventsDirective } from '../shared/shared-events.directive';
|
|
26
|
-
import { LocalizedNumericTextBoxMessagesDirective } from './localization/localized-numerictextbox-messages.directive';
|
|
27
|
-
import { IconWrapperComponent } from '@progress/kendo-angular-icons';
|
|
28
|
-
import * as i0 from "@angular/core";
|
|
29
|
-
import * as i1 from "@progress/kendo-angular-intl";
|
|
30
|
-
import * as i2 from "@progress/kendo-angular-l10n";
|
|
31
|
-
const PARSABLE_OPTIONS = ['min', 'max', 'step', 'decimals'];
|
|
32
|
-
const PARSABLE_DEFAULTS = {
|
|
33
|
-
decimals: null,
|
|
34
|
-
max: null,
|
|
35
|
-
min: null,
|
|
36
|
-
step: 1
|
|
37
|
-
};
|
|
38
|
-
const FOCUSED = 'k-focus';
|
|
39
|
-
const DEFAULT_SIZE = 'medium';
|
|
40
|
-
const DEFAULT_ROUNDED = 'medium';
|
|
41
|
-
const DEFAULT_FILL_MODE = 'solid';
|
|
42
|
-
/**
|
|
43
|
-
* Represents the [Kendo UI NumericTextBox component for Angular]({% slug overview_numerictextbox %}).
|
|
44
|
-
*
|
|
45
|
-
* Use this component to allow users to input numeric values.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```html
|
|
49
|
-
* <kendo-numerictextbox [(ngModel)]="value"></kendo-numerictextbox>
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* @remarks
|
|
53
|
-
* Supported children components are: {@link NumericTextBoxCustomMessagesComponent}.
|
|
54
|
-
*/
|
|
55
|
-
export class NumericTextBoxComponent {
|
|
56
|
-
intl;
|
|
57
|
-
renderer;
|
|
58
|
-
localizationService;
|
|
59
|
-
injector;
|
|
60
|
-
ngZone;
|
|
61
|
-
changeDetector;
|
|
62
|
-
hostElement;
|
|
63
|
-
/**
|
|
64
|
-
* @hidden
|
|
65
|
-
*/
|
|
66
|
-
focusableId = `k-${guid()}`;
|
|
67
|
-
/**
|
|
68
|
-
* When `true`, disables the `NumericTextBox`.
|
|
69
|
-
* To disable the component in reactive forms, see [Forms Support](slug:formssupport_numerictextbox#toc-managing-the-numerictextbox-disabled-state-in-reactive-forms).
|
|
70
|
-
*
|
|
71
|
-
* @default false
|
|
72
|
-
*/
|
|
73
|
-
disabled = false;
|
|
74
|
-
/**
|
|
75
|
-
* When `true`, makes the NumericTextBox read-only.
|
|
76
|
-
*
|
|
77
|
-
* @default false
|
|
78
|
-
*/
|
|
79
|
-
readonly = false;
|
|
80
|
-
/**
|
|
81
|
-
* Sets the `title` attribute of the input element.
|
|
82
|
-
*/
|
|
83
|
-
title = '';
|
|
84
|
-
/**
|
|
85
|
-
* When `true`, the value is automatically corrected based on the minimum and maximum values ([see example]({% slug precision_numerictextbox %})).
|
|
86
|
-
*/
|
|
87
|
-
autoCorrect = false;
|
|
88
|
-
/**
|
|
89
|
-
* Specifies the number format used when the NumericTextBox is not focused ([see example]({% slug formats_numerictextbox %})).
|
|
90
|
-
* If `format` is `null` or `undefined`, the default format is used.
|
|
91
|
-
*/
|
|
92
|
-
get format() {
|
|
93
|
-
const format = this._format;
|
|
94
|
-
return format !== null && format !== undefined ? format : 'n2';
|
|
95
|
-
}
|
|
96
|
-
set format(value) {
|
|
97
|
-
this._format = value;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Sets the maximum valid value ([see example]({% slug precision_numerictextbox %}#toc-value-ranges)).
|
|
101
|
-
*/
|
|
102
|
-
max;
|
|
103
|
-
/**
|
|
104
|
-
* Sets the minimum valid value ([see example]({% slug precision_numerictextbox %}#toc-value-ranges)).
|
|
105
|
-
*/
|
|
106
|
-
min;
|
|
107
|
-
/**
|
|
108
|
-
* Specifies the number of decimals the user can enter when the input is focused ([see example]({% slug precision_numerictextbox %})).
|
|
109
|
-
*/
|
|
110
|
-
decimals = null;
|
|
111
|
-
/**
|
|
112
|
-
* Sets the input placeholder.
|
|
113
|
-
*/
|
|
114
|
-
placeholder;
|
|
115
|
-
/**
|
|
116
|
-
* Specifies the value used to increment or decrement the component value ([see example]({% slug predefinedsteps_numerictextbox %})).
|
|
117
|
-
*
|
|
118
|
-
* @default 1
|
|
119
|
-
*/
|
|
120
|
-
step = 1;
|
|
121
|
-
/**
|
|
122
|
-
* When `true`, renders the **Up** and **Down** spin buttons ([see example]({% slug spinbuttons_numerictextbox %})).
|
|
123
|
-
*
|
|
124
|
-
* @default true
|
|
125
|
-
*/
|
|
126
|
-
spinners = true;
|
|
127
|
-
/**
|
|
128
|
-
* Enforces the built-in minimum and maximum validators during form validation.
|
|
129
|
-
*
|
|
130
|
-
* @default true
|
|
131
|
-
*/
|
|
132
|
-
rangeValidation = true;
|
|
133
|
-
/**
|
|
134
|
-
* Sets the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
135
|
-
*/
|
|
136
|
-
tabindex = 0;
|
|
137
|
-
/**
|
|
138
|
-
* @hidden
|
|
139
|
-
*/
|
|
140
|
-
set tabIndex(tabIndex) {
|
|
141
|
-
this.tabindex = tabIndex;
|
|
142
|
-
}
|
|
143
|
-
get tabIndex() {
|
|
144
|
-
return this.tabindex;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* When `true`, enables changing the value with the mouse wheel.
|
|
148
|
-
*
|
|
149
|
-
* @default true
|
|
150
|
-
*/
|
|
151
|
-
changeValueOnScroll = true;
|
|
152
|
-
/**
|
|
153
|
-
* When `true`, enables selecting the entire value on click.
|
|
154
|
-
*
|
|
155
|
-
* @default true
|
|
156
|
-
*/
|
|
157
|
-
selectOnFocus = true;
|
|
158
|
-
/**
|
|
159
|
-
* Sets the value of the NumericTextBox ([see example]({% slug formats_numerictextbox %})).
|
|
160
|
-
*/
|
|
161
|
-
value = null;
|
|
162
|
-
/**
|
|
163
|
-
* Sets the maximum number of characters the user can type or paste in the input.
|
|
164
|
-
* The locale-specific decimal separator and negative sign (`-`) count toward the length.
|
|
165
|
-
* The `maxlength` does not apply to the formatted value when the component is not focused.
|
|
166
|
-
*/
|
|
167
|
-
maxlength;
|
|
168
|
-
/**
|
|
169
|
-
* Sets the padding of the internal input element ([see example]({% slug appearance_numerictextbox %}#toc-size)).
|
|
170
|
-
*
|
|
171
|
-
* @default 'medium'
|
|
172
|
-
*/
|
|
173
|
-
set size(size) {
|
|
174
|
-
const newSize = size || DEFAULT_SIZE;
|
|
175
|
-
this.handleClasses(newSize, 'size');
|
|
176
|
-
this._size = newSize;
|
|
177
|
-
}
|
|
178
|
-
get size() {
|
|
179
|
-
return this._size;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Sets the border radius of the NumericTextBox ([see example](slug:appearance_numerictextbox#toc-roundness)).
|
|
183
|
-
*
|
|
184
|
-
* @default 'medium'
|
|
185
|
-
*/
|
|
186
|
-
set rounded(rounded) {
|
|
187
|
-
const newRounded = rounded || DEFAULT_ROUNDED;
|
|
188
|
-
this.handleClasses(newRounded, 'rounded');
|
|
189
|
-
this._rounded = newRounded;
|
|
190
|
-
}
|
|
191
|
-
get rounded() {
|
|
192
|
-
return this._rounded;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Sets the background and border styles of the NumericTextBox ([see example](slug:appearance_numerictextbox#toc-fill-mode)).
|
|
196
|
-
*
|
|
197
|
-
* @default 'solid'
|
|
198
|
-
*/
|
|
199
|
-
set fillMode(fillMode) {
|
|
200
|
-
const newFillMode = fillMode || DEFAULT_FILL_MODE;
|
|
201
|
-
this.handleClasses(newFillMode, 'fillMode');
|
|
202
|
-
this._fillMode = newFillMode;
|
|
203
|
-
}
|
|
204
|
-
get fillMode() {
|
|
205
|
-
return this._fillMode;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Sets HTML attributes on the inner input element.
|
|
209
|
-
* The component ignores attributes that are essential for its functionality.
|
|
210
|
-
*/
|
|
211
|
-
set inputAttributes(attributes) {
|
|
212
|
-
if (isObjectPresent(this.parsedAttributes)) {
|
|
213
|
-
removeHTMLAttributes(this.parsedAttributes, this.renderer, this.numericInput.nativeElement);
|
|
214
|
-
}
|
|
215
|
-
this._inputAttributes = attributes;
|
|
216
|
-
this.parsedAttributes = this.inputAttributes ?
|
|
217
|
-
parseAttributes(this.inputAttributes, this.defaultAttributes) :
|
|
218
|
-
this.inputAttributes;
|
|
219
|
-
this.setInputAttributes();
|
|
220
|
-
}
|
|
221
|
-
get inputAttributes() {
|
|
222
|
-
return this._inputAttributes;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Fires when the user selects a new value ([see example](slug:events_numerictextbox)).
|
|
226
|
-
*/
|
|
227
|
-
valueChange = new EventEmitter();
|
|
228
|
-
/**
|
|
229
|
-
* Fires when the NumericTextBox element is focused ([see example](slug:events_numerictextbox)).
|
|
230
|
-
*/
|
|
231
|
-
onFocus = new EventEmitter();
|
|
232
|
-
/**
|
|
233
|
-
* Fires when the `NumericTextBox` component gets blurred ([see example](slug:events_numerictextbox)).
|
|
234
|
-
*/
|
|
235
|
-
onBlur = new EventEmitter();
|
|
236
|
-
/**
|
|
237
|
-
* Fires when the input element is focused.
|
|
238
|
-
*/
|
|
239
|
-
inputFocus = new EventEmitter();
|
|
240
|
-
/**
|
|
241
|
-
* Fires when the input element gets blurred.
|
|
242
|
-
*/
|
|
243
|
-
inputBlur = new EventEmitter();
|
|
244
|
-
/**
|
|
245
|
-
* @hidden
|
|
246
|
-
*/
|
|
247
|
-
numericInput;
|
|
248
|
-
/**
|
|
249
|
-
* @hidden
|
|
250
|
-
*/
|
|
251
|
-
suffixTemplate;
|
|
252
|
-
/**
|
|
253
|
-
* @hidden
|
|
254
|
-
*/
|
|
255
|
-
prefixTemplate;
|
|
256
|
-
direction;
|
|
257
|
-
/**
|
|
258
|
-
* @hidden
|
|
259
|
-
*/
|
|
260
|
-
ArrowDirection = ArrowDirection;
|
|
261
|
-
/**
|
|
262
|
-
* @hidden
|
|
263
|
-
*/
|
|
264
|
-
arrowDirection = ArrowDirection.None;
|
|
265
|
-
get disableClass() {
|
|
266
|
-
return this.disabled;
|
|
267
|
-
}
|
|
268
|
-
hostClasses = true;
|
|
269
|
-
/**
|
|
270
|
-
* @hidden
|
|
271
|
-
*/
|
|
272
|
-
arrowUpIcon = caretAltUpIcon;
|
|
273
|
-
/**
|
|
274
|
-
* @hidden
|
|
275
|
-
*/
|
|
276
|
-
arrowDownIcon = caretAltDownIcon;
|
|
277
|
-
subscriptions;
|
|
278
|
-
inputValue = '';
|
|
279
|
-
spinTimeout;
|
|
280
|
-
isFocused;
|
|
281
|
-
minValidateFn = noop;
|
|
282
|
-
maxValidateFn = noop;
|
|
283
|
-
numericRegex;
|
|
284
|
-
_format = "n2";
|
|
285
|
-
previousSelection;
|
|
286
|
-
pressedKey;
|
|
287
|
-
control;
|
|
288
|
-
isPasted = false;
|
|
289
|
-
mouseDown = false;
|
|
290
|
-
_size = 'medium';
|
|
291
|
-
_rounded = 'medium';
|
|
292
|
-
_fillMode = 'solid';
|
|
293
|
-
ngChange = noop;
|
|
294
|
-
ngTouched = noop;
|
|
295
|
-
ngValidatorChange = noop;
|
|
296
|
-
domEvents = [];
|
|
297
|
-
_inputAttributes;
|
|
298
|
-
parsedAttributes = {};
|
|
299
|
-
get defaultAttributes() {
|
|
300
|
-
return {
|
|
301
|
-
id: this.focusableId,
|
|
302
|
-
disabled: this.disabled ? '' : null,
|
|
303
|
-
readonly: this.readonly ? '' : null,
|
|
304
|
-
tabindex: this.tabIndex,
|
|
305
|
-
placeholder: this.placeholder,
|
|
306
|
-
title: this.title,
|
|
307
|
-
maxlength: this.maxlength,
|
|
308
|
-
'aria-valuemin': this.min,
|
|
309
|
-
'aria-valuemax': this.max,
|
|
310
|
-
'aria-valuenow': this.value,
|
|
311
|
-
required: this.isControlRequired ? '' : null,
|
|
312
|
-
'aria-invalid': this.isControlInvalid
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
get mutableAttributes() {
|
|
316
|
-
return {
|
|
317
|
-
autocomplete: 'off',
|
|
318
|
-
autocorrect: 'off',
|
|
319
|
-
role: 'spinbutton'
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
constructor(intl, renderer, localizationService, injector, ngZone, changeDetector, hostElement) {
|
|
323
|
-
this.intl = intl;
|
|
324
|
-
this.renderer = renderer;
|
|
325
|
-
this.localizationService = localizationService;
|
|
326
|
-
this.injector = injector;
|
|
327
|
-
this.ngZone = ngZone;
|
|
328
|
-
this.changeDetector = changeDetector;
|
|
329
|
-
this.hostElement = hostElement;
|
|
330
|
-
validatePackage(packageMetadata);
|
|
331
|
-
this.direction = localizationService.rtl ? 'rtl' : 'ltr';
|
|
332
|
-
}
|
|
333
|
-
ngOnInit() {
|
|
334
|
-
this.subscriptions = this.localizationService
|
|
335
|
-
.changes
|
|
336
|
-
.subscribe(({ rtl }) => {
|
|
337
|
-
this.direction = rtl ? 'rtl' : 'ltr';
|
|
338
|
-
});
|
|
339
|
-
this.subscriptions.add(this.intl.changes.subscribe(this.intlChange.bind(this)));
|
|
340
|
-
if (this.hostElement) {
|
|
341
|
-
this.renderer.removeAttribute(this.hostElement.nativeElement, "tabindex");
|
|
342
|
-
}
|
|
343
|
-
this.control = this.injector.get(NgControl, null);
|
|
344
|
-
this.ngZone.runOutsideAngular(() => {
|
|
345
|
-
this.domEvents.push(this.renderer.listen(this.hostElement.nativeElement, 'mousewheel', this.handleWheel.bind(this)));
|
|
346
|
-
this.domEvents.push(this.renderer.listen(this.hostElement.nativeElement, 'DOMMouseScroll', this.handleWheel.bind(this)));
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
ngAfterViewInit() {
|
|
350
|
-
const stylingInputs = ['size', 'rounded', 'fillMode'];
|
|
351
|
-
stylingInputs.forEach(input => {
|
|
352
|
-
this.handleClasses(this[input], input);
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* @hidden
|
|
357
|
-
*/
|
|
358
|
-
increasePress = (e) => {
|
|
359
|
-
this.arrowPress(ArrowDirection.Up, e);
|
|
360
|
-
};
|
|
361
|
-
/**
|
|
362
|
-
* @hidden
|
|
363
|
-
*/
|
|
364
|
-
decreasePress = (e) => {
|
|
365
|
-
this.arrowPress(ArrowDirection.Down, e);
|
|
366
|
-
};
|
|
367
|
-
/**
|
|
368
|
-
* @hidden
|
|
369
|
-
*/
|
|
370
|
-
releaseArrow = () => {
|
|
371
|
-
clearTimeout(this.spinTimeout);
|
|
372
|
-
if (this.arrowDirection !== ArrowDirection.None) {
|
|
373
|
-
this.arrowDirection = ArrowDirection.None;
|
|
374
|
-
this.changeDetector.detectChanges();
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
/**
|
|
378
|
-
* @hidden
|
|
379
|
-
*/
|
|
380
|
-
ngOnChanges(changes) {
|
|
381
|
-
if (anyChanged(PARSABLE_OPTIONS, changes, false)) {
|
|
382
|
-
this.parseOptions(PARSABLE_OPTIONS.filter(option => changes[option]));
|
|
383
|
-
}
|
|
384
|
-
this.verifySettings();
|
|
385
|
-
if (anyChanged(['min', 'max', 'rangeValidation'], changes, false)) {
|
|
386
|
-
this.minValidateFn = this.rangeValidation ? createMinValidator(this.min) : noop;
|
|
387
|
-
this.maxValidateFn = this.rangeValidation ? createMaxValidator(this.max) : noop;
|
|
388
|
-
this.ngValidatorChange();
|
|
389
|
-
}
|
|
390
|
-
if (anyChanged(['autoCorrect', 'decimals', 'min'], changes)) {
|
|
391
|
-
delete this.numericRegex;
|
|
392
|
-
}
|
|
393
|
-
if (anyChanged(['value', 'format'], changes, false)) {
|
|
394
|
-
this.verifyValue(this.value);
|
|
395
|
-
this.value = this.restrictModelValue(this.value);
|
|
396
|
-
if (!this.focused || (this.intl.parseNumber(this.elementValue) !== this.value)) {
|
|
397
|
-
this.setInputValue();
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* @hidden
|
|
403
|
-
*/
|
|
404
|
-
ngOnDestroy() {
|
|
405
|
-
if (this.subscriptions) {
|
|
406
|
-
this.subscriptions.unsubscribe();
|
|
407
|
-
}
|
|
408
|
-
clearTimeout(this.spinTimeout);
|
|
409
|
-
this.domEvents.forEach(unbindHandler => unbindHandler());
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* @hidden
|
|
413
|
-
*/
|
|
414
|
-
validate(control) {
|
|
415
|
-
return this.minValidateFn(control) || this.maxValidateFn(control);
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* @hidden
|
|
419
|
-
*/
|
|
420
|
-
registerOnValidatorChange(fn) {
|
|
421
|
-
this.ngValidatorChange = fn;
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* @hidden
|
|
425
|
-
*/
|
|
426
|
-
writeValue(value) {
|
|
427
|
-
this.verifyValue(value);
|
|
428
|
-
const restrictedValue = this.restrictModelValue(value);
|
|
429
|
-
this.value = restrictedValue;
|
|
430
|
-
this.setInputValue();
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* @hidden
|
|
434
|
-
*/
|
|
435
|
-
registerOnChange(fn) {
|
|
436
|
-
this.ngChange = fn;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* @hidden
|
|
440
|
-
*/
|
|
441
|
-
registerOnTouched(fn) {
|
|
442
|
-
this.ngTouched = fn;
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* @hidden
|
|
446
|
-
* Called when the status of the component changes to or from `disabled`.
|
|
447
|
-
* Depending on the value, it enables or disables the appropriate DOM element.
|
|
448
|
-
*
|
|
449
|
-
* @param isDisabled
|
|
450
|
-
*/
|
|
451
|
-
setDisabledState(isDisabled) {
|
|
452
|
-
this.changeDetector.markForCheck();
|
|
453
|
-
this.disabled = isDisabled;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Focuses the NumericTextBox.
|
|
457
|
-
*/
|
|
458
|
-
focus() {
|
|
459
|
-
invokeElementMethod(this.numericInput, 'focus');
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Blurs the NumericTextBox.
|
|
463
|
-
*/
|
|
464
|
-
blur() {
|
|
465
|
-
invokeElementMethod(this.numericInput, 'blur');
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* Notifies the NumericTextBoxComponent that the input value should be changed.
|
|
469
|
-
* Can be used to update the input after setting the component properties directly.
|
|
470
|
-
*/
|
|
471
|
-
notifyValueChange() {
|
|
472
|
-
this.setInputValue();
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* @hidden
|
|
476
|
-
*/
|
|
477
|
-
handlePaste = () => {
|
|
478
|
-
this.isPasted = true;
|
|
479
|
-
};
|
|
480
|
-
/**
|
|
481
|
-
* @hidden
|
|
482
|
-
*/
|
|
483
|
-
handleInput = () => {
|
|
484
|
-
const input = this.numericInput.nativeElement;
|
|
485
|
-
let { selectionStart, selectionEnd, value: inputValue } = input;
|
|
486
|
-
if (this.pressedKey === Keys.NumpadDecimal) {
|
|
487
|
-
inputValue = this.replaceNumpadDotValue();
|
|
488
|
-
}
|
|
489
|
-
if (this.isPasted) {
|
|
490
|
-
inputValue = this.formatInputValue(this.intl.parseNumber(inputValue));
|
|
491
|
-
}
|
|
492
|
-
if (!this.isValid(inputValue)) {
|
|
493
|
-
input.value = this.inputValue;
|
|
494
|
-
this.setSelection(selectionStart - 1, selectionEnd - 1);
|
|
495
|
-
return;
|
|
496
|
-
}
|
|
497
|
-
const parsedValue = this.intl.parseNumber(inputValue);
|
|
498
|
-
let value = this.restrictDecimals(parsedValue);
|
|
499
|
-
if (this.autoCorrect) {
|
|
500
|
-
const limited = this.limitInputValue(value);
|
|
501
|
-
value = limited.value;
|
|
502
|
-
selectionStart = limited.selectionStart;
|
|
503
|
-
selectionEnd = limited.selectionEnd;
|
|
504
|
-
}
|
|
505
|
-
if (parsedValue !== value || this.hasTrailingZeros(inputValue) || !this.focused) {
|
|
506
|
-
this.setInputValue(value);
|
|
507
|
-
this.setSelection(selectionStart, selectionEnd);
|
|
508
|
-
}
|
|
509
|
-
else {
|
|
510
|
-
this.inputValue = inputValue;
|
|
511
|
-
}
|
|
512
|
-
if (this.isPasted) {
|
|
513
|
-
input.value = this.inputValue;
|
|
514
|
-
}
|
|
515
|
-
this.updateValue(value);
|
|
516
|
-
this.previousSelection = null;
|
|
517
|
-
this.isPasted = false;
|
|
518
|
-
};
|
|
519
|
-
/**
|
|
520
|
-
* @hidden
|
|
521
|
-
*/
|
|
522
|
-
handleDragEnter = () => {
|
|
523
|
-
if (!this.focused && !this.isDisabled) {
|
|
524
|
-
this.setInputValue(this.value, true);
|
|
525
|
-
}
|
|
526
|
-
};
|
|
527
|
-
/**
|
|
528
|
-
* @hidden
|
|
529
|
-
*/
|
|
530
|
-
handleMouseDown = () => {
|
|
531
|
-
this.mouseDown = true;
|
|
532
|
-
};
|
|
533
|
-
/**
|
|
534
|
-
* @hidden
|
|
535
|
-
*/
|
|
536
|
-
handleInputFocus = () => {
|
|
537
|
-
if (!this.focused) {
|
|
538
|
-
this.focused = true;
|
|
539
|
-
if (!this.isDisabled) {
|
|
540
|
-
const shouldSelectAll = this.selectOnFocus || !this.mouseDown;
|
|
541
|
-
this.ngZone.runOutsideAngular(() => {
|
|
542
|
-
setTimeout(() => {
|
|
543
|
-
if (shouldSelectAll) {
|
|
544
|
-
this.selectAll();
|
|
545
|
-
}
|
|
546
|
-
else {
|
|
547
|
-
this.selectCaret();
|
|
548
|
-
}
|
|
549
|
-
}, 0);
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
if (hasObservers(this.onFocus)) {
|
|
553
|
-
this.ngZone.run(() => {
|
|
554
|
-
this.onFocus.emit();
|
|
555
|
-
});
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
this.mouseDown = false;
|
|
559
|
-
if (hasObservers(this.inputFocus)) {
|
|
560
|
-
this.ngZone.run(() => {
|
|
561
|
-
this.inputFocus.emit();
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
/**
|
|
566
|
-
* @hidden
|
|
567
|
-
*/
|
|
568
|
-
handleFocus() {
|
|
569
|
-
this.ngZone.run(() => {
|
|
570
|
-
if (!this.focused && hasObservers(this.onFocus)) {
|
|
571
|
-
this.onFocus.emit();
|
|
572
|
-
}
|
|
573
|
-
this.focused = true;
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
/**
|
|
577
|
-
* @hidden
|
|
578
|
-
*/
|
|
579
|
-
handleBlur = () => {
|
|
580
|
-
this.changeDetector.markForCheck();
|
|
581
|
-
this.focused = false;
|
|
582
|
-
//blur is thrown before input when dragging the input text in IE
|
|
583
|
-
if (this.inputValue !== this.elementValue) {
|
|
584
|
-
this.handleInput();
|
|
585
|
-
}
|
|
586
|
-
this.setInputValue();
|
|
587
|
-
if (hasObservers(this.onBlur)) {
|
|
588
|
-
this.ngZone.run(() => {
|
|
589
|
-
this.ngTouched();
|
|
590
|
-
this.onBlur.emit();
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
/**
|
|
595
|
-
* @hidden
|
|
596
|
-
*/
|
|
597
|
-
handleInputBlur = () => {
|
|
598
|
-
this.changeDetector.markForCheck();
|
|
599
|
-
//blur is thrown before input when dragging the input text in IE
|
|
600
|
-
if (this.inputValue !== this.elementValue) {
|
|
601
|
-
this.handleInput();
|
|
602
|
-
}
|
|
603
|
-
this.setInputValue();
|
|
604
|
-
if (hasObservers(this.inputBlur) || requiresZoneOnBlur(this.control)) {
|
|
605
|
-
this.ngZone.run(() => {
|
|
606
|
-
this.ngTouched();
|
|
607
|
-
this.inputBlur.emit();
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
};
|
|
611
|
-
/**
|
|
612
|
-
* @hidden
|
|
613
|
-
*/
|
|
614
|
-
handleKeyDown = (e) => {
|
|
615
|
-
if (this.isDisabled) {
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
let step;
|
|
619
|
-
const code = normalizeKeys(e);
|
|
620
|
-
if (code === Keys.ArrowDown) {
|
|
621
|
-
step = -1;
|
|
622
|
-
}
|
|
623
|
-
else if (code === Keys.ArrowUp) {
|
|
624
|
-
step = 1;
|
|
625
|
-
}
|
|
626
|
-
if (step && this.step) {
|
|
627
|
-
e.preventDefault();
|
|
628
|
-
this.addStep(step);
|
|
629
|
-
}
|
|
630
|
-
const input = this.numericInput.nativeElement;
|
|
631
|
-
this.previousSelection = {
|
|
632
|
-
end: input.selectionEnd,
|
|
633
|
-
start: input.selectionStart
|
|
634
|
-
};
|
|
635
|
-
this.pressedKey = code;
|
|
636
|
-
};
|
|
637
|
-
/**
|
|
638
|
-
* @hidden
|
|
639
|
-
*/
|
|
640
|
-
handleWheel = (e) => {
|
|
641
|
-
if (this.focused && !this.isDisabled && this.changeValueOnScroll) {
|
|
642
|
-
e.preventDefault();
|
|
643
|
-
const delta = getDeltaFromMouseWheel(e);
|
|
644
|
-
this.addStep(delta);
|
|
645
|
-
}
|
|
646
|
-
};
|
|
647
|
-
/**
|
|
648
|
-
* @hidden
|
|
649
|
-
*/
|
|
650
|
-
get incrementTitle() {
|
|
651
|
-
return this.localizationService.get('increment');
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* @hidden
|
|
655
|
-
*/
|
|
656
|
-
get decrementTitle() {
|
|
657
|
-
return this.localizationService.get('decrement');
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* @hidden
|
|
661
|
-
*/
|
|
662
|
-
get isControlInvalid() {
|
|
663
|
-
return this.control && this.control.touched && !this.control.valid;
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* @hidden
|
|
667
|
-
*/
|
|
668
|
-
get isControlRequired() {
|
|
669
|
-
return isControlRequired(this.control?.control);
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* @hidden
|
|
673
|
-
*/
|
|
674
|
-
get focused() {
|
|
675
|
-
return this.isFocused;
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* @hidden
|
|
679
|
-
*/
|
|
680
|
-
set focused(value) {
|
|
681
|
-
if (this.isFocused !== value && this.hostElement) {
|
|
682
|
-
const wrap = this.hostElement.nativeElement;
|
|
683
|
-
if (value) {
|
|
684
|
-
this.renderer.addClass(wrap, FOCUSED);
|
|
685
|
-
}
|
|
686
|
-
else {
|
|
687
|
-
this.renderer.removeClass(wrap, FOCUSED);
|
|
688
|
-
}
|
|
689
|
-
this.isFocused = value;
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
get decimalSeparator() {
|
|
693
|
-
const numberSymbols = this.intl.numberSymbols();
|
|
694
|
-
return numberSymbols.decimal;
|
|
695
|
-
}
|
|
696
|
-
get elementValue() {
|
|
697
|
-
return this.numericInput.nativeElement.value;
|
|
698
|
-
}
|
|
699
|
-
set elementValue(value) {
|
|
700
|
-
this.renderer.setProperty(this.numericInput.nativeElement, 'value', value);
|
|
701
|
-
}
|
|
702
|
-
get hasDecimals() {
|
|
703
|
-
return this.decimals !== null && this.decimals >= 0;
|
|
704
|
-
}
|
|
705
|
-
get isDisabled() {
|
|
706
|
-
return this.disabled || this.readonly;
|
|
707
|
-
}
|
|
708
|
-
arrowPress(direction, e) {
|
|
709
|
-
e.preventDefault();
|
|
710
|
-
if (this.isDisabled || isRightClick(e)) {
|
|
711
|
-
return;
|
|
712
|
-
}
|
|
713
|
-
if (!mobileOS) {
|
|
714
|
-
this.focus();
|
|
715
|
-
this.focused = true;
|
|
716
|
-
}
|
|
717
|
-
if (this.arrowDirection !== direction) {
|
|
718
|
-
this.arrowDirection = direction;
|
|
719
|
-
this.changeDetector.detectChanges();
|
|
720
|
-
}
|
|
721
|
-
if (this.step) {
|
|
722
|
-
this.spin(direction, INITIAL_SPIN_DELAY);
|
|
723
|
-
}
|
|
724
|
-
else {
|
|
725
|
-
this.setInputValue();
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
updateValue(value) {
|
|
729
|
-
if (!areSame(this.value, value)) {
|
|
730
|
-
this.ngZone.run(() => {
|
|
731
|
-
this.value = value;
|
|
732
|
-
this.ngChange(value);
|
|
733
|
-
this.valueChange.emit(value);
|
|
734
|
-
this.changeDetector.markForCheck();
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
replaceNumpadDotValue() {
|
|
739
|
-
let value = this.inputValue || "";
|
|
740
|
-
if (this.previousSelection) {
|
|
741
|
-
const input = this.numericInput.nativeElement;
|
|
742
|
-
const { selectionStart, selectionEnd } = input;
|
|
743
|
-
const { start, end } = this.previousSelection;
|
|
744
|
-
input.value = value = value.substring(0, start) + this.decimalSeparator + value.substring(end);
|
|
745
|
-
this.setSelection(selectionStart, selectionEnd);
|
|
746
|
-
}
|
|
747
|
-
return value;
|
|
748
|
-
}
|
|
749
|
-
isValid(value) {
|
|
750
|
-
if (!this.numericRegex) {
|
|
751
|
-
this.numericRegex = numericRegex({
|
|
752
|
-
autoCorrect: this.autoCorrect,
|
|
753
|
-
decimals: this.decimals,
|
|
754
|
-
min: this.min,
|
|
755
|
-
separator: this.decimalSeparator
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
return this.numericRegex.test(value);
|
|
759
|
-
}
|
|
760
|
-
spin(step, timeout) {
|
|
761
|
-
clearTimeout(this.spinTimeout);
|
|
762
|
-
this.spinTimeout = window.setTimeout(() => {
|
|
763
|
-
this.spin(step, SPIN_DELAY);
|
|
764
|
-
}, timeout);
|
|
765
|
-
this.addStep(step);
|
|
766
|
-
}
|
|
767
|
-
addStep(step) {
|
|
768
|
-
let value = add(this.value || 0, this.step * step);
|
|
769
|
-
value = this.limitValue(value);
|
|
770
|
-
value = this.restrictDecimals(value);
|
|
771
|
-
this.setInputValue(value);
|
|
772
|
-
this.updateValue(value);
|
|
773
|
-
}
|
|
774
|
-
setSelection(start, end) {
|
|
775
|
-
if (this.focused) {
|
|
776
|
-
invokeElementMethod(this.numericInput, 'setSelectionRange', start, end);
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
limitValue(value) {
|
|
780
|
-
let result = value;
|
|
781
|
-
if (!this.isInRange(value)) {
|
|
782
|
-
if (isNumber(this.max) && value > this.max) {
|
|
783
|
-
result = this.max;
|
|
784
|
-
}
|
|
785
|
-
if (isNumber(this.min) && value < this.min) {
|
|
786
|
-
result = this.min;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
return result;
|
|
790
|
-
}
|
|
791
|
-
limitInputValue(value) {
|
|
792
|
-
const { selectionStart, selectionEnd, value: enteredValue } = this.numericInput.nativeElement;
|
|
793
|
-
let limitedValue = value;
|
|
794
|
-
let selectToEnd = false;
|
|
795
|
-
if (!this.isInRange(value)) {
|
|
796
|
-
const lengthChange = enteredValue.length - String(this.inputValue).length;
|
|
797
|
-
const { min, max } = this;
|
|
798
|
-
const hasMax = isNumber(max);
|
|
799
|
-
const hasMin = isNumber(min);
|
|
800
|
-
let padLimit, replaceNext;
|
|
801
|
-
let correctedValue = value;
|
|
802
|
-
if (selectionStart === 0 && this.inputValue.substr(1) === enteredValue) {
|
|
803
|
-
return {
|
|
804
|
-
selectionEnd: selectionEnd,
|
|
805
|
-
selectionStart: selectionStart,
|
|
806
|
-
value: null
|
|
807
|
-
};
|
|
808
|
-
}
|
|
809
|
-
if (hasMax && value > max) {
|
|
810
|
-
if (value > 0) {
|
|
811
|
-
replaceNext = true;
|
|
812
|
-
}
|
|
813
|
-
else {
|
|
814
|
-
padLimit = max;
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
else if (hasMin && value < min) {
|
|
818
|
-
if (value > 0) {
|
|
819
|
-
padLimit = min;
|
|
820
|
-
}
|
|
821
|
-
else {
|
|
822
|
-
replaceNext = true;
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
if (padLimit) {
|
|
826
|
-
const paddedValue = this.tryPadValue(value, padLimit);
|
|
827
|
-
if (paddedValue && decimalPart(value) !== decimalPart(padLimit)) {
|
|
828
|
-
correctedValue = paddedValue;
|
|
829
|
-
selectToEnd = true;
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
else if (replaceNext) {
|
|
833
|
-
if (this.inputValue && selectionStart !== enteredValue.length) {
|
|
834
|
-
correctedValue = parseFloat(enteredValue.substr(0, selectionStart) +
|
|
835
|
-
enteredValue.substr(selectionStart + lengthChange));
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
limitedValue = this.limitValue(correctedValue);
|
|
839
|
-
selectToEnd = (selectToEnd || limitedValue !== correctedValue) && this.previousSelection &&
|
|
840
|
-
(this.previousSelection.end - this.previousSelection.start + lengthChange) > 0;
|
|
841
|
-
}
|
|
842
|
-
return {
|
|
843
|
-
selectionEnd: selectToEnd ? String(limitedValue).length : selectionEnd,
|
|
844
|
-
selectionStart: selectionStart,
|
|
845
|
-
value: limitedValue
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
tryPadValue(value, limit) {
|
|
849
|
-
const limitLength = String(Math.floor(limit)).length;
|
|
850
|
-
const zeroPadded = pad(value, limitLength);
|
|
851
|
-
const zeroPaddedNext = pad(value, limitLength + 1);
|
|
852
|
-
let result;
|
|
853
|
-
if (this.isInRange(zeroPadded)) {
|
|
854
|
-
result = zeroPadded;
|
|
855
|
-
}
|
|
856
|
-
else if (this.isInRange(zeroPaddedNext)) {
|
|
857
|
-
result = zeroPaddedNext;
|
|
858
|
-
}
|
|
859
|
-
return result;
|
|
860
|
-
}
|
|
861
|
-
isInRange(value) {
|
|
862
|
-
return !isNumber(value) || ((!isNumber(this.min) || this.min <= value) && (!isNumber(this.max) || value <= this.max));
|
|
863
|
-
}
|
|
864
|
-
restrictModelValue(value) {
|
|
865
|
-
let result = this.restrictDecimals(value, true);
|
|
866
|
-
if (this.autoCorrect && this.limitValue(result) !== result) {
|
|
867
|
-
result = null;
|
|
868
|
-
}
|
|
869
|
-
return result;
|
|
870
|
-
}
|
|
871
|
-
restrictDecimals(value, round) {
|
|
872
|
-
let result = value;
|
|
873
|
-
if (value && this.hasDecimals) {
|
|
874
|
-
const decimals = this.decimals;
|
|
875
|
-
const stringValue = String(value);
|
|
876
|
-
if (round || EXPONENT_REGEX.test(stringValue)) {
|
|
877
|
-
result = toFixedPrecision(value, decimals);
|
|
878
|
-
}
|
|
879
|
-
else {
|
|
880
|
-
const parts = stringValue.split(POINT);
|
|
881
|
-
let fraction = parts[1];
|
|
882
|
-
if (fraction && fraction.length > decimals) {
|
|
883
|
-
fraction = fraction.substr(0, decimals);
|
|
884
|
-
result = parseFloat(`${parts[0]}${POINT}${fraction}`);
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
return result;
|
|
889
|
-
}
|
|
890
|
-
formatInputValue(value) {
|
|
891
|
-
let stringValue = Object.is(value, -0) ? '-0' : String(value);
|
|
892
|
-
const exponentMatch = EXPONENT_REGEX.exec(stringValue);
|
|
893
|
-
if (exponentMatch) {
|
|
894
|
-
stringValue = value.toFixed(limitPrecision(parseInt(exponentMatch[1], 10)));
|
|
895
|
-
}
|
|
896
|
-
return stringValue.replace(POINT, this.decimalSeparator);
|
|
897
|
-
}
|
|
898
|
-
formatValue(value, focused) {
|
|
899
|
-
let formattedValue;
|
|
900
|
-
if (value === null || !defined(value) || value === '') {
|
|
901
|
-
formattedValue = '';
|
|
902
|
-
}
|
|
903
|
-
else if (focused && !this.readonly) {
|
|
904
|
-
formattedValue = this.formatInputValue(value);
|
|
905
|
-
}
|
|
906
|
-
else {
|
|
907
|
-
formattedValue = this.intl.formatNumber(value, this.format);
|
|
908
|
-
}
|
|
909
|
-
return formattedValue;
|
|
910
|
-
}
|
|
911
|
-
setInputValue(value = this.value, focused = this.focused) {
|
|
912
|
-
const formattedValue = this.formatValue(value, focused);
|
|
913
|
-
this.elementValue = formattedValue;
|
|
914
|
-
this.inputValue = formattedValue;
|
|
915
|
-
}
|
|
916
|
-
verifySettings() {
|
|
917
|
-
if (!isDevMode()) {
|
|
918
|
-
return;
|
|
919
|
-
}
|
|
920
|
-
if (this.min !== null && this.max !== null && this.min > this.max) {
|
|
921
|
-
throw new Error(`The max value should be bigger than the min. See ${MIN_DOC_LINK} and ${MAX_DOC_LINK}.`);
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
verifyValue(value) {
|
|
925
|
-
if (isDevMode() && value && typeof value !== 'number') {
|
|
926
|
-
throw new Error(`The NumericTextBox component requires value of type Number and ${JSON.stringify(value)} was set.`);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
parseOptions(options) {
|
|
930
|
-
for (let idx = 0; idx < options.length; idx++) {
|
|
931
|
-
const name = options[idx];
|
|
932
|
-
const value = this[name];
|
|
933
|
-
if (typeof value === 'string') {
|
|
934
|
-
const parsed = parseFloat(value);
|
|
935
|
-
const valid = !isNaN(parsed);
|
|
936
|
-
if (isDevMode() && !valid && value !== '') {
|
|
937
|
-
throw new Error('The NumericTextBox component requires value of type Number or a String representing ' +
|
|
938
|
-
`a number for the ${name} property and ${JSON.stringify(value)} was set.`);
|
|
939
|
-
}
|
|
940
|
-
this[name] = valid ? parsed : PARSABLE_DEFAULTS[name];
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
intlChange() {
|
|
945
|
-
delete this.numericRegex;
|
|
946
|
-
if (this.numericInput && (!this.focused || !this.isValid(this.elementValue))) {
|
|
947
|
-
this.setInputValue();
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
hasTrailingZeros(inputValue) {
|
|
951
|
-
if (this.hasDecimals && this.focused) {
|
|
952
|
-
const fraction = inputValue.split(this.decimalSeparator)[1];
|
|
953
|
-
return fraction && fraction.length > this.decimals && fraction.lastIndexOf('0') === fraction.length - 1;
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
selectAll() {
|
|
957
|
-
this.setInputValue();
|
|
958
|
-
this.setSelection(0, this.inputValue.length);
|
|
959
|
-
}
|
|
960
|
-
selectCaret() {
|
|
961
|
-
const caretPosition = getCaretPosition(this.numericInput.nativeElement);
|
|
962
|
-
const formattedValue = this.elementValue;
|
|
963
|
-
const partialValue = formattedValue.substring(0, caretPosition);
|
|
964
|
-
this.setInputValue();
|
|
965
|
-
if (partialValue.length) {
|
|
966
|
-
const significantCharsInFormattedValue = extractSignificantNumericChars(partialValue, this.decimalSeparator);
|
|
967
|
-
const adjustedSignificantChars = this.adjustSignificantChars(formattedValue, significantCharsInFormattedValue);
|
|
968
|
-
this.setSelection(adjustedSignificantChars, adjustedSignificantChars);
|
|
969
|
-
}
|
|
970
|
-
else {
|
|
971
|
-
this.setSelection(0, 0);
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
numberOfLeadingZeroes(formattedValue) {
|
|
975
|
-
const separatorIndex = formattedValue.indexOf(this.decimalSeparator);
|
|
976
|
-
const matchedLeadingZeroes = formattedValue.match(/^[^1-9]*?(0+)/);
|
|
977
|
-
if (matchedLeadingZeroes) {
|
|
978
|
-
const lengthOfMatch = matchedLeadingZeroes[0].length;
|
|
979
|
-
const lengthOfLeadingZeroesMatch = matchedLeadingZeroes[1].length;
|
|
980
|
-
return lengthOfMatch === separatorIndex ? lengthOfLeadingZeroesMatch - 1 : lengthOfLeadingZeroesMatch;
|
|
981
|
-
}
|
|
982
|
-
return 0;
|
|
983
|
-
}
|
|
984
|
-
adjustSignificantChars(formattedValue, significantChars) {
|
|
985
|
-
const leadingZeroes = this.numberOfLeadingZeroes(formattedValue);
|
|
986
|
-
if (leadingZeroes > 0) {
|
|
987
|
-
return Math.max(0, significantChars - leadingZeroes);
|
|
988
|
-
}
|
|
989
|
-
return significantChars;
|
|
990
|
-
}
|
|
991
|
-
handleClasses(value, input) {
|
|
992
|
-
const elem = this.hostElement.nativeElement;
|
|
993
|
-
const classes = getStylingClasses('input', input, this[input], value);
|
|
994
|
-
if (classes.toRemove) {
|
|
995
|
-
this.renderer.removeClass(elem, classes.toRemove);
|
|
996
|
-
}
|
|
997
|
-
if (classes.toAdd) {
|
|
998
|
-
this.renderer.addClass(elem, classes.toAdd);
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
setInputAttributes() {
|
|
1002
|
-
const attributesToRender = Object.assign({}, this.mutableAttributes, this.parsedAttributes);
|
|
1003
|
-
setHTMLAttributes(attributesToRender, this.renderer, this.numericInput.nativeElement, this.ngZone);
|
|
1004
|
-
}
|
|
1005
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NumericTextBoxComponent, deps: [{ token: i1.IntlService }, { token: i0.Renderer2 }, { token: i2.LocalizationService }, { token: i0.Injector }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1006
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: NumericTextBoxComponent, isStandalone: true, selector: "kendo-numerictextbox", inputs: { focusableId: "focusableId", disabled: "disabled", readonly: "readonly", title: "title", autoCorrect: "autoCorrect", format: "format", max: "max", min: "min", decimals: "decimals", placeholder: "placeholder", step: "step", spinners: "spinners", rangeValidation: "rangeValidation", tabindex: "tabindex", tabIndex: "tabIndex", changeValueOnScroll: "changeValueOnScroll", selectOnFocus: "selectOnFocus", value: "value", maxlength: "maxlength", size: "size", rounded: "rounded", fillMode: "fillMode", inputAttributes: "inputAttributes" }, outputs: { valueChange: "valueChange", onFocus: "focus", onBlur: "blur", inputFocus: "inputFocus", inputBlur: "inputBlur" }, host: { properties: { "class.k-readonly": "this.readonly", "attr.dir": "this.direction", "class.k-disabled": "this.disableClass", "class.k-input": "this.hostClasses", "class.k-numerictextbox": "this.hostClasses" } }, providers: [
|
|
1007
|
-
LocalizationService,
|
|
1008
|
-
{ provide: L10N_PREFIX, useValue: 'kendo.numerictextbox' },
|
|
1009
|
-
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => NumericTextBoxComponent), multi: true },
|
|
1010
|
-
{ provide: NG_VALIDATORS, useExisting: forwardRef(() => NumericTextBoxComponent), multi: true },
|
|
1011
|
-
{ provide: KendoInput, useExisting: forwardRef(() => NumericTextBoxComponent) }
|
|
1012
|
-
], queries: [{ propertyName: "suffixTemplate", first: true, predicate: SuffixTemplateDirective, descendants: true }, { propertyName: "prefixTemplate", first: true, predicate: PrefixTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "numericInput", first: true, predicate: ["numericInput"], descendants: true, static: true }], exportAs: ["kendoNumericTextBox"], usesOnChanges: true, ngImport: i0, template: `
|
|
1013
|
-
<ng-container kendoNumericTextBoxLocalizedMessages
|
|
1014
|
-
i18n-increment="kendo.numerictextbox.increment|The title for the **Increment** button in the NumericTextBox"
|
|
1015
|
-
increment="Increase value"
|
|
1016
|
-
i18n-decrement="kendo.numerictextbox.decrement|The title for the **Decrement** button in the NumericTextBox"
|
|
1017
|
-
decrement="Decrease value"
|
|
1018
|
-
>
|
|
1019
|
-
</ng-container>
|
|
1020
|
-
<ng-container
|
|
1021
|
-
kendoInputSharedEvents
|
|
1022
|
-
[hostElement]="hostElement"
|
|
1023
|
-
[(isFocused)]="focused"
|
|
1024
|
-
(handleBlur)="handleBlur()"
|
|
1025
|
-
(onFocus)="handleFocus()"
|
|
1026
|
-
>
|
|
1027
|
-
@if (prefixTemplate) {
|
|
1028
|
-
<span class="k-input-prefix k-input-prefix-horizontal">
|
|
1029
|
-
<ng-template [ngTemplateOutlet]="prefixTemplate?.templateRef">
|
|
1030
|
-
</ng-template>
|
|
1031
|
-
</span>
|
|
1032
|
-
}
|
|
1033
|
-
@if (prefixTemplate && prefixTemplate.showSeparator) {
|
|
1034
|
-
<kendo-input-separator></kendo-input-separator>
|
|
1035
|
-
}
|
|
1036
|
-
<input #numericInput
|
|
1037
|
-
class="k-input-inner"
|
|
1038
|
-
role="spinbutton"
|
|
1039
|
-
autocomplete="off"
|
|
1040
|
-
autocorrect="off"
|
|
1041
|
-
[id]="focusableId"
|
|
1042
|
-
[attr.aria-valuemin]="min"
|
|
1043
|
-
[attr.aria-valuemax]="max"
|
|
1044
|
-
[attr.aria-valuenow]="value"
|
|
1045
|
-
[attr.title]="title"
|
|
1046
|
-
[attr.placeholder]="placeholder"
|
|
1047
|
-
[attr.maxLength]="maxlength"
|
|
1048
|
-
[tabindex]="tabIndex"
|
|
1049
|
-
[disabled]="disabled"
|
|
1050
|
-
[readonly]="readonly"
|
|
1051
|
-
[attr.aria-invalid]="isControlInvalid"
|
|
1052
|
-
[attr.required]="isControlRequired ? '' : null"
|
|
1053
|
-
[kendoEventsOutsideAngular]="{
|
|
1054
|
-
mousedown: handleMouseDown,
|
|
1055
|
-
dragenter: handleDragEnter,
|
|
1056
|
-
keydown: handleKeyDown,
|
|
1057
|
-
input: handleInput,
|
|
1058
|
-
focus: handleInputFocus,
|
|
1059
|
-
blur: handleInputBlur,
|
|
1060
|
-
paste: handlePaste
|
|
1061
|
-
}"/>
|
|
1062
|
-
@if (suffixTemplate && suffixTemplate?.showSeparator) {
|
|
1063
|
-
<kendo-input-separator></kendo-input-separator>
|
|
1064
|
-
}
|
|
1065
|
-
@if (suffixTemplate) {
|
|
1066
|
-
<span class="k-input-suffix k-input-suffix-horizontal">
|
|
1067
|
-
<ng-template [ngTemplateOutlet]="suffixTemplate?.templateRef">
|
|
1068
|
-
</ng-template>
|
|
1069
|
-
</span>
|
|
1070
|
-
}
|
|
1071
|
-
@if (spinners) {
|
|
1072
|
-
<span
|
|
1073
|
-
class="k-input-spinner k-spin-button"
|
|
1074
|
-
[kendoEventsOutsideAngular]="{ mouseup: releaseArrow, mouseleave: releaseArrow }"
|
|
1075
|
-
>
|
|
1076
|
-
<button
|
|
1077
|
-
type="button"
|
|
1078
|
-
[kendoEventsOutsideAngular]="{ mousedown: increasePress }"
|
|
1079
|
-
[attr.aria-hidden]="true"
|
|
1080
|
-
[attr.aria-label]="incrementTitle"
|
|
1081
|
-
[title]="incrementTitle"
|
|
1082
|
-
class="k-spinner-increase k-button k-button-md k-icon-button k-button-solid k-button-solid-base"
|
|
1083
|
-
[class.k-active]="arrowDirection === ArrowDirection.Up"
|
|
1084
|
-
tabindex="-1"
|
|
1085
|
-
>
|
|
1086
|
-
<kendo-icon-wrapper
|
|
1087
|
-
name="caret-alt-up"
|
|
1088
|
-
innerCssClass="k-button-icon"
|
|
1089
|
-
[svgIcon]="arrowUpIcon"
|
|
1090
|
-
>
|
|
1091
|
-
</kendo-icon-wrapper>
|
|
1092
|
-
</button>
|
|
1093
|
-
<button
|
|
1094
|
-
type="button"
|
|
1095
|
-
[kendoEventsOutsideAngular]="{ mousedown: decreasePress }"
|
|
1096
|
-
[attr.aria-hidden]="true"
|
|
1097
|
-
[attr.aria-label]="decrementTitle"
|
|
1098
|
-
[title]="decrementTitle"
|
|
1099
|
-
[class.k-active]="arrowDirection === ArrowDirection.Down"
|
|
1100
|
-
class="k-spinner-decrease k-button k-button-md k-icon-button k-button-solid k-button-solid-base"
|
|
1101
|
-
tabindex="-1"
|
|
1102
|
-
>
|
|
1103
|
-
<kendo-icon-wrapper
|
|
1104
|
-
name="caret-alt-down"
|
|
1105
|
-
innerCssClass="k-button-icon"
|
|
1106
|
-
[svgIcon]="arrowDownIcon"
|
|
1107
|
-
>
|
|
1108
|
-
</kendo-icon-wrapper>
|
|
1109
|
-
</button>
|
|
1110
|
-
</span>
|
|
1111
|
-
}
|
|
1112
|
-
</ng-container>
|
|
1113
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedNumericTextBoxMessagesDirective, selector: "[kendoNumericTextBoxLocalizedMessages]" }, { kind: "directive", type: SharedInputEventsDirective, selector: "[kendoInputSharedEvents]", inputs: ["hostElement", "clearButtonClicked", "isFocused"], outputs: ["isFocusedChange", "onFocus", "handleBlur"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: InputSeparatorComponent, selector: "kendo-input-separator, kendo-textbox-separator", inputs: ["orientation"] }, { kind: "directive", type: EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }] });
|
|
1114
|
-
}
|
|
1115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NumericTextBoxComponent, decorators: [{
|
|
1116
|
-
type: Component,
|
|
1117
|
-
args: [{
|
|
1118
|
-
exportAs: 'kendoNumericTextBox',
|
|
1119
|
-
providers: [
|
|
1120
|
-
LocalizationService,
|
|
1121
|
-
{ provide: L10N_PREFIX, useValue: 'kendo.numerictextbox' },
|
|
1122
|
-
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => NumericTextBoxComponent), multi: true },
|
|
1123
|
-
{ provide: NG_VALIDATORS, useExisting: forwardRef(() => NumericTextBoxComponent), multi: true },
|
|
1124
|
-
{ provide: KendoInput, useExisting: forwardRef(() => NumericTextBoxComponent) }
|
|
1125
|
-
],
|
|
1126
|
-
selector: 'kendo-numerictextbox',
|
|
1127
|
-
template: `
|
|
1128
|
-
<ng-container kendoNumericTextBoxLocalizedMessages
|
|
1129
|
-
i18n-increment="kendo.numerictextbox.increment|The title for the **Increment** button in the NumericTextBox"
|
|
1130
|
-
increment="Increase value"
|
|
1131
|
-
i18n-decrement="kendo.numerictextbox.decrement|The title for the **Decrement** button in the NumericTextBox"
|
|
1132
|
-
decrement="Decrease value"
|
|
1133
|
-
>
|
|
1134
|
-
</ng-container>
|
|
1135
|
-
<ng-container
|
|
1136
|
-
kendoInputSharedEvents
|
|
1137
|
-
[hostElement]="hostElement"
|
|
1138
|
-
[(isFocused)]="focused"
|
|
1139
|
-
(handleBlur)="handleBlur()"
|
|
1140
|
-
(onFocus)="handleFocus()"
|
|
1141
|
-
>
|
|
1142
|
-
@if (prefixTemplate) {
|
|
1143
|
-
<span class="k-input-prefix k-input-prefix-horizontal">
|
|
1144
|
-
<ng-template [ngTemplateOutlet]="prefixTemplate?.templateRef">
|
|
1145
|
-
</ng-template>
|
|
1146
|
-
</span>
|
|
1147
|
-
}
|
|
1148
|
-
@if (prefixTemplate && prefixTemplate.showSeparator) {
|
|
1149
|
-
<kendo-input-separator></kendo-input-separator>
|
|
1150
|
-
}
|
|
1151
|
-
<input #numericInput
|
|
1152
|
-
class="k-input-inner"
|
|
1153
|
-
role="spinbutton"
|
|
1154
|
-
autocomplete="off"
|
|
1155
|
-
autocorrect="off"
|
|
1156
|
-
[id]="focusableId"
|
|
1157
|
-
[attr.aria-valuemin]="min"
|
|
1158
|
-
[attr.aria-valuemax]="max"
|
|
1159
|
-
[attr.aria-valuenow]="value"
|
|
1160
|
-
[attr.title]="title"
|
|
1161
|
-
[attr.placeholder]="placeholder"
|
|
1162
|
-
[attr.maxLength]="maxlength"
|
|
1163
|
-
[tabindex]="tabIndex"
|
|
1164
|
-
[disabled]="disabled"
|
|
1165
|
-
[readonly]="readonly"
|
|
1166
|
-
[attr.aria-invalid]="isControlInvalid"
|
|
1167
|
-
[attr.required]="isControlRequired ? '' : null"
|
|
1168
|
-
[kendoEventsOutsideAngular]="{
|
|
1169
|
-
mousedown: handleMouseDown,
|
|
1170
|
-
dragenter: handleDragEnter,
|
|
1171
|
-
keydown: handleKeyDown,
|
|
1172
|
-
input: handleInput,
|
|
1173
|
-
focus: handleInputFocus,
|
|
1174
|
-
blur: handleInputBlur,
|
|
1175
|
-
paste: handlePaste
|
|
1176
|
-
}"/>
|
|
1177
|
-
@if (suffixTemplate && suffixTemplate?.showSeparator) {
|
|
1178
|
-
<kendo-input-separator></kendo-input-separator>
|
|
1179
|
-
}
|
|
1180
|
-
@if (suffixTemplate) {
|
|
1181
|
-
<span class="k-input-suffix k-input-suffix-horizontal">
|
|
1182
|
-
<ng-template [ngTemplateOutlet]="suffixTemplate?.templateRef">
|
|
1183
|
-
</ng-template>
|
|
1184
|
-
</span>
|
|
1185
|
-
}
|
|
1186
|
-
@if (spinners) {
|
|
1187
|
-
<span
|
|
1188
|
-
class="k-input-spinner k-spin-button"
|
|
1189
|
-
[kendoEventsOutsideAngular]="{ mouseup: releaseArrow, mouseleave: releaseArrow }"
|
|
1190
|
-
>
|
|
1191
|
-
<button
|
|
1192
|
-
type="button"
|
|
1193
|
-
[kendoEventsOutsideAngular]="{ mousedown: increasePress }"
|
|
1194
|
-
[attr.aria-hidden]="true"
|
|
1195
|
-
[attr.aria-label]="incrementTitle"
|
|
1196
|
-
[title]="incrementTitle"
|
|
1197
|
-
class="k-spinner-increase k-button k-button-md k-icon-button k-button-solid k-button-solid-base"
|
|
1198
|
-
[class.k-active]="arrowDirection === ArrowDirection.Up"
|
|
1199
|
-
tabindex="-1"
|
|
1200
|
-
>
|
|
1201
|
-
<kendo-icon-wrapper
|
|
1202
|
-
name="caret-alt-up"
|
|
1203
|
-
innerCssClass="k-button-icon"
|
|
1204
|
-
[svgIcon]="arrowUpIcon"
|
|
1205
|
-
>
|
|
1206
|
-
</kendo-icon-wrapper>
|
|
1207
|
-
</button>
|
|
1208
|
-
<button
|
|
1209
|
-
type="button"
|
|
1210
|
-
[kendoEventsOutsideAngular]="{ mousedown: decreasePress }"
|
|
1211
|
-
[attr.aria-hidden]="true"
|
|
1212
|
-
[attr.aria-label]="decrementTitle"
|
|
1213
|
-
[title]="decrementTitle"
|
|
1214
|
-
[class.k-active]="arrowDirection === ArrowDirection.Down"
|
|
1215
|
-
class="k-spinner-decrease k-button k-button-md k-icon-button k-button-solid k-button-solid-base"
|
|
1216
|
-
tabindex="-1"
|
|
1217
|
-
>
|
|
1218
|
-
<kendo-icon-wrapper
|
|
1219
|
-
name="caret-alt-down"
|
|
1220
|
-
innerCssClass="k-button-icon"
|
|
1221
|
-
[svgIcon]="arrowDownIcon"
|
|
1222
|
-
>
|
|
1223
|
-
</kendo-icon-wrapper>
|
|
1224
|
-
</button>
|
|
1225
|
-
</span>
|
|
1226
|
-
}
|
|
1227
|
-
</ng-container>
|
|
1228
|
-
`,
|
|
1229
|
-
standalone: true,
|
|
1230
|
-
imports: [LocalizedNumericTextBoxMessagesDirective, SharedInputEventsDirective, NgTemplateOutlet, InputSeparatorComponent, EventsOutsideAngularDirective, IconWrapperComponent]
|
|
1231
|
-
}]
|
|
1232
|
-
}], ctorParameters: () => [{ type: i1.IntlService }, { type: i0.Renderer2 }, { type: i2.LocalizationService }, { type: i0.Injector }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }], propDecorators: { focusableId: [{
|
|
1233
|
-
type: Input
|
|
1234
|
-
}], disabled: [{
|
|
1235
|
-
type: Input
|
|
1236
|
-
}], readonly: [{
|
|
1237
|
-
type: Input
|
|
1238
|
-
}, {
|
|
1239
|
-
type: HostBinding,
|
|
1240
|
-
args: ['class.k-readonly']
|
|
1241
|
-
}], title: [{
|
|
1242
|
-
type: Input
|
|
1243
|
-
}], autoCorrect: [{
|
|
1244
|
-
type: Input
|
|
1245
|
-
}], format: [{
|
|
1246
|
-
type: Input
|
|
1247
|
-
}], max: [{
|
|
1248
|
-
type: Input
|
|
1249
|
-
}], min: [{
|
|
1250
|
-
type: Input
|
|
1251
|
-
}], decimals: [{
|
|
1252
|
-
type: Input
|
|
1253
|
-
}], placeholder: [{
|
|
1254
|
-
type: Input
|
|
1255
|
-
}], step: [{
|
|
1256
|
-
type: Input
|
|
1257
|
-
}], spinners: [{
|
|
1258
|
-
type: Input
|
|
1259
|
-
}], rangeValidation: [{
|
|
1260
|
-
type: Input
|
|
1261
|
-
}], tabindex: [{
|
|
1262
|
-
type: Input
|
|
1263
|
-
}], tabIndex: [{
|
|
1264
|
-
type: Input
|
|
1265
|
-
}], changeValueOnScroll: [{
|
|
1266
|
-
type: Input
|
|
1267
|
-
}], selectOnFocus: [{
|
|
1268
|
-
type: Input
|
|
1269
|
-
}], value: [{
|
|
1270
|
-
type: Input
|
|
1271
|
-
}], maxlength: [{
|
|
1272
|
-
type: Input
|
|
1273
|
-
}], size: [{
|
|
1274
|
-
type: Input
|
|
1275
|
-
}], rounded: [{
|
|
1276
|
-
type: Input
|
|
1277
|
-
}], fillMode: [{
|
|
1278
|
-
type: Input
|
|
1279
|
-
}], inputAttributes: [{
|
|
1280
|
-
type: Input
|
|
1281
|
-
}], valueChange: [{
|
|
1282
|
-
type: Output
|
|
1283
|
-
}], onFocus: [{
|
|
1284
|
-
type: Output,
|
|
1285
|
-
args: ['focus']
|
|
1286
|
-
}], onBlur: [{
|
|
1287
|
-
type: Output,
|
|
1288
|
-
args: ['blur']
|
|
1289
|
-
}], inputFocus: [{
|
|
1290
|
-
type: Output
|
|
1291
|
-
}], inputBlur: [{
|
|
1292
|
-
type: Output
|
|
1293
|
-
}], numericInput: [{
|
|
1294
|
-
type: ViewChild,
|
|
1295
|
-
args: ['numericInput', { static: true }]
|
|
1296
|
-
}], suffixTemplate: [{
|
|
1297
|
-
type: ContentChild,
|
|
1298
|
-
args: [SuffixTemplateDirective]
|
|
1299
|
-
}], prefixTemplate: [{
|
|
1300
|
-
type: ContentChild,
|
|
1301
|
-
args: [PrefixTemplateDirective]
|
|
1302
|
-
}], direction: [{
|
|
1303
|
-
type: HostBinding,
|
|
1304
|
-
args: ['attr.dir']
|
|
1305
|
-
}], disableClass: [{
|
|
1306
|
-
type: HostBinding,
|
|
1307
|
-
args: ['class.k-disabled']
|
|
1308
|
-
}], hostClasses: [{
|
|
1309
|
-
type: HostBinding,
|
|
1310
|
-
args: ['class.k-input']
|
|
1311
|
-
}, {
|
|
1312
|
-
type: HostBinding,
|
|
1313
|
-
args: ['class.k-numerictextbox']
|
|
1314
|
-
}] } });
|