@nutui/nutui-react 2.0.0-alpha.1 → 2.0.0-alpha.3
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 +26 -0
- package/dist/esm/Address.js +1 -1
- package/dist/esm/Animate.js +6 -7
- package/dist/esm/Badge.js +15 -22
- package/dist/esm/CalendarItem.js +2 -12
- package/dist/esm/Cascader.js +4 -2
- package/dist/esm/Dialog.js +162 -171
- package/dist/esm/Divider.js +4 -3
- package/dist/esm/Drag.js +7 -9
- package/dist/esm/Elevator.js +38 -41
- package/dist/esm/Menu.js +75 -73
- package/dist/esm/MenuItem.js +29 -27
- package/dist/esm/NavBar.js +17 -48
- package/dist/esm/Popup.js +2 -4
- package/dist/esm/Progress.js +20 -68
- package/dist/esm/Switch.js +16 -30
- package/dist/esm/TabPane.js +0 -2
- package/dist/esm/Tabs.js +2 -2
- package/dist/esm/Uploader.js +2 -3
- package/dist/esm/nutui-react.es.js +170 -170
- package/dist/esm/overlay2.js +12 -14
- package/dist/esm/raf.js +16 -0
- package/dist/esm/tabpane2.js +7 -9
- package/dist/esm/tabs2.js +101 -93
- 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 +18642 -19336
- package/dist/nutui.react.umd.js +18640 -19334
- package/dist/packages/badge/badge.scss +8 -17
- package/dist/packages/dialog/dialog.scss +36 -65
- package/dist/packages/elevator/elevator.scss +2 -28
- package/dist/packages/menu/menu.scss +44 -55
- package/dist/packages/menuitem/menuitem.scss +16 -26
- package/dist/packages/navbar/navbar.scss +16 -115
- package/dist/packages/overlay/overlay.scss +11 -4
- package/dist/packages/progress/progress.scss +19 -58
- package/dist/packages/switch/switch.scss +13 -31
- package/dist/packages/tabs/tabs.scss +196 -225
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/themes/default.scss +17 -17
- package/dist/styles/variables-jmapp.scss +35 -125
- package/dist/styles/variables.scss +53 -136
- package/dist/types/index.d.ts +343 -400
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
# v2.0.0-alpha.3
|
|
2
|
+
`2023-04-28`
|
|
3
|
+
|
|
4
|
+
* :bug: fix: overlay 属性 onClick 暴露、lockscroll 相关demo 修订 (#959) @xiaoyatong
|
|
5
|
+
* :bug: fix: 修改taro增加主题编译 (#950) @junjun666
|
|
6
|
+
* 🛠 refactor: dialog (#945) @xiaoyatong
|
|
7
|
+
* 🛠 refactor: switch (#941) @拧巴的猫
|
|
8
|
+
* 🛠 refactor: tabs (#939) @oasis-cloud
|
|
9
|
+
* 🔨 chore: website 2.0 (#955) @oasis-cloud
|
|
10
|
+
* 📖 docs: button 文档表格优化 (#956) @oasis-cloud
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# v2.0.0-alpha.2
|
|
14
|
+
`2023-04-26`
|
|
15
|
+
|
|
16
|
+
* 🛠 refactor: navbar (#890) @拧巴的猫
|
|
17
|
+
* 🛠 refactor: animate (#940) @junjun666
|
|
18
|
+
* 🛠 refactor: badge (#936) @xiaoyatong
|
|
19
|
+
* 🛠 refactor: drag (#937) @拧巴的猫
|
|
20
|
+
* 🛠 refactor: elevator (#927) @拧巴的猫
|
|
21
|
+
* 🛠 refactor: menu (#923) @oasis-cloud
|
|
22
|
+
* 🛠 refactor: progress (#943) @Eiinu
|
|
23
|
+
* 🔨 chore: sync pnpm-lock @oasis-cloud
|
|
24
|
+
* :bug: fix: 修改taro增加主题编译 (#950) @junjun666
|
|
25
|
+
|
|
26
|
+
|
|
1
27
|
# v2.0.0-alpha.1
|
|
2
28
|
`2023-04-21`
|
|
3
29
|
|
package/dist/esm/Address.js
CHANGED
|
@@ -348,7 +348,7 @@ var CustomRender = function CustomRender2(props) {
|
|
|
348
348
|
className: b("elevator-group")
|
|
349
349
|
}, React__default.createElement(Elevator, {
|
|
350
350
|
height,
|
|
351
|
-
|
|
351
|
+
list: regionList[tabName[tabIndex]],
|
|
352
352
|
onClickItem: handleElevatorItem
|
|
353
353
|
})));
|
|
354
354
|
};
|
package/dist/esm/Animate.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
var _excluded = ["className", "type", "action", "loop", "onClick", "children"];
|
|
5
5
|
function ownKeys(object, enumerableOnly) {
|
|
6
6
|
var keys = Object.keys(object);
|
|
@@ -25,23 +25,22 @@ function _objectSpread(target) {
|
|
|
25
25
|
}
|
|
26
26
|
import React__default, { useState } from "react";
|
|
27
27
|
import classNames from "classnames";
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
var defaultProps = {
|
|
28
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
29
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
31
30
|
type: "shake",
|
|
32
31
|
action: "initial",
|
|
33
32
|
loop: false,
|
|
34
33
|
onClick: function onClick(event) {
|
|
35
34
|
}
|
|
36
|
-
};
|
|
35
|
+
});
|
|
36
|
+
var classPrefix = "nut-animate";
|
|
37
37
|
var Animate = function Animate2(props) {
|
|
38
38
|
var _classNames;
|
|
39
39
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, type = _defaultProps$props.type, action = _defaultProps$props.action, loop = _defaultProps$props.loop, onClick2 = _defaultProps$props.onClick, children = _defaultProps$props.children, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
40
40
|
var _useState = useState(false), _useState2 = _slicedToArray(_useState, 2), clicked = _useState2[0], setClicked = _useState2[1];
|
|
41
|
-
var b = cn("animate");
|
|
42
41
|
var classes = classNames((_classNames = {
|
|
43
42
|
"nut-ani-container": true
|
|
44
|
-
}, _defineProperty(_classNames, "".concat(
|
|
43
|
+
}, _defineProperty(_classNames, "".concat(classPrefix, "-").concat(type), action === "initial" || clicked ? type : false), _defineProperty(_classNames, "loop", loop), _classNames));
|
|
45
44
|
var cls = classNames(classes, className);
|
|
46
45
|
var handleClick = function handleClick2(event) {
|
|
47
46
|
setClicked(true);
|
package/dist/esm/Badge.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
function ownKeys(object, enumerableOnly) {
|
|
3
4
|
var keys = Object.keys(object);
|
|
@@ -22,28 +23,23 @@ function _objectSpread(target) {
|
|
|
22
23
|
}
|
|
23
24
|
import React__default from "react";
|
|
24
25
|
import classNames from "classnames";
|
|
25
|
-
import { c as cn } from "./bem.js";
|
|
26
26
|
import { C as ComponentDefaults } from "./typings.js";
|
|
27
|
-
import "@bem-react/classname";
|
|
28
27
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
29
|
-
className: "",
|
|
30
28
|
value: "",
|
|
31
29
|
dot: false,
|
|
32
|
-
max:
|
|
30
|
+
max: 99,
|
|
33
31
|
top: "0",
|
|
34
|
-
right: "
|
|
35
|
-
|
|
36
|
-
color: "",
|
|
37
|
-
icon: null
|
|
32
|
+
right: "5",
|
|
33
|
+
color: ""
|
|
38
34
|
});
|
|
39
|
-
var b = cn("badge");
|
|
40
35
|
var Badge = function Badge2(props) {
|
|
41
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style,
|
|
36
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, value = _defaultProps$props.value, max = _defaultProps$props.max, children = _defaultProps$props.children, dot = _defaultProps$props.dot, top = _defaultProps$props.top, right = _defaultProps$props.right, color = _defaultProps$props.color;
|
|
37
|
+
var classPrefix = "nut-badge";
|
|
38
|
+
var classes = classNames(classPrefix, className);
|
|
39
|
+
var contentClasses = classNames(_defineProperty({}, "".concat(classPrefix, "__dot"), dot), "".concat(classPrefix, "__content"), "".concat(classPrefix, "__sup"));
|
|
42
40
|
function content() {
|
|
43
|
-
if (dot)
|
|
44
|
-
return
|
|
45
|
-
var value = props.value;
|
|
46
|
-
var max = props.max;
|
|
41
|
+
if (dot || _typeof(value) === "object")
|
|
42
|
+
return null;
|
|
47
43
|
if (typeof value === "number" && typeof max === "number") {
|
|
48
44
|
return max < value ? "".concat(max, "+") : value;
|
|
49
45
|
}
|
|
@@ -53,19 +49,16 @@ var Badge = function Badge2(props) {
|
|
|
53
49
|
var style2 = {};
|
|
54
50
|
style2.top = "".concat(Number(top) || parseFloat(top) || 0, "px");
|
|
55
51
|
style2.right = "".concat(Number(right) || parseFloat(right) || 0, "px");
|
|
56
|
-
style2.zIndex = zIndex;
|
|
57
52
|
style2.background = color;
|
|
58
53
|
return style2;
|
|
59
54
|
};
|
|
60
55
|
return React__default.createElement("div", {
|
|
61
|
-
className:
|
|
56
|
+
className: classes,
|
|
62
57
|
style
|
|
63
|
-
},
|
|
64
|
-
className: "
|
|
65
|
-
},
|
|
66
|
-
className:
|
|
67
|
-
"is-dot": dot
|
|
68
|
-
}, b("content"), "sup"),
|
|
58
|
+
}, _typeof(value) === "object" && value && React__default.createElement("div", {
|
|
59
|
+
className: "".concat(classPrefix, "__icon")
|
|
60
|
+
}, value), React__default.createElement("div", null, children), React__default.createElement("div", {
|
|
61
|
+
className: contentClasses,
|
|
69
62
|
style: getStyle()
|
|
70
63
|
}, content()));
|
|
71
64
|
};
|
package/dist/esm/CalendarItem.js
CHANGED
|
@@ -26,19 +26,9 @@ import React__default, { useState, useRef, useEffect } from "react";
|
|
|
26
26
|
import classNames from "classnames";
|
|
27
27
|
import { c as cn } from "./bem.js";
|
|
28
28
|
import { U as Utils } from "./date.js";
|
|
29
|
+
import { r as requestAniFrame } from "./raf.js";
|
|
29
30
|
import { useConfig } from "./ConfigProvider.js";
|
|
30
31
|
import "@bem-react/classname";
|
|
31
|
-
function requestAniFrame() {
|
|
32
|
-
if (typeof window !== "undefined") {
|
|
33
|
-
return window.requestAnimationFrame || function(callback) {
|
|
34
|
-
window.setTimeout(callback, 1e3 / 60);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
return function(callback) {
|
|
38
|
-
setTimeout(callback, 1e3 / 60);
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
var requestAniFrame$1 = requestAniFrame();
|
|
42
32
|
var defaultProps = {
|
|
43
33
|
type: "one",
|
|
44
34
|
isAutoBackFill: false,
|
|
@@ -510,7 +500,7 @@ var CalendarItem = React__default.forwardRef(function(props, ref) {
|
|
|
510
500
|
}
|
|
511
501
|
var lastItem = state.monthsData[state.monthsData.length - 1];
|
|
512
502
|
var containerHeight = lastItem.cssHeight + lastItem.cssScrollHeight;
|
|
513
|
-
requestAniFrame
|
|
503
|
+
requestAniFrame(function() {
|
|
514
504
|
if (months && monthsPanel && viewArea) {
|
|
515
505
|
viewHeight = months.current.clientHeight;
|
|
516
506
|
monthsPanel.current.style.height = "".concat(containerHeight, "px");
|
package/dist/esm/Cascader.js
CHANGED
|
@@ -52,6 +52,8 @@ import { Loading, Checklist } from "@nutui/icons-react";
|
|
|
52
52
|
import { c as cn } from "./bem.js";
|
|
53
53
|
import "./typings.js";
|
|
54
54
|
import "./TabPane.js";
|
|
55
|
+
import "./raf.js";
|
|
56
|
+
import "./use-props-value.js";
|
|
55
57
|
import "@bem-react/classname";
|
|
56
58
|
var defaultProps$1 = {
|
|
57
59
|
data: {
|
|
@@ -608,7 +610,7 @@ var InternalCascader = function InternalCascader2(props, ref) {
|
|
|
608
610
|
className: b("title")
|
|
609
611
|
}, title), React__default.createElement(Tabs, {
|
|
610
612
|
value: tabvalue,
|
|
611
|
-
|
|
613
|
+
title: function title2() {
|
|
612
614
|
return optionsData.map(function(pane, index) {
|
|
613
615
|
var _pane$selectedNode, _pane$selectedNode2;
|
|
614
616
|
return React__default.createElement("div", {
|
|
@@ -631,7 +633,7 @@ var InternalCascader = function InternalCascader2(props, ref) {
|
|
|
631
633
|
}, !state.initLoading && state.panes.length ? optionsData.map(function(pane) {
|
|
632
634
|
return React__default.createElement(TabPane, {
|
|
633
635
|
key: pane.paneKey,
|
|
634
|
-
|
|
636
|
+
value: pane.paneKey
|
|
635
637
|
}, React__default.createElement("div", {
|
|
636
638
|
className: classesPane
|
|
637
639
|
}, pane.nodes && pane.nodes.map(function(node, index) {
|
package/dist/esm/Dialog.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
var _excluded = ["visible", "footer", "
|
|
3
|
+
var _excluded = ["visible", "footer", "hideConfirmButton", "hideCancelButton", "lockScroll", "disableConfirmButton", "closeOnOverlayClick", "confirmText", "cancelText", "onClose", "onCancel", "onConfirm", "beforeCancel", "beforeClose"];
|
|
4
4
|
function ownKeys(object, enumerableOnly) {
|
|
5
5
|
var keys = Object.keys(object);
|
|
6
6
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -22,262 +22,253 @@ function _objectSpread(target) {
|
|
|
22
22
|
}
|
|
23
23
|
return target;
|
|
24
24
|
}
|
|
25
|
-
import
|
|
26
|
-
import React__default, { useEffect, forwardRef } from "react";
|
|
25
|
+
import React__default, { forwardRef } from "react";
|
|
27
26
|
import classNames from "classnames";
|
|
28
27
|
import Button from "./Button.js";
|
|
29
|
-
import { CSSTransition } from "react-transition-group";
|
|
30
28
|
import { r as render, u as unmount } from "./render.js";
|
|
29
|
+
import { CSSTransition } from "react-transition-group";
|
|
30
|
+
import { d as defaultOverlayProps } from "./overlay2.js";
|
|
31
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
32
|
+
import Overlay from "./Overlay.js";
|
|
33
|
+
import { useConfig } from "./ConfigProvider.js";
|
|
31
34
|
import "react-dom";
|
|
32
|
-
var Content = function Content2(props) {
|
|
33
|
-
var visible = props.visible, title = props.title, footer = props.footer, textAlign = props.textAlign, footerDirection = props.footerDirection, onClickSelf = props.onClickSelf, children = props.children;
|
|
34
|
-
var headerNode;
|
|
35
|
-
if (title) {
|
|
36
|
-
headerNode = React__default.createElement("div", {
|
|
37
|
-
className: "nut-dialog__header"
|
|
38
|
-
}, title);
|
|
39
|
-
}
|
|
40
|
-
var footerNode;
|
|
41
|
-
if (footer) {
|
|
42
|
-
footerNode = React__default.createElement("div", {
|
|
43
|
-
className: classNames("nut-dialog__footer", _defineProperty({}, footerDirection, footerDirection))
|
|
44
|
-
}, footer);
|
|
45
|
-
}
|
|
46
|
-
var handleClick = function handleClick2() {
|
|
47
|
-
onClickSelf && onClickSelf();
|
|
48
|
-
};
|
|
49
|
-
return React__default.createElement("div", {
|
|
50
|
-
className: "nut-dialog__outer",
|
|
51
|
-
onClick: handleClick
|
|
52
|
-
}, React__default.createElement("div", {
|
|
53
|
-
className: "nut-dialog",
|
|
54
|
-
style: {
|
|
55
|
-
display: visible ? "flex" : "none"
|
|
56
|
-
}
|
|
57
|
-
}, headerNode, React__default.createElement("div", {
|
|
58
|
-
className: "nut-dialog__content",
|
|
59
|
-
style: {
|
|
60
|
-
textAlign
|
|
61
|
-
}
|
|
62
|
-
}, React__default.createElement("div", null, children)), footerNode));
|
|
63
|
-
};
|
|
64
|
-
Content.displayName = "NutContent";
|
|
65
|
-
function Mask(props) {
|
|
66
|
-
return React.createElement("div", {
|
|
67
|
-
className: "nut-dialog__mask"
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
var DialogWrap = function DialogWrap2(props) {
|
|
71
|
-
var className = props.className, style = props.style, visible = props.visible, mask = props.mask, closeOnClickOverlay = props.closeOnClickOverlay, lockScroll = props.lockScroll, onClosed = props.onClosed, onCancel = props.onCancel;
|
|
72
|
-
var handleClick = function handleClick2(e) {
|
|
73
|
-
if (closeOnClickOverlay && visible && e.target === e.currentTarget) {
|
|
74
|
-
onClosed === null || onClosed === void 0 ? void 0 : onClosed();
|
|
75
|
-
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
76
|
-
lockScroll && document.body.classList.remove("nut-overflow-hidden");
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
var wrapStyle = _objectSpread(_objectSpread({}, style), {}, {
|
|
80
|
-
display: visible ? "block" : "none"
|
|
81
|
-
});
|
|
82
|
-
if (lockScroll && visible) {
|
|
83
|
-
document.body.classList.add("nut-overflow-hidden");
|
|
84
|
-
}
|
|
85
|
-
return React__default.createElement(React__default.Fragment, null, mask ? React__default.createElement(CSSTransition, {
|
|
86
|
-
"in": visible,
|
|
87
|
-
timeout: 300,
|
|
88
|
-
classNames: "fadeDialog",
|
|
89
|
-
unmountOnExit: true,
|
|
90
|
-
appear: true
|
|
91
|
-
}, React__default.createElement(Mask, null)) : null, React__default.createElement("div", {
|
|
92
|
-
className: classNames("nut-dialog__wrap", className),
|
|
93
|
-
onClick: handleClick,
|
|
94
|
-
style: wrapStyle
|
|
95
|
-
}, React__default.createElement(Content, _objectSpread(_objectSpread({}, props), {}, {
|
|
96
|
-
visible
|
|
97
|
-
}))));
|
|
98
|
-
};
|
|
99
|
-
DialogWrap.displayName = "NutDialogWrap";
|
|
100
|
-
var DialogWrapper = function DialogWrapper2(props) {
|
|
101
|
-
var visible = props.visible, lockScroll = props.lockScroll;
|
|
102
|
-
useEffect(function() {
|
|
103
|
-
if (lockScroll && visible) {
|
|
104
|
-
document.body.classList.add("nut-overflow-hidden");
|
|
105
|
-
} else {
|
|
106
|
-
document.body.classList.remove("nut-overflow-hidden");
|
|
107
|
-
}
|
|
108
|
-
}, [visible]);
|
|
109
|
-
useEffect(function() {
|
|
110
|
-
return function() {
|
|
111
|
-
if (document.body.classList.value.includes("nut-overflow-hidden")) {
|
|
112
|
-
document.body.classList.remove("nut-overflow-hidden");
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}, []);
|
|
116
|
-
return React__default.createElement("div", {
|
|
117
|
-
style: {
|
|
118
|
-
display: visible ? "block" : "none"
|
|
119
|
-
}
|
|
120
|
-
}, React__default.createElement(DialogWrap, _objectSpread({}, props)));
|
|
121
|
-
};
|
|
122
|
-
DialogWrapper.displayName = "NutDialogWrapper";
|
|
123
35
|
function ConfirmDialog(props) {
|
|
124
36
|
return React__default.createElement(Dialog, _objectSpread({}, props), props.content);
|
|
125
37
|
}
|
|
126
|
-
var normalizeConfig = function normalizeConfig2(
|
|
127
|
-
if (
|
|
128
|
-
var icon =
|
|
38
|
+
var normalizeConfig = function normalizeConfig2(config) {
|
|
39
|
+
if (config.isNotice) {
|
|
40
|
+
var icon = config.icon;
|
|
129
41
|
if (!icon && icon !== null) {
|
|
130
|
-
switch (
|
|
42
|
+
switch (config.noticeType) {
|
|
131
43
|
case "alert":
|
|
132
44
|
icon = "";
|
|
133
45
|
break;
|
|
134
46
|
}
|
|
135
47
|
}
|
|
136
|
-
|
|
48
|
+
config.hideCancelButton = true;
|
|
137
49
|
}
|
|
138
|
-
return
|
|
50
|
+
return config;
|
|
139
51
|
};
|
|
140
|
-
function
|
|
52
|
+
var confirm = function confirm2(config, renderFunc) {
|
|
141
53
|
var div = document.createElement("div");
|
|
142
54
|
document.body.appendChild(div);
|
|
143
|
-
|
|
55
|
+
var dialogConfig = _objectSpread(_objectSpread({}, config), {}, {
|
|
56
|
+
visible: false
|
|
57
|
+
});
|
|
58
|
+
var render$1 = function render$12(props, callback) {
|
|
144
59
|
render(React__default.createElement(ConfirmDialog, _objectSpread(_objectSpread({}, props), {}, {
|
|
145
|
-
onCancel
|
|
60
|
+
onCancel: function onCancel2() {
|
|
61
|
+
return _onCancel();
|
|
62
|
+
}
|
|
146
63
|
})), div);
|
|
147
64
|
callback && callback();
|
|
148
|
-
}
|
|
65
|
+
};
|
|
149
66
|
var renderFunction = renderFunc || render$1;
|
|
150
|
-
var
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
var onOk = function onOk2() {
|
|
154
|
-
var ret;
|
|
155
|
-
var _onOk = config.onOk || config.onConfirm;
|
|
156
|
-
if (_onOk) {
|
|
157
|
-
ret = _onOk();
|
|
158
|
-
}
|
|
67
|
+
var onConfirm = function onConfirm2() {
|
|
68
|
+
var _onConfirm = config.onConfirm || config.onConfirm;
|
|
69
|
+
var ret = _onConfirm === null || _onConfirm === void 0 ? void 0 : _onConfirm();
|
|
159
70
|
if (ret && ret.then) {
|
|
160
71
|
renderFunction(dialogConfig);
|
|
161
72
|
ret.then(function() {
|
|
162
|
-
|
|
73
|
+
_onCancel(true);
|
|
163
74
|
}, function(e) {
|
|
164
75
|
console.error(e);
|
|
165
76
|
renderFunction(dialogConfig);
|
|
166
77
|
});
|
|
167
78
|
}
|
|
168
79
|
if (!ret) {
|
|
169
|
-
|
|
80
|
+
_onCancel(true);
|
|
170
81
|
}
|
|
171
82
|
};
|
|
172
|
-
dialogConfig.
|
|
83
|
+
dialogConfig.onConfirm = onConfirm;
|
|
173
84
|
dialogConfig = normalizeConfig(dialogConfig);
|
|
174
85
|
dialogConfig.visible = true;
|
|
175
86
|
renderFunction(dialogConfig);
|
|
176
|
-
function
|
|
87
|
+
var destroy = function destroy2() {
|
|
177
88
|
unmount(div);
|
|
178
89
|
if (div !== null && div !== void 0 && div.parentNode) {
|
|
179
90
|
div.parentNode.removeChild(div);
|
|
180
91
|
}
|
|
181
|
-
}
|
|
182
|
-
function
|
|
183
|
-
!
|
|
92
|
+
};
|
|
93
|
+
var _onCancel = function _onCancel2(confirm22) {
|
|
94
|
+
!confirm22 && config.onCancel && config.onCancel();
|
|
184
95
|
dialogConfig.visible = false;
|
|
185
|
-
dialogConfig.
|
|
186
|
-
config.
|
|
96
|
+
dialogConfig.onClose = function() {
|
|
97
|
+
config.onClose && config.onClose();
|
|
187
98
|
};
|
|
188
99
|
renderFunction(dialogConfig, function() {
|
|
189
100
|
destroy();
|
|
190
101
|
});
|
|
191
|
-
}
|
|
192
|
-
function
|
|
102
|
+
};
|
|
103
|
+
var update = function update2(newConfig) {
|
|
193
104
|
dialogConfig = _objectSpread(_objectSpread({}, dialogConfig), {}, {
|
|
194
105
|
title: config.title
|
|
195
106
|
}, newConfig);
|
|
196
107
|
dialogConfig = normalizeConfig(dialogConfig);
|
|
197
108
|
renderFunction(dialogConfig);
|
|
198
|
-
}
|
|
199
|
-
function
|
|
109
|
+
};
|
|
110
|
+
var close = function close2() {
|
|
200
111
|
dialogConfig.visible = false;
|
|
201
|
-
dialogConfig.
|
|
202
|
-
config.
|
|
112
|
+
dialogConfig.onClose = function() {
|
|
113
|
+
config.onClose && config.onClose();
|
|
203
114
|
destroy();
|
|
204
115
|
};
|
|
205
116
|
renderFunction(dialogConfig);
|
|
206
|
-
}
|
|
117
|
+
};
|
|
207
118
|
return {
|
|
208
119
|
close,
|
|
209
120
|
update
|
|
210
121
|
};
|
|
211
|
-
}
|
|
122
|
+
};
|
|
123
|
+
var confirm$1 = confirm;
|
|
124
|
+
var Content = function Content2(props) {
|
|
125
|
+
var visible = props.visible, title = props.title, footer = props.footer, footerDirection = props.footerDirection, onClick = props.onClick, children = props.children;
|
|
126
|
+
var classPrefix = "nut-dialog";
|
|
127
|
+
var renderHeader = function renderHeader2() {
|
|
128
|
+
return title ? React__default.createElement("div", {
|
|
129
|
+
className: "".concat(classPrefix, "__header")
|
|
130
|
+
}, title) : null;
|
|
131
|
+
};
|
|
132
|
+
var renderFooter = function renderFooter2() {
|
|
133
|
+
return footer ? React__default.createElement("div", {
|
|
134
|
+
className: classNames("".concat(classPrefix, "__footer"), _defineProperty({}, footerDirection, footerDirection))
|
|
135
|
+
}, footer) : null;
|
|
136
|
+
};
|
|
137
|
+
var handleClick = function handleClick2(e) {
|
|
138
|
+
onClick && onClick(e);
|
|
139
|
+
};
|
|
140
|
+
return React__default.createElement("div", {
|
|
141
|
+
className: "".concat(classPrefix, "__outer"),
|
|
142
|
+
onClick: function onClick2(e) {
|
|
143
|
+
return handleClick(e);
|
|
144
|
+
}
|
|
145
|
+
}, React__default.createElement("div", {
|
|
146
|
+
className: classPrefix,
|
|
147
|
+
style: {
|
|
148
|
+
display: visible ? "flex" : "none"
|
|
149
|
+
}
|
|
150
|
+
}, renderHeader(), React__default.createElement("div", {
|
|
151
|
+
className: "".concat(classPrefix, "__content")
|
|
152
|
+
}, React__default.createElement(React__default.Fragment, null, children)), renderFooter()));
|
|
153
|
+
};
|
|
154
|
+
Content.displayName = "NutContent";
|
|
155
|
+
var defaultDialogProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
156
|
+
overlay: true,
|
|
157
|
+
overlayStyle: {},
|
|
158
|
+
overlayClassName: "",
|
|
159
|
+
onCancel: function onCancel() {
|
|
160
|
+
},
|
|
161
|
+
onClose: function onClose() {
|
|
162
|
+
},
|
|
163
|
+
onOverlayClick: function onOverlayClick(e) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
}, defaultOverlayProps);
|
|
167
|
+
var DialogWrap = function DialogWrap2(props) {
|
|
168
|
+
var visible = props.visible, overlay = props.overlay, overlayStyle = props.overlayStyle, overlayClassName = props.overlayClassName, closeOnOverlayClick = props.closeOnOverlayClick, lockScroll = props.lockScroll, onClose2 = props.onClose, onCancel2 = props.onCancel, onOverlayClick2 = props.onOverlayClick;
|
|
169
|
+
var onHandleClickOverlay = function onHandleClickOverlay2(e) {
|
|
170
|
+
if (closeOnOverlayClick && visible && e.target === e.currentTarget) {
|
|
171
|
+
var closed = onOverlayClick2 && onOverlayClick2(e);
|
|
172
|
+
closed && (onClose2 === null || onClose2 === void 0 ? void 0 : onClose2());
|
|
173
|
+
closed && (onCancel2 === null || onCancel2 === void 0 ? void 0 : onCancel2());
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
return React__default.createElement(React__default.Fragment, null, overlay ? React__default.createElement(Overlay, {
|
|
177
|
+
style: overlayStyle,
|
|
178
|
+
className: overlayClassName,
|
|
179
|
+
visible,
|
|
180
|
+
closeOnOverlayClick,
|
|
181
|
+
lockScroll,
|
|
182
|
+
onClick: onHandleClickOverlay
|
|
183
|
+
}) : null, React__default.createElement(CSSTransition, {
|
|
184
|
+
"in": visible,
|
|
185
|
+
timeout: 300,
|
|
186
|
+
classNames: "fadeDialog",
|
|
187
|
+
unmountOnExit: true,
|
|
188
|
+
appear: true
|
|
189
|
+
}, React__default.createElement(Content, _objectSpread(_objectSpread({}, props), {}, {
|
|
190
|
+
visible
|
|
191
|
+
}))));
|
|
192
|
+
};
|
|
193
|
+
DialogWrap.defaultProps = defaultDialogProps;
|
|
194
|
+
DialogWrap.displayName = "NutDialogWrap";
|
|
212
195
|
var defaultProps = {
|
|
213
|
-
confirmText: "
|
|
214
|
-
cancelText: "
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
okBtnDisabled: false,
|
|
221
|
-
cancelAutoClose: true,
|
|
222
|
-
textAlign: "center",
|
|
196
|
+
confirmText: "",
|
|
197
|
+
cancelText: "",
|
|
198
|
+
overlay: true,
|
|
199
|
+
closeOnOverlayClick: true,
|
|
200
|
+
hideConfirmButton: false,
|
|
201
|
+
hideCancelButton: false,
|
|
202
|
+
disableConfirmButton: false,
|
|
223
203
|
footerDirection: "horizontal",
|
|
224
|
-
lockScroll:
|
|
204
|
+
lockScroll: true,
|
|
205
|
+
beforeCancel: function beforeCancel() {
|
|
206
|
+
return true;
|
|
207
|
+
},
|
|
208
|
+
beforeClose: function beforeClose() {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
225
211
|
};
|
|
226
212
|
var BaseDialog = function BaseDialog2(props, ref) {
|
|
227
|
-
var
|
|
213
|
+
var _useConfig = useConfig(), locale = _useConfig.locale;
|
|
214
|
+
var visible = props.visible, footer = props.footer, hideConfirmButton = props.hideConfirmButton, hideCancelButton = props.hideCancelButton, lockScroll = props.lockScroll, disableConfirmButton = props.disableConfirmButton, closeOnOverlayClick = props.closeOnOverlayClick, confirmText = props.confirmText, cancelText = props.cancelText, onClose2 = props.onClose, onCancel2 = props.onCancel, onConfirm = props.onConfirm, beforeCancel2 = props.beforeCancel, beforeClose2 = props.beforeClose, restProps = _objectWithoutProperties(props, _excluded);
|
|
215
|
+
var classPrefix = "nut-dialog";
|
|
228
216
|
var renderFooter = function renderFooter2() {
|
|
229
|
-
if (footer === null
|
|
217
|
+
if (footer === null)
|
|
230
218
|
return "";
|
|
231
219
|
var handleCancel = function handleCancel2(e) {
|
|
232
220
|
e.stopPropagation();
|
|
233
|
-
if (!
|
|
221
|
+
if (!(beforeCancel2 !== null && beforeCancel2 !== void 0 && beforeCancel2()))
|
|
234
222
|
return;
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
223
|
+
if (!(beforeClose2 !== null && beforeClose2 !== void 0 && beforeClose2()))
|
|
224
|
+
return;
|
|
225
|
+
onClose2 === null || onClose2 === void 0 ? void 0 : onClose2();
|
|
226
|
+
onCancel2 === null || onCancel2 === void 0 ? void 0 : onCancel2();
|
|
240
227
|
};
|
|
241
228
|
var handleOk = function handleOk2(e) {
|
|
242
229
|
e.stopPropagation();
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
if (lockScroll && visible) {
|
|
246
|
-
document.body.classList.remove("nut-overflow-hidden");
|
|
247
|
-
}
|
|
230
|
+
onClose2 === null || onClose2 === void 0 ? void 0 : onClose2();
|
|
231
|
+
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(e);
|
|
248
232
|
};
|
|
249
|
-
|
|
233
|
+
return footer || React__default.createElement(React__default.Fragment, null, !hideCancelButton && React__default.createElement(Button, {
|
|
250
234
|
size: "small",
|
|
251
235
|
fill: "outline",
|
|
252
236
|
type: "primary",
|
|
253
|
-
className: "
|
|
254
|
-
onClick:
|
|
255
|
-
|
|
237
|
+
className: "".concat(classPrefix, "__footer-cancel"),
|
|
238
|
+
onClick: function onClick(e) {
|
|
239
|
+
return handleCancel(e);
|
|
240
|
+
}
|
|
241
|
+
}, cancelText || locale.cancel), !hideConfirmButton && React__default.createElement(Button, {
|
|
256
242
|
size: "small",
|
|
257
243
|
type: "primary",
|
|
258
|
-
className: classNames("
|
|
259
|
-
disabled:
|
|
244
|
+
className: classNames("".concat(classPrefix, "__footer-ok"), {
|
|
245
|
+
disabled: disableConfirmButton
|
|
260
246
|
}),
|
|
261
|
-
disabled:
|
|
262
|
-
onClick:
|
|
263
|
-
|
|
264
|
-
|
|
247
|
+
disabled: disableConfirmButton,
|
|
248
|
+
onClick: function onClick(e) {
|
|
249
|
+
return handleOk(e);
|
|
250
|
+
}
|
|
251
|
+
}, confirmText || locale.confirm));
|
|
265
252
|
};
|
|
266
|
-
return React__default.createElement(
|
|
253
|
+
return React__default.createElement("div", {
|
|
254
|
+
style: {
|
|
255
|
+
display: visible ? "block" : "none"
|
|
256
|
+
}
|
|
257
|
+
}, React__default.createElement(DialogWrap, _objectSpread(_objectSpread({}, props), {}, {
|
|
267
258
|
visible,
|
|
268
259
|
lockScroll,
|
|
269
260
|
footer: renderFooter(),
|
|
270
|
-
|
|
271
|
-
onCancel
|
|
272
|
-
}));
|
|
261
|
+
onClose: onClose2,
|
|
262
|
+
onCancel: onCancel2
|
|
263
|
+
})));
|
|
273
264
|
};
|
|
274
265
|
var Dialog = forwardRef(BaseDialog);
|
|
275
266
|
Dialog.confirm = function(props) {
|
|
276
|
-
return confirm(props);
|
|
267
|
+
return confirm$1(props);
|
|
277
268
|
};
|
|
278
269
|
["alert"].forEach(function(type) {
|
|
279
270
|
Dialog[type] = function(props) {
|
|
280
|
-
return confirm(_objectSpread(_objectSpread({}, props), {}, {
|
|
271
|
+
return confirm$1(_objectSpread(_objectSpread({}, props), {}, {
|
|
281
272
|
isNotice: false,
|
|
282
273
|
noticeType: type
|
|
283
274
|
}));
|
package/dist/esm/Divider.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
var _excluded = ["children", "contentPosition", "style", "className", "direction"];
|
|
4
4
|
function ownKeys(object, enumerableOnly) {
|
|
5
5
|
var keys = Object.keys(object);
|
|
@@ -24,10 +24,11 @@ function _objectSpread(target) {
|
|
|
24
24
|
}
|
|
25
25
|
import React__default from "react";
|
|
26
26
|
import classNames from "classnames";
|
|
27
|
-
|
|
27
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
28
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
28
29
|
contentPosition: "center",
|
|
29
30
|
direction: "horizontal"
|
|
30
|
-
};
|
|
31
|
+
});
|
|
31
32
|
var classPrefix = "nut-divider";
|
|
32
33
|
var Divider = function Divider2(props) {
|
|
33
34
|
var _classNames, _classNames2;
|