@nutui/nutui-react 2.3.12-beta.0 → 2.3.12
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 +18 -0
- package/dist/esm/ActionSheet.js +30 -76
- package/dist/esm/Address.js +80 -171
- package/dist/esm/Animate.js +21 -49
- package/dist/esm/AnimatingNumbers.js +47 -120
- package/dist/esm/Audio.js +88 -159
- package/dist/esm/Avatar.js +44 -91
- package/dist/esm/AvatarCropper.js +149 -268
- package/dist/esm/AvatarGroup.js +13 -44
- package/dist/esm/BackTop.js +34 -75
- package/dist/esm/Barrage.js +49 -83
- package/dist/esm/Calendar.js +27 -119
- package/dist/esm/CalendarCard.js +180 -291
- package/dist/esm/CalendarItem.js +253 -314
- package/dist/esm/Card.js +38 -72
- package/dist/esm/Cell.js +27 -62
- package/dist/esm/CellGroup.js +16 -45
- package/dist/esm/CheckboxGroup.js +49 -85
- package/dist/esm/CircleProgress.js +42 -93
- package/dist/esm/Col.js +17 -48
- package/dist/esm/Collapse.js +18 -49
- package/dist/esm/ConfigProvider.js +3 -2
- package/dist/esm/CountDown.js +62 -101
- package/dist/esm/DatePicker.js +87 -127
- package/dist/esm/Dialog.js +116 -196
- package/dist/esm/Divider.js +16 -36
- package/dist/esm/Drag.js +32 -76
- package/dist/esm/Elevator.js +93 -133
- package/dist/esm/Ellipsis.js +71 -92
- package/dist/esm/Empty.js +31 -70
- package/dist/esm/FixedNav.js +32 -81
- package/dist/esm/Form.js +28 -61
- package/dist/esm/Grid.js +27 -51
- package/dist/esm/Image.js +47 -102
- package/dist/esm/ImagePreview.js +82 -135
- package/dist/esm/InfiniteLoading.js +77 -159
- package/dist/esm/Input.js +57 -125
- package/dist/esm/InputNumber.js +66 -96
- package/dist/esm/Layout.js +4 -28
- package/dist/esm/Loading.js +13 -40
- package/dist/esm/Menu.js +51 -105
- package/dist/esm/NavBar.js +46 -85
- package/dist/esm/NoticeBar.js +153 -226
- package/dist/esm/Notify.js +87 -178
- package/dist/esm/NumberKeyboard.js +84 -150
- package/dist/esm/Pagination.js +58 -97
- package/dist/esm/Picker.js +215 -276
- package/dist/esm/Popover.js +111 -159
- package/dist/esm/Price.js +23 -60
- package/dist/esm/Progress.js +47 -77
- package/dist/esm/PullToRefresh.js +94 -201
- package/dist/esm/RadioGroup.js +23 -53
- package/dist/esm/Range.js +113 -177
- package/dist/esm/Rate.js +48 -95
- package/dist/esm/Row.js +19 -43
- package/dist/esm/SearchBar.js +52 -119
- package/dist/esm/ShortPassword.js +58 -106
- package/dist/esm/SideNavBar.js +34 -59
- package/dist/esm/SideNavBarItem.js +7 -36
- package/dist/esm/Signature.js +49 -84
- package/dist/esm/Skeleton.js +31 -68
- package/dist/esm/Space.js +7 -34
- package/dist/esm/Step.js +35 -64
- package/dist/esm/Steps.js +16 -40
- package/dist/esm/Sticky.js +64 -108
- package/dist/esm/SubSideNavBar.js +42 -71
- package/dist/esm/Swipe.js +79 -143
- package/dist/esm/Swiper.js +136 -183
- package/dist/esm/SwiperItem.js +13 -38
- package/dist/esm/Switch.js +20 -53
- package/dist/esm/TabPane.js +6 -30
- package/dist/esm/Tabbar.js +29 -59
- package/dist/esm/Table.js +92 -141
- package/dist/esm/Tag.js +30 -74
- package/dist/esm/TextArea.js +37 -82
- package/dist/esm/TimeDetail.js +20 -58
- package/dist/esm/TimeSelect.js +57 -95
- package/dist/esm/Toast.js +110 -197
- package/dist/esm/Tour.js +88 -132
- package/dist/esm/TrendArrow.js +32 -74
- package/dist/esm/Uploader.js +226 -346
- package/dist/esm/UserContext.js +1 -1
- package/dist/esm/Video.js +34 -67
- package/dist/esm/VirtualList.js +127 -160
- package/dist/esm/WaterMark.js +24 -68
- package/dist/esm/badge2.js +23 -53
- package/dist/esm/button2.js +30 -63
- package/dist/esm/can-use-dom.js +1 -1
- package/dist/esm/cascader2.js +307 -536
- package/dist/esm/checkbox2.js +59 -96
- package/dist/esm/collapseitem2.js +48 -86
- package/dist/esm/configprovider2.js +43 -1003
- package/dist/esm/context.js +1 -1
- package/dist/esm/context2.js +1 -1
- package/dist/esm/context3.js +1 -1
- package/dist/esm/context4.js +1 -1
- package/dist/esm/context5.js +8 -8
- package/dist/esm/date.js +88 -66
- package/dist/esm/formitem2.js +236 -1510
- package/dist/esm/get-scroll-parent.js +8 -10
- package/dist/esm/griditem2.js +34 -52
- package/dist/esm/index.js +5 -12
- package/dist/esm/indicator2.js +13 -42
- package/dist/esm/menuitem2.js +81 -124
- package/dist/esm/overlay2.js +39 -78
- package/dist/esm/pad-zero.js +3 -4
- package/dist/esm/popup2.js +79 -124
- package/dist/esm/px-check.js +2 -2
- package/dist/esm/radio2.js +48 -79
- package/dist/esm/raf.js +5 -3
- package/dist/esm/render.js +17 -54
- package/dist/esm/safearea2.js +3 -5
- package/dist/esm/supports-passive.js +3 -3
- package/dist/esm/tabbaritem2.js +42 -58
- package/dist/esm/tabs2.js +82 -120
- package/dist/esm/tslib.es6.js +47 -0
- package/dist/esm/types/src/packages/button/demos/h5/demo1.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/h5/demo2.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/h5/demo3.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/h5/demo4.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/h5/demo5.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/h5/demo6.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/h5/demo7.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/h5/demo8.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/h5/demo9.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/taro/demo1.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/taro/demo10.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/taro/demo2.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/taro/demo3.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/taro/demo4.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/taro/demo5.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/taro/demo6.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/taro/demo7.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/taro/demo8.d.ts +3 -0
- package/dist/esm/types/src/packages/button/demos/taro/demo9.d.ts +3 -0
- package/dist/esm/types/src/packages/configprovider/configprovider.d.ts +1 -0
- package/dist/esm/types/src/packages/configprovider/configprovider.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/configprovider/index.d.ts +2 -2
- package/dist/esm/types/src/packages/configprovider/index.taro.d.ts +2 -2
- package/dist/esm/types/src/packages/inputnumber/inputnumber.taro.d.ts +2 -0
- package/dist/esm/typings.js +1 -1
- package/dist/esm/use-click-away.js +9 -13
- package/dist/esm/use-client-rect.js +4 -4
- package/dist/esm/use-props-value.js +10 -15
- package/dist/esm/use-refs.js +5 -7
- package/dist/esm/use-touch.js +16 -20
- 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/tr-TR.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.es.js +242 -284
- package/dist/nutui.react.umd.js +239 -281
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +4 -0
- package/dist/types/packages/button/demos/h5/demo1.d.ts +3 -0
- package/dist/types/packages/button/demos/h5/demo2.d.ts +3 -0
- package/dist/types/packages/button/demos/h5/demo3.d.ts +3 -0
- package/dist/types/packages/button/demos/h5/demo4.d.ts +3 -0
- package/dist/types/packages/button/demos/h5/demo5.d.ts +3 -0
- package/dist/types/packages/button/demos/h5/demo6.d.ts +3 -0
- package/dist/types/packages/button/demos/h5/demo7.d.ts +3 -0
- package/dist/types/packages/button/demos/h5/demo8.d.ts +3 -0
- package/dist/types/packages/button/demos/h5/demo9.d.ts +3 -0
- package/dist/types/packages/button/demos/taro/demo1.d.ts +3 -0
- package/dist/types/packages/button/demos/taro/demo10.d.ts +3 -0
- package/dist/types/packages/button/demos/taro/demo2.d.ts +3 -0
- package/dist/types/packages/button/demos/taro/demo3.d.ts +3 -0
- package/dist/types/packages/button/demos/taro/demo4.d.ts +3 -0
- package/dist/types/packages/button/demos/taro/demo5.d.ts +3 -0
- package/dist/types/packages/button/demos/taro/demo6.d.ts +3 -0
- package/dist/types/packages/button/demos/taro/demo7.d.ts +3 -0
- package/dist/types/packages/button/demos/taro/demo8.d.ts +3 -0
- package/dist/types/packages/button/demos/taro/demo9.d.ts +3 -0
- package/dist/types/packages/configprovider/configprovider.d.ts +1 -0
- package/dist/types/packages/configprovider/configprovider.taro.d.ts +1 -0
- package/dist/types/packages/configprovider/index.d.ts +2 -2
- package/dist/types/packages/configprovider/index.taro.d.ts +2 -2
- package/dist/types/packages/empty/empty.d.ts +15 -3
- package/dist/types/packages/inputnumber/inputnumber.taro.d.ts +2 -0
- package/dist/types/packages/rate/rate.d.ts +1 -1
- package/package.json +5 -1
package/dist/esm/Notify.js
CHANGED
|
@@ -1,143 +1,81 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
function ownKeys(e, r) {
|
|
9
|
-
var t = Object.keys(e);
|
|
10
|
-
if (Object.getOwnPropertySymbols) {
|
|
11
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
12
|
-
r && (o = o.filter(function(r2) {
|
|
13
|
-
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
14
|
-
})), t.push.apply(t, o);
|
|
15
|
-
}
|
|
16
|
-
return t;
|
|
17
|
-
}
|
|
18
|
-
function _objectSpread(e) {
|
|
19
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
20
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
21
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
22
|
-
_defineProperty(e, r2, t[r2]);
|
|
23
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
24
|
-
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return e;
|
|
28
|
-
}
|
|
29
|
-
function _callSuper(t, o, e) {
|
|
30
|
-
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
31
|
-
}
|
|
32
|
-
function _isNativeReflectConstruct() {
|
|
33
|
-
try {
|
|
34
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
35
|
-
}));
|
|
36
|
-
} catch (t2) {
|
|
37
|
-
}
|
|
38
|
-
return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() {
|
|
39
|
-
return !!t;
|
|
40
|
-
})();
|
|
41
|
-
}
|
|
42
1
|
import * as React from "react";
|
|
43
2
|
import classNames from "classnames";
|
|
44
3
|
import { CSSTransition } from "react-transition-group";
|
|
45
4
|
import { r as render, u as unmount } from "./render.js";
|
|
46
5
|
import { C as ComponentDefaults } from "./typings.js";
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
_this.startCloseTimer = _this.startCloseTimer.bind(_assertThisInitialized(_this));
|
|
57
|
-
_this.clearCloseTimer = _this.clearCloseTimer.bind(_assertThisInitialized(_this));
|
|
58
|
-
_this.clickCover = _this.clickCover.bind(_assertThisInitialized(_this));
|
|
59
|
-
_this.state = {
|
|
6
|
+
const classPrefix = "nut-notify";
|
|
7
|
+
class Notification extends React.PureComponent {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
this.close = this.close.bind(this);
|
|
11
|
+
this.startCloseTimer = this.startCloseTimer.bind(this);
|
|
12
|
+
this.clearCloseTimer = this.clearCloseTimer.bind(this);
|
|
13
|
+
this.clickCover = this.clickCover.bind(this);
|
|
14
|
+
this.state = {
|
|
60
15
|
show: true
|
|
61
16
|
};
|
|
62
|
-
return _this;
|
|
63
17
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.
|
|
71
|
-
|
|
72
|
-
var element = document.getElementById(this.props.id);
|
|
73
|
-
element && element.parentNode && element.parentNode.removeChild(element);
|
|
74
|
-
}
|
|
75
|
-
this.props.onClose();
|
|
76
|
-
}
|
|
77
|
-
}, {
|
|
78
|
-
key: "startCloseTimer",
|
|
79
|
-
value: function startCloseTimer() {
|
|
80
|
-
var _this2 = this;
|
|
81
|
-
var duration = this.props.duration;
|
|
82
|
-
if (duration) {
|
|
83
|
-
this.closeTimer = window.setTimeout(function() {
|
|
84
|
-
_this2.close();
|
|
85
|
-
}, duration);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
key: "clearCloseTimer",
|
|
90
|
-
value: function clearCloseTimer() {
|
|
91
|
-
if (this.closeTimer) {
|
|
92
|
-
clearTimeout(this.closeTimer);
|
|
93
|
-
this.closeTimer = -1;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}, {
|
|
97
|
-
key: "clickCover",
|
|
98
|
-
value: function clickCover() {
|
|
99
|
-
this.props.onClick();
|
|
100
|
-
}
|
|
101
|
-
}, {
|
|
102
|
-
key: "componentDidMount",
|
|
103
|
-
value: function componentDidMount() {
|
|
104
|
-
this.startCloseTimer();
|
|
18
|
+
close() {
|
|
19
|
+
this.setState({
|
|
20
|
+
show: false
|
|
21
|
+
});
|
|
22
|
+
this.clearCloseTimer();
|
|
23
|
+
if (this.props.id) {
|
|
24
|
+
const element = document.getElementById(this.props.id);
|
|
25
|
+
element && element.parentNode && element.parentNode.removeChild(element);
|
|
105
26
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
27
|
+
this.props.onClose();
|
|
28
|
+
}
|
|
29
|
+
startCloseTimer() {
|
|
30
|
+
const { duration } = this.props;
|
|
31
|
+
if (duration) {
|
|
32
|
+
this.closeTimer = window.setTimeout(() => {
|
|
33
|
+
this.close();
|
|
34
|
+
}, duration);
|
|
110
35
|
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
var classes = classNames(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(classPrefix, "-popup-top"), position === "top"), "".concat(classPrefix, "-popup-bottom"), position === "bottom"), "".concat(classPrefix), true), "".concat(classPrefix, "-").concat(type), true));
|
|
117
|
-
return React.createElement(React.Fragment, null, React.createElement(CSSTransition, {
|
|
118
|
-
"in": show,
|
|
119
|
-
timeout: 300,
|
|
120
|
-
classNames: "fade",
|
|
121
|
-
unmountOnExit: true,
|
|
122
|
-
appear: true,
|
|
123
|
-
position
|
|
124
|
-
}, React.createElement("div", {
|
|
125
|
-
className: "".concat(classes, " ").concat(className),
|
|
126
|
-
style,
|
|
127
|
-
onClick: this.clickCover
|
|
128
|
-
}, message)));
|
|
36
|
+
}
|
|
37
|
+
clearCloseTimer() {
|
|
38
|
+
if (this.closeTimer) {
|
|
39
|
+
clearTimeout(this.closeTimer);
|
|
40
|
+
this.closeTimer = -1;
|
|
129
41
|
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
42
|
+
}
|
|
43
|
+
clickCover() {
|
|
44
|
+
this.props.onClick();
|
|
45
|
+
}
|
|
46
|
+
componentDidMount() {
|
|
47
|
+
this.startCloseTimer();
|
|
48
|
+
}
|
|
49
|
+
componentWillUnmount() {
|
|
50
|
+
this.clearCloseTimer();
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
const { style, message, type, className, position } = this.props;
|
|
54
|
+
const { show } = this.state;
|
|
55
|
+
const classes = classNames({
|
|
56
|
+
[`${classPrefix}-popup-top`]: position === "top",
|
|
57
|
+
[`${classPrefix}-popup-bottom`]: position === "bottom",
|
|
58
|
+
[`${classPrefix}`]: true,
|
|
59
|
+
[`${classPrefix}-${type}`]: true
|
|
60
|
+
});
|
|
61
|
+
return React.createElement(
|
|
62
|
+
React.Fragment,
|
|
63
|
+
null,
|
|
64
|
+
React.createElement(
|
|
65
|
+
CSSTransition,
|
|
66
|
+
{ in: show, timeout: 300, classNames: "fade", unmountOnExit: true, appear: true, position },
|
|
67
|
+
React.createElement("div", { className: `${classes} ${className}`, style, onClick: this.clickCover }, message)
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
Notification.newInstance = (properties, callback) => {
|
|
73
|
+
const element = document.createElement("div");
|
|
74
|
+
const id = properties.id ? properties.id : `${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
137
75
|
element.id = id;
|
|
138
76
|
properties.id = id;
|
|
139
77
|
document.body.appendChild(element);
|
|
140
|
-
|
|
78
|
+
let called = false;
|
|
141
79
|
function ref(instance) {
|
|
142
80
|
if (called) {
|
|
143
81
|
return;
|
|
@@ -145,91 +83,62 @@ Notification.newInstance = function(properties, callback) {
|
|
|
145
83
|
called = true;
|
|
146
84
|
callback({
|
|
147
85
|
component: instance,
|
|
148
|
-
destroy
|
|
149
|
-
setTimeout(
|
|
86
|
+
destroy() {
|
|
87
|
+
setTimeout(() => {
|
|
150
88
|
unmount(element);
|
|
151
89
|
element && element.parentNode && element.parentNode.removeChild(element);
|
|
152
90
|
}, 300);
|
|
153
91
|
}
|
|
154
92
|
});
|
|
155
93
|
}
|
|
156
|
-
render(React.createElement(Notification,
|
|
157
|
-
ref
|
|
158
|
-
})), element);
|
|
94
|
+
render(React.createElement(Notification, Object.assign({}, properties, { ref })), element);
|
|
159
95
|
};
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
type: "danger",
|
|
165
|
-
position: "top",
|
|
166
|
-
onClose: function onClose() {
|
|
167
|
-
},
|
|
168
|
-
onClick: function onClick() {
|
|
169
|
-
}
|
|
170
|
-
});
|
|
96
|
+
let messageInstance = null;
|
|
97
|
+
const options = Object.assign(Object.assign({}, ComponentDefaults), { id: "", duration: 3e3, type: "danger", position: "top", onClose: () => {
|
|
98
|
+
}, onClick: () => {
|
|
99
|
+
} });
|
|
171
100
|
function getInstance(props, callback) {
|
|
172
101
|
if (messageInstance) {
|
|
173
102
|
messageInstance.destroy();
|
|
174
103
|
messageInstance = null;
|
|
175
104
|
}
|
|
176
|
-
Notification.newInstance(props,
|
|
105
|
+
Notification.newInstance(props, (notification) => {
|
|
177
106
|
return callback && callback(notification);
|
|
178
107
|
});
|
|
179
108
|
}
|
|
180
109
|
function notice(opts) {
|
|
181
|
-
opts =
|
|
182
|
-
getInstance(opts,
|
|
110
|
+
opts = Object.assign(Object.assign({}, options), opts);
|
|
111
|
+
getInstance(opts, (notification) => {
|
|
183
112
|
messageInstance = notification;
|
|
184
113
|
});
|
|
185
114
|
}
|
|
186
|
-
|
|
115
|
+
const errorMsg = (message) => {
|
|
187
116
|
if (!message) {
|
|
188
117
|
console.warn("[NutUI Notify]: message不能为空");
|
|
189
118
|
}
|
|
190
119
|
};
|
|
191
|
-
|
|
192
|
-
text
|
|
193
|
-
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
120
|
+
const Notify = {
|
|
121
|
+
text(message, option = {}) {
|
|
194
122
|
errorMsg(message);
|
|
195
|
-
return notice(
|
|
196
|
-
message,
|
|
197
|
-
type: "base"
|
|
198
|
-
}, option));
|
|
123
|
+
return notice(Object.assign({ message, type: "base" }, option));
|
|
199
124
|
},
|
|
200
|
-
success
|
|
201
|
-
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
125
|
+
success(message, option = {}) {
|
|
202
126
|
errorMsg(message);
|
|
203
|
-
return notice(
|
|
204
|
-
message,
|
|
205
|
-
type: "success"
|
|
206
|
-
}, option));
|
|
127
|
+
return notice(Object.assign({ message, type: "success" }, option));
|
|
207
128
|
},
|
|
208
|
-
primary
|
|
209
|
-
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
129
|
+
primary(message, option = {}) {
|
|
210
130
|
errorMsg(message);
|
|
211
|
-
return notice(
|
|
212
|
-
message,
|
|
213
|
-
type: "primary"
|
|
214
|
-
}, option));
|
|
131
|
+
return notice(Object.assign({ message, type: "primary" }, option));
|
|
215
132
|
},
|
|
216
|
-
danger
|
|
217
|
-
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
133
|
+
danger(message, option = {}) {
|
|
218
134
|
errorMsg(message);
|
|
219
|
-
return notice(
|
|
220
|
-
message,
|
|
221
|
-
type: "danger"
|
|
222
|
-
}, option));
|
|
135
|
+
return notice(Object.assign({ message, type: "danger" }, option));
|
|
223
136
|
},
|
|
224
|
-
warn
|
|
225
|
-
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
137
|
+
warn(message, option = {}) {
|
|
226
138
|
errorMsg(message);
|
|
227
|
-
return notice(
|
|
228
|
-
message,
|
|
229
|
-
type: "warning"
|
|
230
|
-
}, option));
|
|
139
|
+
return notice(Object.assign({ message, type: "warning" }, option));
|
|
231
140
|
},
|
|
232
|
-
hide
|
|
141
|
+
hide() {
|
|
233
142
|
if (messageInstance) {
|
|
234
143
|
messageInstance.destroy();
|
|
235
144
|
messageInstance = null;
|
|
@@ -1,115 +1,65 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
-
var _excluded = ["title", "rightActions", "confirmText", "visible", "type", "custom", "random", "style", "className", "onChange", "onDelete", "onClose", "onConfirm"];
|
|
6
|
-
function ownKeys(e, r) {
|
|
7
|
-
var t = Object.keys(e);
|
|
8
|
-
if (Object.getOwnPropertySymbols) {
|
|
9
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
10
|
-
r && (o = o.filter(function(r2) {
|
|
11
|
-
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
12
|
-
})), t.push.apply(t, o);
|
|
13
|
-
}
|
|
14
|
-
return t;
|
|
15
|
-
}
|
|
16
|
-
function _objectSpread(e) {
|
|
17
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
18
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
19
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
20
|
-
_defineProperty(e, r2, t[r2]);
|
|
21
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
22
|
-
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return e;
|
|
26
|
-
}
|
|
1
|
+
import { _ as __rest } from "./tslib.es6.js";
|
|
27
2
|
import React__default, { useMemo, useState } from "react";
|
|
28
3
|
import classNames from "classnames";
|
|
29
4
|
import { ArrowDown } from "@nutui/icons-react";
|
|
30
5
|
import Popup from "./Popup.js";
|
|
31
6
|
import { useConfig } from "./ConfigProvider.js";
|
|
32
7
|
import { C as ComponentDefaults } from "./typings.js";
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
custom
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
var NumberKeyboard = function NumberKeyboard2(props) {
|
|
43
|
-
var _useConfig = useConfig(), locale = _useConfig.locale;
|
|
44
|
-
var title = props.title, rightActions = props.rightActions, confirmText = props.confirmText, visible = props.visible, type = props.type, custom = props.custom, random = props.random, style = props.style, className = props.className, onChange = props.onChange, onDelete = props.onDelete, onClose2 = props.onClose, onConfirm = props.onConfirm, rest = _objectWithoutProperties(props, _excluded);
|
|
45
|
-
var classPrefix = "nut-numberkeyboard";
|
|
46
|
-
var getBasicKeys = function getBasicKeys2() {
|
|
47
|
-
var keys = new Array(9).fill(0).map(function(_, index) {
|
|
8
|
+
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { visible: false, rightActions: "", type: "default", custom: [], random: false, onClose: () => {
|
|
9
|
+
} });
|
|
10
|
+
const NumberKeyboard = (props) => {
|
|
11
|
+
const { locale } = useConfig();
|
|
12
|
+
const { title, rightActions, confirmText, visible, type, custom, random, style, className, onChange, onDelete, onClose, onConfirm } = props, rest = __rest(props, ["title", "rightActions", "confirmText", "visible", "type", "custom", "random", "style", "className", "onChange", "onDelete", "onClose", "onConfirm"]);
|
|
13
|
+
const classPrefix = "nut-numberkeyboard";
|
|
14
|
+
const getBasicKeys = () => {
|
|
15
|
+
const keys = new Array(9).fill(0).map((_, index) => {
|
|
48
16
|
return {
|
|
49
17
|
id: String(index + 1),
|
|
50
18
|
type: "num"
|
|
51
19
|
};
|
|
52
20
|
});
|
|
53
|
-
return random ? keys.sort(
|
|
54
|
-
return Math.random() > 0.5 ? 1 : -1;
|
|
55
|
-
}) : keys;
|
|
21
|
+
return random ? keys.sort(() => Math.random() > 0.5 ? 1 : -1) : keys;
|
|
56
22
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
id: "close",
|
|
60
|
-
type: "
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
type: "num"
|
|
64
|
-
}, {
|
|
65
|
-
id: "delete",
|
|
66
|
-
type: "delete"
|
|
67
|
-
}];
|
|
23
|
+
const getCustomKeys = () => {
|
|
24
|
+
const customKeys = [
|
|
25
|
+
{ id: "close", type: "close" },
|
|
26
|
+
{ id: "0", type: "num" },
|
|
27
|
+
{ id: "delete", type: "delete" }
|
|
28
|
+
];
|
|
68
29
|
if (!custom)
|
|
69
30
|
return customKeys;
|
|
70
31
|
if (custom.length > 0) {
|
|
71
|
-
customKeys[0] = {
|
|
72
|
-
id: custom[0],
|
|
73
|
-
type: "custom"
|
|
74
|
-
};
|
|
32
|
+
customKeys[0] = { id: custom[0], type: "custom" };
|
|
75
33
|
}
|
|
76
34
|
if (custom.length > 1) {
|
|
77
|
-
customKeys[2] = {
|
|
78
|
-
id: custom[1],
|
|
79
|
-
type: "custom"
|
|
80
|
-
};
|
|
35
|
+
customKeys[2] = { id: custom[1], type: "custom" };
|
|
81
36
|
}
|
|
82
37
|
return customKeys;
|
|
83
38
|
};
|
|
84
|
-
|
|
85
|
-
return [
|
|
39
|
+
const keysList = useMemo(() => {
|
|
40
|
+
return [...getBasicKeys(), ...getCustomKeys()];
|
|
86
41
|
}, [type, random, custom]);
|
|
87
|
-
|
|
88
|
-
return React__default.createElement(
|
|
89
|
-
|
|
90
|
-
width: "28",
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
fill: "currentColor"
|
|
95
|
-
}), React__default.createElement("path", {
|
|
96
|
-
d: "M753.945 360.214l-121.43 121.429-121.43-121.429s-16.062-8.224-30.356 6.072c-14.295 14.295-6.073 30.357-6.073 30.357l121.43 121.428L486.8 627.357s-8.222 16.062 6.072 30.357c14.297 14.296 30.358 6.072 30.358 6.072l109.286-109.285 109.286 109.285s16.062 8.224 30.357-6.072c14.295-14.295 6.07-30.357 6.07-30.357L668.944 518.072l121.431-121.43s8.22-16.061-6.074-30.356c-14.294-14.296-30.356-6.072-30.356-6.072z",
|
|
97
|
-
fill: "currentColor"
|
|
98
|
-
}));
|
|
42
|
+
const DeleteIcon = () => {
|
|
43
|
+
return React__default.createElement(
|
|
44
|
+
"svg",
|
|
45
|
+
{ viewBox: "0 0 1024 1024", width: "28", height: "28" },
|
|
46
|
+
React__default.createElement("path", { d: "M875.594 186.122H390.803a51.162 51.162 0 0 0-36.18 14.986L79.91 475.821a51.166 51.166 0 0 0 0 72.358l274.714 274.712a51.164 51.164 0 0 0 36.179 14.986h484.791c46.033 0 83.484-37.45 83.484-83.483V269.606c.001-46.033-37.45-83.484-83.483-83.484zm32.32 568.274c0 17.85-14.473 32.318-32.32 32.318H390.803L116.089 512l274.714-274.714h484.791c17.849 0 32.32 14.47 32.32 32.32v484.789z", fill: "currentColor" }),
|
|
47
|
+
React__default.createElement("path", { d: "M753.945 360.214l-121.43 121.429-121.43-121.429s-16.062-8.224-30.356 6.072c-14.295 14.295-6.073 30.357-6.073 30.357l121.43 121.428L486.8 627.357s-8.222 16.062 6.072 30.357c14.297 14.296 30.358 6.072 30.358 6.072l109.286-109.285 109.286 109.285s16.062 8.224 30.357-6.072c14.295-14.295 6.07-30.357 6.07-30.357L668.944 518.072l121.431-121.43s8.22-16.061-6.074-30.356c-14.294-14.296-30.356-6.072-30.356-6.072z", fill: "currentColor" })
|
|
48
|
+
);
|
|
99
49
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
50
|
+
const NumberKeyboardKey = (props2) => {
|
|
51
|
+
const { item } = props2;
|
|
52
|
+
const [active, setActive] = useState(false);
|
|
53
|
+
const onTouchStart = () => {
|
|
104
54
|
setActive(true);
|
|
105
55
|
};
|
|
106
|
-
|
|
56
|
+
const onTouchEnd = (item2) => {
|
|
107
57
|
setActive(false);
|
|
108
58
|
if (item2.type === "num" || item2.type === "custom") {
|
|
109
59
|
onChange && onChange(item2.id);
|
|
110
60
|
}
|
|
111
61
|
if (item2.type === "close") {
|
|
112
|
-
|
|
62
|
+
onClose && onClose();
|
|
113
63
|
}
|
|
114
64
|
if (item2.type === "delete") {
|
|
115
65
|
onDelete && onDelete();
|
|
@@ -118,74 +68,58 @@ var NumberKeyboard = function NumberKeyboard2(props) {
|
|
|
118
68
|
onConfirm && onConfirm();
|
|
119
69
|
}
|
|
120
70
|
};
|
|
121
|
-
return React__default.createElement(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return _onTouchEnd(item);
|
|
140
|
-
}
|
|
141
|
-
}, (item.type === "num" || item.type === "custom") && React__default.createElement("div", null, item.id), item.type === "delete" && React__default.createElement(DeleteIcon, null), item.type === "close" && React__default.createElement(ArrowDown, {
|
|
142
|
-
width: 18,
|
|
143
|
-
height: 18
|
|
144
|
-
}), item.type === "confirm" && React__default.createElement(React__default.Fragment, null, confirmText || locale.done)));
|
|
71
|
+
return React__default.createElement(
|
|
72
|
+
"div",
|
|
73
|
+
{ key: item.id, className: `${classPrefix}-body-wrapper` },
|
|
74
|
+
React__default.createElement(
|
|
75
|
+
"div",
|
|
76
|
+
{ className: classNames({
|
|
77
|
+
key: true,
|
|
78
|
+
active,
|
|
79
|
+
close: item.type === "close",
|
|
80
|
+
delete: item.type === "delete",
|
|
81
|
+
confirm: item.type === "confirm"
|
|
82
|
+
}), onTouchStart: () => onTouchStart(), onTouchEnd: () => onTouchEnd(item), onTouchCancel: () => onTouchEnd(item) },
|
|
83
|
+
(item.type === "num" || item.type === "custom") && React__default.createElement("div", null, item.id),
|
|
84
|
+
item.type === "delete" && React__default.createElement(DeleteIcon, null),
|
|
85
|
+
item.type === "close" && React__default.createElement(ArrowDown, { width: 18, height: 18 }),
|
|
86
|
+
item.type === "confirm" && React__default.createElement(React__default.Fragment, null, confirmText || locale.done)
|
|
87
|
+
)
|
|
88
|
+
);
|
|
145
89
|
};
|
|
146
|
-
return React__default.createElement(
|
|
147
|
-
|
|
148
|
-
position: "bottom",
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
id: "delete",
|
|
180
|
-
type: "delete"
|
|
181
|
-
}
|
|
182
|
-
}), React__default.createElement(NumberKeyboardKey, {
|
|
183
|
-
key: "confirm",
|
|
184
|
-
item: {
|
|
185
|
-
id: "confirm",
|
|
186
|
-
type: "confirm"
|
|
187
|
-
}
|
|
188
|
-
})))));
|
|
90
|
+
return React__default.createElement(
|
|
91
|
+
Popup,
|
|
92
|
+
Object.assign({ visible, position: "bottom", onOverlayClick: onClose, onCloseIconClick: onClose, zIndex: 9999, overlayStyle: { backgroundColor: "rgba(0, 0, 0, 0)" } }, rest),
|
|
93
|
+
React__default.createElement(
|
|
94
|
+
"div",
|
|
95
|
+
{ className: classNames(classPrefix, className), style },
|
|
96
|
+
title && React__default.createElement(
|
|
97
|
+
"div",
|
|
98
|
+
{ className: `${classPrefix}-header` },
|
|
99
|
+
React__default.createElement("div", { className: `${classPrefix}-header-title` }, title),
|
|
100
|
+
type === "default" && React__default.createElement("span", { className: `${classPrefix}-header-close`, onClick: onConfirm }, rightActions || locale.done)
|
|
101
|
+
),
|
|
102
|
+
React__default.createElement(
|
|
103
|
+
"div",
|
|
104
|
+
{ className: `${classPrefix}-body` },
|
|
105
|
+
React__default.createElement("div", { className: `${classPrefix}-body-keys` }, keysList === null || keysList === void 0 ? void 0 : keysList.map((item) => {
|
|
106
|
+
return React__default.createElement(NumberKeyboardKey, { key: item.id, item });
|
|
107
|
+
})),
|
|
108
|
+
type === "rightColumn" && React__default.createElement(
|
|
109
|
+
"div",
|
|
110
|
+
{ className: `${classPrefix}-sidebar` },
|
|
111
|
+
React__default.createElement(NumberKeyboardKey, { key: "delete", item: {
|
|
112
|
+
id: "delete",
|
|
113
|
+
type: "delete"
|
|
114
|
+
} }),
|
|
115
|
+
React__default.createElement(NumberKeyboardKey, { key: "confirm", item: {
|
|
116
|
+
id: "confirm",
|
|
117
|
+
type: "confirm"
|
|
118
|
+
} })
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
)
|
|
122
|
+
);
|
|
189
123
|
};
|
|
190
124
|
NumberKeyboard.defaultProps = defaultProps;
|
|
191
125
|
NumberKeyboard.displayName = "NutNumberKeyboard";
|