@oceanbase/ui 1.0.0-alpha.1 → 1.0.0-alpha.10

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 (384) hide show
  1. package/dist/static/Inter-Medium.ea234620.woff2 +0 -0
  2. package/dist/static/Inter-Regular.34ba43c9.woff2 +0 -0
  3. package/dist/static/Inter-SemiBold.95439fb4.woff2 +0 -0
  4. package/dist/ui.min.css +1 -1
  5. package/dist/ui.min.js +1 -1
  6. package/es/Action/Group.js +121 -15
  7. package/es/Action/Item.d.ts +6 -15
  8. package/es/Action/Item.js +85 -128
  9. package/es/Action/index.d.ts +6 -3
  10. package/es/Action/style/index.d.ts +2 -2
  11. package/es/Action/style/index.js +8 -4
  12. package/es/BasicLayout/locale/ja-JP.d.ts +13 -0
  13. package/es/BasicLayout/locale/ja-JP.js +12 -0
  14. package/es/BasicLayout/style/index.js +35 -23
  15. package/es/BatchOperationBar/index.d.ts +0 -1
  16. package/es/BatchOperationBar/index.js +17 -13
  17. package/es/BatchOperationBar/locale/ja-JP.d.ts +7 -0
  18. package/es/BatchOperationBar/locale/ja-JP.js +6 -0
  19. package/es/BatchOperationBar/style/index.d.ts +10 -0
  20. package/es/BatchOperationBar/style/index.js +51 -0
  21. package/es/Boundary/Components/Code.js +11 -5
  22. package/es/Boundary/Components/Exception.js +85 -74
  23. package/es/Boundary/Components/Function.js +11 -5
  24. package/es/Boundary/index.d.ts +0 -1
  25. package/es/Boundary/index.js +0 -1
  26. package/es/Boundary/locale/en-US.js +1 -1
  27. package/es/Boundary/locale/ja-JP.d.ts +11 -0
  28. package/es/Boundary/locale/ja-JP.js +10 -0
  29. package/es/Boundary/locale/zh-CN.js +1 -1
  30. package/es/Boundary/locale/zh-TW.js +1 -1
  31. package/es/Boundary/style/index.d.ts +10 -0
  32. package/es/Boundary/style/index.js +46 -0
  33. package/es/ContentWithIcon/index.d.ts +0 -1
  34. package/es/ContentWithIcon/index.js +29 -29
  35. package/es/ContentWithIcon/style/index.d.ts +10 -0
  36. package/es/ContentWithIcon/style/index.js +26 -0
  37. package/es/DateRanger/PickerPanel.js +5 -4
  38. package/es/DateRanger/Ranger.d.ts +4 -1
  39. package/es/DateRanger/Ranger.js +168 -19
  40. package/es/DateRanger/constant/index.js +1 -1
  41. package/es/DateRanger/locale/ja-JP.d.ts +56 -0
  42. package/es/DateRanger/locale/ja-JP.js +20 -0
  43. package/es/DateRanger/style/index.d.ts +10 -0
  44. package/es/DateRanger/style/index.js +126 -0
  45. package/es/Dialog/Anchor.d.ts +2 -10
  46. package/es/Dialog/Anchor.js +67 -96
  47. package/es/Dialog/index.d.ts +0 -1
  48. package/es/Dialog/index.js +537 -578
  49. package/es/Dialog/locale/ja-JP.d.ts +5 -0
  50. package/es/Dialog/locale/ja-JP.js +4 -0
  51. package/es/Dialog/locale/zh-CN.js +1 -1
  52. package/es/Dialog/locale/zh-TW.js +1 -1
  53. package/es/Dialog/style/index.d.ts +10 -0
  54. package/es/Dialog/style/index.js +97 -0
  55. package/es/DocDialog/locale/ja-JP.d.ts +2 -0
  56. package/es/DocDialog/locale/ja-JP.js +1 -0
  57. package/es/FooterToolbar/style/index.d.ts +0 -2
  58. package/es/FooterToolbar/style/index.js +7 -13
  59. package/es/FullscreenBox/index.d.ts +0 -1
  60. package/es/FullscreenBox/index.js +46 -37
  61. package/es/FullscreenBox/locale/ja-JP.d.ts +2 -0
  62. package/es/FullscreenBox/locale/ja-JP.js +1 -0
  63. package/es/FullscreenBox/style/index.d.ts +10 -0
  64. package/es/FullscreenBox/style/index.js +53 -0
  65. package/es/Highlight/DiffView/index.d.ts +0 -1
  66. package/es/Highlight/DiffView/index.js +5 -5
  67. package/es/Highlight/JsonView.d.ts +0 -1
  68. package/es/Highlight/JsonView.js +5 -5
  69. package/es/Highlight/index.d.ts +0 -1
  70. package/es/Highlight/index.js +23 -23
  71. package/es/Highlight/locale/ja-JP.d.ts +4 -0
  72. package/es/Highlight/locale/ja-JP.js +3 -0
  73. package/es/Highlight/style/index.d.ts +10 -0
  74. package/es/Highlight/style/index.js +213 -0
  75. package/es/LocaleDropdown/index.js +4 -2
  76. package/es/Login/ActivateForm.d.ts +0 -1
  77. package/es/Login/ActivateForm.js +12 -9
  78. package/es/Login/LoginForm.d.ts +0 -1
  79. package/es/Login/LoginForm.js +20 -15
  80. package/es/Login/RegisterForm.d.ts +0 -1
  81. package/es/Login/RegisterForm.js +14 -11
  82. package/es/Login/index.d.ts +0 -1
  83. package/es/Login/index.js +24 -22
  84. package/es/Login/locale/ja-JP.d.ts +28 -0
  85. package/es/Login/locale/ja-JP.js +27 -0
  86. package/es/Login/locale/zh-CN.js +2 -2
  87. package/es/Login/style/index.d.ts +10 -0
  88. package/es/Login/style/index.js +182 -0
  89. package/es/NavMenu/index.d.ts +1 -2
  90. package/es/NavMenu/index.js +11 -8
  91. package/es/NavMenu/style/index.d.ts +10 -0
  92. package/es/NavMenu/style/index.js +47 -0
  93. package/es/PageContainer/index.d.ts +2 -0
  94. package/es/PageContainer/index.js +102 -25
  95. package/es/PageContainer/locale/en-US.d.ts +1 -0
  96. package/es/PageContainer/locale/en-US.js +2 -1
  97. package/es/PageContainer/locale/ja-JP.d.ts +5 -0
  98. package/es/PageContainer/locale/ja-JP.js +4 -0
  99. package/es/PageContainer/locale/zh-CN.d.ts +1 -0
  100. package/es/PageContainer/locale/zh-CN.js +2 -1
  101. package/es/PageContainer/locale/zh-TW.d.ts +1 -0
  102. package/es/PageContainer/locale/zh-TW.js +2 -1
  103. package/es/PageContainer/style/index.js +41 -16
  104. package/es/Password/index.js +1 -1
  105. package/es/Password/locale/ja-JP.d.ts +13 -0
  106. package/es/Password/locale/ja-JP.js +12 -0
  107. package/es/ProCard/index.js +11 -3
  108. package/es/ProCard/style/index.d.ts +2 -2
  109. package/es/ProCard/style/index.js +13 -5
  110. package/es/ProTable/index.d.ts +1 -1
  111. package/es/ProTable/index.js +23 -8
  112. package/es/ProTable/style/index.d.ts +2 -2
  113. package/es/ProTable/style/index.js +12 -5
  114. package/es/Ranger/QuickPicker.js +8 -4
  115. package/es/Ranger/Ranger.d.ts +0 -1
  116. package/es/Ranger/Ranger.js +12 -9
  117. package/es/Ranger/locale/ja-JP.d.ts +28 -0
  118. package/es/Ranger/locale/ja-JP.js +29 -0
  119. package/es/Ranger/style/index.d.ts +10 -0
  120. package/es/Ranger/style/index.js +44 -0
  121. package/es/SideTip/index.d.ts +0 -1
  122. package/es/SideTip/index.js +24 -22
  123. package/es/SideTip/locale/ja-JP.d.ts +2 -0
  124. package/es/SideTip/locale/ja-JP.js +1 -0
  125. package/es/SideTip/style/index.d.ts +10 -0
  126. package/es/SideTip/style/index.js +162 -0
  127. package/es/TagSelect/Group.d.ts +6 -6
  128. package/es/TagSelect/Group.js +5 -3
  129. package/es/TagSelect/Item.js +5 -3
  130. package/es/Welcome/index.d.ts +0 -1
  131. package/es/Welcome/index.js +30 -26
  132. package/es/Welcome/locale/ja-JP.d.ts +5 -0
  133. package/es/Welcome/locale/ja-JP.js +4 -0
  134. package/es/Welcome/step/style/index.d.ts +10 -0
  135. package/es/Welcome/step/style/index.js +44 -0
  136. package/es/Welcome/step.d.ts +0 -1
  137. package/es/Welcome/step.js +17 -14
  138. package/es/Welcome/style/index.d.ts +10 -0
  139. package/es/Welcome/style/index.js +141 -0
  140. package/es/_util/genComponentStyleHook.d.ts +4 -3
  141. package/es/_util/genComponentStyleHook.js +1 -1
  142. package/es/index.d.ts +0 -5
  143. package/es/index.js +0 -3
  144. package/es/locale/en-US.js +0 -4
  145. package/es/locale/ja-JP.d.ts +3 -0
  146. package/es/locale/ja-JP.js +38 -0
  147. package/es/locale/zh-CN.js +0 -4
  148. package/es/locale/zh-TW.js +0 -4
  149. package/lib/Action/Group.js +122 -46
  150. package/lib/Action/Item.d.ts +6 -15
  151. package/lib/Action/Item.js +66 -76
  152. package/lib/Action/index.d.ts +6 -3
  153. package/lib/Action/style/index.d.ts +2 -2
  154. package/lib/Action/style/index.js +16 -1
  155. package/lib/BackgroundTaskManager/RefreshMan.js +3 -12
  156. package/lib/BackgroundTaskManager/index.js +3 -12
  157. package/lib/BasicLayout/Header.js +120 -62
  158. package/lib/BasicLayout/index.js +166 -143
  159. package/lib/BasicLayout/locale/ja-JP.d.ts +13 -0
  160. package/lib/BasicLayout/locale/ja-JP.js +36 -0
  161. package/lib/BasicLayout/style/index.js +32 -23
  162. package/lib/BatchOperationBar/index.d.ts +0 -1
  163. package/lib/BatchOperationBar/index.js +70 -51
  164. package/lib/BatchOperationBar/locale/ja-JP.d.ts +7 -0
  165. package/lib/{TaskGraph/locale/en-US.js → BatchOperationBar/locale/ja-JP.js} +10 -16
  166. package/lib/BatchOperationBar/style/index.d.ts +10 -0
  167. package/lib/BatchOperationBar/style/index.js +82 -0
  168. package/lib/Boundary/Components/Code.js +25 -13
  169. package/lib/Boundary/Components/Exception.js +70 -49
  170. package/lib/Boundary/Components/Function.js +20 -8
  171. package/lib/Boundary/index.d.ts +0 -1
  172. package/lib/Boundary/index.js +0 -1
  173. package/lib/Boundary/locale/en-US.js +1 -1
  174. package/lib/Boundary/locale/ja-JP.d.ts +11 -0
  175. package/lib/Boundary/locale/ja-JP.js +34 -0
  176. package/lib/Boundary/locale/zh-CN.js +1 -1
  177. package/lib/Boundary/locale/zh-TW.js +1 -1
  178. package/lib/Boundary/style/index.d.ts +10 -0
  179. package/lib/Boundary/style/index.js +74 -0
  180. package/lib/ContentWithIcon/index.d.ts +0 -1
  181. package/lib/ContentWithIcon/index.js +44 -33
  182. package/lib/ContentWithIcon/style/index.d.ts +10 -0
  183. package/lib/ContentWithIcon/style/index.js +57 -0
  184. package/lib/ContentWithQuestion/index.js +8 -3
  185. package/lib/DateRanger/PickerPanel.js +237 -219
  186. package/lib/DateRanger/Ranger.d.ts +4 -1
  187. package/lib/DateRanger/Ranger.js +413 -239
  188. package/lib/DateRanger/constant/index.js +1 -1
  189. package/lib/DateRanger/locale/ja-JP.d.ts +56 -0
  190. package/lib/DateRanger/locale/ja-JP.js +49 -0
  191. package/lib/DateRanger/style/index.d.ts +10 -0
  192. package/lib/DateRanger/style/index.js +195 -0
  193. package/lib/Dialog/Anchor.d.ts +2 -10
  194. package/lib/Dialog/Anchor.js +59 -58
  195. package/lib/Dialog/EventProxy.js +3 -12
  196. package/lib/Dialog/index.d.ts +0 -1
  197. package/lib/Dialog/index.js +514 -466
  198. package/lib/Dialog/locale/ja-JP.d.ts +5 -0
  199. package/lib/{GraphToolbar/locale/en-US.js → Dialog/locale/ja-JP.js} +8 -12
  200. package/lib/Dialog/locale/zh-CN.js +1 -1
  201. package/lib/Dialog/locale/zh-TW.js +1 -1
  202. package/lib/Dialog/style/index.d.ts +10 -0
  203. package/lib/Dialog/style/index.js +135 -0
  204. package/lib/DocDialog/index.js +3 -2
  205. package/lib/DocDialog/locale/ja-JP.d.ts +2 -0
  206. package/lib/DocDialog/locale/ja-JP.js +25 -0
  207. package/lib/FooterToolbar/index.js +3 -2
  208. package/lib/FooterToolbar/style/index.d.ts +0 -2
  209. package/lib/FooterToolbar/style/index.js +7 -18
  210. package/lib/FullscreenBox/index.d.ts +0 -1
  211. package/lib/FullscreenBox/index.js +51 -33
  212. package/lib/FullscreenBox/locale/ja-JP.d.ts +2 -0
  213. package/lib/FullscreenBox/locale/ja-JP.js +25 -0
  214. package/lib/FullscreenBox/style/index.d.ts +10 -0
  215. package/lib/FullscreenBox/style/index.js +86 -0
  216. package/lib/Highlight/DiffView/DiffCells.js +17 -10
  217. package/lib/Highlight/DiffView/index.d.ts +0 -1
  218. package/lib/Highlight/DiffView/index.js +38 -34
  219. package/lib/Highlight/HighlightCell.js +13 -10
  220. package/lib/Highlight/JsonView.d.ts +0 -1
  221. package/lib/Highlight/JsonView.js +18 -17
  222. package/lib/Highlight/index.d.ts +0 -1
  223. package/lib/Highlight/index.js +60 -52
  224. package/lib/Highlight/locale/ja-JP.d.ts +4 -0
  225. package/lib/{GraphToolbar/locale/zh-CN.js → Highlight/locale/ja-JP.js} +7 -12
  226. package/lib/Highlight/style/index.d.ts +10 -0
  227. package/lib/Highlight/style/index.js +293 -0
  228. package/lib/IconFont/index.js +2 -12
  229. package/lib/LightFilter/index.js +3 -2
  230. package/lib/LocaleDropdown/index.js +15 -21
  231. package/lib/Login/ActivateForm.d.ts +0 -1
  232. package/lib/Login/ActivateForm.js +65 -64
  233. package/lib/Login/LoginForm.d.ts +0 -1
  234. package/lib/Login/LoginForm.js +134 -113
  235. package/lib/Login/RegisterForm.d.ts +0 -1
  236. package/lib/Login/RegisterForm.js +90 -89
  237. package/lib/Login/index.d.ts +0 -1
  238. package/lib/Login/index.js +102 -72
  239. package/lib/Login/locale/ja-JP.d.ts +28 -0
  240. package/lib/Login/locale/ja-JP.js +51 -0
  241. package/lib/Login/locale/zh-CN.js +2 -2
  242. package/lib/Login/style/index.d.ts +10 -0
  243. package/lib/Login/style/index.js +267 -0
  244. package/lib/NavMenu/index.d.ts +1 -2
  245. package/lib/NavMenu/index.js +22 -18
  246. package/lib/NavMenu/style/index.d.ts +10 -0
  247. package/lib/NavMenu/style/index.js +78 -0
  248. package/lib/PageContainer/ItemRender.js +5 -5
  249. package/lib/PageContainer/index.d.ts +2 -0
  250. package/lib/PageContainer/index.js +86 -10
  251. package/lib/PageContainer/locale/en-US.d.ts +1 -0
  252. package/lib/PageContainer/locale/en-US.js +2 -1
  253. package/lib/PageContainer/locale/ja-JP.d.ts +5 -0
  254. package/lib/{GraphToolbar/locale/zh-TW.js → PageContainer/locale/ja-JP.js} +8 -12
  255. package/lib/PageContainer/locale/zh-CN.d.ts +1 -0
  256. package/lib/PageContainer/locale/zh-CN.js +2 -1
  257. package/lib/PageContainer/locale/zh-TW.d.ts +1 -0
  258. package/lib/PageContainer/locale/zh-TW.js +2 -1
  259. package/lib/PageContainer/style/index.js +44 -13
  260. package/lib/PageLoading/index.js +6 -16
  261. package/lib/Password/Content.js +38 -42
  262. package/lib/Password/index.js +83 -68
  263. package/lib/Password/locale/ja-JP.d.ts +13 -0
  264. package/lib/Password/locale/ja-JP.js +36 -0
  265. package/lib/ProCard/index.js +6 -3
  266. package/lib/ProCard/style/index.d.ts +2 -2
  267. package/lib/ProCard/style/index.js +18 -3
  268. package/lib/ProTable/index.d.ts +1 -1
  269. package/lib/ProTable/index.js +22 -10
  270. package/lib/ProTable/style/index.d.ts +2 -2
  271. package/lib/ProTable/style/index.js +18 -2
  272. package/lib/Ranger/QuickPicker.js +28 -17
  273. package/lib/Ranger/Ranger.d.ts +0 -1
  274. package/lib/Ranger/Ranger.js +49 -43
  275. package/lib/Ranger/locale/ja-JP.d.ts +28 -0
  276. package/lib/Ranger/locale/ja-JP.js +53 -0
  277. package/lib/Ranger/style/index.d.ts +10 -0
  278. package/lib/Ranger/style/index.js +82 -0
  279. package/lib/SideTip/Dragger.js +5 -4
  280. package/lib/SideTip/IconLoading.js +25 -25
  281. package/lib/SideTip/index.d.ts +0 -1
  282. package/lib/SideTip/index.js +55 -38
  283. package/lib/SideTip/locale/ja-JP.d.ts +2 -0
  284. package/lib/SideTip/locale/ja-JP.js +25 -0
  285. package/lib/SideTip/style/index.d.ts +10 -0
  286. package/lib/SideTip/style/index.js +211 -0
  287. package/lib/TagSelect/Group.d.ts +6 -6
  288. package/lib/TagSelect/Group.js +12 -7
  289. package/lib/TagSelect/Item.js +25 -20
  290. package/lib/TreeSearch/index.js +30 -35
  291. package/lib/Welcome/index.d.ts +0 -1
  292. package/lib/Welcome/index.js +72 -40
  293. package/lib/Welcome/locale/ja-JP.d.ts +5 -0
  294. package/lib/Welcome/locale/ja-JP.js +28 -0
  295. package/lib/Welcome/step/style/index.d.ts +10 -0
  296. package/lib/Welcome/step/style/index.js +74 -0
  297. package/lib/Welcome/step.d.ts +0 -1
  298. package/lib/Welcome/step.js +18 -7
  299. package/lib/Welcome/style/index.d.ts +10 -0
  300. package/lib/Welcome/style/index.js +188 -0
  301. package/lib/_util/genComponentStyleHook.d.ts +4 -3
  302. package/lib/_util/genComponentStyleHook.js +1 -1
  303. package/lib/index.d.ts +0 -5
  304. package/lib/index.js +0 -7
  305. package/lib/locale/LocaleWrapper.js +15 -14
  306. package/lib/locale/en-US.js +16 -20
  307. package/lib/locale/ja-JP.d.ts +3 -0
  308. package/lib/locale/ja-JP.js +67 -0
  309. package/lib/locale/zh-CN.js +17 -21
  310. package/lib/locale/zh-TW.js +15 -19
  311. package/package.json +7 -10
  312. package/dist/static/Inter.f6bcdfb6.woff2 +0 -0
  313. package/es/BatchOperationBar/index.less +0 -46
  314. package/es/BatchOperationBar/index.less.d.ts +0 -15
  315. package/es/Boundary/index.less +0 -36
  316. package/es/ContentWithIcon/index.less +0 -21
  317. package/es/DateRanger/index.less +0 -157
  318. package/es/Dialog/index.less +0 -116
  319. package/es/FullscreenBox/index.less +0 -49
  320. package/es/GraphToolbar/index.d.ts +0 -26
  321. package/es/GraphToolbar/index.js +0 -146
  322. package/es/GraphToolbar/index.less +0 -65
  323. package/es/GraphToolbar/locale/en-US.d.ts +0 -9
  324. package/es/GraphToolbar/locale/en-US.js +0 -8
  325. package/es/GraphToolbar/locale/zh-CN.d.ts +0 -9
  326. package/es/GraphToolbar/locale/zh-CN.js +0 -8
  327. package/es/GraphToolbar/locale/zh-TW.d.ts +0 -9
  328. package/es/GraphToolbar/locale/zh-TW.js +0 -8
  329. package/es/Highlight/index.less +0 -381
  330. package/es/Login/index.less +0 -268
  331. package/es/NavMenu/index.less +0 -50
  332. package/es/Ranger/index.less +0 -57
  333. package/es/SideTip/index.less +0 -180
  334. package/es/TaskGraph/Graph.d.ts +0 -24
  335. package/es/TaskGraph/Graph.js +0 -271
  336. package/es/TaskGraph/graph.less +0 -23
  337. package/es/TaskGraph/index.d.ts +0 -16
  338. package/es/TaskGraph/index.js +0 -178
  339. package/es/TaskGraph/index.less +0 -117
  340. package/es/TaskGraph/locale/en-US.d.ts +0 -13
  341. package/es/TaskGraph/locale/en-US.js +0 -12
  342. package/es/TaskGraph/locale/zh-CN.d.ts +0 -13
  343. package/es/TaskGraph/locale/zh-CN.js +0 -12
  344. package/es/TaskGraph/locale/zh-TW.d.ts +0 -13
  345. package/es/TaskGraph/locale/zh-TW.js +0 -12
  346. package/es/TaskGraph/register.d.ts +0 -7
  347. package/es/TaskGraph/register.js +0 -200
  348. package/es/Welcome/index.less +0 -185
  349. package/es/index.less +0 -1
  350. package/es/variable.less +0 -54
  351. package/lib/BatchOperationBar/index.less +0 -46
  352. package/lib/BatchOperationBar/index.less.d.ts +0 -15
  353. package/lib/Boundary/index.less +0 -36
  354. package/lib/ContentWithIcon/index.less +0 -21
  355. package/lib/DateRanger/index.less +0 -157
  356. package/lib/Dialog/index.less +0 -116
  357. package/lib/FullscreenBox/index.less +0 -49
  358. package/lib/GraphToolbar/index.d.ts +0 -26
  359. package/lib/GraphToolbar/index.js +0 -154
  360. package/lib/GraphToolbar/index.less +0 -65
  361. package/lib/GraphToolbar/locale/en-US.d.ts +0 -9
  362. package/lib/GraphToolbar/locale/zh-CN.d.ts +0 -9
  363. package/lib/GraphToolbar/locale/zh-TW.d.ts +0 -9
  364. package/lib/Highlight/index.less +0 -381
  365. package/lib/Login/index.less +0 -268
  366. package/lib/NavMenu/index.less +0 -50
  367. package/lib/Ranger/index.less +0 -57
  368. package/lib/SideTip/index.less +0 -180
  369. package/lib/TaskGraph/Graph.d.ts +0 -24
  370. package/lib/TaskGraph/Graph.js +0 -261
  371. package/lib/TaskGraph/graph.less +0 -23
  372. package/lib/TaskGraph/index.d.ts +0 -16
  373. package/lib/TaskGraph/index.js +0 -164
  374. package/lib/TaskGraph/index.less +0 -117
  375. package/lib/TaskGraph/locale/en-US.d.ts +0 -13
  376. package/lib/TaskGraph/locale/zh-CN.d.ts +0 -13
  377. package/lib/TaskGraph/locale/zh-CN.js +0 -36
  378. package/lib/TaskGraph/locale/zh-TW.d.ts +0 -13
  379. package/lib/TaskGraph/locale/zh-TW.js +0 -36
  380. package/lib/TaskGraph/register.d.ts +0 -7
  381. package/lib/TaskGraph/register.js +0 -205
  382. package/lib/Welcome/index.less +0 -185
  383. package/lib/index.less +0 -1
  384. package/lib/variable.less +0 -54
