@progress/kendo-react-inputs 5.4.0-dev.202205271059 → 5.4.0-dev.202206090823
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/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/dist/es/checkbox/Checkbox.d.ts +1 -1
- package/dist/es/checkbox/Checkbox.js +2 -2
- package/dist/es/colors/ColorContrastLabels.js +3 -3
- package/dist/es/colors/ColorGradient.d.ts +1 -1
- package/dist/es/colors/ColorGradient.js +7 -3
- package/dist/es/colors/ColorPalette.d.ts +4 -1
- package/dist/es/colors/ColorPalette.js +10 -3
- package/dist/es/colors/ColorPicker.d.ts +1 -1
- package/dist/es/colors/ColorPicker.js +4 -4
- package/dist/es/colors/FlatColorPicker.d.ts +1 -1
- package/dist/es/colors/FlatColorPicker.js +25 -24
- package/dist/es/colors/HexInput.d.ts +1 -1
- package/dist/es/colors/utils/color-parser.js +2 -2
- package/dist/es/colors/utils/svg-calc.js +4 -4
- package/dist/es/common/SliderTooltip.js +3 -3
- package/dist/es/common/SwitchController.js +5 -1
- package/dist/es/common/SwitchModel.d.ts +1 -1
- package/dist/es/input/Input.js +2 -1
- package/dist/es/maskedtextbox/MaskedTextBox.d.ts +7 -7
- package/dist/es/maskedtextbox/MaskedTextBox.js +7 -6
- package/dist/es/maskedtextbox/parsing/parsers.d.ts +2 -2
- package/dist/es/maskedtextbox/parsing/parsers.js +28 -32
- package/dist/es/maskedtextbox/parsing/result.js +1 -1
- package/dist/es/numerictextbox/NumericTextBox.d.ts +1 -1
- package/dist/es/numerictextbox/NumericTextBox.js +3 -3
- package/dist/es/numerictextbox/utils/index.d.ts +1 -1
- package/dist/es/numerictextbox/utils/index.js +5 -5
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/RadioButton.d.ts +1 -1
- package/dist/es/radiobutton/RadioButton.js +1 -1
- package/dist/es/radiobutton/RadioGroup.d.ts +1 -1
- package/dist/es/range-slider/RangeSlider.d.ts +1 -1
- package/dist/es/range-slider/RangeSlider.js +7 -7
- package/dist/es/rating/Rating.d.ts +1 -1
- package/dist/es/rating/Rating.js +15 -12
- package/dist/es/rating/RatingItem.d.ts +1 -1
- package/dist/es/rating/models/index.d.ts +4 -0
- package/dist/es/slider/Slider.d.ts +2 -2
- package/dist/es/slider/Slider.js +2 -0
- package/dist/es/slider/SliderLabel.js +2 -2
- package/dist/es/switch/Switch.d.ts +6 -6
- package/dist/es/switch/Switch.js +7 -4
- package/dist/es/textarea/TextArea.d.ts +1 -1
- package/dist/es/textarea/TextArea.js +4 -4
- package/dist/es/utils.js +9 -5
- package/dist/npm/checkbox/Checkbox.d.ts +1 -1
- package/dist/npm/checkbox/Checkbox.js +14 -14
- package/dist/npm/colors/ColorContrastLabels.js +6 -6
- package/dist/npm/colors/ColorContrastSvg.js +6 -6
- package/dist/npm/colors/ColorGradient.d.ts +1 -1
- package/dist/npm/colors/ColorGradient.js +37 -33
- package/dist/npm/colors/ColorInput.js +3 -3
- package/dist/npm/colors/ColorPalette.d.ts +4 -1
- package/dist/npm/colors/ColorPalette.js +19 -12
- package/dist/npm/colors/ColorPicker.d.ts +1 -1
- package/dist/npm/colors/ColorPicker.js +13 -13
- package/dist/npm/colors/FlatColorPicker.d.ts +1 -1
- package/dist/npm/colors/FlatColorPicker.js +27 -26
- package/dist/npm/colors/HexInput.d.ts +1 -1
- package/dist/npm/colors/HexInput.js +3 -3
- package/dist/npm/colors/Picker.js +1 -1
- package/dist/npm/colors/utils/color-palette.service.js +6 -6
- package/dist/npm/colors/utils/color-parser.js +26 -26
- package/dist/npm/colors/utils/misc.js +1 -1
- package/dist/npm/colors/utils/svg-calc.js +4 -4
- package/dist/npm/common/SliderTooltip.js +4 -4
- package/dist/npm/common/SwitchController.js +5 -1
- package/dist/npm/common/SwitchModel.d.ts +1 -1
- package/dist/npm/input/Input.js +7 -6
- package/dist/npm/main.js +5 -1
- package/dist/npm/maskedtextbox/MaskedTextBox.d.ts +7 -7
- package/dist/npm/maskedtextbox/MaskedTextBox.js +13 -12
- package/dist/npm/maskedtextbox/masking.service.js +19 -19
- package/dist/npm/maskedtextbox/parsing/parsers.d.ts +2 -2
- package/dist/npm/maskedtextbox/parsing/parsers.js +28 -32
- package/dist/npm/maskedtextbox/parsing/result.js +1 -1
- package/dist/npm/numerictextbox/NumericTextBox.d.ts +1 -1
- package/dist/npm/numerictextbox/NumericTextBox.js +31 -31
- package/dist/npm/numerictextbox/utils/index.d.ts +1 -1
- package/dist/npm/numerictextbox/utils/index.js +61 -61
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/radiobutton/RadioButton.d.ts +1 -1
- package/dist/npm/radiobutton/RadioButton.js +10 -10
- package/dist/npm/radiobutton/RadioGroup.d.ts +1 -1
- package/dist/npm/radiobutton/RadioGroup.js +10 -10
- package/dist/npm/range-slider/RangeSlider.d.ts +1 -1
- package/dist/npm/range-slider/RangeSlider.js +17 -17
- package/dist/npm/rating/Rating.d.ts +1 -1
- package/dist/npm/rating/Rating.js +36 -33
- package/dist/npm/rating/RatingItem.d.ts +1 -1
- package/dist/npm/rating/RatingItem.js +2 -2
- package/dist/npm/rating/models/index.d.ts +4 -0
- package/dist/npm/rating/rating-reducer.js +4 -4
- package/dist/npm/rating/utils/index.js +5 -5
- package/dist/npm/slider/Slider.d.ts +2 -2
- package/dist/npm/slider/Slider.js +9 -7
- package/dist/npm/slider/SliderLabel.js +3 -3
- package/dist/npm/switch/Switch.d.ts +6 -6
- package/dist/npm/switch/Switch.js +17 -14
- package/dist/npm/textarea/TextArea.d.ts +1 -1
- package/dist/npm/textarea/TextArea.js +13 -13
- package/dist/npm/utils.js +9 -5
- package/dist/systemjs/kendo-react-inputs.js +1 -1
- package/package.json +15 -15
|
@@ -29,28 +29,28 @@ var VALIDATION_MESSAGE = 'Please enter a valid value!';
|
|
|
29
29
|
*
|
|
30
30
|
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
31
31
|
*/
|
|
32
|
-
exports.NumericTextBoxPropsContext = kendo_react_common_1.createPropsContext();
|
|
32
|
+
exports.NumericTextBoxPropsContext = (0, kendo_react_common_1.createPropsContext)();
|
|
33
33
|
/**
|
|
34
34
|
* Represents the [KendoReact NumericTextBox component]({% slug overview_numerictextbox %}).
|
|
35
35
|
*/
|
|
36
36
|
exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
37
37
|
var _a;
|
|
38
|
-
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
39
|
-
var props = kendo_react_common_1.usePropsContext(exports.NumericTextBoxPropsContext, directProps);
|
|
40
|
-
var calculatedId = React.useMemo(function () { return kendo_react_common_1.guid(); }, []);
|
|
38
|
+
(0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
|
|
39
|
+
var props = (0, kendo_react_common_1.usePropsContext)(exports.NumericTextBoxPropsContext, directProps);
|
|
40
|
+
var calculatedId = React.useMemo(function () { return (0, kendo_react_common_1.guid)(); }, []);
|
|
41
41
|
var inputId = props.id || calculatedId;
|
|
42
|
-
var intlService = kendo_react_intl_1.useInternationalization();
|
|
43
|
-
var localizationService = kendo_react_intl_1.useLocalization();
|
|
42
|
+
var intlService = (0, kendo_react_intl_1.useInternationalization)();
|
|
43
|
+
var localizationService = (0, kendo_react_intl_1.useLocalization)();
|
|
44
44
|
var elementRef = React.useRef(null);
|
|
45
45
|
var valueDuringChangeRef = React.useRef();
|
|
46
46
|
var _b = React.useState(false), forceUpdate = _b[0], setForceUpdate = _b[1];
|
|
47
|
-
var stateRef = React.useRef(utils_1.getInitialState());
|
|
47
|
+
var stateRef = React.useRef((0, utils_1.getInitialState)());
|
|
48
48
|
var isPasteRef = React.useRef(false);
|
|
49
49
|
var prevLooseValueRef = React.useRef();
|
|
50
50
|
var stateValueRef = React.useRef(props.defaultValue);
|
|
51
|
-
var looseValue = utils_1.formatValue(stateRef.current.focused && !props.disabled ?
|
|
51
|
+
var looseValue = (0, utils_1.formatValue)(stateRef.current.focused && !props.disabled ?
|
|
52
52
|
stateRef.current.currentLooseValue :
|
|
53
|
-
utils_1.getStateOrPropsValue(props.value, stateValueRef.current), props.format, intlService);
|
|
53
|
+
(0, utils_1.getStateOrPropsValue)(props.value, stateValueRef.current), props.format, intlService);
|
|
54
54
|
prevLooseValueRef.current = looseValue;
|
|
55
55
|
React.useEffect(function () {
|
|
56
56
|
if (elementRef.current && elementRef.current.setCustomValidity) {
|
|
@@ -69,7 +69,7 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
69
69
|
return valueDuringChangeRef.current;
|
|
70
70
|
}
|
|
71
71
|
else {
|
|
72
|
-
return utils_1.getStateOrPropsValue(props.value, stateValueRef.current);
|
|
72
|
+
return (0, utils_1.getStateOrPropsValue)(props.value, stateValueRef.current);
|
|
73
73
|
}
|
|
74
74
|
}, [props.value]);
|
|
75
75
|
var nameGetter = React.useCallback(function () {
|
|
@@ -113,7 +113,7 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
113
113
|
React.useImperativeHandle(target, getImperativeHandle);
|
|
114
114
|
var getCurrentState = React.useCallback(function () {
|
|
115
115
|
return {
|
|
116
|
-
eventValue: utils_1.getStateOrPropsValue(props.value, stateValueRef.current),
|
|
116
|
+
eventValue: (0, utils_1.getStateOrPropsValue)(props.value, stateValueRef.current),
|
|
117
117
|
prevLooseValue: prevLooseValueRef.current,
|
|
118
118
|
currentLooseValue: elementRef.current.value,
|
|
119
119
|
selectionStart: elementRef.current.selectionStart,
|
|
@@ -131,8 +131,8 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
131
131
|
}
|
|
132
132
|
valueDuringChangeRef.current = newState.eventValue;
|
|
133
133
|
stateValueRef.current = newState.eventValue;
|
|
134
|
-
var formattedValue = utils_1.formatValue(utils_1.rangeValue(newState.eventValue, props.min, props.max), props.format, intlService);
|
|
135
|
-
var rangedValue = utils_1.rangeValue(intlService.parseNumber(formattedValue, props.format), props.min, props.max);
|
|
134
|
+
var formattedValue = (0, utils_1.formatValue)((0, utils_1.rangeValue)(newState.eventValue, props.min, props.max), props.format, intlService);
|
|
135
|
+
var rangedValue = (0, utils_1.rangeValue)(intlService.parseNumber(formattedValue, props.format), props.min, props.max);
|
|
136
136
|
if (rangedValue !== newState.eventValue) {
|
|
137
137
|
newState.valueIsOutOfRange = true;
|
|
138
138
|
newState.eventValue = rangedValue;
|
|
@@ -140,7 +140,7 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
140
140
|
}
|
|
141
141
|
var shouldFireEvent = props.value !== newState.eventValue;
|
|
142
142
|
if (shouldFireEvent) {
|
|
143
|
-
kendo_react_common_1.dispatchEvent(props.onChange, event, getImperativeHandle(), { value: newState.eventValue });
|
|
143
|
+
(0, kendo_react_common_1.dispatchEvent)(props.onChange, event, getImperativeHandle(), { value: newState.eventValue });
|
|
144
144
|
}
|
|
145
145
|
valueDuringChangeRef.current = undefined;
|
|
146
146
|
stateRef.current = newState;
|
|
@@ -149,7 +149,7 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
149
149
|
var onChangeHandler = React.useCallback(function (event) {
|
|
150
150
|
var stateCandidate = getCurrentState();
|
|
151
151
|
isPasteRef.current = false;
|
|
152
|
-
triggerChange(event, utils_1.sanitizeNumber(stateCandidate, props.format, intlService));
|
|
152
|
+
triggerChange(event, (0, utils_1.sanitizeNumber)(stateCandidate, props.format, intlService));
|
|
153
153
|
}, [props.format, props.onChange, intlService, triggerChange, getCurrentState]);
|
|
154
154
|
var onKeyDown = React.useCallback(function (event) {
|
|
155
155
|
var newState = getCurrentState();
|
|
@@ -163,21 +163,21 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
163
163
|
switch (event.keyCode) {
|
|
164
164
|
case 38:
|
|
165
165
|
// Arrow up
|
|
166
|
-
utils_1.increaseValue(currentValue, newState, props.step, props.min, props.max, props.format, intlService);
|
|
166
|
+
(0, utils_1.increaseValue)(currentValue, newState, props.step, props.min, props.max, props.format, intlService);
|
|
167
167
|
break;
|
|
168
168
|
case 40:
|
|
169
169
|
// Arrow down
|
|
170
|
-
utils_1.decreaseValue(currentValue, newState, props.step, props.min, props.max, props.format, intlService);
|
|
170
|
+
(0, utils_1.decreaseValue)(currentValue, newState, props.step, props.min, props.max, props.format, intlService);
|
|
171
171
|
break;
|
|
172
172
|
case 13:
|
|
173
173
|
// Enter - range values
|
|
174
174
|
if (props.rangeOnEnter === false) {
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
|
-
var formattedValue = utils_1.formatValue(utils_1.rangeValue(currentValue, props.min, props.max), props.format, intlService);
|
|
178
|
-
var rangedValue = utils_1.rangeValue(intlService.parseNumber(formattedValue, props.format), props.min, props.max);
|
|
177
|
+
var formattedValue = (0, utils_1.formatValue)((0, utils_1.rangeValue)(currentValue, props.min, props.max), props.format, intlService);
|
|
178
|
+
var rangedValue = (0, utils_1.rangeValue)(intlService.parseNumber(formattedValue, props.format), props.min, props.max);
|
|
179
179
|
newState.eventValue = rangedValue;
|
|
180
|
-
newState.currentLooseValue = utils_1.formatValue(rangedValue, props.format, intlService);
|
|
180
|
+
newState.currentLooseValue = (0, utils_1.formatValue)(rangedValue, props.format, intlService);
|
|
181
181
|
newState.selectionStart = newState.selectionEnd = newState.currentLooseValue.length;
|
|
182
182
|
break;
|
|
183
183
|
case 110:
|
|
@@ -189,7 +189,7 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
189
189
|
symbols.decimal +
|
|
190
190
|
newState.currentLooseValue.slice(newState.selectionEnd);
|
|
191
191
|
newState.selectionStart = newState.selectionEnd = newState.selectionStart + 1;
|
|
192
|
-
newState = utils_1.sanitizeNumber(newState, props.format, intlService);
|
|
192
|
+
newState = (0, utils_1.sanitizeNumber)(newState, props.format, intlService);
|
|
193
193
|
}
|
|
194
194
|
break;
|
|
195
195
|
default:
|
|
@@ -207,7 +207,7 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
209
|
var newState = getCurrentState();
|
|
210
|
-
utils_1.increaseValue(intlService.parseNumber(String(newState.currentLooseValue), props.format), newState, props.step, props.min, props.max, props.format, intlService);
|
|
210
|
+
(0, utils_1.increaseValue)(intlService.parseNumber(String(newState.currentLooseValue), props.format), newState, props.step, props.min, props.max, props.format, intlService);
|
|
211
211
|
triggerChange(event, newState);
|
|
212
212
|
}, [props.format, props.min, props.max, props.step, props.onChange, props.readOnly, props.disabled, triggerChange, getCurrentState]);
|
|
213
213
|
var onDecrease = React.useCallback(function (event) {
|
|
@@ -216,7 +216,7 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
218
|
var newState = getCurrentState();
|
|
219
|
-
utils_1.decreaseValue(intlService.parseNumber(String(newState.currentLooseValue), props.format), newState, props.step, props.min, props.max, props.format, intlService);
|
|
219
|
+
(0, utils_1.decreaseValue)(intlService.parseNumber(String(newState.currentLooseValue), props.format), newState, props.step, props.min, props.max, props.format, intlService);
|
|
220
220
|
triggerChange(event, newState);
|
|
221
221
|
}, [props.format, props.min, props.max, props.step, props.onChange, props.readOnly, props.disabled, triggerChange, getCurrentState]);
|
|
222
222
|
var onWheelHandler = React.useCallback(function (event) {
|
|
@@ -237,12 +237,12 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
237
237
|
var onFocus = React.useCallback(function (event) {
|
|
238
238
|
stateRef.current.currentLooseValue = prevLooseValueRef.current;
|
|
239
239
|
stateRef.current.focused = true;
|
|
240
|
-
kendo_react_common_1.dispatchEvent(props.onFocus, event, getImperativeHandle(), {});
|
|
240
|
+
(0, kendo_react_common_1.dispatchEvent)(props.onFocus, event, getImperativeHandle(), {});
|
|
241
241
|
setForceUpdate(function (x) { return !x; });
|
|
242
242
|
}, [props.onFocus, setForceUpdate, getImperativeHandle]);
|
|
243
243
|
var onBlur = React.useCallback(function (event) {
|
|
244
|
-
stateRef.current = utils_1.getInitialState();
|
|
245
|
-
kendo_react_common_1.dispatchEvent(props.onBlur, event, getImperativeHandle(), {});
|
|
244
|
+
stateRef.current = (0, utils_1.getInitialState)();
|
|
245
|
+
(0, kendo_react_common_1.dispatchEvent)(props.onBlur, event, getImperativeHandle(), {});
|
|
246
246
|
setForceUpdate(function (x) { return !x; });
|
|
247
247
|
}, [props.onBlur, setForceUpdate, getImperativeHandle]);
|
|
248
248
|
var onMouseDown = React.useCallback(function (e) {
|
|
@@ -263,15 +263,15 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
263
263
|
}, [forceUpdate]);
|
|
264
264
|
var isValid = !validityStylesGetter() || validityGetter().valid;
|
|
265
265
|
var numerictextbox = (React.createElement("span", { dir: props.dir, style: !props.label
|
|
266
|
-
? __assign({ width: props.width }, props.style) : props.style, className: kendo_react_common_1.classNames('k-input', 'k-numerictextbox', (_a = {},
|
|
267
|
-
_a["k-input-"
|
|
268
|
-
_a["k-input-"
|
|
269
|
-
_a["k-rounded-"
|
|
266
|
+
? __assign({ width: props.width }, props.style) : props.style, className: (0, kendo_react_common_1.classNames)('k-input', 'k-numerictextbox', (_a = {},
|
|
267
|
+
_a["k-input-".concat(kendo_react_common_1.kendoThemeMaps.sizeMap[props.size] || props.size)] = props.size,
|
|
268
|
+
_a["k-input-".concat(props.fillMode)] = props.fillMode,
|
|
269
|
+
_a["k-rounded-".concat(kendo_react_common_1.kendoThemeMaps.roundedMap[props.rounded] || props.rounded)] = props.rounded,
|
|
270
270
|
_a['k-invalid'] = !isValid,
|
|
271
271
|
_a['k-required'] = props.required,
|
|
272
272
|
_a['k-disabled'] = props.disabled,
|
|
273
273
|
_a), props.className), "aria-disabled": props.disabled ? 'true' : undefined },
|
|
274
|
-
React.createElement("input", { value: looseValue === null ? '' : looseValue, tabIndex: kendo_react_common_1.getTabIndex(props.tabIndex, props.disabled), accessKey: props.accessKey, disabled: props.disabled, title: props.title, "aria-valuemin": props.min, "aria-valuemax": props.max, "aria-label": props.ariaLabel, "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy, placeholder: props.placeholder, spellCheck: false, autoComplete: 'off', autoCorrect: 'off', type: props.inputType || 'tel', className: 'k-input-inner', id: inputId, name: props.name, readOnly: props.readOnly, style: props.inputStyle, onChange: onChangeHandler, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onPaste: onPasteHandler, onWheel: onWheelHandler, ref: elementRef }),
|
|
274
|
+
React.createElement("input", { value: looseValue === null ? '' : looseValue, tabIndex: (0, kendo_react_common_1.getTabIndex)(props.tabIndex, props.disabled), accessKey: props.accessKey, disabled: props.disabled, title: props.title, "aria-valuemin": props.min, "aria-valuemax": props.max, "aria-label": props.ariaLabel, "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy, placeholder: props.placeholder, spellCheck: false, autoComplete: 'off', autoCorrect: 'off', type: props.inputType || 'tel', className: 'k-input-inner', id: inputId, name: props.name, readOnly: props.readOnly, style: props.inputStyle, onChange: onChangeHandler, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onPaste: onPasteHandler, onWheel: onWheelHandler, ref: elementRef }),
|
|
275
275
|
props.children,
|
|
276
276
|
props.spinners &&
|
|
277
277
|
(React.createElement("span", { className: "k-input-spinner k-spin-button", onMouseDown: onMouseDown },
|
|
@@ -35,7 +35,7 @@ export declare const decreaseValue: (value: any, newState: any, step: any, min:
|
|
|
35
35
|
/**
|
|
36
36
|
* @hidden
|
|
37
37
|
*/
|
|
38
|
-
export declare const rangeValue: (value: number | null, min
|
|
38
|
+
export declare const rangeValue: (value: number | null, min?: number, max?: number) => number | null;
|
|
39
39
|
/**
|
|
40
40
|
* @hidden
|
|
41
41
|
*/
|
|
@@ -65,7 +65,7 @@ exports.fractionLength = fractionLength;
|
|
|
65
65
|
* @hidden
|
|
66
66
|
*/
|
|
67
67
|
var maxFractionLength = function (value1, value2) {
|
|
68
|
-
return Math.max(exports.fractionLength(value1), exports.fractionLength(value2));
|
|
68
|
+
return Math.max((0, exports.fractionLength)(value1), (0, exports.fractionLength)(value2));
|
|
69
69
|
};
|
|
70
70
|
/**
|
|
71
71
|
* @hidden
|
|
@@ -76,7 +76,7 @@ exports.limitPrecision = limitPrecision;
|
|
|
76
76
|
* @hidden
|
|
77
77
|
*/
|
|
78
78
|
var toFixedPrecision = function (value, precision) {
|
|
79
|
-
var maxPrecision = exports.limitPrecision(precision);
|
|
79
|
+
var maxPrecision = (0, exports.limitPrecision)(precision);
|
|
80
80
|
return parseFloat(value.toFixed(maxPrecision));
|
|
81
81
|
};
|
|
82
82
|
exports.toFixedPrecision = toFixedPrecision;
|
|
@@ -85,10 +85,10 @@ exports.toFixedPrecision = toFixedPrecision;
|
|
|
85
85
|
*/
|
|
86
86
|
var increaseValue = function (value, newState, step, min, max, format, intlService) {
|
|
87
87
|
var maxPrecision = maxFractionLength(value || 0, step || 0);
|
|
88
|
-
var increasedValue = exports.rangeValue(exports.toFixedPrecision((value || 0) + (step || 0), maxPrecision), min, max);
|
|
88
|
+
var increasedValue = (0, exports.rangeValue)((0, exports.toFixedPrecision)((value || 0) + (step || 0), maxPrecision), min, max);
|
|
89
89
|
newState.eventValue = increasedValue;
|
|
90
|
-
newState.currentLooseValue = exports.formatValue(increasedValue, format, intlService);
|
|
91
|
-
newState.selectionStart = newState.selectionEnd = exports.getLastNumberIndex(newState.currentLooseValue, DIGITS_REGEX);
|
|
90
|
+
newState.currentLooseValue = (0, exports.formatValue)(increasedValue, format, intlService);
|
|
91
|
+
newState.selectionStart = newState.selectionEnd = (0, exports.getLastNumberIndex)(newState.currentLooseValue, DIGITS_REGEX);
|
|
92
92
|
};
|
|
93
93
|
exports.increaseValue = increaseValue;
|
|
94
94
|
/**
|
|
@@ -96,10 +96,10 @@ exports.increaseValue = increaseValue;
|
|
|
96
96
|
*/
|
|
97
97
|
var decreaseValue = function (value, newState, step, min, max, format, intlService) {
|
|
98
98
|
var maxPrecision = maxFractionLength(value || 0, step || 0);
|
|
99
|
-
var decreasedValue = exports.rangeValue(exports.toFixedPrecision((value || 0) - (step || 0), maxPrecision), min, max);
|
|
99
|
+
var decreasedValue = (0, exports.rangeValue)((0, exports.toFixedPrecision)((value || 0) - (step || 0), maxPrecision), min, max);
|
|
100
100
|
newState.eventValue = decreasedValue;
|
|
101
|
-
newState.currentLooseValue = exports.formatValue(decreasedValue, format, intlService);
|
|
102
|
-
newState.selectionStart = newState.selectionEnd = exports.getLastNumberIndex(newState.currentLooseValue, DIGITS_REGEX);
|
|
101
|
+
newState.currentLooseValue = (0, exports.formatValue)(decreasedValue, format, intlService);
|
|
102
|
+
newState.selectionStart = newState.selectionEnd = (0, exports.getLastNumberIndex)(newState.currentLooseValue, DIGITS_REGEX);
|
|
103
103
|
};
|
|
104
104
|
exports.decreaseValue = decreaseValue;
|
|
105
105
|
/**
|
|
@@ -159,7 +159,7 @@ exports.getMinCursorPosition = getMinCursorPosition;
|
|
|
159
159
|
* @hidden
|
|
160
160
|
*/
|
|
161
161
|
var rangeSelection = function (nextLooseValue, formatInfo, newState) {
|
|
162
|
-
var maxPosition = exports.getMaxCursorPosition(nextLooseValue, formatInfo);
|
|
162
|
+
var maxPosition = (0, exports.getMaxCursorPosition)(nextLooseValue, formatInfo);
|
|
163
163
|
if (maxPosition !== -1 && newState.selectionStart > maxPosition) {
|
|
164
164
|
newState.selectionStart = newState.selectionEnd = maxPosition;
|
|
165
165
|
return;
|
|
@@ -167,7 +167,7 @@ var rangeSelection = function (nextLooseValue, formatInfo, newState) {
|
|
|
167
167
|
if (newState.selectionStart > nextLooseValue.length) {
|
|
168
168
|
newState.selectionStart = newState.selectionEnd = nextLooseValue.length;
|
|
169
169
|
}
|
|
170
|
-
var minPosition = exports.getMinCursorPosition(nextLooseValue, formatInfo);
|
|
170
|
+
var minPosition = (0, exports.getMinCursorPosition)(nextLooseValue, formatInfo);
|
|
171
171
|
if (minPosition !== -1 && newState.selectionStart < minPosition) {
|
|
172
172
|
newState.selectionStart = newState.selectionEnd = minPosition;
|
|
173
173
|
}
|
|
@@ -181,7 +181,7 @@ exports.rangeSelection = rangeSelection;
|
|
|
181
181
|
*/
|
|
182
182
|
var setSelection = function (newState, newIndex, nextLooseValue, formatInfo) {
|
|
183
183
|
newState.selectionStart = newState.selectionEnd = newIndex;
|
|
184
|
-
exports.rangeSelection(nextLooseValue, formatInfo, newState);
|
|
184
|
+
(0, exports.rangeSelection)(nextLooseValue, formatInfo, newState);
|
|
185
185
|
};
|
|
186
186
|
exports.setSelection = setSelection;
|
|
187
187
|
/**
|
|
@@ -191,7 +191,7 @@ var setInvalid = function (newState, format, formatInfo, intlService) {
|
|
|
191
191
|
newState.eventValue = intlService.parseNumber(newState.prevLooseValue, format);
|
|
192
192
|
newState.currentLooseValue = newState.prevLooseValue;
|
|
193
193
|
newState.valueIsCorrected = true;
|
|
194
|
-
exports.setSelection(newState, newState.selectionStart, newState.currentLooseValue, formatInfo);
|
|
194
|
+
(0, exports.setSelection)(newState, newState.selectionStart, newState.currentLooseValue, formatInfo);
|
|
195
195
|
};
|
|
196
196
|
exports.setInvalid = setInvalid;
|
|
197
197
|
/**
|
|
@@ -229,14 +229,14 @@ var getFormatPrefixSufix = function (format, intlService) {
|
|
|
229
229
|
var negativeResult = intlService.formatNumber(-DEFAULT_NUMBER, format);
|
|
230
230
|
var zeroResult = intlService.formatNumber(ZERO_NUMBER, format);
|
|
231
231
|
var oneResult = intlService.formatNumber(ONE_NUMBER, format);
|
|
232
|
-
var positivePrefix = exports.getPrefix(positiveResult);
|
|
233
|
-
var negativePrefix = exports.getPrefix(negativeResult);
|
|
234
|
-
var zeroPrefix = exports.getPrefix(zeroResult);
|
|
235
|
-
var onePrefix = exports.getPrefix(oneResult);
|
|
236
|
-
var positiveSuffix = exports.getSuffix(positiveResult);
|
|
237
|
-
var negativeSuffix = exports.getSuffix(negativeResult);
|
|
238
|
-
var zeroSuffix = exports.getSuffix(zeroResult);
|
|
239
|
-
var oneSuffix = exports.getSuffix(oneResult);
|
|
232
|
+
var positivePrefix = (0, exports.getPrefix)(positiveResult);
|
|
233
|
+
var negativePrefix = (0, exports.getPrefix)(negativeResult);
|
|
234
|
+
var zeroPrefix = (0, exports.getPrefix)(zeroResult);
|
|
235
|
+
var onePrefix = (0, exports.getPrefix)(oneResult);
|
|
236
|
+
var positiveSuffix = (0, exports.getSuffix)(positiveResult);
|
|
237
|
+
var negativeSuffix = (0, exports.getSuffix)(negativeResult);
|
|
238
|
+
var zeroSuffix = (0, exports.getSuffix)(zeroResult);
|
|
239
|
+
var oneSuffix = (0, exports.getSuffix)(oneResult);
|
|
240
240
|
return {
|
|
241
241
|
positiveInfo: [positivePrefix, positiveSuffix],
|
|
242
242
|
negativeInfo: [negativePrefix, negativeSuffix],
|
|
@@ -254,7 +254,7 @@ var getFormatSymbols = function (format, intlService) {
|
|
|
254
254
|
var zeroResult = intlService.formatNumber(ZERO_NUMBER, format);
|
|
255
255
|
var oneResult = intlService.formatNumber(ONE_NUMBER, format);
|
|
256
256
|
var symbols = intlService.numberSymbols();
|
|
257
|
-
var sanitizeRegex = new RegExp("[\\d\\"
|
|
257
|
+
var sanitizeRegex = new RegExp("[\\d\\".concat(symbols.decimal).concat(symbols.group, "]"), 'g');
|
|
258
258
|
var resultWithDuplicates = [positiveResult, negativeResult, zeroResult, oneResult]
|
|
259
259
|
.map(function (result) { return result.replace(sanitizeRegex, ''); })
|
|
260
260
|
.join('');
|
|
@@ -272,7 +272,7 @@ var getInitialPosition = function (nextLooseValue, symbols) {
|
|
|
272
272
|
if (decimalIdex > -1) {
|
|
273
273
|
return decimalIdex;
|
|
274
274
|
}
|
|
275
|
-
return exports.getLastNumberIndex(nextLooseValue, DIGITS_REGEX);
|
|
275
|
+
return (0, exports.getLastNumberIndex)(nextLooseValue, DIGITS_REGEX);
|
|
276
276
|
};
|
|
277
277
|
exports.getInitialPosition = getInitialPosition;
|
|
278
278
|
/**
|
|
@@ -286,7 +286,7 @@ exports.reverseString = reverseString;
|
|
|
286
286
|
* @hidden
|
|
287
287
|
*/
|
|
288
288
|
var getLastNumberIndex = function (currentLooseValue, inputRegex) {
|
|
289
|
-
return currentLooseValue.length - exports.reverseString(currentLooseValue).search(inputRegex);
|
|
289
|
+
return currentLooseValue.length - (0, exports.reverseString)(currentLooseValue).search(inputRegex);
|
|
290
290
|
};
|
|
291
291
|
exports.getLastNumberIndex = getLastNumberIndex;
|
|
292
292
|
/**
|
|
@@ -300,8 +300,8 @@ exports.getPrefix = getPrefix;
|
|
|
300
300
|
* @hidden
|
|
301
301
|
*/
|
|
302
302
|
var getSuffix = function (str) {
|
|
303
|
-
var reversedString = exports.reverseString(str);
|
|
304
|
-
return exports.reverseString(reversedString.split(reversedString[reversedString.search(DIGITS_REGEX)])[0]);
|
|
303
|
+
var reversedString = (0, exports.reverseString)(str);
|
|
304
|
+
return (0, exports.reverseString)(reversedString.split(reversedString[reversedString.search(DIGITS_REGEX)])[0]);
|
|
305
305
|
};
|
|
306
306
|
exports.getSuffix = getSuffix;
|
|
307
307
|
/**
|
|
@@ -354,15 +354,15 @@ var sanitizeNumber = function (state, format, intlService) {
|
|
|
354
354
|
var newState = __assign({}, state);
|
|
355
355
|
var prevLooseValue = newState.prevLooseValue;
|
|
356
356
|
var symbols = intlService.numberSymbols();
|
|
357
|
-
var restrictedSymbols = exports.getFormatSymbols(format, intlService);
|
|
357
|
+
var restrictedSymbols = (0, exports.getFormatSymbols)(format, intlService);
|
|
358
358
|
var currentLooseValueAsString = String(newState.currentLooseValue);
|
|
359
359
|
var prevLooseValueAsString = String(prevLooseValue);
|
|
360
|
-
var sanitizeRegex = new RegExp("[^\\d\\"
|
|
361
|
-
var sanitizeGroupRegex = new RegExp("[^\\d\\"
|
|
362
|
-
var allSymbolsRegex = new RegExp("[\\d\\"
|
|
360
|
+
var sanitizeRegex = new RegExp("[^\\d\\".concat(symbols.decimal, "]"), 'g');
|
|
361
|
+
var sanitizeGroupRegex = new RegExp("[^\\d\\".concat(symbols.decimal, "\\").concat(symbols.group, "]"), 'g');
|
|
362
|
+
var allSymbolsRegex = new RegExp("[\\d\\".concat(symbols.decimal, "\\").concat(symbols.group, "]"));
|
|
363
363
|
var sanitizedString = currentLooseValueAsString.replace(sanitizeRegex, '');
|
|
364
|
-
var numberStart = exports.getFirstNumberIndex(currentLooseValueAsString, DIGITS_REGEX);
|
|
365
|
-
var numberEnd = numberStart === -1 ? -1 : exports.getLastNumberIndex(currentLooseValueAsString, DIGITS_REGEX);
|
|
364
|
+
var numberStart = (0, exports.getFirstNumberIndex)(currentLooseValueAsString, DIGITS_REGEX);
|
|
365
|
+
var numberEnd = numberStart === -1 ? -1 : (0, exports.getLastNumberIndex)(currentLooseValueAsString, DIGITS_REGEX);
|
|
366
366
|
var decimalIndex = currentLooseValueAsString.indexOf(symbols.decimal);
|
|
367
367
|
var sanitizedFormattedString = (currentLooseValueAsString.substring(0, numberStart) +
|
|
368
368
|
currentLooseValueAsString.substring(numberStart, numberEnd).replace(sanitizeGroupRegex, '') +
|
|
@@ -376,11 +376,11 @@ var sanitizeNumber = function (state, format, intlService) {
|
|
|
376
376
|
var formattedMin = intlService.formatNumber(MIN_DECIMAL, format).replace(sanitizeRegex, '');
|
|
377
377
|
var minDecimalIndex = formattedMin.indexOf(symbols.decimal);
|
|
378
378
|
var minDecimalCount = minDecimalIndex > -1 ? formattedMin.length - minDecimalIndex - 1 : 0;
|
|
379
|
-
var _a = exports.getFormatPrefixSufix(format, intlService), positiveInfo = _a.positiveInfo, negativeInfo = _a.negativeInfo, zeroInfo = _a.zeroInfo, oneInfo = _a.oneInfo;
|
|
379
|
+
var _a = (0, exports.getFormatPrefixSufix)(format, intlService), positiveInfo = _a.positiveInfo, negativeInfo = _a.negativeInfo, zeroInfo = _a.zeroInfo, oneInfo = _a.oneInfo;
|
|
380
380
|
var formatInfo = [positiveInfo, negativeInfo, zeroInfo, oneInfo];
|
|
381
381
|
var isFormatContainPrefixSuffix = formatInfo.findIndex(function (info) { return info.findIndex(function (nestedInfo) { return Boolean(nestedInfo); }) !== -1; }) !== 1;
|
|
382
382
|
var isDelete = currentLooseValueAsString.length > 0 && currentLooseValueAsString.length < prevLooseValueAsString.length;
|
|
383
|
-
var isPercentFormat = format &&
|
|
383
|
+
var isPercentFormat = typeof format === 'string' &&
|
|
384
384
|
format[0] === 'p' &&
|
|
385
385
|
currentLooseValueAsString &&
|
|
386
386
|
currentLooseValueAsString.indexOf(symbols.percentSign) === -1;
|
|
@@ -394,31 +394,31 @@ var sanitizeNumber = function (state, format, intlService) {
|
|
|
394
394
|
// 2. Check is minus sign
|
|
395
395
|
if (newState.currentLooseValue === symbols.minusSign && intlService.formatNumber(-0, format) !== prevLooseValueAsString) {
|
|
396
396
|
newState.eventValue = -0;
|
|
397
|
-
newState.currentLooseValue = exports.formatValue(newState.eventValue, format, intlService);
|
|
398
|
-
exports.setSelection(newState, exports.getInitialPosition(newState.currentLooseValue, symbols), newState.currentLooseValue, formatInfo);
|
|
397
|
+
newState.currentLooseValue = (0, exports.formatValue)(newState.eventValue, format, intlService);
|
|
398
|
+
(0, exports.setSelection)(newState, (0, exports.getInitialPosition)(newState.currentLooseValue, symbols), newState.currentLooseValue, formatInfo);
|
|
399
399
|
return newState;
|
|
400
400
|
}
|
|
401
401
|
// 3. Minus sign toggle
|
|
402
|
-
if (exports.isMinusSymbolAdded(newState, symbols)) {
|
|
402
|
+
if ((0, exports.isMinusSymbolAdded)(newState, symbols)) {
|
|
403
403
|
var nextValue = intlService.parseNumber(prevLooseValue, format);
|
|
404
404
|
newState.eventValue = -(nextValue !== null ? nextValue : 0);
|
|
405
|
-
newState.currentLooseValue = exports.formatValue(newState.eventValue, format, intlService);
|
|
406
|
-
var currentNumberStart = exports.getFirstNumberIndex(newState.currentLooseValue, DIGITS_REGEX);
|
|
407
|
-
var oldNumberStart = exports.getFirstNumberIndex(prevLooseValueAsString, DIGITS_REGEX);
|
|
408
|
-
exports.setSelection(newState, newState.selectionEnd - 1 + (currentNumberStart - oldNumberStart), newState.currentLooseValue, formatInfo);
|
|
405
|
+
newState.currentLooseValue = (0, exports.formatValue)(newState.eventValue, format, intlService);
|
|
406
|
+
var currentNumberStart = (0, exports.getFirstNumberIndex)(newState.currentLooseValue, DIGITS_REGEX);
|
|
407
|
+
var oldNumberStart = (0, exports.getFirstNumberIndex)(prevLooseValueAsString, DIGITS_REGEX);
|
|
408
|
+
(0, exports.setSelection)(newState, newState.selectionEnd - 1 + (currentNumberStart - oldNumberStart), newState.currentLooseValue, formatInfo);
|
|
409
409
|
return newState;
|
|
410
410
|
}
|
|
411
|
-
if (exports.isMinusSymbolRemoved(newState, symbols)) {
|
|
411
|
+
if ((0, exports.isMinusSymbolRemoved)(newState, symbols)) {
|
|
412
412
|
newState.eventValue = intlService.parseNumber(newState.currentLooseValue, format);
|
|
413
|
-
exports.setSelection(newState, newState.selectionStart, newState.currentLooseValue, formatInfo);
|
|
413
|
+
(0, exports.setSelection)(newState, newState.selectionStart, newState.currentLooseValue, formatInfo);
|
|
414
414
|
return newState;
|
|
415
415
|
}
|
|
416
416
|
// 4. Check is decimal symbol
|
|
417
417
|
if (newState.currentLooseValue === symbols.decimal) {
|
|
418
418
|
newState.eventValue = 0;
|
|
419
|
-
var valueCandidate = exports.formatValue(newState.eventValue, format, intlService);
|
|
419
|
+
var valueCandidate = (0, exports.formatValue)(newState.eventValue, format, intlService);
|
|
420
420
|
if (minDecimalCount === 0 && maxDecimalCount > 0) {
|
|
421
|
-
var currentLastNumberIndex = exports.getLastNumberIndex(valueCandidate, DIGITS_REGEX);
|
|
421
|
+
var currentLastNumberIndex = (0, exports.getLastNumberIndex)(valueCandidate, DIGITS_REGEX);
|
|
422
422
|
newState.currentLooseValue = valueCandidate.substring(0, currentLastNumberIndex) +
|
|
423
423
|
symbols.decimal +
|
|
424
424
|
valueCandidate.substring(currentLastNumberIndex);
|
|
@@ -426,24 +426,24 @@ var sanitizeNumber = function (state, format, intlService) {
|
|
|
426
426
|
else {
|
|
427
427
|
newState.currentLooseValue = valueCandidate;
|
|
428
428
|
}
|
|
429
|
-
exports.setSelection(newState, exports.getInitialPosition(newState.currentLooseValue, symbols) + 1, newState.currentLooseValue, formatInfo);
|
|
429
|
+
(0, exports.setSelection)(newState, (0, exports.getInitialPosition)(newState.currentLooseValue, symbols) + 1, newState.currentLooseValue, formatInfo);
|
|
430
430
|
return newState;
|
|
431
431
|
}
|
|
432
432
|
// 5. Duplicate decimal - it's possible only as trailing
|
|
433
|
-
if (exports.isDecimalDuplicated(newState, symbols)) {
|
|
434
|
-
exports.setInvalid(newState, format, formatInfo, intlService);
|
|
433
|
+
if ((0, exports.isDecimalDuplicated)(newState, symbols)) {
|
|
434
|
+
(0, exports.setInvalid)(newState, format, formatInfo, intlService);
|
|
435
435
|
return newState;
|
|
436
436
|
}
|
|
437
437
|
// 6. Percent format
|
|
438
438
|
if (isPercentFormat) {
|
|
439
439
|
newState.eventValue = intlService.parseNumber(currentLooseValueAsString, format) / 100;
|
|
440
|
-
newState.currentLooseValue = exports.formatValue(newState.eventValue, format, intlService);
|
|
440
|
+
newState.currentLooseValue = (0, exports.formatValue)(newState.eventValue, format, intlService);
|
|
441
441
|
return newState;
|
|
442
442
|
}
|
|
443
443
|
// 7. More than 15 numeric symbols
|
|
444
444
|
var numericSymbols = String(newState.currentLooseValue).replace(/[^\d]/g, '');
|
|
445
445
|
if (numericSymbols.length > MAX_PRECISION) {
|
|
446
|
-
exports.setInvalid(newState, format, formatInfo, intlService);
|
|
446
|
+
(0, exports.setInvalid)(newState, format, formatInfo, intlService);
|
|
447
447
|
return newState;
|
|
448
448
|
}
|
|
449
449
|
// 8. Check prefix / suffix for modifications
|
|
@@ -483,7 +483,7 @@ var sanitizeNumber = function (state, format, intlService) {
|
|
|
483
483
|
return false;
|
|
484
484
|
});
|
|
485
485
|
if (formatInfoIndex === -1) {
|
|
486
|
-
exports.setInvalid(newState, format, formatInfo, intlService);
|
|
486
|
+
(0, exports.setInvalid)(newState, format, formatInfo, intlService);
|
|
487
487
|
return newState;
|
|
488
488
|
}
|
|
489
489
|
}
|
|
@@ -502,7 +502,7 @@ var sanitizeNumber = function (state, format, intlService) {
|
|
|
502
502
|
prevLooseValueAsString.split('').filter(function (x) { return x === s; }).length &&
|
|
503
503
|
currentLooseValueAsString.length + 1 === prevLooseValueAsString.length) {
|
|
504
504
|
if (s === symbols.decimal &&
|
|
505
|
-
exports.getDecimalCount(prevLooseValueAsString.replace(sanitizeRegex, ''), symbols.decimal) === 0) {
|
|
505
|
+
(0, exports.getDecimalCount)(prevLooseValueAsString.replace(sanitizeRegex, ''), symbols.decimal) === 0) {
|
|
506
506
|
return false;
|
|
507
507
|
}
|
|
508
508
|
return true;
|
|
@@ -515,12 +515,12 @@ var sanitizeNumber = function (state, format, intlService) {
|
|
|
515
515
|
return newState;
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
var currentDecimalCount = exports.getDecimalCount(sanitizedString, symbols.decimal);
|
|
518
|
+
var currentDecimalCount = (0, exports.getDecimalCount)(sanitizedString, symbols.decimal);
|
|
519
519
|
var endsOnDecimal = sanitizedString[sanitizedString.length - 1] === '0';
|
|
520
520
|
// 11. Deleting more decimals than allowed
|
|
521
521
|
if (isDelete && endsOnDecimal && currentDecimalCount < minDecimalCount) {
|
|
522
522
|
newState.eventValue = intlService.parseNumber(newState.currentLooseValue, format);
|
|
523
|
-
newState.currentLooseValue = exports.formatValue(newState.eventValue, format, intlService);
|
|
523
|
+
newState.currentLooseValue = (0, exports.formatValue)(newState.eventValue, format, intlService);
|
|
524
524
|
return newState;
|
|
525
525
|
}
|
|
526
526
|
// 12. Ending on zero OR more decimals than allowed
|
|
@@ -529,8 +529,8 @@ var sanitizeNumber = function (state, format, intlService) {
|
|
|
529
529
|
if (endsOnDecimal && (!valueUntillDecimal || prevLooseValueAsString.indexOf(valueUntillDecimal) !== 0)) {
|
|
530
530
|
// ending on zero but typing before decimal separator
|
|
531
531
|
newState.eventValue = intlService.parseNumber(newState.currentLooseValue, format);
|
|
532
|
-
var nextLooseValue = exports.formatValue(newState.eventValue, format, intlService);
|
|
533
|
-
exports.setSelection(newState, exports.changeBasedSelection(currentLooseValueAsString, nextLooseValue, newState.selectionEnd, isDelete, sanitizeRegex), nextLooseValue, formatInfo);
|
|
532
|
+
var nextLooseValue = (0, exports.formatValue)(newState.eventValue, format, intlService);
|
|
533
|
+
(0, exports.setSelection)(newState, (0, exports.changeBasedSelection)(currentLooseValueAsString, nextLooseValue, newState.selectionEnd, isDelete, sanitizeRegex), nextLooseValue, formatInfo);
|
|
534
534
|
newState.currentLooseValue = nextLooseValue;
|
|
535
535
|
return newState;
|
|
536
536
|
}
|
|
@@ -542,7 +542,7 @@ var sanitizeNumber = function (state, format, intlService) {
|
|
|
542
542
|
currentLooseValueAsString.substring(numberEnd, String(newState.currentLooseValue).length);
|
|
543
543
|
newState.eventValue = intlService.parseNumber(result, format);
|
|
544
544
|
newState.currentLooseValue = result;
|
|
545
|
-
exports.setSelection(newState, newState.selectionStart, result, formatInfo);
|
|
545
|
+
(0, exports.setSelection)(newState, newState.selectionStart, result, formatInfo);
|
|
546
546
|
return newState;
|
|
547
547
|
}
|
|
548
548
|
if (minDecimalCount !== maxDecimalCount && currentDecimalCount <= maxDecimalCount && endsOnDecimal) {
|
|
@@ -554,7 +554,7 @@ var sanitizeNumber = function (state, format, intlService) {
|
|
|
554
554
|
if (currentDecimalCount < minDecimalCount) {
|
|
555
555
|
// deleting more decimals than allowed
|
|
556
556
|
newState.eventValue = intlService.parseNumber(newState.currentLooseValue, format);
|
|
557
|
-
newState.currentLooseValue = exports.formatValue(newState.eventValue, format, intlService);
|
|
557
|
+
newState.currentLooseValue = (0, exports.formatValue)(newState.eventValue, format, intlService);
|
|
558
558
|
return newState;
|
|
559
559
|
}
|
|
560
560
|
}
|
|
@@ -565,19 +565,19 @@ var sanitizeNumber = function (state, format, intlService) {
|
|
|
565
565
|
newState.eventValue = newState.eventValue / 100;
|
|
566
566
|
}
|
|
567
567
|
if (typeof newState.eventValue === 'number') {
|
|
568
|
-
var nextLooseValue = exports.formatValue(newState.eventValue, format, intlService);
|
|
568
|
+
var nextLooseValue = (0, exports.formatValue)(newState.eventValue, format, intlService);
|
|
569
569
|
// First digit add
|
|
570
570
|
if (currentLooseValueAsString.length === 1) {
|
|
571
|
-
exports.setSelection(newState, exports.getInitialPosition(nextLooseValue, symbols), nextLooseValue, formatInfo);
|
|
571
|
+
(0, exports.setSelection)(newState, (0, exports.getInitialPosition)(nextLooseValue, symbols), nextLooseValue, formatInfo);
|
|
572
572
|
}
|
|
573
573
|
else {
|
|
574
|
-
exports.setSelection(newState, exports.changeBasedSelection(currentLooseValueAsString, nextLooseValue, newState.selectionEnd, isDelete, sanitizeRegex), nextLooseValue, formatInfo);
|
|
574
|
+
(0, exports.setSelection)(newState, (0, exports.changeBasedSelection)(currentLooseValueAsString, nextLooseValue, newState.selectionEnd, isDelete, sanitizeRegex), nextLooseValue, formatInfo);
|
|
575
575
|
}
|
|
576
576
|
newState.currentLooseValue = nextLooseValue;
|
|
577
577
|
}
|
|
578
578
|
else {
|
|
579
579
|
// Case when deleting last number
|
|
580
|
-
newState.currentLooseValue = exports.formatValue(intlService.parseNumber(sanitizedString), format, intlService);
|
|
580
|
+
newState.currentLooseValue = (0, exports.formatValue)(intlService.parseNumber(sanitizedString), format, intlService);
|
|
581
581
|
}
|
|
582
582
|
return newState;
|
|
583
583
|
};
|
|
@@ -8,7 +8,7 @@ exports.packageMetadata = {
|
|
|
8
8
|
name: '@progress/kendo-react-inputs',
|
|
9
9
|
productName: 'KendoReact',
|
|
10
10
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
11
|
-
publishDate:
|
|
11
|
+
publishDate: 1654761952,
|
|
12
12
|
version: '',
|
|
13
13
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
14
14
|
};
|
|
@@ -20,4 +20,4 @@ export declare const RadioButtonPropsContext: React.Context<(p: RadioButtonProps
|
|
|
20
20
|
* Accepts properties of type [RadioButtonProps]({% slug api_inputs_radiobuttonprops %}).
|
|
21
21
|
* Obtaining the `ref` returns an object of type [RadioButtonHandle]({% slug api_inputs_radiobuttonhandle %}).
|
|
22
22
|
*/
|
|
23
|
-
export declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<RadioButtonHandle>>;
|
|
23
|
+
export declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<RadioButtonHandle | null>>;
|
|
@@ -34,7 +34,7 @@ var package_metadata_1 = require("../package-metadata");
|
|
|
34
34
|
*
|
|
35
35
|
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
36
36
|
*/
|
|
37
|
-
exports.RadioButtonPropsContext = kendo_react_common_1.createPropsContext();
|
|
37
|
+
exports.RadioButtonPropsContext = (0, kendo_react_common_1.createPropsContext)();
|
|
38
38
|
/**
|
|
39
39
|
* Represents the [KendoReact RadioButton component]({% slug overview_radiobutton %}).
|
|
40
40
|
*
|
|
@@ -43,8 +43,8 @@ exports.RadioButtonPropsContext = kendo_react_common_1.createPropsContext();
|
|
|
43
43
|
*/
|
|
44
44
|
exports.RadioButton = React.forwardRef(function (directProps, target) {
|
|
45
45
|
var _a;
|
|
46
|
-
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
47
|
-
var props = kendo_react_common_1.usePropsContext(exports.RadioButtonPropsContext, directProps);
|
|
46
|
+
(0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
|
|
47
|
+
var props = (0, kendo_react_common_1.usePropsContext)(exports.RadioButtonPropsContext, directProps);
|
|
48
48
|
var ariaDescribedBy = props.ariaDescribedBy, checked = props.checked, children = props.children, className = props.className, disabled = props.disabled, id = props.id, size = props.size, label = props.label, labelPlacement = props.labelPlacement, name = props.name, style = props.style, tabIndex = props.tabIndex, value = props.value, valid = props.valid, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, others = __rest(props, ["ariaDescribedBy", "checked", "children", "className", "disabled", "id", "size", "label", "labelPlacement", "name", "style", "tabIndex", "value", "valid", "onChange", "onFocus", "onBlur"]);
|
|
49
49
|
var elementRef = React.useRef(null);
|
|
50
50
|
var focusElement = React.useCallback(function () {
|
|
@@ -57,24 +57,24 @@ exports.RadioButton = React.forwardRef(function (directProps, target) {
|
|
|
57
57
|
focus: focusElement
|
|
58
58
|
}); }, [focusElement]);
|
|
59
59
|
React.useImperativeHandle(target, getImperativeHandle);
|
|
60
|
-
var calculatedId = React.useMemo(function () { return kendo_react_common_1.guid(); }, []);
|
|
60
|
+
var calculatedId = React.useMemo(function () { return (0, kendo_react_common_1.guid)(); }, []);
|
|
61
61
|
var handleChange = React.useCallback(function (event) {
|
|
62
|
-
kendo_react_common_1.dispatchEvent(onChange, event, getImperativeHandle(), { value: value });
|
|
62
|
+
(0, kendo_react_common_1.dispatchEvent)(onChange, event, getImperativeHandle(), { value: value });
|
|
63
63
|
}, [onChange, value, disabled]);
|
|
64
64
|
var handleFocus = React.useCallback(function (event) {
|
|
65
65
|
if (onFocus && !disabled) {
|
|
66
|
-
kendo_react_common_1.dispatchEvent(onFocus, event, getImperativeHandle(), undefined);
|
|
66
|
+
(0, kendo_react_common_1.dispatchEvent)(onFocus, event, getImperativeHandle(), undefined);
|
|
67
67
|
}
|
|
68
68
|
}, [onFocus, disabled]);
|
|
69
69
|
var handleBlur = React.useCallback(function (event) {
|
|
70
70
|
if (onBlur && !disabled) {
|
|
71
|
-
kendo_react_common_1.dispatchEvent(onBlur, event, getImperativeHandle(), undefined);
|
|
71
|
+
(0, kendo_react_common_1.dispatchEvent)(onBlur, event, getImperativeHandle(), undefined);
|
|
72
72
|
}
|
|
73
73
|
}, [onBlur, disabled]);
|
|
74
|
-
var inputProps = __assign({ type: 'radio', id: id || calculatedId, name: name, className: kendo_react_common_1.classNames('k-radio', (_a = {},
|
|
75
|
-
_a["k-radio-"
|
|
74
|
+
var inputProps = __assign({ type: 'radio', id: id || calculatedId, name: name, className: (0, kendo_react_common_1.classNames)('k-radio', (_a = {},
|
|
75
|
+
_a["k-radio-".concat(kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
|
|
76
76
|
_a['k-invalid'] = valid === false,
|
|
77
|
-
_a), className), ref: elementRef, disabled: disabled, tabIndex: kendo_react_common_1.getTabIndex(tabIndex, disabled), checked: checked, style: style, 'aria-describedby': ariaDescribedBy, value: value, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur }, others);
|
|
77
|
+
_a), className), ref: elementRef, disabled: disabled, tabIndex: (0, kendo_react_common_1.getTabIndex)(tabIndex, disabled), checked: checked, style: style, 'aria-describedby': ariaDescribedBy, value: value, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur }, others);
|
|
78
78
|
var radioButtonLabel = (React.createElement(React.Fragment, null, label !== undefined ? (React.createElement("label", { className: 'k-radio-label', htmlFor: id || calculatedId, style: { userSelect: 'none' }, "aria-label": label }, label)) : null));
|
|
79
79
|
var radio = React.createElement("input", __assign({}, inputProps));
|
|
80
80
|
return (labelPlacement === 'before'
|
|
@@ -20,4 +20,4 @@ export declare const RadioGroupPropsContext: React.Context<(p: RadioGroupProps)
|
|
|
20
20
|
* Accepts properties of type [RadioGroupProps]({% slug api_inputs_radiogroupprops %}).
|
|
21
21
|
* Obtaining the `ref` returns an object of type [RadioGroupHandle]({% slug api_inputs_radiogrouphandle %}).
|
|
22
22
|
*/
|
|
23
|
-
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<RadioGroupHandle>>;
|
|
23
|
+
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<RadioGroupHandle | null>>;
|