@oceanbase/ui 1.0.0-alpha.4 → 1.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/dist/ui.min.css +1 -1
  2. package/dist/ui.min.js +1 -1
  3. package/es/Action/Item.d.ts +6 -15
  4. package/es/Action/Item.js +85 -128
  5. package/es/Action/index.d.ts +6 -3
  6. package/es/BasicLayout/style/index.js +30 -18
  7. package/es/BatchOperationBar/index.d.ts +0 -1
  8. package/es/BatchOperationBar/index.js +17 -13
  9. package/es/BatchOperationBar/style/index.d.ts +10 -0
  10. package/es/BatchOperationBar/style/index.js +51 -0
  11. package/es/Boundary/Components/Code.js +11 -5
  12. package/es/Boundary/Components/Exception.js +85 -74
  13. package/es/Boundary/Components/Function.js +11 -5
  14. package/es/Boundary/index.d.ts +0 -1
  15. package/es/Boundary/index.js +0 -1
  16. package/es/Boundary/style/index.d.ts +10 -0
  17. package/es/Boundary/style/index.js +46 -0
  18. package/es/ContentWithIcon/index.d.ts +0 -1
  19. package/es/ContentWithIcon/index.js +29 -29
  20. package/es/ContentWithIcon/style/index.d.ts +10 -0
  21. package/es/ContentWithIcon/style/index.js +26 -0
  22. package/es/DateRanger/PickerPanel.js +5 -4
  23. package/es/DateRanger/Ranger.d.ts +0 -1
  24. package/es/DateRanger/Ranger.js +13 -8
  25. package/es/DateRanger/style/index.d.ts +10 -0
  26. package/es/DateRanger/style/index.js +126 -0
  27. package/es/Dialog/Anchor.d.ts +2 -10
  28. package/es/Dialog/Anchor.js +67 -96
  29. package/es/Dialog/index.d.ts +0 -1
  30. package/es/Dialog/index.js +537 -578
  31. package/es/Dialog/style/index.d.ts +10 -0
  32. package/es/Dialog/style/index.js +97 -0
  33. package/es/FullscreenBox/index.d.ts +0 -1
  34. package/es/FullscreenBox/index.js +46 -37
  35. package/es/FullscreenBox/style/index.d.ts +10 -0
  36. package/es/FullscreenBox/style/index.js +53 -0
  37. package/es/GraphToolbar/index.d.ts +0 -1
  38. package/es/GraphToolbar/index.js +19 -16
  39. package/es/GraphToolbar/style/index.d.ts +10 -0
  40. package/es/GraphToolbar/style/index.js +60 -0
  41. package/es/Highlight/DiffView/index.d.ts +0 -1
  42. package/es/Highlight/DiffView/index.js +5 -5
  43. package/es/Highlight/JsonView.d.ts +0 -1
  44. package/es/Highlight/JsonView.js +5 -5
  45. package/es/Highlight/index.d.ts +0 -1
  46. package/es/Highlight/index.js +23 -23
  47. package/es/Highlight/style/index.d.ts +10 -0
  48. package/es/Highlight/style/index.js +213 -0
  49. package/es/Login/ActivateForm.d.ts +0 -1
  50. package/es/Login/ActivateForm.js +12 -9
  51. package/es/Login/LoginForm.d.ts +0 -1
  52. package/es/Login/LoginForm.js +20 -15
  53. package/es/Login/RegisterForm.d.ts +0 -1
  54. package/es/Login/RegisterForm.js +14 -11
  55. package/es/Login/index.d.ts +0 -1
  56. package/es/Login/index.js +24 -22
  57. package/es/Login/style/index.d.ts +10 -0
  58. package/es/Login/style/index.js +182 -0
  59. package/es/NavMenu/index.d.ts +1 -2
  60. package/es/NavMenu/index.js +11 -8
  61. package/es/NavMenu/style/index.d.ts +10 -0
  62. package/es/NavMenu/style/index.js +47 -0
  63. package/es/Ranger/QuickPicker.js +8 -4
  64. package/es/Ranger/Ranger.d.ts +0 -1
  65. package/es/Ranger/Ranger.js +12 -9
  66. package/es/Ranger/style/index.d.ts +10 -0
  67. package/es/Ranger/style/index.js +44 -0
  68. package/es/SideTip/index.d.ts +0 -1
  69. package/es/SideTip/index.js +24 -22
  70. package/es/SideTip/style/index.d.ts +10 -0
  71. package/es/SideTip/style/index.js +162 -0
  72. package/es/TagSelect/Group.d.ts +6 -6
  73. package/es/TagSelect/Group.js +5 -3
  74. package/es/TagSelect/Item.js +5 -3
  75. package/es/TaskGraph/Graph/style/index.d.ts +10 -0
  76. package/es/TaskGraph/Graph/style/index.js +28 -0
  77. package/es/TaskGraph/Graph.d.ts +0 -1
  78. package/es/TaskGraph/Graph.js +26 -10
  79. package/es/TaskGraph/index.d.ts +0 -1
  80. package/es/TaskGraph/index.js +10 -7
  81. package/es/TaskGraph/style/index.d.ts +10 -0
  82. package/es/TaskGraph/style/index.js +102 -0
  83. package/es/Welcome/index.d.ts +0 -1
  84. package/es/Welcome/index.js +30 -26
  85. package/es/Welcome/step/style/index.d.ts +10 -0
  86. package/es/Welcome/step/style/index.js +44 -0
  87. package/es/Welcome/step.d.ts +0 -1
  88. package/es/Welcome/step.js +17 -14
  89. package/es/Welcome/style/index.d.ts +10 -0
  90. package/es/Welcome/style/index.js +141 -0
  91. package/es/index.d.ts +0 -1
  92. package/es/index.js +0 -1
  93. package/lib/Action/Item.d.ts +6 -15
  94. package/lib/Action/Item.js +66 -81
  95. package/lib/Action/index.d.ts +6 -3
  96. package/lib/BasicLayout/style/index.js +27 -18
  97. package/lib/BatchOperationBar/index.d.ts +0 -1
  98. package/lib/BatchOperationBar/index.js +54 -50
  99. package/lib/BatchOperationBar/style/index.d.ts +10 -0
  100. package/lib/BatchOperationBar/style/index.js +82 -0
  101. package/lib/Boundary/Components/Code.js +23 -17
  102. package/lib/Boundary/Components/Exception.js +40 -29
  103. package/lib/Boundary/Components/Function.js +18 -12
  104. package/lib/Boundary/index.d.ts +0 -1
  105. package/lib/Boundary/index.js +0 -1
  106. package/lib/Boundary/style/index.d.ts +10 -0
  107. package/lib/Boundary/style/index.js +74 -0
  108. package/lib/ContentWithIcon/index.d.ts +0 -1
  109. package/lib/ContentWithIcon/index.js +35 -32
  110. package/lib/ContentWithIcon/style/index.d.ts +10 -0
  111. package/lib/ContentWithIcon/style/index.js +57 -0
  112. package/lib/DateRanger/PickerPanel.js +2 -2
  113. package/lib/DateRanger/Ranger.d.ts +0 -1
  114. package/lib/DateRanger/Ranger.js +353 -348
  115. package/lib/DateRanger/style/index.d.ts +10 -0
  116. package/lib/DateRanger/style/index.js +195 -0
  117. package/lib/Dialog/Anchor.d.ts +2 -10
  118. package/lib/Dialog/Anchor.js +58 -60
  119. package/lib/Dialog/index.d.ts +0 -1
  120. package/lib/Dialog/index.js +446 -422
  121. package/lib/Dialog/style/index.d.ts +10 -0
  122. package/lib/Dialog/style/index.js +135 -0
  123. package/lib/FullscreenBox/index.d.ts +0 -1
  124. package/lib/FullscreenBox/index.js +47 -38
  125. package/lib/FullscreenBox/style/index.d.ts +10 -0
  126. package/lib/FullscreenBox/style/index.js +86 -0
  127. package/lib/GraphToolbar/index.d.ts +0 -1
  128. package/lib/GraphToolbar/index.js +69 -66
  129. package/lib/GraphToolbar/style/index.d.ts +10 -0
  130. package/lib/GraphToolbar/style/index.js +91 -0
  131. package/lib/Highlight/DiffView/index.d.ts +0 -1
  132. package/lib/Highlight/DiffView/index.js +3 -3
  133. package/lib/Highlight/JsonView.d.ts +0 -1
  134. package/lib/Highlight/JsonView.js +3 -3
  135. package/lib/Highlight/index.d.ts +0 -1
  136. package/lib/Highlight/index.js +32 -29
  137. package/lib/Highlight/style/index.d.ts +10 -0
  138. package/lib/Highlight/style/index.js +293 -0
  139. package/lib/Login/ActivateForm.d.ts +0 -1
  140. package/lib/Login/ActivateForm.js +17 -9
  141. package/lib/Login/LoginForm.d.ts +0 -1
  142. package/lib/Login/LoginForm.js +25 -13
  143. package/lib/Login/RegisterForm.d.ts +0 -1
  144. package/lib/Login/RegisterForm.js +17 -9
  145. package/lib/Login/index.d.ts +0 -1
  146. package/lib/Login/index.js +96 -94
  147. package/lib/Login/style/index.d.ts +10 -0
  148. package/lib/Login/style/index.js +267 -0
  149. package/lib/NavMenu/index.d.ts +1 -2
  150. package/lib/NavMenu/index.js +20 -17
  151. package/lib/NavMenu/style/index.d.ts +10 -0
  152. package/lib/NavMenu/style/index.js +78 -0
  153. package/lib/Ranger/QuickPicker.js +4 -2
  154. package/lib/Ranger/Ranger.d.ts +0 -1
  155. package/lib/Ranger/Ranger.js +48 -45
  156. package/lib/Ranger/style/index.d.ts +10 -0
  157. package/lib/Ranger/style/index.js +82 -0
  158. package/lib/SideTip/index.d.ts +0 -1
  159. package/lib/SideTip/index.js +46 -38
  160. package/lib/SideTip/style/index.d.ts +10 -0
  161. package/lib/SideTip/style/index.js +211 -0
  162. package/lib/TagSelect/Group.d.ts +6 -6
  163. package/lib/TagSelect/Group.js +3 -2
  164. package/lib/TagSelect/Item.js +3 -2
  165. package/lib/TaskGraph/Graph/style/index.d.ts +10 -0
  166. package/lib/TaskGraph/Graph/style/index.js +56 -0
  167. package/lib/TaskGraph/Graph.d.ts +0 -1
  168. package/lib/TaskGraph/Graph.js +16 -7
  169. package/lib/TaskGraph/index.d.ts +0 -1
  170. package/lib/TaskGraph/index.js +6 -5
  171. package/lib/TaskGraph/style/index.d.ts +10 -0
  172. package/lib/TaskGraph/style/index.js +143 -0
  173. package/lib/Welcome/index.d.ts +0 -1
  174. package/lib/Welcome/index.js +64 -59
  175. package/lib/Welcome/step/style/index.d.ts +10 -0
  176. package/lib/Welcome/step/style/index.js +74 -0
  177. package/lib/Welcome/step.d.ts +0 -1
  178. package/lib/Welcome/step.js +17 -13
  179. package/lib/Welcome/style/index.d.ts +10 -0
  180. package/lib/Welcome/style/index.js +188 -0
  181. package/lib/index.d.ts +0 -1
  182. package/lib/index.js +0 -1
  183. package/package.json +4 -7
  184. package/es/BatchOperationBar/index.less +0 -46
  185. package/es/BatchOperationBar/index.less.d.ts +0 -15
  186. package/es/Boundary/index.less +0 -36
  187. package/es/ContentWithIcon/index.less +0 -21
  188. package/es/DateRanger/index.less +0 -180
  189. package/es/Dialog/index.less +0 -116
  190. package/es/FullscreenBox/index.less +0 -51
  191. package/es/GraphToolbar/index.less +0 -65
  192. package/es/Highlight/index.less +0 -381
  193. package/es/Login/index.less +0 -268
  194. package/es/NavMenu/index.less +0 -50
  195. package/es/Ranger/index.less +0 -57
  196. package/es/SideTip/index.less +0 -180
  197. package/es/TaskGraph/graph.less +0 -23
  198. package/es/TaskGraph/index.less +0 -117
  199. package/es/Welcome/index.less +0 -185
  200. package/es/index.less +0 -1
  201. package/es/variable.less +0 -54
  202. package/lib/BatchOperationBar/index.less +0 -46
  203. package/lib/BatchOperationBar/index.less.d.ts +0 -15
  204. package/lib/Boundary/index.less +0 -36
  205. package/lib/ContentWithIcon/index.less +0 -21
  206. package/lib/DateRanger/index.less +0 -180
  207. package/lib/Dialog/index.less +0 -116
  208. package/lib/FullscreenBox/index.less +0 -51
  209. package/lib/GraphToolbar/index.less +0 -65
  210. package/lib/Highlight/index.less +0 -381
  211. package/lib/Login/index.less +0 -268
  212. package/lib/NavMenu/index.less +0 -50
  213. package/lib/Ranger/index.less +0 -57
  214. package/lib/SideTip/index.less +0 -180
  215. package/lib/TaskGraph/graph.less +0 -23
  216. package/lib/TaskGraph/index.less +0 -117
  217. package/lib/Welcome/index.less +0 -185
  218. package/lib/index.less +0 -1
  219. package/lib/variable.less +0 -54
