@nutui/nutui-react 1.3.5 → 1.3.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/CHANGELOG.md +7 -0
- package/dist/esm/ActionSheet.js +15 -25
- package/dist/esm/Address.js +151 -221
- package/dist/esm/AnimatingNumbers.js +7 -31
- package/dist/esm/Audio.js +31 -66
- package/dist/esm/Avatar.js +25 -51
- package/dist/esm/AvatarGroup.js +2 -9
- package/dist/esm/BackTop.js +29 -55
- package/dist/esm/Badge.js +9 -20
- package/dist/esm/Barrage.js +8 -20
- package/dist/esm/Button.js +22 -37
- package/dist/esm/Calendar.js +23 -37
- package/dist/esm/CalendarItem.js +86 -186
- package/dist/esm/Card.js +14 -20
- package/dist/esm/Cascader.js +77 -197
- package/dist/esm/Cell.js +20 -30
- package/dist/esm/CellGroup.js +6 -12
- package/dist/esm/Checkbox.js +27 -48
- package/dist/esm/CheckboxGroup.js +12 -30
- package/dist/esm/CircleProgress.js +11 -28
- package/dist/esm/Col.js +11 -22
- package/dist/esm/Collapse.js +11 -27
- package/dist/esm/CollapseItem.js +33 -47
- package/dist/esm/ConfigProvider.js +4 -15
- package/dist/esm/CountDown.js +37 -74
- package/dist/esm/DatePicker.js +44 -106
- package/dist/esm/Dialog.js +31 -89
- package/dist/esm/Divider.js +8 -15
- package/dist/esm/Drag.js +30 -45
- package/dist/esm/Elevator.js +37 -74
- package/dist/esm/Empty.js +11 -24
- package/dist/esm/FixedNav.js +18 -29
- package/dist/esm/Grid.js +13 -28
- package/dist/esm/GridItem.js +18 -34
- package/dist/esm/ImagePreview.js +36 -71
- package/dist/esm/Indicator.js +9 -20
- package/dist/esm/Infiniteloading.js +26 -55
- package/dist/esm/Input.js +62 -106
- package/dist/esm/InputNumber.js +25 -52
- package/dist/esm/Layout.js +0 -6
- package/dist/esm/Menu.js +24 -46
- package/dist/esm/MenuItem.js +29 -52
- package/dist/esm/NavBar.js +18 -34
- package/dist/esm/NoticeBar.js +54 -102
- package/dist/esm/Notify.js +9 -38
- package/dist/esm/NumberKeyboard.js +21 -52
- package/dist/esm/Pagination.js +38 -71
- package/dist/esm/Picker.js +91 -178
- package/dist/esm/Popover.js +32 -72
- package/dist/esm/Popup.js +40 -72
- package/dist/esm/Price.js +7 -24
- package/dist/esm/Progress.js +35 -50
- package/dist/esm/PullToRefresh.js +28 -83
- package/dist/esm/Radio.js +24 -47
- package/dist/esm/RadioGroup.js +14 -24
- package/dist/esm/Range.js +44 -116
- package/dist/esm/Rate.js +21 -39
- package/dist/esm/Row.js +7 -16
- package/dist/esm/SearchBar.js +47 -68
- package/dist/esm/ShortPassword.js +29 -56
- package/dist/esm/SideNavBar.js +9 -16
- package/dist/esm/SideNavBarItem.js +4 -11
- package/dist/esm/Signature.js +13 -43
- package/dist/esm/Skeleton.js +13 -23
- package/dist/esm/Step.js +12 -28
- package/dist/esm/Steps.js +6 -14
- package/dist/esm/Sticky.js +24 -52
- package/dist/esm/SubSideNavBar.js +7 -22
- package/dist/esm/Swipe.js +15 -54
- package/dist/esm/Swiper.js +102 -186
- package/dist/esm/SwiperItem.js +2 -12
- package/dist/esm/Switch.js +13 -27
- package/dist/esm/Tabbar.js +13 -25
- package/dist/esm/TabbarItem.js +15 -23
- package/dist/esm/Table.js +19 -39
- package/dist/esm/Tag.js +19 -36
- package/dist/esm/TextArea.js +19 -43
- package/dist/esm/TimeDetail.js +15 -28
- package/dist/esm/TimePannel.js +5 -12
- package/dist/esm/TimeSelect.js +35 -59
- package/dist/esm/Toast.js +16 -49
- package/dist/esm/Uploader.js +57 -152
- package/dist/esm/Video.js +8 -19
- package/dist/esm/VirtualList.js +84 -118
- package/dist/esm/date-710f8c7c.js +9 -33
- package/dist/esm/get-scroll-parent-3dcd3f53.js +1 -9
- package/dist/esm/icon-8dc4de10.js +11 -21
- package/dist/esm/offsetContext-0e3d04b3.js +0 -3
- package/dist/esm/overlay-ed3eb37d.js +12 -23
- package/dist/esm/render-18227751.js +0 -11
- package/dist/esm/tabpane-c957ab14.js +4 -10
- package/dist/esm/tabs-0896a61b.js +28 -56
- package/dist/esm/types/src/packages/elevator/demo.d.ts +1 -0
- package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +2 -0
- package/dist/esm/useClientRect-839d18c5.js +0 -5
- package/dist/esm/useTouch-a2ea68c6.js +27 -47
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/nutui.react.es.js +424 -406
- package/dist/nutui.react.umd.js +416 -398
- package/dist/packages/searchbar/searchbar.scss +20 -3
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/esm/TimeDetail.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
-
|
|
6
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
-
|
|
8
5
|
import React__default, { useState, useEffect } from 'react';
|
|
9
6
|
import { c as cn } from './bem-893ad28d.js';
|
|
10
7
|
import { useConfig } from './ConfigProvider.js';
|
|
@@ -18,52 +15,43 @@ var defaultProps = {
|
|
|
18
15
|
return null;
|
|
19
16
|
}
|
|
20
17
|
};
|
|
21
|
-
|
|
22
18
|
var TimeDetail = function TimeDetail(props) {
|
|
23
19
|
useConfig();
|
|
24
|
-
|
|
25
20
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
children = _defaultProps$props.children,
|
|
22
|
+
times = _defaultProps$props.times,
|
|
23
|
+
className = _defaultProps$props.className,
|
|
24
|
+
currentKey = _defaultProps$props.currentKey,
|
|
25
|
+
currentTime = _defaultProps$props.currentTime,
|
|
26
|
+
select = _defaultProps$props.select;
|
|
33
27
|
var b = cn('timedetail');
|
|
34
|
-
|
|
35
28
|
var _useState = useState([]),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
renderData = _useState2[0],
|
|
31
|
+
setRenderData = _useState2[1];
|
|
40
32
|
useEffect(function () {
|
|
41
33
|
var currentData = times.find(function (timesItem) {
|
|
42
34
|
return String(timesItem.key) === String(currentKey);
|
|
43
35
|
});
|
|
44
|
-
var renderData = currentData ? currentData.list : [];
|
|
45
|
-
|
|
36
|
+
var renderData = currentData ? currentData.list : [];
|
|
37
|
+
// 根据选中的日期回显当前日期可配送的时间
|
|
46
38
|
setRenderData(renderData);
|
|
47
|
-
}, [times, currentKey]);
|
|
48
|
-
|
|
39
|
+
}, [times, currentKey]);
|
|
40
|
+
// 选中时间的回调
|
|
49
41
|
var handleTime = function handleTime(time) {
|
|
50
42
|
select(time);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
};
|
|
44
|
+
// 选中的配送时间增加 active 类名
|
|
54
45
|
var getDetailClass = function getDetailClass(item) {
|
|
55
46
|
var initClass = 'nut-timedetail__item';
|
|
56
47
|
var curTimeData = currentTime.find(function (item) {
|
|
57
48
|
return String(item.key) === String(currentKey);
|
|
58
49
|
});
|
|
59
|
-
|
|
60
50
|
if (curTimeData && curTimeData.list && curTimeData.list.includes(item)) {
|
|
61
51
|
initClass += ' nut-timedetail__item-active';
|
|
62
52
|
}
|
|
63
|
-
|
|
64
53
|
return initClass;
|
|
65
54
|
};
|
|
66
|
-
|
|
67
55
|
return React__default.createElement("div", {
|
|
68
56
|
className: "".concat(b(), " ").concat(className || '')
|
|
69
57
|
}, renderData.map(function (item, index) {
|
|
@@ -76,7 +64,6 @@ var TimeDetail = function TimeDetail(props) {
|
|
|
76
64
|
}, item);
|
|
77
65
|
}));
|
|
78
66
|
};
|
|
79
|
-
|
|
80
67
|
TimeDetail.defaultProps = defaultProps;
|
|
81
68
|
TimeDetail.displayName = 'NutTimeDetail';
|
|
82
69
|
export { TimeDetail as default };
|
package/dist/esm/TimePannel.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
import React__default from 'react';
|
|
8
5
|
import { c as cn } from './bem-893ad28d.js';
|
|
9
6
|
import { useConfig } from './ConfigProvider.js';
|
|
@@ -13,17 +10,14 @@ var defaultProps = {
|
|
|
13
10
|
date: '',
|
|
14
11
|
curKey: 0
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
var TimePannel = function TimePannel(props) {
|
|
18
14
|
useConfig();
|
|
19
|
-
|
|
20
15
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
children = _defaultProps$props.children,
|
|
17
|
+
className = _defaultProps$props.className,
|
|
18
|
+
date = _defaultProps$props.date,
|
|
19
|
+
curKey = _defaultProps$props.curKey,
|
|
20
|
+
change = _defaultProps$props.change;
|
|
27
21
|
var b = cn('timepannel');
|
|
28
22
|
return React__default.createElement("div", {
|
|
29
23
|
className: "".concat(b(), " ").concat(className || ''),
|
|
@@ -32,7 +26,6 @@ var TimePannel = function TimePannel(props) {
|
|
|
32
26
|
}
|
|
33
27
|
}, date);
|
|
34
28
|
};
|
|
35
|
-
|
|
36
29
|
TimePannel.defaultProps = defaultProps;
|
|
37
30
|
TimePannel.displayName = 'NutTimePannel';
|
|
38
31
|
export { TimePannel as default };
|
package/dist/esm/TimeSelect.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
|
|
5
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
-
|
|
7
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
-
|
|
9
6
|
import React__default, { useState, useEffect } from 'react';
|
|
10
7
|
import Popup from './Popup.js';
|
|
11
8
|
import TimePannel from './TimePannel.js';
|
|
@@ -24,58 +21,50 @@ var defaultProps = {
|
|
|
24
21
|
dates: [],
|
|
25
22
|
times: []
|
|
26
23
|
};
|
|
27
|
-
|
|
28
24
|
var TimeSelect = function TimeSelect(props) {
|
|
29
25
|
useConfig();
|
|
30
|
-
|
|
31
26
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
27
|
+
children = _defaultProps$props.children,
|
|
28
|
+
visible = _defaultProps$props.visible,
|
|
29
|
+
className = _defaultProps$props.className,
|
|
30
|
+
height = _defaultProps$props.height,
|
|
31
|
+
title = _defaultProps$props.title,
|
|
32
|
+
currentKey = _defaultProps$props.currentKey,
|
|
33
|
+
currentTime = _defaultProps$props.currentTime,
|
|
34
|
+
dates = _defaultProps$props.dates,
|
|
35
|
+
times = _defaultProps$props.times,
|
|
36
|
+
multiple = _defaultProps$props.multiple,
|
|
37
|
+
select = _defaultProps$props.select,
|
|
38
|
+
pannelChange = _defaultProps$props.pannelChange,
|
|
39
|
+
timeChange = _defaultProps$props.timeChange;
|
|
46
40
|
var _useState = useState(currentKey),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
42
|
+
activeKey = _useState2[0],
|
|
43
|
+
setActiveKey = _useState2[1];
|
|
51
44
|
var _useState3 = useState(currentTime.length ? currentTime : [{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
key: currentKey,
|
|
46
|
+
list: []
|
|
47
|
+
}]),
|
|
48
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
49
|
+
activeTime = _useState4[0],
|
|
50
|
+
setActiveTime = _useState4[1];
|
|
59
51
|
var _useState5 = useState(visible),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
53
|
+
popVisible = _useState6[0],
|
|
54
|
+
setPopVisible = _useState6[1];
|
|
64
55
|
var popStyle = {
|
|
65
56
|
width: '100%',
|
|
66
57
|
height: height
|
|
67
58
|
};
|
|
68
|
-
var b = cn('timeselect');
|
|
69
|
-
|
|
59
|
+
var b = cn('timeselect');
|
|
60
|
+
// popup 的关闭回调, 执行 select 函数更改外部 visible
|
|
70
61
|
var closeFun = function closeFun() {
|
|
71
62
|
select && select(activeTime);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
};
|
|
64
|
+
// 选择配送时间回调
|
|
75
65
|
var handleSelectTime = function handleSelectTime(time) {
|
|
76
66
|
var curTimeData = {};
|
|
77
67
|
var curIndex = -1;
|
|
78
|
-
|
|
79
68
|
for (var i = 0; i < activeTime.length; i++) {
|
|
80
69
|
if (String(activeTime[i].key) === String(activeKey)) {
|
|
81
70
|
curTimeData = activeTime[i];
|
|
@@ -83,36 +72,28 @@ var TimeSelect = function TimeSelect(props) {
|
|
|
83
72
|
break;
|
|
84
73
|
}
|
|
85
74
|
}
|
|
86
|
-
|
|
87
75
|
var curTimeIndex = curTimeData.list.findIndex(function (item) {
|
|
88
76
|
return String(item) === String(time);
|
|
89
77
|
});
|
|
90
|
-
|
|
91
78
|
if (curTimeIndex === -1) {
|
|
92
79
|
curTimeData.list.push(time);
|
|
93
80
|
} else {
|
|
94
81
|
curTimeData.list.splice(curTimeIndex, 1);
|
|
95
82
|
}
|
|
96
|
-
|
|
97
83
|
var resultTimeData = _toConsumableArray(activeTime);
|
|
98
|
-
|
|
99
84
|
resultTimeData.splice(curIndex, 1, curTimeData);
|
|
100
85
|
setActiveTime(resultTimeData);
|
|
101
86
|
timeChange && timeChange(time, resultTimeData);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
|
|
87
|
+
};
|
|
88
|
+
// 选择日期的回调
|
|
105
89
|
var handleChange = function handleChange(pannelKey) {
|
|
106
90
|
var resultTimeData = _toConsumableArray(activeTime);
|
|
107
|
-
|
|
108
91
|
if (String(pannelKey) !== String(activeKey)) {
|
|
109
92
|
setActiveKey === null || setActiveKey === void 0 ? void 0 : setActiveKey(pannelKey);
|
|
110
|
-
|
|
111
93
|
if (multiple) {
|
|
112
94
|
var curTimeDataIndex = activeTime.findIndex(function (item) {
|
|
113
95
|
return String(item.key) === String(pannelKey);
|
|
114
96
|
});
|
|
115
|
-
|
|
116
97
|
if (curTimeDataIndex === -1) {
|
|
117
98
|
resultTimeData.push({
|
|
118
99
|
key: pannelKey,
|
|
@@ -127,20 +108,16 @@ var TimeSelect = function TimeSelect(props) {
|
|
|
127
108
|
}]);
|
|
128
109
|
}
|
|
129
110
|
}
|
|
130
|
-
|
|
131
111
|
pannelChange && pannelChange(pannelKey, resultTimeData);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
|
|
112
|
+
};
|
|
113
|
+
// 选中的日期增加 active 类名
|
|
135
114
|
var getTimePannelClass = function getTimePannelClass(dataItem) {
|
|
136
115
|
if (String(dataItem['pannel-key']) === String(activeKey)) {
|
|
137
116
|
return 'nut-timepannel-active';
|
|
138
117
|
}
|
|
139
|
-
|
|
140
118
|
return '';
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
|
|
119
|
+
};
|
|
120
|
+
// 根据外部传入 visible 进行组件的显隐展示
|
|
144
121
|
useEffect(function () {
|
|
145
122
|
setPopVisible(visible);
|
|
146
123
|
}, [visible]);
|
|
@@ -176,7 +153,6 @@ var TimeSelect = function TimeSelect(props) {
|
|
|
176
153
|
select: handleSelectTime
|
|
177
154
|
})))));
|
|
178
155
|
};
|
|
179
|
-
|
|
180
156
|
TimeSelect.defaultProps = defaultProps;
|
|
181
157
|
TimeSelect.displayName = 'NutTimeSelect';
|
|
182
158
|
export { TimeSelect as default };
|
package/dist/esm/Toast.js
CHANGED
|
@@ -5,15 +5,10 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
-
|
|
11
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
|
|
13
10
|
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); }; }
|
|
14
|
-
|
|
15
11
|
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; } }
|
|
16
|
-
|
|
17
12
|
import * as React from 'react';
|
|
18
13
|
import * as ReactDOM from 'react-dom';
|
|
19
14
|
import classNames from 'classnames';
|
|
@@ -21,21 +16,14 @@ import { c as cn } from './bem-893ad28d.js';
|
|
|
21
16
|
import Icon from './Icon.js';
|
|
22
17
|
import { r as render } from './render-18227751.js';
|
|
23
18
|
import '@bem-react/classname';
|
|
24
|
-
|
|
25
19
|
var Notification = /*#__PURE__*/function (_React$PureComponent) {
|
|
26
20
|
_inherits(Notification, _React$PureComponent);
|
|
27
|
-
|
|
28
21
|
var _super = _createSuper(Notification);
|
|
29
|
-
|
|
30
22
|
function Notification(props) {
|
|
31
23
|
var _this;
|
|
32
|
-
|
|
33
24
|
_classCallCheck(this, Notification);
|
|
34
|
-
|
|
35
25
|
_this = _super.call(this, props);
|
|
36
|
-
|
|
37
26
|
_defineProperty(_assertThisInitialized(_this), "closeTimer", void 0);
|
|
38
|
-
|
|
39
27
|
_this.close = _this.close.bind(_assertThisInitialized(_this));
|
|
40
28
|
_this.startCloseTimer = _this.startCloseTimer.bind(_assertThisInitialized(_this));
|
|
41
29
|
_this.clearCloseTimer = _this.clearCloseTimer.bind(_assertThisInitialized(_this));
|
|
@@ -43,7 +31,6 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
43
31
|
_this.clickCover = _this.clickCover.bind(_assertThisInitialized(_this));
|
|
44
32
|
return _this;
|
|
45
33
|
}
|
|
46
|
-
|
|
47
34
|
_createClass(Notification, [{
|
|
48
35
|
key: "close",
|
|
49
36
|
value: function close() {
|
|
@@ -54,9 +41,7 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
54
41
|
key: "startCloseTimer",
|
|
55
42
|
value: function startCloseTimer() {
|
|
56
43
|
var _this2 = this;
|
|
57
|
-
|
|
58
44
|
var duration = this.props.duration;
|
|
59
|
-
|
|
60
45
|
if (duration) {
|
|
61
46
|
this.closeTimer = window.setTimeout(function () {
|
|
62
47
|
_this2.close();
|
|
@@ -75,7 +60,6 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
75
60
|
key: "clickCover",
|
|
76
61
|
value: function clickCover() {
|
|
77
62
|
var closeOnClickOverlay = this.props.closeOnClickOverlay;
|
|
78
|
-
|
|
79
63
|
if (closeOnClickOverlay) {
|
|
80
64
|
this.close();
|
|
81
65
|
}
|
|
@@ -94,24 +78,23 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
94
78
|
key: "render",
|
|
95
79
|
value: function render() {
|
|
96
80
|
var _classNames,
|
|
97
|
-
|
|
98
|
-
|
|
81
|
+
_this3 = this;
|
|
99
82
|
var _this$props = this.props,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
83
|
+
id = _this$props.id,
|
|
84
|
+
style = _this$props.style,
|
|
85
|
+
icon = _this$props.icon,
|
|
86
|
+
iconSize = _this$props.iconSize,
|
|
87
|
+
title = _this$props.title,
|
|
88
|
+
msg = _this$props.msg,
|
|
89
|
+
bottom = _this$props.bottom,
|
|
90
|
+
center = _this$props.center,
|
|
91
|
+
bgColor = _this$props.bgColor,
|
|
92
|
+
coverColor = _this$props.coverColor,
|
|
93
|
+
textAlignCenter = _this$props.textAlignCenter,
|
|
94
|
+
size = _this$props.size,
|
|
95
|
+
customClass = _this$props.customClass,
|
|
96
|
+
cover = _this$props.cover,
|
|
97
|
+
type = _this$props.type;
|
|
115
98
|
var toastBem = cn('toast');
|
|
116
99
|
var classes = classNames((_classNames = {
|
|
117
100
|
'nut-toast-center': center,
|
|
@@ -148,27 +131,20 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
148
131
|
}, msg))));
|
|
149
132
|
}
|
|
150
133
|
}]);
|
|
151
|
-
|
|
152
134
|
return Notification;
|
|
153
135
|
}(React.PureComponent);
|
|
154
|
-
|
|
155
136
|
_defineProperty(Notification, "newInstance", void 0);
|
|
156
|
-
|
|
157
137
|
Notification.newInstance = function (properties, callback) {
|
|
158
138
|
var element = document.createElement('div');
|
|
159
|
-
|
|
160
139
|
if (properties.id) {
|
|
161
140
|
element.setAttribute('id', "".concat(properties.id));
|
|
162
141
|
}
|
|
163
|
-
|
|
164
142
|
document.body.appendChild(element);
|
|
165
143
|
var called = false;
|
|
166
|
-
|
|
167
144
|
function ref(instance) {
|
|
168
145
|
if (called) {
|
|
169
146
|
return;
|
|
170
147
|
}
|
|
171
|
-
|
|
172
148
|
called = true;
|
|
173
149
|
callback({
|
|
174
150
|
component: instance,
|
|
@@ -178,12 +154,10 @@ Notification.newInstance = function (properties, callback) {
|
|
|
178
154
|
}
|
|
179
155
|
});
|
|
180
156
|
}
|
|
181
|
-
|
|
182
157
|
render(React.createElement(Notification, _objectSpread(_objectSpread({}, properties), {}, {
|
|
183
158
|
ref: ref
|
|
184
159
|
})), element);
|
|
185
160
|
};
|
|
186
|
-
|
|
187
161
|
var messageInstance = null;
|
|
188
162
|
var options = {
|
|
189
163
|
msg: '',
|
|
@@ -205,7 +179,6 @@ var options = {
|
|
|
205
179
|
cover: false,
|
|
206
180
|
coverColor: 'rgba(0, 0, 0, 0)',
|
|
207
181
|
closeOnClickOverlay: false // 是否点击遮罩可关闭
|
|
208
|
-
|
|
209
182
|
};
|
|
210
183
|
|
|
211
184
|
function getInstance(props, callback) {
|
|
@@ -213,12 +186,10 @@ function getInstance(props, callback) {
|
|
|
213
186
|
messageInstance.destroy();
|
|
214
187
|
messageInstance = null;
|
|
215
188
|
}
|
|
216
|
-
|
|
217
189
|
Notification.newInstance(props, function (notification) {
|
|
218
190
|
return callback && callback(notification);
|
|
219
191
|
});
|
|
220
192
|
}
|
|
221
|
-
|
|
222
193
|
function notice(opts) {
|
|
223
194
|
function close() {
|
|
224
195
|
if (messageInstance) {
|
|
@@ -226,22 +197,18 @@ function notice(opts) {
|
|
|
226
197
|
messageInstance = null;
|
|
227
198
|
}
|
|
228
199
|
}
|
|
229
|
-
|
|
230
200
|
var opts2 = _objectSpread(_objectSpread(_objectSpread({}, options), opts), {}, {
|
|
231
201
|
onClose: close
|
|
232
202
|
});
|
|
233
|
-
|
|
234
203
|
getInstance(opts2, function (notification) {
|
|
235
204
|
messageInstance = notification;
|
|
236
205
|
});
|
|
237
206
|
}
|
|
238
|
-
|
|
239
207
|
var errorMsg = function errorMsg(msg) {
|
|
240
208
|
if (!msg) {
|
|
241
209
|
console.warn('[NutUI Toast]: msg cannot be null');
|
|
242
210
|
}
|
|
243
211
|
};
|
|
244
|
-
|
|
245
212
|
var Toast = {
|
|
246
213
|
text: function text(msg) {
|
|
247
214
|
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|