dtable-ui-component 6.0.24-beta1 → 6.0.25
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/lib/ActionSheet/index.js +194 -0
- package/lib/ActionSheet/style/index.css +365 -0
- package/lib/ActivityIndicator/index.css +108 -0
- package/lib/ActivityIndicator/index.js +76 -0
- package/lib/Badge/index.css +96 -0
- package/lib/Badge/index.js +65 -0
- package/lib/DateEditor/mb-date-editor-popover/index.js +3 -3
- package/lib/DatePicker/index.js +120 -0
- package/lib/DatePicker/locale/en_US.js +14 -0
- package/lib/DatePicker/locale/ru_RU.js +14 -0
- package/lib/DatePicker/locale/sv_SE.js +14 -0
- package/lib/DatePicker/locale/zh_CN.js +14 -0
- package/lib/DatePicker/style/index.css +290 -0
- package/lib/DatePicker/utils.js +36 -0
- package/lib/Drawer/index.css +142 -0
- package/lib/Drawer/index.js +21 -0
- package/lib/Icon/index.css +50 -0
- package/lib/Icon/index.js +34 -0
- package/lib/Icon/load-sprite.js +56 -0
- package/lib/InputItem/custom-input.js +321 -0
- package/lib/InputItem/custom-keyboard.js +162 -0
- package/lib/InputItem/index.js +388 -0
- package/lib/InputItem/input.js +45 -0
- package/lib/InputItem/locale/en_US.js +12 -0
- package/lib/InputItem/locale/ru_RU.js +12 -0
- package/lib/InputItem/locale/sv_SE.js +12 -0
- package/lib/InputItem/locale/zh_CN.js +12 -0
- package/lib/InputItem/portal.js +23 -0
- package/lib/InputItem/style/index.css +512 -0
- package/lib/List/index.css +381 -0
- package/lib/List/index.js +41 -0
- package/lib/List/list-item.js +169 -0
- package/lib/Modal/alert.js +82 -0
- package/lib/Modal/index.js +15 -0
- package/lib/Modal/modal.js +118 -0
- package/lib/Modal/operation.js +77 -0
- package/lib/Modal/prompt.js +207 -0
- package/lib/Picker/AbstractPicker.js +190 -0
- package/lib/Picker/index.js +28 -0
- package/lib/Picker/locale/en_US.js +12 -0
- package/lib/Picker/locale/ru_RU.js +12 -0
- package/lib/Picker/locale/sv_SE.js +12 -0
- package/lib/Picker/locale/zh_CN.js +12 -0
- package/lib/Picker/popupProps.js +12 -0
- package/lib/Picker/style/index.css +141 -0
- package/lib/Popover/index.js +62 -0
- package/lib/Popover/item.js +55 -0
- package/lib/Popover/style/index.css +229 -0
- package/lib/Progress/index.css +22 -0
- package/lib/Progress/index.js +65 -0
- package/lib/Radio/Radio.js +47 -0
- package/lib/Radio/RadioItem.js +57 -0
- package/lib/Radio/index.css +90 -0
- package/lib/Radio/index.js +12 -0
- package/lib/TabBar/Tab.js +76 -0
- package/lib/TabBar/index.css +138 -0
- package/lib/TabBar/index.js +128 -0
- package/lib/Tabs/index.css +443 -0
- package/lib/Tabs/index.js +38 -0
- package/lib/TextareaItem/index.css +231 -0
- package/lib/TextareaItem/index.js +231 -0
- package/lib/Toast/index.css +65 -0
- package/lib/Toast/index.js +131 -0
- package/lib/_util/class.js +34 -0
- package/lib/_util/closest.js +17 -0
- package/lib/_util/exenv.js +8 -0
- package/lib/_util/getDataAttr.js +15 -0
- package/lib/_util/getLocale.js +42 -0
- package/lib/index.js +103 -5
- package/lib/utils/utils.js +2 -3
- package/package.json +12 -3
- package/lib/BodyPortal/index.js +0 -29
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _rmcFeedback = _interopRequireDefault(require("rmc-feedback"));
|
|
12
|
+
var _exenv = require("../_util/exenv");
|
|
13
|
+
require("./index.css");
|
|
14
|
+
/* tslint:disable:jsx-no-multiline-js */
|
|
15
|
+
|
|
16
|
+
function noop() {}
|
|
17
|
+
function fixControlledValue(value) {
|
|
18
|
+
if (typeof value === 'undefined' || value === null) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
const regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]|\n/g;
|
|
24
|
+
function countSymbols() {
|
|
25
|
+
let text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
26
|
+
return text.replace(regexAstralSymbols, '_').length;
|
|
27
|
+
}
|
|
28
|
+
class TextareaItem extends React.Component {
|
|
29
|
+
constructor(props) {
|
|
30
|
+
super(props);
|
|
31
|
+
this.focus = () => {
|
|
32
|
+
this.textareaRef.focus();
|
|
33
|
+
};
|
|
34
|
+
this.reAlignHeight = () => {
|
|
35
|
+
const textareaDom = this.textareaRef;
|
|
36
|
+
textareaDom.style.height = ''; // 字数减少时能自动减小高度
|
|
37
|
+
textareaDom.style.height = "".concat(textareaDom.scrollHeight, "px");
|
|
38
|
+
};
|
|
39
|
+
this.onChange = e => {
|
|
40
|
+
const value = e.target.value;
|
|
41
|
+
if ('value' in this.props) {
|
|
42
|
+
this.setState({
|
|
43
|
+
value: this.props.value
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
this.setState({
|
|
47
|
+
value
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const {
|
|
51
|
+
onChange
|
|
52
|
+
} = this.props;
|
|
53
|
+
if (onChange) {
|
|
54
|
+
onChange(value);
|
|
55
|
+
}
|
|
56
|
+
// 设置 defaultValue 时,用户输入不会触发 componentDidUpdate ,此处手工调用
|
|
57
|
+
this.componentDidUpdate();
|
|
58
|
+
};
|
|
59
|
+
this.onBlur = e => {
|
|
60
|
+
this.debounceTimeout = setTimeout(() => {
|
|
61
|
+
if (document.activeElement !== this.textareaRef) {
|
|
62
|
+
this.setState({
|
|
63
|
+
focus: false
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}, 100);
|
|
67
|
+
const value = e.currentTarget.value;
|
|
68
|
+
if (this.props.onBlur) {
|
|
69
|
+
// fix autoFocus item blur with flash
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
// fix ios12 wechat browser click failure after input
|
|
72
|
+
if (document.body) {
|
|
73
|
+
// eslint-disable-next-line no-self-assign
|
|
74
|
+
document.body.scrollTop = document.body.scrollTop;
|
|
75
|
+
}
|
|
76
|
+
}, 100);
|
|
77
|
+
this.props.onBlur(value);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
this.onFocus = e => {
|
|
81
|
+
if (this.debounceTimeout) {
|
|
82
|
+
clearTimeout(this.debounceTimeout);
|
|
83
|
+
this.debounceTimeout = null;
|
|
84
|
+
}
|
|
85
|
+
this.setState({
|
|
86
|
+
focus: true
|
|
87
|
+
});
|
|
88
|
+
const value = e.currentTarget.value;
|
|
89
|
+
if (this.props.onFocus) {
|
|
90
|
+
this.props.onFocus(value);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
this.onErrorClick = () => {
|
|
94
|
+
if (this.props.onErrorClick) {
|
|
95
|
+
this.props.onErrorClick();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
this.clearInput = () => {
|
|
99
|
+
this.setState({
|
|
100
|
+
value: ''
|
|
101
|
+
});
|
|
102
|
+
if (this.props.onChange) {
|
|
103
|
+
this.props.onChange('');
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
this.state = {
|
|
107
|
+
focus: false,
|
|
108
|
+
value: props.value || props.defaultValue || ''
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
componentWillReceiveProps(nextProps) {
|
|
112
|
+
if ('value' in nextProps) {
|
|
113
|
+
this.setState({
|
|
114
|
+
value: fixControlledValue(nextProps.value)
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
componentDidMount() {
|
|
119
|
+
if (this.props.autoHeight) {
|
|
120
|
+
this.reAlignHeight();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
componentDidUpdate() {
|
|
124
|
+
if (this.props.autoHeight) {
|
|
125
|
+
this.reAlignHeight();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
componentWillUnmount() {
|
|
129
|
+
if (this.debounceTimeout) {
|
|
130
|
+
clearTimeout(this.debounceTimeout);
|
|
131
|
+
this.debounceTimeout = null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
render() {
|
|
135
|
+
const {
|
|
136
|
+
prefixCls,
|
|
137
|
+
prefixListCls,
|
|
138
|
+
editable,
|
|
139
|
+
style,
|
|
140
|
+
clear,
|
|
141
|
+
children,
|
|
142
|
+
error,
|
|
143
|
+
className,
|
|
144
|
+
count,
|
|
145
|
+
labelNumber,
|
|
146
|
+
title,
|
|
147
|
+
onErrorClick,
|
|
148
|
+
autoHeight,
|
|
149
|
+
defaultValue,
|
|
150
|
+
...otherProps
|
|
151
|
+
} = this.props;
|
|
152
|
+
const {
|
|
153
|
+
disabled
|
|
154
|
+
} = otherProps;
|
|
155
|
+
const {
|
|
156
|
+
value,
|
|
157
|
+
focus
|
|
158
|
+
} = this.state;
|
|
159
|
+
const hasCount = count > 0 && this.props.rows > 1;
|
|
160
|
+
const wrapCls = (0, _classnames.default)(className, "".concat(prefixListCls, "-item"), "".concat(prefixCls, "-item"), {
|
|
161
|
+
["".concat(prefixCls, "-disabled")]: disabled,
|
|
162
|
+
["".concat(prefixCls, "-item-single-line")]: this.props.rows === 1 && !autoHeight,
|
|
163
|
+
["".concat(prefixCls, "-error")]: error,
|
|
164
|
+
["".concat(prefixCls, "-focus")]: focus,
|
|
165
|
+
["".concat(prefixCls, "-has-count")]: hasCount
|
|
166
|
+
});
|
|
167
|
+
const labelCls = (0, _classnames.default)("".concat(prefixCls, "-label"), {
|
|
168
|
+
["".concat(prefixCls, "-label-2")]: labelNumber === 2,
|
|
169
|
+
["".concat(prefixCls, "-label-3")]: labelNumber === 3,
|
|
170
|
+
["".concat(prefixCls, "-label-4")]: labelNumber === 4,
|
|
171
|
+
["".concat(prefixCls, "-label-5")]: labelNumber === 5,
|
|
172
|
+
["".concat(prefixCls, "-label-6")]: labelNumber === 6,
|
|
173
|
+
["".concat(prefixCls, "-label-7")]: labelNumber === 7
|
|
174
|
+
});
|
|
175
|
+
const characterLength = countSymbols(value);
|
|
176
|
+
const lengthCtrlProps = {};
|
|
177
|
+
if (count > 0) {
|
|
178
|
+
// Note: If in the iOS environment of dev-tools, It will fail.
|
|
179
|
+
if (_exenv.IS_IOS) {
|
|
180
|
+
const entValue = value ? value.replace(regexAstralSymbols, '_') : '';
|
|
181
|
+
const entLen = entValue ? entValue.split('_').length - 1 : 0;
|
|
182
|
+
lengthCtrlProps.maxLength = count + entLen - characterLength + (value ? value.length : 0);
|
|
183
|
+
} else {
|
|
184
|
+
lengthCtrlProps.maxLength = count - characterLength + (value ? value.length : 0);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
188
|
+
className: wrapCls
|
|
189
|
+
}, title && /*#__PURE__*/React.createElement("div", {
|
|
190
|
+
className: labelCls
|
|
191
|
+
}, title), /*#__PURE__*/React.createElement("div", {
|
|
192
|
+
className: "".concat(prefixCls, "-control")
|
|
193
|
+
}, /*#__PURE__*/React.createElement("textarea", Object.assign({
|
|
194
|
+
ref: el => this.textareaRef = el
|
|
195
|
+
}, lengthCtrlProps, otherProps, {
|
|
196
|
+
value: value,
|
|
197
|
+
onChange: this.onChange,
|
|
198
|
+
onBlur: this.onBlur,
|
|
199
|
+
onFocus: this.onFocus,
|
|
200
|
+
readOnly: !editable,
|
|
201
|
+
style: style
|
|
202
|
+
}))), clear && editable && value && characterLength > 0 && /*#__PURE__*/React.createElement(_rmcFeedback.default, {
|
|
203
|
+
activeClassName: "".concat(prefixCls, "-clear-active")
|
|
204
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
205
|
+
className: "".concat(prefixCls, "-clear"),
|
|
206
|
+
onClick: this.clearInput
|
|
207
|
+
})), error && /*#__PURE__*/React.createElement("div", {
|
|
208
|
+
className: "".concat(prefixCls, "-error-extra"),
|
|
209
|
+
onClick: this.onErrorClick
|
|
210
|
+
}), hasCount && /*#__PURE__*/React.createElement("span", {
|
|
211
|
+
className: "".concat(prefixCls, "-count")
|
|
212
|
+
}, /*#__PURE__*/React.createElement("span", null, value ? characterLength : 0), "/", count));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
exports.default = TextareaItem;
|
|
216
|
+
TextareaItem.defaultProps = {
|
|
217
|
+
prefixCls: 'am-textarea',
|
|
218
|
+
prefixListCls: 'am-list',
|
|
219
|
+
autoHeight: false,
|
|
220
|
+
editable: true,
|
|
221
|
+
disabled: false,
|
|
222
|
+
placeholder: '',
|
|
223
|
+
clear: false,
|
|
224
|
+
rows: 1,
|
|
225
|
+
onChange: noop,
|
|
226
|
+
onBlur: noop,
|
|
227
|
+
onFocus: noop,
|
|
228
|
+
onErrorClick: noop,
|
|
229
|
+
error: false,
|
|
230
|
+
labelNumber: 5
|
|
231
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.am-toast {
|
|
2
|
+
position: fixed;
|
|
3
|
+
width: 100%;
|
|
4
|
+
z-index: 1999;
|
|
5
|
+
font-size: 14px;
|
|
6
|
+
text-align: center;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.am-toast>span {
|
|
10
|
+
max-width: 50%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.am-toast.am-toast-mask {
|
|
14
|
+
height: 100%;
|
|
15
|
+
display: -webkit-box;
|
|
16
|
+
display: -webkit-flex;
|
|
17
|
+
display: -ms-flexbox;
|
|
18
|
+
display: flex;
|
|
19
|
+
-webkit-box-pack: center;
|
|
20
|
+
-webkit-justify-content: center;
|
|
21
|
+
-ms-flex-pack: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
-webkit-box-align: center;
|
|
24
|
+
-webkit-align-items: center;
|
|
25
|
+
-ms-flex-align: center;
|
|
26
|
+
align-items: center;
|
|
27
|
+
left: 0;
|
|
28
|
+
top: 0;
|
|
29
|
+
-webkit-transform: translateZ(1px);
|
|
30
|
+
transform: translateZ(1px);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.am-toast.am-toast-nomask {
|
|
34
|
+
position: fixed;
|
|
35
|
+
max-width: 50%;
|
|
36
|
+
width: auto;
|
|
37
|
+
left: 50%;
|
|
38
|
+
top: 50%;
|
|
39
|
+
-webkit-transform: translateZ(1px);
|
|
40
|
+
transform: translateZ(1px);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.am-toast.am-toast-nomask .am-toast-notice {
|
|
44
|
+
-webkit-transform: translateX(-50%) translateY(-50%);
|
|
45
|
+
-ms-transform: translateX(-50%) translateY(-50%);
|
|
46
|
+
transform: translateX(-50%) translateY(-50%);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.am-toast-notice-content .am-toast-text {
|
|
50
|
+
min-width: 60px;
|
|
51
|
+
border-radius: 3px;
|
|
52
|
+
color: #fff;
|
|
53
|
+
background-color: rgba(58, 58, 58, 0.9);
|
|
54
|
+
line-height: 1.5;
|
|
55
|
+
padding: 9px 15px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.am-toast-notice-content .am-toast-text.am-toast-text-icon {
|
|
59
|
+
border-radius: 5px;
|
|
60
|
+
padding: 15px 15px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.am-toast-notice-content .am-toast-text.am-toast-text-icon .am-toast-text-info {
|
|
64
|
+
margin-top: 6px;
|
|
65
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _rmcNotification = _interopRequireDefault(require("rmc-notification"));
|
|
12
|
+
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
13
|
+
require("./index.css");
|
|
14
|
+
const SHORT = 3;
|
|
15
|
+
const config = {
|
|
16
|
+
duration: SHORT,
|
|
17
|
+
mask: true
|
|
18
|
+
};
|
|
19
|
+
let messageInstance;
|
|
20
|
+
let messageNeedHide;
|
|
21
|
+
const prefixCls = 'am-toast';
|
|
22
|
+
function getMessageInstance(mask, callback) {
|
|
23
|
+
_rmcNotification.default.newInstance({
|
|
24
|
+
prefixCls,
|
|
25
|
+
style: {},
|
|
26
|
+
// clear rmc-notification default style
|
|
27
|
+
transitionName: 'am-fade',
|
|
28
|
+
className: (0, _classnames.default)({
|
|
29
|
+
["".concat(prefixCls, "-mask")]: mask,
|
|
30
|
+
["".concat(prefixCls, "-nomask")]: !mask
|
|
31
|
+
})
|
|
32
|
+
}, notification => callback && callback(notification));
|
|
33
|
+
}
|
|
34
|
+
function notice(content, type) {
|
|
35
|
+
let duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : config.duration;
|
|
36
|
+
let onClose = arguments.length > 3 ? arguments[3] : undefined;
|
|
37
|
+
let mask = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : config.mask;
|
|
38
|
+
const iconTypes = {
|
|
39
|
+
info: '',
|
|
40
|
+
success: 'success',
|
|
41
|
+
fail: 'fail',
|
|
42
|
+
offline: 'dislike',
|
|
43
|
+
loading: 'loading'
|
|
44
|
+
};
|
|
45
|
+
const iconType = iconTypes[type];
|
|
46
|
+
messageNeedHide = false;
|
|
47
|
+
getMessageInstance(mask, notification => {
|
|
48
|
+
if (!notification) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (messageInstance) {
|
|
52
|
+
messageInstance.destroy();
|
|
53
|
+
messageInstance = null;
|
|
54
|
+
}
|
|
55
|
+
if (messageNeedHide) {
|
|
56
|
+
notification.destroy();
|
|
57
|
+
messageNeedHide = false;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
messageInstance = notification;
|
|
61
|
+
notification.notice({
|
|
62
|
+
duration,
|
|
63
|
+
style: {},
|
|
64
|
+
content: iconType ? /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
className: "".concat(prefixCls, "-text ").concat(prefixCls, "-text-icon"),
|
|
66
|
+
role: "alert",
|
|
67
|
+
"aria-live": "assertive"
|
|
68
|
+
}, /*#__PURE__*/React.createElement(_Icon.default, {
|
|
69
|
+
type: iconType,
|
|
70
|
+
size: "lg"
|
|
71
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
className: "".concat(prefixCls, "-text-info")
|
|
73
|
+
}, content)) : /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: "".concat(prefixCls, "-text"),
|
|
75
|
+
role: "alert",
|
|
76
|
+
"aria-live": "assertive"
|
|
77
|
+
}, /*#__PURE__*/React.createElement("div", null, content)),
|
|
78
|
+
closable: true,
|
|
79
|
+
onClose() {
|
|
80
|
+
if (onClose) {
|
|
81
|
+
onClose();
|
|
82
|
+
}
|
|
83
|
+
notification.destroy();
|
|
84
|
+
notification = null;
|
|
85
|
+
messageInstance = null;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const Toast = {
|
|
91
|
+
SHORT,
|
|
92
|
+
LONG: 8,
|
|
93
|
+
show(content, duration, mask) {
|
|
94
|
+
return notice(content, 'info', duration, () => {}, mask);
|
|
95
|
+
},
|
|
96
|
+
info(content, duration, onClose, mask) {
|
|
97
|
+
return notice(content, 'info', duration, onClose, mask);
|
|
98
|
+
},
|
|
99
|
+
success(content, duration, onClose, mask) {
|
|
100
|
+
return notice(content, 'success', duration, onClose, mask);
|
|
101
|
+
},
|
|
102
|
+
fail(content, duration, onClose, mask) {
|
|
103
|
+
return notice(content, 'fail', duration, onClose, mask);
|
|
104
|
+
},
|
|
105
|
+
offline(content, duration, onClose, mask) {
|
|
106
|
+
return notice(content, 'offline', duration, onClose, mask);
|
|
107
|
+
},
|
|
108
|
+
loading(content, duration, onClose, mask) {
|
|
109
|
+
return notice(content, 'loading', duration, onClose, mask);
|
|
110
|
+
},
|
|
111
|
+
hide() {
|
|
112
|
+
if (messageInstance) {
|
|
113
|
+
messageInstance.destroy();
|
|
114
|
+
messageInstance = null;
|
|
115
|
+
} else {
|
|
116
|
+
messageNeedHide = true;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
config() {
|
|
120
|
+
let conf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
121
|
+
const {
|
|
122
|
+
duration = SHORT,
|
|
123
|
+
mask
|
|
124
|
+
} = conf;
|
|
125
|
+
config.duration = duration;
|
|
126
|
+
if (mask === false) {
|
|
127
|
+
config.mask = false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var _default = exports.default = Toast;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.addClass = addClass;
|
|
7
|
+
exports.hasClass = hasClass;
|
|
8
|
+
exports.removeClass = removeClass;
|
|
9
|
+
function hasClass(node, className) {
|
|
10
|
+
if (node.classList) {
|
|
11
|
+
return node.classList.contains(className);
|
|
12
|
+
}
|
|
13
|
+
const originClass = node.className;
|
|
14
|
+
return " ".concat(originClass, " ").indexOf(" ".concat(className, " ")) > -1;
|
|
15
|
+
}
|
|
16
|
+
function addClass(node, className) {
|
|
17
|
+
if (node.classList) {
|
|
18
|
+
node.classList.add(className);
|
|
19
|
+
} else {
|
|
20
|
+
if (!hasClass(node, className)) {
|
|
21
|
+
node.className = "".concat(node.className, " ").concat(className);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function removeClass(node, className) {
|
|
26
|
+
if (node.classList) {
|
|
27
|
+
node.classList.remove(className);
|
|
28
|
+
} else {
|
|
29
|
+
if (hasClass(node, className)) {
|
|
30
|
+
const originClass = node.className;
|
|
31
|
+
node.className = " ".concat(originClass, " ").replace(" ".concat(className, " "), '');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = closest;
|
|
7
|
+
function closest(el, selector) {
|
|
8
|
+
const matchesSelector = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector;
|
|
9
|
+
let p = el;
|
|
10
|
+
while (p) {
|
|
11
|
+
if (matchesSelector.call(p, selector)) {
|
|
12
|
+
return p;
|
|
13
|
+
}
|
|
14
|
+
p = p.parentElement;
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.canUseDOM = exports.IS_IOS = void 0;
|
|
7
|
+
const canUseDOM = exports.canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
8
|
+
const IS_IOS = exports.IS_IOS = canUseDOM && /iphone|ipad|ipod/i.test(window.navigator.userAgent);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const getDataAttr = props => {
|
|
8
|
+
return Object.keys(props).reduce((prev, key) => {
|
|
9
|
+
if (key.substr(0, 5) === 'aria-' || key.substr(0, 5) === 'data-' || key === 'role') {
|
|
10
|
+
prev[key] = props[key];
|
|
11
|
+
}
|
|
12
|
+
return prev;
|
|
13
|
+
}, {});
|
|
14
|
+
};
|
|
15
|
+
var _default = exports.default = getDataAttr;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getComponentLocale = getComponentLocale;
|
|
7
|
+
exports.getLocaleCode = getLocaleCode;
|
|
8
|
+
function getComponentLocale(props, context, componentName, getDefaultLocale) {
|
|
9
|
+
let locale = {};
|
|
10
|
+
if (context && context.antLocale && context.antLocale[componentName]) {
|
|
11
|
+
locale = context.antLocale[componentName];
|
|
12
|
+
} else {
|
|
13
|
+
const defaultLocale = getDefaultLocale();
|
|
14
|
+
// TODO: make default lang of antd be English
|
|
15
|
+
// https://github.com/ant-design/ant-design/issues/6334
|
|
16
|
+
locale = defaultLocale.default || defaultLocale;
|
|
17
|
+
}
|
|
18
|
+
let result = {
|
|
19
|
+
...locale
|
|
20
|
+
};
|
|
21
|
+
if (props.locale) {
|
|
22
|
+
result = {
|
|
23
|
+
...result,
|
|
24
|
+
...props.locale
|
|
25
|
+
};
|
|
26
|
+
if (props.locale.lang) {
|
|
27
|
+
result.lang = {
|
|
28
|
+
...locale.lang,
|
|
29
|
+
...props.locale.lang
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
function getLocaleCode(context) {
|
|
36
|
+
const localeCode = context.antLocale && context.antLocale.locale;
|
|
37
|
+
// Had use LocaleProvide but didn't set locale
|
|
38
|
+
if (context.antLocale && context.antLocale.exist && !localeCode) {
|
|
39
|
+
return 'zh-cn';
|
|
40
|
+
}
|
|
41
|
+
return localeCode;
|
|
42
|
+
}
|