@@ -1,32 +1,27 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
8
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
9
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
11
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
14
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
16
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
13
  import { CloseOutlined, ExpandAltOutlined, FullscreenExitOutlined, FullscreenOutlined, MinusOutlined } from '@oceanbase/icons';
18
- import React from 'react';
14
+ import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
15
+ import { ConfigProvider } from '@oceanbase/design';
19
16
  import { createPortal } from 'react-dom';
20
17
  import LocaleWrapper from "../locale/LocaleWrapper";
21
- import { getPrefix } from "../_util";
22
18
  import { Anchor } from "./Anchor";
23
19
  import { Dock } from "./Dock";
24
20
  import { EventProxy } from "./EventProxy";
25
21
  import zhCN from "./locale/zh-CN";
26
- import "./index.less";
22
+ import useStyle from "./style";
27
23
  import { jsx as _jsx } from "react/jsx-runtime";
28
24
  import { jsxs as _jsxs } from "react/jsx-runtime";
29
- var prefix = getPrefix('dialog');
30
25
  var DEFAULT_LEFT = 0.1;
31
26
  var DEFAULT_TOP = 0.1;
32
27
  var MINIMIZE_HEIGHT = 36;
@@ -37,598 +32,562 @@ var DEFAULT_HEIGHT_MEMBER = 600;
37
32
  var DEFAULT_BORDER_WIDTH = 24;
