@qsxy/element-plus-react 1.0.2 → 1.0.3
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/Alert/Alert.d.ts +7 -0
- package/dist/Alert/Alert.js +98 -0
- package/dist/Alert/index.d.ts +2 -0
- package/dist/Alert/index.js +1 -0
- package/dist/Alert/typings.d.ts +45 -0
- package/dist/Alert/typings.js +1 -0
- package/dist/Card/Card.js +5 -3
- package/dist/Cascader/useCascader.d.ts +0 -14
- package/dist/Cascader/useCascader.js +33 -32
- package/dist/Checkbox/Checkbox.js +3 -2
- package/dist/ConfigProvider/ConfigProvider.js +2 -24
- package/dist/ConfigProvider/ConfigProviderContext.js +1 -1
- package/dist/ConfigProvider/typings.d.ts +1 -1
- package/dist/Container/Main.d.ts +1 -1
- package/dist/Container/typings.d.ts +1 -1
- package/dist/Dialog/Dialog.js +5 -12
- package/dist/Input/Input.js +68 -43
- package/dist/Input/TextArea.js +1 -1
- package/dist/Input/typings.d.ts +42 -1
- package/dist/Input/utils.d.ts +1 -0
- package/dist/Input/utils.js +5 -1
- package/dist/InputNumber/InputNumber.js +351 -141
- package/dist/InputNumber/typings.d.ts +15 -1
- package/dist/Loading/Loading.js +5 -2
- package/dist/Menu/Menu.js +25 -1
- package/dist/Menu/MenuItem.js +4 -2
- package/dist/Menu/SubMenu.js +2 -2
- package/dist/Menu/SubMenuCollapseTransition.js +14 -9
- package/dist/Menu/typings.d.ts +2 -1
- package/dist/Message/Message.js +51 -23
- package/dist/Message/index.js +8 -10
- package/dist/Message/typings.d.ts +8 -5
- package/dist/MessageBox/MessageBox.js +52 -30
- package/dist/MessageBox/index.d.ts +2 -1
- package/dist/MessageBox/index.js +4 -2
- package/dist/MessageBox/typings.d.ts +3 -0
- package/dist/Notification/Notification.js +26 -19
- package/dist/Select/SelectContext.d.ts +2 -1
- package/dist/Select/SelectContext.js +2 -1
- package/dist/Select/SelectCore.js +13 -7
- package/dist/Select/SelectDropdown.js +23 -15
- package/dist/Select/index.d.ts +1 -1
- package/dist/Select/typings.d.ts +13 -9
- package/dist/Select/useSelect.d.ts +13 -10
- package/dist/Select/useSelect.js +34 -26
- package/dist/Space/Space.d.ts +4 -0
- package/dist/Space/Space.js +128 -0
- package/dist/Space/SpaceItem.d.ts +7 -0
- package/dist/Space/SpaceItem.js +14 -0
- package/dist/Space/index.d.ts +3 -0
- package/dist/Space/index.js +2 -0
- package/dist/Space/typings.d.ts +26 -0
- package/dist/Space/typings.js +1 -0
- package/dist/Space/useSpace.d.ts +7 -0
- package/dist/Space/useSpace.js +104 -0
- package/dist/Statistic/Statistic.d.ts +4 -0
- package/dist/Statistic/Statistic.js +92 -0
- package/dist/Statistic/index.d.ts +2 -0
- package/dist/Statistic/index.js +1 -0
- package/dist/Statistic/typings.d.ts +28 -0
- package/dist/Statistic/typings.js +1 -0
- package/dist/Switch/Switch.js +2 -2
- package/dist/Table/Table.js +3 -0
- package/dist/Table/typings.d.ts +2 -0
- package/dist/Tag/typings.d.ts +1 -1
- package/dist/Text/Text.d.ts +4 -0
- package/dist/Text/Text.js +84 -0
- package/dist/Text/index.d.ts +2 -0
- package/dist/Text/index.js +1 -0
- package/dist/Text/typings.d.ts +15 -0
- package/dist/Text/typings.js +1 -0
- package/dist/Tree/CollapseTransition.d.ts +7 -0
- package/dist/Tree/CollapseTransition.js +60 -0
- package/dist/Tree/Tree.d.ts +3 -140
- package/dist/Tree/Tree.js +350 -77
- package/dist/Tree/TreeContext.d.ts +9 -0
- package/dist/Tree/TreeContext.js +14 -0
- package/dist/Tree/TreeNode.d.ts +5 -3
- package/dist/Tree/TreeNode.js +321 -331
- package/dist/Tree/TreeNodeContent.d.ts +9 -0
- package/dist/Tree/TreeNodeContent.js +22 -0
- package/dist/Tree/index.d.ts +3 -8
- package/dist/Tree/index.js +1 -4
- package/dist/Tree/model/node.d.ts +62 -0
- package/dist/Tree/model/node.js +601 -0
- package/dist/Tree/model/tree-store.d.ts +52 -0
- package/dist/Tree/model/tree-store.js +510 -0
- package/dist/Tree/model/useDragNode.d.ts +30 -0
- package/dist/Tree/model/useDragNode.js +293 -0
- package/dist/Tree/model/useKeydown.d.ts +0 -0
- package/dist/Tree/model/useKeydown.js +104 -0
- package/dist/Tree/model/useNodeExpandEventBroadcast.d.ts +15 -0
- package/dist/Tree/model/useNodeExpandEventBroadcast.js +54 -0
- package/dist/Tree/model/util.d.ts +7 -0
- package/dist/Tree/model/util.js +24 -0
- package/dist/Tree/typings.d.ts +225 -114
- package/dist/TreeSelect/TreeSelect.d.ts +2 -10
- package/dist/TreeSelect/TreeSelect.js +90 -566
- package/dist/TreeSelect/TreeSelectOption.d.ts +6 -0
- package/dist/TreeSelect/TreeSelectOption.js +62 -0
- package/dist/TreeSelect/cacheOptions.d.ts +9 -0
- package/dist/TreeSelect/cacheOptions.js +22 -0
- package/dist/TreeSelect/index.d.ts +0 -1
- package/dist/TreeSelect/typings.d.ts +11 -63
- package/dist/TreeSelect/useSelect.d.ts +125 -0
- package/dist/TreeSelect/useSelect.js +104 -0
- package/dist/TreeSelect/useTree.d.ts +130 -0
- package/dist/TreeSelect/useTree.js +285 -0
- package/dist/TreeSelect/utils.d.ts +10 -0
- package/dist/TreeSelect/utils.js +38 -0
- package/dist/Upload/UploadContent.js +2 -0
- package/dist/Upload/ajax.js +3 -0
- package/dist/Upload/typings.d.ts +4 -0
- package/dist/Util/aria.js +12 -12
- package/dist/Util/base.d.ts +5 -0
- package/dist/Util/base.js +140 -1
- package/dist/config/Constants.d.ts +3 -0
- package/dist/config/Constants.js +8 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/popperPropsUtils.js +1 -1
- package/dist/hooks/treePropsUtils.d.ts +3 -3
- package/dist/hooks/treePropsUtils.js +2 -2
- package/dist/hooks/useConfigProvider.d.ts +27 -0
- package/dist/hooks/useConfigProvider.js +78 -0
- package/dist/hooks/useResizeObserver.js +6 -6
- package/dist/index.css +1 -1
- package/dist/index.d.ts +18 -11
- package/dist/index.js +11 -5
- package/package.json +1 -1
- package/theme-chalk/alert.scss +115 -0
- package/theme-chalk/aside.scss +8 -8
- package/theme-chalk/button-group.scss +80 -80
- package/theme-chalk/button.scss +304 -304
- package/theme-chalk/calendar/date-table.scss +164 -164
- package/theme-chalk/checkbox.scss +34 -0
- package/theme-chalk/color/index.scss +20 -20
- package/theme-chalk/common/transition.scss +142 -142
- package/theme-chalk/container.scss +14 -14
- package/theme-chalk/dark/css-vars.scss +39 -39
- package/theme-chalk/dark/var.scss +225 -225
- package/theme-chalk/date-picker.scss +12 -12
- package/theme-chalk/drawer.scss +1 -0
- package/theme-chalk/footer.scss +12 -12
- package/theme-chalk/header.scss +12 -12
- package/theme-chalk/index.scss +4 -0
- package/theme-chalk/input/input-range.scss +2 -1
- package/theme-chalk/input/input.scss +439 -424
- package/theme-chalk/input-number.bak +172 -0
- package/theme-chalk/input-number.scss +192 -172
- package/theme-chalk/link.scss +87 -87
- package/theme-chalk/main.scss +14 -14
- package/theme-chalk/menu.scss +353 -353
- package/theme-chalk/message.scss +104 -178
- package/theme-chalk/mixins/_button.scss +224 -224
- package/theme-chalk/mixins/_col.scss +33 -33
- package/theme-chalk/mixins/_var.scss +67 -67
- package/theme-chalk/mixins/config.scss +5 -5
- package/theme-chalk/mixins/function.scss +99 -99
- package/theme-chalk/mixins/mixins.scss +240 -240
- package/theme-chalk/mixins/utils.scss +39 -39
- package/theme-chalk/notification.bak +156 -0
- package/theme-chalk/notification.scss +109 -156
- package/theme-chalk/popper.scss +104 -104
- package/theme-chalk/radio-button.scss +169 -169
- package/theme-chalk/select/index.scss +278 -272
- package/theme-chalk/space.scss +20 -0
- package/theme-chalk/statistic.scss +35 -0
- package/theme-chalk/switch.scss +300 -300
- package/theme-chalk/tag.scss +181 -181
- package/theme-chalk/text.scss +48 -0
- package/theme-chalk/transition.scss +34 -4
- package/theme-chalk/tree-select.scss +41 -25
- package/theme-chalk/tree.scss +136 -0
- package/theme-chalk/var.scss +83 -83
- package/dist/Input/Input.1.d.ts +0 -16
- package/dist/Input/Input.1.js +0 -376
- package/dist/Tree/DirectoryTree.d.ts +0 -15
- package/dist/Tree/DirectoryTree.js +0 -183
- package/dist/Tree/DropIndicator.d.ts +0 -8
- package/dist/Tree/DropIndicator.js +0 -34
- package/dist/Tree/Indent.d.ts +0 -9
- package/dist/Tree/Indent.js +0 -25
- package/dist/Tree/MotionTreeNode.d.ts +0 -14
- package/dist/Tree/MotionTreeNode.js +0 -125
- package/dist/Tree/NodeList.d.ts +0 -50
- package/dist/Tree/NodeList.js +0 -301
- package/dist/Tree/RCTree.d.ts +0 -248
- package/dist/Tree/RCTree.js +0 -1216
- package/dist/Tree/contextTypes.d.ts +0 -69
- package/dist/Tree/contextTypes.js +0 -9
- package/dist/Tree/typings.tsx--bak +0 -245
- package/dist/Tree/useUnmount.d.ts +0 -5
- package/dist/Tree/useUnmount.js +0 -34
- package/dist/Tree/util.d.ts +0 -51
- package/dist/Tree/util.js +0 -303
- package/dist/Tree/utils/conductUtil.d.ts +0 -17
- package/dist/Tree/utils/conductUtil.js +0 -209
- package/dist/Tree/utils/dictUtil.d.ts +0 -13
- package/dist/Tree/utils/dictUtil.js +0 -75
- package/dist/Tree/utils/diffUtil.d.ts +0 -7
- package/dist/Tree/utils/diffUtil.js +0 -48
- package/dist/Tree/utils/dropIndicator.d.ts +0 -11
- package/dist/Tree/utils/dropIndicator.js +0 -36
- package/dist/Tree/utils/iconUtil.d.ts +0 -5
- package/dist/Tree/utils/iconUtil.js +0 -62
- package/dist/Tree/utils/keyUtil.d.ts +0 -2
- package/dist/Tree/utils/keyUtil.js +0 -3
- package/dist/Tree/utils/motion.d.ts +0 -10
- package/dist/Tree/utils/motion.js +0 -54
- package/dist/Tree/utils/pickAttrs.d.ts +0 -11
- package/dist/Tree/utils/pickAttrs.js +0 -51
- package/dist/Tree/utils/treeUtil.d.ts +0 -86
- package/dist/Tree/utils/treeUtil.js +0 -364
- package/dist/TreeSelect/Utils.d.ts +0 -3
- package/dist/TreeSelect/Utils.js +0 -20
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
1
|
var _templateObject, _templateObject2;
|
|
3
|
-
var _excluded = ["name", "max", "min", "step", "precision", "onChange", "
|
|
2
|
+
var _excluded = ["name", "id", "max", "min", "step", "precision", "stepStrictly", "valueOnClear", "inputmode", "align", "disabledScientific", "controls", "controlsPosition", "onChange", "onFocus", "onBlur", "classPrefix", "prefix", "suffix", "placeholder", "warning", "error", "maxLength", "minLength", "decreaseIcon", "increaseIcon"];
|
|
4
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
4
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
6
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -15,42 +11,64 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
15
11
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
12
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
13
|
import classNames from 'classnames';
|
|
18
|
-
import
|
|
19
|
-
import min from 'lodash/min';
|
|
14
|
+
import isNil from 'lodash/isNil';
|
|
20
15
|
import omit from 'lodash/omit';
|
|
21
16
|
import toFinite from 'lodash/toFinite';
|
|
22
|
-
import React, { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
17
|
+
import React, { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
18
|
+
import { useTranslation } from 'react-i18next';
|
|
23
19
|
import { useConfigProvider } from "../ConfigProvider/ConfigProviderContext";
|
|
24
20
|
import Icon from "../Icon/Icon";
|
|
25
21
|
import Input from "../Input/Input";
|
|
26
|
-
import {
|
|
22
|
+
import { isNotEmpty, isNumber, isUndefined, mergeDefaultProps } from "../Util";
|
|
27
23
|
import { partitionHTMLProps, useClassNames, useControlled, useDisabled, useSize } from "../hooks";
|
|
28
24
|
var InputNumber = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
25
|
+
var _useConfigProvider = useConfigProvider(),
|
|
26
|
+
locale = _useConfigProvider.locale;
|
|
27
|
+
var _useTranslation = useTranslation(),
|
|
28
|
+
t = _useTranslation.t;
|
|
29
29
|
props = mergeDefaultProps({
|
|
30
|
+
disabled: undefined,
|
|
30
31
|
step: 1,
|
|
31
|
-
precision:
|
|
32
|
-
max:
|
|
33
|
-
min:
|
|
34
|
-
placeholder: '
|
|
32
|
+
precision: undefined,
|
|
33
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
34
|
+
min: Number.MIN_SAFE_INTEGER,
|
|
35
|
+
placeholder: '',
|
|
36
|
+
controls: true,
|
|
37
|
+
controlsPosition: '',
|
|
38
|
+
stepStrictly: false,
|
|
39
|
+
valueOnClear: null,
|
|
40
|
+
// validateEvent: true,
|
|
41
|
+
inputmode: undefined,
|
|
42
|
+
align: 'center'
|
|
35
43
|
}, props);
|
|
36
44
|
var _props = props,
|
|
37
45
|
name = _props.name,
|
|
46
|
+
id = _props.id,
|
|
38
47
|
_maxProp = _props.max,
|
|
39
48
|
_minProp = _props.min,
|
|
40
49
|
step = _props.step,
|
|
41
|
-
|
|
50
|
+
precisionProp = _props.precision,
|
|
51
|
+
stepStrictly = _props.stepStrictly,
|
|
52
|
+
valueOnClear = _props.valueOnClear,
|
|
53
|
+
inputmode = _props.inputmode,
|
|
54
|
+
align = _props.align,
|
|
55
|
+
disabledScientific = _props.disabledScientific,
|
|
56
|
+
controls = _props.controls,
|
|
57
|
+
controlsPosition = _props.controlsPosition,
|
|
42
58
|
onChange = _props.onChange,
|
|
59
|
+
onFocus = _props.onFocus,
|
|
60
|
+
onBlur = _props.onBlur,
|
|
43
61
|
_props$classPrefix = _props.classPrefix,
|
|
44
62
|
classPrefix = _props$classPrefix === void 0 ? 'input-number' : _props$classPrefix,
|
|
45
63
|
prefix = _props.prefix,
|
|
46
64
|
suffix = _props.suffix,
|
|
47
|
-
prepend = _props.prepend,
|
|
48
|
-
append = _props.append,
|
|
49
65
|
placeholder = _props.placeholder,
|
|
50
66
|
warning = _props.warning,
|
|
51
67
|
error = _props.error,
|
|
52
68
|
maxLength = _props.maxLength,
|
|
53
69
|
minLength = _props.minLength,
|
|
70
|
+
decreaseIcon = _props.decreaseIcon,
|
|
71
|
+
increaseIcon = _props.increaseIcon,
|
|
54
72
|
rest = _objectWithoutProperties(_props, _excluded);
|
|
55
73
|
var _useClassNames = useClassNames(classPrefix),
|
|
56
74
|
b = _useClassNames.b,
|
|
@@ -71,185 +89,377 @@ var InputNumber = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, re
|
|
|
71
89
|
setValue = _useControlled2[1];
|
|
72
90
|
var disabled = useDisabled(props.disabled);
|
|
73
91
|
var size = useSize(props.size);
|
|
74
|
-
var
|
|
75
|
-
inputNumber =
|
|
92
|
+
var _useConfigProvider2 = useConfigProvider(),
|
|
93
|
+
inputNumber = _useConfigProvider2.inputNumber;
|
|
76
94
|
var valueRef = useRef(value);
|
|
77
95
|
var containerRef = useRef(null);
|
|
78
96
|
var inputRef = useRef(null);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}, [append, inputNumber === null || inputNumber === void 0 ? void 0 : inputNumber.controlsPositionRight, prefix, prepend, props.controlsPositionRight, suffix]);
|
|
97
|
+
var _useState = useState(null),
|
|
98
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
99
|
+
userInput = _useState2[0],
|
|
100
|
+
setUserInput = _useState2[1];
|
|
84
101
|
|
|
85
|
-
//
|
|
102
|
+
// Computed properties equivalent
|
|
103
|
+
var controlsAtRight = useMemo(function () {
|
|
104
|
+
return controls && controlsPosition === 'right' || controlsPosition !== '' && (inputNumber === null || inputNumber === void 0 ? void 0 : inputNumber.controlsPosition) === 'right';
|
|
105
|
+
}, [controls, controlsPosition, inputNumber === null || inputNumber === void 0 ? void 0 : inputNumber.controlsPosition]);
|
|
86
106
|
var maxProp = useMemo(function () {
|
|
87
107
|
var _ref;
|
|
88
|
-
return (_ref = _maxProp !== null && _maxProp !== void 0 ? _maxProp : inputNumber === null || inputNumber === void 0 ? void 0 : inputNumber.max) !== null && _ref !== void 0 ? _ref :
|
|
108
|
+
return (_ref = _maxProp !== null && _maxProp !== void 0 ? _maxProp : inputNumber === null || inputNumber === void 0 ? void 0 : inputNumber.max) !== null && _ref !== void 0 ? _ref : Number.MAX_SAFE_INTEGER;
|
|
89
109
|
}, [_maxProp, inputNumber === null || inputNumber === void 0 ? void 0 : inputNumber.max]);
|
|
90
110
|
var minProp = useMemo(function () {
|
|
91
111
|
var _ref2;
|
|
92
|
-
return (_ref2 = _minProp !== null && _minProp !== void 0 ? _minProp : inputNumber === null || inputNumber === void 0 ? void 0 : inputNumber.min) !== null && _ref2 !== void 0 ? _ref2 :
|
|
112
|
+
return (_ref2 = _minProp !== null && _minProp !== void 0 ? _minProp : inputNumber === null || inputNumber === void 0 ? void 0 : inputNumber.min) !== null && _ref2 !== void 0 ? _ref2 : Number.MIN_SAFE_INTEGER;
|
|
93
113
|
}, [_minProp, inputNumber === null || inputNumber === void 0 ? void 0 : inputNumber.min]);
|
|
94
114
|
|
|
95
|
-
|
|
96
|
-
var
|
|
97
|
-
if (
|
|
115
|
+
// Utility functions
|
|
116
|
+
var getPrecision = useCallback(function (val) {
|
|
117
|
+
if (val == null) {
|
|
118
|
+
return 0;
|
|
119
|
+
}
|
|
120
|
+
var valueString = val.toString();
|
|
121
|
+
var dotPosition = valueString.indexOf('.');
|
|
122
|
+
var precision = 0;
|
|
123
|
+
if (dotPosition !== -1) {
|
|
124
|
+
precision = valueString.length - dotPosition - 1;
|
|
125
|
+
}
|
|
126
|
+
return precision;
|
|
127
|
+
}, []);
|
|
128
|
+
var numPrecision = useMemo(function () {
|
|
129
|
+
var stepPrecision = getPrecision(step);
|
|
130
|
+
if (!isUndefined(props.precision)) {
|
|
131
|
+
if (stepPrecision > precisionProp) {
|
|
132
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
133
|
+
console.warn('[InputNumber] precision should not be less than the decimal places of step');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return precisionProp;
|
|
137
|
+
} else {
|
|
138
|
+
return Math.max(getPrecision(value), stepPrecision);
|
|
139
|
+
}
|
|
140
|
+
}, [getPrecision, step, props.precision, precisionProp, value]);
|
|
141
|
+
var minDisabled = useMemo(function () {
|
|
142
|
+
return typeof value === 'number' && value <= minProp;
|
|
143
|
+
}, [value, minProp]);
|
|
144
|
+
var maxDisabled = useMemo(function () {
|
|
145
|
+
return typeof value === 'number' && value >= maxProp;
|
|
146
|
+
}, [value, maxProp]);
|
|
147
|
+
var displayValue = useMemo(function () {
|
|
148
|
+
var _currentValue;
|
|
149
|
+
if (userInput !== null) {
|
|
150
|
+
return userInput !== null && userInput !== void 0 ? userInput : '';
|
|
151
|
+
}
|
|
152
|
+
var currentValue = value;
|
|
153
|
+
if (isNil(currentValue)) {
|
|
154
|
+
return '';
|
|
155
|
+
}
|
|
156
|
+
if (isNumber(currentValue)) {
|
|
157
|
+
if (Number.isNaN(currentValue)) {
|
|
158
|
+
return '';
|
|
159
|
+
}
|
|
160
|
+
if (!isUndefined(precisionProp)) {
|
|
161
|
+
currentValue = currentValue.toFixed(precisionProp);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return (_currentValue = currentValue) !== null && _currentValue !== void 0 ? _currentValue : '';
|
|
165
|
+
}, [userInput, value, precisionProp]);
|
|
166
|
+
var toPrecision = useCallback(function (num, pre) {
|
|
167
|
+
if (pre === undefined) {
|
|
168
|
+
pre = numPrecision;
|
|
169
|
+
}
|
|
170
|
+
if (pre === 0) {
|
|
171
|
+
return Math.round(num);
|
|
172
|
+
}
|
|
173
|
+
var snum = String(num);
|
|
174
|
+
var pointPos = snum.indexOf('.');
|
|
175
|
+
if (pointPos === -1) {
|
|
176
|
+
return num;
|
|
177
|
+
}
|
|
178
|
+
var nums = snum.replace('.', '').split('');
|
|
179
|
+
var datum = nums[pointPos + pre];
|
|
180
|
+
if (!datum) {
|
|
181
|
+
return num;
|
|
182
|
+
}
|
|
183
|
+
var length = snum.length;
|
|
184
|
+
if (snum.charAt(length - 1) === '5') {
|
|
185
|
+
snum = "".concat(snum.slice(0, Math.max(0, length - 1)), "6");
|
|
186
|
+
}
|
|
187
|
+
return Number.parseFloat(Number(snum).toFixed(pre));
|
|
188
|
+
}, [numPrecision]);
|
|
189
|
+
var ensurePrecision = useCallback(function (val) {
|
|
190
|
+
var coefficient = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
191
|
+
if (typeof val !== 'number') {
|
|
192
|
+
return value;
|
|
193
|
+
}
|
|
194
|
+
if (val >= Number.MAX_SAFE_INTEGER && coefficient === 1) {
|
|
195
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
196
|
+
console.warn('InputNumber', 'The value has reached the maximum safe integer limit.');
|
|
197
|
+
}
|
|
198
|
+
return val;
|
|
199
|
+
} else if (val <= Number.MIN_SAFE_INTEGER && coefficient === -1) {
|
|
200
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
201
|
+
console.warn('InputNumber', 'The value has reached the minimum safe integer limit.');
|
|
202
|
+
}
|
|
203
|
+
return val;
|
|
204
|
+
}
|
|
205
|
+
return toPrecision(val + step * coefficient);
|
|
206
|
+
}, [toPrecision, step, value]);
|
|
207
|
+
var verifyValue = useCallback(function (val) {
|
|
208
|
+
var shouldUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
209
|
+
if (maxProp < minProp) {
|
|
210
|
+
throw new Error('InputNumber: min should not be greater than max.');
|
|
211
|
+
}
|
|
212
|
+
var newVal = Number(val);
|
|
213
|
+
if (val == null || Number.isNaN(newVal)) {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
if (val === '') {
|
|
217
|
+
if (valueOnClear === null) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
if (typeof valueOnClear === 'string') {
|
|
221
|
+
newVal = valueOnClear === 'min' ? minProp : maxProp;
|
|
222
|
+
} else {
|
|
223
|
+
newVal = valueOnClear;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (stepStrictly) {
|
|
227
|
+
newVal = toPrecision(Math.round(toPrecision(newVal / step)) * step, precisionProp);
|
|
228
|
+
if (newVal !== val && shouldUpdate) {
|
|
229
|
+
// Emit update event - handled by parent in React
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (precisionProp !== undefined) {
|
|
233
|
+
newVal = toPrecision(newVal, precisionProp);
|
|
234
|
+
}
|
|
235
|
+
if (newVal > maxProp || newVal < minProp) {
|
|
236
|
+
newVal = newVal > maxProp ? maxProp : minProp;
|
|
237
|
+
if (shouldUpdate) {
|
|
238
|
+
// Emit update event - handled by parent in React
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return newVal;
|
|
242
|
+
}, [maxProp, minProp, valueOnClear, stepStrictly, toPrecision, step, precisionProp]);
|
|
243
|
+
var setCurrentValue = useCallback(function (val) {
|
|
244
|
+
var emitChange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
245
|
+
var oldVal = value;
|
|
246
|
+
var newVal = verifyValue(val);
|
|
247
|
+
if (!emitChange) {
|
|
248
|
+
setValue(newVal);
|
|
98
249
|
return;
|
|
99
250
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var formatVal = formatNumber(increaseValue, precision);
|
|
103
|
-
setValue(formatVal);
|
|
104
|
-
onChange === null || onChange === void 0 || onChange(toFinite(formatVal), increaseOldValue);
|
|
105
|
-
}, [disabled, value, step, maxProp, precision, setValue, onChange]);
|
|
106
|
-
|
|
107
|
-
/** 递减 */
|
|
108
|
-
var decrease = useCallback(function () {
|
|
109
|
-
if (disabled) {
|
|
251
|
+
setUserInput(null);
|
|
252
|
+
if (oldVal === newVal && val) {
|
|
110
253
|
return;
|
|
111
254
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
onChange === null || onChange === void 0 || onChange(toFinite(formatVal), decreaseOldValue);
|
|
117
|
-
}, [disabled, value, step, minProp, precision, setValue, onChange]);
|
|
118
|
-
var onInput = useCallback(function (inputVal) {
|
|
119
|
-
// 阻止输入错误位置的负号
|
|
120
|
-
inputVal = inputVal.split('').filter(function (item, index) {
|
|
121
|
-
if (item === '-' && index > 0) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
return true;
|
|
125
|
-
}).join('');
|
|
126
|
-
// inputVal = inputVal.replace(/[^\d-\\.]/g, '').replace(/(?<=.)-/g, '');
|
|
127
|
-
setValue(inputVal);
|
|
128
|
-
valueRef.current = inputVal;
|
|
129
|
-
// 输入小数点后,如果转为数字会丢失小数点,所以此时不提交数据
|
|
130
|
-
if (!inputVal.endsWith('.') && !inputVal.endsWith('0')) {
|
|
131
|
-
var _inputVal = isEmpty(inputVal) ? '' : toFinite(inputVal);
|
|
132
|
-
setValue(_inputVal);
|
|
133
|
-
onChange === null || onChange === void 0 || onChange(_inputVal);
|
|
134
|
-
}
|
|
135
|
-
inputRef.current.input.current.value = isEmpty(inputVal) ? '' : inputVal;
|
|
136
|
-
}, [onChange, setValue]);
|
|
255
|
+
setValue(newVal);
|
|
256
|
+
if (oldVal !== newVal && onChange) {
|
|
257
|
+
onChange(newVal, oldVal);
|
|
258
|
+
}
|
|
137
259
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (
|
|
142
|
-
setValue('');
|
|
143
|
-
onChange === null || onChange === void 0 || onChange('');
|
|
144
|
-
valueRef.current = '';
|
|
145
|
-
inputRef.current.input.current.value = '';
|
|
260
|
+
// Form validation would go here if needed
|
|
261
|
+
}, [value, verifyValue, setValue, setUserInput, onChange]);
|
|
262
|
+
var increase = useCallback(function () {
|
|
263
|
+
if (props.readOnly || disabled || maxDisabled) {
|
|
146
264
|
return;
|
|
147
265
|
}
|
|
148
|
-
var
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
onChange === null || onChange === void 0 || onChange(maxProp, inputOldValue);
|
|
156
|
-
inputRef.current.input.current.value = maxProp + '';
|
|
266
|
+
var val = Number(displayValue) || 0;
|
|
267
|
+
var newVal = ensurePrecision(val);
|
|
268
|
+
setCurrentValue(newVal);
|
|
269
|
+
onChange === null || onChange === void 0 || onChange(newVal);
|
|
270
|
+
}, [props.readOnly, disabled, maxDisabled, displayValue, ensurePrecision, setCurrentValue, onChange]);
|
|
271
|
+
var decrease = useCallback(function () {
|
|
272
|
+
if (props.readOnly || disabled || minDisabled) {
|
|
157
273
|
return;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
274
|
+
}
|
|
275
|
+
var val = Number(displayValue) || 0;
|
|
276
|
+
var newVal = ensurePrecision(val, -1);
|
|
277
|
+
setCurrentValue(newVal);
|
|
278
|
+
onChange === null || onChange === void 0 || onChange(newVal);
|
|
279
|
+
}, [props.readOnly, disabled, minDisabled, displayValue, ensurePrecision, setCurrentValue, onChange]);
|
|
280
|
+
|
|
281
|
+
// Event handlers
|
|
282
|
+
var handleKeydown = useCallback(function (event) {
|
|
283
|
+
var key = event.key;
|
|
284
|
+
var code = event.code;
|
|
285
|
+
if (disabledScientific && ['e', 'E'].includes(key)) {
|
|
286
|
+
event.preventDefault();
|
|
162
287
|
return;
|
|
163
288
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
289
|
+
switch (code) {
|
|
290
|
+
case 'ArrowUp':
|
|
291
|
+
{
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
increase();
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
case 'ArrowDown':
|
|
297
|
+
{
|
|
298
|
+
event.preventDefault();
|
|
299
|
+
decrease();
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}, [decrease, disabledScientific, increase]);
|
|
304
|
+
var handleInput = useCallback(function (inputVal) {
|
|
305
|
+
setUserInput(inputVal);
|
|
306
|
+
var newVal = inputVal === '' ? null : Number(inputVal);
|
|
307
|
+
onChange === null || onChange === void 0 || onChange(newVal);
|
|
308
|
+
setCurrentValue(newVal, false);
|
|
309
|
+
}, [onChange, setCurrentValue]);
|
|
310
|
+
var handleInputChange = useCallback(function (inputVal) {
|
|
311
|
+
var newVal = inputVal !== '' ? Number(inputVal) : '';
|
|
312
|
+
// onChange?.(newVal);
|
|
313
|
+
// setCurrentValue(newVal, true);
|
|
314
|
+
if (typeof newVal === 'number' && !Number.isNaN(newVal) || inputVal === '') {
|
|
315
|
+
setUserInput(inputVal);
|
|
316
|
+
onChange === null || onChange === void 0 || onChange(newVal);
|
|
317
|
+
// setCurrentValue(newVal);
|
|
318
|
+
}
|
|
319
|
+
// setUserInput(null);
|
|
320
|
+
}, [onChange]);
|
|
321
|
+
var handleFocus = useCallback(function (event) {
|
|
322
|
+
onFocus === null || onFocus === void 0 || onFocus(event);
|
|
323
|
+
}, [onFocus]);
|
|
324
|
+
var handleBlur = useCallback(function (event) {
|
|
325
|
+
var _inputRef$current;
|
|
326
|
+
// setUserInput(null);
|
|
327
|
+
// Handle Firefox bug where non-numeric content isn't cleared
|
|
328
|
+
if (value === null && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.input.current) {
|
|
329
|
+
inputRef.current.input.current.value = '';
|
|
330
|
+
}
|
|
331
|
+
onBlur === null || onBlur === void 0 || onBlur(event);
|
|
332
|
+
if (isNotEmpty(userInput)) {
|
|
333
|
+
setCurrentValue(String(userInput), false);
|
|
334
|
+
setUserInput(null);
|
|
335
|
+
}
|
|
336
|
+
// Form validation would go here
|
|
337
|
+
}, [value, onBlur, setCurrentValue, userInput]);
|
|
338
|
+
|
|
339
|
+
// Effects
|
|
168
340
|
useEffect(function () {
|
|
169
341
|
valueRef.current = value;
|
|
170
342
|
}, [value]);
|
|
343
|
+
useEffect(function () {
|
|
344
|
+
var _inputRef$current2;
|
|
345
|
+
var innerInput = (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.input.current;
|
|
346
|
+
if (innerInput) {
|
|
347
|
+
innerInput.setAttribute('role', 'spinbutton');
|
|
348
|
+
if (Number.isFinite(maxProp)) {
|
|
349
|
+
innerInput.setAttribute('aria-valuemax', String(maxProp));
|
|
350
|
+
} else {
|
|
351
|
+
innerInput.removeAttribute('aria-valuemax');
|
|
352
|
+
}
|
|
353
|
+
if (Number.isFinite(minProp)) {
|
|
354
|
+
innerInput.setAttribute('aria-valuemin', String(minProp));
|
|
355
|
+
} else {
|
|
356
|
+
innerInput.removeAttribute('aria-valuemin');
|
|
357
|
+
}
|
|
358
|
+
innerInput.setAttribute('aria-valuenow', value != null ? String(value) : '');
|
|
359
|
+
innerInput.setAttribute('aria-disabled', String(disabled));
|
|
360
|
+
|
|
361
|
+
// Add wheel event listener
|
|
362
|
+
var handleWheel = function handleWheel(e) {
|
|
363
|
+
if (document.activeElement === e.target) {
|
|
364
|
+
e.preventDefault();
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
innerInput.addEventListener('wheel', handleWheel, {
|
|
368
|
+
passive: false
|
|
369
|
+
});
|
|
370
|
+
return function () {
|
|
371
|
+
innerInput.removeEventListener('wheel', handleWheel);
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
}, [maxProp, minProp, value, disabled]);
|
|
375
|
+
|
|
376
|
+
// Ref methods
|
|
171
377
|
useImperativeHandle(ref, function () {
|
|
172
378
|
return {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
get input() {
|
|
177
|
-
return inputRef;
|
|
178
|
-
},
|
|
379
|
+
ref: containerRef,
|
|
380
|
+
input: inputRef,
|
|
179
381
|
getValue: function getValue() {
|
|
180
382
|
return toFinite(value);
|
|
181
383
|
},
|
|
182
|
-
focus:
|
|
183
|
-
|
|
384
|
+
focus: function focus() {
|
|
385
|
+
var _inputRef$current3;
|
|
386
|
+
return (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.focus();
|
|
387
|
+
},
|
|
388
|
+
blur: function blur() {
|
|
389
|
+
var _inputRef$current4;
|
|
390
|
+
return (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.blur();
|
|
391
|
+
}
|
|
184
392
|
};
|
|
185
393
|
});
|
|
186
394
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
187
|
-
className: classNames(b(), m(
|
|
188
|
-
|
|
395
|
+
className: classNames(b(), m(size), is({
|
|
396
|
+
disabled: disabled,
|
|
397
|
+
'without-controls': !controls,
|
|
398
|
+
'controls-right': controls && controlsAtRight,
|
|
399
|
+
align: !!align
|
|
189
400
|
}), props.className),
|
|
190
401
|
style: props.style,
|
|
191
402
|
ref: containerRef
|
|
192
|
-
}, tooltipEvents
|
|
403
|
+
}, tooltipEvents, {
|
|
404
|
+
onDragStart: function onDragStart(e) {
|
|
405
|
+
return e.preventDefault();
|
|
406
|
+
}
|
|
407
|
+
}), controls && /*#__PURE__*/React.createElement("span", {
|
|
193
408
|
className: classNames(e(_templateObject || (_templateObject = _taggedTemplateLiteral(["decrease"]))), is({
|
|
194
|
-
disabled:
|
|
409
|
+
disabled: minDisabled
|
|
195
410
|
})),
|
|
411
|
+
role: "button",
|
|
412
|
+
"aria-label": t('el.inputNumber.decrease', {
|
|
413
|
+
lng: locale
|
|
414
|
+
}),
|
|
415
|
+
tabIndex: 0,
|
|
416
|
+
onKeyDown: function onKeyDown(event) {
|
|
417
|
+
return event.key === 'Enter' && decrease();
|
|
418
|
+
},
|
|
196
419
|
onClick: decrease
|
|
197
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
})), /*#__PURE__*/React.createElement("span", {
|
|
420
|
+
}, decreaseIcon || /*#__PURE__*/React.createElement(Icon, {
|
|
421
|
+
name: controlsAtRight ? 'angle-down' : 'minus',
|
|
422
|
+
prefix: controlsAtRight ? 'fal' : 'far'
|
|
423
|
+
})), controls && /*#__PURE__*/React.createElement("span", {
|
|
201
424
|
className: classNames(e(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["increase"]))), is({
|
|
202
|
-
disabled:
|
|
425
|
+
disabled: maxDisabled
|
|
203
426
|
})),
|
|
427
|
+
role: "button",
|
|
428
|
+
"aria-label": t('el.inputNumber.increase', {
|
|
429
|
+
lng: locale
|
|
430
|
+
}),
|
|
431
|
+
tabIndex: 0,
|
|
432
|
+
onKeyDown: function onKeyDown(event) {
|
|
433
|
+
return event.key === 'Enter' && increase();
|
|
434
|
+
},
|
|
204
435
|
onClick: increase
|
|
205
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
206
|
-
|
|
207
|
-
|
|
436
|
+
}, increaseIcon || /*#__PURE__*/React.createElement(Icon, {
|
|
437
|
+
name: controlsAtRight ? 'angle-up' : 'plus',
|
|
438
|
+
prefix: controlsAtRight ? 'fal' : 'far'
|
|
208
439
|
})), /*#__PURE__*/React.createElement(Input, _extends({
|
|
440
|
+
id: id,
|
|
209
441
|
placeholder: placeholder,
|
|
210
442
|
prefix: prefix,
|
|
211
443
|
suffix: suffix,
|
|
212
444
|
name: name,
|
|
213
|
-
value:
|
|
445
|
+
value: displayValue,
|
|
214
446
|
disabled: disabled,
|
|
215
447
|
readOnly: props.readOnly,
|
|
216
448
|
size: size,
|
|
217
449
|
error: error,
|
|
218
450
|
warning: warning,
|
|
219
451
|
clearable: false,
|
|
220
|
-
onBlur:
|
|
221
|
-
|
|
452
|
+
onBlur: handleBlur,
|
|
453
|
+
onFocus: handleFocus
|
|
454
|
+
// onInput={handleInput}
|
|
455
|
+
,
|
|
456
|
+
onChange: handleInputChange,
|
|
457
|
+
onKeyDown: handleKeydown,
|
|
222
458
|
maxLength: maxLength,
|
|
223
|
-
minLength:
|
|
224
|
-
|
|
225
|
-
if (event.ctrlKey) {
|
|
226
|
-
isCtrlKey.current = true;
|
|
227
|
-
}
|
|
228
|
-
// 复制、粘贴和剪切可以执行
|
|
229
|
-
if (isCtrlKey.current) {
|
|
230
|
-
if (!['c', 'v', 'x'].includes(event.key)) {
|
|
231
|
-
event.preventDefault();
|
|
232
|
-
}
|
|
233
|
-
} else if (!['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '.', 'ArrowLeft', 'ArrowRight', 'Backspace', 'Delete'].includes(event.key)) {
|
|
234
|
-
event.preventDefault();
|
|
235
|
-
}
|
|
236
|
-
var val = valueRef.current;
|
|
237
|
-
if (isNotEmpty(val)) {
|
|
238
|
-
// 如果已经有小数点了,阻止输入小数点
|
|
239
|
-
if (val.toString().indexOf('.') > -1 && event.key === '.') {
|
|
240
|
-
event.preventDefault();
|
|
241
|
-
}
|
|
242
|
-
// 如果已经是负数了,阻止输入负号
|
|
243
|
-
if (val.toString().indexOf('-') > -1 && event.key === '-') {
|
|
244
|
-
event.preventDefault();
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}, []),
|
|
248
|
-
onKeyUp: useCallback(function () {
|
|
249
|
-
isCtrlKey.current = false;
|
|
250
|
-
}, []),
|
|
459
|
+
minLength: minLength,
|
|
460
|
+
inputMode: inputmode,
|
|
251
461
|
ref: inputRef
|
|
252
|
-
}, omit(htmlInputProps, ['value', 'defaultValue', 'disabled', 'size', 'onInput', '
|
|
462
|
+
}, omit(htmlInputProps, ['value', 'defaultValue', 'disabled', 'size', 'onInput', 'onChange', 'onKeyDown', 'style', 'className', 'type', 'name', 'prefix', 'readOnly', 'maxLength', 'minLength']))));
|
|
253
463
|
}));
|
|
254
464
|
InputNumber.displayName = 'ElInputNumber';
|
|
255
465
|
export default InputNumber;
|
|
@@ -14,8 +14,12 @@ export interface InputNumberProps<V = ValueType> extends Omit<FormControlBasePro
|
|
|
14
14
|
stepStrictly?: boolean;
|
|
15
15
|
/** 数值精度 */
|
|
16
16
|
precision?: number;
|
|
17
|
+
/** 是否显示控制按钮 */
|
|
18
|
+
controls?: boolean;
|
|
17
19
|
/** 控制按钮位置 */
|
|
18
|
-
|
|
20
|
+
controlsPosition?: '' | 'right';
|
|
21
|
+
/** 当输入框被清空时显示的值 */
|
|
22
|
+
valueOnClear?: 'min' | 'max' | number | null;
|
|
19
23
|
/** 占位符 */
|
|
20
24
|
placeholder?: string;
|
|
21
25
|
/** 绑定值被改变时触发 */
|
|
@@ -38,6 +42,16 @@ export interface InputNumberProps<V = ValueType> extends Omit<FormControlBasePro
|
|
|
38
42
|
maxLength?: number;
|
|
39
43
|
/** 原生属性,最小输入长度 */
|
|
40
44
|
minLength?: number;
|
|
45
|
+
/** 内部输入文本对齐 */
|
|
46
|
+
align?: 'left' | 'right' | 'center';
|
|
47
|
+
/** 禁用科学计数法的输入(例如输入 'e') */
|
|
48
|
+
disabledScientific?: boolean;
|
|
49
|
+
/** 原生 inputmode 属性 */
|
|
50
|
+
inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';
|
|
51
|
+
/** 自定义减少按钮图标 */
|
|
52
|
+
decreaseIcon?: React.ReactNode;
|
|
53
|
+
/** 自定义增加按钮图标 */
|
|
54
|
+
increaseIcon?: React.ReactNode;
|
|
41
55
|
}
|
|
42
56
|
export interface InputNumberRef {
|
|
43
57
|
/** 顶级div */
|
package/dist/Loading/Loading.js
CHANGED
|
@@ -31,6 +31,9 @@ var LoadingMain = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
31
31
|
b = _useClassNames.b,
|
|
32
32
|
is = _useClassNames.is,
|
|
33
33
|
bm = _useClassNames.bm;
|
|
34
|
+
var zIndex = useMemo(function () {
|
|
35
|
+
return PopupManager.nextZIndex();
|
|
36
|
+
}, []);
|
|
34
37
|
var nodeRef = useRef(null);
|
|
35
38
|
var onEnter = useCallback(function () {
|
|
36
39
|
var _nodeRef$current;
|
|
@@ -72,7 +75,7 @@ var LoadingMain = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
72
75
|
}), props.className),
|
|
73
76
|
style: _objectSpread(_objectSpread({}, props.style), {}, {
|
|
74
77
|
background: background,
|
|
75
|
-
zIndex:
|
|
78
|
+
zIndex: zIndex
|
|
76
79
|
})
|
|
77
80
|
}, /*#__PURE__*/React.createElement("div", {
|
|
78
81
|
className: b(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["spinner"])))
|
|
@@ -91,7 +94,7 @@ var LoadingMain = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
91
94
|
})), text && /*#__PURE__*/React.createElement("p", {
|
|
92
95
|
className: b(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["text"])))
|
|
93
96
|
}, text))));
|
|
94
|
-
}, [b, background, fullscreen, is, onEnter, props.className, props.style, spinner, svg, svgViewBox, text, visible]);
|
|
97
|
+
}, [b, background, fullscreen, is, onEnter, props.className, props.style, spinner, svg, svgViewBox, text, visible, zIndex]);
|
|
95
98
|
return props.children ? /*#__PURE__*/React.createElement("div", {
|
|
96
99
|
className: classNames(bm('parent', 'relative'), bm('parent', 'hidden'))
|
|
97
100
|
}, content, props.children) : content;
|