cloud-b2b 1.1.46 → 1.1.50
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/es/Area/Area.js +45 -16
- package/es/Card/Card.js +4 -3
- package/es/CodeInput/CodeInput.js +59 -30
- package/es/Control/Control.js +117 -58
- package/es/Control/event.js +14 -0
- package/es/Enhance/Dialogs.js +21 -6
- package/es/Enhance/Loading.js +46 -26
- package/es/Enhance/index.js +2 -0
- package/es/Header/Header.js +35 -3
- package/es/Header/Vertical.js +24 -1
- package/es/ImageView/ImageView.js +22 -5
- package/es/Indent/Indent.js +7 -3
- package/es/InpurCascader/InputCascader.js +36 -10
- package/es/InputEditor/InputEditor.js +52 -53
- package/es/InputSearch/InputSearch.js +71 -26
- package/es/InputSelect/InputSelect.js +48 -17
- package/es/InputTreeSelect/InputTreeSelect.js +147 -0
- package/es/InputTreeSelect/package.json +6 -0
- package/es/InputWriting/InputWriting.js +28 -6
- package/es/Layout/Layout.js +59 -28
- package/es/LayoutLink/LayoutLink.js +20 -11
- package/es/Link/Link.js +27 -4
- package/es/Loading/Loading.js +3 -1
- package/es/Loading2/Loading2.js +2 -0
- package/es/ModalWithDrag/ModalWithDrag.js +8 -3
- package/es/ModalWithDrag/drag.js +29 -12
- package/es/NumberInput/NumberInput.js +64 -24
- package/es/Search/Search.js +164 -54
- package/es/Sidebar/Sidebar.js +34 -13
- package/es/Sidebar2/Sidebar.js +30 -3
- package/es/SuperForm/SuperForm.js +164 -27
- package/es/SuperForm2/SuperForm.js +182 -31
- package/es/SuperIcon/SuperIcon.js +6 -3
- package/es/SuperPagination/SuperPagination.js +32 -15
- package/es/SuperTab/SuperTab.js +27 -4
- package/es/SuperTab2/SuperTab2.js +33 -11
- package/es/SuperTable/DragSortRow.js +34 -6
- package/es/SuperTable/FilterDropDown.js +34 -10
- package/es/SuperTable/SuperTable.js +216 -84
- package/es/SuperTable/fixed.js +9 -1
- package/es/SuperTable2/SuperTable2.js +226 -101
- package/es/SuperTable2/SuperTableCell.js +60 -16
- package/es/SuperTable3/FilterDropDown.js +34 -10
- package/es/SuperTable3/SuperTable.js +175 -50
- package/es/SuperTable3/fixed.js +9 -1
- package/es/SuperToolbar/SuperToolbar.js +49 -21
- package/es/SuperUpload/SuperUpload.js +233 -156
- package/es/Title/Title.js +15 -12
- package/es/Viewer/ImageViews.js +60 -7
- package/es/Viewer/Viewer.js +32 -5
- package/es/WingBlank/WingBlank.js +6 -2
- package/es/helper.js +29 -7
- package/es/history.js +2 -3
- package/lib/Area/Area.js +64 -16
- package/lib/Card/Card.js +13 -3
- package/lib/CodeInput/CodeInput.js +77 -30
- package/lib/Control/Control.js +160 -58
- package/lib/Control/event.js +16 -0
- package/lib/Enhance/Dialogs.js +32 -6
- package/lib/Enhance/Loading.js +62 -26
- package/lib/Enhance/index.js +9 -0
- package/lib/Header/Header.js +48 -3
- package/lib/Header/Vertical.js +36 -1
- package/lib/ImageView/ImageView.js +30 -5
- package/lib/Indent/Indent.js +13 -3
- package/lib/InpurCascader/InputCascader.js +50 -11
- package/lib/InputEditor/InputEditor.js +61 -53
- package/lib/InputSearch/InputSearch.js +78 -26
- package/lib/InputSelect/InputSelect.js +62 -17
- package/lib/InputTreeSelect/InputTreeSelect.js +169 -0
- package/lib/InputTreeSelect/package.json +6 -0
- package/lib/InputWriting/InputWriting.js +35 -6
- package/lib/Layout/Layout.js +76 -28
- package/lib/LayoutLink/LayoutLink.js +38 -11
- package/lib/Link/Link.js +40 -4
- package/lib/Loading/Loading.js +9 -1
- package/lib/Loading2/Loading2.js +8 -0
- package/lib/ModalWithDrag/ModalWithDrag.js +18 -3
- package/lib/ModalWithDrag/drag.js +34 -12
- package/lib/NumberInput/NumberInput.js +77 -24
- package/lib/Search/Search.js +171 -54
- package/lib/Sidebar/Sidebar.js +46 -13
- package/lib/Sidebar2/Sidebar.js +42 -3
- package/lib/SuperForm/SuperForm.js +162 -27
- package/lib/SuperForm2/SuperForm.js +175 -31
- package/lib/SuperIcon/SuperIcon.js +14 -3
- package/lib/SuperPagination/SuperPagination.js +42 -15
- package/lib/SuperTab/SuperTab.js +34 -4
- package/lib/SuperTab2/SuperTab2.js +48 -11
- package/lib/SuperTable/DragSortRow.js +42 -6
- package/lib/SuperTable/FilterDropDown.js +42 -10
- package/lib/SuperTable/SuperTable.js +211 -83
- package/lib/SuperTable/fixed.js +13 -1
- package/lib/SuperTable2/SuperTable2.js +240 -101
- package/lib/SuperTable2/SuperTableCell.js +67 -13
- package/lib/SuperTable3/FilterDropDown.js +42 -10
- package/lib/SuperTable3/SuperTable.js +170 -49
- package/lib/SuperTable3/fixed.js +13 -1
- package/lib/SuperToolbar/SuperToolbar.js +64 -20
- package/lib/SuperUpload/SuperUpload.js +267 -156
- package/lib/Title/Title.js +24 -12
- package/lib/Viewer/ImageViews.js +63 -7
- package/lib/Viewer/Viewer.js +41 -5
- package/lib/WingBlank/WingBlank.js +14 -2
- package/lib/helper.js +47 -6
- package/lib/history.js +5 -0
- package/lib/index.js +76 -0
- package/lib/variables.js +4 -0
- package/package.json +2 -2
|
@@ -6,17 +6,21 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import drag from './drag';
|
|
8
8
|
import variables from '../variables';
|
|
9
|
+
|
|
9
10
|
var onLoad = function onLoad(e) {
|
|
10
11
|
var dragElement = e.parentNode.parentNode;
|
|
11
12
|
var targetElement = dragElement.parentNode.parentNode;
|
|
12
13
|
drag(dragElement, targetElement);
|
|
13
14
|
};
|
|
15
|
+
|
|
14
16
|
var ModalWithDrag = function ModalWithDrag(_ref) {
|
|
15
17
|
var _context;
|
|
18
|
+
|
|
16
19
|
var className = _ref.className,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
children = _ref.children,
|
|
21
|
+
title = _ref.title,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
|
|
20
24
|
props.title = /*#__PURE__*/React.createElement("div", {
|
|
21
25
|
ref: function ref(e) {
|
|
22
26
|
return e && onLoad(e);
|
|
@@ -26,4 +30,5 @@ var ModalWithDrag = function ModalWithDrag(_ref) {
|
|
|
26
30
|
className: _concatInstanceProperty(_context = "".concat(className, " ")).call(_context, variables('ModalWithDrag'))
|
|
27
31
|
}, props), children);
|
|
28
32
|
};
|
|
33
|
+
|
|
29
34
|
export default ModalWithDrag;
|
package/es/ModalWithDrag/drag.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
2
2
|
import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
|
|
3
|
+
|
|
3
4
|
// 依据CSS3的transform属性进行移动
|
|
4
5
|
var dragByTransform = function dragByTransform(dragElement, targetElement) {
|
|
5
6
|
var mouseMove = null;
|
|
@@ -10,26 +11,30 @@ var dragByTransform = function dragByTransform(dragElement, targetElement) {
|
|
|
10
11
|
var x = 0;
|
|
11
12
|
var y = 0;
|
|
12
13
|
dragElement.style.cursor = 'move';
|
|
14
|
+
|
|
13
15
|
dragElement.onmousedown = function (e) {
|
|
14
16
|
mouseMove = document.onmousemove;
|
|
15
17
|
mouseUp = document.onmouseup;
|
|
16
18
|
x = e.clientX;
|
|
17
19
|
y = e.clientY;
|
|
18
|
-
active = true;
|
|
20
|
+
active = true; // 如果下拉框拥有焦点,通过使其失去焦点来关闭掉下拉框
|
|
19
21
|
|
|
20
|
-
// 如果下拉框拥有焦点,通过使其失去焦点来关闭掉下拉框
|
|
21
22
|
if (document.activeElement && document.activeElement !== dragElement) {
|
|
22
23
|
document.activeElement.blur();
|
|
23
24
|
}
|
|
25
|
+
|
|
24
26
|
document.onmousemove = function (e) {
|
|
25
27
|
if (active) {
|
|
26
28
|
var _context;
|
|
29
|
+
|
|
27
30
|
var x2 = offsetX + e.clientX - x;
|
|
28
31
|
var y2 = offsetY + e.clientY - y;
|
|
29
32
|
targetElement.style.transform = _concatInstanceProperty(_context = "translate(".concat(x2, "px, ")).call(_context, y2, "px)");
|
|
30
33
|
}
|
|
34
|
+
|
|
31
35
|
mouseMove && mouseMove(e);
|
|
32
36
|
};
|
|
37
|
+
|
|
33
38
|
document.onmouseup = function (e) {
|
|
34
39
|
if (active) {
|
|
35
40
|
document.onmousemove = mouseMove;
|
|
@@ -38,18 +43,20 @@ var dragByTransform = function dragByTransform(dragElement, targetElement) {
|
|
|
38
43
|
offsetY += e.clientY - y;
|
|
39
44
|
active = false;
|
|
40
45
|
}
|
|
46
|
+
|
|
41
47
|
mouseUp && mouseUp(e);
|
|
42
48
|
};
|
|
49
|
+
|
|
43
50
|
return false;
|
|
44
51
|
};
|
|
45
|
-
};
|
|
52
|
+
}; // 获取相关CSS属性
|
|
53
|
+
|
|
46
54
|
|
|
47
|
-
// 获取相关CSS属性
|
|
48
55
|
var getCss = function getCss(o, key) {
|
|
49
56
|
return o.currentStyle ? o.currentStyle[key] : document.defaultView.getComputedStyle(o)[key];
|
|
50
|
-
};
|
|
57
|
+
}; // 依据position属性进行移动
|
|
58
|
+
|
|
51
59
|
|
|
52
|
-
// 依据position属性进行移动
|
|
53
60
|
var dragByPosition = function dragByPosition(dragElement, targetElement) {
|
|
54
61
|
var mouseMove = null;
|
|
55
62
|
var mouseUp = null;
|
|
@@ -59,58 +66,68 @@ var dragByPosition = function dragByPosition(dragElement, targetElement) {
|
|
|
59
66
|
var x = 0;
|
|
60
67
|
var y = 0;
|
|
61
68
|
dragElement.style.cursor = 'move';
|
|
69
|
+
|
|
62
70
|
dragElement.onmousedown = function (e) {
|
|
63
71
|
mouseMove = document.onmousemove;
|
|
64
72
|
mouseUp = document.onmouseup;
|
|
65
73
|
x = e.clientX;
|
|
66
74
|
y = e.clientY;
|
|
67
75
|
active = true;
|
|
76
|
+
|
|
68
77
|
if (getCss(targetElement, 'left') !== 'auto') {
|
|
69
78
|
left = _parseInt(getCss(targetElement, "left"));
|
|
70
79
|
}
|
|
80
|
+
|
|
71
81
|
if (getCss(targetElement, 'top') !== 'auto') {
|
|
72
82
|
top = _parseInt(getCss(targetElement, 'top'));
|
|
73
|
-
}
|
|
83
|
+
} // 如果下拉框拥有焦点,通过使其失去焦点来关闭掉下拉框
|
|
84
|
+
|
|
74
85
|
|
|
75
|
-
// 如果下拉框拥有焦点,通过使其失去焦点来关闭掉下拉框
|
|
76
86
|
if (document.activeElement && document.activeElement !== dragElement) {
|
|
77
87
|
document.activeElement.blur();
|
|
78
88
|
}
|
|
89
|
+
|
|
79
90
|
document.onmousemove = function (e) {
|
|
80
91
|
if (active) {
|
|
81
92
|
var top2 = top + e.clientY - y;
|
|
82
93
|
targetElement.style.left = "".concat(left + e.clientX - x, "px");
|
|
83
94
|
targetElement.style.top = "".concat(top2 > 0 ? top2 : 0, "px");
|
|
84
95
|
}
|
|
96
|
+
|
|
85
97
|
mouseMove && mouseMove(e);
|
|
86
98
|
};
|
|
99
|
+
|
|
87
100
|
document.onmouseup = function (e) {
|
|
88
101
|
if (active) {
|
|
89
102
|
document.onmousemove = mouseMove;
|
|
90
103
|
document.onmouseup = mouseUp;
|
|
91
104
|
active = false;
|
|
92
105
|
}
|
|
106
|
+
|
|
93
107
|
mouseUp && mouseUp(e);
|
|
94
108
|
};
|
|
109
|
+
|
|
95
110
|
return false;
|
|
96
111
|
};
|
|
97
112
|
};
|
|
113
|
+
|
|
98
114
|
var drag = function drag(dragElement, targetElement) {
|
|
99
115
|
if (!dragElement || !targetElement) {
|
|
100
116
|
console.error('请传入有效的HTML元素对象');
|
|
101
117
|
return;
|
|
102
|
-
}
|
|
118
|
+
} // 已经绑定过,不需要再次绑定
|
|
119
|
+
|
|
103
120
|
|
|
104
|
-
// 已经绑定过,不需要再次绑定
|
|
105
121
|
if (dragElement.onmousedown) {
|
|
106
122
|
return;
|
|
107
|
-
}
|
|
123
|
+
} // 如果目标元素是非定位元素采用transform属性进行移动
|
|
124
|
+
|
|
108
125
|
|
|
109
|
-
// 如果目标元素是非定位元素采用transform属性进行移动
|
|
110
126
|
if (getCss(targetElement, 'position') === 'static') {
|
|
111
127
|
dragByTransform(dragElement, targetElement);
|
|
112
128
|
} else {
|
|
113
129
|
dragByPosition(dragElement, targetElement);
|
|
114
130
|
}
|
|
115
131
|
};
|
|
132
|
+
|
|
116
133
|
export default drag;
|
|
@@ -14,70 +14,83 @@ import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
|
14
14
|
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
15
15
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
16
16
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
17
|
+
|
|
17
18
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
18
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
|
|
19
22
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
23
|
+
|
|
20
24
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
25
|
+
|
|
21
26
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
22
27
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
23
28
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
24
29
|
import React from 'react';
|
|
25
30
|
import PropTypes from 'prop-types';
|
|
26
31
|
import { getObjectExclude } from '../helper';
|
|
32
|
+
|
|
27
33
|
var parseNumber = function parseNumber(value, _ref) {
|
|
28
34
|
var _context;
|
|
35
|
+
|
|
29
36
|
var real = _ref.real,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
sign = _ref.sign,
|
|
38
|
+
zero = _ref.zero,
|
|
39
|
+
precision = _ref.precision,
|
|
40
|
+
fixed = _ref.fixed,
|
|
41
|
+
big = _ref.big;
|
|
35
42
|
var invalid = {
|
|
36
43
|
invalid: true,
|
|
37
44
|
value: ''
|
|
38
45
|
};
|
|
46
|
+
|
|
39
47
|
if (value === '') {
|
|
40
48
|
return {
|
|
41
49
|
value: value
|
|
42
50
|
};
|
|
43
|
-
}
|
|
51
|
+
} // 非数字
|
|
52
|
+
|
|
44
53
|
|
|
45
|
-
// 非数字
|
|
46
54
|
value = big ? value : Number(value);
|
|
55
|
+
|
|
47
56
|
if (isNaN(value)) {
|
|
48
57
|
return invalid;
|
|
49
|
-
}
|
|
58
|
+
} // 不能为实数,却包含小数点
|
|
59
|
+
|
|
50
60
|
|
|
51
|
-
// 不能为实数,却包含小数点
|
|
52
61
|
if (!real && _includesInstanceProperty(_context = String(value)).call(_context, '.')) {
|
|
53
62
|
return invalid;
|
|
54
|
-
}
|
|
63
|
+
} // 不能为负数,却小于0
|
|
64
|
+
|
|
55
65
|
|
|
56
|
-
// 不能为负数,却小于0
|
|
57
66
|
if (!sign && value < 0) {
|
|
58
67
|
return invalid;
|
|
59
|
-
}
|
|
68
|
+
} // 不能为0,却为0
|
|
69
|
+
|
|
60
70
|
|
|
61
|
-
// 不能为0,却为0
|
|
62
71
|
if (!zero && value === 0) {
|
|
63
72
|
return invalid;
|
|
64
73
|
}
|
|
74
|
+
|
|
65
75
|
if (real) {
|
|
66
76
|
precision = Number(precision);
|
|
77
|
+
|
|
67
78
|
if (precision) {
|
|
68
79
|
value = value.toFixed(precision);
|
|
69
80
|
value = value.toString(); // 将数值转换为字符串
|
|
81
|
+
|
|
70
82
|
value = value.replace(/(\.\d*?[1-9])0+$|\.0*$/, "$1"); // 去除小数点后无意义的零
|
|
83
|
+
|
|
71
84
|
if (!fixed) {
|
|
72
85
|
value = Number(value);
|
|
73
86
|
}
|
|
74
87
|
}
|
|
75
88
|
}
|
|
89
|
+
|
|
76
90
|
return {
|
|
77
91
|
value: value
|
|
78
92
|
};
|
|
79
93
|
};
|
|
80
|
-
|
|
81
94
|
/**
|
|
82
95
|
* real: true表示带小数点,默认为false
|
|
83
96
|
* sign: true表示带正负号,默认为false
|
|
@@ -86,6 +99,8 @@ var parseNumber = function parseNumber(value, _ref) {
|
|
|
86
99
|
* fixed: real为true时生效; true表示固定显示指定精度的小数,精度由precision确定,默认值为false
|
|
87
100
|
* big: big为ture时生效; true标识为大数值,与上面所有属性互斥
|
|
88
101
|
*/
|
|
102
|
+
|
|
103
|
+
|
|
89
104
|
var PROPS = {
|
|
90
105
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
91
106
|
real: PropTypes.bool,
|
|
@@ -98,24 +113,35 @@ var PROPS = {
|
|
|
98
113
|
onChange: PropTypes.func,
|
|
99
114
|
onBlur: PropTypes.func
|
|
100
115
|
};
|
|
116
|
+
|
|
101
117
|
var PROPS_KEYS = _Object$keys(PROPS);
|
|
118
|
+
|
|
102
119
|
var NumberInput = /*#__PURE__*/function (_React$Component) {
|
|
103
120
|
_inherits(NumberInput, _React$Component);
|
|
121
|
+
|
|
104
122
|
var _super = _createSuper(NumberInput);
|
|
123
|
+
|
|
105
124
|
function NumberInput() {
|
|
106
125
|
var _context2;
|
|
126
|
+
|
|
107
127
|
var _this;
|
|
128
|
+
|
|
108
129
|
_classCallCheck(this, NumberInput);
|
|
130
|
+
|
|
109
131
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
110
132
|
args[_key] = arguments[_key];
|
|
111
133
|
}
|
|
134
|
+
|
|
112
135
|
_this = _super.call.apply(_super, _concatInstanceProperty(_context2 = [this]).call(_context2, args));
|
|
136
|
+
|
|
113
137
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
114
138
|
typo: false,
|
|
115
139
|
value: ''
|
|
116
140
|
});
|
|
141
|
+
|
|
117
142
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (event) {
|
|
118
143
|
var value = event.target.value;
|
|
144
|
+
|
|
119
145
|
if (!_this.hasSpecialChar(value)) {
|
|
120
146
|
_this.setState({
|
|
121
147
|
value: value,
|
|
@@ -123,25 +149,31 @@ var NumberInput = /*#__PURE__*/function (_React$Component) {
|
|
|
123
149
|
});
|
|
124
150
|
}
|
|
125
151
|
});
|
|
152
|
+
|
|
126
153
|
_defineProperty(_assertThisInitialized(_this), "onBlur", function (event) {
|
|
127
154
|
var _this$props = _this.props,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
155
|
+
onBlur = _this$props.onBlur,
|
|
156
|
+
onChange = _this$props.onChange,
|
|
157
|
+
fixed = _this$props.fixed;
|
|
158
|
+
|
|
131
159
|
if (_this.state.typo) {
|
|
132
160
|
var _this$format = _this.format(_this.state.value, fixed),
|
|
133
|
-
|
|
134
|
-
|
|
161
|
+
invalid = _this$format.invalid,
|
|
162
|
+
value = _this$format.value;
|
|
163
|
+
|
|
135
164
|
_this.setState({
|
|
136
165
|
typo: false,
|
|
137
166
|
value: ''
|
|
138
167
|
});
|
|
168
|
+
|
|
139
169
|
if (!invalid) {
|
|
140
170
|
onChange && onChange(value);
|
|
141
171
|
}
|
|
172
|
+
|
|
142
173
|
onBlur && onBlur(event); //有输入才触发外部失去焦点事件,避免非必要请求
|
|
143
174
|
}
|
|
144
175
|
});
|
|
176
|
+
|
|
145
177
|
_defineProperty(_assertThisInitialized(_this), "hasSpecialChar", function (value) {
|
|
146
178
|
if (_includesInstanceProperty(value).call(value, '+')) {
|
|
147
179
|
return true;
|
|
@@ -151,13 +183,14 @@ var NumberInput = /*#__PURE__*/function (_React$Component) {
|
|
|
151
183
|
return !_this.props.real && _includesInstanceProperty(value).call(value, '.');
|
|
152
184
|
}
|
|
153
185
|
});
|
|
186
|
+
|
|
154
187
|
_defineProperty(_assertThisInitialized(_this), "format", function (value, fixed) {
|
|
155
188
|
var _this$props2 = _this.props,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
189
|
+
real = _this$props2.real,
|
|
190
|
+
sign = _this$props2.sign,
|
|
191
|
+
zero = _this$props2.zero,
|
|
192
|
+
precision = _this$props2.precision,
|
|
193
|
+
big = _this$props2.big;
|
|
161
194
|
return parseNumber(value, {
|
|
162
195
|
real: real,
|
|
163
196
|
sign: sign,
|
|
@@ -167,6 +200,7 @@ var NumberInput = /*#__PURE__*/function (_React$Component) {
|
|
|
167
200
|
big: big
|
|
168
201
|
});
|
|
169
202
|
});
|
|
203
|
+
|
|
170
204
|
_defineProperty(_assertThisInitialized(_this), "getShowValue", function () {
|
|
171
205
|
if (_this.state.typo) {
|
|
172
206
|
// 处于输入状态从state中取值
|
|
@@ -176,6 +210,7 @@ var NumberInput = /*#__PURE__*/function (_React$Component) {
|
|
|
176
210
|
return _this.format(_this.props.defaultValue, _this.props.fixed).value;
|
|
177
211
|
}
|
|
178
212
|
});
|
|
213
|
+
|
|
179
214
|
_defineProperty(_assertThisInitialized(_this), "getProps", function () {
|
|
180
215
|
var props = getObjectExclude(_this.props, PROPS_KEYS);
|
|
181
216
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -186,15 +221,20 @@ var NumberInput = /*#__PURE__*/function (_React$Component) {
|
|
|
186
221
|
onBlur: _this.onBlur
|
|
187
222
|
});
|
|
188
223
|
});
|
|
224
|
+
|
|
189
225
|
return _this;
|
|
190
226
|
}
|
|
227
|
+
|
|
191
228
|
_createClass(NumberInput, [{
|
|
192
229
|
key: "render",
|
|
193
230
|
value: function render() {
|
|
194
231
|
return /*#__PURE__*/React.createElement(_Input, this.getProps());
|
|
195
232
|
}
|
|
196
233
|
}]);
|
|
234
|
+
|
|
197
235
|
return NumberInput;
|
|
198
236
|
}(React.Component);
|
|
237
|
+
|
|
199
238
|
_defineProperty(NumberInput, "propTypes", PROPS);
|
|
239
|
+
|
|
200
240
|
export default NumberInput;
|