38
33
  // 预留滚动条宽度
39
34
  var SCROLL_BAR_WIDTH = 1;
40
- var DialogComp = /*#__PURE__*/function (_React$PureComponent) {
41
- _inherits(DialogComp, _React$PureComponent);
42
- var _super = _createSuper(DialogComp);
43
- function DialogComp() {
44
- var _this$props$width, _this$props$height, _this$props$left, _this$props$width2, _this$props$top, _this$props$height2;
45
- var _this;
46
- _classCallCheck(this, DialogComp);
47
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
- args[_key] = arguments[_key];
49
- }
50
- _this = _super.call.apply(_super, [this].concat(args));
51
- _defineProperty(_assertThisInitialized(_this), "state", {
52
- mask: true,
53
- width: (_this$props$width = _this.props.width) !== null && _this$props$width !== void 0 ? _this$props$width : DEFAULT_WIDTH_MEMBER,
54
- height: (_this$props$height = _this.props.height) !== null && _this$props$height !== void 0 ? _this$props$height : DEFAULT_HEIGHT_MEMBER,
55
- left: (_this$props$left = _this.props.left) !== null && _this$props$left !== void 0 ? _this$props$left : _this.props.clientWidth - ((_this$props$width2 = _this.props.width) !== null && _this$props$width2 !== void 0 ? _this$props$width2 : DEFAULT_WIDTH_MEMBER) - DEFAULT_BORDER_WIDTH,
56
- top: (_this$props$top = _this.props.top) !== null && _this$props$top !== void 0 ? _this$props$top : _this.props.clientHeight - ((_this$props$height2 = _this.props.height) !== null && _this$props$height2 !== void 0 ? _this$props$height2 : DEFAULT_HEIGHT_MEMBER) - DEFAULT_BORDER_WIDTH,
57
- moveX: 0,
58
- moveY: 0,
59
- maximization: _this.props.isEmbed,
35
+ // Static container for portal
36
+ var _container = null;
37
+ var getContainer = function getContainer() {
38
+ if (!_container) {
39
+ _container = document.createElement('div');
40
+ document.body.appendChild(_container);
41
+ }
42
+ return _container;
43
+ };
44
+ var DialogComp = function DialogComp(props) {
45
+ var className = props.className,
46
+ visible = props.visible,
47
+ children = props.children,
48
+ _props$min = props.min,
49
+ min = _props$min === void 0 ? DEFAULT_MIN : _props$min,
50
+ max = props.max,
51
+ width = props.width,
52
+ height = props.height,
53
+ left = props.left,
54
+ top = props.top,
55
+ title = props.title,
56
+ onClose = props.onClose,
57
+ clientWidth = props.clientWidth,
58
+ clientHeight = props.clientHeight,
59
+ _props$resizable = props.resizable,
60
+ resizable = _props$resizable === void 0 ? true : _props$resizable,
61
+ _props$draggable = props.draggable,
62
+ draggable = _props$draggable === void 0 ? true : _props$draggable,
63
+ _props$enableMaximiza = props.enableMaximization,
64
+ enableMaximization = _props$enableMaximiza === void 0 ? true : _props$enableMaximiza,
65
+ locale = props.locale,
66
+ extLink = props.extLink,
67
+ setRootWidth = props.setRootWidth,
68
+ _props$isEmbed = props.isEmbed,
69
+ isEmbed = _props$isEmbed === void 0 ? false : _props$isEmbed;
70
+ var _useContext = useContext(ConfigProvider.ConfigContext),
71
+ getPrefixCls = _useContext.getPrefixCls;
72
+ var prefixCls = getPrefixCls('dialog');
73
+ var _useStyle = useStyle(prefixCls),
74
+ wrapSSR = _useStyle.wrapSSR;
75
+
76
+ // Refs for instance properties
77
+ var hostRef = useRef(null);
78
+ var clientXRef = useRef(0);
79
+ var clientYRef = useRef(0);
80
+ var isPointDownRef = useRef(false);
81
+ var originInfoRef = useRef({});
82
+
83
+ // State
84
+ var _useState = useState(true),
85
+ _useState2 = _slicedToArray(_useState, 2),
86
+ mask = _useState2[0],
87
+ setMask = _useState2[1];
88
+ var _useState3 = useState(width !== null && width !== void 0 ? width : DEFAULT_WIDTH_MEMBER),
89
+ _useState4 = _slicedToArray(_useState3, 2),
90
+ dialogWidth = _useState4[0],
91
+ setDialogWidth = _useState4[1];
92
+ var _useState5 = useState(height !== null && height !== void 0 ? height : DEFAULT_HEIGHT_MEMBER),
93
+ _useState6 = _slicedToArray(_useState5, 2),
94
+ dialogHeight = _useState6[0],
95
+ setDialogHeight = _useState6[1];
96
+ var _useState7 = useState(left !== null && left !== void 0 ? left : clientWidth - (width !== null && width !== void 0 ? width : DEFAULT_WIDTH_MEMBER) - DEFAULT_BORDER_WIDTH),
97
+ _useState8 = _slicedToArray(_useState7, 2),
98
+ dialogLeft = _useState8[0],
99
+ setDialogLeft = _useState8[1];
100
+ var _useState9 = useState(top !== null && top !== void 0 ? top : clientHeight - (height !== null && height !== void 0 ? height : DEFAULT_HEIGHT_MEMBER) - DEFAULT_BORDER_WIDTH),
101
+ _useState10 = _slicedToArray(_useState9, 2),
102
+ dialogTop = _useState10[0],
103
+ setDialogTop = _useState10[1];
104
+ var _useState11 = useState(0),
105
+ _useState12 = _slicedToArray(_useState11, 2),
106
+ moveX = _useState12[0],
107
+ setMoveX = _useState12[1];
108
+ var _useState13 = useState(0),
109
+ _useState14 = _slicedToArray(_useState13, 2),
110
+ moveY = _useState14[0],
111
+ setMoveY = _useState14[1];
112
+ var _useState15 = useState(isEmbed),
113
+ _useState16 = _slicedToArray(_useState15, 2),
114
+ maximization = _useState16[0],
115
+ setMaximization = _useState16[1];
116
+ var _useState17 = useState(false),
117
+ _useState18 = _slicedToArray(_useState17, 2),
118
+ minimize = _useState18[0],
119
+ setMinimize = _useState18[1];
120
+ var _useState19 = useState({}),
121
+ _useState20 = _slicedToArray(_useState19, 2),
122
+ headerStyle = _useState20[0],
123
+ setHeaderStyle = _useState20[1];
124
+
125
+ // Computed values
126
+ var maxSize = useMemo(function () {
127
+ if (max) return max;
128
+ return [clientWidth, clientHeight];
129
+ }, [max, clientWidth, clientHeight]);
130
+ var minSize = useMemo(function () {
131
+ return min;
132
+ }, [min]);
133
+ var getDefaultEmbedState = useCallback(function () {
134
+ return {
135
+ width: width !== null && width !== void 0 ? width : DEFAULT_WIDTH_MEMBER,
136
+ height: height !== null && height !== void 0 ? height : DEFAULT_HEIGHT_MEMBER,
137
+ left: left !== null && left !== void 0 ? left : clientWidth - (width !== null && width !== void 0 ? width : DEFAULT_WIDTH_MEMBER) - DEFAULT_BORDER_WIDTH,
138
+ top: top !== null && top !== void 0 ? top : clientHeight - (height !== null && height !== void 0 ? height : DEFAULT_HEIGHT_MEMBER) - DEFAULT_BORDER_WIDTH
139
+ };
140
+ }, [width, height, left, top, clientWidth, clientHeight]);
141
+ var setRootWidthInEmbedMode = useCallback(function (newWidth) {
142
+ var restWidth = !!newWidth ? newWidth + SCROLL_BAR_WIDTH : 0;
143
+ var rootWidth = (clientWidth - restWidth) / clientWidth;
144
+ setRootWidth === null || setRootWidth === void 0 || setRootWidth("".concat(rootWidth * 100, "%"));
145
+ }, [clientWidth, setRootWidth]);
146
+ var compatClonedModel = useCallback(function (model) {
147
+ return _objectSpread({
148
+ left: DEFAULT_LEFT,
149
+ top: DEFAULT_TOP,
150
+ width: DEFAULT_WIDTH_MEMBER / clientWidth,
151
+ height: DEFAULT_HEIGHT_MEMBER / clientHeight,
60
152
  minimize: false,
61
- headerStyle: {}
62
- });
63
- _defineProperty(_assertThisInitialized(_this), "clientX", 0);
64
- _defineProperty(_assertThisInitialized(_this), "clientY", 0);
65
- _defineProperty(_assertThisInitialized(_this), "getDefaultEmbedState", function () {
66
- var _this$props = _this.props,
67
- clientHeight = _this$props.clientHeight,
68
- clientWidth = _this$props.clientWidth,
69
- width = _this$props.width,
70
- height = _this$props.height,
71
- left = _this$props.left,
72
- top = _this$props.top;
73
- return {
74
- width: width !== null && width !== void 0 ? width : DEFAULT_WIDTH_MEMBER,
75
- height: height !== null && height !== void 0 ? height : DEFAULT_HEIGHT_MEMBER,
76
- left: left !== null && left !== void 0 ? left : clientWidth - (width !== null && width !== void 0 ? width : DEFAULT_WIDTH_MEMBER) - DEFAULT_BORDER_WIDTH,
77
- top: top !== null && top !== void 0 ? top : clientHeight - (height !== null && height !== void 0 ? height : DEFAULT_HEIGHT_MEMBER) - DEFAULT_BORDER_WIDTH
78
- };
79
- });
80
- _defineProperty(_assertThisInitialized(_this), "host", document.createElement('div'));
81
- _defineProperty(_assertThisInitialized(_this), "isPointDown", false);
82
- _defineProperty(_assertThisInitialized(_this), "onDragStart", function (event) {
83
- if (!_this.props.draggable) return;
84
- var maximization = _this.state.maximization;
85
- if (maximization) return;
86
- _this.setState(_objectSpread(_objectSpread({
87
- mask: true
88
- }, _this.state.left === undefined ? {
89
- left: DEFAULT_LEFT
90
- } : {}), _this.state.top === undefined ? {
91
- top: DEFAULT_TOP
92
- } : {}));
93
- _this.clientX = event.clientX;
94
- _this.clientY = event.clientY;
95
- _this.isPointDown = true;
96
- });
97
- _defineProperty(_assertThisInitialized(_this), "onDragMove", function (event) {
98
- if (!_this.props.draggable || !_this.isPointDown) return;
99
- event.preventDefault();
100
- _this.setState({
101
- moveX: event.clientX - _this.clientX,
102
- moveY: event.clientY - _this.clientY
103
- });
104
- });
105
- _defineProperty(_assertThisInitialized(_this), "onDragEnd", function () {
106
- var draggable = _this.props.draggable;
107
- if (!draggable) return;
108
- _this.isPointDown = false;
109
- if (_this.state.moveX === 0 && _this.state.moveY === 0) return;
110
- _this.setState({
111
- mask: false,
112
- left: _this.state.left + _this.state.moveX,
113
- top: _this.state.top + _this.state.moveY,
114
- moveX: 0,
115
- moveY: 0
116
- });
117
- });
118
- _defineProperty(_assertThisInitialized(_this), "toggleMinimize", function () {
119
- _this.setState({
120
- maximization: false,
121
- minimize: !_this.state.minimize
122
- });
123
- });
124
- _defineProperty(_assertThisInitialized(_this), "toggleMaximization", function () {
125
- // 嵌入模式不支持toggleMaximization
126
- var enable = _this.props.resizable && _this.props.enableMaximization && !_this.props.isEmbed;
127
- if (!enable) return;
128
- _this.setState({
129
- maximization: !_this.state.maximization,
130
- minimize: false
131
- });
132
- });
133
- _defineProperty(_assertThisInitialized(_this), "onClose", function (event) {
134
- var _this$props$onClose, _this$props2;
135
- event.stopPropagation();
136
- (_this$props$onClose = (_this$props2 = _this.props).onClose) === null || _this$props$onClose === void 0 || _this$props$onClose.call(_this$props2);
137
- });
138
- _defineProperty(_assertThisInitialized(_this), "getBaseStyle", function () {
139
- var visible = _this.props.visible;
140
- // 通过样式控制显隐
141
- var baseStyle = {
142
- visibility: visible ? 'visible' : 'hidden',
143
- opacity: visible ? 1 : 0
144
- };
145
- return baseStyle;
146
- });
147
- _defineProperty(_assertThisInitialized(_this), "getStyle", function () {
148
- var _this$state = _this.state,
149
- maximization = _this$state.maximization,
150
- minimize = _this$state.minimize,
151
- headerStyle = _this$state.headerStyle;
152
- var transform = "translate(".concat(_this.state.moveX, "px, ").concat(_this.state.moveY, "px)");
153
- var baseStyle = _this.getBaseStyle();
154
- if (maximization && !_this.props.isEmbed) {
155
- return _objectSpread(_objectSpread({}, baseStyle), {}, {
156
- top: 0,
157
- bottom: 0,
158
- right: 0,
159
- width: _this.props.width || DEFAULT_WIDTH_MEMBER,
160
- height: 'auto',
161
- borderRadius: 0
162
- });
163
- } else if (minimize) {
164
- var _ref = headerStyle,
165
- height = _ref.height;
166
- return _objectSpread(_objectSpread(_objectSpread({}, baseStyle), _this.getCompatAbsPostion(_this.state)), {}, {
167
- width: MINIMIZE_WIDTH,
168
- height: height || MINIMIZE_HEIGHT,
169
- transform: transform
170
- });
171
- } else {
172
- return _objectSpread(_objectSpread(_objectSpread({}, baseStyle), _this.getCompatAbsPostion(_this.state)), {}, {
173
- transform: transform
174
- });
153
+ maximization: false
154
+ }, model);
155
+ }, [clientWidth, clientHeight]);
156
+ var checkSize = function checkSize(w, h) {
157
+ var newModel = {};
158
+ var result = {
159
+ widthShouldChange: true,
160
+ heightShouldChange: true
161
+ };
162
+ if (minSize && w < minSize[0]) {
163
+ newModel.width = minSize[0];
164
+ result.widthShouldChange = false;
165
+ }
166
+ if (minSize && h < minSize[1]) {
167
+ newModel.height = minSize[1];
168
+ result.heightShouldChange = false;
169
+ }
170
+ if (maxSize && w > maxSize[0]) {
171
+ newModel.width = maxSize[0];
172
+ result.widthShouldChange = false;
173
+ }
174
+ if (maxSize && h > maxSize[1]) {
175
+ newModel.height = maxSize[1];
176
+ result.heightShouldChange = false;
177
+ }
178
+ return result;
179
+ };
180
+
181
+ // componentDidMount
182
+ useEffect(function () {
183
+ var host = document.createElement('div');
184
+ hostRef.current = host;
185
+ getContainer().appendChild(host);
186
+ return function () {
187
+ if (hostRef.current && getContainer().contains(hostRef.current)) {
188
+ getContainer().removeChild(hostRef.current);
175
189
  }
190
+ };
191
+ }, []);
192
+
193
+ // componentDidUpdate
194
+ useEffect(function () {
195
+ if (!visible) {
196
+ setRootWidthInEmbedMode(0);
197
+ return;
198
+ }
199
+ var tempState = getDefaultEmbedState();
200
+ setDialogWidth(tempState.width);
201
+ setDialogHeight(tempState.height);
202
+ setDialogLeft(tempState.left);
203
+ setDialogTop(tempState.top);
204
+ setRootWidthInEmbedMode(tempState.width);
205
+ }, [visible, clientWidth, clientHeight, getDefaultEmbedState, setRootWidthInEmbedMode]);
206
+ useEffect(function () {
207
+ if (isEmbed) {
208
+ setMinimize(false);
209
+ setMaximization(true);
210
+ } else {
211
+ setMinimize(false);
212
+ setMaximization(false);
213
+ if (height) setDialogHeight(height);
214
+ if (width) setDialogWidth(width);
215
+ if (top !== undefined) setDialogTop(top);
216
+ if (left !== undefined) setDialogLeft(left);
217
+ }
218
+ }, [isEmbed, height, width, top, left]);
219
+
220
+ // Drag handlers
221
+ var onDragStart = function onDragStart(event) {
222
+ if (!draggable) return;
223
+ if (maximization) return;
224
+ setMask(true);
225
+ if (dialogLeft === undefined) {
226
+ setDialogLeft(DEFAULT_LEFT);
227
+ }
228
+ if (dialogTop === undefined) {
229
+ setDialogTop(DEFAULT_TOP);
230
+ }
231
+ clientXRef.current = event.clientX;
232
+ clientYRef.current = event.clientY;
233
+ isPointDownRef.current = true;
234
+ };
235
+ var onDragMove = function onDragMove(event) {
236
+ if (!draggable || !isPointDownRef.current) return;
237
+ event.preventDefault();
238
+ setMoveX(event.clientX - clientXRef.current);
239
+ setMoveY(event.clientY - clientYRef.current);
240
+ };
241
+ var onDragEnd = function onDragEnd() {
242
+ if (!draggable) return;
243
+ isPointDownRef.current = false;
244
+ if (moveX === 0 && moveY === 0) return;
245
+ setMask(false);
246
+ setDialogLeft(function (prev) {
247
+ return (prev !== null && prev !== void 0 ? prev : 0) + moveX;
176
248
  });
177
- _defineProperty(_assertThisInitialized(_this), "compatClonedModel", function (model) {
178
- return _objectSpread({
179
- left: DEFAULT_LEFT,
180
- top: DEFAULT_TOP,
181
- width: DEFAULT_WIDTH_MEMBER / _this.props.clientWidth,
182
- height: DEFAULT_HEIGHT_MEMBER / _this.props.clientHeight,
183
- minimize: false,
184
- maximization: false
185
- }, model);
186
- });
187
- _defineProperty(_assertThisInitialized(_this), "detectPointUp", function () {
188
- _this.setState({
189
- mask: false
190
- });
191
- });
192
- _defineProperty(_assertThisInitialized(_this), "originInfo", void 0);
193
- _defineProperty(_assertThisInitialized(_this), "setRootWidthInEmbedMode", function (newWidth) {
194
- var setRootWidth = _this.props.setRootWidth;
195
- var restWidth = !!newWidth ? newWidth + SCROLL_BAR_WIDTH : 0;
196
- var rootWidth = (_this.props.clientWidth - restWidth) / _this.props.clientWidth;
197
- setRootWidth === null || setRootWidth === void 0 || setRootWidth("".concat(rootWidth * 100, "%"));
249
+ setDialogTop(function (prev) {
250
+ return (prev !== null && prev !== void 0 ? prev : 0) + moveY;
198
251
  });
199
- _defineProperty(_assertThisInitialized(_this), "onResizeStart", function () {
200
- if (_this.state.minimize || !_this.props.resizable) return;
201
- _this.originInfo = _this.compatClonedModel(_this.state);
202
- _this.setState({
203
- mask: true
204
- });
252
+ setMoveX(0);
253
+ setMoveY(0);
254
+ };
255
+ var detectPointUp = function detectPointUp() {
256
+ setMask(false);
257
+ };
258
+
259
+ // Resize handlers
260
+ var onResizeStart = function onResizeStart() {
261
+ if (minimize || !resizable) return;
262
+ originInfoRef.current = compatClonedModel({
263
+ width: dialogWidth,
264
+ height: dialogHeight,
265
+ left: dialogLeft,
266
+ top: dialogTop,
267
+ minimize: minimize,
268
+ maximization: maximization
205
269
  });
206
- _defineProperty(_assertThisInitialized(_this), "onResizeMove", function (event) {
207
- var resizable = _this.props.resizable;
208
- event.preventDefault();
209
- if (_this.state.minimize || !resizable) return;
210
- // 以下PointerEvent没有moveRight属性,通过event传递,所以加上了ts-ignore
270
+ setMask(true);
271
+ };
272
+ var onResizeMove = function onResizeMove(event) {
273
+ event.preventDefault();
274
+ if (minimize || !resizable) return;
275
+ // @ts-ignore
276
+ var newWidth = originInfoRef.current.width + event.moveRight;
277
+ // @ts-ignore
278
+ var newHeight = originInfoRef.current.height + event.moveBottom;
279
+ var checkResult = checkSize(newWidth, newHeight);
280
+ if (checkResult.widthShouldChange) {
281
+ setRootWidthInEmbedMode(newWidth);
282
+ }
283
+ if (checkResult.widthShouldChange) {
211
284
  // @ts-ignore
212
- var newWidth = _this.originInfo.width + event.moveRight;
285
+ setDialogLeft(originInfoRef.current.left + event.moveLeft);
286
+ setDialogWidth(newWidth);
287
+ }
288
+ if (checkResult.heightShouldChange) {
213
289
  // @ts-ignore
214
- var newHeight = _this.originInfo.height + event.moveBottom;
215
- var checkResult = _this.checkSize(newWidth, newHeight);
290
+ setDialogTop(originInfoRef.current.top + event.moveTop);
291
+ setDialogHeight(newHeight);
292
+ }
293
+ };
294
+ var onResizeEnd = function onResizeEnd() {
295
+ if (!mask || !resizable) return;
296
+ setMask(false);
297
+ };
216
298
 
217
- // 只在宽度允许发生改变时设置外部width
218
- if (checkResult.widthShouldChange) {
219
- _this.setRootWidthInEmbedMode(newWidth);
220
- }
221
- _this.setState(_objectSpread(_objectSpread({}, checkResult.widthShouldChange ? {
222
- // @ts-ignore
223
- left: _this.originInfo.left + event.moveLeft,
224
- width: newWidth
225
- } : {}), checkResult.heightShouldChange ? {
226
- // @ts-ignore
227
- top: _this.originInfo.top + event.moveTop,
228
- height: newHeight
229
- } : {}));
299
+ // Toggle handlers
300
+ var toggleMinimize = function toggleMinimize() {
301
+ setMaximization(false);
302
+ setMinimize(function (prev) {
303
+ return !prev;
230
304
  });
231
- _defineProperty(_assertThisInitialized(_this), "onResizeEnd", function () {
232
- var mask = _this.state.mask;
233
- if (!mask || !_this.props.resizable) return;
234
- _this.setState({
235
- mask: false
236
- });
305
+ };
306
+ var toggleMaximization = function toggleMaximization() {
307
+ var enable = resizable && enableMaximization && !isEmbed;
308
+ if (!enable) return;
309
+ setMaximization(function (prev) {
310
+ return !prev;
237
311
  });
238
- return _this;
239
- }
240
- _createClass(DialogComp, [{
241
- key: "componentDidMount",
242
- value: function componentDidMount() {
243
- DialogComp.container.appendChild(this.host);
312
+ setMinimize(false);
313
+ };
314
+ var handleClose = function handleClose(event) {
315
+ event.stopPropagation();
316
+ onClose === null || onClose === void 0 || onClose();
317
+ };
318
+
319
+ // Style calculations
320
+ var getBaseStyle = useCallback(function () {
321
+ return {
322
+ visibility: visible ? 'visible' : 'hidden',
323
+ opacity: visible ? 1 : 0
324
+ };
325
+ }, [visible]);
326
+ var getCompatAbsPostion = useCallback(function (info) {
327
+ var compatInfo = compatClonedModel(info);
328
+ var isMinimize = compatInfo.minimize;
329
+ var ret = {};
330
+ ['left', 'width', 'top', 'height'].forEach(function (key) {
331
+ ret[key] = compatInfo[key];
332
+ });
333
+
334
+ // Apply min/max constraints
335
+ if (maxSize && ret.width > maxSize[0]) {
336
+ ret.width = maxSize[0];
244
337
  }
245
- }, {
246
- key: "componentDidUpdate",
247
- value: function componentDidUpdate(prevProps, _) {
248
- var preVisible = prevProps.visible,
249
- preClientWidth = prevProps.clientWidth,
250
- preClientHeight = prevProps.clientHeight,
251
- preIsEmbed = prevProps.isEmbed;
252
- var _this$props3 = this.props,
253
- visible = _this$props3.visible,
254
- isEmbed = _this$props3.isEmbed,
255
- clientWidth = _this$props3.clientWidth,
256
- clientHeight = _this$props3.clientHeight,
257
- height = _this$props3.height,
258
- width = _this$props3.width,
259
- top = _this$props3.top,
260
- left = _this$props3.left;
261
- // 嵌入式切换非嵌入式,属性重置
262
- if (preIsEmbed && !isEmbed) {
263
- this.setRootWidthInEmbedMode(0);
264
- this.setState(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
265
- minimize: false,
266
- maximization: false
267
- }, height ? {
268
- height: height
269
- } : {}), width ? {
270
- width: width
271
- } : {}), top ? {
272
- top: top
273
- } : {}), left ? {
274
- left: left
275
- } : {}));
276
- return;
277
- }
278
- // 非嵌入式切换嵌入式,属性重置
279
- if (!preIsEmbed && isEmbed) {
280
- this.setState({
281
- minimize: false,
282
- maximization: true
283
- });
284
- }
285
- if (visible) {
286
- if (!preVisible || clientWidth !== preClientWidth || clientHeight !== preClientHeight) {
287
- var tempState = this.getDefaultEmbedState();
288
- this.setState(tempState);
289
- this.setRootWidthInEmbedMode(tempState === null || tempState === void 0 ? void 0 : tempState.width);
290
- }
291
- } else if (preVisible && !visible) {
292
- this.setRootWidthInEmbedMode(0);
293
- }
338
+ if (maxSize && ret.height > maxSize[1]) {
339
+ ret.height = maxSize[1];
294
340
  }
295
- }, {
296
- key: "componentWillUnmount",
297
- value: function componentWillUnmount() {
298
- DialogComp.container.removeChild(this.host);
341
+ if (minSize && ret.width < minSize[0]) {
342
+ ret.width = minSize[0];
299
343
  }
300
- }, {
301
- key: "max",
302
- get: function get() {
303
- var max = this.props.max;
304
- if (!max) {
305
- var _this$props4 = this.props,
306
- clientWidth = _this$props4.clientWidth,
307
- clientHeight = _this$props4.clientHeight;
308
- max = [clientWidth, clientHeight];
309
- }
310
- return max;
344
+ if (minSize && ret.height < minSize[1]) {
345
+ ret.height = minSize[1];
311
346
  }
312
- }, {
313
- key: "min",
314
- get: function get() {
315
- return this.props.min;
347
+ ret.width = isMinimize ? MINIMIZE_WIDTH : ret.width;
348
+ ret.height = isMinimize ? MINIMIZE_HEIGHT : ret.height;
349
+
350
+ // Adjust position if out of bounds (calculate but don't setState here)
351
+ if (ret.left + ret.width > clientWidth) {
352
+ ret.left = clientWidth - ret.width;
316
353
  }
317
- }, {
318
- key: "hasMask",
319
- get: function get() {
320
- return this.state.mask;
354
+ if (ret.left < 0) {
355
+ ret.left = 0;
321
356
  }
322
- }, {
323
- key: "renderHeader",
324
- value: function renderHeader() {
325
- var _this$props5 = this.props,
326
- locale = _this$props5.locale,
327
- title = _this$props5.title,
328
- isEmbed = _this$props5.isEmbed;
329
- var _this$state2 = this.state,
330
- headerStyle = _this$state2.headerStyle,
331
- minimize = _this$state2.minimize;
332
- var style = _objectSpread(_objectSpread(_objectSpread({}, headerStyle), minimize ? {
333
- boxShadow: '0 2px 20px 0 rgba(4, 1, 30, 0.07)'
334
- } : {}), isEmbed ? {
335
- cursor: 'initial'
336
- } : {});
337
- return /*#__PURE__*/_jsxs("header", {
338
- className: "".concat(prefix, "-header"),
339
- style: style,
340
- onPointerDown: this.onDragStart,
341
- onDoubleClick: this.toggleMaximization,
342
- children: [/*#__PURE__*/_jsx("span", {
343
- className: "".concat(prefix, "-title"),
344
- children: title || locale.helpDocument
345
- }), this.renderControls()]
346
- });
357
+ if (ret.top < 0) {
358
+ ret.top = 0;
347
359
  }
348
- }, {
349
- key: "renderControlLink",
350
- value: function renderControlLink() {
351
- var extLink = this.props.extLink;
352
- return /*#__PURE__*/_jsx("span", {
353
- className: "".concat(prefix, "-item"),
354
- children: /*#__PURE__*/_jsx("a", {
355
- className: "".concat(prefix, "-item-link"),
356
- href: extLink === null || extLink === void 0 ? void 0 : extLink.link,
357
- target: "_blank",
358
- rel: "noopener noreferrer",
359
- children: /*#__PURE__*/_jsx("svg", {
360
- // t="1679557306532"
361
- className: "icon",
362
- viewBox: "0 0 1024 1024",
363
- version: "1.1",
364
- xmlns: "http://www.w3.org/2000/svg"
365
- // p-id="2545"
366
- ,
367
- width: "16",
368
- height: "16",
369
- children: /*#__PURE__*/_jsx("path", {
370
- 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"
371
- // p-id="2546"
372
- })
373
- })
374
- })
375
- });
360
+ if (ret.top + ret.height > clientHeight) {
361
+ ret.top = clientHeight - ret.height;
376
362
  }
377
- }, {
378
- key: "renderControls",
379
- value: function renderControls() {
380
- var _this$state3 = this.state,
381
- maximization = _this$state3.maximization,
382
- minimize = _this$state3.minimize;
383
- var _this$props6 = this.props,
384
- enableMaximization = _this$props6.enableMaximization,
385
- isEmbed = _this$props6.isEmbed;
386
- if (isEmbed) {
387
- return /*#__PURE__*/_jsxs("span", {
388
- className: "".concat(prefix, "-controls"),
389
- children: [this.renderControlLink(), /*#__PURE__*/_jsx("span", {
390
- className: "".concat(prefix, "-item"),
391
- onClick: this.onClose,
392
- children: /*#__PURE__*/_jsx(CloseOutlined, {})
393
- })]
394
- });
395
- }
396
- return /*#__PURE__*/_jsxs("span", {
397
- className: "".concat(prefix, "-controls"),
398
- children: [this.renderControlLink(), /*#__PURE__*/_jsx("span", {
399
- className: "".concat(prefix, "-item"),
400
- onClick: this.toggleMinimize,
401
- children: minimize ? /*#__PURE__*/_jsx(ExpandAltOutlined, {}) : /*#__PURE__*/_jsx(MinusOutlined, {})
402
- }), enableMaximization && /*#__PURE__*/_jsx("span", {
403
- className: "".concat(prefix, "-item"),
404
- onClick: this.toggleMaximization,
405
- children: maximization ? /*#__PURE__*/_jsx(FullscreenExitOutlined, {}) : /*#__PURE__*/_jsx(FullscreenOutlined, {})
406
- }), /*#__PURE__*/_jsx("span", {
407
- className: "".concat(prefix, "-item"),
408
- onClick: this.onClose,
409
- children: /*#__PURE__*/_jsx(CloseOutlined, {})
410
- })]
411
- });
363
+ return ret;
364
+ }, [maxSize, minSize, clientWidth, clientHeight, compatClonedModel]);
365
+
366
+ // Adjust position if out of bounds
367
+ useEffect(function () {
368
+ if (!visible) return;
369
+ var adjusted = getCompatAbsPostion({
370
+ width: dialogWidth,
371
+ height: dialogHeight,
372
+ left: dialogLeft,
373
+ top: dialogTop,
374
+ minimize: minimize
375
+ });
376
+ if (adjusted.left !== dialogLeft) {
377
+ setDialogLeft(adjusted.left);
412
378
  }
413
- }, {
414
- key: "renderContent",
415
- value: function renderContent() {
416
- var children = this.props.children;
417
- return /*#__PURE__*/_jsxs("main", {
418
- className: "".concat(prefix, "-main"),
419
- style: this.state.minimize ? {
420
- visibility: 'hidden'
421
- } : {},
422
- children: [this.renderMask(), children]
423
- });
379
+ if (adjusted.top !== dialogTop) {
380
+ setDialogTop(adjusted.top);
424
381
  }
425
- }, {
426
- key: "renderMask",
427
- value: function renderMask() {
428
- if (!this.hasMask) return;
429
- return /*#__PURE__*/_jsx("div", {
430
- className: "".concat(prefix, "-mask")
382
+ }, [dialogWidth, dialogHeight, dialogLeft, dialogTop, minimize, visible, getCompatAbsPostion]);
383
+ var getStyle = useMemo(function () {
384
+ var transform = "translate(".concat(moveX, "px, ").concat(moveY, "px)");
385
+ var baseStyle = getBaseStyle();
386
+ if (maximization && !isEmbed) {
387
+ return _objectSpread(_objectSpread({}, baseStyle), {}, {
388
+ top: 0,
389
+ bottom: 0,
390
+ right: 0,
391
+ width: width || DEFAULT_WIDTH_MEMBER,
392
+ height: 'auto',
393
+ borderRadius: 0
431
394
  });
432
- }
433
- }, {
434
- key: "getCompatAbsPostion",
435
- value:
436
- // 将比例转换为绝对数值,各个端的渲染依据视口大小会有不同
437
- function getCompatAbsPostion(info) {
438
- var compatInfo = this.compatClonedModel(info);
439
- var minimize = compatInfo.minimize;
440
- var _this$props7 = this.props,
441
- clientWidth = _this$props7.clientWidth,
442
- clientHeight = _this$props7.clientHeight;
443
- var ret = {};
444
- ['left', 'width', 'top', 'height'].forEach(function (key) {
445
- ret[key] = compatInfo[key];
395
+ } else if (minimize) {
396
+ var _ref = headerStyle,
397
+ headerHeight = _ref.height;
398
+ var position = getCompatAbsPostion({
399
+ width: dialogWidth,
400
+ height: dialogHeight,
401
+ left: dialogLeft,
402
+ top: dialogTop,
403
+ minimize: minimize
446
404
  });
447
- var max = this.max;
448
- var min = this.min;
449
- // 最小宽度
450
- if (max && ret.width > max[0]) {
451
- ret.width = max[0];
452
- }
453
- if (max && ret.height > max[1]) {
454
- ret.height = max[1];
455
- }
456
- if (min && ret.width < min[0]) {
457
- ret.width = min[0];
458
- }
459
- if (min && ret.height < min[1]) {
460
- ret.height = min[1];
461
- }
462
- ret.width = minimize ? MINIMIZE_WIDTH : ret.width;
463
- ret.height = minimize ? MINIMIZE_HEIGHT : ret.height;
464
- if (ret.left + ret.width > clientWidth) {
465
- ret.left = clientWidth - ret.width;
466
- this.setState({
467
- left: ret.left
468
- });
469
- }
470
- if (ret.left < 0) {
471
- this.setState({
472
- left: 0
473
- });
474
- }
475
- if (ret.top < 0) {
476
- this.setState({
477
- top: 0
478
- });
479
- }
480
- if (ret.top + ret.height > clientHeight) {
481
- ret.top = clientHeight - ret.height;
482
- this.setState({
483
- top: ret.top
484
- });
485
- }
486
- return ret;
487
- }
488
- }, {
489
- key: "renderDialog",
490
- value: function renderDialog() {
491
- var style = this.getStyle();
492
- var _this$props8 = this.props,
493
- className = _this$props8.className,
494
- isEmbed = _this$props8.isEmbed;
495
- return /*#__PURE__*/_jsx(React.Fragment, {
496
- children: /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
497
- className: "".concat(prefix, "-container ").concat(className, " ").concat(isEmbed ? "".concat(prefix, "-container-embed") : ''),
498
- style: style
499
- }, this.state.minimize ? {} : {
500
- tabIndex: 0
501
- }), {}, {
502
- children: [this.renderHeader(), this.renderContent(), isEmbed ? this.renderEmbedBorders() : this.renderBorders(), /*#__PURE__*/_jsx(EventProxy, {
503
- onPointerMove: this.onDragMove,
504
- onPointerUp: this.onDragEnd
505
- }), /*#__PURE__*/_jsx(EventProxy, {
506
- onPointerUp: this.detectPointUp
507
- })]
508
- }))
405
+ return _objectSpread(_objectSpread(_objectSpread({}, baseStyle), position), {}, {
406
+ width: MINIMIZE_WIDTH,
407
+ height: headerHeight || MINIMIZE_HEIGHT,
408
+ transform: transform
509
409
  });
510
- }
511
- }, {
512
- key: "checkSize",
513
- value:
514
- /**
515
- * width,height 是否在最大最小值的范围内
516
- */
517
- function checkSize(width, height) {
518
- var max = this.max;
519
- var min = this.min;
520
- var newModel = {};
521
- var result = {
522
- widthShouldChange: true,
523
- heightShouldChange: true
524
- };
525
- if (min && width < min[0]) {
526
- newModel.width = min[0];
527
- result.widthShouldChange = false;
528
- }
529
- if (min && height < min[1]) {
530
- newModel.height = min[1];
531
- result.heightShouldChange = false;
532
- }
533
- if (max && width > max[0]) {
534
- newModel.width = max[0];
535
- result.widthShouldChange = false;
536
- }
537
- if (max && height > max[1]) {
538
- newModel.height = max[1];
539
- result.heightShouldChange = false;
540
- }
541
- return result;
542
- }
543
- }, {
544
- key: "renderEmbedBorders",
545
- value: function renderEmbedBorders() {
546
- return /*#__PURE__*/_jsx(React.Fragment, {
547
- children: /*#__PURE__*/_jsx(Anchor, {
548
- dock: Dock.left,
549
- onStart: this.onResizeStart,
550
- onMove: this.onResizeMove,
551
- onEnd: this.onResizeEnd
552
- })
410
+ } else {
411
+ var _position = getCompatAbsPostion({
412
+ width: dialogWidth,
413
+ height: dialogHeight,
414
+ left: dialogLeft,
415
+ top: dialogTop
416
+ });
417
+ return _objectSpread(_objectSpread(_objectSpread({}, baseStyle), _position), {}, {
418
+ transform: transform
553
419
  });
554
420
  }
555
- }, {
556
- key: "renderBorders",
557
- value: function renderBorders() {
558
- return /*#__PURE__*/_jsxs(React.Fragment, {
559
- children: [/*#__PURE__*/_jsx(Anchor, {
560
- dock: Dock.top,
561
- onStart: this.onResizeStart,
562
- onMove: this.onResizeMove,
563
- onEnd: this.onResizeEnd
564
- }), /*#__PURE__*/_jsx(Anchor, {
565
- dock: Dock.right,
566
- onStart: this.onResizeStart,
567
- onMove: this.onResizeMove,
568
- onEnd: this.onResizeEnd
569
- }), /*#__PURE__*/_jsx(Anchor, {
570
- dock: Dock.bottom,
571
- onStart: this.onResizeStart,
572
- onMove: this.onResizeMove,
573
- onEnd: this.onResizeEnd
574
- }), /*#__PURE__*/_jsx(Anchor, {
575
- dock: Dock.left,
576
- onStart: this.onResizeStart,
577
- onMove: this.onResizeMove,
578
- onEnd: this.onResizeEnd
579
- }), /*#__PURE__*/_jsx(Anchor, {
580
- dock: Dock.topLeft,
581
- onStart: this.onResizeStart,
582
- onMove: this.onResizeMove,
583
- onEnd: this.onResizeEnd
584
- }), /*#__PURE__*/_jsx(Anchor, {
585
- dock: Dock.topRight,
586
- onStart: this.onResizeStart,
587
- onMove: this.onResizeMove,
588
- onEnd: this.onResizeEnd
589
- }), /*#__PURE__*/_jsx(Anchor, {
590
- dock: Dock.bottomLeft,
591
- onStart: this.onResizeStart,
592
- onMove: this.onResizeMove,
593
- onEnd: this.onResizeEnd
594
- }), /*#__PURE__*/_jsx(Anchor, {
595
- dock: Dock.bottomRight,
596
- onStart: this.onResizeStart,
597
- onMove: this.onResizeMove,
598
- onEnd: this.onResizeEnd
421
+ }, [maximization, isEmbed, minimize, moveX, moveY, width, headerStyle, dialogWidth, dialogHeight, dialogLeft, dialogTop, getCompatAbsPostion, getBaseStyle]);
422
+
423
+ // Render methods
424
+ var renderControlLink = function renderControlLink() {
425
+ return /*#__PURE__*/_jsx("span", {
426
+ className: "".concat(prefixCls, "-item"),
427
+ children: /*#__PURE__*/_jsx("a", {
428
+ className: "".concat(prefixCls, "-item-link"),
429
+ href: extLink === null || extLink === void 0 ? void 0 : extLink.link,
430
+ target: "_blank",
431
+ rel: "noopener noreferrer",
432
+ children: /*#__PURE__*/_jsx("svg", {
433
+ className: "icon",
434
+ viewBox: "0 0 1024 1024",
435
+ version: "1.1",
436
+ xmlns: "http://www.w3.org/2000/svg",
437
+ width: "16",
438
+ height: "16",
439
+ children: /*#__PURE__*/_jsx("path", {
440
+ 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"
441
+ })
442
+ })
443
+ })
444
+ });
445
+ };
446
+ var renderControls = function renderControls() {
447
+ if (isEmbed) {
448
+ return /*#__PURE__*/_jsxs("span", {
449
+ className: "".concat(prefixCls, "-controls"),
450
+ children: [renderControlLink(), /*#__PURE__*/_jsx("span", {
451
+ className: "".concat(prefixCls, "-item"),
452
+ onClick: handleClose,
453
+ children: /*#__PURE__*/_jsx(CloseOutlined, {})
599
454
  })]
600
455
  });
601
456
  }
602
- }, {
603
- key: "render",
604
- value: function render() {
605
- var _this$props9 = this.props,
606
- visible = _this$props9.visible,
607
- isEmbed = _this$props9.isEmbed;
608
- // 嵌入模式通过style控制显隐
609
- if (!visible && !isEmbed) return /*#__PURE__*/_jsx(React.Fragment, {});
610
- return /*#__PURE__*/createPortal(this.renderDialog(), DialogComp.container);
611
- }
612
- }], [{
613
- key: "container",
614
- get: function get() {
615
- if (!this._container) {
616
- this._container = document.createElement('div');
617
- document.body.appendChild(this._container);
618
- }
619
- return this._container;
620
- }
621
- }]);
622
- return DialogComp;
623
- }(React.PureComponent);
624
- _defineProperty(DialogComp, "defaultProps", {
625
- min: DEFAULT_MIN,
626
- resizable: true,
627
- draggable: true,
628
- enableMaximization: true,
629
- isEmbed: false
630
- });
631
- _defineProperty(DialogComp, "_container", void 0);
457
+ return /*#__PURE__*/_jsxs("span", {
458
+ className: "".concat(prefixCls, "-controls"),
459
+ children: [renderControlLink(), /*#__PURE__*/_jsx("span", {
460
+ className: "".concat(prefixCls, "-item"),
461
+ onClick: toggleMinimize,
462
+ children: minimize ? /*#__PURE__*/_jsx(ExpandAltOutlined, {}) : /*#__PURE__*/_jsx(MinusOutlined, {})
463
+ }), enableMaximization && /*#__PURE__*/_jsx("span", {
464
+ className: "".concat(prefixCls, "-item"),
465
+ onClick: toggleMaximization,
466
+ children: maximization ? /*#__PURE__*/_jsx(FullscreenExitOutlined, {}) : /*#__PURE__*/_jsx(FullscreenOutlined, {})
467
+ }), /*#__PURE__*/_jsx("span", {
468
+ className: "".concat(prefixCls, "-item"),
469
+ onClick: handleClose,
470
+ children: /*#__PURE__*/_jsx(CloseOutlined, {})
471
+ })]
472
+ });
473
+ };
474
+ var renderHeader = function renderHeader() {
475
+ var headerStyleObj = _objectSpread(_objectSpread(_objectSpread({}, headerStyle), minimize ? {
476
+ boxShadow: '0 2px 20px 0 rgba(4, 1, 30, 0.07)'
477
+ } : {}), isEmbed ? {
478
+ cursor: 'initial'
479
+ } : {});
480
+ return /*#__PURE__*/_jsxs("header", {
481
+ className: "".concat(prefixCls, "-header"),
482
+ style: headerStyleObj,
483
+ onPointerDown: onDragStart,
484
+ onDoubleClick: toggleMaximization,
485
+ children: [/*#__PURE__*/_jsx("span", {
486
+ className: "".concat(prefixCls, "-title"),
487
+ children: title || (locale === null || locale === void 0 ? void 0 : locale.helpDocument)
488
+ }), renderControls()]
489
+ });
490
+ };
491
+ var renderMask = function renderMask() {
492
+ if (!mask) return null;
493
+ return /*#__PURE__*/_jsx("div", {
494
+ className: "".concat(prefixCls, "-mask")
495
+ });
496
+ };
497
+ var renderContent = function renderContent() {
498
+ return /*#__PURE__*/_jsxs("main", {
499
+ className: "".concat(prefixCls, "-main"),
500
+ style: minimize ? {
501
+ visibility: 'hidden'
502
+ } : {},
503
+ children: [renderMask(), children]
504
+ });
505
+ };
506
+ var renderEmbedBorders = function renderEmbedBorders() {
507
+ return /*#__PURE__*/_jsx(React.Fragment, {
508
+ children: /*#__PURE__*/_jsx(Anchor, {
509
+ prefixCls: prefixCls,
510
+ dock: Dock.left,
511
+ onStart: onResizeStart,
512
+ onMove: onResizeMove,
513
+ onEnd: onResizeEnd
514
+ })
515
+ });
516
+ };
517
+ var renderBorders = function renderBorders() {
518
+ return /*#__PURE__*/_jsxs(React.Fragment, {
519
+ children: [/*#__PURE__*/_jsx(Anchor, {
520
+ prefixCls: prefixCls,
521
+ dock: Dock.top,
522
+ onStart: onResizeStart,
523
+ onMove: onResizeMove,
524
+ onEnd: onResizeEnd
525
+ }), /*#__PURE__*/_jsx(Anchor, {
526
+ prefixCls: prefixCls,
527
+ dock: Dock.right,
528
+ onStart: onResizeStart,
529
+ onMove: onResizeMove,
530
+ onEnd: onResizeEnd
531
+ }), /*#__PURE__*/_jsx(Anchor, {
532
+ prefixCls: prefixCls,
533
+ dock: Dock.bottom,
534
+ onStart: onResizeStart,
535
+ onMove: onResizeMove,
536
+ onEnd: onResizeEnd
537
+ }), /*#__PURE__*/_jsx(Anchor, {
538
+ prefixCls: prefixCls,
539
+ dock: Dock.left,
540
+ onStart: onResizeStart,
541
+ onMove: onResizeMove,
542
+ onEnd: onResizeEnd
543
+ }), /*#__PURE__*/_jsx(Anchor, {
544
+ prefixCls: prefixCls,
545
+ dock: Dock.topLeft,
546
+ onStart: onResizeStart,
547
+ onMove: onResizeMove,
548
+ onEnd: onResizeEnd
549
+ }), /*#__PURE__*/_jsx(Anchor, {
550
+ prefixCls: prefixCls,
551
+ dock: Dock.topRight,
552
+ onStart: onResizeStart,
553
+ onMove: onResizeMove,
554
+ onEnd: onResizeEnd
555
+ }), /*#__PURE__*/_jsx(Anchor, {
556
+ prefixCls: prefixCls,
557
+ dock: Dock.bottomLeft,
558
+ onStart: onResizeStart,
559
+ onMove: onResizeMove,
560
+ onEnd: onResizeEnd
561
+ }), /*#__PURE__*/_jsx(Anchor, {
562
+ prefixCls: prefixCls,
563
+ dock: Dock.bottomRight,
564
+ onStart: onResizeStart,
565
+ onMove: onResizeMove,
566
+ onEnd: onResizeEnd
567
+ })]
568
+ });
569
+ };
570
+ var renderDialog = function renderDialog() {
571
+ var style = getStyle;
572
+ return wrapSSR( /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
573
+ className: "".concat(prefixCls, "-container ").concat(className || '', " ").concat(isEmbed ? "".concat(prefixCls, "-container-embed") : ''),
574
+ style: style
575
+ }, minimize ? {} : {
576
+ tabIndex: 0
577
+ }), {}, {
578
+ children: [renderHeader(), renderContent(), isEmbed ? renderEmbedBorders() : renderBorders(), /*#__PURE__*/_jsx(EventProxy, {
579
+ onPointerMove: onDragMove,
580
+ onPointerUp: onDragEnd
581
+ }), /*#__PURE__*/_jsx(EventProxy, {
582
+ onPointerUp: detectPointUp
583
+ })]
584
+ })));
585
+ };
586
+
587
+ // 嵌入模式通过style控制显隐
588
+ if (!visible && !isEmbed) return /*#__PURE__*/_jsx(React.Fragment, {});
589
+ return /*#__PURE__*/createPortal(renderDialog(), getContainer());
590
+ };
632
591
  export default LocaleWrapper({
633
592
  componentName: 'Dialog',
634
593
  defaultLocale: zhCN