assui 2.0.2 → 2.0.6
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/button-drawer/index.d.ts +10 -0
- package/es/button-drawer/index.js +116 -0
- package/es/button-drawer/style/index.d.ts +1 -0
- package/es/button-drawer/style/index.js +1 -0
- package/es/button-modal/index.d.ts +14 -0
- package/es/button-modal/index.js +131 -0
- package/es/button-modal/style/index.d.ts +1 -0
- package/es/button-modal/style/index.js +1 -0
- package/es/condition-input/index.d.ts +15 -0
- package/es/condition-input/index.js +108 -0
- package/es/condition-input/parse2RegexOption.d.ts +13 -0
- package/es/condition-input/parse2RegexOption.js +57 -0
- package/es/condition-input/style/index.d.ts +1 -0
- package/es/condition-input/style/index.js +1 -0
- package/es/copy-to-clipboard/index.d.ts +22 -0
- package/es/copy-to-clipboard/index.js +95 -0
- package/es/copy-to-clipboard/style/index.css +249 -0
- package/es/copy-to-clipboard/style/index.d.ts +1 -0
- package/es/copy-to-clipboard/style/index.js +1 -0
- package/es/copy-to-clipboard/style/index.less +1 -0
- package/es/highlight-textarea/HighlighedContents.d.ts +7 -0
- package/es/highlight-textarea/HighlighedContents.js +15 -0
- package/es/highlight-textarea/extractSpansOfClasses.d.ts +15 -0
- package/es/highlight-textarea/extractSpansOfClasses.js +159 -0
- package/es/highlight-textarea/getRanges.d.ts +2 -0
- package/es/highlight-textarea/getRanges.js +142 -0
- package/es/highlight-textarea/getType.d.ts +2 -0
- package/es/highlight-textarea/getType.js +29 -0
- package/es/highlight-textarea/index.d.ts +12 -0
- package/es/highlight-textarea/index.js +132 -0
- package/es/highlight-textarea/style/index.css +38 -0
- package/es/highlight-textarea/style/index.d.ts +2 -0
- package/es/highlight-textarea/style/index.js +2 -0
- package/es/highlight-textarea/style/index.less +42 -0
- package/es/highlight-textarea/types.d.ts +16 -0
- package/es/highlight-textarea/types.js +0 -0
- package/es/highlight-words/index.d.ts +3 -0
- package/es/highlight-words/index.js +2 -0
- package/es/highlight-words/style/index.d.ts +1 -0
- package/es/highlight-words/style/index.js +0 -0
- package/es/icon/demo/svg/check-circle-filled.svg +6 -0
- package/es/icon/demo/svg/coin-circle.svg +9 -0
- package/es/icon/index.d.ts +27 -0
- package/es/icon/index.js +95 -0
- package/es/icon/style/index.d.ts +1 -0
- package/es/icon/style/index.js +0 -0
- package/es/icon/utils.d.ts +6 -0
- package/es/icon/utils.js +22 -0
- package/es/img-crop/EasyCrop.d.ts +6 -0
- package/es/img-crop/EasyCrop.js +113 -0
- package/es/img-crop/getCroppedImg.d.ts +6 -0
- package/es/img-crop/getCroppedImg.js +199 -0
- package/es/img-crop/index.d.ts +53 -0
- package/es/img-crop/index.js +531 -0
- package/es/img-crop/style/index.css +52 -0
- package/es/img-crop/style/index.d.ts +3 -0
- package/es/img-crop/style/index.js +3 -0
- package/es/img-crop/style/index.less +54 -0
- package/es/index.d.ts +34 -2
- package/es/index.js +18 -2
- package/es/keep-tab/demo/index.modules.less +66 -0
- package/es/keep-tab/index.d.ts +29 -0
- package/es/keep-tab/index.js +129 -0
- package/es/keep-tab/style/index.css +1129 -0
- package/es/keep-tab/style/index.d.ts +2 -0
- package/es/keep-tab/style/index.js +2 -0
- package/es/keep-tab/style/index.less +2 -0
- package/es/number-input/index.d.ts +22 -7
- package/es/number-input/index.js +22 -11
- package/es/number-input/style/index.d.ts +1 -1
- package/es/number-input/style/index.js +1 -1
- package/es/number-input/utils.d.ts +10 -11
- package/es/number-input/utils.js +7 -7
- package/es/rc-echart/core.d.ts +32 -0
- package/es/rc-echart/core.js +136 -0
- package/es/rc-echart/index.d.ts +21 -0
- package/es/rc-echart/index.js +27 -0
- package/es/rc-echart/style/index.d.ts +1 -0
- package/es/rc-echart/style/index.js +0 -0
- package/es/rc-motion/demo/CSSMotion.less +91 -0
- package/es/rc-motion/index.d.ts +2 -0
- package/es/rc-motion/index.js +2 -0
- package/es/rc-motion/style/index.d.ts +1 -0
- package/es/rc-motion/style/index.js +0 -0
- package/es/rc-qrcode/index.d.ts +20 -0
- package/es/rc-qrcode/index.js +57 -0
- package/es/rc-qrcode/style/index.d.ts +1 -0
- package/es/rc-qrcode/style/index.js +0 -0
- package/es/rc-qrcode/useQrcode.d.ts +4 -0
- package/es/rc-qrcode/useQrcode.js +50 -0
- package/es/rc-transition-group/index.d.ts +2 -0
- package/es/rc-transition-group/index.js +2 -0
- package/es/rc-transition-group/style/index.d.ts +1 -0
- package/es/rc-transition-group/style/index.js +0 -0
- package/es/single-img-upload/index.d.ts +19 -0
- package/es/single-img-upload/index.js +199 -0
- package/es/single-img-upload/style/index.css +74 -0
- package/es/single-img-upload/style/index.d.ts +3 -0
- package/es/single-img-upload/style/index.js +3 -0
- package/es/single-img-upload/style/index.less +85 -0
- package/es/sortable-hoc/demo/VerticalListBase/index.modules.less +63 -0
- package/es/sortable-hoc/demo/index.modules.less +248 -0
- package/es/sortable-hoc/index.d.ts +2 -0
- package/es/sortable-hoc/index.js +2 -0
- package/es/sortable-hoc/style/index.d.ts +1 -0
- package/es/sortable-hoc/style/index.js +0 -0
- package/es/split-pane/index.d.ts +59 -0
- package/es/split-pane/index.js +21 -0
- package/es/split-pane/style/index.css +41 -0
- package/es/split-pane/style/index.d.ts +1 -0
- package/es/split-pane/style/index.js +1 -0
- package/es/split-pane/style/index.less +49 -0
- package/es/text-area/index.d.ts +12 -0
- package/es/text-area/index.js +96 -0
- package/es/text-area/style/index.d.ts +1 -0
- package/es/text-area/style/index.js +1 -0
- package/es/text-input/index.d.ts +5 -0
- package/es/text-input/index.js +85 -0
- package/es/{number-input → text-input}/style/index.css +0 -3
- package/es/text-input/style/index.d.ts +1 -0
- package/es/text-input/style/index.js +1 -0
- package/es/{number-input → text-input}/style/index.less +0 -4
- package/lib/button-drawer/index.d.ts +10 -0
- package/lib/button-drawer/index.js +164 -0
- package/lib/button-drawer/style/index.d.ts +1 -0
- package/lib/button-drawer/style/index.js +7 -0
- package/lib/button-modal/index.d.ts +14 -0
- package/lib/button-modal/index.js +178 -0
- package/lib/button-modal/style/index.d.ts +1 -0
- package/lib/button-modal/style/index.js +7 -0
- package/lib/condition-input/index.d.ts +15 -0
- package/lib/condition-input/index.js +158 -0
- package/lib/condition-input/parse2RegexOption.d.ts +13 -0
- package/lib/condition-input/parse2RegexOption.js +72 -0
- package/lib/condition-input/style/index.d.ts +1 -0
- package/lib/condition-input/style/index.js +7 -0
- package/lib/copy-to-clipboard/index.d.ts +22 -0
- package/lib/copy-to-clipboard/index.js +143 -0
- package/lib/copy-to-clipboard/style/index.css +249 -0
- package/lib/copy-to-clipboard/style/index.d.ts +1 -0
- package/lib/copy-to-clipboard/style/index.js +7 -0
- package/lib/copy-to-clipboard/style/index.less +1 -0
- package/lib/highlight-textarea/HighlighedContents.d.ts +7 -0
- package/lib/highlight-textarea/HighlighedContents.js +29 -0
- package/lib/highlight-textarea/extractSpansOfClasses.d.ts +15 -0
- package/lib/highlight-textarea/extractSpansOfClasses.js +173 -0
- package/lib/highlight-textarea/getRanges.d.ts +2 -0
- package/lib/highlight-textarea/getRanges.js +156 -0
- package/lib/highlight-textarea/getType.d.ts +2 -0
- package/lib/highlight-textarea/getType.js +37 -0
- package/lib/highlight-textarea/index.d.ts +12 -0
- package/lib/highlight-textarea/index.js +183 -0
- package/lib/highlight-textarea/style/index.css +38 -0
- package/lib/highlight-textarea/style/index.d.ts +2 -0
- package/lib/highlight-textarea/style/index.js +9 -0
- package/lib/highlight-textarea/style/index.less +42 -0
- package/lib/highlight-textarea/types.d.ts +16 -0
- package/lib/highlight-textarea/types.js +5 -0
- package/lib/highlight-words/index.d.ts +3 -0
- package/lib/highlight-words/index.js +15 -0
- package/lib/highlight-words/style/index.d.ts +1 -0
- package/lib/highlight-words/style/index.js +0 -0
- package/lib/icon/demo/svg/check-circle-filled.svg +6 -0
- package/lib/icon/demo/svg/coin-circle.svg +9 -0
- package/lib/icon/index.d.ts +27 -0
- package/lib/icon/index.js +143 -0
- package/lib/icon/style/index.d.ts +1 -0
- package/lib/icon/style/index.js +0 -0
- package/lib/icon/utils.d.ts +6 -0
- package/lib/icon/utils.js +32 -0
- package/lib/img-crop/EasyCrop.d.ts +6 -0
- package/lib/img-crop/EasyCrop.js +160 -0
- package/lib/img-crop/getCroppedImg.d.ts +6 -0
- package/lib/img-crop/getCroppedImg.js +205 -0
- package/lib/img-crop/index.d.ts +53 -0
- package/lib/img-crop/index.js +582 -0
- package/lib/img-crop/style/index.css +52 -0
- package/lib/img-crop/style/index.d.ts +3 -0
- package/lib/img-crop/style/index.js +11 -0
- package/lib/img-crop/style/index.less +54 -0
- package/lib/index.d.ts +34 -2
- package/lib/index.js +160 -9
- package/lib/keep-tab/demo/index.modules.less +66 -0
- package/lib/keep-tab/index.d.ts +29 -0
- package/lib/keep-tab/index.js +181 -0
- package/lib/keep-tab/style/index.css +1129 -0
- package/lib/keep-tab/style/index.d.ts +2 -0
- package/lib/keep-tab/style/index.js +9 -0
- package/lib/keep-tab/style/index.less +2 -0
- package/lib/number-input/index.d.ts +22 -7
- package/lib/number-input/index.js +22 -11
- package/lib/number-input/style/index.d.ts +1 -1
- package/lib/number-input/style/index.js +1 -1
- package/lib/number-input/utils.d.ts +10 -11
- package/lib/number-input/utils.js +8 -8
- package/lib/rc-echart/core.d.ts +32 -0
- package/lib/rc-echart/core.js +185 -0
- package/lib/rc-echart/index.d.ts +21 -0
- package/lib/rc-echart/index.js +75 -0
- package/lib/rc-echart/style/index.d.ts +1 -0
- package/lib/rc-echart/style/index.js +0 -0
- package/lib/rc-motion/demo/CSSMotion.less +91 -0
- package/lib/rc-motion/index.d.ts +2 -0
- package/lib/rc-motion/index.js +43 -0
- package/lib/rc-motion/style/index.d.ts +1 -0
- package/lib/rc-motion/style/index.js +0 -0
- package/lib/rc-qrcode/index.d.ts +20 -0
- package/lib/rc-qrcode/index.js +108 -0
- package/lib/rc-qrcode/style/index.d.ts +1 -0
- package/lib/rc-qrcode/style/index.js +0 -0
- package/lib/rc-qrcode/useQrcode.d.ts +4 -0
- package/lib/rc-qrcode/useQrcode.js +66 -0
- package/lib/rc-transition-group/index.d.ts +2 -0
- package/lib/rc-transition-group/index.js +43 -0
- package/lib/rc-transition-group/style/index.d.ts +1 -0
- package/lib/rc-transition-group/style/index.js +0 -0
- package/lib/single-img-upload/index.d.ts +19 -0
- package/lib/single-img-upload/index.js +250 -0
- package/lib/single-img-upload/style/index.css +74 -0
- package/lib/single-img-upload/style/index.d.ts +3 -0
- package/lib/single-img-upload/style/index.js +11 -0
- package/lib/single-img-upload/style/index.less +85 -0
- package/lib/sortable-hoc/demo/VerticalListBase/index.modules.less +63 -0
- package/lib/sortable-hoc/demo/index.modules.less +248 -0
- package/lib/sortable-hoc/index.d.ts +2 -0
- package/lib/sortable-hoc/index.js +43 -0
- package/lib/sortable-hoc/style/index.d.ts +1 -0
- package/lib/sortable-hoc/style/index.js +0 -0
- package/lib/split-pane/index.d.ts +59 -0
- package/lib/split-pane/index.js +69 -0
- package/lib/split-pane/style/index.css +41 -0
- package/lib/split-pane/style/index.d.ts +1 -0
- package/lib/split-pane/style/index.js +7 -0
- package/lib/split-pane/style/index.less +49 -0
- package/lib/text-area/index.d.ts +12 -0
- package/lib/text-area/index.js +144 -0
- package/lib/text-area/style/index.d.ts +1 -0
- package/lib/text-area/style/index.js +7 -0
- package/lib/text-input/index.d.ts +5 -0
- package/lib/text-input/index.js +99 -0
- package/lib/{number-input → text-input}/style/index.css +0 -3
- package/lib/text-input/style/index.d.ts +1 -0
- package/lib/text-input/style/index.js +7 -0
- package/lib/{number-input → text-input}/style/index.less +0 -4
- package/package.json +20 -3
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
declare type ValueType = string | number;
|
|
2
1
|
export interface NumberInputProps {
|
|
3
|
-
|
|
2
|
+
/** 输入框的内容 */
|
|
3
|
+
value?: string;
|
|
4
|
+
/** 输入数据的类型 */
|
|
4
5
|
numberType?: 'int' | 'float';
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
/** 精度,只对float有效 */
|
|
7
|
+
precision: number;
|
|
8
|
+
/** 指定输入框展示值的格式 */
|
|
9
|
+
formatter?: (value: string) => string;
|
|
10
|
+
/** 指定从 formatter 里转换回数字的方式,和 formatter 搭配使用 */
|
|
11
|
+
parser?: (value: string) => string;
|
|
12
|
+
/** 是否允许输入负数 */
|
|
7
13
|
enableMinus?: boolean;
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
/** 变化回调 */
|
|
15
|
+
onChange?: (value: string) => void;
|
|
16
|
+
/** 失去焦点回调 */
|
|
17
|
+
onBlur?: (value: string) => void;
|
|
10
18
|
}
|
|
11
|
-
declare const NumberInput:
|
|
19
|
+
declare const NumberInput: {
|
|
20
|
+
(props: NumberInputProps): JSX.Element;
|
|
21
|
+
defaultProps: {
|
|
22
|
+
numberType: string;
|
|
23
|
+
precision: number;
|
|
24
|
+
enableMinus: boolean;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
12
27
|
export default NumberInput;
|
package/es/number-input/index.js
CHANGED
|
@@ -55,7 +55,7 @@ var __read = this && this.__read || function (o, n) {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
import * as React from 'react';
|
|
58
|
-
import Input from 'antd/
|
|
58
|
+
import Input from 'antd/es/input';
|
|
59
59
|
import { INT } from './const/numberType';
|
|
60
60
|
import { filterInt, filterFloat } from './utils';
|
|
61
61
|
|
|
@@ -65,15 +65,16 @@ var NumberInput = function NumberInput(props) {
|
|
|
65
65
|
numberType = props.numberType,
|
|
66
66
|
precision = props.precision,
|
|
67
67
|
formatter = props.formatter,
|
|
68
|
+
parser = props.parser,
|
|
68
69
|
enableMinus = props.enableMinus,
|
|
69
70
|
onBlur = props.onBlur,
|
|
70
|
-
restProps = __rest(props, ["value", "onChange", "numberType", "precision", "formatter", "enableMinus", "onBlur"]);
|
|
71
|
+
restProps = __rest(props, ["value", "onChange", "numberType", "precision", "formatter", "parser", "enableMinus", "onBlur"]);
|
|
71
72
|
|
|
72
73
|
var _a = __read(React.useState(''), 2),
|
|
73
74
|
number = _a[0],
|
|
74
75
|
setNumber = _a[1];
|
|
75
76
|
|
|
76
|
-
var resultValue =
|
|
77
|
+
var resultValue = value === undefined ? number : value;
|
|
77
78
|
|
|
78
79
|
var onNumberChange = function onNumberChange(e) {
|
|
79
80
|
var newNumber;
|
|
@@ -94,39 +95,49 @@ var NumberInput = function NumberInput(props) {
|
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
if (
|
|
98
|
-
newNumber =
|
|
98
|
+
if (parser) {
|
|
99
|
+
newNumber = parser(newNumber);
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
if (resultValue !== newNumber) {
|
|
103
|
+
if (value === undefined) {
|
|
104
|
+
setNumber(newNumber);
|
|
105
|
+
}
|
|
106
|
+
|
|
102
107
|
if (onChange) {
|
|
103
108
|
onChange(newNumber);
|
|
104
|
-
} else {
|
|
105
|
-
setNumber(newNumber);
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
};
|
|
109
112
|
|
|
110
113
|
var onNumberBlur = function onNumberBlur() {
|
|
111
114
|
if (resultValue === '-' || resultValue === '.') {
|
|
115
|
+
if (value === undefined) {
|
|
116
|
+
setNumber('');
|
|
117
|
+
}
|
|
118
|
+
|
|
112
119
|
if (onChange) {
|
|
113
120
|
onChange('');
|
|
114
|
-
} else {
|
|
115
|
-
setNumber('');
|
|
116
121
|
}
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
if (onBlur) {
|
|
120
|
-
onBlur(resultValue);
|
|
125
|
+
onBlur(resultValue || '');
|
|
121
126
|
}
|
|
122
127
|
};
|
|
123
128
|
|
|
129
|
+
var inputValue = formatter ? formatter(resultValue) : resultValue;
|
|
124
130
|
return /*#__PURE__*/React.createElement(Input, __assign({
|
|
125
131
|
type: "text",
|
|
126
|
-
value:
|
|
132
|
+
value: inputValue,
|
|
127
133
|
onBlur: onNumberBlur,
|
|
128
134
|
onChange: onNumberChange
|
|
129
135
|
}, restProps));
|
|
130
136
|
};
|
|
131
137
|
|
|
138
|
+
NumberInput.defaultProps = {
|
|
139
|
+
numberType: INT,
|
|
140
|
+
precision: 2,
|
|
141
|
+
enableMinus: false
|
|
142
|
+
};
|
|
132
143
|
export default NumberInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import 'antd/es/input/style';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import 'antd/es/input/style';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
value:
|
|
3
|
-
enableMinus
|
|
4
|
-
preValue:
|
|
5
|
-
}
|
|
6
|
-
export declare const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}) => any;
|
|
1
|
+
export interface FilterIntType {
|
|
2
|
+
value: string;
|
|
3
|
+
enableMinus?: boolean;
|
|
4
|
+
preValue: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const filterInt: ({ value, enableMinus, preValue }: FilterIntType) => string;
|
|
7
|
+
export interface FilterFloatType extends FilterIntType {
|
|
8
|
+
precision: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const filterFloat: ({ value, preValue, precision, enableMinus }: FilterFloatType) => string;
|
package/es/number-input/utils.js
CHANGED
|
@@ -3,13 +3,13 @@ export var filterInt = function filterInt(_a) {
|
|
|
3
3
|
var value = _a.value,
|
|
4
4
|
enableMinus = _a.enableMinus,
|
|
5
5
|
preValue = _a.preValue;
|
|
6
|
-
var nextValue = value.replace(/[
|
|
6
|
+
var nextValue = value.replace(/[^\d\-]/g, '');
|
|
7
7
|
|
|
8
8
|
if (!enableMinus) {
|
|
9
|
-
nextValue = value.replace(/
|
|
9
|
+
nextValue = value.replace(/\D/g, '');
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
var intNumberReg =
|
|
12
|
+
var intNumberReg = /^-?\d+$/;
|
|
13
13
|
|
|
14
14
|
if (nextValue && nextValue.length > 1 && !intNumberReg.test(nextValue)) {
|
|
15
15
|
return preValue;
|
|
@@ -22,18 +22,18 @@ export var filterFloat = function filterFloat(_a) {
|
|
|
22
22
|
preValue = _a.preValue,
|
|
23
23
|
precision = _a.precision,
|
|
24
24
|
enableMinus = _a.enableMinus;
|
|
25
|
-
var nextValue = value.replace(/[
|
|
26
|
-
var matchDecimalPoint = nextValue.match(
|
|
25
|
+
var nextValue = value.replace(/[^\d.\-]/g, '');
|
|
26
|
+
var matchDecimalPoint = nextValue.match(/\./g) || [];
|
|
27
27
|
|
|
28
28
|
if (matchDecimalPoint.length > 1) {
|
|
29
29
|
return preValue;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
if (!enableMinus) {
|
|
33
|
-
nextValue = value.replace(/[
|
|
33
|
+
nextValue = value.replace(/[^\d.]/g, '');
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
var floatNumberReg =
|
|
36
|
+
var floatNumberReg = /^-?\d+\.?\d*$/;
|
|
37
37
|
|
|
38
38
|
if (nextValue && nextValue.length > 1 && !floatNumberReg.test(nextValue)) {
|
|
39
39
|
return preValue;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EChartsOption } from 'echarts';
|
|
3
|
+
export declare type Opts = {
|
|
4
|
+
devicePixelRatio?: number;
|
|
5
|
+
renderer?: 'canvas' | 'svg';
|
|
6
|
+
width?: number | null | undefined | 'auto';
|
|
7
|
+
height?: number | null | undefined | 'auto';
|
|
8
|
+
locale?: string;
|
|
9
|
+
};
|
|
10
|
+
export interface RcEchartPropsType {
|
|
11
|
+
option: EChartsOption;
|
|
12
|
+
notMerge?: boolean;
|
|
13
|
+
lazyUpdate?: boolean;
|
|
14
|
+
echarts: any;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
className?: string;
|
|
17
|
+
theme?: string;
|
|
18
|
+
onEvents?: Record<string, Function>;
|
|
19
|
+
opts?: Opts;
|
|
20
|
+
}
|
|
21
|
+
declare const ReactEchartCore: {
|
|
22
|
+
(props: RcEchartPropsType): JSX.Element;
|
|
23
|
+
defaultProps: {
|
|
24
|
+
notMerge: boolean;
|
|
25
|
+
lazyUpdate: boolean;
|
|
26
|
+
style: {};
|
|
27
|
+
className: string;
|
|
28
|
+
onEvents: {};
|
|
29
|
+
opts: {};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export default ReactEchartCore;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
|
|
6
|
+
for (var p in s) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
/* eslint-disable no-unused-expressions */
|
|
17
|
+
|
|
18
|
+
/* eslint-disable no-restricted-syntax */
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
import React, { useRef, useLayoutEffect } from 'react';
|
|
22
|
+
import useMount from 'ahooks/lib/useMount';
|
|
23
|
+
import useUpdateEffect from 'ahooks/lib/useUpdateEffect';
|
|
24
|
+
import classNames from 'classnames';
|
|
25
|
+
import ResizeObserver from 'resize-observer-polyfill';
|
|
26
|
+
|
|
27
|
+
var ReactEchartCore = function ReactEchartCore(props) {
|
|
28
|
+
var className = props.className,
|
|
29
|
+
option = props.option,
|
|
30
|
+
style = props.style,
|
|
31
|
+
echarts = props.echarts,
|
|
32
|
+
notMerge = props.notMerge,
|
|
33
|
+
lazyUpdate = props.lazyUpdate,
|
|
34
|
+
onEvents = props.onEvents,
|
|
35
|
+
opts = props.opts,
|
|
36
|
+
theme = props.theme;
|
|
37
|
+
var chartDomRef = useRef();
|
|
38
|
+
var chartRef = useRef();
|
|
39
|
+
|
|
40
|
+
var bindEvents = function bindEvents() {
|
|
41
|
+
var bindEventFunc = function bindEventFunc(eventName, func) {
|
|
42
|
+
if (typeof eventName === 'string' && typeof func === 'function') {
|
|
43
|
+
if (chartRef.current) {
|
|
44
|
+
chartRef.current.on(eventName, function (param) {
|
|
45
|
+
func(param, chartRef.current);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
for (var eventName in onEvents) {
|
|
52
|
+
if (Object.prototype.hasOwnProperty.call(onEvents, eventName)) {
|
|
53
|
+
bindEventFunc(eventName, onEvents[eventName]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var initEcharts = function initEcharts() {
|
|
59
|
+
chartRef.current = echarts.init(chartDomRef.current, theme, opts);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var renderEchartDom = function renderEchartDom() {
|
|
63
|
+
if (chartRef.current) {
|
|
64
|
+
chartRef.current.setOption(option, notMerge, lazyUpdate);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var dispose = function dispose() {
|
|
69
|
+
if (chartRef.current) {
|
|
70
|
+
chartRef.current.dispose();
|
|
71
|
+
}
|
|
72
|
+
}; // first add
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
useMount(function () {
|
|
76
|
+
initEcharts();
|
|
77
|
+
renderEchartDom();
|
|
78
|
+
bindEvents();
|
|
79
|
+
}); // need reBuild
|
|
80
|
+
|
|
81
|
+
useUpdateEffect(function () {
|
|
82
|
+
dispose();
|
|
83
|
+
renderEchartDom();
|
|
84
|
+
bindEvents();
|
|
85
|
+
}, [theme, opts, onEvents]); // need setOption
|
|
86
|
+
|
|
87
|
+
useUpdateEffect(function () {
|
|
88
|
+
renderEchartDom();
|
|
89
|
+
}, [option, notMerge, lazyUpdate]); // need resize
|
|
90
|
+
|
|
91
|
+
var resizeChart = function resizeChart() {
|
|
92
|
+
if (chartRef.current) {
|
|
93
|
+
chartRef.current.resize();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
useLayoutEffect(function () {
|
|
98
|
+
var resizeObserver = new ResizeObserver(function () {
|
|
99
|
+
resizeChart();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
if (chartDomRef.current) {
|
|
103
|
+
resizeObserver.observe(chartDomRef.current);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return function () {
|
|
107
|
+
resizeObserver.disconnect();
|
|
108
|
+
};
|
|
109
|
+
}, []);
|
|
110
|
+
useUpdateEffect(function () {
|
|
111
|
+
resizeChart();
|
|
112
|
+
}, [style, className]);
|
|
113
|
+
|
|
114
|
+
var finallyStyle = __assign({
|
|
115
|
+
width: '100%',
|
|
116
|
+
height: '100%'
|
|
117
|
+
}, style);
|
|
118
|
+
|
|
119
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
120
|
+
ref: function ref(node) {
|
|
121
|
+
chartDomRef.current = node;
|
|
122
|
+
},
|
|
123
|
+
style: finallyStyle,
|
|
124
|
+
className: classNames('react-echart', className)
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
ReactEchartCore.defaultProps = {
|
|
129
|
+
notMerge: false,
|
|
130
|
+
lazyUpdate: false,
|
|
131
|
+
style: {},
|
|
132
|
+
className: '',
|
|
133
|
+
onEvents: {},
|
|
134
|
+
opts: {}
|
|
135
|
+
};
|
|
136
|
+
export default ReactEchartCore;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as echarts from 'echarts';
|
|
3
|
+
export declare type Opts = {
|
|
4
|
+
devicePixelRatio?: number;
|
|
5
|
+
renderer?: 'canvas' | 'svg';
|
|
6
|
+
width?: number | null | undefined | 'auto';
|
|
7
|
+
height?: number | null | undefined | 'auto';
|
|
8
|
+
locale?: string;
|
|
9
|
+
};
|
|
10
|
+
export interface RcEchartPropsType {
|
|
11
|
+
option: echarts.EChartsOption;
|
|
12
|
+
notMerge?: boolean;
|
|
13
|
+
lazyUpdate?: boolean;
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
className?: string;
|
|
16
|
+
theme?: string;
|
|
17
|
+
onEvents?: Record<string, Function>;
|
|
18
|
+
opts?: Opts;
|
|
19
|
+
}
|
|
20
|
+
declare const RcEcharts: (props: RcEchartPropsType) => JSX.Element;
|
|
21
|
+
export default RcEcharts;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
|
|
6
|
+
for (var p in s) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import * as echarts from 'echarts';
|
|
19
|
+
import RcEchartCore from './core';
|
|
20
|
+
|
|
21
|
+
var RcEcharts = function RcEcharts(props) {
|
|
22
|
+
return /*#__PURE__*/React.createElement(RcEchartCore, __assign({
|
|
23
|
+
echarts: echarts
|
|
24
|
+
}, props));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default RcEcharts;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
.grid {
|
|
2
|
+
display: table;
|
|
3
|
+
|
|
4
|
+
> div {
|
|
5
|
+
display: table-cell;
|
|
6
|
+
min-width: 350px;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.demo-block {
|
|
11
|
+
display: block;
|
|
12
|
+
height: 300px;
|
|
13
|
+
width: 300px;
|
|
14
|
+
background: red;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.transition {
|
|
19
|
+
transition: height 1.3s, opacity 1.3s;
|
|
20
|
+
// transition: all 5s!important;
|
|
21
|
+
|
|
22
|
+
&.transition-appear,
|
|
23
|
+
&.transition-enter {
|
|
24
|
+
opacity: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.transition-appear.transition-appear-active,
|
|
28
|
+
&.transition-enter.transition-enter-active {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.transition-leave-active {
|
|
33
|
+
opacity: 0;
|
|
34
|
+
background: green;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.animation {
|
|
39
|
+
animation-duration: 1.3s;
|
|
40
|
+
animation-fill-mode: both;
|
|
41
|
+
|
|
42
|
+
&.animation-appear,
|
|
43
|
+
&.animation-enter {
|
|
44
|
+
animation-name: enter;
|
|
45
|
+
animation-fill-mode: both;
|
|
46
|
+
animation-play-state: paused;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.animation-appear.animation-appear-active,
|
|
50
|
+
&.animation-enter.animation-enter-active {
|
|
51
|
+
animation-name: enter;
|
|
52
|
+
animation-play-state: running;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.animation-leave {
|
|
56
|
+
animation-name: leave;
|
|
57
|
+
animation-fill-mode: both;
|
|
58
|
+
animation-play-state: paused;
|
|
59
|
+
|
|
60
|
+
&.animation-leave-active {
|
|
61
|
+
animation-name: leave;
|
|
62
|
+
animation-play-state: running;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.hidden {
|
|
68
|
+
display: none !important;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@keyframes enter {
|
|
72
|
+
from {
|
|
73
|
+
transform: scale(0);
|
|
74
|
+
opacity: 0;
|
|
75
|
+
}
|
|
76
|
+
to {
|
|
77
|
+
transform: scale(1);
|
|
78
|
+
opacity: 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@keyframes leave {
|
|
83
|
+
from {
|
|
84
|
+
transform: scale(1);
|
|
85
|
+
opacity: 1;
|
|
86
|
+
}
|
|
87
|
+
to {
|
|
88
|
+
transform: scale(0);
|
|
89
|
+
opacity: 0;
|
|
90
|
+
}
|
|
91
|
+
}
|