@@ -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 import_index = require("./index.less");
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 _DialogComp = class extends import_react.default.PureComponent {
57
- constructor() {
58
- super(...arguments);
59
- this.state = {
60
- mask: true,
61
- width: this.props.width ?? DEFAULT_WIDTH_MEMBER,
62
- height: this.props.height ?? DEFAULT_HEIGHT_MEMBER,
63
- left: this.props.left ?? this.props.clientWidth - (this.props.width ?? DEFAULT_WIDTH_MEMBER) - DEFAULT_BORDER_WIDTH,
64
- top: this.props.top ?? this.props.clientHeight - (this.props.height ?? DEFAULT_HEIGHT_MEMBER) - DEFAULT_BORDER_WIDTH,
65
- moveX: 0,
66
- moveY: 0,
67
- maximization: this.props.isEmbed,
68
- minimize: false,
69
- headerStyle: {}
70
- };
71
- this.clientX = 0;
72
- this.clientY = 0;
73
- this.getDefaultEmbedState = () => {
74
- const { clientHeight, clientWidth, width, height, left, top } = this.props;
75
- return {
76
- width: width ?? DEFAULT_WIDTH_MEMBER,
77
- height: height ?? DEFAULT_HEIGHT_MEMBER,
78
- left: left ?? clientWidth - (width ?? DEFAULT_WIDTH_MEMBER) - DEFAULT_BORDER_WIDTH,
79
- top: top ?? clientHeight - (height ?? DEFAULT_HEIGHT_MEMBER) - DEFAULT_BORDER_WIDTH
80
- };
81
- };
82
- this.host = document.createElement("div");
83
- this.isPointDown = false;
84
- this.onDragStart = (event) => {
85
- if (!this.props.draggable)
86
- return;
87
- const { maximization } = this.state;
88
- if (maximization)
89
- return;
90
- this.setState({
91
- mask: true,
92
- ...this.state.left === void 0 ? { left: DEFAULT_LEFT } : {},
93
- ...this.state.top === void 0 ? { top: DEFAULT_TOP } : {}
94
- });
95
- this.clientX = event.clientX;
96
- this.clientY = event.clientY;
97
- this.isPointDown = true;
98
- };
99
- this.onDragMove = (event) => {
100
- if (!this.props.draggable || !this.isPointDown)
101
- return;
102
- event.preventDefault();
103
- this.setState({
104
- moveX: event.clientX - this.clientX,
105
- moveY: event.clientY - this.clientY
106
- });
107
- };
108
- this.onDragEnd = () => {
109
- const { draggable } = this.props;
110
- if (!draggable)
111
- return;
112
- this.isPointDown = false;
113
- if (this.state.moveX === 0 && this.state.moveY === 0)
114
- return;
115
- this.setState({
116
- mask: false,
117
- left: this.state.left + this.state.moveX,
118
- top: this.state.top + this.state.moveY,
119
- moveX: 0,
120
- moveY: 0
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
- this.compatClonedModel = (model) => {
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 / this.props.clientWidth,
187
- height: DEFAULT_HEIGHT_MEMBER / this.props.clientHeight,
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
- this.detectPointUp = () => {
194
- this.setState({ mask: false });
195
- };
196
- this.setRootWidthInEmbedMode = (newWidth) => {
197
- const { setRootWidth } = this.props;
198
- const restWidth = !!newWidth ? newWidth + SCROLL_BAR_WIDTH : 0;
199
- const rootWidth = (this.props.clientWidth - restWidth) / this.props.clientWidth;
200
- setRootWidth == null ? void 0 : setRootWidth(`${rootWidth * 100}%`);
201
- };
202
- this.onResizeStart = () => {
203
- if (this.state.minimize || !this.props.resizable)
204
- return;
205
- this.originInfo = this.compatClonedModel(this.state);
206
- this.setState({ mask: true });
207
- };
208
- this.onResizeMove = (event) => {
209
- const { resizable } = this.props;
210
- event.preventDefault();
211
- if (this.state.minimize || !resizable)
212
- return;
213
- const newWidth = this.originInfo.width + event.moveRight;
214
- const newHeight = this.originInfo.height + event.moveBottom;
215
- const checkResult = this.checkSize(newWidth, newHeight);
216
- if (checkResult.widthShouldChange) {
217
- this.setRootWidthInEmbedMode(newWidth);
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
- static get container() {
240
- if (!this._container) {
241
- this._container = document.createElement("div");
242
- document.body.appendChild(this._container);
177
+ }, []);
178
+ (0, import_react.useEffect)(() => {
179
+ if (!visible) {
180
+ setRootWidthInEmbedMode(0);
181
+ return;
243
182
  }
244
- return this._container;
245
- }
246
- componentDidMount() {
247
- _DialogComp.container.appendChild(this.host);
248
- }
249
- componentDidUpdate(prevProps, _) {
250
- const {
251
- visible: preVisible,
252
- clientWidth: preClientWidth,
253
- clientHeight: preClientHeight,
254
- isEmbed: preIsEmbed
255
- } = prevProps;
256
- const { visible, isEmbed, clientWidth, clientHeight, height, width, top, left } = this.props;
257
- if (preIsEmbed && !isEmbed) {
258
- this.setRootWidthInEmbedMode(0);
259
- this.setState({
260
- minimize: false,
261
- maximization: false,
262
- ...height ? { height } : {},
263
- ...width ? { width } : {},
264
- ...top ? { top } : {},
265
- ...left ? { left } : {}
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 (!preIsEmbed && isEmbed) {
270
- this.setState({
271
- minimize: false,
272
- maximization: true
273
- });
216
+ if (dialogTop === void 0) {
217
+ setDialogTop(DEFAULT_TOP);
274
218
  }
275
- if (visible) {
276
- if (!preVisible || clientWidth !== preClientWidth || clientHeight !== preClientHeight) {
277
- const tempState = this.getDefaultEmbedState();
278
- this.setState(tempState);
279
- this.setRootWidthInEmbedMode(tempState == null ? void 0 : tempState.width);
280
- }
281
- } else if (preVisible && !visible) {
282
- this.setRootWidthInEmbedMode(0);
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
- componentWillUnmount() {
286
- _DialogComp.container.removeChild(this.host);
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
- return max;
295
- }
296
- get min() {
297
- return this.props.min;
298
- }
299
- get hasMask() {
300
- return this.state.mask;
301
- }
302
- renderHeader() {
303
- const { locale, title, isEmbed } = this.props;
304
- const { headerStyle, minimize } = this.state;
305
- const style = {
306
- ...headerStyle,
307
- ...minimize ? { boxShadow: "0 2px 20px 0 rgba(4, 1, 30, 0.07)" } : {},
308
- ...isEmbed ? { cursor: "initial" } : {}
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
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
311
- "header",
312
- {
313
- className: `${prefix}-header`,
314
- style,
315
- onPointerDown: this.onDragStart,
316
- onDoubleClick: this.toggleMaximization,
317
- children: [
318
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefix}-title`, children: title || locale.helpDocument }),
319
- this.renderControls()
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
- renderControlLink() {
325
- const { extLink } = this.props;
326
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefix}-item`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
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: `${prefix}-item-link`,
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: `${prefix}-controls`, children: [
358
- this.renderControlLink(),
359
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefix}-item`, onClick: this.onClose, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CloseOutlined, {}) })
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: `${prefix}-controls`, children: [
363
- this.renderControlLink(),
364
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefix}-item`, onClick: this.toggleMinimize, children: minimize ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ExpandAltOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.MinusOutlined, {}) }),
365
- enableMaximization && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefix}-item`, onClick: this.toggleMaximization, children: maximization ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.FullscreenExitOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.FullscreenOutlined, {}) }),
366
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefix}-item`, onClick: this.onClose, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CloseOutlined, {}) })
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
- renderContent() {
370
- const { children } = this.props;
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
- "main",
459
+ "header",
373
460
  {
374
- className: `${prefix}-main`,
375
- style: this.state.minimize ? { visibility: "hidden" } : {},
461
+ className: `${prefixCls}-header`,
462
+ style: headerStyleObj,
463
+ onPointerDown: onDragStart,
464
+ onDoubleClick: toggleMaximization,
376
465
  children: [
377
- this.renderMask(),
378
- children
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 (!this.hasMask)
385
- return;
386
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${prefix}-mask` });
387
- }
388
- // 将比例转换为绝对数值,各个端的渲染依据视口大小会有不同
389
- getCompatAbsPostion(info) {
390
- const compatInfo = this.compatClonedModel(info);
391
- const { minimize } = compatInfo;
392
- const { clientWidth, clientHeight } = this.props;
393
- const ret = {};
394
- ["left", "width", "top", "height"].forEach((key) => {
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: this.onResizeStart,
483
- onMove: this.onResizeMove,
484
- onEnd: this.onResizeEnd
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: this.onResizeStart,
495
- onMove: this.onResizeMove,
496
- onEnd: this.onResizeEnd
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: this.onResizeStart,
504
- onMove: this.onResizeMove,
505
- onEnd: this.onResizeEnd
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: this.onResizeStart,
513
- onMove: this.onResizeMove,
514
- onEnd: this.onResizeEnd
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: this.onResizeStart,
522
- onMove: this.onResizeMove,
523
- onEnd: this.onResizeEnd
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: this.onResizeStart,
531
- onMove: this.onResizeMove,
532
- onEnd: this.onResizeEnd
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: this.onResizeStart,
540
- onMove: this.onResizeMove,
541
- onEnd: this.onResizeEnd
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: this.onResizeStart,
549
- onMove: this.onResizeMove,
550
- onEnd: this.onResizeEnd
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: this.onResizeStart,
558
- onMove: this.onResizeMove,
559
- onEnd: this.onResizeEnd
572
+ onStart: onResizeStart,
573
+ onMove: onResizeMove,
574
+ onEnd: onResizeEnd
560
575
  }
561
576
  )
562
577
  ] });
563
- }
564
- render() {
565
- const { visible, isEmbed } = this.props;
566
- if (!visible && !isEmbed)
567
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Fragment, {});
568
- return (0, import_react_dom.createPortal)(this.renderDialog(), _DialogComp.container);
569
- }
570
- };
571
- var DialogComp = _DialogComp;
572
- DialogComp.defaultProps = {
573
- min: DEFAULT_MIN,
574
- resizable: true,
575
- draggable: true,
576
- enableMaximization: true,
577
- isEmbed: false
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",