cloud-b2b 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Card/Card.js +20 -0
- package/es/Card/package.json +6 -0
- package/es/Control/Control.js +402 -0
- package/es/Control/event.js +57 -0
- package/es/Control/package.json +6 -0
- package/es/Enhance/Dialogs.js +67 -0
- package/es/Enhance/Loading.js +151 -0
- package/es/Enhance/index.js +8 -0
- package/es/Enhance/package.json +6 -0
- package/es/Header/Header.js +194 -0
- package/es/Header/Header.less +94 -0
- package/es/Header/Vertical.js +129 -0
- package/es/Header/Vertical.less +60 -0
- package/es/Header/package.json +6 -0
- package/es/HomeHeader/Header.js +75 -0
- package/es/HomeHeader/Header.less +73 -0
- package/es/HomeHeader/package.json +6 -0
- package/es/ImageView/ImageView.js +117 -0
- package/es/ImageView/ImageView.less +14 -0
- package/es/ImageView/package.json +6 -0
- package/es/InpurCascader/InputCascader.js +135 -0
- package/es/InpurCascader/package.json +6 -0
- package/es/InputEditor/InputEditor.js +118 -0
- package/es/InputEditor/inputEditor.less +8 -0
- package/es/InputEditor/package.json +6 -0
- package/es/InputSearch/InputSearch.js +306 -0
- package/es/InputSearch/package.json +6 -0
- package/es/InputSelect/InputSelect.js +185 -0
- package/es/InputSelect/package.json +6 -0
- package/es/InputWriting/InputWriting.js +107 -0
- package/es/InputWriting/package.json +6 -0
- package/es/Layout/Layout.js +232 -0
- package/es/Layout/Layout.less +28 -0
- package/es/Layout/package.json +6 -0
- package/es/LayoutLink/LayoutLink.js +82 -0
- package/es/LayoutLink/LayoutLink.less +53 -0
- package/es/LayoutLink/package.json +6 -0
- package/es/Link/Link.js +108 -0
- package/es/Link/package.json +6 -0
- package/es/Loading/Loading.js +15 -0
- package/es/Loading/Loading.less +13 -0
- package/es/Loading/package.json +6 -0
- package/es/Loading2/Loading2.js +11 -0
- package/es/Loading2/Loading2.less +19 -0
- package/es/Loading2/package.json +6 -0
- package/es/ModalWithDrag/ModalWithDrag.js +34 -0
- package/es/ModalWithDrag/ModalWithDrag.less +6 -0
- package/es/ModalWithDrag/drag.js +133 -0
- package/es/ModalWithDrag/package.json +6 -0
- package/es/NumberInput/NumberInput.js +237 -0
- package/es/NumberInput/package.json +6 -0
- package/es/Search/Search.js +581 -0
- package/es/Search/Search.less +63 -0
- package/es/Search/package.json +6 -0
- package/es/Sidebar/Sidebar.js +165 -0
- package/es/Sidebar/Sidebar.less +77 -0
- package/es/Sidebar/package.json +6 -0
- package/es/Sidebar2/Sidebar.js +192 -0
- package/es/Sidebar2/Sidebar.less +153 -0
- package/es/Sidebar2/package.json +6 -0
- package/es/SuperForm/SuperForm.js +641 -0
- package/es/SuperForm/SuperForm.less +52 -0
- package/es/SuperForm/package.json +6 -0
- package/es/SuperIcon/SuperIcon.js +30 -0
- package/es/SuperIcon/package.json +6 -0
- package/es/SuperPagination/SuperPagination.js +126 -0
- package/es/SuperPagination/package.json +6 -0
- package/es/SuperToolbar/SuperToolbar.js +223 -0
- package/es/SuperToolbar/SuperToolbar.less +17 -0
- package/es/SuperToolbar/package.json +6 -0
- package/es/SuperUpload/SuperUpload.js +282 -0
- package/es/SuperUpload/SuperUpload.less +27 -0
- package/es/SuperUpload/package.json +6 -0
- package/es/Viewer/ImageViews.js +311 -0
- package/es/Viewer/Viewer.js +149 -0
- package/es/Viewer/Viewer.less +67 -0
- package/es/Viewer/imgView.less +59 -0
- package/es/Viewer/package.json +7 -0
- package/es/WingBlank/WingBlank.js +20 -0
- package/es/WingBlank/WingBlank.less +12 -0
- package/es/WingBlank/package.json +6 -0
- package/es/helper.js +118 -0
- package/es/history.js +5 -0
- package/es/index.js +24 -1
- package/es/variables.less +73 -73
- package/lib/Card/Card.js +38 -0
- package/lib/Card/package.json +6 -0
- package/lib/Control/Control.js +449 -0
- package/lib/Control/event.js +68 -0
- package/lib/Control/package.json +6 -0
- package/lib/Enhance/Dialogs.js +87 -0
- package/lib/Enhance/Loading.js +175 -0
- package/lib/Enhance/index.js +35 -0
- package/lib/Enhance/package.json +6 -0
- package/lib/Header/Header.js +215 -0
- package/lib/Header/Header.less +94 -0
- package/lib/Header/Vertical.js +150 -0
- package/lib/Header/Vertical.less +60 -0
- package/lib/Header/package.json +6 -0
- package/lib/HomeHeader/Header.js +95 -0
- package/lib/HomeHeader/Header.less +73 -0
- package/lib/HomeHeader/package.json +6 -0
- package/lib/ImageView/ImageView.js +134 -0
- package/lib/ImageView/ImageView.less +14 -0
- package/lib/ImageView/package.json +6 -0
- package/lib/InpurCascader/InputCascader.js +156 -0
- package/lib/InpurCascader/package.json +6 -0
- package/lib/InputEditor/InputEditor.js +136 -0
- package/lib/InputEditor/inputEditor.less +8 -0
- package/lib/InputEditor/package.json +6 -0
- package/lib/InputSearch/InputSearch.js +322 -0
- package/lib/InputSearch/package.json +6 -0
- package/lib/InputSelect/InputSelect.js +208 -0
- package/lib/InputSelect/package.json +6 -0
- package/lib/InputWriting/InputWriting.js +123 -0
- package/lib/InputWriting/package.json +6 -0
- package/lib/Layout/Layout.js +258 -0
- package/lib/Layout/Layout.less +28 -0
- package/lib/Layout/package.json +6 -0
- package/lib/LayoutLink/LayoutLink.js +114 -0
- package/lib/LayoutLink/LayoutLink.less +53 -0
- package/lib/LayoutLink/package.json +6 -0
- package/lib/Link/Link.js +130 -0
- package/lib/Link/package.json +6 -0
- package/lib/Loading/Loading.js +30 -0
- package/lib/Loading/Loading.less +13 -0
- package/lib/Loading/package.json +6 -0
- package/lib/Loading2/Loading2.js +26 -0
- package/lib/Loading2/Loading2.less +19 -0
- package/lib/Loading2/package.json +6 -0
- package/lib/ModalWithDrag/ModalWithDrag.js +53 -0
- package/lib/ModalWithDrag/ModalWithDrag.less +6 -0
- package/lib/ModalWithDrag/drag.js +147 -0
- package/lib/ModalWithDrag/package.json +6 -0
- package/lib/NumberInput/NumberInput.js +259 -0
- package/lib/NumberInput/package.json +6 -0
- package/lib/Search/Search.js +603 -0
- package/lib/Search/Search.less +63 -0
- package/lib/Search/package.json +6 -0
- package/lib/Sidebar/Sidebar.js +186 -0
- package/lib/Sidebar/Sidebar.less +77 -0
- package/lib/Sidebar/package.json +6 -0
- package/lib/Sidebar2/Sidebar.js +213 -0
- package/lib/Sidebar2/Sidebar.less +153 -0
- package/lib/Sidebar2/package.json +6 -0
- package/lib/SuperForm/SuperForm.js +657 -0
- package/lib/SuperForm/SuperForm.less +52 -0
- package/lib/SuperForm/package.json +6 -0
- package/lib/SuperIcon/SuperIcon.js +47 -0
- package/lib/SuperIcon/package.json +6 -0
- package/lib/SuperPagination/SuperPagination.js +145 -0
- package/lib/SuperPagination/package.json +6 -0
- package/lib/SuperToolbar/SuperToolbar.js +248 -0
- package/lib/SuperToolbar/SuperToolbar.less +17 -0
- package/lib/SuperToolbar/package.json +6 -0
- package/lib/SuperUpload/SuperUpload.js +324 -0
- package/lib/SuperUpload/SuperUpload.less +27 -0
- package/lib/SuperUpload/package.json +6 -0
- package/lib/Viewer/ImageViews.js +323 -0
- package/lib/Viewer/Viewer.js +167 -0
- package/lib/Viewer/Viewer.less +67 -0
- package/lib/Viewer/imgView.less +59 -0
- package/lib/Viewer/package.json +7 -0
- package/lib/WingBlank/WingBlank.js +37 -0
- package/lib/WingBlank/WingBlank.less +12 -0
- package/lib/WingBlank/package.json +6 -0
- package/lib/helper.js +147 -0
- package/lib/history.js +18 -0
- package/lib/index.js +208 -1
- package/lib/index.less +20 -1
- package/lib/variables.less +73 -73
- package/package.json +3 -2
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
2
|
+
import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
|
|
3
|
+
|
|
4
|
+
// 依据CSS3的transform属性进行移动
|
|
5
|
+
var dragByTransform = function dragByTransform(dragElement, targetElement) {
|
|
6
|
+
var mouseMove = null;
|
|
7
|
+
var mouseUp = null;
|
|
8
|
+
var active = false;
|
|
9
|
+
var offsetX = 0;
|
|
10
|
+
var offsetY = 0;
|
|
11
|
+
var x = 0;
|
|
12
|
+
var y = 0;
|
|
13
|
+
dragElement.style.cursor = 'move';
|
|
14
|
+
|
|
15
|
+
dragElement.onmousedown = function (e) {
|
|
16
|
+
mouseMove = document.onmousemove;
|
|
17
|
+
mouseUp = document.onmouseup;
|
|
18
|
+
x = e.clientX;
|
|
19
|
+
y = e.clientY;
|
|
20
|
+
active = true; // 如果下拉框拥有焦点,通过使其失去焦点来关闭掉下拉框
|
|
21
|
+
|
|
22
|
+
if (document.activeElement && document.activeElement !== dragElement) {
|
|
23
|
+
document.activeElement.blur();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
document.onmousemove = function (e) {
|
|
27
|
+
if (active) {
|
|
28
|
+
var _context;
|
|
29
|
+
|
|
30
|
+
var x2 = offsetX + e.clientX - x;
|
|
31
|
+
var y2 = offsetY + e.clientY - y;
|
|
32
|
+
targetElement.style.transform = _concatInstanceProperty(_context = "translate(".concat(x2, "px, ")).call(_context, y2, "px)");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
mouseMove && mouseMove(e);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
document.onmouseup = function (e) {
|
|
39
|
+
if (active) {
|
|
40
|
+
document.onmousemove = mouseMove;
|
|
41
|
+
document.onmouseup = mouseUp;
|
|
42
|
+
offsetX += e.clientX - x;
|
|
43
|
+
offsetY += e.clientY - y;
|
|
44
|
+
active = false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
mouseUp && mouseUp(e);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return false;
|
|
51
|
+
};
|
|
52
|
+
}; // 获取相关CSS属性
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
var getCss = function getCss(o, key) {
|
|
56
|
+
return o.currentStyle ? o.currentStyle[key] : document.defaultView.getComputedStyle(o)[key];
|
|
57
|
+
}; // 依据position属性进行移动
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
var dragByPosition = function dragByPosition(dragElement, targetElement) {
|
|
61
|
+
var mouseMove = null;
|
|
62
|
+
var mouseUp = null;
|
|
63
|
+
var active = false;
|
|
64
|
+
var left = 0;
|
|
65
|
+
var top = 0;
|
|
66
|
+
var x = 0;
|
|
67
|
+
var y = 0;
|
|
68
|
+
dragElement.style.cursor = 'move';
|
|
69
|
+
|
|
70
|
+
dragElement.onmousedown = function (e) {
|
|
71
|
+
mouseMove = document.onmousemove;
|
|
72
|
+
mouseUp = document.onmouseup;
|
|
73
|
+
x = e.clientX;
|
|
74
|
+
y = e.clientY;
|
|
75
|
+
active = true;
|
|
76
|
+
|
|
77
|
+
if (getCss(targetElement, 'left') !== 'auto') {
|
|
78
|
+
left = _parseInt(getCss(targetElement, "left"));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (getCss(targetElement, 'top') !== 'auto') {
|
|
82
|
+
top = _parseInt(getCss(targetElement, 'top'));
|
|
83
|
+
} // 如果下拉框拥有焦点,通过使其失去焦点来关闭掉下拉框
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
if (document.activeElement && document.activeElement !== dragElement) {
|
|
87
|
+
document.activeElement.blur();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
document.onmousemove = function (e) {
|
|
91
|
+
if (active) {
|
|
92
|
+
var top2 = top + e.clientY - y;
|
|
93
|
+
targetElement.style.left = "".concat(left + e.clientX - x, "px");
|
|
94
|
+
targetElement.style.top = "".concat(top2 > 0 ? top2 : 0, "px");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
mouseMove && mouseMove(e);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
document.onmouseup = function (e) {
|
|
101
|
+
if (active) {
|
|
102
|
+
document.onmousemove = mouseMove;
|
|
103
|
+
document.onmouseup = mouseUp;
|
|
104
|
+
active = false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
mouseUp && mouseUp(e);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return false;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
var drag = function drag(dragElement, targetElement) {
|
|
115
|
+
if (!dragElement || !targetElement) {
|
|
116
|
+
console.error('请传入有效的HTML元素对象');
|
|
117
|
+
return;
|
|
118
|
+
} // 已经绑定过,不需要再次绑定
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
if (dragElement.onmousedown) {
|
|
122
|
+
return;
|
|
123
|
+
} // 如果目标元素是非定位元素采用transform属性进行移动
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
if (getCss(targetElement, 'position') === 'static') {
|
|
127
|
+
dragByTransform(dragElement, targetElement);
|
|
128
|
+
} else {
|
|
129
|
+
dragByPosition(dragElement, targetElement);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export default drag;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
|
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
9
|
+
import _Input from "antd/es/input";
|
|
10
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
11
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
12
|
+
import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
|
|
13
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
14
|
+
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
15
|
+
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
16
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
26
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
27
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
28
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
29
|
+
import React from 'react';
|
|
30
|
+
import PropTypes from 'prop-types';
|
|
31
|
+
import { getObjectExclude } from '../helper';
|
|
32
|
+
|
|
33
|
+
var parseNumber = function parseNumber(value, _ref) {
|
|
34
|
+
var _context;
|
|
35
|
+
|
|
36
|
+
var real = _ref.real,
|
|
37
|
+
sign = _ref.sign,
|
|
38
|
+
zero = _ref.zero,
|
|
39
|
+
precision = _ref.precision,
|
|
40
|
+
fixed = _ref.fixed,
|
|
41
|
+
big = _ref.big;
|
|
42
|
+
var invalid = {
|
|
43
|
+
invalid: true,
|
|
44
|
+
value: ''
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
if (value === '') {
|
|
48
|
+
return {
|
|
49
|
+
value: value
|
|
50
|
+
};
|
|
51
|
+
} // 非数字
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
value = big ? value : Number(value);
|
|
55
|
+
|
|
56
|
+
if (isNaN(value)) {
|
|
57
|
+
return invalid;
|
|
58
|
+
} // 不能为实数,却包含小数点
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
if (!real && _includesInstanceProperty(_context = String(value)).call(_context, '.')) {
|
|
62
|
+
return invalid;
|
|
63
|
+
} // 不能为负数,却小于0
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if (!sign && value < 0) {
|
|
67
|
+
return invalid;
|
|
68
|
+
} // 不能为0,却为0
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if (!zero && value === 0) {
|
|
72
|
+
return invalid;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (real) {
|
|
76
|
+
precision = Number(precision);
|
|
77
|
+
|
|
78
|
+
if (precision) {
|
|
79
|
+
value = value.toFixed(precision);
|
|
80
|
+
|
|
81
|
+
if (!fixed) {
|
|
82
|
+
value = Number(value);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
value: value
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* real: true表示带小数点,默认为false
|
|
93
|
+
* sign: true表示带正负号,默认为false
|
|
94
|
+
* precision: real为true时,小数的精度;否则无效
|
|
95
|
+
* zero:true表示可以输入0,默认为false
|
|
96
|
+
* fixed: real为true时生效; true表示固定显示指定精度的小数,精度由precision确定,默认值为false
|
|
97
|
+
* big: big为ture时生效; true标识为大数值,与上面所有属性互斥
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
var PROPS = {
|
|
102
|
+
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
103
|
+
real: PropTypes.bool,
|
|
104
|
+
sign: PropTypes.bool,
|
|
105
|
+
precision: PropTypes.any,
|
|
106
|
+
zero: PropTypes.bool,
|
|
107
|
+
fixed: PropTypes.bool,
|
|
108
|
+
big: PropTypes.bool,
|
|
109
|
+
inputRef: PropTypes.func,
|
|
110
|
+
onChange: PropTypes.func,
|
|
111
|
+
onBlur: PropTypes.func
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
var PROPS_KEYS = _Object$keys(PROPS);
|
|
115
|
+
|
|
116
|
+
var NumberInput = /*#__PURE__*/function (_React$Component) {
|
|
117
|
+
_inherits(NumberInput, _React$Component);
|
|
118
|
+
|
|
119
|
+
var _super = _createSuper(NumberInput);
|
|
120
|
+
|
|
121
|
+
function NumberInput() {
|
|
122
|
+
var _context2;
|
|
123
|
+
|
|
124
|
+
var _this;
|
|
125
|
+
|
|
126
|
+
_classCallCheck(this, NumberInput);
|
|
127
|
+
|
|
128
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
129
|
+
args[_key] = arguments[_key];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
_this = _super.call.apply(_super, _concatInstanceProperty(_context2 = [this]).call(_context2, args));
|
|
133
|
+
|
|
134
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
135
|
+
typo: false,
|
|
136
|
+
value: ''
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
_defineProperty(_assertThisInitialized(_this), "onChange", function (event) {
|
|
140
|
+
var value = event.target.value;
|
|
141
|
+
|
|
142
|
+
if (!_this.hasSpecialChar(value)) {
|
|
143
|
+
_this.setState({
|
|
144
|
+
value: value,
|
|
145
|
+
typo: true
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
_defineProperty(_assertThisInitialized(_this), "onBlur", function (event) {
|
|
151
|
+
var _this$props = _this.props,
|
|
152
|
+
onBlur = _this$props.onBlur,
|
|
153
|
+
onChange = _this$props.onChange,
|
|
154
|
+
fixed = _this$props.fixed;
|
|
155
|
+
|
|
156
|
+
if (_this.state.typo) {
|
|
157
|
+
var _this$format = _this.format(_this.state.value, fixed),
|
|
158
|
+
invalid = _this$format.invalid,
|
|
159
|
+
value = _this$format.value;
|
|
160
|
+
|
|
161
|
+
_this.setState({
|
|
162
|
+
typo: false,
|
|
163
|
+
value: ''
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
if (!invalid) {
|
|
167
|
+
onChange && onChange(value);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
onBlur && onBlur(event);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
_defineProperty(_assertThisInitialized(_this), "hasSpecialChar", function (value) {
|
|
175
|
+
if (_includesInstanceProperty(value).call(value, '+')) {
|
|
176
|
+
return true;
|
|
177
|
+
} else if (!_this.props.sign && _includesInstanceProperty(value).call(value, '-')) {
|
|
178
|
+
return true;
|
|
179
|
+
} else {
|
|
180
|
+
return !_this.props.real && _includesInstanceProperty(value).call(value, '.');
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
_defineProperty(_assertThisInitialized(_this), "format", function (value, fixed) {
|
|
185
|
+
var _this$props2 = _this.props,
|
|
186
|
+
real = _this$props2.real,
|
|
187
|
+
sign = _this$props2.sign,
|
|
188
|
+
zero = _this$props2.zero,
|
|
189
|
+
precision = _this$props2.precision,
|
|
190
|
+
big = _this$props2.big;
|
|
191
|
+
return parseNumber(value, {
|
|
192
|
+
real: real,
|
|
193
|
+
sign: sign,
|
|
194
|
+
zero: zero,
|
|
195
|
+
precision: precision,
|
|
196
|
+
fixed: fixed,
|
|
197
|
+
big: big
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
_defineProperty(_assertThisInitialized(_this), "getShowValue", function () {
|
|
202
|
+
if (_this.state.typo) {
|
|
203
|
+
// 处于输入状态从state中取值
|
|
204
|
+
return _this.state.value;
|
|
205
|
+
} else {
|
|
206
|
+
// 处于非输入状态从props中取值
|
|
207
|
+
return _this.format(_this.props.defaultValue, _this.props.fixed).value;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
_defineProperty(_assertThisInitialized(_this), "getProps", function () {
|
|
212
|
+
var props = getObjectExclude(_this.props, PROPS_KEYS);
|
|
213
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
214
|
+
type: 'text',
|
|
215
|
+
ref: _this.props.inputRef || null,
|
|
216
|
+
value: _this.getShowValue(),
|
|
217
|
+
onChange: _this.onChange,
|
|
218
|
+
onBlur: _this.onBlur
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
return _this;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
_createClass(NumberInput, [{
|
|
226
|
+
key: "render",
|
|
227
|
+
value: function render() {
|
|
228
|
+
return /*#__PURE__*/React.createElement(_Input, this.getProps());
|
|
229
|
+
}
|
|
230
|
+
}]);
|
|
231
|
+
|
|
232
|
+
return NumberInput;
|
|
233
|
+
}(React.Component);
|
|
234
|
+
|
|
235
|
+
_defineProperty(NumberInput, "propTypes", PROPS);
|
|
236
|
+
|
|
237
|
+
export default NumberInput;
|