@oceanbase/ui 1.0.0-alpha.3 → 1.0.0-alpha.5
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/ui.min.css +1 -1
- package/dist/ui.min.js +1 -1
- package/es/Action/Group.js +121 -15
- package/es/Action/Item.d.ts +6 -15
- package/es/Action/Item.js +85 -128
- package/es/Action/index.d.ts +6 -3
- package/es/Action/style/index.js +8 -4
- package/es/BasicLayout/locale/ja-JP.d.ts +13 -0
- package/es/BasicLayout/locale/ja-JP.js +12 -0
- package/es/BasicLayout/style/index.js +35 -23
- package/es/BatchOperationBar/index.d.ts +0 -1
- package/es/BatchOperationBar/index.js +17 -13
- package/es/BatchOperationBar/locale/ja-JP.d.ts +7 -0
- package/es/BatchOperationBar/locale/ja-JP.js +6 -0
- package/es/BatchOperationBar/style/index.d.ts +10 -0
- package/es/BatchOperationBar/style/index.js +51 -0
- package/es/Boundary/Components/Code.js +11 -5
- package/es/Boundary/Components/Exception.js +85 -74
- package/es/Boundary/Components/Function.js +11 -5
- package/es/Boundary/index.d.ts +0 -1
- package/es/Boundary/index.js +0 -1
- package/es/Boundary/locale/ja-JP.d.ts +11 -0
- package/es/Boundary/locale/ja-JP.js +10 -0
- package/es/Boundary/style/index.d.ts +10 -0
- package/es/Boundary/style/index.js +46 -0
- package/es/ContentWithIcon/index.d.ts +0 -1
- package/es/ContentWithIcon/index.js +29 -29
- package/es/ContentWithIcon/style/index.d.ts +10 -0
- package/es/ContentWithIcon/style/index.js +26 -0
- package/es/DateRanger/PickerPanel.js +5 -4
- package/es/DateRanger/Ranger.d.ts +0 -1
- package/es/DateRanger/Ranger.js +13 -8
- package/es/DateRanger/locale/ja-JP.d.ts +56 -0
- package/es/DateRanger/locale/ja-JP.js +20 -0
- package/es/DateRanger/style/index.d.ts +10 -0
- package/es/DateRanger/style/index.js +126 -0
- package/es/Dialog/Anchor.d.ts +2 -10
- package/es/Dialog/Anchor.js +67 -96
- package/es/Dialog/index.d.ts +0 -1
- package/es/Dialog/index.js +537 -578
- package/es/Dialog/locale/ja-JP.d.ts +5 -0
- package/es/Dialog/locale/ja-JP.js +4 -0
- package/es/Dialog/style/index.d.ts +10 -0
- package/es/Dialog/style/index.js +97 -0
- package/es/DocDialog/locale/ja-JP.d.ts +2 -0
- package/es/DocDialog/locale/ja-JP.js +1 -0
- package/es/FooterToolbar/style/index.js +7 -1
- package/es/FullscreenBox/index.d.ts +0 -1
- package/es/FullscreenBox/index.js +46 -37
- package/es/FullscreenBox/locale/ja-JP.d.ts +2 -0
- package/es/FullscreenBox/locale/ja-JP.js +1 -0
- package/es/FullscreenBox/style/index.d.ts +10 -0
- package/es/FullscreenBox/style/index.js +53 -0
- package/es/GraphToolbar/index.d.ts +0 -1
- package/es/GraphToolbar/index.js +19 -16
- package/es/GraphToolbar/locale/ja-JP.d.ts +9 -0
- package/es/GraphToolbar/locale/ja-JP.js +8 -0
- package/es/GraphToolbar/style/index.d.ts +10 -0
- package/es/GraphToolbar/style/index.js +60 -0
- package/es/Highlight/DiffView/index.d.ts +0 -1
- package/es/Highlight/DiffView/index.js +5 -5
- package/es/Highlight/JsonView.d.ts +0 -1
- package/es/Highlight/JsonView.js +5 -5
- package/es/Highlight/index.d.ts +0 -1
- package/es/Highlight/index.js +23 -23
- package/es/Highlight/locale/ja-JP.d.ts +4 -0
- package/es/Highlight/locale/ja-JP.js +3 -0
- package/es/Highlight/style/index.d.ts +10 -0
- package/es/Highlight/style/index.js +213 -0
- package/es/LocaleDropdown/index.js +4 -2
- package/es/Login/ActivateForm.d.ts +0 -1
- package/es/Login/ActivateForm.js +12 -9
- package/es/Login/LoginForm.d.ts +0 -1
- package/es/Login/LoginForm.js +20 -15
- package/es/Login/RegisterForm.d.ts +0 -1
- package/es/Login/RegisterForm.js +14 -11
- package/es/Login/index.d.ts +0 -1
- package/es/Login/index.js +24 -22
- package/es/Login/locale/ja-JP.d.ts +28 -0
- package/es/Login/locale/ja-JP.js +27 -0
- package/es/Login/style/index.d.ts +10 -0
- package/es/Login/style/index.js +182 -0
- package/es/NavMenu/index.d.ts +1 -2
- package/es/NavMenu/index.js +11 -8
- package/es/NavMenu/style/index.d.ts +10 -0
- package/es/NavMenu/style/index.js +47 -0
- package/es/PageContainer/locale/ja-JP.d.ts +4 -0
- package/es/PageContainer/locale/ja-JP.js +3 -0
- package/es/PageContainer/style/index.js +5 -5
- package/es/Password/locale/ja-JP.d.ts +13 -0
- package/es/Password/locale/ja-JP.js +12 -0
- package/es/Ranger/QuickPicker.js +8 -4
- package/es/Ranger/Ranger.d.ts +0 -1
- package/es/Ranger/Ranger.js +12 -9
- package/es/Ranger/locale/ja-JP.d.ts +28 -0
- package/es/Ranger/locale/ja-JP.js +29 -0
- package/es/Ranger/style/index.d.ts +10 -0
- package/es/Ranger/style/index.js +44 -0
- package/es/SideTip/index.d.ts +0 -1
- package/es/SideTip/index.js +24 -22
- package/es/SideTip/locale/ja-JP.d.ts +2 -0
- package/es/SideTip/locale/ja-JP.js +1 -0
- package/es/SideTip/style/index.d.ts +10 -0
- package/es/SideTip/style/index.js +162 -0
- package/es/TagSelect/Group.d.ts +6 -6
- package/es/TagSelect/Group.js +5 -3
- package/es/TagSelect/Item.js +5 -3
- package/es/TaskGraph/Graph/style/index.d.ts +10 -0
- package/es/TaskGraph/Graph/style/index.js +28 -0
- package/es/TaskGraph/Graph.d.ts +0 -1
- package/es/TaskGraph/Graph.js +26 -10
- package/es/TaskGraph/index.d.ts +0 -1
- package/es/TaskGraph/index.js +10 -7
- package/es/TaskGraph/locale/ja-JP.d.ts +13 -0
- package/es/TaskGraph/locale/ja-JP.js +12 -0
- package/es/TaskGraph/style/index.d.ts +10 -0
- package/es/TaskGraph/style/index.js +102 -0
- package/es/Welcome/index.d.ts +0 -1
- package/es/Welcome/index.js +30 -26
- package/es/Welcome/locale/ja-JP.d.ts +5 -0
- package/es/Welcome/locale/ja-JP.js +4 -0
- package/es/Welcome/step/style/index.d.ts +10 -0
- package/es/Welcome/step/style/index.js +44 -0
- package/es/Welcome/step.d.ts +0 -1
- package/es/Welcome/step.js +17 -14
- package/es/Welcome/style/index.d.ts +10 -0
- package/es/Welcome/style/index.js +141 -0
- package/es/index.d.ts +0 -1
- package/es/index.js +0 -1
- package/es/locale/ja-JP.d.ts +3 -0
- package/es/locale/ja-JP.js +42 -0
- package/lib/Action/Group.js +85 -20
- package/lib/Action/Item.d.ts +6 -15
- package/lib/Action/Item.js +66 -81
- package/lib/Action/index.d.ts +6 -3
- package/lib/Action/style/index.js +16 -1
- package/lib/BasicLayout/locale/ja-JP.d.ts +13 -0
- package/lib/BasicLayout/locale/ja-JP.js +36 -0
- package/lib/BasicLayout/style/index.js +32 -23
- package/lib/BatchOperationBar/index.d.ts +0 -1
- package/lib/BatchOperationBar/index.js +54 -50
- package/lib/BatchOperationBar/locale/ja-JP.d.ts +7 -0
- package/lib/BatchOperationBar/locale/ja-JP.js +30 -0
- package/lib/BatchOperationBar/style/index.d.ts +10 -0
- package/lib/BatchOperationBar/style/index.js +82 -0
- package/lib/Boundary/Components/Code.js +23 -17
- package/lib/Boundary/Components/Exception.js +40 -29
- package/lib/Boundary/Components/Function.js +18 -12
- package/lib/Boundary/index.d.ts +0 -1
- package/lib/Boundary/index.js +0 -1
- package/lib/Boundary/locale/ja-JP.d.ts +11 -0
- package/lib/Boundary/locale/ja-JP.js +34 -0
- package/lib/Boundary/style/index.d.ts +10 -0
- package/lib/Boundary/style/index.js +74 -0
- package/lib/ContentWithIcon/index.d.ts +0 -1
- package/lib/ContentWithIcon/index.js +35 -32
- package/lib/ContentWithIcon/style/index.d.ts +10 -0
- package/lib/ContentWithIcon/style/index.js +57 -0
- package/lib/DateRanger/PickerPanel.js +2 -2
- package/lib/DateRanger/Ranger.d.ts +0 -1
- package/lib/DateRanger/Ranger.js +353 -348
- package/lib/DateRanger/locale/ja-JP.d.ts +56 -0
- package/lib/DateRanger/locale/ja-JP.js +49 -0
- package/lib/DateRanger/style/index.d.ts +10 -0
- package/lib/DateRanger/style/index.js +195 -0
- package/lib/Dialog/Anchor.d.ts +2 -10
- package/lib/Dialog/Anchor.js +58 -60
- package/lib/Dialog/index.d.ts +0 -1
- package/lib/Dialog/index.js +446 -422
- package/lib/Dialog/locale/ja-JP.d.ts +5 -0
- package/lib/Dialog/locale/ja-JP.js +28 -0
- package/lib/Dialog/style/index.d.ts +10 -0
- package/lib/Dialog/style/index.js +135 -0
- package/lib/DocDialog/locale/ja-JP.d.ts +2 -0
- package/lib/DocDialog/locale/ja-JP.js +25 -0
- package/lib/FooterToolbar/style/index.js +7 -1
- package/lib/FullscreenBox/index.d.ts +0 -1
- package/lib/FullscreenBox/index.js +47 -38
- package/lib/FullscreenBox/locale/ja-JP.d.ts +2 -0
- package/lib/FullscreenBox/locale/ja-JP.js +25 -0
- package/lib/FullscreenBox/style/index.d.ts +10 -0
- package/lib/FullscreenBox/style/index.js +86 -0
- package/lib/GraphToolbar/index.d.ts +0 -1
- package/lib/GraphToolbar/index.js +69 -66
- package/lib/GraphToolbar/locale/ja-JP.d.ts +9 -0
- package/lib/GraphToolbar/locale/ja-JP.js +32 -0
- package/lib/GraphToolbar/style/index.d.ts +10 -0
- package/lib/GraphToolbar/style/index.js +91 -0
- package/lib/Highlight/DiffView/index.d.ts +0 -1
- package/lib/Highlight/DiffView/index.js +3 -3
- package/lib/Highlight/JsonView.d.ts +0 -1
- package/lib/Highlight/JsonView.js +3 -3
- package/lib/Highlight/index.d.ts +0 -1
- package/lib/Highlight/index.js +32 -29
- package/lib/Highlight/locale/ja-JP.d.ts +4 -0
- package/lib/Highlight/locale/ja-JP.js +27 -0
- package/lib/Highlight/style/index.d.ts +10 -0
- package/lib/Highlight/style/index.js +293 -0
- package/lib/LocaleDropdown/index.js +2 -1
- package/lib/Login/ActivateForm.d.ts +0 -1
- package/lib/Login/ActivateForm.js +17 -9
- package/lib/Login/LoginForm.d.ts +0 -1
- package/lib/Login/LoginForm.js +25 -13
- package/lib/Login/RegisterForm.d.ts +0 -1
- package/lib/Login/RegisterForm.js +17 -9
- package/lib/Login/index.d.ts +0 -1
- package/lib/Login/index.js +96 -94
- package/lib/Login/locale/ja-JP.d.ts +28 -0
- package/lib/Login/locale/ja-JP.js +51 -0
- package/lib/Login/style/index.d.ts +10 -0
- package/lib/Login/style/index.js +267 -0
- package/lib/NavMenu/index.d.ts +1 -2
- package/lib/NavMenu/index.js +20 -17
- package/lib/NavMenu/style/index.d.ts +10 -0
- package/lib/NavMenu/style/index.js +78 -0
- package/lib/PageContainer/locale/ja-JP.d.ts +4 -0
- package/lib/PageContainer/locale/ja-JP.js +27 -0
- package/lib/PageContainer/style/index.js +5 -5
- package/lib/Password/locale/ja-JP.d.ts +13 -0
- package/lib/Password/locale/ja-JP.js +36 -0
- package/lib/Ranger/QuickPicker.js +4 -2
- package/lib/Ranger/Ranger.d.ts +0 -1
- package/lib/Ranger/Ranger.js +48 -45
- package/lib/Ranger/locale/ja-JP.d.ts +28 -0
- package/lib/Ranger/locale/ja-JP.js +53 -0
- package/lib/Ranger/style/index.d.ts +10 -0
- package/lib/Ranger/style/index.js +82 -0
- package/lib/SideTip/index.d.ts +0 -1
- package/lib/SideTip/index.js +46 -38
- package/lib/SideTip/locale/ja-JP.d.ts +2 -0
- package/lib/SideTip/locale/ja-JP.js +25 -0
- package/lib/SideTip/style/index.d.ts +10 -0
- package/lib/SideTip/style/index.js +211 -0
- package/lib/TagSelect/Group.d.ts +6 -6
- package/lib/TagSelect/Group.js +3 -2
- package/lib/TagSelect/Item.js +3 -2
- package/lib/TaskGraph/Graph/style/index.d.ts +10 -0
- package/lib/TaskGraph/Graph/style/index.js +56 -0
- package/lib/TaskGraph/Graph.d.ts +0 -1
- package/lib/TaskGraph/Graph.js +16 -7
- package/lib/TaskGraph/index.d.ts +0 -1
- package/lib/TaskGraph/index.js +6 -5
- package/lib/TaskGraph/locale/ja-JP.d.ts +13 -0
- package/lib/TaskGraph/locale/ja-JP.js +36 -0
- package/lib/TaskGraph/style/index.d.ts +10 -0
- package/lib/TaskGraph/style/index.js +143 -0
- package/lib/Welcome/index.d.ts +0 -1
- package/lib/Welcome/index.js +64 -59
- package/lib/Welcome/locale/ja-JP.d.ts +5 -0
- package/lib/Welcome/locale/ja-JP.js +28 -0
- package/lib/Welcome/step/style/index.d.ts +10 -0
- package/lib/Welcome/step/style/index.js +74 -0
- package/lib/Welcome/step.d.ts +0 -1
- package/lib/Welcome/step.js +17 -13
- package/lib/Welcome/style/index.d.ts +10 -0
- package/lib/Welcome/style/index.js +188 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/locale/ja-JP.d.ts +3 -0
- package/lib/locale/ja-JP.js +71 -0
- package/package.json +6 -9
- package/es/BatchOperationBar/index.less +0 -46
- package/es/BatchOperationBar/index.less.d.ts +0 -15
- package/es/Boundary/index.less +0 -36
- package/es/ContentWithIcon/index.less +0 -21
- package/es/DateRanger/index.less +0 -180
- package/es/Dialog/index.less +0 -116
- package/es/FullscreenBox/index.less +0 -49
- package/es/GraphToolbar/index.less +0 -65
- package/es/Highlight/index.less +0 -381
- package/es/Login/index.less +0 -268
- package/es/NavMenu/index.less +0 -50
- package/es/Ranger/index.less +0 -57
- package/es/SideTip/index.less +0 -180
- package/es/TaskGraph/graph.less +0 -23
- package/es/TaskGraph/index.less +0 -117
- package/es/Welcome/index.less +0 -185
- package/es/index.less +0 -1
- package/es/variable.less +0 -54
- package/lib/BatchOperationBar/index.less +0 -46
- package/lib/BatchOperationBar/index.less.d.ts +0 -15
- package/lib/Boundary/index.less +0 -36
- package/lib/ContentWithIcon/index.less +0 -21
- package/lib/DateRanger/index.less +0 -180
- package/lib/Dialog/index.less +0 -116
- package/lib/FullscreenBox/index.less +0 -49
- package/lib/GraphToolbar/index.less +0 -65
- package/lib/Highlight/index.less +0 -381
- package/lib/Login/index.less +0 -268
- package/lib/NavMenu/index.less +0 -50
- package/lib/Ranger/index.less +0 -57
- package/lib/SideTip/index.less +0 -180
- package/lib/TaskGraph/graph.less +0 -23
- package/lib/TaskGraph/index.less +0 -117
- package/lib/Welcome/index.less +0 -185
- package/lib/index.less +0 -1
- package/lib/variable.less +0 -54
package/lib/Dialog/index.js
CHANGED
|
@@ -34,16 +34,15 @@ __export(Dialog_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(Dialog_exports);
|
|
35
35
|
var import_icons = require("@oceanbase/icons");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_design = require("@oceanbase/design");
|
|
37
38
|
var import_react_dom = require("react-dom");
|
|
38
39
|
var import_LocaleWrapper = __toESM(require("../locale/LocaleWrapper"));
|
|
39
|
-
var import_util = require("../_util");
|
|
40
40
|
var import_Anchor = require("./Anchor");
|
|
41
41
|
var import_Dock = require("./Dock");
|
|
42
42
|
var import_EventProxy = require("./EventProxy");
|
|
43
43
|
var import_zh_CN = __toESM(require("./locale/zh-CN"));
|
|
44
|
-
var
|
|
44
|
+
var import_style = __toESM(require("./style"));
|
|
45
45
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
-
var prefix = (0, import_util.getPrefix)("dialog");
|
|
47
46
|
var DEFAULT_LEFT = 0.1;
|
|
48
47
|
var DEFAULT_TOP = 0.1;
|
|
49
48
|
var MINIMIZE_HEIGHT = 36;
|
|
@@ -53,280 +52,371 @@ var DEFAULT_WIDTH_MEMBER = 520;
|
|
|
53
52
|
var DEFAULT_HEIGHT_MEMBER = 600;
|
|
54
53
|
var DEFAULT_BORDER_WIDTH = 24;
|
|
55
54
|
var SCROLL_BAR_WIDTH = 1;
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
this.toggleMinimize = () => {
|
|
124
|
-
this.setState({
|
|
125
|
-
maximization: false,
|
|
126
|
-
minimize: !this.state.minimize
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
this.toggleMaximization = () => {
|
|
130
|
-
const enable = this.props.resizable && this.props.enableMaximization && !this.props.isEmbed;
|
|
131
|
-
if (!enable)
|
|
132
|
-
return;
|
|
133
|
-
this.setState({
|
|
134
|
-
maximization: !this.state.maximization,
|
|
135
|
-
minimize: false
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
this.onClose = (event) => {
|
|
139
|
-
var _a, _b;
|
|
140
|
-
event.stopPropagation();
|
|
141
|
-
(_b = (_a = this.props).onClose) == null ? void 0 : _b.call(_a);
|
|
142
|
-
};
|
|
143
|
-
this.getBaseStyle = () => {
|
|
144
|
-
const { visible } = this.props;
|
|
145
|
-
const baseStyle = {
|
|
146
|
-
visibility: visible ? "visible" : "hidden",
|
|
147
|
-
opacity: visible ? 1 : 0
|
|
148
|
-
};
|
|
149
|
-
return baseStyle;
|
|
150
|
-
};
|
|
151
|
-
this.getStyle = () => {
|
|
152
|
-
const { maximization, minimize, headerStyle } = this.state;
|
|
153
|
-
const transform = `translate(${this.state.moveX}px, ${this.state.moveY}px)`;
|
|
154
|
-
const baseStyle = this.getBaseStyle();
|
|
155
|
-
if (maximization && !this.props.isEmbed) {
|
|
156
|
-
return {
|
|
157
|
-
...baseStyle,
|
|
158
|
-
top: 0,
|
|
159
|
-
bottom: 0,
|
|
160
|
-
right: 0,
|
|
161
|
-
width: this.props.width || DEFAULT_WIDTH_MEMBER,
|
|
162
|
-
height: "auto",
|
|
163
|
-
borderRadius: 0
|
|
164
|
-
};
|
|
165
|
-
} else if (minimize) {
|
|
166
|
-
const { height } = headerStyle;
|
|
167
|
-
return {
|
|
168
|
-
...baseStyle,
|
|
169
|
-
...this.getCompatAbsPostion(this.state),
|
|
170
|
-
width: MINIMIZE_WIDTH,
|
|
171
|
-
height: height || MINIMIZE_HEIGHT,
|
|
172
|
-
transform
|
|
173
|
-
};
|
|
174
|
-
} else {
|
|
175
|
-
return {
|
|
176
|
-
...baseStyle,
|
|
177
|
-
...this.getCompatAbsPostion(this.state),
|
|
178
|
-
transform
|
|
179
|
-
};
|
|
180
|
-
}
|
|
55
|
+
var _container = null;
|
|
56
|
+
var getContainer = () => {
|
|
57
|
+
if (!_container) {
|
|
58
|
+
_container = document.createElement("div");
|
|
59
|
+
document.body.appendChild(_container);
|
|
60
|
+
}
|
|
61
|
+
return _container;
|
|
62
|
+
};
|
|
63
|
+
var DialogComp = (props) => {
|
|
64
|
+
const {
|
|
65
|
+
className,
|
|
66
|
+
visible,
|
|
67
|
+
children,
|
|
68
|
+
min = DEFAULT_MIN,
|
|
69
|
+
max,
|
|
70
|
+
width,
|
|
71
|
+
height,
|
|
72
|
+
left,
|
|
73
|
+
top,
|
|
74
|
+
title,
|
|
75
|
+
onClose,
|
|
76
|
+
clientWidth,
|
|
77
|
+
clientHeight,
|
|
78
|
+
resizable = true,
|
|
79
|
+
draggable = true,
|
|
80
|
+
enableMaximization = true,
|
|
81
|
+
locale,
|
|
82
|
+
extLink,
|
|
83
|
+
setRootWidth,
|
|
84
|
+
isEmbed = false
|
|
85
|
+
} = props;
|
|
86
|
+
const { getPrefixCls } = (0, import_react.useContext)(import_design.ConfigProvider.ConfigContext);
|
|
87
|
+
const prefixCls = getPrefixCls("dialog");
|
|
88
|
+
const { wrapSSR } = (0, import_style.default)(prefixCls);
|
|
89
|
+
const hostRef = (0, import_react.useRef)(null);
|
|
90
|
+
const clientXRef = (0, import_react.useRef)(0);
|
|
91
|
+
const clientYRef = (0, import_react.useRef)(0);
|
|
92
|
+
const isPointDownRef = (0, import_react.useRef)(false);
|
|
93
|
+
const originInfoRef = (0, import_react.useRef)({});
|
|
94
|
+
const [mask, setMask] = (0, import_react.useState)(true);
|
|
95
|
+
const [dialogWidth, setDialogWidth] = (0, import_react.useState)(width ?? DEFAULT_WIDTH_MEMBER);
|
|
96
|
+
const [dialogHeight, setDialogHeight] = (0, import_react.useState)(height ?? DEFAULT_HEIGHT_MEMBER);
|
|
97
|
+
const [dialogLeft, setDialogLeft] = (0, import_react.useState)(
|
|
98
|
+
left ?? clientWidth - (width ?? DEFAULT_WIDTH_MEMBER) - DEFAULT_BORDER_WIDTH
|
|
99
|
+
);
|
|
100
|
+
const [dialogTop, setDialogTop] = (0, import_react.useState)(
|
|
101
|
+
top ?? clientHeight - (height ?? DEFAULT_HEIGHT_MEMBER) - DEFAULT_BORDER_WIDTH
|
|
102
|
+
);
|
|
103
|
+
const [moveX, setMoveX] = (0, import_react.useState)(0);
|
|
104
|
+
const [moveY, setMoveY] = (0, import_react.useState)(0);
|
|
105
|
+
const [maximization, setMaximization] = (0, import_react.useState)(isEmbed);
|
|
106
|
+
const [minimize, setMinimize] = (0, import_react.useState)(false);
|
|
107
|
+
const [headerStyle, setHeaderStyle] = (0, import_react.useState)({});
|
|
108
|
+
const maxSize = (0, import_react.useMemo)(() => {
|
|
109
|
+
if (max)
|
|
110
|
+
return max;
|
|
111
|
+
return [clientWidth, clientHeight];
|
|
112
|
+
}, [max, clientWidth, clientHeight]);
|
|
113
|
+
const minSize = (0, import_react.useMemo)(() => min, [min]);
|
|
114
|
+
const getDefaultEmbedState = (0, import_react.useCallback)(() => {
|
|
115
|
+
return {
|
|
116
|
+
width: width ?? DEFAULT_WIDTH_MEMBER,
|
|
117
|
+
height: height ?? DEFAULT_HEIGHT_MEMBER,
|
|
118
|
+
left: left ?? clientWidth - (width ?? DEFAULT_WIDTH_MEMBER) - DEFAULT_BORDER_WIDTH,
|
|
119
|
+
top: top ?? clientHeight - (height ?? DEFAULT_HEIGHT_MEMBER) - DEFAULT_BORDER_WIDTH
|
|
181
120
|
};
|
|
182
|
-
|
|
121
|
+
}, [width, height, left, top, clientWidth, clientHeight]);
|
|
122
|
+
const setRootWidthInEmbedMode = (0, import_react.useCallback)(
|
|
123
|
+
(newWidth) => {
|
|
124
|
+
const restWidth = !!newWidth ? newWidth + SCROLL_BAR_WIDTH : 0;
|
|
125
|
+
const rootWidth = (clientWidth - restWidth) / clientWidth;
|
|
126
|
+
setRootWidth == null ? void 0 : setRootWidth(`${rootWidth * 100}%`);
|
|
127
|
+
},
|
|
128
|
+
[clientWidth, setRootWidth]
|
|
129
|
+
);
|
|
130
|
+
const compatClonedModel = (0, import_react.useCallback)(
|
|
131
|
+
(model) => {
|
|
183
132
|
return {
|
|
184
133
|
left: DEFAULT_LEFT,
|
|
185
134
|
top: DEFAULT_TOP,
|
|
186
|
-
width: DEFAULT_WIDTH_MEMBER /
|
|
187
|
-
height: DEFAULT_HEIGHT_MEMBER /
|
|
135
|
+
width: DEFAULT_WIDTH_MEMBER / clientWidth,
|
|
136
|
+
height: DEFAULT_HEIGHT_MEMBER / clientHeight,
|
|
188
137
|
minimize: false,
|
|
189
138
|
maximization: false,
|
|
190
139
|
...model
|
|
191
140
|
};
|
|
141
|
+
},
|
|
142
|
+
[clientWidth, clientHeight]
|
|
143
|
+
);
|
|
144
|
+
const checkSize = (w, h) => {
|
|
145
|
+
const newModel = {};
|
|
146
|
+
const result = {
|
|
147
|
+
widthShouldChange: true,
|
|
148
|
+
heightShouldChange: true
|
|
192
149
|
};
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (
|
|
217
|
-
|
|
150
|
+
if (minSize && w < minSize[0]) {
|
|
151
|
+
newModel.width = minSize[0];
|
|
152
|
+
result.widthShouldChange = false;
|
|
153
|
+
}
|
|
154
|
+
if (minSize && h < minSize[1]) {
|
|
155
|
+
newModel.height = minSize[1];
|
|
156
|
+
result.heightShouldChange = false;
|
|
157
|
+
}
|
|
158
|
+
if (maxSize && w > maxSize[0]) {
|
|
159
|
+
newModel.width = maxSize[0];
|
|
160
|
+
result.widthShouldChange = false;
|
|
161
|
+
}
|
|
162
|
+
if (maxSize && h > maxSize[1]) {
|
|
163
|
+
newModel.height = maxSize[1];
|
|
164
|
+
result.heightShouldChange = false;
|
|
165
|
+
}
|
|
166
|
+
return result;
|
|
167
|
+
};
|
|
168
|
+
(0, import_react.useEffect)(() => {
|
|
169
|
+
const host = document.createElement("div");
|
|
170
|
+
hostRef.current = host;
|
|
171
|
+
getContainer().appendChild(host);
|
|
172
|
+
return () => {
|
|
173
|
+
if (hostRef.current && getContainer().contains(hostRef.current)) {
|
|
174
|
+
getContainer().removeChild(hostRef.current);
|
|
218
175
|
}
|
|
219
|
-
this.setState({
|
|
220
|
-
...checkResult.widthShouldChange ? {
|
|
221
|
-
// @ts-ignore
|
|
222
|
-
left: this.originInfo.left + event.moveLeft,
|
|
223
|
-
width: newWidth
|
|
224
|
-
} : {},
|
|
225
|
-
...checkResult.heightShouldChange ? {
|
|
226
|
-
// @ts-ignore
|
|
227
|
-
top: this.originInfo.top + event.moveTop,
|
|
228
|
-
height: newHeight
|
|
229
|
-
} : {}
|
|
230
|
-
});
|
|
231
|
-
};
|
|
232
|
-
this.onResizeEnd = () => {
|
|
233
|
-
const { mask } = this.state;
|
|
234
|
-
if (!mask || !this.props.resizable)
|
|
235
|
-
return;
|
|
236
|
-
this.setState({ mask: false });
|
|
237
176
|
};
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (!
|
|
241
|
-
|
|
242
|
-
|
|
177
|
+
}, []);
|
|
178
|
+
(0, import_react.useEffect)(() => {
|
|
179
|
+
if (!visible) {
|
|
180
|
+
setRootWidthInEmbedMode(0);
|
|
181
|
+
return;
|
|
243
182
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
183
|
+
const tempState = getDefaultEmbedState();
|
|
184
|
+
setDialogWidth(tempState.width);
|
|
185
|
+
setDialogHeight(tempState.height);
|
|
186
|
+
setDialogLeft(tempState.left);
|
|
187
|
+
setDialogTop(tempState.top);
|
|
188
|
+
setRootWidthInEmbedMode(tempState.width);
|
|
189
|
+
}, [visible, clientWidth, clientHeight, getDefaultEmbedState, setRootWidthInEmbedMode]);
|
|
190
|
+
(0, import_react.useEffect)(() => {
|
|
191
|
+
if (isEmbed) {
|
|
192
|
+
setMinimize(false);
|
|
193
|
+
setMaximization(true);
|
|
194
|
+
} else {
|
|
195
|
+
setMinimize(false);
|
|
196
|
+
setMaximization(false);
|
|
197
|
+
if (height)
|
|
198
|
+
setDialogHeight(height);
|
|
199
|
+
if (width)
|
|
200
|
+
setDialogWidth(width);
|
|
201
|
+
if (top !== void 0)
|
|
202
|
+
setDialogTop(top);
|
|
203
|
+
if (left !== void 0)
|
|
204
|
+
setDialogLeft(left);
|
|
205
|
+
}
|
|
206
|
+
}, [isEmbed, height, width, top, left]);
|
|
207
|
+
const onDragStart = (event) => {
|
|
208
|
+
if (!draggable)
|
|
209
|
+
return;
|
|
210
|
+
if (maximization)
|
|
267
211
|
return;
|
|
212
|
+
setMask(true);
|
|
213
|
+
if (dialogLeft === void 0) {
|
|
214
|
+
setDialogLeft(DEFAULT_LEFT);
|
|
268
215
|
}
|
|
269
|
-
if (
|
|
270
|
-
|
|
271
|
-
minimize: false,
|
|
272
|
-
maximization: true
|
|
273
|
-
});
|
|
216
|
+
if (dialogTop === void 0) {
|
|
217
|
+
setDialogTop(DEFAULT_TOP);
|
|
274
218
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
219
|
+
clientXRef.current = event.clientX;
|
|
220
|
+
clientYRef.current = event.clientY;
|
|
221
|
+
isPointDownRef.current = true;
|
|
222
|
+
};
|
|
223
|
+
const onDragMove = (event) => {
|
|
224
|
+
if (!draggable || !isPointDownRef.current)
|
|
225
|
+
return;
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
setMoveX(event.clientX - clientXRef.current);
|
|
228
|
+
setMoveY(event.clientY - clientYRef.current);
|
|
229
|
+
};
|
|
230
|
+
const onDragEnd = () => {
|
|
231
|
+
if (!draggable)
|
|
232
|
+
return;
|
|
233
|
+
isPointDownRef.current = false;
|
|
234
|
+
if (moveX === 0 && moveY === 0)
|
|
235
|
+
return;
|
|
236
|
+
setMask(false);
|
|
237
|
+
setDialogLeft((prev) => (prev ?? 0) + moveX);
|
|
238
|
+
setDialogTop((prev) => (prev ?? 0) + moveY);
|
|
239
|
+
setMoveX(0);
|
|
240
|
+
setMoveY(0);
|
|
241
|
+
};
|
|
242
|
+
const detectPointUp = () => {
|
|
243
|
+
setMask(false);
|
|
244
|
+
};
|
|
245
|
+
const onResizeStart = () => {
|
|
246
|
+
if (minimize || !resizable)
|
|
247
|
+
return;
|
|
248
|
+
originInfoRef.current = compatClonedModel({
|
|
249
|
+
width: dialogWidth,
|
|
250
|
+
height: dialogHeight,
|
|
251
|
+
left: dialogLeft,
|
|
252
|
+
top: dialogTop,
|
|
253
|
+
minimize,
|
|
254
|
+
maximization
|
|
255
|
+
});
|
|
256
|
+
setMask(true);
|
|
257
|
+
};
|
|
258
|
+
const onResizeMove = (event) => {
|
|
259
|
+
event.preventDefault();
|
|
260
|
+
if (minimize || !resizable)
|
|
261
|
+
return;
|
|
262
|
+
const newWidth = originInfoRef.current.width + event.moveRight;
|
|
263
|
+
const newHeight = originInfoRef.current.height + event.moveBottom;
|
|
264
|
+
const checkResult = checkSize(newWidth, newHeight);
|
|
265
|
+
if (checkResult.widthShouldChange) {
|
|
266
|
+
setRootWidthInEmbedMode(newWidth);
|
|
283
267
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
get max() {
|
|
289
|
-
let { max } = this.props;
|
|
290
|
-
if (!max) {
|
|
291
|
-
const { clientWidth, clientHeight } = this.props;
|
|
292
|
-
max = [clientWidth, clientHeight];
|
|
268
|
+
if (checkResult.widthShouldChange) {
|
|
269
|
+
setDialogLeft(originInfoRef.current.left + event.moveLeft);
|
|
270
|
+
setDialogWidth(newWidth);
|
|
293
271
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
272
|
+
if (checkResult.heightShouldChange) {
|
|
273
|
+
setDialogTop(originInfoRef.current.top + event.moveTop);
|
|
274
|
+
setDialogHeight(newHeight);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
const onResizeEnd = () => {
|
|
278
|
+
if (!mask || !resizable)
|
|
279
|
+
return;
|
|
280
|
+
setMask(false);
|
|
281
|
+
};
|
|
282
|
+
const toggleMinimize = () => {
|
|
283
|
+
setMaximization(false);
|
|
284
|
+
setMinimize((prev) => !prev);
|
|
285
|
+
};
|
|
286
|
+
const toggleMaximization = () => {
|
|
287
|
+
const enable = resizable && enableMaximization && !isEmbed;
|
|
288
|
+
if (!enable)
|
|
289
|
+
return;
|
|
290
|
+
setMaximization((prev) => !prev);
|
|
291
|
+
setMinimize(false);
|
|
292
|
+
};
|
|
293
|
+
const handleClose = (event) => {
|
|
294
|
+
event.stopPropagation();
|
|
295
|
+
onClose == null ? void 0 : onClose();
|
|
296
|
+
};
|
|
297
|
+
const getBaseStyle = (0, import_react.useCallback)(() => {
|
|
298
|
+
return {
|
|
299
|
+
visibility: visible ? "visible" : "hidden",
|
|
300
|
+
opacity: visible ? 1 : 0
|
|
309
301
|
};
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
]
|
|
302
|
+
}, [visible]);
|
|
303
|
+
const getCompatAbsPostion = (0, import_react.useCallback)(
|
|
304
|
+
(info) => {
|
|
305
|
+
const compatInfo = compatClonedModel(info);
|
|
306
|
+
const { minimize: isMinimize } = compatInfo;
|
|
307
|
+
const ret = {};
|
|
308
|
+
["left", "width", "top", "height"].forEach((key) => {
|
|
309
|
+
ret[key] = compatInfo[key];
|
|
310
|
+
});
|
|
311
|
+
if (maxSize && ret.width > maxSize[0]) {
|
|
312
|
+
ret.width = maxSize[0];
|
|
321
313
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
314
|
+
if (maxSize && ret.height > maxSize[1]) {
|
|
315
|
+
ret.height = maxSize[1];
|
|
316
|
+
}
|
|
317
|
+
if (minSize && ret.width < minSize[0]) {
|
|
318
|
+
ret.width = minSize[0];
|
|
319
|
+
}
|
|
320
|
+
if (minSize && ret.height < minSize[1]) {
|
|
321
|
+
ret.height = minSize[1];
|
|
322
|
+
}
|
|
323
|
+
ret.width = isMinimize ? MINIMIZE_WIDTH : ret.width;
|
|
324
|
+
ret.height = isMinimize ? MINIMIZE_HEIGHT : ret.height;
|
|
325
|
+
if (ret.left + ret.width > clientWidth) {
|
|
326
|
+
ret.left = clientWidth - ret.width;
|
|
327
|
+
}
|
|
328
|
+
if (ret.left < 0) {
|
|
329
|
+
ret.left = 0;
|
|
330
|
+
}
|
|
331
|
+
if (ret.top < 0) {
|
|
332
|
+
ret.top = 0;
|
|
333
|
+
}
|
|
334
|
+
if (ret.top + ret.height > clientHeight) {
|
|
335
|
+
ret.top = clientHeight - ret.height;
|
|
336
|
+
}
|
|
337
|
+
return ret;
|
|
338
|
+
},
|
|
339
|
+
[maxSize, minSize, clientWidth, clientHeight, compatClonedModel]
|
|
340
|
+
);
|
|
341
|
+
(0, import_react.useEffect)(() => {
|
|
342
|
+
if (!visible)
|
|
343
|
+
return;
|
|
344
|
+
const adjusted = getCompatAbsPostion({
|
|
345
|
+
width: dialogWidth,
|
|
346
|
+
height: dialogHeight,
|
|
347
|
+
left: dialogLeft,
|
|
348
|
+
top: dialogTop,
|
|
349
|
+
minimize
|
|
350
|
+
});
|
|
351
|
+
if (adjusted.left !== dialogLeft) {
|
|
352
|
+
setDialogLeft(adjusted.left);
|
|
353
|
+
}
|
|
354
|
+
if (adjusted.top !== dialogTop) {
|
|
355
|
+
setDialogTop(adjusted.top);
|
|
356
|
+
}
|
|
357
|
+
}, [dialogWidth, dialogHeight, dialogLeft, dialogTop, minimize, visible, getCompatAbsPostion]);
|
|
358
|
+
const getStyle = (0, import_react.useMemo)(() => {
|
|
359
|
+
const transform = `translate(${moveX}px, ${moveY}px)`;
|
|
360
|
+
const baseStyle = getBaseStyle();
|
|
361
|
+
if (maximization && !isEmbed) {
|
|
362
|
+
return {
|
|
363
|
+
...baseStyle,
|
|
364
|
+
top: 0,
|
|
365
|
+
bottom: 0,
|
|
366
|
+
right: 0,
|
|
367
|
+
width: width || DEFAULT_WIDTH_MEMBER,
|
|
368
|
+
height: "auto",
|
|
369
|
+
borderRadius: 0
|
|
370
|
+
};
|
|
371
|
+
} else if (minimize) {
|
|
372
|
+
const { height: headerHeight } = headerStyle;
|
|
373
|
+
const position = getCompatAbsPostion({
|
|
374
|
+
width: dialogWidth,
|
|
375
|
+
height: dialogHeight,
|
|
376
|
+
left: dialogLeft,
|
|
377
|
+
top: dialogTop,
|
|
378
|
+
minimize
|
|
379
|
+
});
|
|
380
|
+
return {
|
|
381
|
+
...baseStyle,
|
|
382
|
+
...position,
|
|
383
|
+
width: MINIMIZE_WIDTH,
|
|
384
|
+
height: headerHeight || MINIMIZE_HEIGHT,
|
|
385
|
+
transform
|
|
386
|
+
};
|
|
387
|
+
} else {
|
|
388
|
+
const position = getCompatAbsPostion({
|
|
389
|
+
width: dialogWidth,
|
|
390
|
+
height: dialogHeight,
|
|
391
|
+
left: dialogLeft,
|
|
392
|
+
top: dialogTop
|
|
393
|
+
});
|
|
394
|
+
return {
|
|
395
|
+
...baseStyle,
|
|
396
|
+
...position,
|
|
397
|
+
transform
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
}, [
|
|
401
|
+
maximization,
|
|
402
|
+
isEmbed,
|
|
403
|
+
minimize,
|
|
404
|
+
moveX,
|
|
405
|
+
moveY,
|
|
406
|
+
width,
|
|
407
|
+
headerStyle,
|
|
408
|
+
dialogWidth,
|
|
409
|
+
dialogHeight,
|
|
410
|
+
dialogLeft,
|
|
411
|
+
dialogTop,
|
|
412
|
+
getCompatAbsPostion,
|
|
413
|
+
getBaseStyle
|
|
414
|
+
]);
|
|
415
|
+
const renderControlLink = () => {
|
|
416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefixCls}-item`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
327
417
|
"a",
|
|
328
418
|
{
|
|
329
|
-
className: `${
|
|
419
|
+
className: `${prefixCls}-item-link`,
|
|
330
420
|
href: extLink == null ? void 0 : extLink.link,
|
|
331
421
|
target: "_blank",
|
|
332
422
|
rel: "noopener noreferrer",
|
|
@@ -339,242 +429,176 @@ var _DialogComp = class extends import_react.default.PureComponent {
|
|
|
339
429
|
xmlns: "http://www.w3.org/2000/svg",
|
|
340
430
|
width: "16",
|
|
341
431
|
height: "16",
|
|
342
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
343
|
-
"path",
|
|
344
|
-
{
|
|
345
|
-
d: "M880.0256 912.0256H144.0256a31.9488 31.9488 0 0 1-32.0512-32V144.0256c0-17.7152 14.336-32.0512 32.0512-32.0512h359.936c4.4544 0 8.0384 3.584 8.0384 8.0384v56.0128c0 4.352-3.584 7.9872-7.9872 7.9872h-320v655.9744h655.9744v-320c0-4.4032 3.584-7.9872 8.0384-7.9872h55.9616c4.4032 0 8.0384 3.584 8.0384 7.9872v359.9872c0 17.7152-14.336 32-32 32zM770.8672 199.1168l-52.224-52.224a8.0384 8.0384 0 0 1 4.7104-13.568l179.4048-20.992c5.12-0.6144 9.5232 3.6864 8.9088 8.9088l-20.992 179.4048a8.0384 8.0384 0 0 1-13.6192 4.6592L824.6784 252.928l-256.2048 256.2048c-3.072 3.072-8.192 3.072-11.264 0l-42.4448-42.3936a8.0384 8.0384 0 0 1 0-11.264l256.1024-256.3584z"
|
|
346
|
-
}
|
|
347
|
-
)
|
|
432
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M880.0256 912.0256H144.0256a31.9488 31.9488 0 0 1-32.0512-32V144.0256c0-17.7152 14.336-32.0512 32.0512-32.0512h359.936c4.4544 0 8.0384 3.584 8.0384 8.0384v56.0128c0 4.352-3.584 7.9872-7.9872 7.9872h-320v655.9744h655.9744v-320c0-4.4032 3.584-7.9872 8.0384-7.9872h55.9616c4.4032 0 8.0384 3.584 8.0384 7.9872v359.9872c0 17.7152-14.336 32-32 32zM770.8672 199.1168l-52.224-52.224a8.0384 8.0384 0 0 1 4.7104-13.568l179.4048-20.992c5.12-0.6144 9.5232 3.6864 8.9088 8.9088l-20.992 179.4048a8.0384 8.0384 0 0 1-13.6192 4.6592L824.6784 252.928l-256.2048 256.2048c-3.072 3.072-8.192 3.072-11.264 0l-42.4448-42.3936a8.0384 8.0384 0 0 1 0-11.264l256.1024-256.3584z" })
|
|
348
433
|
}
|
|
349
434
|
)
|
|
350
435
|
}
|
|
351
436
|
) });
|
|
352
|
-
}
|
|
353
|
-
renderControls() {
|
|
354
|
-
const { maximization, minimize } = this.state;
|
|
355
|
-
const { enableMaximization, isEmbed } = this.props;
|
|
437
|
+
};
|
|
438
|
+
const renderControls = () => {
|
|
356
439
|
if (isEmbed) {
|
|
357
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: `${
|
|
358
|
-
|
|
359
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${
|
|
440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: `${prefixCls}-controls`, children: [
|
|
441
|
+
renderControlLink(),
|
|
442
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefixCls}-item`, onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CloseOutlined, {}) })
|
|
360
443
|
] });
|
|
361
444
|
}
|
|
362
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: `${
|
|
363
|
-
|
|
364
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${
|
|
365
|
-
enableMaximization && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${
|
|
366
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${
|
|
445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: `${prefixCls}-controls`, children: [
|
|
446
|
+
renderControlLink(),
|
|
447
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefixCls}-item`, onClick: toggleMinimize, children: minimize ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ExpandAltOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.MinusOutlined, {}) }),
|
|
448
|
+
enableMaximization && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefixCls}-item`, onClick: toggleMaximization, children: maximization ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.FullscreenExitOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.FullscreenOutlined, {}) }),
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefixCls}-item`, onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CloseOutlined, {}) })
|
|
367
450
|
] });
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
const
|
|
451
|
+
};
|
|
452
|
+
const renderHeader = () => {
|
|
453
|
+
const headerStyleObj = {
|
|
454
|
+
...headerStyle,
|
|
455
|
+
...minimize ? { boxShadow: "0 2px 20px 0 rgba(4, 1, 30, 0.07)" } : {},
|
|
456
|
+
...isEmbed ? { cursor: "initial" } : {}
|
|
457
|
+
};
|
|
371
458
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
372
|
-
"
|
|
459
|
+
"header",
|
|
373
460
|
{
|
|
374
|
-
className: `${
|
|
375
|
-
style:
|
|
461
|
+
className: `${prefixCls}-header`,
|
|
462
|
+
style: headerStyleObj,
|
|
463
|
+
onPointerDown: onDragStart,
|
|
464
|
+
onDoubleClick: toggleMaximization,
|
|
376
465
|
children: [
|
|
377
|
-
|
|
378
|
-
|
|
466
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefixCls}-title`, children: title || (locale == null ? void 0 : locale.helpDocument) }),
|
|
467
|
+
renderControls()
|
|
379
468
|
]
|
|
380
469
|
}
|
|
381
470
|
);
|
|
382
|
-
}
|
|
383
|
-
renderMask() {
|
|
384
|
-
if (!
|
|
385
|
-
return;
|
|
386
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
ret[key] = compatInfo[key];
|
|
396
|
-
});
|
|
397
|
-
const { max } = this;
|
|
398
|
-
const { min } = this;
|
|
399
|
-
if (max && ret.width > max[0]) {
|
|
400
|
-
ret.width = max[0];
|
|
401
|
-
}
|
|
402
|
-
if (max && ret.height > max[1]) {
|
|
403
|
-
ret.height = max[1];
|
|
404
|
-
}
|
|
405
|
-
if (min && ret.width < min[0]) {
|
|
406
|
-
ret.width = min[0];
|
|
407
|
-
}
|
|
408
|
-
if (min && ret.height < min[1]) {
|
|
409
|
-
ret.height = min[1];
|
|
410
|
-
}
|
|
411
|
-
ret.width = minimize ? MINIMIZE_WIDTH : ret.width;
|
|
412
|
-
ret.height = minimize ? MINIMIZE_HEIGHT : ret.height;
|
|
413
|
-
if (ret.left + ret.width > clientWidth) {
|
|
414
|
-
ret.left = clientWidth - ret.width;
|
|
415
|
-
this.setState({ left: ret.left });
|
|
416
|
-
}
|
|
417
|
-
if (ret.left < 0) {
|
|
418
|
-
this.setState({ left: 0 });
|
|
419
|
-
}
|
|
420
|
-
if (ret.top < 0) {
|
|
421
|
-
this.setState({ top: 0 });
|
|
422
|
-
}
|
|
423
|
-
if (ret.top + ret.height > clientHeight) {
|
|
424
|
-
ret.top = clientHeight - ret.height;
|
|
425
|
-
this.setState({ top: ret.top });
|
|
426
|
-
}
|
|
427
|
-
return ret;
|
|
428
|
-
}
|
|
429
|
-
renderDialog() {
|
|
430
|
-
const style = this.getStyle();
|
|
431
|
-
const { className, isEmbed } = this.props;
|
|
432
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
433
|
-
"div",
|
|
434
|
-
{
|
|
435
|
-
className: `${prefix}-container ${className} ${isEmbed ? `${prefix}-container-embed` : ""}`,
|
|
436
|
-
style,
|
|
437
|
-
...this.state.minimize ? {} : { tabIndex: 0 },
|
|
438
|
-
children: [
|
|
439
|
-
this.renderHeader(),
|
|
440
|
-
this.renderContent(),
|
|
441
|
-
isEmbed ? this.renderEmbedBorders() : this.renderBorders(),
|
|
442
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_EventProxy.EventProxy, { onPointerMove: this.onDragMove, onPointerUp: this.onDragEnd }),
|
|
443
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_EventProxy.EventProxy, { onPointerUp: this.detectPointUp })
|
|
444
|
-
]
|
|
445
|
-
}
|
|
446
|
-
) });
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* width,height 是否在最大最小值的范围内
|
|
450
|
-
*/
|
|
451
|
-
checkSize(width, height) {
|
|
452
|
-
const { max } = this;
|
|
453
|
-
const { min } = this;
|
|
454
|
-
const newModel = {};
|
|
455
|
-
const result = {
|
|
456
|
-
widthShouldChange: true,
|
|
457
|
-
heightShouldChange: true
|
|
458
|
-
};
|
|
459
|
-
if (min && width < min[0]) {
|
|
460
|
-
newModel.width = min[0];
|
|
461
|
-
result.widthShouldChange = false;
|
|
462
|
-
}
|
|
463
|
-
if (min && height < min[1]) {
|
|
464
|
-
newModel.height = min[1];
|
|
465
|
-
result.heightShouldChange = false;
|
|
466
|
-
}
|
|
467
|
-
if (max && width > max[0]) {
|
|
468
|
-
newModel.width = max[0];
|
|
469
|
-
result.widthShouldChange = false;
|
|
470
|
-
}
|
|
471
|
-
if (max && height > max[1]) {
|
|
472
|
-
newModel.height = max[1];
|
|
473
|
-
result.heightShouldChange = false;
|
|
474
|
-
}
|
|
475
|
-
return result;
|
|
476
|
-
}
|
|
477
|
-
renderEmbedBorders() {
|
|
471
|
+
};
|
|
472
|
+
const renderMask = () => {
|
|
473
|
+
if (!mask)
|
|
474
|
+
return null;
|
|
475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${prefixCls}-mask` });
|
|
476
|
+
};
|
|
477
|
+
const renderContent = () => {
|
|
478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", { className: `${prefixCls}-main`, style: minimize ? { visibility: "hidden" } : {}, children: [
|
|
479
|
+
renderMask(),
|
|
480
|
+
children
|
|
481
|
+
] });
|
|
482
|
+
};
|
|
483
|
+
const renderEmbedBorders = () => {
|
|
478
484
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
479
485
|
import_Anchor.Anchor,
|
|
480
486
|
{
|
|
487
|
+
prefixCls,
|
|
481
488
|
dock: import_Dock.Dock.left,
|
|
482
|
-
onStart:
|
|
483
|
-
onMove:
|
|
484
|
-
onEnd:
|
|
489
|
+
onStart: onResizeStart,
|
|
490
|
+
onMove: onResizeMove,
|
|
491
|
+
onEnd: onResizeEnd
|
|
485
492
|
}
|
|
486
493
|
) });
|
|
487
|
-
}
|
|
488
|
-
renderBorders() {
|
|
494
|
+
};
|
|
495
|
+
const renderBorders = () => {
|
|
489
496
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.default.Fragment, { children: [
|
|
490
497
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
491
498
|
import_Anchor.Anchor,
|
|
492
499
|
{
|
|
500
|
+
prefixCls,
|
|
493
501
|
dock: import_Dock.Dock.top,
|
|
494
|
-
onStart:
|
|
495
|
-
onMove:
|
|
496
|
-
onEnd:
|
|
502
|
+
onStart: onResizeStart,
|
|
503
|
+
onMove: onResizeMove,
|
|
504
|
+
onEnd: onResizeEnd
|
|
497
505
|
}
|
|
498
506
|
),
|
|
499
507
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
500
508
|
import_Anchor.Anchor,
|
|
501
509
|
{
|
|
510
|
+
prefixCls,
|
|
502
511
|
dock: import_Dock.Dock.right,
|
|
503
|
-
onStart:
|
|
504
|
-
onMove:
|
|
505
|
-
onEnd:
|
|
512
|
+
onStart: onResizeStart,
|
|
513
|
+
onMove: onResizeMove,
|
|
514
|
+
onEnd: onResizeEnd
|
|
506
515
|
}
|
|
507
516
|
),
|
|
508
517
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
509
518
|
import_Anchor.Anchor,
|
|
510
519
|
{
|
|
520
|
+
prefixCls,
|
|
511
521
|
dock: import_Dock.Dock.bottom,
|
|
512
|
-
onStart:
|
|
513
|
-
onMove:
|
|
514
|
-
onEnd:
|
|
522
|
+
onStart: onResizeStart,
|
|
523
|
+
onMove: onResizeMove,
|
|
524
|
+
onEnd: onResizeEnd
|
|
515
525
|
}
|
|
516
526
|
),
|
|
517
527
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
518
528
|
import_Anchor.Anchor,
|
|
519
529
|
{
|
|
530
|
+
prefixCls,
|
|
520
531
|
dock: import_Dock.Dock.left,
|
|
521
|
-
onStart:
|
|
522
|
-
onMove:
|
|
523
|
-
onEnd:
|
|
532
|
+
onStart: onResizeStart,
|
|
533
|
+
onMove: onResizeMove,
|
|
534
|
+
onEnd: onResizeEnd
|
|
524
535
|
}
|
|
525
536
|
),
|
|
526
537
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
527
538
|
import_Anchor.Anchor,
|
|
528
539
|
{
|
|
540
|
+
prefixCls,
|
|
529
541
|
dock: import_Dock.Dock.topLeft,
|
|
530
|
-
onStart:
|
|
531
|
-
onMove:
|
|
532
|
-
onEnd:
|
|
542
|
+
onStart: onResizeStart,
|
|
543
|
+
onMove: onResizeMove,
|
|
544
|
+
onEnd: onResizeEnd
|
|
533
545
|
}
|
|
534
546
|
),
|
|
535
547
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
536
548
|
import_Anchor.Anchor,
|
|
537
549
|
{
|
|
550
|
+
prefixCls,
|
|
538
551
|
dock: import_Dock.Dock.topRight,
|
|
539
|
-
onStart:
|
|
540
|
-
onMove:
|
|
541
|
-
onEnd:
|
|
552
|
+
onStart: onResizeStart,
|
|
553
|
+
onMove: onResizeMove,
|
|
554
|
+
onEnd: onResizeEnd
|
|
542
555
|
}
|
|
543
556
|
),
|
|
544
557
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
545
558
|
import_Anchor.Anchor,
|
|
546
559
|
{
|
|
560
|
+
prefixCls,
|
|
547
561
|
dock: import_Dock.Dock.bottomLeft,
|
|
548
|
-
onStart:
|
|
549
|
-
onMove:
|
|
550
|
-
onEnd:
|
|
562
|
+
onStart: onResizeStart,
|
|
563
|
+
onMove: onResizeMove,
|
|
564
|
+
onEnd: onResizeEnd
|
|
551
565
|
}
|
|
552
566
|
),
|
|
553
567
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
554
568
|
import_Anchor.Anchor,
|
|
555
569
|
{
|
|
570
|
+
prefixCls,
|
|
556
571
|
dock: import_Dock.Dock.bottomRight,
|
|
557
|
-
onStart:
|
|
558
|
-
onMove:
|
|
559
|
-
onEnd:
|
|
572
|
+
onStart: onResizeStart,
|
|
573
|
+
onMove: onResizeMove,
|
|
574
|
+
onEnd: onResizeEnd
|
|
560
575
|
}
|
|
561
576
|
)
|
|
562
577
|
] });
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
+
};
|
|
579
|
+
const renderDialog = () => {
|
|
580
|
+
const style = getStyle;
|
|
581
|
+
return wrapSSR(
|
|
582
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
583
|
+
"div",
|
|
584
|
+
{
|
|
585
|
+
className: `${prefixCls}-container ${className || ""} ${isEmbed ? `${prefixCls}-container-embed` : ""}`,
|
|
586
|
+
style,
|
|
587
|
+
...minimize ? {} : { tabIndex: 0 },
|
|
588
|
+
children: [
|
|
589
|
+
renderHeader(),
|
|
590
|
+
renderContent(),
|
|
591
|
+
isEmbed ? renderEmbedBorders() : renderBorders(),
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_EventProxy.EventProxy, { onPointerMove: onDragMove, onPointerUp: onDragEnd }),
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_EventProxy.EventProxy, { onPointerUp: detectPointUp })
|
|
594
|
+
]
|
|
595
|
+
}
|
|
596
|
+
)
|
|
597
|
+
);
|
|
598
|
+
};
|
|
599
|
+
if (!visible && !isEmbed)
|
|
600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Fragment, {});
|
|
601
|
+
return (0, import_react_dom.createPortal)(renderDialog(), getContainer());
|
|
578
602
|
};
|
|
579
603
|
var Dialog_default = (0, import_LocaleWrapper.default)({
|
|
580
604
|
componentName: "Dialog",
|