@nutui/nutui-react-taro 1.5.2-beta.1 → 1.5.2
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/dist/esm/ActionSheet.js +90 -14
- package/dist/esm/Address.js +620 -21
- package/dist/esm/Animate.js +53 -7
- package/dist/esm/AnimatingNumbers.js +125 -7
- package/dist/esm/Audio.js +264 -19
- package/dist/esm/Avatar.js +130 -11
- package/dist/esm/{AvatarContext-c96afdcc.js → AvatarContext-15733596.js} +1 -3
- package/dist/esm/AvatarGroup.js +41 -11
- package/dist/esm/BackTop.js +138 -10
- package/dist/esm/Badge.js +71 -9
- package/dist/esm/Barrage.js +97 -8
- package/dist/esm/Button.js +108 -9
- package/dist/esm/Calendar.js +128 -20
- package/dist/esm/CalendarItem.js +674 -12
- package/dist/esm/Card.js +61 -11
- package/dist/esm/Cascader.js +671 -16
- package/dist/esm/Cell.js +101 -9
- package/dist/esm/CellGroup.js +2 -5
- package/dist/esm/Checkbox.js +5 -7
- package/dist/esm/CheckboxGroup.js +111 -8
- package/dist/esm/CircleProgress.js +114 -8
- package/dist/esm/Col.js +57 -7
- package/dist/esm/Collapse.js +97 -7
- package/dist/esm/CollapseItem.js +146 -8
- package/dist/esm/ConfigProvider.js +187 -8
- package/dist/esm/CountDown.js +247 -9
- package/dist/esm/DatePicker.js +309 -25
- package/dist/esm/Dialog.js +296 -17
- package/dist/esm/Divider.js +34 -7
- package/dist/esm/Drag.js +118 -7
- package/dist/esm/Elevator.js +234 -8
- package/dist/esm/Ellipsis.js +176 -10
- package/dist/esm/Empty.js +79 -8
- package/dist/esm/FixedNav.js +103 -14
- package/dist/esm/Form.js +215 -10
- package/dist/esm/FormItem.js +3 -10
- package/dist/esm/Grid.js +81 -11
- package/dist/esm/GridItem.js +123 -13
- package/dist/esm/Icon.js +2 -5
- package/dist/esm/Image.js +169 -11
- package/dist/esm/ImagePreview.js +225 -19
- package/dist/esm/Indicator.js +50 -7
- package/dist/esm/Infiniteloading.js +215 -14
- package/dist/esm/Input.js +362 -12
- package/dist/esm/InputNumber.js +275 -9
- package/dist/esm/Layout.js +13 -5
- package/dist/esm/Menu.js +153 -10
- package/dist/esm/MenuItem.js +175 -15
- package/dist/esm/NavBar.js +114 -9
- package/dist/esm/NoticeBar.js +568 -10
- package/dist/esm/Notify.js +234 -8
- package/dist/esm/NumberKeyboard.js +247 -17
- package/dist/esm/Overlay.js +2 -6
- package/dist/esm/Pagination.js +168 -9
- package/dist/esm/Picker.js +494 -22
- package/dist/esm/Popover.js +223 -12
- package/dist/esm/Popup.js +193 -13
- package/dist/esm/Price.js +84 -6
- package/dist/esm/Progress.js +122 -9
- package/dist/esm/PullToRefresh.js +276 -13
- package/dist/esm/Radio.js +4 -8
- package/dist/esm/RadioGroup.js +120 -7
- package/dist/esm/Range.js +406 -15
- package/dist/esm/Rate.js +121 -9
- package/dist/esm/Row.js +49 -7
- package/dist/esm/SearchBar.js +235 -12
- package/dist/esm/ShortPassword.js +191 -17
- package/dist/esm/SideNavBar.js +57 -19
- package/dist/esm/SideNavBarItem.js +24 -5
- package/dist/esm/Signature.js +153 -13
- package/dist/esm/Skeleton.js +98 -12
- package/dist/esm/Step.js +87 -10
- package/dist/esm/Steps.js +38 -8
- package/dist/esm/Sticky.js +190 -11
- package/dist/esm/SubSideNavBar.js +78 -6
- package/dist/esm/Swipe.js +230 -10
- package/dist/esm/Swiper.js +490 -9
- package/dist/esm/SwiperItem.js +36 -8
- package/dist/esm/Switch.js +71 -6
- package/dist/esm/TabPane.js +2 -5
- package/dist/esm/Tabbar.js +68 -6
- package/dist/esm/TabbarItem.js +78 -9
- package/dist/esm/Table.js +140 -12
- package/dist/esm/Tabs.js +5 -8
- package/dist/esm/Tag.js +110 -10
- package/dist/esm/TextArea.js +148 -9
- package/dist/esm/TimeDetail.js +67 -9
- package/dist/esm/TimePannel.js +29 -9
- package/dist/esm/TimeSelect.js +171 -19
- package/dist/esm/Toast.js +268 -7
- package/dist/esm/TrendArrow.js +99 -7
- package/dist/esm/Uploader.js +566 -17
- package/dist/esm/{UserContext-0aac9a82.js → UserContext-101ad4a4.js} +1 -3
- package/dist/esm/{UserContext-e402e1a6.js → UserContext-2629d479.js} +1 -3
- package/dist/esm/{UserContext-e8176108.js → UserContext-b33bcf21.js} +1 -3
- package/dist/esm/Video.js +90 -7
- package/dist/esm/VirtualList.js +313 -9
- package/dist/esm/WaterMark.js +111 -11
- package/dist/esm/{bem-350c1702.js → bem-3b438e61.js} +6 -3
- package/dist/esm/cellgroup-fcc72767.js +34 -0
- package/dist/esm/checkbox-44e13cd0.js +137 -0
- package/dist/esm/date-c7aad4c0.js +97 -0
- package/dist/esm/formitem-8a73a5fb.js +157 -0
- package/dist/esm/get-scroll-parent-5f85dee8.js +24 -0
- package/dist/esm/{grid.taro.context-c2bbfb4f.js → grid.context-2ee27d95.js} +2 -4
- package/dist/esm/icon-4ef1581c.js +70 -0
- package/dist/esm/index-030b7245.js +11 -0
- package/dist/esm/nutui-react.es.js +94 -119
- package/dist/esm/offsetContext-3ab00d40.js +16 -0
- package/dist/esm/overlay-de6c79d5.js +83 -0
- package/dist/esm/radio-9f141e6b.js +118 -0
- package/dist/esm/render-bbebb760.js +79 -0
- package/dist/esm/tabpane-01075e6c.js +29 -0
- package/dist/esm/tabs-e1b4e4b1.js +181 -0
- package/dist/esm/typings-f27b58f4.js +8 -0
- package/dist/esm/useClientRect-56bb675b.js +39 -0
- package/dist/esm/useTouch-cf73a407.js +99 -0
- 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/locales/zh-UG.js +1 -1
- package/dist/nutui.react.mjs +15025 -13192
- package/dist/nutui.react.umd.js +15004 -13169
- package/dist/style.mjs +1 -1
- package/dist/types/index.d.ts +183 -176
- package/package.json +1 -1
- package/dist/esm/actionsheet.taro-e6a51446.js +0 -53
- package/dist/esm/address.taro-3a9b6396.js +0 -461
- package/dist/esm/animate.taro-fb7986d6.js +0 -40
- package/dist/esm/animatingnumbers.taro-03e5d61d.js +0 -104
- package/dist/esm/audio.taro-87ec8bf2.js +0 -161
- package/dist/esm/avatar.taro-3676f38f.js +0 -103
- package/dist/esm/avatargroup-f3574510.js +0 -34
- package/dist/esm/backtop.taro-66394a36.js +0 -48
- package/dist/esm/badge.taro-a4e59c11.js +0 -52
- package/dist/esm/barrage.taro-0495a1b2.js +0 -94
- package/dist/esm/button.taro-9244d065.js +0 -100
- package/dist/esm/calendar.taro-670842ea.js +0 -65
- package/dist/esm/calendaritem.taro-2a603571.js +0 -787
- package/dist/esm/can-use-dom-3eeb5af4.js +0 -6
- package/dist/esm/card.taro-e4c76dad.js +0 -33
- package/dist/esm/cascader.taro-eb1fb011.js +0 -438
- package/dist/esm/cell.taro-a10a74d3.js +0 -64
- package/dist/esm/cellgroup.taro-abe501bc.js +0 -25
- package/dist/esm/checkbox.taro-6120e3e3.js +0 -171
- package/dist/esm/circleprogress.taro-79854448.js +0 -109
- package/dist/esm/col.taro-53eed3cc.js +0 -41
- package/dist/esm/collapse.taro-1a9e4ba2.js +0 -83
- package/dist/esm/collapseitem-4d0bc55d.js +0 -83
- package/dist/esm/configprovider-67d19d3a.js +0 -19
- package/dist/esm/configprovider.taro-8d71eb49.js +0 -42
- package/dist/esm/countdown.taro-5b17c607.js +0 -226
- package/dist/esm/datepicker.taro-6e9b4b8f.js +0 -275
- package/dist/esm/dialog.taro-a3267d29.js +0 -118
- package/dist/esm/divider.taro-26d1d8b4.js +0 -35
- package/dist/esm/drag.taro-79bb8744.js +0 -110
- package/dist/esm/elevator.taro-6019669e.js +0 -178
- package/dist/esm/ellipsis.taro-f15f26da.js +0 -241
- package/dist/esm/empty.taro-04ae4389.js +0 -62
- package/dist/esm/fixednav.taro-1f05acaf.js +0 -53
- package/dist/esm/form.taro-0c8e7a39.js +0 -179
- package/dist/esm/formitem.taro-190a3326.js +0 -89
- package/dist/esm/get-scroll-parent-b4a07e65.js +0 -25
- package/dist/esm/grid.taro-3503b82c.js +0 -61
- package/dist/esm/griditem.taro-cdb3f119.js +0 -98
- package/dist/esm/icon-296a1bec.js +0 -63
- package/dist/esm/icon.taro-296a1bec.js +0 -63
- package/dist/esm/image.taro-142cf512.js +0 -64
- package/dist/esm/imagepreview.taro-c50bb0a3.js +0 -167
- package/dist/esm/index-5bcb0ff8.js +0 -7
- package/dist/esm/indicator.taro-cba8b010.js +0 -37
- package/dist/esm/infiniteloading.taro-183bccbf.js +0 -144
- package/dist/esm/input.taro-97af6c96.js +0 -240
- package/dist/esm/inputnumber.taro-91f65d17.js +0 -130
- package/dist/esm/layout.taro-9046d093.js +0 -11
- package/dist/esm/menu.taro-7e4038a1.js +0 -99
- package/dist/esm/menuitem.taro-96cc4f15.js +0 -130
- package/dist/esm/navbar.taro-777c4705.js +0 -79
- package/dist/esm/noticebar.taro-4a23cdee.js +0 -448
- package/dist/esm/notify.taro-e17c6f82.js +0 -75
- package/dist/esm/numberkeyboard.taro-1bc24744.js +0 -159
- package/dist/esm/offsetContext-c2a746fa.js +0 -5
- package/dist/esm/overlay.taro-21e87fb1.js +0 -69
- package/dist/esm/pagination.taro-715a173b.js +0 -124
- package/dist/esm/picker.taro-9ad1b7c5.js +0 -473
- package/dist/esm/popover.taro-ad5e76ea.js +0 -156
- package/dist/esm/popup.taro-01676bff.js +0 -137
- package/dist/esm/price.taro-776ed16e.js +0 -83
- package/dist/esm/progress.taro-f0ce38e9.js +0 -90
- package/dist/esm/pulltorefresh.taro-a294f656.js +0 -181
- package/dist/esm/radio.taro-a6eff96c.js +0 -168
- package/dist/esm/range.taro-d8fc7656.js +0 -332
- package/dist/esm/rate.taro-6cdf03bd.js +0 -75
- package/dist/esm/row.taro-f64d4a13.js +0 -46
- package/dist/esm/searchbar.taro-0c25927b.js +0 -152
- package/dist/esm/shortpassword.taro-9ee034f7.js +0 -111
- package/dist/esm/sidenavbar.taro-c307b35e.js +0 -35
- package/dist/esm/sidenavbaritem.taro-5a7965d0.js +0 -12
- package/dist/esm/signature.taro-ec4e713b.js +0 -143
- package/dist/esm/skeleton.taro-76faf63f.js +0 -62
- package/dist/esm/step.taro-b7903e8c.js +0 -59
- package/dist/esm/steps.taro-c82d2252.js +0 -30
- package/dist/esm/sticky.taro-218bda37.js +0 -138
- package/dist/esm/subsidenavbar.taro-69cb9752.js +0 -63
- package/dist/esm/supports-passive-c85ef996.js +0 -18
- package/dist/esm/swipe.taro-ea35f07f.js +0 -177
- package/dist/esm/swiper.taro-7a94e211.js +0 -451
- package/dist/esm/swiperitem-c9e3d0d5.js +0 -29
- package/dist/esm/switch.taro-34ca8228.js +0 -50
- package/dist/esm/tabbar.taro-9acfc2fa.js +0 -59
- package/dist/esm/tabbaritem.taro-bf517487.js +0 -58
- package/dist/esm/table.taro-91fc0c01.js +0 -93
- package/dist/esm/tabpane.taro-4ca340ef.js +0 -23
- package/dist/esm/tabs.taro-6a7524a4.js +0 -140
- package/dist/esm/tag.taro-23ba0834.js +0 -92
- package/dist/esm/textarea.taro-442e7350.js +0 -94
- package/dist/esm/timedetail.taro-5b2f2269.js +0 -44
- package/dist/esm/timepannel.taro-d6e40180.js +0 -22
- package/dist/esm/timeselect.taro-a07036f4.js +0 -133
- package/dist/esm/toast.taro-d6c14811.js +0 -109
- package/dist/esm/trendarrow.taro-b8c5ccd9.js +0 -73
- package/dist/esm/typings-b9828dba.js +0 -9
- package/dist/esm/uploader.taro-587e6bf3.js +0 -492
- package/dist/esm/useClientRect-1f8ed1fe.js +0 -18
- package/dist/esm/useTouch-db24bb5c.js +0 -69
- package/dist/esm/video-f1be8a91.js +0 -67
- package/dist/esm/virtuallist.taro-f0b0270d.js +0 -214
- package/dist/esm/watermark.taro-9ce2ae37.js +0 -114
- package/dist/esm/zh-CN-c779e6c1.js +0 -131
package/dist/esm/Notify.js
CHANGED
|
@@ -1,10 +1,236 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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; }
|
|
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; }
|
|
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); }; }
|
|
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; } }
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import * as ReactDOM from 'react-dom';
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
import { CSSTransition } from 'react-transition-group';
|
|
16
|
+
import { c as cn } from './bem-3b438e61.js';
|
|
17
|
+
import { r as render } from './render-bbebb760.js';
|
|
6
18
|
import '@bem-react/classname';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
19
|
+
var Notification = /*#__PURE__*/function (_React$PureComponent) {
|
|
20
|
+
_inherits(Notification, _React$PureComponent);
|
|
21
|
+
var _super = _createSuper(Notification);
|
|
22
|
+
function Notification(props) {
|
|
23
|
+
var _this;
|
|
24
|
+
_classCallCheck(this, Notification);
|
|
25
|
+
_this = _super.call(this, props);
|
|
26
|
+
_defineProperty(_assertThisInitialized(_this), "closeTimer", void 0);
|
|
27
|
+
_this.close = _this.close.bind(_assertThisInitialized(_this));
|
|
28
|
+
_this.startCloseTimer = _this.startCloseTimer.bind(_assertThisInitialized(_this));
|
|
29
|
+
_this.clearCloseTimer = _this.clearCloseTimer.bind(_assertThisInitialized(_this));
|
|
30
|
+
_this.clickCover = _this.clickCover.bind(_assertThisInitialized(_this));
|
|
31
|
+
_this.state = {
|
|
32
|
+
show: true
|
|
33
|
+
};
|
|
34
|
+
return _this;
|
|
35
|
+
}
|
|
36
|
+
_createClass(Notification, [{
|
|
37
|
+
key: "close",
|
|
38
|
+
value: function close() {
|
|
39
|
+
this.setState({
|
|
40
|
+
show: false
|
|
41
|
+
});
|
|
42
|
+
this.clearCloseTimer();
|
|
43
|
+
if (this.props.id) {
|
|
44
|
+
var element = document.getElementById(this.props.id);
|
|
45
|
+
element && element.parentNode && element.parentNode.removeChild(element);
|
|
46
|
+
}
|
|
47
|
+
this.props.onClosed();
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "startCloseTimer",
|
|
51
|
+
value: function startCloseTimer() {
|
|
52
|
+
var _this2 = this;
|
|
53
|
+
var duration = this.props.duration;
|
|
54
|
+
if (duration) {
|
|
55
|
+
this.closeTimer = window.setTimeout(function () {
|
|
56
|
+
_this2.close();
|
|
57
|
+
}, duration);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "clearCloseTimer",
|
|
62
|
+
value: function clearCloseTimer() {
|
|
63
|
+
if (this.closeTimer) {
|
|
64
|
+
clearTimeout(this.closeTimer);
|
|
65
|
+
this.closeTimer = -1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "clickCover",
|
|
70
|
+
value: function clickCover() {
|
|
71
|
+
this.props.onClick();
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "componentDidMount",
|
|
75
|
+
value: function componentDidMount() {
|
|
76
|
+
this.startCloseTimer();
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
key: "componentWillUnmount",
|
|
80
|
+
value: function componentWillUnmount() {
|
|
81
|
+
this.clearCloseTimer();
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "render",
|
|
85
|
+
value: function render() {
|
|
86
|
+
var _this$props = this.props,
|
|
87
|
+
children = _this$props.children,
|
|
88
|
+
style = _this$props.style,
|
|
89
|
+
msg = _this$props.msg,
|
|
90
|
+
color = _this$props.color,
|
|
91
|
+
background = _this$props.background,
|
|
92
|
+
type = _this$props.type,
|
|
93
|
+
className = _this$props.className,
|
|
94
|
+
position = _this$props.position,
|
|
95
|
+
isWrapTeleport = _this$props.isWrapTeleport;
|
|
96
|
+
this.state;
|
|
97
|
+
cn('notify');
|
|
98
|
+
var classes = classNames(_defineProperty({
|
|
99
|
+
'nut-notify--popup-top': position === 'top',
|
|
100
|
+
'nut-notify--popup-bottom': position === 'bottom',
|
|
101
|
+
'nut-notify': true
|
|
102
|
+
}, "nut-notify--".concat(type), true));
|
|
103
|
+
return React.createElement(React.Fragment, null, React.createElement(CSSTransition, {
|
|
104
|
+
"in": this.state.show,
|
|
105
|
+
timeout: 300,
|
|
106
|
+
classNames: "fade",
|
|
107
|
+
unmountOnExit: true,
|
|
108
|
+
appear: true,
|
|
109
|
+
position: position,
|
|
110
|
+
isWrapTeleport: isWrapTeleport
|
|
111
|
+
}, React.createElement("div", {
|
|
112
|
+
className: "".concat(classes, " ").concat(className),
|
|
113
|
+
style: {
|
|
114
|
+
color: "".concat(color || ''),
|
|
115
|
+
background: "".concat(background || '')
|
|
116
|
+
},
|
|
117
|
+
onClick: this.clickCover
|
|
118
|
+
}, children || msg)));
|
|
119
|
+
}
|
|
120
|
+
}]);
|
|
121
|
+
return Notification;
|
|
122
|
+
}(React.PureComponent);
|
|
123
|
+
_defineProperty(Notification, "newInstance", void 0);
|
|
124
|
+
Notification.newInstance = function (properties, callback) {
|
|
125
|
+
var element = document.createElement('div');
|
|
126
|
+
var id = properties.id ? properties.id : "".concat(new Date().getTime());
|
|
127
|
+
element.id = id;
|
|
128
|
+
properties.id = id;
|
|
129
|
+
document.body.appendChild(element);
|
|
130
|
+
var called = false;
|
|
131
|
+
function ref(instance) {
|
|
132
|
+
if (called) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
called = true;
|
|
136
|
+
callback({
|
|
137
|
+
component: instance,
|
|
138
|
+
destroy: function destroy() {
|
|
139
|
+
setTimeout(function () {
|
|
140
|
+
ReactDOM.unmountComponentAtNode(element);
|
|
141
|
+
element && element.parentNode && element.parentNode.removeChild(element);
|
|
142
|
+
}, 300);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
render(React.createElement(Notification, _objectSpread(_objectSpread({}, properties), {}, {
|
|
147
|
+
ref: ref
|
|
148
|
+
})), element);
|
|
149
|
+
};
|
|
150
|
+
var messageInstance = null;
|
|
151
|
+
var options = {
|
|
152
|
+
msg: '',
|
|
153
|
+
id: '',
|
|
154
|
+
duration: 3000,
|
|
155
|
+
color: '',
|
|
156
|
+
type: 'danger',
|
|
157
|
+
className: '',
|
|
158
|
+
position: 'top',
|
|
159
|
+
onClosed: function onClosed() {},
|
|
160
|
+
onClick: function onClick() {}
|
|
161
|
+
};
|
|
162
|
+
function getInstance(props, callback) {
|
|
163
|
+
if (messageInstance) {
|
|
164
|
+
messageInstance.destroy();
|
|
165
|
+
messageInstance = null;
|
|
166
|
+
}
|
|
167
|
+
Notification.newInstance(props, function (notification) {
|
|
168
|
+
return callback && callback(notification);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function notice(opts) {
|
|
172
|
+
// function close() {
|
|
173
|
+
// if (messageInstance) {
|
|
174
|
+
// messageInstance.destroy()
|
|
175
|
+
// messageInstance = null
|
|
176
|
+
// }
|
|
177
|
+
// }
|
|
178
|
+
opts = _objectSpread(_objectSpread({}, options), opts);
|
|
179
|
+
getInstance(opts, function (notification) {
|
|
180
|
+
messageInstance = notification;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
var errorMsg = function errorMsg(msg) {
|
|
184
|
+
if (!msg) {
|
|
185
|
+
console.warn('[NutUI Notify]: msg不能为空');
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
var Notify = {
|
|
189
|
+
text: function text(msg) {
|
|
190
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
191
|
+
errorMsg(msg);
|
|
192
|
+
return notice(_objectSpread({
|
|
193
|
+
msg: msg,
|
|
194
|
+
type: 'base'
|
|
195
|
+
}, option));
|
|
196
|
+
},
|
|
197
|
+
success: function success(msg) {
|
|
198
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
199
|
+
errorMsg(msg);
|
|
200
|
+
return notice(_objectSpread({
|
|
201
|
+
msg: msg,
|
|
202
|
+
type: 'success'
|
|
203
|
+
}, option));
|
|
204
|
+
},
|
|
205
|
+
primary: function primary(msg) {
|
|
206
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
207
|
+
errorMsg(msg);
|
|
208
|
+
return notice(_objectSpread({
|
|
209
|
+
msg: msg,
|
|
210
|
+
type: 'primary'
|
|
211
|
+
}, option));
|
|
212
|
+
},
|
|
213
|
+
danger: function danger(msg) {
|
|
214
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
215
|
+
errorMsg(msg);
|
|
216
|
+
return notice(_objectSpread({
|
|
217
|
+
msg: msg,
|
|
218
|
+
type: 'danger'
|
|
219
|
+
}, option));
|
|
220
|
+
},
|
|
221
|
+
warn: function warn(msg) {
|
|
222
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
223
|
+
errorMsg(msg);
|
|
224
|
+
return notice(_objectSpread({
|
|
225
|
+
msg: msg,
|
|
226
|
+
type: 'warning'
|
|
227
|
+
}, option));
|
|
228
|
+
},
|
|
229
|
+
hide: function hide() {
|
|
230
|
+
if (messageInstance) {
|
|
231
|
+
messageInstance.destroy();
|
|
232
|
+
messageInstance = null;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
};
|
|
10
236
|
export { Notify as default };
|
|
@@ -1,19 +1,249 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
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; }
|
|
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; }
|
|
6
|
+
import React__default, { useState, useEffect } from 'react';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import { c as cn } from './bem-3b438e61.js';
|
|
9
|
+
import Popup from './Popup.js';
|
|
10
|
+
import { useConfig } from './ConfigProvider.js';
|
|
5
11
|
import '@bem-react/classname';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
var defaultProps = {
|
|
13
|
+
confirmText: '',
|
|
14
|
+
title: '',
|
|
15
|
+
visible: false,
|
|
16
|
+
overlay: true,
|
|
17
|
+
type: 'default',
|
|
18
|
+
customKey: [],
|
|
19
|
+
className: '',
|
|
20
|
+
randomKeys: false,
|
|
21
|
+
popClass: '',
|
|
22
|
+
onClose: function onClose() {}
|
|
23
|
+
};
|
|
24
|
+
var NumberKeyboard = function NumberKeyboard(props) {
|
|
25
|
+
var _useConfig = useConfig(),
|
|
26
|
+
locale = _useConfig.locale;
|
|
27
|
+
var title = props.title,
|
|
28
|
+
confirmText = props.confirmText,
|
|
29
|
+
visible = props.visible,
|
|
30
|
+
overlay = props.overlay,
|
|
31
|
+
type = props.type,
|
|
32
|
+
customKey = props.customKey,
|
|
33
|
+
randomKeys = props.randomKeys,
|
|
34
|
+
popClass = props.popClass,
|
|
35
|
+
style = props.style,
|
|
36
|
+
className = props.className,
|
|
37
|
+
onChange = props.onChange,
|
|
38
|
+
onDelete = props.onDelete,
|
|
39
|
+
onClose = props.onClose;
|
|
40
|
+
var b = cn('numberkeyboard');
|
|
41
|
+
var _useState = useState(visible),
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
show = _useState2[0],
|
|
44
|
+
setShow = _useState2[1];
|
|
45
|
+
var _useState3 = useState(undefined),
|
|
46
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
47
|
+
clickKeyIndex = _useState4[0],
|
|
48
|
+
setClickKeyIndex = _useState4[1];
|
|
49
|
+
var _useState5 = useState([]),
|
|
50
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
51
|
+
keysList = _useState6[0],
|
|
52
|
+
setKeysList = _useState6[1];
|
|
53
|
+
useEffect(function () {
|
|
54
|
+
setShow(visible);
|
|
55
|
+
}, [visible]);
|
|
56
|
+
var defaultKey = function defaultKey() {
|
|
57
|
+
var leftBottomKey = {
|
|
58
|
+
id: 'lock',
|
|
59
|
+
type: 'lock'
|
|
60
|
+
};
|
|
61
|
+
if (customKey) {
|
|
62
|
+
var customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
63
|
+
if (customKeys.length > 0) {
|
|
64
|
+
var newCustomKey = customKeys[0];
|
|
65
|
+
leftBottomKey = {
|
|
66
|
+
id: newCustomKey,
|
|
67
|
+
type: 'custom'
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return [].concat(_toConsumableArray(getBasicKeys()), [leftBottomKey, {
|
|
72
|
+
id: 0,
|
|
73
|
+
type: 'number'
|
|
74
|
+
}, {
|
|
75
|
+
id: 'delete',
|
|
76
|
+
type: 'delete'
|
|
77
|
+
}]);
|
|
78
|
+
};
|
|
79
|
+
var getBasicKeys = function getBasicKeys() {
|
|
80
|
+
var keys = [];
|
|
81
|
+
for (var i = 1; i <= 9; i++) {
|
|
82
|
+
keys.push({
|
|
83
|
+
id: i,
|
|
84
|
+
type: 'number'
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (randomKeys) {
|
|
88
|
+
return keys.sort(function () {
|
|
89
|
+
return Math.random() > 0.5 ? 1 : -1;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return keys;
|
|
93
|
+
};
|
|
94
|
+
var genCustomKeys = function genCustomKeys() {
|
|
95
|
+
var keys = getBasicKeys();
|
|
96
|
+
if (!customKey) return [];
|
|
97
|
+
var customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
98
|
+
if (customKeys.length > 2) {
|
|
99
|
+
customKeys = [customKeys[0], customKeys[1]];
|
|
100
|
+
}
|
|
101
|
+
if (customKeys.length === 2 && props.title && props.type !== 'rightColumn') {
|
|
102
|
+
customKeys = [customKeys[0]];
|
|
103
|
+
}
|
|
104
|
+
if (customKeys.length === 1) {
|
|
105
|
+
if (props.title && props.type !== 'rightColumn') {
|
|
106
|
+
keys.push({
|
|
107
|
+
id: customKeys[0],
|
|
108
|
+
type: 'custom'
|
|
109
|
+
}, {
|
|
110
|
+
id: 0,
|
|
111
|
+
type: 'number'
|
|
112
|
+
}, {
|
|
113
|
+
id: 'delete',
|
|
114
|
+
type: 'delete'
|
|
115
|
+
});
|
|
116
|
+
} else {
|
|
117
|
+
keys.push({
|
|
118
|
+
id: 0,
|
|
119
|
+
type: 'number'
|
|
120
|
+
}, {
|
|
121
|
+
id: customKeys[0],
|
|
122
|
+
type: 'custom'
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
} else if (customKeys.length === 2) {
|
|
126
|
+
keys.push({
|
|
127
|
+
id: customKeys[0],
|
|
128
|
+
type: 'custom'
|
|
129
|
+
}, {
|
|
130
|
+
id: 0,
|
|
131
|
+
type: 'number'
|
|
132
|
+
}, {
|
|
133
|
+
id: customKeys[1],
|
|
134
|
+
type: 'custom'
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return keys;
|
|
138
|
+
};
|
|
139
|
+
useEffect(function () {
|
|
140
|
+
if (props.type === 'rightColumn' || props.title !== '') {
|
|
141
|
+
setKeysList(genCustomKeys());
|
|
142
|
+
} else {
|
|
143
|
+
setKeysList(defaultKey());
|
|
144
|
+
}
|
|
145
|
+
}, []);
|
|
146
|
+
var onTouchstart = function onTouchstart(item, event) {
|
|
147
|
+
event.stopPropagation();
|
|
148
|
+
setClickKeyIndex(item.id);
|
|
149
|
+
if (item.type === 'number' || item.type === 'custom') {
|
|
150
|
+
onChange && onChange(item.id);
|
|
151
|
+
}
|
|
152
|
+
if (item.type === 'lock') {
|
|
153
|
+
onClose && onClose();
|
|
154
|
+
}
|
|
155
|
+
if (item.type === 'delete') {
|
|
156
|
+
onDelete && onDelete();
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
var onTouchMove = function onTouchMove(event) {
|
|
160
|
+
event.stopPropagation();
|
|
161
|
+
};
|
|
162
|
+
var onTouchEnd = function onTouchEnd(event) {
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
setClickKeyIndex(undefined);
|
|
165
|
+
};
|
|
166
|
+
return React__default.createElement("div", null, React__default.createElement(Popup, {
|
|
167
|
+
visible: show,
|
|
168
|
+
position: "bottom",
|
|
169
|
+
popClass: popClass,
|
|
170
|
+
onClickOverlay: onClose,
|
|
171
|
+
overlay: overlay,
|
|
172
|
+
onClickCloseIcon: onClose,
|
|
173
|
+
overlayStyle: {
|
|
174
|
+
backgroundColor: 'rgba(0, 0, 0, 0)'
|
|
175
|
+
}
|
|
176
|
+
}, React__default.createElement("div", {
|
|
177
|
+
className: "".concat(b(), " ").concat(className),
|
|
178
|
+
style: _objectSpread({}, style)
|
|
179
|
+
}, title ? React__default.createElement("div", {
|
|
180
|
+
className: b('header')
|
|
181
|
+
}, React__default.createElement("h3", {
|
|
182
|
+
className: b('header__tit')
|
|
183
|
+
}, title), type === 'default' ? React__default.createElement("span", {
|
|
184
|
+
className: b('header__close'),
|
|
185
|
+
onClick: onClose
|
|
186
|
+
}, locale.done) : null) : null, React__default.createElement("div", {
|
|
187
|
+
className: b('body')
|
|
188
|
+
}, React__default.createElement("div", {
|
|
189
|
+
className: b('body__keys')
|
|
190
|
+
}, keysList === null || keysList === void 0 ? void 0 : keysList.map(function (item, index) {
|
|
191
|
+
return React__default.createElement("div", {
|
|
192
|
+
key: index,
|
|
193
|
+
className: classNames({
|
|
194
|
+
'key-board-wrapper': true,
|
|
195
|
+
'key-board-wrapper-large': item.id === 0 && type === 'rightColumn' && Array.isArray(customKey) && customKey.length === 1
|
|
196
|
+
})
|
|
197
|
+
}, React__default.createElement("div", {
|
|
198
|
+
className: classNames({
|
|
199
|
+
key: true,
|
|
200
|
+
active: item.id === clickKeyIndex,
|
|
201
|
+
lock: item.type === 'lock',
|
|
202
|
+
"delete": item.type === 'delete'
|
|
203
|
+
}),
|
|
204
|
+
onTouchStart: function onTouchStart(event) {
|
|
205
|
+
return onTouchstart(item, event);
|
|
206
|
+
},
|
|
207
|
+
onTouchMove: onTouchMove,
|
|
208
|
+
onTouchEnd: onTouchEnd
|
|
209
|
+
}, item.type === 'number' || item.type === 'custom' ? React__default.createElement("div", null, item.id) : null, item.type === 'lock' ? React__default.createElement("img", {
|
|
210
|
+
src: "https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png",
|
|
211
|
+
alt: ""
|
|
212
|
+
}) : null, item.type === 'delete' ? React__default.createElement("img", {
|
|
213
|
+
src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png",
|
|
214
|
+
alt: ""
|
|
215
|
+
}) : null));
|
|
216
|
+
})), type === 'rightColumn' ? React__default.createElement("div", {
|
|
217
|
+
className: b('sidebar')
|
|
218
|
+
}, React__default.createElement("div", {
|
|
219
|
+
className: "key-board-wrapper"
|
|
220
|
+
}, React__default.createElement("div", {
|
|
221
|
+
className: classNames({
|
|
222
|
+
key: true,
|
|
223
|
+
active: clickKeyIndex === 'delete'
|
|
224
|
+
}),
|
|
225
|
+
onTouchStart: function onTouchStart(event) {
|
|
226
|
+
return onTouchstart({
|
|
227
|
+
id: 'delete',
|
|
228
|
+
type: 'delete'
|
|
229
|
+
}, event);
|
|
230
|
+
},
|
|
231
|
+
onTouchMove: onTouchMove,
|
|
232
|
+
onTouchEnd: onTouchEnd
|
|
233
|
+
}, React__default.createElement("img", {
|
|
234
|
+
src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png",
|
|
235
|
+
alt: ""
|
|
236
|
+
}))), React__default.createElement("div", {
|
|
237
|
+
className: "key-board-wrapper key-board-finish",
|
|
238
|
+
onClick: onClose
|
|
239
|
+
}, React__default.createElement("div", {
|
|
240
|
+
className: classNames({
|
|
241
|
+
key: true,
|
|
242
|
+
finish: true,
|
|
243
|
+
activeFinsh: clickKeyIndex === 'finish'
|
|
244
|
+
})
|
|
245
|
+
}, confirmText || locale.done))) : null))));
|
|
246
|
+
};
|
|
247
|
+
NumberKeyboard.defaultProps = defaultProps;
|
|
248
|
+
NumberKeyboard.displayName = 'NutNumberKeyboard';
|
|
19
249
|
export { NumberKeyboard as default };
|
package/dist/esm/Overlay.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { O as Overlay } from './overlay
|
|
1
|
+
import { O as Overlay } from './overlay-de6c79d5.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import 'classnames';
|
|
4
|
-
import './bem-
|
|
4
|
+
import './bem-3b438e61.js';
|
|
5
5
|
import '@bem-react/classname';
|
|
6
|
-
import '@tarojs/components';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
6
|
export { Overlay as default };
|